uikit 3.13.9 → 3.13.11-dev.3b88fea57

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 (99) hide show
  1. package/CHANGELOG.md +38 -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 +386 -301
  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 +433 -309
  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/drop.js +20 -16
  48. package/src/js/core/navbar.js +18 -6
  49. package/src/js/core/scrollspy-nav.js +6 -11
  50. package/src/js/core/sticky.js +58 -22
  51. package/src/js/core/toggle.js +8 -8
  52. package/src/js/mixin/media.js +12 -9
  53. package/src/js/mixin/modal.js +6 -2
  54. package/src/js/mixin/parallax.js +8 -3
  55. package/src/js/mixin/position.js +24 -24
  56. package/src/js/uikit-core.js +0 -4
  57. package/src/js/util/lang.js +34 -42
  58. package/src/js/util/position.js +177 -125
  59. package/src/js/util/viewport.js +42 -22
  60. package/src/less/components/drop.less +0 -1
  61. package/src/less/components/dropdown.less +11 -1
  62. package/src/less/components/icon.less +3 -0
  63. package/src/less/components/nav.less +23 -0
  64. package/src/less/components/navbar.less +26 -2
  65. package/src/less/components/search.less +2 -0
  66. package/src/less/components/sticky.less +8 -3
  67. package/src/less/components/utility.less +1 -0
  68. package/src/less/theme/dropdown.less +4 -0
  69. package/src/less/theme/nav.less +6 -0
  70. package/src/less/theme/navbar.less +4 -0
  71. package/src/less/theme/search.less +6 -0
  72. package/src/scss/components/drop.scss +0 -1
  73. package/src/scss/components/dropdown.scss +11 -1
  74. package/src/scss/components/icon.scss +3 -0
  75. package/src/scss/components/nav.scss +23 -0
  76. package/src/scss/components/navbar.scss +26 -2
  77. package/src/scss/components/search.scss +2 -0
  78. package/src/scss/components/sticky.scss +8 -3
  79. package/src/scss/components/utility.scss +1 -0
  80. package/src/scss/mixins-theme.scss +5 -0
  81. package/src/scss/mixins.scss +5 -0
  82. package/src/scss/theme/dropdown.scss +4 -0
  83. package/src/scss/theme/nav.scss +6 -0
  84. package/src/scss/theme/navbar.scss +4 -0
  85. package/src/scss/theme/search.scss +6 -0
  86. package/src/scss/variables-theme.scss +5 -1
  87. package/src/scss/variables.scss +5 -1
  88. package/tests/alert.html +1 -1
  89. package/tests/animation.html +216 -214
  90. package/tests/drop.html +129 -80
  91. package/tests/dropdown.html +16 -2
  92. package/tests/nav.html +27 -0
  93. package/tests/navbar.html +56 -5
  94. package/tests/parallax.html +5 -5
  95. package/tests/position.html +38 -39
  96. package/tests/sticky-navbar.html +6 -6
  97. package/tests/sticky-parallax.html +169 -148
  98. package/tests/sticky.html +300 -49
  99. package/src/js/core/core.js +0 -25
@@ -133,10 +133,6 @@ export function toWindow(element) {
133
133
  return document?.defaultView || window;
134
134
  }
135
135
 
