uikit 3.13.9 → 3.13.11-dev.1296bb84c

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 (102) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/build/build.js +4 -1
  3. package/dist/css/uikit-core-rtl.css +49 -8
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +49 -8
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +49 -6
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +49 -6
  10. package/dist/css/uikit.min.css +1 -1
  11. package/dist/js/components/countdown.js +1 -1
  12. package/dist/js/components/countdown.min.js +1 -1
  13. package/dist/js/components/filter.js +1 -1
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +7 -3
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +7 -3
  18. package/dist/js/components/lightbox.min.js +1 -1
  19. package/dist/js/components/notification.js +1 -1
  20. package/dist/js/components/notification.min.js +1 -1
  21. package/dist/js/components/parallax.js +21 -12
  22. package/dist/js/components/parallax.min.js +1 -1
  23. package/dist/js/components/slider-parallax.js +21 -12
  24. package/dist/js/components/slider-parallax.min.js +1 -1
  25. package/dist/js/components/slider.js +2 -2
  26. package/dist/js/components/slider.min.js +1 -1
  27. package/dist/js/components/slideshow-parallax.js +21 -12
  28. package/dist/js/components/slideshow-parallax.min.js +1 -1
  29. package/dist/js/components/slideshow.js +1 -1
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +2 -2
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +62 -30
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +1 -1
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +433 -314
  38. package/dist/js/uikit-core.min.js +1 -1
  39. package/dist/js/uikit-icons.js +1 -1
  40. package/dist/js/uikit-icons.min.js +1 -1
  41. package/dist/js/uikit.js +480 -322
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +1 -1
  44. package/src/js/components/slider.js +1 -1
  45. package/src/js/components/sortable.js +2 -3
  46. package/src/js/components/tooltip.js +38 -3
  47. package/src/js/core/cover.js +27 -14
  48. package/src/js/core/drop.js +40 -17
  49. package/src/js/core/height-match.js +1 -1
  50. package/src/js/core/margin.js +9 -2
  51. package/src/js/core/navbar.js +18 -6
  52. package/src/js/core/scrollspy-nav.js +6 -11
  53. package/src/js/core/sticky.js +58 -22
  54. package/src/js/core/toggle.js +8 -8
  55. package/src/js/mixin/media.js +12 -9
  56. package/src/js/mixin/modal.js +6 -2
  57. package/src/js/mixin/parallax.js +8 -3
  58. package/src/js/mixin/position.js +24 -24
  59. package/src/js/uikit-core.js +0 -4
  60. package/src/js/util/lang.js +34 -42
  61. package/src/js/util/position.js +180 -125
  62. package/src/js/util/viewport.js +42 -22
  63. package/src/less/components/drop.less +0 -1
  64. package/src/less/components/dropdown.less +11 -1
  65. package/src/less/components/icon.less +3 -0
  66. package/src/less/components/nav.less +23 -0
  67. package/src/less/components/navbar.less +26 -2
  68. package/src/less/components/search.less +2 -0
  69. package/src/less/components/sticky.less +8 -3
  70. package/src/less/components/utility.less +1 -0
  71. package/src/less/theme/dropdown.less +4 -0
  72. package/src/less/theme/nav.less +6 -0
  73. package/src/less/theme/navbar.less +4 -0
  74. package/src/less/theme/search.less +6 -0
  75. package/src/scss/components/drop.scss +0 -1
  76. package/src/scss/components/dropdown.scss +11 -1
  77. package/src/scss/components/icon.scss +3 -0
  78. package/src/scss/components/nav.scss +23 -0
  79. package/src/scss/components/navbar.scss +26 -2
  80. package/src/scss/components/search.scss +2 -0
  81. package/src/scss/components/sticky.scss +8 -3
  82. package/src/scss/components/utility.scss +1 -0
  83. package/src/scss/mixins-theme.scss +5 -0
  84. package/src/scss/mixins.scss +5 -0
  85. package/src/scss/theme/dropdown.scss +4 -0
  86. package/src/scss/theme/nav.scss +6 -0
  87. package/src/scss/theme/navbar.scss +4 -0
  88. package/src/scss/theme/search.scss +6 -0
  89. package/src/scss/variables-theme.scss +5 -1
  90. package/src/scss/variables.scss +5 -1
  91. package/tests/alert.html +1 -1
  92. package/tests/animation.html +216 -214
  93. package/tests/drop.html +154 -80
  94. package/tests/dropdown.html +16 -2
  95. package/tests/nav.html +27 -0
  96. package/tests/navbar.html +56 -5
  97. package/tests/parallax.html +5 -5
  98. package/tests/position.html +38 -39
  99. package/tests/sticky-navbar.html +6 -6
  100. package/tests/sticky-parallax.html +29 -13
  101. package/tests/sticky.html +300 -49
  102. package/src/js/core/core.js +0 -25
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.13.9",
5
+ "version": "3.13.11-dev.1296bb84c",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -79,7 +79,7 @@ export default {
79
79
  let left = 0;
80
80
  const sets = [];
81
81
  const width = dimensions(this.list).width;
82
- for (let i in this.slides) {
82
+ for (let i = 0; i < this.slides.length; i++) {
83
83
  const slideWidth = dimensions(this.slides[i]).width;
84
84
 
85
85
  if (left + slideWidth > width) {
@@ -10,14 +10,13 @@ import {
10
10
  css,
11
11
  findIndex,
12
12
  getEventPos,
13
- getViewport,
14
13
  hasTouch,
15
14
  height,
16
15
  index,
17
16
  isEmpty,
18
17
  isInput,
19
18
  off,
20
- offset,
19
+ offsetViewport,
21
20
  on,
22
21
  parent,
23
22
  pointerDown,
@@ -324,7 +323,7 @@ function trackScroll(pos) {
324
323
  .some((scrollEl) => {
325
324
  let { scrollTop: scroll, scrollHeight } = scrollEl;
326
325
 
327
- const { top, bottom, height } = offset(getViewport(scrollEl));
326
+ const { top, bottom, height } = offsetViewport(scrollEl);
328
327
 
329
328
  if (top < y && top + 35 > y) {
330
329
  scroll -= dist;
@@ -6,9 +6,11 @@ import {
6
6
  attr,
7
7
  flipPosition,
8
8
  hasAttr,
9
+ includes,
9
10
  isFocusable,
10
11
  isTouch,
11
12
  matches,
13
+ offset,
12
14
  on,
13
15
  once,
14
16
  pointerDown,
@@ -104,10 +106,12 @@ export default {
104
106
 
105
107
  this.positionAt(this.tooltip, this.$el);
106
108
 
109
+ const [dir, align] = getAlignment(this.tooltip, this.$el, this.pos);
110
+
107
111
  this.origin =
108
- this.getAxis() === 'y'
109
- ? `${flipPosition(this.dir)}-${this.align}`
110
- : `${this.align}-${flipPosition(this.dir)}`;
112
+ this.axis === 'y'
113
+ ? `${flipPosition(dir)}-${align}`
114
+ : `${align}-${flipPosition(dir)}`;
111
115
  });
112
116
 
113
117
  this.toggleElement(this.tooltip, true);
@@ -143,3 +147,34 @@ function makeFocusable(el) {
143
147
  attr(el, 'tabindex', '0');
144
148
  }
145
149
  }
150
+
151
+ function getAlignment(el, target, [dir, align]) {
152
+ const elOffset = offset(el);
153
+ const targetOffset = offset(target);
154
+ const properties = [
155
+ ['left', 'right'],
156
+ ['top', 'bottom'],
157
+ ];
158
+
159
+ for (const props of properties) {
160
+ if (elOffset[props[0]] >= targetOffset[props[1]]) {
161
+ dir = props[1];
162
+ break;
163
+ }
164
+ if (elOffset[props[1]] <= targetOffset[props[0]]) {
165
+ dir = props[0];
166
+ break;
167
+ }
168
+ }
169
+
170
+ const props = includes(properties[0], dir) ? properties[1] : properties[0];
171
+ if (elOffset[props[0]] === targetOffset[props[0]]) {
172
+ align = props[0];
173
+ } else if (elOffset[props[1]] === targetOffset[props[1]]) {
174
+ align = props[1];
175
+ } else {
176
+ align = 'center';
177
+ }
178
+
179
+ return [dir, align];
180
+ }
@@ -26,25 +26,38 @@ export default {
26
26
 
27
27
  update: {
28
28
  read() {
29
- const el = this.$el;
30
- const { offsetHeight: height, offsetWidth: width } =
31
- getPositionedParent(el) || parent(el);
32
- const dim = Dimensions.cover(
33
- {
34
- width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
35
- height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight,
36
- },
37
- {
38
- width: width + (width % 2 ? 1 : 0),
39
- height: height + (height % 2 ? 1 : 0),
40
- }
41
- );
29
+ const { ratio, cover } = Dimensions;
30
+ const { $el, width, height } = this;
31
+
32
+ let dim = { width, height };
42
33
 
43
34
  if (!dim.width || !dim.height) {
35
+ const intrinsic = {
36
+ width: $el.naturalWidth || $el.videoWidth || $el.clientWidth,
37
+ height: $el.naturalHeight || $el.videoHeight || $el.clientHeight,
38
+ };
39
+
40
+ if (dim.width) {
41
+ dim = ratio(intrinsic, 'width', dim.width);
42
+ } else if (height) {
43
+ dim = ratio(intrinsic, 'height', dim.height);
44
+ } else {
45
+ dim = intrinsic;
46
+ }
47
+ }
48
+
49
+ const { offsetHeight: coverHeight, offsetWidth: coverWidth } =
50
+ getPositionedParent($el) || parent($el);
51
+ const coverDim = cover(dim, {
52
+ width: coverWidth + (coverWidth % 2 ? 1 : 0),
53
+ height: coverHeight + (coverHeight % 2 ? 1 : 0),
54
+ });
55
+
56
+ if (!coverDim.width || !coverDim.height) {
44
57
  return false;
45
58
  }
46
59
 
47
- return dim;
60
+ return coverDim;
48
61
  },
49
62
 
50
63
  write({ height, width }) {
@@ -13,7 +13,9 @@ import {
13
13
  isTouch,
14
14
  matches,
15
15
  MouseTracker,
16
+ observeResize,
16
17
  offset,
18
+ offsetViewport,
17
19
  on,
18
20
  once,
19
21
  parent,
@@ -24,6 +26,7 @@ import {
24
26
  pointerUp,
25
27
  query,
26
28
  removeClass,
29
+ scrollParents,
27
30
  toggleClass,
28
31
  within,
29
32
  } from 'uikit-util';
@@ -42,6 +45,7 @@ export default {
42
45
  boundaryAlign: Boolean,
43
46
  delayShow: Number,
44
47
  delayHide: Number,
48
+ display: String,
45
49
  clsDrop: String,
46
50
  },
47
51
 
@@ -52,6 +56,7 @@ export default {
52
56
  boundaryAlign: false,
53
57
  delayShow: 0,
54
58
  delayHide: 800,
59
+ display: null,
55
60
  clsDrop: false,
56
61
  animation: ['uk-animation-fade'],
57
62
  cls: 'uk-open',
@@ -242,13 +247,23 @@ export default {
242
247
  this.hide(false);
243
248
  }
244
249
  }),
245
- on(window, 'resize', () => this.$emit()),
246
- on(
247
- document,
248
- 'scroll',
249
- ({ target }) => target.contains(this.$el) && this.$emit(),
250
- true
251
- ),
250
+
251
+ ...(this.display === 'static'
252
+ ? []
253
+ : (() => {
254
+ const handler = () => this.$emit();
255
+ return [
256
+ on(window, 'resize', handler),
257
+ on(document, 'scroll', handler, true),
258
+ (() => {
259
+ const observer = observeResize(
260
+ scrollParents(this.$el),
261
+ handler
262
+ );
263
+ return () => observer.disconnect();
264
+ })(),
265
+ ];
266
+ })()),
252
267
  ]) {
253
268
  once(this.$el, 'hide', handler, { self: true });
254
269
  }
@@ -359,25 +374,33 @@ export default {
359
374
  },
360
375
 
361
376
  position() {
362
- const boundary = query(this.boundary, this.$el) || window;
363
377
  removeClass(this.$el, `${this.clsDrop}-stack`);
364
378
  toggleClass(this.$el, `${this.clsDrop}-boundary`, this.boundaryAlign);
365
379
 
366
- const boundaryOffset = offset(boundary);
367
- const targetOffset = offset(this.target);
368
- const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
380
+ const boundary = query(this.boundary, this.$el);
381
+ const [scrollParent] = scrollParents(this.$el);
382
+ const scrollParentOffset = offsetViewport(scrollParent);
383
+ const boundaryOffset = boundary ? offset(boundary) : scrollParentOffset;
384
+
385
+ css(this.$el, 'maxWidth', '');
386
+ const maxWidth = scrollParentOffset.width - (boundary ? 0 : 2 * this.viewportPadding);
369
387
 
370
388
  if (this.pos[1] === 'justify') {
371
- const prop = this.getAxis() === 'y' ? 'width' : 'height';
389
+ const prop = this.axis === 'y' ? 'width' : 'height';
390
+ const targetOffset = offset(this.target);
391
+ const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
372
392
  css(this.$el, prop, alignTo[prop]);
373
- } else if (
374
- this.$el.offsetWidth >
375
- Math.max(boundaryOffset.right - alignTo.left, alignTo.right - boundaryOffset.left)
376
- ) {
393
+ } else if (this.$el.offsetWidth > maxWidth) {
377
394
  addClass(this.$el, `${this.clsDrop}-stack`);
378
395
  }
379
396
 
380
- this.positionAt(this.$el, this.boundaryAlign ? boundary : this.target, boundary);
397
+ css(this.$el, 'maxWidth', maxWidth);
398
+
399
+ this.positionAt(
400
+ this.$el,
401
+ boundary && this.boundaryAlign ? boundary : this.target,
402
+ boundary
403
+ );
381
404
  },
382
405
  },
383
406
  };
@@ -30,7 +30,7 @@ export default {
30
30
  },
31
31
 
32
32
  resizeTargets() {
33
- return [this.$el, this.elements];
33
+ return [this.$el, ...this.elements];
34
34
  },
35
35
 
36
36
  update: {
@@ -1,5 +1,12 @@
1
1
  import Resize from '../mixin/resize';
2
- import { isRtl, isVisible, observeMutation, offsetPosition, toggleClass } from 'uikit-util';
2
+ import {
3
+ isRtl,
4
+ isVisible,
5
+ observeMutation,
6
+ offsetPosition,
7
+ toArray,
8
+ toggleClass,
9
+ } from 'uikit-util';
3
10
 
4
11
  export default {
5
12
  mixins: [Resize],
@@ -15,7 +22,7 @@ export default {
15
22
  },
16
23
 
17
24
  resizeTargets() {
18
- return [this.$el, this.$el.children];
25
+ return [this.$el, ...toArray(this.$el.children)];
19
26
  },
20
27
 
21
28
  connected() {
@@ -27,8 +27,6 @@ import {
27
27
  within,
28
28
  } from 'uikit-util';
29
29
 
30
- const navItem = '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle';
31
-
32
30
  export default {
33
31
  mixins: [Class, Container],
34
32
 
@@ -48,7 +46,7 @@ export default {
48
46
  },
49
47
 
50
48
  data: {
51
- dropdown: navItem,
49
+ dropdown: '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle',
52
50
  align: isRtl ? 'right' : 'left',
53
51
  clsDrop: 'uk-navbar-dropdown',
54
52
  mode: undefined,
@@ -134,8 +132,22 @@ export default {
134
132
  immediate: true,
135
133
  },
136
134
 
137
- toggles({ dropdown }, $el) {
138
- return $$(dropdown, $el);
135
+ toggles: {
136
+ get({ dropdown }, $el) {
137
+ return $$(dropdown, $el);
138
+ },
139
+
140
+ watch() {
141
+ const justify = hasClass(this.$el, 'uk-navbar-justify');
142
+ for (const container of $$(
143
+ '.uk-navbar-nav, .uk-navbar-left, .uk-navbar-right',
144
+ this.$el
145
+ )) {
146
+ css(container, 'flexGrow', justify ? $$(this.dropdown, container).length : '');
147
+ }
148
+ },
149
+
150
+ immediate: true,
139
151
  },
140
152
  },
141
153
 
@@ -297,7 +309,7 @@ export default {
297
309
  return this.dropbar;
298
310
  },
299
311
 
300
- handler(_, { $el, dir }) {
312
+ handler(_, { $el, pos: [dir] = [] }) {
301
313
  if (!hasClass($el, this.clsDrop)) {
302
314
  return;
303
315
  }
@@ -2,11 +2,10 @@ import Scroll from '../mixin/scroll';
2
2
  import {
3
3
  $$,
4
4
  closest,
5
- getViewport,
6
- getViewportClientHeight,
7
5
  hasClass,
8
6
  isVisible,
9
7
  offset,
8
+ offsetViewport,
10
9
  scrollParents,
11
10
  toggleClass,
12
11
  trigger,
@@ -65,19 +64,15 @@ export default {
65
64
 
66
65
  const [scrollElement] = scrollParents(targets, /auto|scroll/, true);
67
66
  const { scrollTop, scrollHeight } = scrollElement;
68
- const max = scrollHeight - getViewportClientHeight(scrollElement);
67
+ const viewport = offsetViewport(scrollElement);
68
+ const max = scrollHeight - viewport.height;
69
69
  let active = false;
70
70
 
71
71
  if (scrollTop === max) {
72
72
  active = length - 1;
73
73
  } else {
74
- for (const i in targets) {
75
- if (
76
- offset(targets[i]).top -
77
- offset(getViewport(scrollElement)).top -
78
- this.offset >
79
- 0
80
- ) {
74
+ for (let i = 0; i < targets.length; i++) {
75
+ if (offset(targets[i]).top - viewport.top - this.offset > 0) {
81
76
  break;
82
77
  }
83
78
  active = +i;
@@ -95,7 +90,7 @@ export default {
95
90
  const changed = active !== false && !hasClass(this.elements[active], this.cls);
96
91
 
97
92
  this.links.forEach((el) => el.blur());
98
- for (const i in this.elements) {
93
+ for (let i = 0; i < this.elements.length; i++) {
99
94
  toggleClass(this.elements[i], this.cls, +i === active);
100
95
  }
101
96
 
@@ -10,11 +10,10 @@ import {
10
10
  clamp,
11
11
  css,
12
12
  dimensions,
13
- fastdom,
14
13
  height as getHeight,
15
14
  offset as getOffset,
16
- getScrollingElement,
17
15
  intersectRect,
16
+ isNumeric,
18
17
  isString,
19
18
  isVisible,
20
19
  noop,
@@ -38,8 +37,11 @@ export default {
38
37
  props: {
39
38
  position: String,
40
39
  top: null,
41
- bottom: Boolean,
40
+ bottom: null,
41
+ start: null,
42
+ end: null,
42
43
  offset: String,
44
+ overflowFlip: Boolean,
43
45
  animation: String,
44
46
  clsActive: String,
45
47
  clsInactive: String,
@@ -52,9 +54,12 @@ export default {
52
54
 
53
55
  data: {
54
56
  position: 'top',
55
- top: 0,
57
+ top: false,
56
58
  bottom: false,
59
+ start: false,
60
+ end: false,
57
61
  offset: 0,
62
+ overflowFlip: false,
58
63
  animation: '',
59
64
  clsActive: 'uk-active',
60
65
  clsInactive: '',
@@ -76,6 +81,9 @@ export default {
76
81
  },
77
82
 
78
83
  connected() {
84
+ this.start = coerce(this.start || this.top);
85
+ this.end = coerce(this.end || this.bottom);
86
+
79
87
  this.placeholder =
80
88
  $('+ .uk-sticky-placeholder', this.$el) ||
81
89
  $('<div class="uk-sticky-placeholder"></div>');
@@ -94,6 +102,17 @@ export default {
94
102
  },
95
103
 
96
104
  events: [
105
+ {
106
+ name: 'resize',
107
+
108
+ el() {
109
+ return window;
110
+ },
111
+
112
+ handler() {
113
+ this.$emit('resize');
114
+ },
115
+ },
97
116
  {
98
117
  name: 'load hashchange popstate',
99
118
 
@@ -110,7 +129,7 @@ export default {
110
129
  return;
111
130
  }
112
131
 
113
- fastdom.read(() => {
132
+ setTimeout(() => {
114
133
  const targetOffset = getOffset($(location.hash));
115
134
  const elOffset = getOffset(this.$el);
116
135
 
@@ -119,8 +138,8 @@ export default {
119
138
  window,
120
139
  targetOffset.top -
121
140
  elOffset.height -
122
- toPx(this.targetOffset, 'height') -
123
- toPx(this.offset, 'height')
141
+ toPx(this.targetOffset, 'height', this.placeholder) -
142
+ toPx(this.offset, 'height', this.placeholder)
124
143
  );
125
144
  }
126
145
  });
@@ -150,32 +169,38 @@ export default {
150
169
 
151
170
  if (hide) {
152
171
  this.show();
153
- fastdom.write(() => css(this.selTarget, 'transition', ''));
172
+ requestAnimationFrame(() => css(this.selTarget, 'transition', ''));
154
173
  }
155
174
 
156
175
  const referenceElement = this.isFixed ? this.placeholder : this.$el;
157
176
  const windowHeight = getHeight(window);
158
177
 
159
178
  let position = this.position;
160
- if (position === 'auto' && height > windowHeight) {
161
- position = 'bottom';
179
+ if (this.overflowFlip && height > windowHeight) {
180
+ position = position === 'top' ? 'bottom' : 'top';
162
181
  }
163
182
 
164
183
  let offset = toPx(this.offset, 'height', referenceElement);
165
- if (position === 'bottom') {
184
+ if (position === 'bottom' && (height < windowHeight || this.overflowFlip)) {
166
185
  offset += windowHeight - height;
167
186
  }
168
187
 
169
- const overflow = Math.max(0, height + offset - windowHeight);
188
+ const overflow = this.overflowFlip
189
+ ? 0
190
+ : Math.max(0, height + offset - windowHeight);
170
191
  const topOffset = getOffset(referenceElement).top;
171
192
 
172
- const top = parseProp(this.top, this.$el, topOffset);
173
- const bottom = parseProp(this.bottom, this.$el, topOffset + height, true);
174
-
175
- const start = Math.max(top, topOffset) - offset;
176
- const end = bottom
177
- ? bottom - getOffset(this.$el).height + overflow - offset
178
- : getScrollingElement(this.$el).scrollHeight - windowHeight;
193
+ const start =
194
+ (this.start === false
195
+ ? topOffset
196
+ : parseProp(this.start, this.$el, topOffset)) - offset;
197
+ const end =
198
+ this.end === false
199
+ ? document.scrollingElement.scrollHeight - windowHeight
200
+ : parseProp(this.end, this.$el, topOffset + height, true) -
201
+ getOffset(this.$el).height +
202
+ overflow -
203
+ offset;
179
204
 
180
205
  return {
181
206
  start,
@@ -221,7 +246,9 @@ export default {
221
246
  prevDir,
222
247
  scroll,
223
248
  prevScroll,
224
- offsetParentTop: getOffset(this.$el.offsetParent).top,
249
+ offsetParentTop: getOffset(
250
+ (this.isFixed ? this.placeholder : this.$el).offsetParent
251
+ ).top,
225
252
  overflowScroll: clamp(
226
253
  overflowScroll + clamp(scroll, start, end) - clamp(prevScroll, start, end),
227
254
  0,
@@ -376,8 +403,8 @@ function parseProp(value, el, propOffset, padding) {
376
403
  return 0;
377
404
  }
378
405
 
379
- if (isString(value) && value.match(/^-?\d/)) {
380
- return propOffset + toPx(value);
406
+ if (isNumeric(value) || (isString(value) && value.match(/^-?\d/))) {
407
+ return propOffset + toPx(value, 'height', el, true);
381
408
  } else {
382
409
  const refElement = value === true ? parent(el) : query(value, el);
383
410
  return (
@@ -388,3 +415,12 @@ function parseProp(value, el, propOffset, padding) {
388
415
  );
389
416
  }
390
417
  }
418
+
419
+ function coerce(value) {
420
+ if (value === 'true') {
421
+ return true;
422
+ } else if (value === 'false') {
423
+ return false;
424
+ }
425
+ return value;
426
+ }
@@ -156,15 +156,7 @@ export default {
156
156
  {
157
157
  name: 'click',
158
158
 
159
- filter() {
160
- return includes(this.mode, 'click');
161
- },
162
-
163
159
  handler(e) {
164
- if (this._preventClick) {
165
- return (this._preventClick = null);
166
- }
167
-
168
160
  let link;
169
161
  if (
170
162
  closest(e.target, 'a[href="#"], a[href=""]') ||
@@ -175,6 +167,14 @@ export default {
175
167
  e.preventDefault();
176
168
  }
177
169
 
170
+ if (this._preventClick) {
171
+ return (this._preventClick = null);
172
+ }
173
+
174
+ if (!includes(this.mode, 'click')) {
175
+ return;
176
+ }
177
+
178
178
  this.toggle();
179
179
  },
180
180
  },
@@ -20,16 +20,19 @@ export default {
20
20
 
21
21
  connected() {
22
22
  const media = toMedia(this.media);
23
- this.mediaObj = window.matchMedia(media);
24
- const handler = () => {
25
- this.matchMedia = this.mediaObj.matches;
26
- trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
27
- };
28
- this.offMediaObj = on(this.mediaObj, 'change', () => {
23
+ this.matchMedia = true;
24
+ if (media) {
25
+ this.mediaObj = window.matchMedia(media);
26
+ const handler = () => {
27
+ this.matchMedia = this.mediaObj.matches;
28
+ trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
29
+ };
30
+ this.offMediaObj = on(this.mediaObj, 'change', () => {
31
+ handler();
32
+ this.$emit('resize');
33
+ });
29
34
  handler();
30
- this.$emit('resize');
31
- });
32
- handler();
35
+ }
33
36
  },
34
37
 
35
38
  disconnected() {
@@ -4,6 +4,7 @@ import {
4
4
  append,
5
5
  attr,
6
6
  css,
7
+ endsWith,
7
8
  includes,
8
9
  isFocusable,
9
10
  last,
@@ -15,7 +16,6 @@ import {
15
16
  pointerUp,
16
17
  removeClass,
17
18
  toFloat,
18
- toMs,
19
19
  width,
20
20
  within,
21
21
  } from 'uikit-util';
@@ -245,7 +245,7 @@ function animate({ transitionElement, _toggle }) {
245
245
  return (el, show) =>
246
246
  new Promise((resolve, reject) =>
247
247
  once(el, 'show hide', () => {
248
- el._reject && el._reject();
248
+ el._reject?.();
249
249
  el._reject = reject;
250
250
 
251
251
  _toggle(el, show);
@@ -269,3 +269,7 @@ function animate({ transitionElement, _toggle }) {
269
269
  })
270
270
  ).then(() => delete el._reject);
271
271
  }
272
+
273
+ function toMs(time) {
274
+ return time ? (endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000) : 0;
275
+ }