uikit 3.14.4-dev.d014a9a57 → 3.14.4-dev.d2929b5b7
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 +34 -17
- package/build/util.js +1 -0
- package/dist/css/uikit-core-rtl.css +317 -76
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +317 -76
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +337 -80
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +337 -80
- 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 +77 -120
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +77 -120
- 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 +4 -5
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +4 -5
- 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 +4 -5
- 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 +88 -134
- 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 +357 -367
- package/dist/js/uikit-core.min.js +14 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +357 -367
- package/dist/js/uikit.min.js +14 -1
- package/package.json +1 -1
- package/src/images/components/navbar-toggle-icon.svg +22 -3
- package/src/js/api/state.js +1 -1
- package/src/js/core/accordion.js +9 -17
- package/src/js/core/alert.js +35 -14
- package/src/js/core/drop.js +90 -61
- package/src/js/core/height-viewport.js +4 -2
- package/src/js/core/index.js +1 -1
- package/src/js/core/leader.js +2 -2
- package/src/js/core/navbar.js +28 -45
- package/src/js/core/scroll.js +37 -10
- package/src/js/mixin/media.js +4 -5
- package/src/js/mixin/modal.js +9 -6
- package/src/js/mixin/position.js +21 -24
- package/src/js/mixin/togglable.js +80 -124
- package/src/js/util/animation.js +4 -3
- package/src/js/util/filter.js +3 -7
- package/src/js/util/position.js +42 -47
- package/src/js/util/style.js +4 -13
- package/src/js/util/viewport.js +3 -5
- package/src/less/components/_import.less +1 -0
- package/src/less/components/drop.less +1 -18
- package/src/less/components/dropbar.less +115 -0
- package/src/less/components/dropdown.less +11 -19
- package/src/less/components/leader.less +1 -1
- package/src/less/components/nav.less +212 -23
- package/src/less/components/navbar.less +16 -52
- package/src/less/components/utility.less +10 -2
- package/src/less/theme/_import.less +1 -0
- package/src/less/theme/dropbar.less +44 -0
- package/src/less/theme/dropdown.less +0 -11
- package/src/less/theme/nav.less +46 -0
- package/src/less/theme/navbar.less +1 -5
- package/src/scss/components/_import.scss +1 -0
- package/src/scss/components/drop.scss +1 -18
- package/src/scss/components/dropbar.scss +115 -0
- package/src/scss/components/dropdown.scss +11 -19
- package/src/scss/components/leader.scss +1 -1
- package/src/scss/components/nav.scss +161 -22
- package/src/scss/components/navbar.scss +16 -52
- package/src/scss/components/utility.scss +8 -1
- package/src/scss/mixins-theme.scss +80 -8
- package/src/scss/mixins.scss +77 -4
- package/src/scss/theme/_import.scss +1 -0
- package/src/scss/theme/dropbar.scss +44 -0
- package/src/scss/theme/dropdown.scss +0 -8
- package/src/scss/theme/nav.scss +44 -0
- package/src/scss/theme/navbar.scss +1 -5
- package/src/scss/variables-theme.scss +51 -10
- package/src/scss/variables.scss +40 -8
- package/tests/accordion.html +2 -2
- package/tests/alert.html +2 -2
- package/tests/countdown.html +1 -1
- package/tests/drop.html +444 -412
- package/tests/dropbar.html +456 -0
- package/tests/dropdown.html +8 -470
- package/tests/filter.html +9 -12
- package/tests/form.html +1 -1
- package/tests/index.html +124 -105
- package/tests/lightbox.html +5 -5
- package/tests/list.html +8 -8
- package/tests/modal.html +13 -13
- package/tests/nav.html +121 -12
- package/tests/navbar.html +76 -218
- package/tests/offcanvas.html +10 -14
- package/tests/parallax.html +1 -1
- package/tests/position.html +13 -24
- package/tests/progress.html +9 -9
- package/tests/scroll.html +7 -10
- package/tests/search.html +5 -5
- package/tests/slider.html +6 -5
- package/tests/slideshow.html +8 -8
- package/tests/sortable.html +6 -8
- package/tests/sticky-navbar.html +6 -6
- package/tests/sticky.html +8 -8
- package/tests/switcher.html +1 -1
- package/tests/tab.html +1 -1
- package/tests/table.html +7 -7
- package/tests/toggle.html +2 -2
- package/tests/tooltip.html +1 -1
- package/tests/upload.html +11 -11
- package/tests/utility.html +19 -0
package/src/js/core/scroll.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, scrollIntoView, trigger } from 'uikit-util';
|
|
1
|
+
import { $, off, on, scrollIntoView, trigger, within } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
props: {
|
|
@@ -9,6 +9,14 @@ export default {
|
|
|
9
9
|
offset: 0,
|
|
10
10
|
},
|
|
11
11
|
|
|
12
|
+
connected() {
|
|
13
|
+
registerClick(this);
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
disconnected() {
|
|
17
|
+
unregisterClick(this);
|
|
18
|
+
},
|
|
19
|
+
|
|
12
20
|
methods: {
|
|
13
21
|
async scrollTo(el) {
|
|
14
22
|
el = (el && $(el)) || document.body;
|
|
@@ -19,18 +27,37 @@ export default {
|
|
|
19
27
|
}
|
|
20
28
|
},
|
|
21
29
|
},
|
|
30
|
+
};
|
|
22
31
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
const components = new Set();
|
|
33
|
+
function registerClick(cmp) {
|
|
34
|
+
if (!components.size) {
|
|
35
|
+
on(document, 'click', clickHandler);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
components.add(cmp);
|
|
39
|
+
}
|
|
28
40
|
|
|
41
|
+
function unregisterClick(cmp) {
|
|
42
|
+
components.delete(cmp);
|
|
43
|
+
|
|
44
|
+
if (!components.length) {
|
|
45
|
+
off(document, 'click', clickHandler);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function clickHandler(e) {
|
|
50
|
+
if (e.defaultPrevented) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
for (const component of components) {
|
|
55
|
+
if (within(e.target, component.$el)) {
|
|
29
56
|
e.preventDefault();
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
57
|
+
component.scrollTo(getTargetElement(component.$el));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
34
61
|
|
|
35
62
|
export function getTargetElement(el) {
|
|
36
63
|
return document.getElementById(decodeURIComponent(el.hash).substring(1));
|
package/src/js/mixin/media.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createEvent,
|
|
3
|
-
|
|
3
|
+
css,
|
|
4
4
|
isNumeric,
|
|
5
5
|
isString,
|
|
6
6
|
on,
|
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
connected() {
|
|
22
|
-
const media = toMedia(this.media);
|
|
22
|
+
const media = toMedia(this.media, this.$el);
|
|
23
23
|
this.matchMedia = true;
|
|
24
24
|
if (media) {
|
|
25
25
|
this.mediaObj = window.matchMedia(media);
|
|
@@ -40,11 +40,10 @@ export default {
|
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
function toMedia(value) {
|
|
43
|
+
function toMedia(value, element) {
|
|
44
44
|
if (isString(value)) {
|
|
45
45
|
if (startsWith(value, '@')) {
|
|
46
|
-
|
|
47
|
-
value = toFloat(getCssVar(name));
|
|
46
|
+
value = toFloat(css(element, `--uk-breakpoint-${value.substr(1)}`));
|
|
48
47
|
} else if (isNaN(value)) {
|
|
49
48
|
return value;
|
|
50
49
|
}
|
package/src/js/mixin/modal.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
includes,
|
|
10
10
|
isFocusable,
|
|
11
11
|
last,
|
|
12
|
+
noop,
|
|
12
13
|
on,
|
|
13
14
|
once,
|
|
14
15
|
parent,
|
|
@@ -134,8 +135,8 @@ export default {
|
|
|
134
135
|
);
|
|
135
136
|
|
|
136
137
|
if (this.overlay) {
|
|
137
|
-
once(this.$el, '
|
|
138
|
-
once(this.$el, '
|
|
138
|
+
once(this.$el, 'hidden', preventOverscroll(this.$el));
|
|
139
|
+
once(this.$el, 'hidden', preventBackgroundScroll());
|
|
139
140
|
}
|
|
140
141
|
|
|
141
142
|
if (this.stack) {
|
|
@@ -217,10 +218,6 @@ export default {
|
|
|
217
218
|
active.splice(active.indexOf(this), 1);
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
if (!active.length) {
|
|
221
|
-
css(document.body, 'overflowY', '');
|
|
222
|
-
}
|
|
223
|
-
|
|
224
221
|
css(this.$el, 'zIndex', '');
|
|
225
222
|
|
|
226
223
|
if (!active.some((modal) => modal.clsPage === this.clsPage)) {
|
|
@@ -337,7 +334,12 @@ export function preventOverscroll(el) {
|
|
|
337
334
|
return () => events.forEach((fn) => fn());
|
|
338
335
|
}
|
|
339
336
|
|
|
337
|
+
let prevented;
|
|
340
338
|
export function preventBackgroundScroll() {
|
|
339
|
+
if (prevented) {
|
|
340
|
+
return noop;
|
|
341
|
+
}
|
|
342
|
+
prevented = true;
|
|
341
343
|
const { body, documentElement } = document;
|
|
342
344
|
css(body, {
|
|
343
345
|
overflowY: width(window) > documentElement.clientWidth ? 'scroll' : '',
|
|
@@ -345,6 +347,7 @@ export function preventBackgroundScroll() {
|
|
|
345
347
|
});
|
|
346
348
|
css(documentElement, 'overflowY', 'hidden');
|
|
347
349
|
return () => {
|
|
350
|
+
prevented = false;
|
|
348
351
|
css(documentElement, 'overflowY', '');
|
|
349
352
|
css(body, { overflowY: '', touchAction: '' });
|
|
350
353
|
};
|
package/src/js/mixin/position.js
CHANGED
|
@@ -2,13 +2,11 @@ import {
|
|
|
2
2
|
css,
|
|
3
3
|
dimensions,
|
|
4
4
|
flipPosition,
|
|
5
|
-
getCssVar,
|
|
6
5
|
includes,
|
|
7
6
|
isRtl,
|
|
8
7
|
positionAt,
|
|
9
8
|
scrollParents,
|
|
10
9
|
toPx,
|
|
11
|
-
trigger,
|
|
12
10
|
} from 'uikit-util';
|
|
13
11
|
|
|
14
12
|
export default {
|
|
@@ -16,12 +14,16 @@ export default {
|
|
|
16
14
|
pos: String,
|
|
17
15
|
offset: null,
|
|
18
16
|
flip: Boolean,
|
|
17
|
+
shift: Boolean,
|
|
18
|
+
inset: Boolean,
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
data: {
|
|
22
22
|
pos: `bottom-${isRtl ? 'right' : 'left'}`,
|
|
23
|
-
flip: true,
|
|
24
23
|
offset: false,
|
|
24
|
+
flip: true,
|
|
25
|
+
shift: true,
|
|
26
|
+
inset: false,
|
|
25
27
|
},
|
|
26
28
|
|
|
27
29
|
connected() {
|
|
@@ -35,7 +37,7 @@ export default {
|
|
|
35
37
|
let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
|
|
36
38
|
|
|
37
39
|
const attach = {
|
|
38
|
-
element: [flipPosition(this.dir), this.align],
|
|
40
|
+
element: [this.inset ? this.dir : flipPosition(this.dir), this.align],
|
|
39
41
|
target: [this.dir, this.align],
|
|
40
42
|
};
|
|
41
43
|
|
|
@@ -53,21 +55,14 @@ export default {
|
|
|
53
55
|
const elDim = dimensions(element);
|
|
54
56
|
css(element, { top: -elDim.height, left: -elDim.width });
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
viewportOffset: this.getViewportOffset(element),
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
trigger(element, 'beforeposition', args);
|
|
69
|
-
|
|
70
|
-
positionAt(...args);
|
|
58
|
+
positionAt(element, target, {
|
|
59
|
+
attach,
|
|
60
|
+
offset,
|
|
61
|
+
boundary,
|
|
62
|
+
flip: this.flip,
|
|
63
|
+
shift: this.shift,
|
|
64
|
+
viewportOffset: this.getViewportOffset(element),
|
|
65
|
+
});
|
|
71
66
|
|
|
72
67
|
// Restore scroll position
|
|
73
68
|
scrollElement.scrollTop = scrollTop;
|
|
@@ -77,25 +72,27 @@ export default {
|
|
|
77
72
|
getPositionOffset(element) {
|
|
78
73
|
return (
|
|
79
74
|
toPx(
|
|
80
|
-
this.offset === false ?
|
|
75
|
+
this.offset === false ? css(element, '--uk-position-offset') : this.offset,
|
|
81
76
|
this.axis === 'x' ? 'width' : 'height',
|
|
82
77
|
element
|
|
83
|
-
) *
|
|
78
|
+
) *
|
|
79
|
+
(includes(['left', 'top'], this.dir) ? -1 : 1) *
|
|
80
|
+
(this.inset ? -1 : 1)
|
|
84
81
|
);
|
|
85
82
|
},
|
|
86
83
|
|
|
87
84
|
getShiftOffset(element) {
|
|
88
|
-
return
|
|
85
|
+
return this.align === 'center'
|
|
89
86
|
? 0
|
|
90
87
|
: toPx(
|
|
91
|
-
|
|
88
|
+
css(element, '--uk-position-shift-offset'),
|
|
92
89
|
this.axis === 'y' ? 'width' : 'height',
|
|
93
90
|
element
|
|
94
91
|
) * (includes(['left', 'top'], this.align) ? 1 : -1);
|
|
95
92
|
},
|
|
96
93
|
|
|
97
94
|
getViewportOffset(element) {
|
|
98
|
-
return toPx(
|
|
95
|
+
return toPx(css(element, '--uk-position-viewport-offset'));
|
|
99
96
|
},
|
|
100
97
|
},
|
|
101
98
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
addClass,
|
|
4
4
|
Animation,
|
|
5
5
|
css,
|
|
6
|
-
|
|
6
|
+
dimensions,
|
|
7
7
|
hasClass,
|
|
8
8
|
includes,
|
|
9
9
|
isBoolean,
|
|
@@ -11,13 +11,14 @@ import {
|
|
|
11
11
|
isVisible,
|
|
12
12
|
noop,
|
|
13
13
|
removeClass,
|
|
14
|
-
scrollParents,
|
|
15
14
|
startsWith,
|
|
16
15
|
toFloat,
|
|
17
16
|
toggleClass,
|
|
18
17
|
toNodes,
|
|
19
18
|
Transition,
|
|
20
19
|
trigger,
|
|
20
|
+
unwrap,
|
|
21
|
+
wrapInner,
|
|
21
22
|
} from 'uikit-util';
|
|
22
23
|
|
|
23
24
|
export default {
|
|
@@ -39,26 +40,6 @@ export default {
|
|
|
39
40
|
transition: 'ease',
|
|
40
41
|
clsEnter: 'uk-togglabe-enter',
|
|
41
42
|
clsLeave: 'uk-togglabe-leave',
|
|
42
|
-
|
|
43
|
-
initProps: {
|
|
44
|
-
overflow: '',
|
|
45
|
-
maxHeight: '',
|
|
46
|
-
paddingTop: '',
|
|
47
|
-
paddingBottom: '',
|
|
48
|
-
marginTop: '',
|
|
49
|
-
marginBottom: '',
|
|
50
|
-
boxShadow: '',
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
hideProps: {
|
|
54
|
-
overflow: 'hidden',
|
|
55
|
-
maxHeight: 0,
|
|
56
|
-
paddingTop: 0,
|
|
57
|
-
paddingBottom: 0,
|
|
58
|
-
marginTop: 0,
|
|
59
|
-
marginBottom: 0,
|
|
60
|
-
boxShadow: 'none',
|
|
61
|
-
},
|
|
62
43
|
},
|
|
63
44
|
|
|
64
45
|
computed: {
|
|
@@ -67,7 +48,7 @@ export default {
|
|
|
67
48
|
},
|
|
68
49
|
|
|
69
50
|
hasTransition({ animation }) {
|
|
70
|
-
return startsWith(animation[0],
|
|
51
|
+
return ['slide', 'reveal'].some((transition) => startsWith(animation[0], transition));
|
|
71
52
|
},
|
|
72
53
|
},
|
|
73
54
|
|
|
@@ -160,122 +141,97 @@ function toggleInstant({ _toggle }) {
|
|
|
160
141
|
};
|
|
161
142
|
}
|
|
162
143
|
|
|
163
|
-
function toggleTransition(cmp) {
|
|
164
|
-
|
|
165
|
-
case 'slide-left':
|
|
166
|
-
return slideHorizontal(cmp);
|
|
167
|
-
case 'slide-right':
|
|
168
|
-
return slideHorizontal(cmp, true);
|
|
169
|
-
}
|
|
170
|
-
return slide(cmp);
|
|
171
|
-
}
|
|
144
|
+
export function toggleTransition(cmp) {
|
|
145
|
+
const [mode = 'reveal', startProp = 'top'] = cmp.animation[0]?.split('-') || [];
|
|
172
146
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const inProgress = Transition.inProgress(el);
|
|
184
|
-
const inner =
|
|
185
|
-
!inProgress && el.hasChildNodes()
|
|
186
|
-
? toFloat(css(el.firstElementChild, 'marginTop')) +
|
|
187
|
-
toFloat(css(el.lastElementChild, 'marginBottom'))
|
|
188
|
-
: 0;
|
|
189
|
-
const currentHeight = isVisible(el) ? toFloat(css(el, 'height')) + inner : 0;
|
|
147
|
+
const dirs = [
|
|
148
|
+
['left', 'right'],
|
|
149
|
+
['top', 'bottom'],
|
|
150
|
+
];
|
|
151
|
+
const dir = dirs[includes(dirs[0], startProp) ? 0 : 1];
|
|
152
|
+
const end = dir[1] === startProp;
|
|
153
|
+
const props = ['width', 'height'];
|
|
154
|
+
const dimProp = props[dirs.indexOf(dir)];
|
|
155
|
+
const marginProp = `margin-${dir[0]}`;
|
|
156
|
+
const marginStartProp = `margin-${startProp}`;
|
|
190
157
|
|
|
191
|
-
|
|
158
|
+
return async (el, show) => {
|
|
159
|
+
let { duration, velocity, transition, _toggle } = cmp;
|
|
192
160
|
|
|
193
|
-
|
|
161
|
+
let currentDim = dimensions(el)[dimProp];
|
|
162
|
+
|
|
163
|
+
const inProgress = Transition.inProgress(el);
|
|
164
|
+
await Transition.cancel(el);
|
|
194
165
|
|
|
195
|
-
if (
|
|
166
|
+
if (show) {
|
|
196
167
|
_toggle(el, true);
|
|
197
168
|
}
|
|
198
169
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const endHeight = toFloat(css(el, 'height')) + inner;
|
|
205
|
-
duration = velocity * endHeight + duration;
|
|
206
|
-
|
|
207
|
-
css(el, { ...props, maxHeight: currentHeight });
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
show
|
|
211
|
-
? Transition.start(
|
|
212
|
-
el,
|
|
213
|
-
{ ...initProps, overflow: 'hidden', maxHeight: endHeight },
|
|
214
|
-
duration * (1 - currentHeight / endHeight),
|
|
215
|
-
transition
|
|
216
|
-
)
|
|
217
|
-
: Transition.start(
|
|
218
|
-
el,
|
|
219
|
-
hideProps,
|
|
220
|
-
duration * (currentHeight / endHeight),
|
|
221
|
-
transition
|
|
222
|
-
).then(() => _toggle(el, false))
|
|
223
|
-
).then(() => css(el, initProps));
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function slideHorizontal({ isToggled, duration, velocity, transition, _toggle }, right) {
|
|
228
|
-
return (el, show) => {
|
|
229
|
-
const visible = isVisible(el);
|
|
230
|
-
const marginLeft = toFloat(css(el, 'marginLeft'));
|
|
231
|
-
|
|
232
|
-
Transition.cancel(el);
|
|
170
|
+
const prevProps = Object.fromEntries(
|
|
171
|
+
['padding', 'border', 'width', 'height', 'overflow', marginProp, marginStartProp].map(
|
|
172
|
+
(key) => [key, el.style[key]]
|
|
173
|
+
)
|
|
174
|
+
);
|
|
233
175
|
|
|
234
|
-
const
|
|
235
|
-
css(
|
|
176
|
+
const dim = dimensions(el);
|
|
177
|
+
const currentMargin = toFloat(css(el, marginProp));
|
|
178
|
+
const marginStart = toFloat(css(el, marginStartProp));
|
|
179
|
+
const endDim = dim[dimProp] + marginStart;
|
|
236
180
|
|
|
237
|
-
if (!
|
|
238
|
-
|
|
181
|
+
if (!inProgress && !show) {
|
|
182
|
+
currentDim += marginStart;
|
|
239
183
|
}
|
|
240
184
|
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
185
|
+
const [wrapper] = wrapInner(el, '<div>');
|
|
186
|
+
css(wrapper, {
|
|
187
|
+
boxSizing: 'border-box',
|
|
188
|
+
height: dim.height,
|
|
189
|
+
width: dim.width,
|
|
190
|
+
...css(el, [
|
|
191
|
+
'padding',
|
|
192
|
+
'borderTop',
|
|
193
|
+
'borderRight',
|
|
194
|
+
'borderBottom',
|
|
195
|
+
'borderLeft',
|
|
196
|
+
'borderImage',
|
|
197
|
+
marginStartProp,
|
|
198
|
+
]),
|
|
199
|
+
});
|
|
245
200
|
|
|
246
201
|
css(el, {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
202
|
+
padding: 0,
|
|
203
|
+
border: 0,
|
|
204
|
+
[marginStartProp]: 0,
|
|
205
|
+
width: dim.width,
|
|
206
|
+
height: dim.height,
|
|
207
|
+
overflow: 'hidden',
|
|
208
|
+
[dimProp]: currentDim,
|
|
251
209
|
});
|
|
252
210
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
css(el, { clipPath: '', marginLeft: '' });
|
|
278
|
-
});
|
|
211
|
+
const percent = currentDim / endDim;
|
|
212
|
+
duration = (velocity * endDim + duration) * (show ? 1 - percent : percent);
|
|
213
|
+
const endProps = { [dimProp]: show ? endDim : 0 };
|
|
214
|
+
|
|
215
|
+
if (end) {
|
|
216
|
+
css(el, marginProp, endDim - currentDim + currentMargin);
|
|
217
|
+
endProps[marginProp] = show ? currentMargin : endDim + currentMargin;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (!end ^ (mode === 'reveal')) {
|
|
221
|
+
css(wrapper, marginProp, -endDim + currentDim);
|
|
222
|
+
Transition.start(wrapper, { [marginProp]: show ? 0 : -endDim }, duration, transition);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
try {
|
|
226
|
+
await Transition.start(el, endProps, duration, transition);
|
|
227
|
+
} finally {
|
|
228
|
+
css(el, prevProps);
|
|
229
|
+
unwrap(wrapper.firstChild);
|
|
230
|
+
|
|
231
|
+
if (!show) {
|
|
232
|
+
_toggle(el, false);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
279
235
|
};
|
|
280
236
|
}
|
|
281
237
|
|
package/src/js/util/animation.js
CHANGED
|
@@ -50,13 +50,14 @@ export function transition(element, props, duration = 400, timing = 'linear') {
|
|
|
50
50
|
export const Transition = {
|
|
51
51
|
start: transition,
|
|
52
52
|
|
|
53
|
-
stop(element) {
|
|
53
|
+
async stop(element) {
|
|
54
54
|
trigger(element, 'transitionend');
|
|
55
|
-
|
|
55
|
+
await Promise.resolve();
|
|
56
56
|
},
|
|
57
57
|
|
|
58
|
-
cancel(element) {
|
|
58
|
+
async cancel(element) {
|
|
59
59
|
trigger(element, 'transitioncanceled');
|
|
60
|
+
await Promise.resolve();
|
|
60
61
|
},
|
|
61
62
|
|
|
62
63
|
inProgress(element) {
|
package/src/js/util/filter.js
CHANGED
|
@@ -51,12 +51,8 @@ export function matches(element, selector) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export function closest(element, selector) {
|
|
54
|
-
if (startsWith(selector, '>')) {
|
|
55
|
-
selector = selector.slice(1);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
54
|
return isElement(element)
|
|
59
|
-
? element.closest(selector)
|
|
55
|
+
? element.closest(startsWith(selector, '>') ? selector.slice(1) : selector)
|
|
60
56
|
: toNodes(element)
|
|
61
57
|
.map((element) => closest(element, selector))
|
|
62
58
|
.filter(Boolean);
|
|
@@ -64,8 +60,8 @@ export function closest(element, selector) {
|
|
|
64
60
|
|
|
65
61
|
export function within(element, selector) {
|
|
66
62
|
return isString(selector)
|
|
67
|
-
?
|
|
68
|
-
:
|
|
63
|
+
? !!closest(element, selector)
|
|
64
|
+
: toNode(selector).contains(toNode(element));
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
export function parents(element, selector) {
|