uikit 3.14.4-dev.871ba3c05 → 3.14.4-dev.a014fa609
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 +47 -12
- package/build/util.js +1 -0
- package/dist/css/uikit-core-rtl.css +385 -110
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +385 -110
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +402 -115
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +402 -115
- 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 +7 -5
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +196 -140
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +196 -140
- 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 +22 -7
- 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 +22 -7
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +3 -3
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +107 -137
- 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 +1819 -1714
- 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 +1081 -959
- package/dist/js/uikit.min.js +14 -1
- package/package.json +1 -1
- package/src/images/{backgrounds/nav-parent-open.svg → components/nav-parent-icon-large.svg} +0 -0
- package/src/images/components/nav-parent-icon.svg +3 -0
- package/src/images/components/navbar-parent-icon.svg +3 -0
- package/src/images/components/navbar-toggle-icon.svg +22 -3
- package/src/js/api/state.js +2 -2
- package/src/js/components/filter.js +5 -3
- package/src/js/components/sortable.js +2 -3
- package/src/js/core/accordion.js +9 -17
- package/src/js/core/alert.js +35 -14
- package/src/js/core/drop.js +115 -80
- package/src/js/core/height-viewport.js +14 -6
- package/src/js/core/icon.js +16 -0
- package/src/js/core/index.js +2 -0
- package/src/js/core/leader.js +2 -2
- package/src/js/core/navbar.js +44 -30
- package/src/js/core/offcanvas.js +1 -47
- package/src/js/core/scroll.js +37 -10
- package/src/js/core/sticky.js +8 -9
- package/src/js/core/toggle.js +3 -5
- package/src/js/mixin/media.js +4 -5
- package/src/js/mixin/modal.js +97 -8
- package/src/js/mixin/position.js +26 -11
- package/src/js/mixin/slider-drag.js +20 -8
- package/src/js/mixin/style.js +11 -0
- package/src/js/mixin/togglable.js +88 -133
- package/src/js/util/animation.js +4 -3
- package/src/js/util/class.js +3 -1
- package/src/js/util/dimensions.js +6 -6
- package/src/js/util/filter.js +3 -7
- package/src/js/util/position.js +108 -107
- package/src/js/util/style.js +4 -13
- package/src/js/util/viewport.js +5 -32
- 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 +16 -16
- package/src/less/components/leader.less +1 -1
- package/src/less/components/nav.less +240 -63
- package/src/less/components/navbar.less +81 -38
- package/src/less/components/utility.less +21 -4
- 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 +43 -9
- package/src/less/theme/navbar.less +7 -11
- 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 +16 -16
- package/src/scss/components/leader.scss +1 -1
- package/src/scss/components/nav.scss +189 -51
- package/src/scss/components/navbar.scss +69 -38
- package/src/scss/components/utility.scss +19 -3
- package/src/scss/mixins-theme.scss +93 -25
- package/src/scss/mixins.scss +89 -17
- 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 +41 -9
- package/src/scss/theme/navbar.scss +7 -8
- package/src/scss/variables-theme.scss +71 -18
- package/src/scss/variables.scss +60 -14
- package/tests/accordion.html +2 -2
- package/tests/alert.html +2 -2
- package/tests/countdown.html +1 -1
- package/tests/drop.html +461 -375
- package/tests/dropbar.html +458 -0
- package/tests/dropdown.html +26 -401
- package/tests/filter.html +9 -12
- package/tests/form.html +1 -1
- package/tests/index.html +126 -107
- package/tests/js/index.js +1 -4
- package/tests/lightbox.html +5 -5
- package/tests/list.html +8 -8
- package/tests/modal.html +13 -13
- package/tests/nav.html +117 -75
- package/tests/navbar.html +2002 -1131
- package/tests/offcanvas.html +17 -21
- package/tests/parallax.html +1 -1
- package/tests/position.html +18 -16
- package/tests/progress.html +9 -9
- package/tests/scroll.html +7 -10
- package/tests/search.html +6 -6
- package/tests/slider.html +6 -5
- package/tests/slideshow.html +8 -8
- package/tests/sortable.html +6 -8
- package/tests/sticky-navbar.html +9 -9
- 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/images/backgrounds/nav-parent-close.svg +0 -3
package/src/js/mixin/position.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
css,
|
|
3
3
|
dimensions,
|
|
4
4
|
flipPosition,
|
|
5
|
-
getCssVar,
|
|
6
5
|
includes,
|
|
7
6
|
isRtl,
|
|
8
7
|
positionAt,
|
|
8
|
+
scrollParents,
|
|
9
9
|
toPx,
|
|
10
10
|
} from 'uikit-util';
|
|
11
11
|
|
|
@@ -14,12 +14,16 @@ export default {
|
|
|
14
14
|
pos: String,
|
|
15
15
|
offset: null,
|
|
16
16
|
flip: Boolean,
|
|
17
|
+
shift: Boolean,
|
|
18
|
+
inset: Boolean,
|
|
17
19
|
},
|
|
18
20
|
|
|
19
21
|
data: {
|
|
20
22
|
pos: `bottom-${isRtl ? 'right' : 'left'}`,
|
|
21
|
-
flip: true,
|
|
22
23
|
offset: false,
|
|
24
|
+
flip: true,
|
|
25
|
+
shift: true,
|
|
26
|
+
inset: false,
|
|
23
27
|
},
|
|
24
28
|
|
|
25
29
|
connected() {
|
|
@@ -31,19 +35,24 @@ export default {
|
|
|
31
35
|
methods: {
|
|
32
36
|
positionAt(element, target, boundary) {
|
|
33
37
|
let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
|
|
38
|
+
const placement = [this.flip && 'flip', this.shift && 'shift'];
|
|
34
39
|
|
|
35
40
|
const attach = {
|
|
36
|
-
element: [flipPosition(this.dir), this.align],
|
|
41
|
+
element: [this.inset ? this.dir : flipPosition(this.dir), this.align],
|
|
37
42
|
target: [this.dir, this.align],
|
|
38
43
|
};
|
|
39
44
|
|
|
40
45
|
if (this.axis === 'y') {
|
|
41
46
|
for (const prop in attach) {
|
|
42
|
-
attach[prop]
|
|
47
|
+
attach[prop].reverse();
|
|
43
48
|
}
|
|
44
|
-
offset
|
|
49
|
+
offset.reverse();
|
|
50
|
+
placement.reverse();
|
|
45
51
|
}
|
|
46
52
|
|
|
53
|
+
const [scrollElement] = scrollParents(element, /auto|scroll/);
|
|
54
|
+
const { scrollTop, scrollLeft } = scrollElement;
|
|
55
|
+
|
|
47
56
|
// Ensure none positioned element does not generate scrollbars
|
|
48
57
|
const elDim = dimensions(element);
|
|
49
58
|
css(element, { top: -elDim.height, left: -elDim.width });
|
|
@@ -52,33 +61,39 @@ export default {
|
|
|
52
61
|
attach,
|
|
53
62
|
offset,
|
|
54
63
|
boundary,
|
|
55
|
-
|
|
64
|
+
placement,
|
|
56
65
|
viewportOffset: this.getViewportOffset(element),
|
|
57
66
|
});
|
|
67
|
+
|
|
68
|
+
// Restore scroll position
|
|
69
|
+
scrollElement.scrollTop = scrollTop;
|
|
70
|
+
scrollElement.scrollLeft = scrollLeft;
|
|
58
71
|
},
|
|
59
72
|
|
|
60
73
|
getPositionOffset(element) {
|
|
61
74
|
return (
|
|
62
75
|
toPx(
|
|
63
|
-
this.offset === false ?
|
|
76
|
+
this.offset === false ? css(element, '--uk-position-offset') : this.offset,
|
|
64
77
|
this.axis === 'x' ? 'width' : 'height',
|
|
65
78
|
element
|
|
66
|
-
) *
|
|
79
|
+
) *
|
|
80
|
+
(includes(['left', 'top'], this.dir) ? -1 : 1) *
|
|
81
|
+
(this.inset ? -1 : 1)
|
|
67
82
|
);
|
|
68
83
|
},
|
|
69
84
|
|
|
70
85
|
getShiftOffset(element) {
|
|
71
|
-
return
|
|
86
|
+
return this.align === 'center'
|
|
72
87
|
? 0
|
|
73
88
|
: toPx(
|
|
74
|
-
|
|
89
|
+
css(element, '--uk-position-shift-offset'),
|
|
75
90
|
this.axis === 'y' ? 'width' : 'height',
|
|
76
91
|
element
|
|
77
92
|
) * (includes(['left', 'top'], this.align) ? 1 : -1);
|
|
78
93
|
},
|
|
79
94
|
|
|
80
95
|
getViewportOffset(element) {
|
|
81
|
-
return toPx(
|
|
96
|
+
return toPx(css(element, '--uk-position-viewport-offset'));
|
|
82
97
|
},
|
|
83
98
|
},
|
|
84
99
|
};
|
|
@@ -5,16 +5,18 @@ import {
|
|
|
5
5
|
includes,
|
|
6
6
|
isRtl,
|
|
7
7
|
isTouch,
|
|
8
|
+
noop,
|
|
8
9
|
off,
|
|
9
10
|
on,
|
|
10
|
-
pointerCancel,
|
|
11
|
-
pointerDown,
|
|
12
|
-
pointerMove,
|
|
13
|
-
pointerUp,
|
|
14
11
|
selInput,
|
|
15
12
|
trigger,
|
|
16
13
|
} from 'uikit-util';
|
|
17
14
|
|
|
15
|
+
const pointerOptions = { passive: false, capture: true };
|
|
16
|
+
const pointerDown = 'touchstart mousedown';
|
|
17
|
+
const pointerMove = 'touchmove mousemove';
|
|
18
|
+
const pointerUp = 'touchend touchcancel mouseup click input';
|
|
19
|
+
|
|
18
20
|
export default {
|
|
19
21
|
props: {
|
|
20
22
|
draggable: Boolean,
|
|
@@ -69,6 +71,16 @@ export default {
|
|
|
69
71
|
e.preventDefault();
|
|
70
72
|
},
|
|
71
73
|
},
|
|
74
|
+
|
|
75
|
+
{
|
|
76
|
+
// iOS workaround for slider stopping if swiping fast
|
|
77
|
+
name: `${pointerMove} ${pointerUp}`,
|
|
78
|
+
el() {
|
|
79
|
+
return this.list;
|
|
80
|
+
},
|
|
81
|
+
handler: noop,
|
|
82
|
+
...pointerOptions,
|
|
83
|
+
},
|
|
72
84
|
],
|
|
73
85
|
|
|
74
86
|
methods: {
|
|
@@ -89,10 +101,10 @@ export default {
|
|
|
89
101
|
this.prevIndex = this.index;
|
|
90
102
|
}
|
|
91
103
|
|
|
92
|
-
on(document, pointerMove, this.move,
|
|
104
|
+
on(document, pointerMove, this.move, pointerOptions);
|
|
93
105
|
|
|
94
106
|
// 'input' event is triggered by video controls
|
|
95
|
-
on(document,
|
|
107
|
+
on(document, pointerUp, this.end, pointerOptions);
|
|
96
108
|
|
|
97
109
|
css(this.list, 'userSelect', 'none');
|
|
98
110
|
},
|
|
@@ -172,8 +184,8 @@ export default {
|
|
|
172
184
|
},
|
|
173
185
|
|
|
174
186
|
end() {
|
|
175
|
-
off(document, pointerMove, this.move,
|
|
176
|
-
off(document,
|
|
187
|
+
off(document, pointerMove, this.move, pointerOptions);
|
|
188
|
+
off(document, pointerUp, this.end, pointerOptions);
|
|
177
189
|
|
|
178
190
|
if (this.dragging) {
|
|
179
191
|
this.dragging = null;
|
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
addClass,
|
|
4
4
|
Animation,
|
|
5
5
|
css,
|
|
6
|
-
|
|
6
|
+
dimensions,
|
|
7
7
|
hasClass,
|
|
8
8
|
includes,
|
|
9
9
|
isBoolean,
|
|
10
10
|
isFunction,
|
|
11
11
|
isVisible,
|
|
12
12
|
noop,
|
|
13
|
-
offset,
|
|
14
13
|
removeClass,
|
|
15
|
-
scrollParents,
|
|
16
14
|
startsWith,
|
|
17
15
|
toFloat,
|
|
18
16
|
toggleClass,
|
|
19
17
|
toNodes,
|
|
20
18
|
Transition,
|
|
21
19
|
trigger,
|
|
20
|
+
unwrap,
|
|
21
|
+
wrapInner,
|
|
22
22
|
} from 'uikit-util';
|
|
23
23
|
|
|
24
24
|
export default {
|
|
@@ -40,26 +40,6 @@ export default {
|
|
|
40
40
|
transition: 'ease',
|
|
41
41
|
clsEnter: 'uk-togglabe-enter',
|
|
42
42
|
clsLeave: 'uk-togglabe-leave',
|
|
43
|
-
|
|
44
|
-
initProps: {
|
|
45
|
-
overflow: '',
|
|
46
|
-
maxHeight: '',
|
|
47
|
-
paddingTop: '',
|
|
48
|
-
paddingBottom: '',
|
|
49
|
-
marginTop: '',
|
|
50
|
-
marginBottom: '',
|
|
51
|
-
boxShadow: '',
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
hideProps: {
|
|
55
|
-
overflow: 'hidden',
|
|
56
|
-
maxHeight: 0,
|
|
57
|
-
paddingTop: 0,
|
|
58
|
-
paddingBottom: 0,
|
|
59
|
-
marginTop: 0,
|
|
60
|
-
marginBottom: 0,
|
|
61
|
-
boxShadow: 'none',
|
|
62
|
-
},
|
|
63
43
|
},
|
|
64
44
|
|
|
65
45
|
computed: {
|
|
@@ -68,7 +48,7 @@ export default {
|
|
|
68
48
|
},
|
|
69
49
|
|
|
70
50
|
hasTransition({ animation }) {
|
|
71
|
-
return startsWith(animation[0],
|
|
51
|
+
return ['slide', 'reveal'].some((transition) => startsWith(animation[0], transition));
|
|
72
52
|
},
|
|
73
53
|
},
|
|
74
54
|
|
|
@@ -161,130 +141,105 @@ function toggleInstant({ _toggle }) {
|
|
|
161
141
|
};
|
|
162
142
|
}
|
|
163
143
|
|
|
164
|
-
function toggleTransition(cmp) {
|
|
165
|
-
|
|
166
|
-
case 'slide-left':
|
|
167
|
-
return slideHorizontal(cmp);
|
|
168
|
-
case 'slide-right':
|
|
169
|
-
return slideHorizontal(cmp, true);
|
|
170
|
-
}
|
|
171
|
-
return slide(cmp);
|
|
172
|
-
}
|
|
144
|
+
export function toggleTransition(cmp) {
|
|
145
|
+
const [mode = 'reveal', startProp = 'top'] = cmp.animation[0]?.split('-') || [];
|
|
173
146
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const inProgress = Transition.inProgress(el);
|
|
185
|
-
const inner =
|
|
186
|
-
!inProgress && el.hasChildNodes()
|
|
187
|
-
? toFloat(css(el.firstElementChild, 'marginTop')) +
|
|
188
|
-
toFloat(css(el.lastElementChild, 'marginBottom'))
|
|
189
|
-
: 0;
|
|
190
|
-
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}`;
|
|
191
157
|
|
|
192
|
-
|
|
158
|
+
return async (el, show) => {
|
|
159
|
+
let { duration, velocity, transition, _toggle } = cmp;
|
|
193
160
|
|
|
194
|
-
|
|
161
|
+
let currentDim = dimensions(el)[dimProp];
|
|
162
|
+
|
|
163
|
+
const inProgress = Transition.inProgress(el);
|
|
164
|
+
await Transition.cancel(el);
|
|
195
165
|
|
|
196
|
-
if (
|
|
166
|
+
if (show) {
|
|
197
167
|
_toggle(el, true);
|
|
198
168
|
}
|
|
199
169
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
? Transition.start(
|
|
213
|
-
el,
|
|
214
|
-
{ ...initProps, overflow: 'hidden', maxHeight: endHeight },
|
|
215
|
-
duration * (1 - currentHeight / endHeight),
|
|
216
|
-
transition
|
|
217
|
-
)
|
|
218
|
-
: Transition.start(
|
|
219
|
-
el,
|
|
220
|
-
hideProps,
|
|
221
|
-
duration * (currentHeight / endHeight),
|
|
222
|
-
transition
|
|
223
|
-
).then(() => _toggle(el, false))
|
|
224
|
-
).then(() => css(el, initProps));
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
function slideHorizontal({ isToggled, duration, velocity, transition, _toggle }, right) {
|
|
229
|
-
return (el, show) => {
|
|
230
|
-
const visible = isVisible(el);
|
|
231
|
-
const marginLeft = toFloat(css(el, 'marginLeft'));
|
|
232
|
-
|
|
233
|
-
Transition.cancel(el);
|
|
170
|
+
const prevProps = Object.fromEntries(
|
|
171
|
+
[
|
|
172
|
+
'padding',
|
|
173
|
+
'border',
|
|
174
|
+
'width',
|
|
175
|
+
'height',
|
|
176
|
+
'overflowY',
|
|
177
|
+
'overflowX',
|
|
178
|
+
marginProp,
|
|
179
|
+
marginStartProp,
|
|
180
|
+
].map((key) => [key, el.style[key]])
|
|
181
|
+
);
|
|
234
182
|
|
|
235
|
-
const
|
|
236
|
-
css(
|
|
183
|
+
const dim = dimensions(el);
|
|
184
|
+
const currentMargin = toFloat(css(el, marginProp));
|
|
185
|
+
const marginStart = toFloat(css(el, marginStartProp));
|
|
186
|
+
const endDim = dim[dimProp] + marginStart;
|
|
237
187
|
|
|
238
|
-
if (!
|
|
239
|
-
|
|
188
|
+
if (!inProgress && !show) {
|
|
189
|
+
currentDim += marginStart;
|
|
240
190
|
}
|
|
241
191
|
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
192
|
+
const [wrapper] = wrapInner(el, '<div>');
|
|
193
|
+
css(wrapper, {
|
|
194
|
+
boxSizing: 'border-box',
|
|
195
|
+
height: dim.height,
|
|
196
|
+
width: dim.width,
|
|
197
|
+
...css(el, [
|
|
198
|
+
'overflow',
|
|
199
|
+
'padding',
|
|
200
|
+
'borderTop',
|
|
201
|
+
'borderRight',
|
|
202
|
+
'borderBottom',
|
|
203
|
+
'borderLeft',
|
|
204
|
+
'borderImage',
|
|
205
|
+
marginStartProp,
|
|
206
|
+
]),
|
|
207
|
+
});
|
|
250
208
|
|
|
251
209
|
css(el, {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
210
|
+
padding: 0,
|
|
211
|
+
border: 0,
|
|
212
|
+
[marginStartProp]: 0,
|
|
213
|
+
width: dim.width,
|
|
214
|
+
height: dim.height,
|
|
215
|
+
overflow: 'hidden',
|
|
216
|
+
[dimProp]: currentDim,
|
|
258
217
|
});
|
|
259
218
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
).then(() => {
|
|
285
|
-
css(scrollElement, 'overflowX', '');
|
|
286
|
-
css(el, { clipPath: '', marginLeft: '' });
|
|
287
|
-
});
|
|
219
|
+
const percent = currentDim / endDim;
|
|
220
|
+
duration = (velocity * endDim + duration) * (show ? 1 - percent : percent);
|
|
221
|
+
const endProps = { [dimProp]: show ? endDim : 0 };
|
|
222
|
+
|
|
223
|
+
if (end) {
|
|
224
|
+
css(el, marginProp, endDim - currentDim + currentMargin);
|
|
225
|
+
endProps[marginProp] = show ? currentMargin : endDim + currentMargin;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (!end ^ (mode === 'reveal')) {
|
|
229
|
+
css(wrapper, marginProp, -endDim + currentDim);
|
|
230
|
+
Transition.start(wrapper, { [marginProp]: show ? 0 : -endDim }, duration, transition);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
try {
|
|
234
|
+
await Transition.start(el, endProps, duration, transition);
|
|
235
|
+
} finally {
|
|
236
|
+
css(el, prevProps);
|
|
237
|
+
unwrap(wrapper.firstChild);
|
|
238
|
+
|
|
239
|
+
if (!show) {
|
|
240
|
+
_toggle(el, false);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
288
243
|
};
|
|
289
244
|
}
|
|
290
245
|
|
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/class.js
CHANGED
|
@@ -10,7 +10,9 @@ export function removeClass(element, ...args) {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function removeClasses(element, cls) {
|
|
13
|
-
attr(element, 'class', (value) =>
|
|
13
|
+
attr(element, 'class', (value) =>
|
|
14
|
+
(value || '').replace(new RegExp(`\\b${cls}\\b\\s?`, 'g'), '')
|
|
15
|
+
);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export function replaceClass(element, ...args) {
|
|
@@ -94,13 +94,13 @@ export function position(element) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
export function offsetPosition(element) {
|
|
97
|
-
const offset = [0, 0];
|
|
98
|
-
|
|
99
97
|
element = toNode(element);
|
|
100
98
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
99
|
+
const offset = [element.offsetTop, element.offsetLeft];
|
|
100
|
+
|
|
101
|
+
while ((element = element.offsetParent)) {
|
|
102
|
+
offset[0] += element.offsetTop + toFloat(css(element, `borderTopWidth`));
|
|
103
|
+
offset[1] += element.offsetLeft + toFloat(css(element, `borderLeftWidth`));
|
|
104
104
|
|
|
105
105
|
if (css(element, 'position') === 'fixed') {
|
|
106
106
|
const win = toWindow(element);
|
|
@@ -108,7 +108,7 @@ export function offsetPosition(element) {
|
|
|
108
108
|
offset[1] += win.scrollX;
|
|
109
109
|
return offset;
|
|
110
110
|
}
|
|
111
|
-
}
|
|
111
|
+
}
|
|
112
112
|
|
|
113
113
|
return offset;
|
|
114
114
|
}
|
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) {
|