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.
- package/CHANGELOG.md +38 -1
- package/build/build.js +4 -1
- package/dist/css/uikit-core-rtl.css +49 -8
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +49 -8
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +49 -6
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +49 -6
- 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 +7 -3
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +7 -3
- 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 +21 -12
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +21 -12
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +2 -2
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +21 -12
- 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 +2 -2
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +62 -30
- 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 +386 -301
- 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 +433 -309
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/components/slider.js +1 -1
- package/src/js/components/sortable.js +2 -3
- package/src/js/components/tooltip.js +38 -3
- package/src/js/core/drop.js +20 -16
- package/src/js/core/navbar.js +18 -6
- package/src/js/core/scrollspy-nav.js +6 -11
- package/src/js/core/sticky.js +58 -22
- package/src/js/core/toggle.js +8 -8
- package/src/js/mixin/media.js +12 -9
- package/src/js/mixin/modal.js +6 -2
- package/src/js/mixin/parallax.js +8 -3
- package/src/js/mixin/position.js +24 -24
- package/src/js/uikit-core.js +0 -4
- package/src/js/util/lang.js +34 -42
- package/src/js/util/position.js +177 -125
- package/src/js/util/viewport.js +42 -22
- package/src/less/components/drop.less +0 -1
- package/src/less/components/dropdown.less +11 -1
- package/src/less/components/icon.less +3 -0
- package/src/less/components/nav.less +23 -0
- package/src/less/components/navbar.less +26 -2
- package/src/less/components/search.less +2 -0
- package/src/less/components/sticky.less +8 -3
- package/src/less/components/utility.less +1 -0
- package/src/less/theme/dropdown.less +4 -0
- package/src/less/theme/nav.less +6 -0
- package/src/less/theme/navbar.less +4 -0
- package/src/less/theme/search.less +6 -0
- package/src/scss/components/drop.scss +0 -1
- package/src/scss/components/dropdown.scss +11 -1
- package/src/scss/components/icon.scss +3 -0
- package/src/scss/components/nav.scss +23 -0
- package/src/scss/components/navbar.scss +26 -2
- package/src/scss/components/search.scss +2 -0
- package/src/scss/components/sticky.scss +8 -3
- package/src/scss/components/utility.scss +1 -0
- package/src/scss/mixins-theme.scss +5 -0
- package/src/scss/mixins.scss +5 -0
- package/src/scss/theme/dropdown.scss +4 -0
- package/src/scss/theme/nav.scss +6 -0
- package/src/scss/theme/navbar.scss +4 -0
- package/src/scss/theme/search.scss +6 -0
- package/src/scss/variables-theme.scss +5 -1
- package/src/scss/variables.scss +5 -1
- package/tests/alert.html +1 -1
- package/tests/animation.html +216 -214
- package/tests/drop.html +129 -80
- package/tests/dropdown.html +16 -2
- package/tests/nav.html +27 -0
- package/tests/navbar.html +56 -5
- package/tests/parallax.html +5 -5
- package/tests/position.html +38 -39
- package/tests/sticky-navbar.html +6 -6
- package/tests/sticky-parallax.html +169 -148
- package/tests/sticky.html +300 -49
- 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.
|
|
5
|
+
"version": "3.13.11-dev.3b88fea57",
|
|
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
|
|
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
|
-
|
|
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 } =
|
|
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.
|
|
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/drop.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
matches,
|
|
15
15
|
MouseTracker,
|
|
16
16
|
offset,
|
|
17
|
+
offsetViewport,
|
|
17
18
|
on,
|
|
18
19
|
once,
|
|
19
20
|
parent,
|
|
@@ -24,6 +25,7 @@ import {
|
|
|
24
25
|
pointerUp,
|
|
25
26
|
query,
|
|
26
27
|
removeClass,
|
|
28
|
+
scrollParents,
|
|
27
29
|
toggleClass,
|
|
28
30
|
within,
|
|
29
31
|
} from 'uikit-util';
|
|
@@ -243,12 +245,6 @@ export default {
|
|
|
243
245
|
}
|
|
244
246
|
}),
|
|
245
247
|
on(window, 'resize', () => this.$emit()),
|
|
246
|
-
on(
|
|
247
|
-
document,
|
|
248
|
-
'scroll',
|
|
249
|
-
({ target }) => target.contains(this.$el) && this.$emit(),
|
|
250
|
-
true
|
|
251
|
-
),
|
|
252
248
|
]) {
|
|
253
249
|
once(this.$el, 'hide', handler, { self: true });
|
|
254
250
|
}
|
|
@@ -359,25 +355,33 @@ export default {
|
|
|
359
355
|
},
|
|
360
356
|
|
|
361
357
|
position() {
|
|
362
|
-
const boundary = query(this.boundary, this.$el) || window;
|
|
363
358
|
removeClass(this.$el, `${this.clsDrop}-stack`);
|
|
364
359
|
toggleClass(this.$el, `${this.clsDrop}-boundary`, this.boundaryAlign);
|
|
365
360
|
|
|
366
|
-
const
|
|
367
|
-
const
|
|
368
|
-
const
|
|
361
|
+
const boundary = query(this.boundary, this.$el);
|
|
362
|
+
const [scrollParent] = scrollParents(this.$el);
|
|
363
|
+
const scrollParentOffset = offsetViewport(scrollParent);
|
|
364
|
+
const boundaryOffset = boundary ? offset(boundary) : scrollParentOffset;
|
|
365
|
+
|
|
366
|
+
css(this.$el, 'maxWidth', '');
|
|
367
|
+
const maxWidth = scrollParentOffset.width - (boundary ? 0 : 2 * this.viewportPadding);
|
|
369
368
|
|
|
370
369
|
if (this.pos[1] === 'justify') {
|
|
371
|
-
const prop = this.
|
|
370
|
+
const prop = this.axis === 'y' ? 'width' : 'height';
|
|
371
|
+
const targetOffset = offset(this.target);
|
|
372
|
+
const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
|
|
372
373
|
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
|
-
) {
|
|
374
|
+
} else if (this.$el.offsetWidth > maxWidth) {
|
|
377
375
|
addClass(this.$el, `${this.clsDrop}-stack`);
|
|
378
376
|
}
|
|
379
377
|
|
|
380
|
-
|
|
378
|
+
css(this.$el, 'maxWidth', maxWidth);
|
|
379
|
+
|
|
380
|
+
this.positionAt(
|
|
381
|
+
this.$el,
|
|
382
|
+
boundary && this.boundaryAlign ? boundary : this.target,
|
|
383
|
+
boundary
|
|
384
|
+
);
|
|
381
385
|
},
|
|
382
386
|
},
|
|
383
387
|
};
|
package/src/js/core/navbar.js
CHANGED
|
@@ -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:
|
|
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
|
|
138
|
-
|
|
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
|
|
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 (
|
|
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 (
|
|
93
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
99
94
|
toggleClass(this.elements[i], this.cls, +i === active);
|
|
100
95
|
}
|
|
101
96
|
|
package/src/js/core/sticky.js
CHANGED
|
@@ -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:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
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 =
|
|
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
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const end =
|
|
177
|
-
|
|
178
|
-
|
|
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(
|
|
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
|
+
}
|
package/src/js/core/toggle.js
CHANGED
|
@@ -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
|
},
|
package/src/js/mixin/media.js
CHANGED
|
@@ -20,16 +20,19 @@ export default {
|
|
|
20
20
|
|
|
21
21
|
connected() {
|
|
22
22
|
const media = toMedia(this.media);
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
this.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
});
|
|
32
|
-
handler();
|
|
35
|
+
}
|
|
33
36
|
},
|
|
34
37
|
|
|
35
38
|
disconnected() {
|
package/src/js/mixin/modal.js
CHANGED
|
@@ -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
|
|
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
|
+
}
|
package/src/js/mixin/parallax.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
createEvent,
|
|
5
5
|
css,
|
|
6
6
|
Dimensions,
|
|
7
|
-
each,
|
|
8
7
|
findIndex,
|
|
9
8
|
isNumber,
|
|
10
9
|
isString,
|
|
@@ -65,7 +64,9 @@ export default {
|
|
|
65
64
|
|
|
66
65
|
methods: {
|
|
67
66
|
reset() {
|
|
68
|
-
|
|
67
|
+
for (const prop in this.getCss(0)) {
|
|
68
|
+
css(this.$el, prop, '');
|
|
69
|
+
}
|
|
69
70
|
},
|
|
70
71
|
|
|
71
72
|
getCss(percent) {
|
|
@@ -79,12 +80,16 @@ export default {
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
function transformFn(prop, el, stops) {
|
|
82
|
-
|
|
83
|
+
let unit = getUnit(stops) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
|
|
83
84
|
let transformFn;
|
|
84
85
|
|
|
85
86
|
if (prop === 'x' || prop === 'y') {
|
|
86
87
|
prop = `translate${ucfirst(prop)}`;
|
|
87
88
|
transformFn = (stop) => toFloat(toFloat(stop).toFixed(unit === 'px' ? 0 : 6));
|
|
89
|
+
} else if (prop === 'scale') {
|
|
90
|
+
unit = '';
|
|
91
|
+
transformFn = (stop) =>
|
|
92
|
+
getUnit([stop]) ? toPx(stop, 'width', el, true) / el.offsetWidth : stop;
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
if (stops.length === 1) {
|
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,
|
|
@@ -20,49 +21,48 @@ export default {
|
|
|
20
21
|
pos: `bottom-${isRtl ? 'right' : 'left'}`,
|
|
21
22
|
flip: true,
|
|
22
23
|
offset: false,
|
|
24
|
+
viewportPadding: 10,
|
|
23
25
|
},
|
|
24
26
|
|
|
25
27
|
connected() {
|
|
26
28
|
this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
|
|
27
|
-
this.
|
|
28
|
-
this.align = this.pos[1];
|
|
29
|
+
this.axis = includes(['top', 'bottom'], this.pos[0]) ? 'y' : 'x';
|
|
29
30
|
},
|
|
30
31
|
|
|
31
32
|
methods: {
|
|
32
33
|
positionAt(element, target, boundary) {
|
|
33
|
-
const
|
|
34
|
-
const dir = this.pos[0];
|
|
35
|
-
const align = this.pos[1];
|
|
34
|
+
const [dir, align] = this.pos;
|
|
36
35
|
|
|
37
36
|
let { offset } = this;
|
|
38
37
|
if (!isNumeric(offset)) {
|
|
39
38
|
const node = $(offset);
|
|
40
39
|
offset = node
|
|
41
|
-
? getOffset(node)[axis === 'x' ? 'left' : 'top'] -
|
|
42
|
-
getOffset(target)[axis === 'x' ? 'right' : 'bottom']
|
|
40
|
+
? getOffset(node)[this.axis === 'x' ? 'left' : 'top'] -
|
|
41
|
+
getOffset(target)[this.axis === 'x' ? 'right' : 'bottom']
|
|
43
42
|
: 0;
|
|
44
43
|
}
|
|
45
44
|
offset = toPx(offset) + toPx(getCssVar('position-offset', element));
|
|
45
|
+
offset = [includes(['left', 'top'], dir) ? -offset : +offset, 0];
|
|
46
46
|
|
|
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;
|
|
47
|
+
const attach = {
|
|
48
|
+
element: [flipPosition(dir), align],
|
|
49
|
+
target: [dir, align],
|
|
50
|
+
};
|
|
59
51
|
|
|
60
|
-
this.
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
if (this.axis === 'y') {
|
|
53
|
+
for (const prop in attach) {
|
|
54
|
+
attach[prop] = attach[prop].reverse();
|
|
55
|
+
}
|
|
56
|
+
offset = offset.reverse();
|
|
57
|
+
}
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
positionAt(element, target, {
|
|
60
|
+
attach,
|
|
61
|
+
offset,
|
|
62
|
+
boundary,
|
|
63
|
+
viewportPadding: this.viewportPadding,
|
|
64
|
+
flip: this.flip,
|
|
65
|
+
});
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
};
|
package/src/js/uikit-core.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import UIkit from './api/index';
|
|
2
|
-
import Core from './core/core';
|
|
3
2
|
import boot from './api/boot';
|
|
4
3
|
import * as components from './core/index';
|
|
5
4
|
import { each } from 'uikit-util';
|
|
@@ -7,9 +6,6 @@ import { each } from 'uikit-util';
|
|
|
7
6
|
// register components
|
|
8
7
|
each(components, (component, name) => UIkit.component(name, component));
|
|
9
8
|
|
|
10
|
-
// core functionality
|
|
11
|
-
UIkit.use(Core);
|
|
12
|
-
|
|
13
9
|
boot(UIkit);
|
|
14
10
|
|
|
15
11
|
export default UIkit;
|