uikit 3.17.9-dev.73842811 → 3.17.9-dev.77c1d012a

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 (78) hide show
  1. package/CHANGELOG.md +16 -2
  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 +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +2 -2
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +9 -9
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +9 -9
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +2 -2
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +21 -25
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +21 -25
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +6 -6
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +21 -25
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +6 -6
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +4 -4
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +41 -33
  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 +64 -67
  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 +94 -103
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +12 -12
  43. package/src/js/api/component.js +2 -2
  44. package/src/js/api/events.js +1 -6
  45. package/src/js/api/instance.js +5 -5
  46. package/src/js/api/observables.js +2 -2
  47. package/src/js/api/options.js +15 -14
  48. package/src/js/api/props.js +13 -15
  49. package/src/js/components/filter.js +1 -2
  50. package/src/js/components/notification.js +1 -2
  51. package/src/js/components/sortable.js +4 -5
  52. package/src/js/components/tooltip.js +30 -35
  53. package/src/js/core/accordion.js +1 -2
  54. package/src/js/core/drop.js +23 -20
  55. package/src/js/core/dropnav.js +2 -3
  56. package/src/js/core/form-custom.js +5 -5
  57. package/src/js/core/icon.js +5 -6
  58. package/src/js/core/navbar.js +1 -2
  59. package/src/js/core/overflow-auto.js +3 -3
  60. package/src/js/core/scroll.js +1 -2
  61. package/src/js/core/scrollspy-nav.js +1 -2
  62. package/src/js/core/sticky.js +2 -5
  63. package/src/js/core/switcher.js +10 -12
  64. package/src/js/core/tab.js +2 -2
  65. package/src/js/core/toggle.js +3 -5
  66. package/src/js/mixin/animate.js +7 -7
  67. package/src/js/mixin/internal/animate-fade.js +2 -2
  68. package/src/js/mixin/modal.js +4 -6
  69. package/src/js/mixin/slider-drag.js +1 -2
  70. package/src/js/mixin/slider-nav.js +7 -8
  71. package/src/js/mixin/togglable.js +8 -8
  72. package/src/js/util/dimensions.js +4 -4
  73. package/src/js/util/event.js +6 -7
  74. package/src/js/util/lang.js +10 -10
  75. package/src/js/util/position.js +1 -2
  76. package/src/js/util/selector.js +2 -2
  77. package/src/js/util/style.js +2 -2
  78. package/src/js/util/viewport.js +18 -14
@@ -6,7 +6,6 @@ import {
6
6
  on,
7
7
  scrollIntoView,
8
8
  trigger,
9
- within,
10
9
  } from 'uikit-util';
11
10
 