136
- export function toMs(time) {
137
- return time ? (endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000) : 0;
138
- }
139
-
140
136
  export function isEqual(value, other) {
141
137
  return (
142
138
  value === other ||
@@ -204,48 +200,44 @@ export function pointInRect(point, rect) {
204
200
  );
205
201
  }
206
202
 
207
- export const Dimensions = {
208
- ratio(dimensions, prop, value) {
209
- const aProp = prop === 'width' ? 'height' : 'width';
210
-
211
- return {
212
- [aProp]: dimensions[prop]
213
- ? Math.round((value * dimensions[aProp]) / dimensions[prop])
214
- : dimensions[aProp],
215
- [prop]: value,
216
- };
217
- },
218
-
219
- contain(dimensions, maxDimensions) {
220
- dimensions = { ...dimensions };
221
-
222
- each(
223
- dimensions,
224
- (_, prop) =>
225
- (dimensions =
226
- dimensions[prop] > maxDimensions[prop]
227
- ? this.ratio(dimensions, prop, maxDimensions[prop])
228
- : dimensions)
229
- );
203
+ function ratio(dimensions, prop, value) {
204
+ const aProp = prop === 'width' ? 'height' : 'width';
230
205
 
231
- return dimensions;
232
- },
206
+ return {
207
+ [aProp]: dimensions[prop]
208
+ ? Math.round((value * dimensions[aProp]) / dimensions[prop])
209
+ : dimensions[aProp],
210
+ [prop]: value,
211
+ };
212
+ }
233
213
 
234
- cover(dimensions, maxDimensions) {
235
- dimensions = this.contain(dimensions, maxDimensions);
214
+ function contain(dimensions, maxDimensions) {
215
+ dimensions = { ...dimensions };
236
216
 
237
- each(
238
- dimensions,
239
- (_, prop) =>
240
- (dimensions =
241
- dimensions[prop] < maxDimensions[prop]
242
- ? this.ratio(dimensions, prop, maxDimensions[prop])
243
- : dimensions)
244
- );
217
+ for (const prop in dimensions) {
218
+ dimensions =
219
+ dimensions[prop] > maxDimensions[prop]
220
+ ? ratio(dimensions, prop, maxDimensions[prop])
221
+ : dimensions;
222
+ }
223
+
224
+ return dimensions;
225
+ }
226
+
227
+ function cover(dimensions, maxDimensions) {
228
+ dimensions = contain(dimensions, maxDimensions);
229
+
230
+ for (const prop in dimensions) {
231
+ dimensions =
232
+ dimensions[prop] < maxDimensions[prop]
233
+ ? ratio(dimensions, prop, maxDimensions[prop])
234
+ : dimensions;
235
+ }
236
+
237
+ return dimensions;
238
+ }
245
239
 
246
- return dimensions;
247
- },
248
- };
240
+ export const Dimensions = { ratio, contain, cover };
249
241
 
250
242
  export function getIndex(i, elements, current = 0, finite = false) {
251
243
  elements = toNodes(elements);
@@ -1,156 +1,208 @@
1
1
  import { offset } from './dimensions';
2
- import { each, endsWith, includes, toFloat } from './lang';
3
- import { getViewport, scrollParents } from './viewport';
4
-
5
- const dirs = {
6
- width: ['x', 'left', 'right'],
7
- height: ['y', 'top', 'bottom'],
8
- };
9
-
10
- export function positionAt(
11
- element,
12
- target,
13
- elAttach,
14
- targetAttach,
15
- elOffset,
16
- targetOffset,
17
- flip,
18
- boundary
19
- ) {
20
- elAttach = getPos(elAttach);
21
- targetAttach = getPos(targetAttach);
22
-
23
- const flipped = { element: elAttach, target: targetAttach };
24
-
25
- if (!element || !target) {
26
- return flipped;
2
+ import { clamp, includes, ucfirst } from './lang';
3
+ import { offsetViewport, scrollParents } from './viewport';
4
+
5
+ const dirs = [
6
+ ['width', 'x', 'left', 'right'],
7
+ ['height', 'y', 'top', 'bottom'],
8
+ ];
9
+
10
+ export function positionAt(element, target, options) {
11
+ options = {
12
+ attach: {
13
+ element: ['left', 'top'],
14
+ target: ['left', 'top'],
15
+ ...options.attach,
16
+ },
17
+ offset: [0, 0],
18
+ ...options,
19
+ };
20
+
21
+ const dim = options.flip
22
+ ? attachToWithFlip(element, target, options)
23
+ : attachTo(element, target, options);
24
+
25
+ offset(element, dim);
26
+ }
27
+
28
+ function attachTo(element, target, options) {
29
+ let { attach, offset: offsetBy } = {
30
+ attach: {
31
+ element: ['left', 'top'],
32
+ target: ['left', 'top'],
33
+ ...options.attach,
34
+ },
35
+ offset: [0, 0],
36
+ ...options,
37
+ };
38
+
39
+ const position = offset(element);
40
+ const targetOffset = offset(target);
41
+ for (const [i, [prop, dir, start, end]] of Object.entries(dirs)) {
42
+ position[start] = position[dir] =
43
+ targetOffset[start] +
44
+ moveBy(attach.target[i], end, targetOffset[prop]) -
45
+ moveBy(attach.element[i], end, position[prop]) +
46
+ +offsetBy[i];
47
+ position[end] = position[start] + position[prop];
27
48
  }
49
+ return position;
50
+ }
28
51
 
29
- const dim = offset(element);
52
+ function attachToWithFlip(element, target, options) {
53
+ const position = attachTo(element, target, options);
30
54
  const targetDim = offset(target);
31
- const position = targetDim;
55
+ const viewports = scrollParents(element);
56
+ const [scrollElement] = viewports;
57
+
58
+ let {
59
+ flip,
60
+ attach: { element: elAttach, target: targetAttach },
61
+ offset: elOffset,
62
+ boundary,
63
+ viewport,
64
+ viewportPadding,
65
+ } = options;
66
+
67
+ viewports.push(viewport);
68
+
69
+ const offsetPosition = { ...position };
70
+ for (const [i, [prop, dir, start, end]] of Object.entries(dirs)) {
71
+ if (flip !== true && !includes(flip, dir)) {
72
+ continue;
73
+ }
32
74
 
33
- moveTo(position, elAttach, dim, -1);
34
- moveTo(position, targetAttach, targetDim, 1);
75
+ const willFlip =
76
+ !intersectLine(position, targetDim, i) && intersectLine(position, targetDim, 1 - i);
35
77
 
36
- elOffset = getOffsets(elOffset, dim.width, dim.height);
37
- targetOffset = getOffsets(targetOffset, targetDim.width, targetDim.height);
78
+ viewport = getIntersectionArea(...viewports.filter(Boolean).map(offsetViewport));
38
79
 
39
- elOffset['x'] += targetOffset['x'];
40
- elOffset['y'] += targetOffset['y'];
80
+ if (viewportPadding) {
81
+ viewport[start] += viewportPadding;
82
+ viewport[end] -= viewportPadding;
83
+ }
41
84
 
42
- position.left += elOffset['x'];
43
- position.top += elOffset['y'];
85
+ if (boundary && !(willFlip || position[prop] > offset(boundary)[prop])) {
86
+ viewport = getIntersectionArea(viewport, offset(boundary));
87
+ }
44
88
 
45
- if (flip) {
46
- let boundaries = scrollParents(element).map(getViewport);
89
+ const isInStartBoundary = position[start] >= viewport[start];
90
+ const isInEndBoundary = position[end] <= viewport[end];
47
91
 
48
- if (boundary && !includes(boundaries, boundary)) {
49
- boundaries.unshift(boundary);
92
+ if (isInStartBoundary && isInEndBoundary) {
93
+ continue;
50
94
  }
51
95
 
52
- boundaries = boundaries.map((el) => offset(el));
96
+ let offsetBy;
53
97
 
54
- each(dirs, ([dir, align, alignFlip], prop) => {
55
- if (!(flip === true || includes(flip, dir))) {
56
- return;
98
+ // Flip
99
+ if (willFlip) {
100
+ if (
101
+ (elAttach[i] === end && isInStartBoundary) ||
102
+ (elAttach[i] === start && isInEndBoundary)
103
+ ) {
104
+ continue;
57
105
  }
58
106
 
59
- boundaries.some((boundary) => {
60
- const elemOffset =
61
- elAttach[dir] === align
62
- ? -dim[prop]
63
- : elAttach[dir] === alignFlip
64
- ? dim[prop]
65
- : 0;
66
-
67
- const targetOffset =
68
- targetAttach[dir] === align
69
- ? targetDim[prop]
70
- : targetAttach[dir] === alignFlip
71
- ? -targetDim[prop]
72
- : 0;
73
-
74
- if (
75
- position[align] < boundary[align] ||
76
- position[align] + dim[prop] > boundary[alignFlip]
77
- ) {
78
- const centerOffset = dim[prop] / 2;
79
- const centerTargetOffset =
80
- targetAttach[dir] === 'center' ? -targetDim[prop] / 2 : 0;
81
-
82
- return (
83
- (elAttach[dir] === 'center' &&
84
- (apply(centerOffset, centerTargetOffset) ||
85
- apply(-centerOffset, -centerTargetOffset))) ||
86
- apply(elemOffset, targetOffset)
87
- );
107
+ offsetBy =
108
+ (elAttach[i] === start
109
+ ? -position[prop]
110
+ : elAttach[i] === end
111
+ ? position[prop]
112
+ : 0) +
113
+ (targetAttach[i] === start
114
+ ? targetDim[prop]
115
+ : targetAttach[i] === end
116
+ ? -targetDim[prop]
117
+ : 0) -
118
+ elOffset[i] * 2;
119
+
120
+ if (
121
+ !isInScrollArea(
122
+ {
123
+ ...position,
124
+ [start]: position[start] + offsetBy,
125
+ [end]: position[end] + offsetBy,
126
+ },
127
+ scrollElement,
128
+ i
129
+ )
130
+ ) {
131
+ if (isInScrollArea(position, scrollElement, i)) {
132
+ continue;
88
133
  }
89
134
 
90
- function apply(elemOffset, targetOffset) {
91
- const newVal = toFloat(
92
- (position[align] + elemOffset + targetOffset - elOffset[dir] * 2).toFixed(4)
93
- );
94
-
95
- if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
96
- position[align] = newVal;
97
-
98
- for (const el of ['element', 'target']) {
99
- if (elemOffset) {
100
- flipped[el][dir] =
101
- flipped[el][dir] === dirs[prop][1]
102
- ? dirs[prop][2]
103
- : dirs[prop][1];
104
- }
105
- }
106
-
107
- return true;
108
- }
135
+ if (options.recursion) {
136
+ return false;
109
137
  }
110
- });
111
- });
138
+
139
+ const newPos = attachToWithFlip(element, target, {
140
+ ...options,
141
+ attach: {
142
+ element: elAttach.map(flipDir).reverse(),
143
+ target: targetAttach.map(flipDir).reverse(),
144
+ },
145
+ offset: elOffset.reverse(),
146
+ flip: flip === true ? flip : [...flip, dirs[1 - i][1]],
147
+ recursion: true,
148
+ });
149
+
150
+ if (newPos && isInScrollArea(newPos, scrollElement, 1 - i)) {
151
+ return newPos;
152
+ }
153
+ }
154
+
155
+ // Move
156
+ } else {
157
+ offsetBy =
158
+ clamp(
159
+ clamp(position[start], viewport[start], viewport[end] - position[prop]),
160
+ targetDim[start] - position[prop] + elOffset[i],
161
+ targetDim[end] - elOffset[i]
162
+ ) - position[start];
163
+ }
164
+
165
+ offsetPosition[start] = position[dir] = position[start] + offsetBy;
166
+ offsetPosition[end] += offsetBy;
112
167
  }
113
168
 
114
- offset(element, position);
169
+ return offsetPosition;
170
+ }
115
171
 
116
- return flipped;
172
+ function moveBy(start, end, dim) {
173
+ return start === 'center' ? dim / 2 : start === end ? dim : 0;
117
174
  }
118
175
 
119
- function moveTo(position, attach, dim, factor) {
120
- each(dirs, ([dir, align, alignFlip], prop) => {
121
- if (attach[dir] === alignFlip) {
122
- position[align] += dim[prop] * factor;
123
- } else if (attach[dir] === 'center') {
124
- position[align] += (dim[prop] * factor) / 2;
176
+ function getIntersectionArea(...rects) {
177
+ let area = {};
178
+ for (const rect of rects) {
179
+ for (const [, , start, end] of dirs) {
180
+ area[start] = Math.max(area[start] || 0, rect[start]);
181
+ area[end] = Math.min(...[area[end], rect[end]].filter(Boolean));
125
182
  }
126
- });
183
+ }
184
+ return area;
127
185
  }
128
186
 
129
- function getPos(pos) {
130
- const x = /left|center|right/;
131
- const y = /top|center|bottom/;
132
-
133
- pos = (pos || '').split(' ');
187
+ function isInScrollArea(position, scrollElement, dir) {
188
+ const viewport = offsetViewport(scrollElement);
189
+ const [prop, , start, end] = dirs[dir];
190
+ viewport[start] -= scrollElement[`scroll${ucfirst(start)}`];
191
+ viewport[end] = viewport[start] + scrollElement[`scroll${ucfirst(prop)}`];
134
192
 
135
- if (pos.length === 1) {
136
- pos = x.test(pos[0])
137
- ? pos.concat('center')
138
- : y.test(pos[0])
139
- ? ['center'].concat(pos)
140
- : ['center', 'center'];
141
- }
142
-
143
- return {
144
- x: x.test(pos[0]) ? pos[0] : 'center',
145
- y: y.test(pos[1]) ? pos[1] : 'center',
146
- };
193
+ return position[start] >= viewport[start] && position[end] <= viewport[end];
147
194
  }
148
195
 
149
- function getOffsets(offsets, width, height) {
150
- const [x, y] = (offsets || '').split(' ');
196
+ function intersectLine(dimA, dimB, dir) {
197
+ const [, , start, end] = dirs[dir];
198
+ return dimA[end] > dimB[start] && dimB[end] > dimA[start];
199
+ }
151
200
 
152
- return {
153
- x: x ? toFloat(x) * (endsWith(x, '%') ? width / 100 : 1) : 0,
154
- y: y ? toFloat(y) * (endsWith(y, '%') ? height / 100 : 1) : 0,
155
- };
201
+ function flipDir(prop) {
202
+ for (let i = 0; i < dirs.length; i++) {
203
+ const index = dirs[i].indexOf(prop);
204
+ if (~index) {
205
+ return dirs[1 - i][(index % 2) + 2];
206
+ }
207
+ }
156
208
  }
@@ -8,8 +8,10 @@ import {
8
8
  isDocument,
9
9
  isUndefined,
10
10
  isWindow,
11
+ toFloat,
11
12
  toNode,
12
13
  toWindow,
14
+ ucfirst,
13
15
  } from './lang';
14
16
 
15
17
  export function isInView(element, offsetTop = 0, offsetLeft = 0) {
@@ -20,7 +22,7 @@ export function isInView(element, offsetTop = 0, offsetLeft = 0) {
20
22
  return intersectRect(
21
23
  ...scrollParents(element)
22
24
  .map((parent) => {
23
- const { top, left, bottom, right } = offset(getViewport(parent));
25
+ const { top, left, bottom, right } = offsetViewport(parent);
24
26
 
25
27
  return {
26
28
  top: top - offsetTop,
@@ -35,7 +37,7 @@ export function isInView(element, offsetTop = 0, offsetLeft = 0) {
35
37
 
36
38
  export function scrollTop(element, top) {
37
39
  if (isWindow(element) || isDocument(element)) {
38
- element = getScrollingElement(element);
40
+ element = scrollingElement(element);
39
41
  } else {
40
42
  element = toNode(element);
41
43
  }
@@ -52,12 +54,13 @@ export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
52
54
  return parents.reduce(
53
55
  (fn, scrollElement, i) => {
54
56
  const { scrollTop, scrollHeight, offsetHeight } = scrollElement;
55
- const maxScroll = scrollHeight - getViewportClientHeight(scrollElement);
56
- const { height: elHeight, top: elTop } = offset(parents[i - 1] || element);
57
+ const viewport = offsetViewport(scrollElement);
58
+ const maxScroll = scrollHeight - viewport.height;
59
+ const { height: elHeight, top: elTop } = parents[i - 1]
60
+ ? offsetViewport(parents[i - 1])
61
+ : offset(element);
57
62
 
58
- let top = Math.ceil(
59
- elTop - offset(getViewport(scrollElement)).top - offsetBy + scrollTop
60
- );
63
+ let top = Math.ceil(elTop - viewport.top - offsetBy + scrollTop);
61
64
 
62
65
  if (offsetBy > 0 && offsetHeight < elHeight + offsetBy) {
63
66
  top += offsetBy;
@@ -115,7 +118,7 @@ export function scrolledOver(element, startOffset = 0, endOffset = 0) {
115
118
 
116
119
  const [scrollElement] = scrollParents(element, /auto|scroll/, true);
117
120
  const { scrollHeight, scrollTop } = scrollElement;
118
- const viewportHeight = getViewportClientHeight(scrollElement);
121
+ const { height: viewportHeight } = offsetViewport(scrollElement);
119
122
  const maxScroll = scrollHeight - viewportHeight;
120
123
  const elementOffsetTop = offsetPosition(element)[0] - offsetPosition(scrollElement)[0];
121
124
 
@@ -126,7 +129,7 @@ export function scrolledOver(element, startOffset = 0, endOffset = 0) {
126
129
  }
127
130
 
128
131
  export function scrollParents(element, overflowRe = /auto|scroll|hidden/, scrollable = false) {
129
- const scrollEl = getScrollingElement(element);
132
+ const scrollEl = scrollingElement(element);
130
133
 
131
134
  let ancestors = parents(element).reverse();
132
135
  ancestors = ancestors.slice(ancestors.indexOf(scrollEl) + 1);
@@ -141,26 +144,43 @@ export function scrollParents(element, overflowRe = /auto|scroll|hidden/, scroll
141
144
  ancestors.filter(
142
145
  (parent) =>
143
146
  overflowRe.test(css(parent, 'overflow')) &&
144
- (!scrollable || parent.scrollHeight > getViewportClientHeight(parent))
147
+ (!scrollable || parent.scrollHeight > offsetViewport(parent).height)
145
148
  )
146
149
  )
147
150
  .reverse();
148
151
  }
149
152
 
150
- export function getViewport(scrollElement) {
151
- return scrollElement === getScrollingElement(scrollElement) ? window : scrollElement;
153
+ export function offsetViewport(scrollElement) {
154
+ let viewportElement = getViewport(scrollElement);
155
+
156
+ // iOS 12 returns <body> as scrollingElement
157
+ if (viewportElement === scrollingElement(viewportElement)) {
158
+ viewportElement = document.documentElement;
159
+ }
160
+
161
+ let rect = offset(viewportElement);
162
+ for (let [prop, dir, start, end] of [
163
+ ['width', 'x', 'left', 'right'],
164
+ ['height', 'y', 'top', 'bottom'],
165
+ ]) {
166
+ if (!isWindow(getViewport(viewportElement))) {
167
+ rect[start] += toFloat(css(viewportElement, `border${ucfirst(start)}Width`));
168
+ }
169
+ rect[prop] = rect[dir] = (
170
+ isWindow(viewportElement) ? scrollingElement(viewportElement) : viewportElement
171
+ )[`client${ucfirst(prop)}`];
172
+ rect[end] = rect[prop] + rect[start];
173
+ }
174
+ return rect;
152
175
  }
153
176
 
154
- // iOS 12 returns <body> as scrollingElement
155
- export function getViewportClientHeight(scrollElement) {
156
- return (
157
- scrollElement === getScrollingElement(scrollElement)
158
- ? document.documentElement
159
- : scrollElement
160
- ).clientHeight;
177
+ function scrollingElement(element) {
178
+ const {
179
+ document: { scrollingElement },
180
+ } = toWindow(element);
181
+ return scrollingElement;
161
182
  }
162
183
 
163
- export function getScrollingElement(element) {
164
- const { document } = toWindow(element);
165
- return document.scrollingElement || document.documentElement;
184
+ function getViewport(scrollElement) {
185
+ return scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
166
186
  }
@@ -45,7 +45,6 @@
45
45
  /* 3 */
46
46
  box-sizing: border-box;
47
47
  width: @drop-width;
48
- max-width: 100vw;
49
48
  }
50
49
 
51
50
  /* Show */
@@ -29,6 +29,7 @@
29
29
 
30
30
  @dropdown-nav-item-color: @global-muted-color;
31
31
  @dropdown-nav-item-hover-color: @global-color;
32
+ @dropdown-nav-subtitle-font-size: @global-small-font-size;
32
33
  @dropdown-nav-header-color: @global-emphasis-color;
33
34
  @dropdown-nav-divider-border-width: @global-border-width;
34
35
  @dropdown-nav-divider-border: @global-border;
@@ -74,7 +75,6 @@
74
75
  ========================================================================== */
75
76
 
76
77
  .uk-dropdown-nav {
77
- white-space: nowrap;
78
78
  .hook-dropdown-nav();
79
79
  }
80
80
 
@@ -94,6 +94,15 @@
94
94
  .hook-dropdown-nav-item-hover();
95
95
  }
96
96
 
97
+ /*
98
+ * Subtitle
99
+ */
100
+
101
+ .uk-dropdown-nav .uk-nav-subtitle {
102
+ font-size: @dropdown-nav-subtitle-font-size;
103
+ .hook-dropdown-nav-subtitle();
104
+ }
105
+
97
106
  /*
98
107
  * Header
99
108
  */
@@ -138,6 +147,7 @@
138
147
  .hook-dropdown-nav() {}
139
148
  .hook-dropdown-nav-item() {}
140
149
  .hook-dropdown-nav-item-hover() {}
150
+ .hook-dropdown-nav-subtitle() {}
141
151
  .hook-dropdown-nav-header() {}
142
152
  .hook-dropdown-nav-divider() {}
143
153
  .hook-dropdown-misc() {}
@@ -130,10 +130,13 @@ button.uk-icon:not(:disabled) { cursor: pointer; }
130
130
 
131
131
  /*
132
132
  * Link
133
+ * 1. Allow text within link
133
134
  */
134
135
 
135
136
  .uk-icon-link {
136
137
  color: @icon-link-color;
138
+ /* 1 */
139
+ text-decoration: none !important;
137
140
  .hook-icon-link();
138
141
  }
139
142