uikit 3.17.9-dev.9f100be74 → 3.17.9-dev.f43c05fb3

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 (76) hide show
  1. package/CHANGELOG.md +10 -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 +6 -6
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +6 -6
  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 +3 -3
  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 +3 -3
  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 +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 +54 -47
  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 +62 -55
  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/instance.js +2 -2
  45. package/src/js/api/observables.js +2 -2
  46. package/src/js/api/options.js +14 -14
  47. package/src/js/components/filter.js +1 -2
  48. package/src/js/components/notification.js +1 -2
  49. package/src/js/components/sortable.js +4 -5
  50. package/src/js/components/tooltip.js +1 -2
  51. package/src/js/core/accordion.js +1 -2
  52. package/src/js/core/drop.js +23 -20
  53. package/src/js/core/dropnav.js +2 -3
  54. package/src/js/core/form-custom.js +5 -5
  55. package/src/js/core/icon.js +5 -6
  56. package/src/js/core/navbar.js +1 -2
  57. package/src/js/core/overflow-auto.js +3 -3
  58. package/src/js/core/scroll.js +1 -2
  59. package/src/js/core/scrollspy-nav.js +1 -2
  60. package/src/js/core/sticky.js +2 -5
  61. package/src/js/core/switcher.js +10 -12
  62. package/src/js/core/tab.js +2 -2
  63. package/src/js/core/toggle.js +3 -5
  64. package/src/js/mixin/animate.js +7 -7
  65. package/src/js/mixin/internal/animate-fade.js +2 -2
  66. package/src/js/mixin/modal.js +4 -6
  67. package/src/js/mixin/slider-drag.js +1 -2
  68. package/src/js/mixin/slider-nav.js +7 -8
  69. package/src/js/mixin/togglable.js +8 -8
  70. package/src/js/util/dimensions.js +4 -4
  71. package/src/js/util/event.js +6 -7
  72. package/src/js/util/lang.js +10 -10
  73. package/src/js/util/position.js +1 -2
  74. package/src/js/util/selector.js +2 -2
  75. package/src/js/util/style.js +2 -2
  76. package/src/js/util/viewport.js +25 -16
@@ -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,
@@ -70,7 +70,9 @@ export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
70
70
  const scroll = element.scrollTop;
71
71
  const duration = getDuration(Math.abs(top));
72
72
  const start = Date.now();
73
- const targetTop = offset(targetEl).top;
73
+ const isScrollingElement = scrollingElement(element) === element;
74
+ const targetTop = offset(targetEl).top + (isScrollingElement ? 0 : scroll);
75
+
74
76
  let prev = 0;
75
77
  let frames = 15;
76
78
 
@@ -78,7 +80,10 @@ export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
78
80
  const percent = ease(clamp((Date.now() - start) / duration));
79
81
  let diff = 0;
80
82
  if (parents[0] === element && scroll + top < maxScroll) {
81
- diff = offset(targetEl).top - targetTop;
83
+ diff =
84
+ offset(targetEl).top +
85
+ (isScrollingElement ? 0 : element.scrollTop) -
86
+ targetTop;
82
87
  const coverEl = getCoveringElement(targetEl);
83
88
  diff -= coverEl ? offset(coverEl).height : 0;
84
89
  }
@@ -199,21 +204,25 @@ export function offsetViewport(scrollElement) {
199
204
  }
200
205
 
201
206
  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
- );
207
+ return target.ownerDocument.elementsFromPoint(offset(target).left, 0).find(
208
+ (el) =>
209
+ !el.contains(target) &&
210
+ ((hasPosition(el, 'fixed') &&
211
+ zIndex(
212
+ parents(target)
213
+ .reverse()
214
+ .find((parent) => !parent.contains(el) && !hasPosition(parent, 'static')),
215
+ ) < zIndex(el)) ||
216
+ (hasPosition(el, 'sticky') && parent(el).contains(target))),
217
+ );
210
218
  }
211
219
 
212
- function hasHigherZIndex(element1, element2) {
213
- return (
214
- parent(element1) === parent(element2) &&
215
- toFloat(css(element1, 'zIndex')) > toFloat(css(element2, 'zIndex'))
216
- );
220
+ function zIndex(element) {
221
+ return toFloat(css(element, 'zIndex'));
222
+ }
223
+
224
+ function hasPosition(element, position) {
225
+ return css(element, 'position') === position;
217
226
  }
218
227
 
219
228
  function scrollingElement(element) {