12
11
  export default {
@@ -61,7 +60,7 @@ function clickHandler(e) {
61
60
  }
62
61
 
63
62
  for (const instance of instances) {
64
- if (within(e.target, instance.$el) && isSameSiteAnchor(instance.$el)) {
63
+ if (instance.$el.contains(e.target) && isSameSiteAnchor(instance.$el)) {
65
64
  e.preventDefault();
66
65
  if (window.location.href !== instance.$el.href) {
67
66
  window.history.pushState({}, '', instance.$el.href);
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  $$,
3
- closest,
4
3
  getCoveringElement,
5
4
  getTargetedElement,
6
5
  hasClass,
@@ -35,7 +34,7 @@ export default {
35
34
  links: (_, $el) => $$('a[href*="#"]', $el).filter((el) => el.hash && isSameSiteAnchor(el)),
36
35
 
37
36
  elements({ closest: selector }) {
38
- return this.links.map((el) => closest(el, selector || '*'));
37
+ return this.links.map((el) => el.closest(selector || '*'));
39
38
  },
40
39
  },
41
40
 
@@ -25,7 +25,6 @@ import {
25
25
  toPx,
26
26
  toggleClass,
27
27
  trigger,
28
- within,
29
28
  } from 'uikit-util';
30
29
  import { resize, scroll, viewport } from '../api/observables';
31
30
  import Class from '../mixin/class';
@@ -253,7 +252,7 @@ export default {
253
252
 
254
253
  css(placeholder, { height, width, margin });
255
254
 
256
- if (!within(placeholder, document)) {
255
+ if (!document.contains(placeholder)) {
257
256
  placeholder.hidden = true;
258
257
  }
259
258
  (sticky ? before : after)(this.$el, placeholder);
@@ -456,9 +455,7 @@ function parseProp(value, el, propOffset, padding) {
456
455
  const refElement = value === true ? parent(el) : query(value, el);
457
456
  return (
458
457
  getOffset(refElement).bottom -
459
- (padding && refElement && within(el, refElement)
460
- ? toFloat(css(refElement, 'paddingBottom'))
461
- : 0)
458
+ (padding && refElement?.contains(el) ? toFloat(css(refElement, 'paddingBottom')) : 0)
462
459
  );
463
460
  }
464
461
  }
@@ -2,7 +2,6 @@ import {
2
2
  $$,
3
3
  attr,
4
4
  children,
5
- closest,
6
5
  css,
7
6
  data,
8
7
  endsWith,
@@ -15,7 +14,6 @@ import {
15
14
  queryAll,
16
15
  toArray,
17
16
  toggleClass,
18
- within,
19
17
  } from 'uikit-util';
20
18
  import { generateId } from '../api/instance';
21
19
  import { lazyload, swipe } from '../api/observables';
@@ -61,7 +59,7 @@ export default {
61
59
 
62
60
  children(_, $el) {
63
61
  return children($el).filter((child) =>
64
- this.toggles.some((toggle) => within(toggle, child)),
62
+ this.toggles.some((toggle) => child.contains(toggle)),
65
63
  );
66
64
  },
67
65
  },
@@ -132,14 +130,14 @@ export default {
132
130
  keyCode === keyMap.HOME
133
131
  ? 0
134
132
  : keyCode === keyMap.END
135
- ? 'last'
136
- : (keyCode === keyMap.LEFT && !isVertical) ||
137
- (keyCode === keyMap.UP && isVertical)
138
- ? 'previous'
139
- : (keyCode === keyMap.RIGHT && !isVertical) ||
140
- (keyCode === keyMap.DOWN && isVertical)
141
- ? 'next'
142
- : -1;
133
+ ? 'last'
134
+ : (keyCode === keyMap.LEFT && !isVertical) ||
135
+ (keyCode === keyMap.UP && isVertical)
136
+ ? 'previous'
137
+ : (keyCode === keyMap.RIGHT && !isVertical) ||
138
+ (keyCode === keyMap.DOWN && isVertical)
139
+ ? 'next'
140
+ : -1;
143
141
 
144
142
  if (~i) {
145
143
  e.preventDefault();
@@ -165,7 +163,7 @@ export default {
165
163
  },
166
164
 
167
165
  handler(e) {
168
- if (closest(e.target, 'a,button')) {
166
+ if (e.target.closest('a,button')) {
169
167
  e.preventDefault();
170
168
  this.show(data(e.current, this.attrItem));
171
169
  }
@@ -21,8 +21,8 @@ export default {
21
21
  const cls = hasClass(this.$el, 'uk-tab-left')
22
22
  ? 'uk-tab-left'
23
23
  : hasClass(this.$el, 'uk-tab-right')
24
- ? 'uk-tab-right'
25
- : false;
24
+ ? 'uk-tab-right'
25
+ : false;
26
26
 
27
27
  if (cls) {
28
28
  this.$create('toggle', this.$el, { cls, mode: 'media', media: this.media });
@@ -1,6 +1,5 @@
1
1
  import {
2
2
  attr,
3
- closest,
4
3
  hasAttr,
5
4
  hasClass,
6
5
  includes,
@@ -15,7 +14,6 @@ import {
15
14
  pointerLeave,
16
15
  queryAll,
17
16
  trigger,
18
- within,
19
17
  } from 'uikit-util';
20
18
  import { lazyload } from '../api/observables';
21
19
  import Media from '../mixin/media';
@@ -85,7 +83,7 @@ export default {
85
83
  pointerDown,
86
84
  () => trigger(this.$el, 'blur'),
87
85
  true,
88
- (e) => !within(e.target, this.$el),
86
+ (e) => !this.$el.contains(e.target),
89
87
  );
90
88
 
91
89
  // Prevent initial click to prevent double toggle through focus + click
@@ -163,8 +161,8 @@ export default {
163
161
  let link;
164
162
  if (
165
163
  this._preventClick ||
166
- closest(e.target, 'a[href="#"], a[href=""]') ||
167
- ((link = closest(e.target, 'a[href]')) &&
164
+ e.target.closest('a[href="#"], a[href=""]') ||
165
+ ((link = e.target.closest('a[href]')) &&
168
166
  (!this.isToggled(this.target) ||
169
167
  (link.hash && matches(this.target, link.hash))))
170
168
  ) {
@@ -20,13 +20,13 @@ export default {
20
20
  name === 'fade'
21
21
  ? fade
22
22
  : name === 'delayed-fade'
23
- ? (...args) => fade(...args, 40)
24
- : name
25
- ? slide
26
- : () => {
27
- action();
28
- return Promise.resolve();
29
- };
23
+ ? (...args) => fade(...args, 40)
24
+ : name
25
+ ? slide
26
+ : () => {
27
+ action();
28
+ return Promise.resolve();
29
+ };
30
30
 
31
31
  return animationFn(action, target, this.duration).catch(noop);
32
32
  },
@@ -93,8 +93,8 @@ export default function fade(action, target, duration, stagger = 0) {
93
93
  return hasClass(target, clsLeave)
94
94
  ? waitTransitionend(target).then(enterFn)
95
95
  : hasClass(target, clsEnter)
96
- ? waitTransitionend(target).then(leaveFn).then(enterFn)
97
- : leaveFn().then(enterFn);
96
+ ? waitTransitionend(target).then(leaveFn).then(enterFn)
97
+ : leaveFn().then(enterFn);
98
98
  }
99
99
 
100
100
  function transitionIndex(target, next) {
@@ -18,7 +18,6 @@ import {
18
18
  pointerUp,
19
19
  removeClass,
20
20
  toFloat,
21
- within,
22
21
  } from 'uikit-util';
23
22
  import Class from './class';
24
23
  import Container from './container';
@@ -89,8 +88,7 @@ export default {
89
88
  !defaultPrevented &&
90
89
  hash &&
91
90
  isSameSiteAnchor(current) &&
92
- !within(hash, this.$el) &&
93
- $(hash, document.body)
91
+ !this.$el.contains($(hash))
94
92
  ) {
95
93
  this.hide();
96
94
  } else if (matches(current, this.selClose)) {
@@ -259,7 +257,7 @@ function toMs(time) {
259
257
 
260
258
  function preventBackgroundFocus(modal) {
261
259
  return on(document, 'focusin', (e) => {
262
- if (last(active) === modal && !within(e.target, modal.$el)) {
260
+ if (last(active) === modal && !modal.$el.contains(e.target)) {
263
261
  modal.$el.focus();
264
262
  }
265
263
  });
@@ -269,8 +267,8 @@ function listenForBackgroundClose(modal) {
269
267
  return on(document, pointerDown, ({ target }) => {
270
268
  if (
271
269
  last(active) !== modal ||
272
- (modal.overlay && !within(target, modal.$el)) ||
273
- within(target, modal.panel)
270
+ (modal.overlay && !modal.$el.contains(target)) ||
271
+ modal.panel.contains(target)
274
272
  ) {
275
273
  return;
276
274
  }
@@ -1,5 +1,4 @@
1
1
  import {
2
- closest,
3
2
  css,
4
3
  getEventPos,
5
4
  includes,
@@ -57,7 +56,7 @@ export default {
57
56
  if (
58
57
  !this.draggable ||
59
58
  (!isTouch(e) && hasSelectableText(e.target)) ||
60
- closest(e.target, selInput) ||
59
+ e.target.closest(selInput) ||
61
60
  e.button > 0 ||
62
61
  this.length < 2
63
62
  ) {
@@ -4,7 +4,6 @@ import {
4
4
  append,
5
5
  attr,
6
6
  children,
7
- closest,
8
7
  data,
9
8
  empty,
10
9
  isNumeric,
@@ -151,7 +150,7 @@ export default {
151
150
 
152
151
  handler(e) {
153
152
  if (
154
- closest(e.target, 'a,button') &&
153
+ e.target.closest('a,button') &&
155
154
  (e.type === 'click' || e.keyCode === keyMap.SPACE)
156
155
  ) {
157
156
  e.preventDefault();
@@ -184,12 +183,12 @@ export default {
184
183
  keyCode === keyMap.HOME
185
184
  ? 0
186
185
  : keyCode === keyMap.END
187
- ? 'last'
188
- : keyCode === keyMap.LEFT
189
- ? 'previous'
190
- : keyCode === keyMap.RIGHT
191
- ? 'next'
192
- : -1;
186
+ ? 'last'
187
+ : keyCode === keyMap.LEFT
188
+ ? 'previous'
189
+ : keyCode === keyMap.RIGHT
190
+ ? 'next'
191
+ : -1;
193
192
 
194
193
  if (~i) {
195
194
  e.preventDefault();
@@ -64,10 +64,10 @@ export default {
64
64
  isFunction(animate)
65
65
  ? animate
66
66
  : animate === false || !this.hasAnimation
67
- ? toggleInstant
68
- : this.hasTransition
69
- ? toggleTransition
70
- : toggleAnimation
67
+ ? toggleInstant
68
+ : this.hasTransition
69
+ ? toggleTransition
70
+ : toggleAnimation
71
71
  )(el, show, this);
72
72
 
73
73
  const cls = show ? this.clsEnter : this.clsLeave;
@@ -100,10 +100,10 @@ export default {
100
100
  return hasClass(el, this.clsEnter)
101
101
  ? true
102
102
  : hasClass(el, this.clsLeave)
103
- ? false
104
- : this.cls
105
- ? hasClass(el, this.cls.split(' ')[0])
106
- : isVisible(el);
103
+ ? false
104
+ : this.cls
105
+ ? hasClass(el, this.cls.split(' ')[0])
106
+ : isVisible(el);
107
107
  },
108
108
 
109
109
  _toggle(el, toggled) {
@@ -178,10 +178,10 @@ export function toPx(value, property = 'width', element = window, offsetDim = fa
178
178
  unit === 'vh'
179
179
  ? getViewportHeight()
180
180
  : unit === 'vw'
181
- ? width(toWindow(element))
182
- : offsetDim
183
- ? element[`offset${ucfirst(property)}`]
184
- : dimensions(element)[property],
181
+ ? width(toWindow(element))
182
+ : offsetDim
183
+ ? element[`offset${ucfirst(property)}`]
184
+ : dimensions(element)[property],
185
185
  value,
186
186
  )
187
187
  : value;
@@ -1,4 +1,3 @@
1
- import { closest, within } from './filter';
2
1
  import { isArray, isFunction, isString, toNode, toNodes } from './lang';
3
2
  import { findAll } from './selector';
4
3
 
@@ -91,8 +90,8 @@ function delegate(selector, listener) {
91
90
  selector[0] === '>'
92
91
  ? findAll(selector, e.currentTarget)
93
92
  .reverse()
94
- .filter((element) => within(e.target, element))[0]
95
- : closest(e.target, selector);
93
+ .find((element) => element.contains(e.target))
94
+ : e.target.closest(selector);
96
95
 
97
96
  if (current) {
98
97
  e.current = current;
@@ -126,10 +125,10 @@ export function toEventTargets(target) {
126
125
  return isArray(target)
127
126
  ? target.map(toEventTarget).filter(Boolean)
128
127
  : isString(target)
129
- ? findAll(target)
130
- : isEventTarget(target)
131
- ? [target]
132
- : toNodes(target);
128
+ ? findAll(target)
129
+ : isEventTarget(target)
130
+ ? [target]
131
+ : toNodes(target);
133
132
  }
134
133
 
135
134
  export function isTouch(e) {
@@ -95,10 +95,10 @@ export function toBoolean(value) {
95
95
  return isBoolean(value)
96
96
  ? value
97
97
  : value === 'true' || value === '1' || value === ''
98
- ? true
99
- : value === 'false' || value === '0'
100
- ? false
101
- : value;
98
+ ? true
99
+ : value === 'false' || value === '0'
100
+ ? false
101
+ : value;
102
102
  }
103
103
 
104
104
  export function toNumber(value) {
@@ -258,12 +258,12 @@ export function getIndex(i, elements, current = 0, finite = false) {
258
258
  i = isNumeric(i)
259
259
  ? toNumber(i)
260
260
  : i === 'next'
261
- ? current + 1
262
- : i === 'previous'
263
- ? current - 1
264
- : i === 'last'
265
- ? length - 1
266
- : elements.indexOf(toNode(i));
261
+ ? current + 1
262
+ : i === 'previous'
263
+ ? current - 1
264
+ : i === 'last'
265
+ ? length - 1
266
+ : elements.indexOf(toNode(i));
267
267
 
268
268
  if (finite) {
269
269
  return clamp(i, 0, length - 1);
@@ -1,5 +1,4 @@
1
1
  import { offset } from './dimensions';
2
- import { within } from './filter';
3
2
  import { clamp, isArray, ucfirst } from './lang';
4
3
  import { css } from './style';
5
4
  import { offsetViewport, overflowParents } from './viewport';
@@ -169,7 +168,7 @@ function getScrollArea(element, target, viewportOffset, i) {
169
168
  }
170
169
 
171
170
  function commonScrollParents(element, target) {
172
- return overflowParents(target).filter((parent) => within(element, parent));
171
+ return overflowParents(target).filter((parent) => parent.contains(element));
173
172
  }
174
173
 
175
174
  function getIntersectionArea(...rects) {
@@ -1,5 +1,5 @@
1
1
  import { attr } from './attr';
2
- import { closest, index, matches, parent } from './filter';
2
+ import { index, matches, parent } from './filter';
3
3
  import { isDocument, isString, memoize, toNode, toNodes } from './lang';
4
4
 
5
5
  export function query(selector, context) {
@@ -45,7 +45,7 @@ function _query(selector, context = document, queryFn) {
45
45
 
46
46
  if (sel[0] === '!') {
47
47
  const selectors = sel.substr(1).trim().split(' ');
48
- ctx = closest(parent(context), selectors[0]);
48
+ ctx = parent(context).closest(selectors[0]);
49
49
  sel = selectors.slice(1).join(' ').trim();
50
50
  if (!sel.length && split.length === 1) {
51
51
  return ctx;
@@ -44,8 +44,8 @@ export function css(element, property, value, priority) {
44
44
  isNumeric(value) && !cssNumber[property]
45
45
  ? `${value}px`
46
46
  : value || isNumber(value)
47
- ? value
48
- : '',
47
+ ? value
48
+ : '',
49
49
  priority,
50
50
  );
51
51
  }
@@ -1,5 +1,5 @@
1
1
  import { offset, offsetPosition } from './dimensions';
2
- import { isVisible, parent, parents, within } from './filter';
2
+ import { isVisible, parent, parents } from './filter';
3
3
  import {
4
4
  clamp,
5
5
  findIndex,
@@ -199,21 +199,25 @@ export function offsetViewport(scrollElement) {
199
199
  }
200
200
 
201
201
  export function getCoveringElement(target) {
202
- return target.ownerDocument
203
- .elementsFromPoint(offset(target).left, 0)
204
- .find(
205
- (el) =>
206
- !el.contains(target) &&
207
- ((css(el, 'position') === 'fixed' && !hasHigherZIndex(target, el)) ||
208
- (css(el, 'position') === 'sticky' && within(target, parent(el)))),
209
- );
202
+ return target.ownerDocument.elementsFromPoint(offset(target).left, 0).find(
203
+ (el) =>
204
+ !el.contains(target) &&
205
+ ((hasPosition(el, 'fixed') &&
206
+ zIndex(
207
+ parents(target)
208
+ .reverse()
209
+ .find((parent) => !parent.contains(el) && !hasPosition(parent, 'static')),
210
+ ) < zIndex(el)) ||
211
+ (hasPosition(el, 'sticky') && parent(el).contains(target))),
212
+ );
210
213
  }
211
214
 
212
- function hasHigherZIndex(element1, element2) {
213
- return (
214
- parent(element1) === parent(element2) &&
215
- toFloat(css(element1, 'zIndex')) > toFloat(css(element2, 'zIndex'))
216
- );
215
+ function zIndex(element) {
216
+ return toFloat(css(element, 'zIndex'));
217
+ }
218
+
219
+ function hasPosition(element, position) {
220
+ return css(element, 'position') === position;
217
221
  }
218
222
 
219
223
  function scrollingElement(element) {