uikit 3.11.2-dev.28b7953b9 → 3.11.2-dev.29f2881ed
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/.eslintrc.json +4 -49
- package/.prettierignore +14 -0
- package/.prettierrc.json +13 -0
- package/.webstorm.js +3 -3
- package/CHANGELOG.md +42 -29
- package/build/.eslintrc.json +1 -3
- package/build/build.js +26 -28
- package/build/icons.js +7 -11
- package/build/less.js +48 -36
- package/build/package.json +2 -2
- package/build/prefix.js +21 -18
- package/build/publishDev.js +6 -8
- package/build/release.js +20 -17
- package/build/scope.js +21 -11
- package/build/scss.js +72 -39
- package/build/util.js +71 -62
- package/build/wrapper/icons.js +0 -2
- package/dist/css/uikit-core-rtl.css +127 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +127 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +129 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +129 -207
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1098 -1316
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1144 -1393
- package/dist/js/components/lightbox.min.js +1 -1
- package/dist/js/components/notification.js +94 -114
- package/dist/js/components/notification.min.js +1 -1
- package/dist/js/components/parallax.js +345 -358
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +343 -357
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +768 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +343 -357
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +643 -826
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -620
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +324 -356
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5339 -6661
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +7 -9
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +8156 -9889
- package/dist/js/uikit.min.js +1 -1
- package/jsconfig.json +1 -1
- package/package.json +64 -60
- package/src/js/api/boot.js +25 -32
- package/src/js/api/component.js +15 -28
- package/src/js/api/global.js +6 -12
- package/src/js/api/hooks.js +14 -33
- package/src/js/api/instance.js +7 -15
- package/src/js/api/state.js +65 -82
- package/src/js/components/countdown.js +24 -50
- package/src/js/components/filter.js +70 -66
- package/src/js/components/index.js +13 -13
- package/src/js/components/internal/lightbox-animations.js +14 -25
- package/src/js/components/internal/slider-preload.js +37 -0
- package/src/js/components/internal/slider-transitioner.js +66 -45
- package/src/js/components/internal/slideshow-animations.js +46 -64
- package/src/js/components/lightbox-panel.js +107 -105
- package/src/js/components/lightbox.js +17 -39
- package/src/js/components/notification.js +49 -43
- package/src/js/components/parallax.js +16 -30
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +95 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -44
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +52 -63
- package/src/js/core/accordion.js +53 -48
- package/src/js/core/alert.js +9 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +106 -92
- package/src/js/core/form-custom.js +20 -25
- package/src/js/core/gif.js +3 -7
- package/src/js/core/grid.js +57 -58
- package/src/js/core/height-match.js +16 -29
- package/src/js/core/height-viewport.js +28 -35
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +80 -78
- package/src/js/core/index.js +39 -39
- package/src/js/core/leader.js +9 -18
- package/src/js/core/margin.js +21 -37
- package/src/js/core/modal.js +49 -36
- package/src/js/core/nav.js +2 -4
- package/src/js/core/navbar.js +112 -88
- package/src/js/core/offcanvas.js +49 -53
- package/src/js/core/overflow-auto.js +13 -17
- package/src/js/core/responsive.js +14 -12
- package/src/js/core/scroll.js +10 -20
- package/src/js/core/scrollspy-nav.js +34 -31
- package/src/js/core/scrollspy.js +37 -54
- package/src/js/core/sticky.js +156 -118
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +66 -67
- package/src/js/core/video.js +11 -22
- package/src/js/mixin/animate.js +19 -20
- package/src/js/mixin/class.js +2 -4
- package/src/js/mixin/container.js +7 -11
- package/src/js/mixin/internal/animate-fade.js +73 -30
- package/src/js/mixin/internal/animate-slide.js +58 -41
- package/src/js/mixin/internal/slideshow-animations.js +7 -14
- package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +149 -106
- package/src/js/mixin/position.js +26 -20
- package/src/js/mixin/slider-autoplay.js +12 -21
- package/src/js/mixin/slider-drag.js +64 -65
- package/src/js/mixin/slider-nav.js +26 -35
- package/src/js/mixin/slider-reactive.js +2 -8
- package/src/js/mixin/slider.js +48 -55
- package/src/js/mixin/slideshow.js +13 -19
- package/src/js/mixin/togglable.js +89 -63
- package/src/js/uikit-core.js +2 -4
- package/src/js/uikit.js +2 -4
- package/src/js/util/ajax.js +25 -40
- package/src/js/util/animation.js +77 -75
- package/src/js/util/attr.js +17 -21
- package/src/js/util/class.js +14 -52
- package/src/js/util/dimensions.js +58 -45
- package/src/js/util/dom.js +39 -66
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +32 -46
- package/src/js/util/player.js +41 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +39 -49
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/base.less +10 -33
- package/src/less/components/flex.less +0 -9
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/height.less +3 -0
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +0 -3
- package/src/less/components/slideshow.less +0 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +3 -4
- package/src/scss/components/height.scss +3 -0
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/slider.scss +0 -3
- package/src/scss/components/slideshow.scss +0 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +9 -9
- package/src/scss/variables.scss +9 -9
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -54
- package/tests/images/image-type.avif +0 -0
- package/tests/images/image-type.jpeg +0 -0
- package/tests/images/image-type.webp +0 -0
- package/tests/index.html +8 -8
- package/tests/js/index.js +114 -85
- package/tests/lightbox.html +10 -10
- package/tests/marker.html +2 -2
- package/tests/modal.html +8 -9
- package/tests/navbar.html +2 -2
- package/tests/overlay.html +7 -7
- package/tests/parallax.html +14 -5
- package/tests/position.html +12 -12
- package/tests/slidenav.html +12 -12
- package/tests/slider.html +20 -20
- package/tests/sortable.html +1 -1
- package/tests/sticky-parallax.html +55 -70
- package/tests/svg.html +6 -6
- package/tests/table.html +11 -11
- package/tests/thumbnav.html +12 -12
- package/tests/transition.html +30 -30
- package/tests/utility.html +33 -33
- package/tests/video.html +1 -1
- package/tests/width.html +1 -1
- package/src/js/mixin/flex-bug.js +0 -56
- package/src/js/util/promise.js +0 -191
- package/tests/images/animated.gif +0 -0
- package/tests/images/test.avif +0 -0
- package/tests/images/test.webp +0 -0
package/src/js/core/navbar.js
CHANGED
|
@@ -1,14 +1,35 @@
|
|
|
1
|
-
import {active} from './drop';
|
|
1
|
+
import { active } from './drop';
|
|
2
2
|
import Class from '../mixin/class';
|
|
3
|
-
import FlexBug from '../mixin/flex-bug';
|
|
4
3
|
import Container from '../mixin/container';
|
|
5
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
$,
|
|
6
|
+
$$,
|
|
7
|
+
addClass,
|
|
8
|
+
after,
|
|
9
|
+
css,
|
|
10
|
+
findIndex,
|
|
11
|
+
hasAttr,
|
|
12
|
+
hasClass,
|
|
13
|
+
height,
|
|
14
|
+
includes,
|
|
15
|
+
isRtl,
|
|
16
|
+
isVisible,
|
|
17
|
+
matches,
|
|
18
|
+
noop,
|
|
19
|
+
once,
|
|
20
|
+
parent,
|
|
21
|
+
query,
|
|
22
|
+
remove,
|
|
23
|
+
selFocusable,
|
|
24
|
+
toFloat,
|
|
25
|
+
Transition,
|
|
26
|
+
within,
|
|
27
|
+
} from 'uikit-util';
|
|
6
28
|
|
|
7
29
|
const navItem = '.uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle';
|
|
8
30
|
|
|
9
31
|
export default {
|
|
10
|
-
|
|
11
|
-
mixins: [Class, Container, FlexBug],
|
|
32
|
+
mixins: [Class, Container],
|
|
12
33
|
|
|
13
34
|
props: {
|
|
14
35
|
dropdown: String,
|
|
@@ -23,7 +44,7 @@ export default {
|
|
|
23
44
|
dropbar: Boolean,
|
|
24
45
|
dropbarMode: String,
|
|
25
46
|
dropbarAnchor: Boolean,
|
|
26
|
-
duration: Number
|
|
47
|
+
duration: Number,
|
|
27
48
|
},
|
|
28
49
|
|
|
29
50
|
data: {
|
|
@@ -43,43 +64,41 @@ export default {
|
|
|
43
64
|
duration: 200,
|
|
44
65
|
forceHeight: true,
|
|
45
66
|
selMinHeight: navItem,
|
|
46
|
-
container: false
|
|
67
|
+
container: false,
|
|
47
68
|
},
|
|
48
69
|
|
|
49
70
|
computed: {
|
|
50
|
-
|
|
51
|
-
boundary({boundary, boundaryAlign}, $el) {
|
|
71
|
+
boundary({ boundary, boundaryAlign }, $el) {
|
|
52
72
|
return boundary === true || boundaryAlign ? $el : boundary;
|
|
53
73
|
},
|
|
54
74
|
|
|
55
|
-
dropbarAnchor({dropbarAnchor}, $el) {
|
|
75
|
+
dropbarAnchor({ dropbarAnchor }, $el) {
|
|
56
76
|
return query(dropbarAnchor, $el);
|
|
57
77
|
},
|
|
58
78
|
|
|
59
|
-
pos({align}) {
|
|
79
|
+
pos({ align }) {
|
|
60
80
|
return `bottom-${align}`;
|
|
61
81
|
},
|
|
62
82
|
|
|
63
83
|
dropbar: {
|
|
64
|
-
|
|
65
|
-
get({dropbar}) {
|
|
66
|
-
|
|
84
|
+
get({ dropbar }) {
|
|
67
85
|
if (!dropbar) {
|
|
68
86
|
return null;
|
|
69
87
|
}
|
|
70
88
|
|
|
71
|
-
dropbar =
|
|
89
|
+
dropbar =
|
|
90
|
+
this._dropbar ||
|
|
91
|
+
query(dropbar, this.$el) ||
|
|
92
|
+
$('+ .uk-navbar-dropbar', this.$el);
|
|
72
93
|
|
|
73
94
|
return dropbar ? dropbar : (this._dropbar = $('<div></div>'));
|
|
74
|
-
|
|
75
95
|
},
|
|
76
96
|
|
|
77
97
|
watch(dropbar) {
|
|
78
98
|
addClass(dropbar, 'uk-navbar-dropbar');
|
|
79
99
|
},
|
|
80
100
|
|
|
81
|
-
immediate: true
|
|
82
|
-
|
|
101
|
+
immediate: true,
|
|
83
102
|
},
|
|
84
103
|
|
|
85
104
|
dropContainer(_, $el) {
|
|
@@ -87,17 +106,16 @@ export default {
|
|
|
87
106
|
},
|
|
88
107
|
|
|
89
108
|
dropdowns: {
|
|
90
|
-
|
|
91
|
-
get({clsDrop}, $el) {
|
|
109
|
+
get({ clsDrop }, $el) {
|
|
92
110
|
const dropdowns = $$(`.${clsDrop}`, $el);
|
|
93
111
|
|
|
94
112
|
if (this.dropContainer !== $el) {
|
|
95
|
-
$$(`.${clsDrop}`, this.dropContainer)
|
|
96
|
-
const
|
|
97
|
-
if (!includes(dropdowns, el) &&
|
|
113
|
+
for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
|
|
114
|
+
const target = this.getDropdown(el)?.target;
|
|
115
|
+
if (!includes(dropdowns, el) && target && within(target, this.$el)) {
|
|
98
116
|
dropdowns.push(el);
|
|
99
117
|
}
|
|
100
|
-
}
|
|
118
|
+
}
|
|
101
119
|
}
|
|
102
120
|
|
|
103
121
|
return dropdowns;
|
|
@@ -106,19 +124,22 @@ export default {
|
|
|
106
124
|
watch(dropdowns) {
|
|
107
125
|
this.$create(
|
|
108
126
|
'drop',
|
|
109
|
-
dropdowns.filter(el => !this.getDropdown(el)),
|
|
110
|
-
|
|
127
|
+
dropdowns.filter((el) => !this.getDropdown(el)),
|
|
128
|
+
{
|
|
129
|
+
...this.$props,
|
|
130
|
+
boundary: this.boundary,
|
|
131
|
+
pos: this.pos,
|
|
132
|
+
offset: this.dropbar || this.offset,
|
|
133
|
+
}
|
|
111
134
|
);
|
|
112
135
|
},
|
|
113
136
|
|
|
114
|
-
immediate: true
|
|
115
|
-
|
|
137
|
+
immediate: true,
|
|
116
138
|
},
|
|
117
139
|
|
|
118
|
-
toggles({dropdown}, $el) {
|
|
140
|
+
toggles({ dropdown }, $el) {
|
|
119
141
|
return $$(dropdown, $el);
|
|
120
|
-
}
|
|
121
|
-
|
|
142
|
+
},
|
|
122
143
|
},
|
|
123
144
|
|
|
124
145
|
disconnected() {
|
|
@@ -127,7 +148,6 @@ export default {
|
|
|
127
148
|
},
|
|
128
149
|
|
|
129
150
|
events: [
|
|
130
|
-
|
|
131
151
|
{
|
|
132
152
|
name: 'mouseover focusin',
|
|
133
153
|
|
|
@@ -135,13 +155,18 @@ export default {
|
|
|
135
155
|
return this.dropdown;
|
|
136
156
|
},
|
|
137
157
|
|
|
138
|
-
handler({current}) {
|
|
158
|
+
handler({ current }) {
|
|
139
159
|
const active = this.getActive();
|
|
140
|
-
if (
|
|
160
|
+
if (
|
|
161
|
+
active &&
|
|
162
|
+
includes(active.mode, 'hover') &&
|
|
163
|
+
active.target &&
|
|
164
|
+
!within(active.target, current) &&
|
|
165
|
+
!active.isDelaying
|
|
166
|
+
) {
|
|
141
167
|
active.hide(false);
|
|
142
168
|
}
|
|
143
|
-
}
|
|
144
|
-
|
|
169
|
+
},
|
|
145
170
|
},
|
|
146
171
|
|
|
147
172
|
{
|
|
@@ -152,25 +177,24 @@ export default {
|
|
|
152
177
|
},
|
|
153
178
|
|
|
154
179
|
handler(e) {
|
|
155
|
-
|
|
156
|
-
const {current, keyCode} = e;
|
|
180
|
+
const { current, keyCode } = e;
|
|
157
181
|
const active = this.getActive();
|
|
158
182
|
|
|
159
183
|
if (keyCode === keyMap.DOWN && hasAttr(current, 'aria-expanded')) {
|
|
160
|
-
|
|
161
184
|
e.preventDefault();
|
|
162
185
|
|
|
163
186
|
if (!active || active.target !== current) {
|
|
164
187
|
current.click();
|
|
165
|
-
once(this.dropContainer, 'show', ({target}) =>
|
|
188
|
+
once(this.dropContainer, 'show', ({ target }) =>
|
|
189
|
+
focusFirstFocusableElement(target)
|
|
190
|
+
);
|
|
166
191
|
} else {
|
|
167
192
|
focusFirstFocusableElement(active.$el);
|
|
168
193
|
}
|
|
169
|
-
|
|
170
194
|
}
|
|
171
195
|
|
|
172
196
|
handleNavItemNavigation(e, this.toggles, active);
|
|
173
|
-
}
|
|
197
|
+
},
|
|
174
198
|
},
|
|
175
199
|
|
|
176
200
|
{
|
|
@@ -185,8 +209,7 @@ export default {
|
|
|
185
209
|
},
|
|
186
210
|
|
|
187
211
|
handler(e) {
|
|
188
|
-
|
|
189
|
-
const {current, keyCode} = e;
|
|
212
|
+
const { current, keyCode } = e;
|
|
190
213
|
|
|
191
214
|
if (!includes(this.dropdowns, current)) {
|
|
192
215
|
return;
|
|
@@ -194,7 +217,7 @@ export default {
|
|
|
194
217
|
|
|
195
218
|
const active = this.getActive();
|
|
196
219
|
const elements = $$(selFocusable, current);
|
|
197
|
-
const i = findIndex(elements, el => matches(el, ':focus'));
|
|
220
|
+
const i = findIndex(elements, (el) => matches(el, ':focus'));
|
|
198
221
|
|
|
199
222
|
if (keyCode === keyMap.UP) {
|
|
200
223
|
e.preventDefault();
|
|
@@ -211,11 +234,11 @@ export default {
|
|
|
211
234
|
}
|
|
212
235
|
|
|
213
236
|
if (keyCode === keyMap.ESC) {
|
|
214
|
-
active
|
|
237
|
+
active?.target?.focus();
|
|
215
238
|
}
|
|
216
239
|
|
|
217
240
|
handleNavItemNavigation(e, this.toggles, active);
|
|
218
|
-
}
|
|
241
|
+
},
|
|
219
242
|
},
|
|
220
243
|
|
|
221
244
|
{
|
|
@@ -232,10 +255,14 @@ export default {
|
|
|
232
255
|
handler() {
|
|
233
256
|
const active = this.getActive();
|
|
234
257
|
|
|
235
|
-
if (
|
|
258
|
+
if (
|
|
259
|
+
active &&
|
|
260
|
+
includes(active.mode, 'hover') &&
|
|
261
|
+
!this.dropdowns.some((el) => matches(el, ':hover'))
|
|
262
|
+
) {
|
|
236
263
|
active.hide();
|
|
237
264
|
}
|
|
238
|
-
}
|
|
265
|
+
},
|
|
239
266
|
},
|
|
240
267
|
|
|
241
268
|
{
|
|
@@ -250,12 +277,10 @@ export default {
|
|
|
250
277
|
},
|
|
251
278
|
|
|
252
279
|
handler() {
|
|
253
|
-
|
|
254
280
|
if (!parent(this.dropbar)) {
|
|
255
281
|
after(this.dropbarAnchor || this.$el, this.dropbar);
|
|
256
282
|
}
|
|
257
|
-
|
|
258
|
-
}
|
|
283
|
+
},
|
|
259
284
|
},
|
|
260
285
|
|
|
261
286
|
{
|
|
@@ -269,7 +294,7 @@ export default {
|
|
|
269
294
|
return this.dropbar;
|
|
270
295
|
},
|
|
271
296
|
|
|
272
|
-
handler(_, {$el, dir}) {
|
|
297
|
+
handler(_, { $el, dir }) {
|
|
273
298
|
if (!hasClass($el, this.clsDrop)) {
|
|
274
299
|
return;
|
|
275
300
|
}
|
|
@@ -281,9 +306,14 @@ export default {
|
|
|
281
306
|
this.clsDrop && addClass($el, `${this.clsDrop}-dropbar`);
|
|
282
307
|
|
|
283
308
|
if (dir === 'bottom') {
|
|
284
|
-
this.transitionTo(
|
|
309
|
+
this.transitionTo(
|
|
310
|
+
$el.offsetHeight +
|
|
311
|
+
toFloat(css($el, 'marginTop')) +
|
|
312
|
+
toFloat(css($el, 'marginBottom')),
|
|
313
|
+
$el
|
|
314
|
+
);
|
|
285
315
|
}
|
|
286
|
-
}
|
|
316
|
+
},
|
|
287
317
|
},
|
|
288
318
|
|
|
289
319
|
{
|
|
@@ -297,18 +327,17 @@ export default {
|
|
|
297
327
|
return this.dropbar;
|
|
298
328
|
},
|
|
299
329
|
|
|
300
|
-
handler(e, {$el}) {
|
|
301
|
-
|
|
330
|
+
handler(e, { $el }) {
|
|
302
331
|
const active = this.getActive();
|
|
303
332
|
|
|
304
|
-
if (
|
|
305
|
-
&&
|
|
306
|
-
|
|
307
|
-
|
|
333
|
+
if (
|
|
334
|
+
matches(this.dropbar, ':hover') &&
|
|
335
|
+
active?.$el === $el &&
|
|
336
|
+
!this.toggles.some((el) => active.target !== el && matches(el, ':focus'))
|
|
308
337
|
) {
|
|
309
338
|
e.preventDefault();
|
|
310
339
|
}
|
|
311
|
-
}
|
|
340
|
+
},
|
|
312
341
|
},
|
|
313
342
|
|
|
314
343
|
{
|
|
@@ -322,30 +351,27 @@ export default {
|
|
|
322
351
|
return this.dropbar;
|
|
323
352
|
},
|
|
324
353
|
|
|
325
|
-
handler(_, {$el}) {
|
|
354
|
+
handler(_, { $el }) {
|
|
326
355
|
if (!hasClass($el, this.clsDrop)) {
|
|
327
356
|
return;
|
|
328
357
|
}
|
|
329
358
|
|
|
330
359
|
const active = this.getActive();
|
|
331
360
|
|
|
332
|
-
if (!active || active
|
|
361
|
+
if (!active || active?.$el === $el) {
|
|
333
362
|
this.transitionTo(0);
|
|
334
363
|
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
364
|
+
},
|
|
365
|
+
},
|
|
338
366
|
],
|
|
339
367
|
|
|
340
368
|
methods: {
|
|
341
|
-
|
|
342
369
|
getActive() {
|
|
343
370
|
return active && within(active.target, this.$el) && active;
|
|
344
371
|
},
|
|
345
372
|
|
|
346
373
|
transitionTo(newHeight, el) {
|
|
347
|
-
|
|
348
|
-
const {dropbar} = this;
|
|
374
|
+
const { dropbar } = this;
|
|
349
375
|
const oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
|
|
350
376
|
|
|
351
377
|
el = oldHeight < newHeight && el;
|
|
@@ -356,54 +382,52 @@ export default {
|
|
|
356
382
|
|
|
357
383
|
Transition.cancel([el, dropbar]);
|
|
358
384
|
return Promise.all([
|
|
359
|
-
Transition.start(dropbar, {height: newHeight}, this.duration),
|
|
360
|
-
Transition.start(
|
|
385
|
+
Transition.start(dropbar, { height: newHeight }, this.duration),
|
|
386
|
+
Transition.start(
|
|
387
|
+
el,
|
|
388
|
+
{ clip: `rect(0,${el.offsetWidth}px,${newHeight}px,0)` },
|
|
389
|
+
this.duration
|
|
390
|
+
),
|
|
361
391
|
])
|
|
362
392
|
.catch(noop)
|
|
363
393
|
.then(() => {
|
|
364
|
-
css(el, {clip: ''});
|
|
394
|
+
css(el, { clip: '' });
|
|
365
395
|
this.$update(dropbar);
|
|
366
396
|
});
|
|
367
397
|
},
|
|
368
398
|
|
|
369
399
|
getDropdown(el) {
|
|
370
400
|
return this.$getComponent(el, 'drop') || this.$getComponent(el, 'dropdown');
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
|
|
401
|
+
},
|
|
402
|
+
},
|
|
375
403
|
};
|
|
376
404
|
|
|
377
405
|
function handleNavItemNavigation(e, toggles, active) {
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
const target = active && active.target || current;
|
|
406
|
+
const { current, keyCode } = e;
|
|
407
|
+
const target = active?.target || current;
|
|
381
408
|
const i = toggles.indexOf(target);
|
|
382
409
|
|
|
383
410
|
// Left
|
|
384
411
|
if (keyCode === keyMap.LEFT && i > 0) {
|
|
385
|
-
active
|
|
412
|
+
active?.hide(false);
|
|
386
413
|
toggles[i - 1].focus();
|
|
387
414
|
}
|
|
388
415
|
|
|
389
416
|
// Right
|
|
390
417
|
if (keyCode === keyMap.RIGHT && i < toggles.length - 1) {
|
|
391
|
-
active
|
|
418
|
+
active?.hide(false);
|
|
392
419
|
toggles[i + 1].focus();
|
|
393
420
|
}
|
|
394
421
|
|
|
395
422
|
if (keyCode === keyMap.TAB) {
|
|
396
423
|
target.focus();
|
|
397
|
-
active
|
|
424
|
+
active?.hide(false);
|
|
398
425
|
}
|
|
399
426
|
}
|
|
400
427
|
|
|
401
428
|
function focusFirstFocusableElement(el) {
|
|
402
429
|
if (!$(':focus', el)) {
|
|
403
|
-
|
|
404
|
-
if (focusEl) {
|
|
405
|
-
focusEl.focus();
|
|
406
|
-
}
|
|
430
|
+
$(selFocusable, el)?.focus();
|
|
407
431
|
}
|
|
408
432
|
}
|
|
409
433
|
|
|
@@ -413,5 +437,5 @@ const keyMap = {
|
|
|
413
437
|
LEFT: 37,
|
|
414
438
|
UP: 38,
|
|
415
439
|
RIGHT: 39,
|
|
416
|
-
DOWN: 40
|
|
440
|
+
DOWN: 40,
|
|
417
441
|
};
|
package/src/js/core/offcanvas.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import Modal from '../mixin/modal';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
$,
|
|
4
|
+
addClass,
|
|
5
|
+
append,
|
|
6
|
+
css,
|
|
7
|
+
endsWith,
|
|
8
|
+
hasClass,
|
|
9
|
+
height,
|
|
10
|
+
isVisible,
|
|
11
|
+
parent,
|
|
12
|
+
removeClass,
|
|
13
|
+
unwrap,
|
|
14
|
+
wrapAll,
|
|
15
|
+
} from 'uikit-util';
|
|
3
16
|
|
|
4
17
|
export default {
|
|
5
|
-
|
|
6
18
|
mixins: [Modal],
|
|
7
19
|
|
|
8
20
|
args: 'mode',
|
|
@@ -10,7 +22,7 @@ export default {
|
|
|
10
22
|
props: {
|
|
11
23
|
mode: String,
|
|
12
24
|
flip: Boolean,
|
|
13
|
-
overlay: Boolean
|
|
25
|
+
overlay: Boolean,
|
|
14
26
|
},
|
|
15
27
|
|
|
16
28
|
data: {
|
|
@@ -26,65 +38,58 @@ export default {
|
|
|
26
38
|
clsMode: 'uk-offcanvas',
|
|
27
39
|
clsOverlay: 'uk-offcanvas-overlay',
|
|
28
40
|
selClose: '.uk-offcanvas-close',
|
|
29
|
-
container: false
|
|
41
|
+
container: false,
|
|
30
42
|
},
|
|
31
43
|
|
|
32
44
|
computed: {
|
|
33
|
-
|
|
34
|
-
clsFlip({flip, clsFlip}) {
|
|
45
|
+
clsFlip({ flip, clsFlip }) {
|
|
35
46
|
return flip ? clsFlip : '';
|
|
36
47
|
},
|
|
37
48
|
|
|
38
|
-
clsOverlay({overlay, clsOverlay}) {
|
|
49
|
+
clsOverlay({ overlay, clsOverlay }) {
|
|
39
50
|
return overlay ? clsOverlay : '';
|
|
40
51
|
},
|
|
41
52
|
|
|
42
|
-
clsMode({mode, clsMode}) {
|
|
53
|
+
clsMode({ mode, clsMode }) {
|
|
43
54
|
return `${clsMode}-${mode}`;
|
|
44
55
|
},
|
|
45
56
|
|
|
46
|
-
clsSidebarAnimation({mode, clsSidebarAnimation}) {
|
|
57
|
+
clsSidebarAnimation({ mode, clsSidebarAnimation }) {
|
|
47
58
|
return mode === 'none' || mode === 'reveal' ? '' : clsSidebarAnimation;
|
|
48
59
|
},
|
|
49
60
|
|
|
50
|
-
clsContainerAnimation({mode, clsContainerAnimation}) {
|
|
61
|
+
clsContainerAnimation({ mode, clsContainerAnimation }) {
|
|
51
62
|
return mode !== 'push' && mode !== 'reveal' ? '' : clsContainerAnimation;
|
|
52
63
|
},
|
|
53
64
|
|
|
54
|
-
transitionElement({mode}) {
|
|
65
|
+
transitionElement({ mode }) {
|
|
55
66
|
return mode === 'reveal' ? parent(this.panel) : this.panel;
|
|
56
|
-
}
|
|
57
|
-
|
|
67
|
+
},
|
|
58
68
|
},
|
|
59
69
|
|
|
60
70
|
update: {
|
|
61
|
-
|
|
62
71
|
read() {
|
|
63
72
|
if (this.isToggled() && !isVisible(this.$el)) {
|
|
64
73
|
this.hide();
|
|
65
74
|
}
|
|
66
75
|
},
|
|
67
76
|
|
|
68
|
-
events: ['resize']
|
|
69
|
-
|
|
77
|
+
events: ['resize'],
|
|
70
78
|
},
|
|
71
79
|
|
|
72
80
|
events: [
|
|
73
|
-
|
|
74
81
|
{
|
|
75
|
-
|
|
76
82
|
name: 'click',
|
|
77
83
|
|
|
78
84
|
delegate() {
|
|
79
85
|
return 'a[href^="#"]';
|
|
80
86
|
},
|
|
81
87
|
|
|
82
|
-
handler({current: {hash}, defaultPrevented}) {
|
|
88
|
+
handler({ current: { hash }, defaultPrevented }) {
|
|
83
89
|
if (!defaultPrevented && hash && $(hash, document.body)) {
|
|
84
90
|
this.hide();
|
|
85
91
|
}
|
|
86
|
-
}
|
|
87
|
-
|
|
92
|
+
},
|
|
88
93
|
},
|
|
89
94
|
|
|
90
95
|
{
|
|
@@ -96,14 +101,11 @@ export default {
|
|
|
96
101
|
return this.panel;
|
|
97
102
|
},
|
|
98
103
|
|
|
99
|
-
handler({targetTouches}) {
|
|
100
|
-
|
|
104
|
+
handler({ targetTouches }) {
|
|
101
105
|
if (targetTouches.length === 1) {
|
|
102
106
|
this.clientY = targetTouches[0].clientY;
|
|
103
107
|
}
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
108
|
+
},
|
|
107
109
|
},
|
|
108
110
|
|
|
109
111
|
{
|
|
@@ -118,8 +120,7 @@ export default {
|
|
|
118
120
|
|
|
119
121
|
handler(e) {
|
|
120
122
|
e.cancelable && e.preventDefault();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
+
},
|
|
123
124
|
},
|
|
124
125
|
|
|
125
126
|
{
|
|
@@ -132,23 +133,21 @@ export default {
|
|
|
132
133
|
},
|
|
133
134
|
|
|
134
135
|
handler(e) {
|
|
135
|
-
|
|
136
136
|
if (e.targetTouches.length !== 1) {
|
|
137
137
|
return;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
const clientY = e.targetTouches[0].clientY - this.clientY;
|
|
141
|
-
const {scrollTop, scrollHeight, clientHeight} = this.panel;
|
|
141
|
+
const { scrollTop, scrollHeight, clientHeight } = this.panel;
|
|
142
142
|
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
if (
|
|
144
|
+
clientHeight >= scrollHeight ||
|
|
145
|
+
(scrollTop === 0 && clientY > 0) ||
|
|
146
|
+
(scrollHeight - scrollTop <= clientHeight && clientY < 0)
|
|
146
147
|
) {
|
|
147
148
|
e.cancelable && e.preventDefault();
|
|
148
149
|
}
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
150
|
+
},
|
|
152
151
|
},
|
|
153
152
|
|
|
154
153
|
{
|
|
@@ -157,7 +156,6 @@ export default {
|
|
|
157
156
|
self: true,
|
|
158
157
|
|
|
159
158
|
handler() {
|
|
160
|
-
|
|
161
159
|
if (this.mode === 'reveal' && !hasClass(parent(this.panel), this.clsMode)) {
|
|
162
160
|
wrapAll(this.panel, '<div>');
|
|
163
161
|
addClass(parent(this.panel), this.clsMode);
|
|
@@ -168,15 +166,17 @@ export default {
|
|
|
168
166
|
css(document.body, 'touch-action', 'pan-y pinch-zoom');
|
|
169
167
|
css(this.$el, 'display', 'block');
|
|
170
168
|
addClass(this.$el, this.clsOverlay);
|
|
171
|
-
addClass(
|
|
169
|
+
addClass(
|
|
170
|
+
this.panel,
|
|
171
|
+
this.clsSidebarAnimation,
|
|
172
|
+
this.mode !== 'reveal' ? this.clsMode : ''
|
|
173
|
+
);
|
|
172
174
|
|
|
173
175
|
height(document.body); // force reflow
|
|
174
176
|
addClass(document.body, this.clsContainerAnimation);
|
|
175
177
|
|
|
176
178
|
this.clsContainerAnimation && suppressUserScale();
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
179
|
+
},
|
|
180
180
|
},
|
|
181
181
|
|
|
182
182
|
{
|
|
@@ -187,7 +187,7 @@ export default {
|
|
|
187
187
|
handler() {
|
|
188
188
|
removeClass(document.body, this.clsContainerAnimation);
|
|
189
189
|
css(document.body, 'touch-action', '');
|
|
190
|
-
}
|
|
190
|
+
},
|
|
191
191
|
},
|
|
192
192
|
|
|
193
193
|
{
|
|
@@ -196,7 +196,6 @@ export default {
|
|
|
196
196
|
self: true,
|
|
197
197
|
|
|
198
198
|
handler() {
|
|
199
|
-
|
|
200
199
|
this.clsContainerAnimation && resumeUserScale();
|
|
201
200
|
|
|
202
201
|
if (this.mode === 'reveal') {
|
|
@@ -209,24 +208,19 @@ export default {
|
|
|
209
208
|
removeClass(document.body, this.clsContainer, this.clsFlip);
|
|
210
209
|
|
|
211
210
|
css(document.documentElement, 'overflowY', '');
|
|
212
|
-
|
|
213
|
-
}
|
|
211
|
+
},
|
|
214
212
|
},
|
|
215
213
|
|
|
216
214
|
{
|
|
217
215
|
name: 'swipeLeft swipeRight',
|
|
218
216
|
|
|
219
217
|
handler(e) {
|
|
220
|
-
|
|
221
218
|
if (this.isToggled() && endsWith(e.type, 'Left') ^ this.flip) {
|
|
222
219
|
this.hide();
|
|
223
220
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
]
|
|
229
|
-
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
],
|
|
230
224
|
};
|
|
231
225
|
|
|
232
226
|
// Chrome in responsive mode zooms page upon opening offcanvas
|
|
@@ -240,5 +234,7 @@ function resumeUserScale() {
|
|
|
240
234
|
}
|
|
241
235
|
|
|
242
236
|
function getViewport() {
|
|
243
|
-
return
|
|
237
|
+
return (
|
|
238
|
+
$('meta[name="viewport"]', document.head) || append(document.head, '<meta name="viewport">')
|
|
239
|
+
);
|
|
244
240
|
}
|