uikit 3.13.7-dev.04818b8b8 → 3.13.8-dev.06ac04d2b
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.
- package/CHANGELOG.md +19 -1
- package/dist/css/uikit-core-rtl.css +34 -5
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +34 -5
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +34 -3
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +34 -3
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +1 -1
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +1 -1
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1 -1
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1 -1
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +1 -1
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +12 -10
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +12 -10
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +1 -1
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +12 -10
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +1 -1
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +1 -1
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +59 -29
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +1 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +172 -176
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +209 -180
- package/dist/js/uikit.min.js +1 -1
- package/package.json +5 -5
- package/src/js/components/tooltip.js +38 -3
- package/src/js/core/accordion.js +1 -1
- package/src/js/core/drop.js +10 -6
- package/src/js/core/height-match.js +10 -15
- package/src/js/core/navbar.js +1 -1
- package/src/js/mixin/media.js +11 -9
- package/src/js/mixin/position.js +22 -24
- package/src/js/util/position.js +128 -129
- package/src/less/components/dropdown.less +11 -1
- package/src/less/components/nav.less +22 -0
- package/src/less/components/navbar.less +22 -2
- package/src/less/theme/dropdown.less +2 -0
- package/src/less/theme/nav.less +4 -0
- package/src/less/theme/navbar.less +2 -0
- package/src/scss/components/dropdown.scss +11 -1
- package/src/scss/components/nav.scss +22 -0
- package/src/scss/components/navbar.scss +22 -2
- package/src/scss/mixins-theme.scss +4 -0
- package/src/scss/mixins.scss +4 -0
- package/src/scss/theme/dropdown.scss +2 -0
- package/src/scss/theme/nav.scss +4 -0
- package/src/scss/theme/navbar.scss +2 -0
- package/src/scss/variables-theme.scss +5 -1
- package/src/scss/variables.scss +5 -1
- package/tests/drop.html +0 -6
- package/tests/dropdown.html +18 -10
- package/tests/nav.html +27 -0
- package/tests/navbar.html +18 -4
- package/tests/position.html +38 -39
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.
|
|
5
|
+
"version": "3.13.8-dev.06ac04d2b",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
"@rollup/plugin-replace": "^4.0.0",
|
|
42
42
|
"archiver": "^5.3.0",
|
|
43
43
|
"camelcase": "^6.3.0",
|
|
44
|
-
"clean-css": "^5.
|
|
44
|
+
"clean-css": "^5.3.0",
|
|
45
45
|
"dateformat": "^5.0.3",
|
|
46
|
-
"esbuild": "^0.14.
|
|
46
|
+
"esbuild": "^0.14.32",
|
|
47
47
|
"eslint": "^8.12.0",
|
|
48
48
|
"eslint-config-prettier": "^8.5.0",
|
|
49
49
|
"fs-extra": "^10.0.1",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"minimist": "^1.2.6",
|
|
54
54
|
"number-precision": "^1.5.2",
|
|
55
55
|
"p-limit": "^4.0.0",
|
|
56
|
-
"prettier": "^2.6.
|
|
56
|
+
"prettier": "^2.6.2",
|
|
57
57
|
"rollup": "^2.70.1",
|
|
58
|
-
"rollup-plugin-esbuild": "^4.
|
|
58
|
+
"rollup-plugin-esbuild": "^4.9.1",
|
|
59
59
|
"rollup-plugin-html": "^0.2.1",
|
|
60
60
|
"rollup-plugin-modify": "^3.0.0",
|
|
61
61
|
"rtlcss": "^3.5.0",
|
|
@@ -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.
|
|
109
|
-
? `${flipPosition(
|
|
110
|
-
: `${
|
|
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
|
+
}
|
package/src/js/core/accordion.js
CHANGED
package/src/js/core/drop.js
CHANGED
|
@@ -62,8 +62,11 @@ export default {
|
|
|
62
62
|
this.tracker = new MouseTracker();
|
|
63
63
|
},
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
beforeConnect() {
|
|
66
66
|
this.clsDrop = this.$props.clsDrop || `uk-${this.$options.name}`;
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
connected() {
|
|
67
70
|
addClass(this.$el, this.clsDrop);
|
|
68
71
|
|
|
69
72
|
if (this.toggle && !this.target) {
|
|
@@ -359,17 +362,18 @@ export default {
|
|
|
359
362
|
const boundaryOffset = offset(boundary);
|
|
360
363
|
const targetOffset = offset(this.target);
|
|
361
364
|
const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
|
|
365
|
+
const prop = this.axis === 'y' ? 'width' : 'height';
|
|
366
|
+
|
|
367
|
+
css(this.$el, `max-${prop}`, '');
|
|
362
368
|
|
|
363
369
|
if (this.pos[1] === 'justify') {
|
|
364
|
-
const prop = this.getAxis() === 'y' ? 'width' : 'height';
|
|
365
370
|
css(this.$el, prop, alignTo[prop]);
|
|
366
|
-
} else if (
|
|
367
|
-
this.$el.offsetWidth >
|
|
368
|
-
Math.max(boundaryOffset.right - alignTo.left, alignTo.right - boundaryOffset.left)
|
|
369
|
-
) {
|
|
371
|
+
} else if (this.$el.offsetWidth > boundaryOffset.width) {
|
|
370
372
|
addClass(this.$el, `${this.clsDrop}-stack`);
|
|
371
373
|
}
|
|
372
374
|
|
|
375
|
+
css(this.$el, `max-${prop}`, boundaryOffset[prop]);
|
|
376
|
+
|
|
373
377
|
this.positionAt(this.$el, this.boundaryAlign ? boundary : this.target, boundary);
|
|
374
378
|
},
|
|
375
379
|
},
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import Resize from '../mixin/resize';
|
|
1
2
|
import { getRows } from './margin';
|
|
2
|
-
import { $$, boxModelAdjust, css, dimensions, isVisible
|
|
3
|
+
import { $$, boxModelAdjust, css, dimensions, isVisible } from 'uikit-util';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
6
|
+
mixins: [Resize],
|
|
7
|
+
|
|
5
8
|
args: 'target',
|
|
6
9
|
|
|
7
10
|
props: {
|
|
@@ -53,22 +56,14 @@ function match(elements) {
|
|
|
53
56
|
return { heights: [''], elements };
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
css(elements, 'minHeight', '');
|
|
56
60
|
let heights = elements.map(getHeight);
|
|
57
|
-
|
|
58
|
-
const hasMinHeight = elements.some((el) => el.style.minHeight);
|
|
59
|
-
const hasShrunk = elements.some((el, i) => !el.style.minHeight && heights[i] < max);
|
|
60
|
-
|
|
61
|
-
if (hasMinHeight && hasShrunk) {
|
|
62
|
-
css(elements, 'minHeight', '');
|
|
63
|
-
heights = elements.map(getHeight);
|
|
64
|
-
max = Math.max(...heights);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
heights = elements.map((el, i) =>
|
|
68
|
-
heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max
|
|
69
|
-
);
|
|
61
|
+
const max = Math.max(...heights);
|
|
70
62
|
|
|
71
|
-
return {
|
|
63
|
+
return {
|
|
64
|
+
heights: elements.map((el, i) => (heights[i].toFixed(2) === max.toFixed(2) ? '' : max)),
|
|
65
|
+
elements,
|
|
66
|
+
};
|
|
72
67
|
}
|
|
73
68
|
|
|
74
69
|
function getHeight(element) {
|
package/src/js/core/navbar.js
CHANGED
package/src/js/mixin/media.js
CHANGED
|
@@ -20,16 +20,18 @@ export default {
|
|
|
20
20
|
|
|
21
21
|
connected() {
|
|
22
22
|
const media = toMedia(this.media);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
if (media) {
|
|
24
|
+
this.mediaObj = window.matchMedia(media);
|
|
25
|
+
const handler = () => {
|
|
26
|
+
this.matchMedia = this.mediaObj.matches;
|
|
27
|
+
trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
|
|
28
|
+
};
|
|
29
|
+
this.offMediaObj = on(this.mediaObj, 'change', () => {
|
|
30
|
+
handler();
|
|
31
|
+
this.$emit('resize');
|
|
32
|
+
});
|
|
29
33
|
handler();
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
handler();
|
|
34
|
+
}
|
|
33
35
|
},
|
|
34
36
|
|
|
35
37
|
disconnected() {
|
package/src/js/mixin/position.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
flipPosition,
|
|
4
4
|
getCssVar,
|
|
5
5
|
offset as getOffset,
|
|
6
|
+
includes,
|
|
6
7
|
isNumeric,
|
|
7
8
|
isRtl,
|
|
8
9
|
positionAt,
|
|
@@ -24,45 +25,42 @@ export default {
|
|
|
24
25
|
|
|
25
26
|
connected() {
|
|
26
27
|
this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
|
|
27
|
-
this.
|
|
28
|
-
this.align = this.pos[1];
|
|
28
|
+
this.axis = includes(['top', 'bottom'], this.pos[0]) ? 'y' : 'x';
|
|
29
29
|
},
|
|
30
30
|
|
|
31
31
|
methods: {
|
|
32
32
|
positionAt(element, target, boundary) {
|
|
33
|
-
const
|
|
34
|
-
const dir = this.pos[0];
|
|
35
|
-
const align = this.pos[1];
|
|
33
|
+
const [dir, align] = this.pos;
|
|
36
34
|
|
|
37
35
|
let { offset } = this;
|
|
38
36
|
if (!isNumeric(offset)) {
|
|
39
37
|
const node = $(offset);
|
|
40
38
|
offset = node
|
|
41
|
-
? getOffset(node)[axis === 'x' ? 'left' : 'top'] -
|
|
42
|
-
getOffset(target)[axis === 'x' ? 'right' : 'bottom']
|
|
39
|
+
? getOffset(node)[this.axis === 'x' ? 'left' : 'top'] -
|
|
40
|
+
getOffset(target)[this.axis === 'x' ? 'right' : 'bottom']
|
|
43
41
|
: 0;
|
|
44
42
|
}
|
|
45
43
|
offset = toPx(offset) + toPx(getCssVar('position-offset', element));
|
|
44
|
+
offset = [includes(['left', 'top'], dir) ? -offset : +offset, 0];
|
|
46
45
|
|
|
47
|
-
const
|
|
48
|
-
element,
|
|
49
|
-
target,
|
|
50
|
-
|
|
51
|
-
axis === 'x' ? `${dir} ${align}` : `${align} ${dir}`,
|
|
52
|
-
axis === 'x'
|
|
53
|
-
? `${dir === 'left' ? -offset : offset}`
|
|
54
|
-
: ` ${dir === 'top' ? -offset : offset}`,
|
|
55
|
-
null,
|
|
56
|
-
this.flip,
|
|
57
|
-
boundary
|
|
58
|
-
).target;
|
|
46
|
+
const attach = {
|
|
47
|
+
element: [flipPosition(dir), align],
|
|
48
|
+
target: [dir, align],
|
|
49
|
+
};
|
|
59
50
|
|
|
60
|
-
this.
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
if (this.axis === 'y') {
|
|
52
|
+
for (const prop in attach) {
|
|
53
|
+
attach[prop] = attach[prop].reverse();
|
|
54
|
+
}
|
|
55
|
+
offset = offset.reverse();
|
|
56
|
+
}
|
|
63
57
|
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
positionAt(element, target, {
|
|
59
|
+
attach,
|
|
60
|
+
offset,
|
|
61
|
+
boundary,
|
|
62
|
+
flip: this.flip,
|
|
63
|
+
});
|
|
66
64
|
},
|
|
67
65
|
},
|
|
68
66
|
};
|
package/src/js/util/position.js
CHANGED
|
@@ -1,156 +1,155 @@
|
|
|
1
1
|
import { offset } from './dimensions';
|
|
2
|
-
import {
|
|
2
|
+
import { clamp, includes } from './lang';
|
|
3
3
|
import { getViewport, scrollParents } from './viewport';
|
|
4
4
|
|
|
5
|
-
const dirs =
|
|
6
|
-
width
|
|
7
|
-
height
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export function positionAt(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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 in dirs) {
|
|
42
|
+
const [prop, dir, start, end] = dirs[i];
|
|
43
|
+
position[start] = position[dir] =
|
|
44
|
+
targetOffset[start] +
|
|
45
|
+
moveBy(attach.target[i], end, targetOffset[prop]) -
|
|
46
|
+
moveBy(attach.element[i], end, position[prop]) +
|
|
47
|
+
+offsetBy[i];
|
|
48
|
+
position[end] = position[start] + position[prop];
|
|
27
49
|
}
|
|
50
|
+
return position;
|
|
51
|
+
}
|
|
28
52
|
|
|
29
|
-
|
|
53
|
+
function attachToWithFlip(element, target, options) {
|
|
54
|
+
const position = attachTo(element, target, options);
|
|
30
55
|
const targetDim = offset(target);
|
|
31
|
-
const
|
|
56
|
+
const viewports = scrollParents(element).map(getViewport);
|
|
57
|
+
|
|
58
|
+
let {
|
|
59
|
+
flip,
|
|
60
|
+
attach: { element: elAttach, target: targetAttach },
|
|
61
|
+
offset: elOffset,
|
|
62
|
+
boundary,
|
|
63
|
+
viewport,
|
|
64
|
+
} = options;
|
|
32
65
|
|
|
33
|
-
|
|
34
|
-
moveTo(position, targetAttach, targetDim, 1);
|
|
66
|
+
viewports.push(viewport);
|
|
35
67
|
|
|
36
|
-
|
|
37
|
-
|
|
68
|
+
for (const i in dirs) {
|
|
69
|
+
const [prop, dir, start, end] = dirs[i];
|
|
38
70
|
|
|
39
|
-
|
|
40
|
-
|
|
71
|
+
if (flip !== true && !includes(flip, dir)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
41
74
|
|
|
42
|
-
|
|
43
|
-
|
|
75
|
+
const willFlip =
|
|
76
|
+
!intersectLine(position, targetDim, i) && intersectLine(position, targetDim, 1 - i);
|
|
44
77
|
|
|
45
|
-
|
|
46
|
-
|
|
78
|
+
viewport = getIntersectionArea(
|
|
79
|
+
...viewports,
|
|
80
|
+
willFlip || position[prop] > offset(boundary)[prop] ? null : boundary
|
|
81
|
+
);
|
|
82
|
+
const isInStartBoundary = position[start] >= viewport[start];
|
|
83
|
+
const isInEndBoundary = position[end] <= viewport[end];
|
|
47
84
|
|
|
48
|
-
if (
|
|
49
|
-
|
|
85
|
+
if (isInStartBoundary && isInEndBoundary) {
|
|
86
|
+
continue;
|
|
50
87
|
}
|
|
51
88
|
|
|
52
|
-
|
|
89
|
+
let offsetBy;
|
|
53
90
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
91
|
+
// Flip
|
|
92
|
+
if (willFlip) {
|
|
93
|
+
if (
|
|
94
|
+
(elAttach[i] === end && isInStartBoundary) ||
|
|
95
|
+
(elAttach[i] === start && isInEndBoundary)
|
|
96
|
+
) {
|
|
97
|
+
continue;
|
|
57
98
|
}
|
|
58
99
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
position[
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
(elAttach[dir] === 'center' &&
|
|
84
|
-
(apply(centerOffset, centerTargetOffset) ||
|
|
85
|
-
apply(-centerOffset, -centerTargetOffset))) ||
|
|
86
|
-
apply(elemOffset, targetOffset)
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
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
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
100
|
+
offsetBy =
|
|
101
|
+
(elAttach[i] === start
|
|
102
|
+
? -position[prop]
|
|
103
|
+
: elAttach[i] === end
|
|
104
|
+
? position[prop]
|
|
105
|
+
: 0) +
|
|
106
|
+
(targetAttach[i] === start
|
|
107
|
+
? targetDim[prop]
|
|
108
|
+
: targetAttach[i] === end
|
|
109
|
+
? -targetDim[prop]
|
|
110
|
+
: 0) -
|
|
111
|
+
elOffset[i] * 2;
|
|
112
|
+
|
|
113
|
+
// Move
|
|
114
|
+
} else {
|
|
115
|
+
offsetBy =
|
|
116
|
+
clamp(
|
|
117
|
+
clamp(position[start], viewport[start], viewport[end] - position[prop]),
|
|
118
|
+
targetDim[start] - position[prop] + elOffset[i],
|
|
119
|
+
targetDim[end] - elOffset[i]
|
|
120
|
+
) - position[start];
|
|
121
|
+
}
|
|
113
122
|
|
|
114
|
-
|
|
123
|
+
position[start] = position[dir] = position[start] + offsetBy;
|
|
124
|
+
position[end] += offsetBy;
|
|
125
|
+
}
|
|
115
126
|
|
|
116
|
-
return
|
|
127
|
+
return position;
|
|
117
128
|
}
|
|
118
129
|
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
if (attach[dir] === alignFlip) {
|
|
122
|
-
position[align] += dim[prop] * factor;
|
|
123
|
-
} else if (attach[dir] === 'center') {
|
|
124
|
-
position[align] += (dim[prop] * factor) / 2;
|
|
125
|
-
}
|
|
126
|
-
});
|
|
130
|
+
function moveBy(start, end, dim) {
|
|
131
|
+
return start === 'center' ? dim / 2 : start === end ? dim : 0;
|
|
127
132
|
}
|
|
128
133
|
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
134
|
+
function getIntersectionArea(...elements) {
|
|
135
|
+
let intersection;
|
|
136
|
+
for (const el of elements.filter(Boolean)) {
|
|
137
|
+
const rect = offset(el);
|
|
138
|
+
if (!intersection) {
|
|
139
|
+
intersection = rect;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
for (const prop of ['left', 'top']) {
|
|
143
|
+
intersection[prop] = Math.max(rect[prop], intersection[prop]);
|
|
144
|
+
}
|
|
145
|
+
for (const prop of ['right', 'bottom']) {
|
|
146
|
+
intersection[prop] = Math.min(rect[prop], intersection[prop]);
|
|
147
|
+
}
|
|
141
148
|
}
|
|
142
|
-
|
|
143
|
-
return {
|
|
144
|
-
x: x.test(pos[0]) ? pos[0] : 'center',
|
|
145
|
-
y: y.test(pos[1]) ? pos[1] : 'center',
|
|
146
|
-
};
|
|
149
|
+
return intersection;
|
|
147
150
|
}
|
|
148
151
|
|
|
149
|
-
function
|
|
150
|
-
const [
|
|
151
|
-
|
|
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
|
-
};
|
|
152
|
+
function intersectLine(dimA, dimB, dir) {
|
|
153
|
+
const [, , start, end] = dirs[dir];
|
|
154
|
+
return dimA[end] > dimB[start] && dimB[end] > dimA[start];
|
|
156
155
|
}
|
|
@@ -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() {}
|