uikit 3.21.17 → 3.21.18-dev.27bfd7d2b
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 +32 -0
- package/dist/css/uikit-core-rtl.css +243 -69
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +243 -69
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +247 -65
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +247 -65
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +13 -8
- 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 +334 -103
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +351 -108
- 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 +1 -1
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +3 -7
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +3 -7
- 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 +7 -2
- 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 +92 -93
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +20 -17
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +379 -262
- package/dist/js/uikit.min.js +1 -1
- package/package.json +3 -3
- package/src/images/icons/arrow-down-arrow-up.svg +6 -0
- package/src/images/icons/arrow-down.svg +3 -3
- package/src/images/icons/arrow-left.svg +3 -3
- package/src/images/icons/arrow-right.svg +3 -3
- package/src/images/icons/arrow-up-right.svg +3 -3
- package/src/images/icons/arrow-up.svg +3 -3
- package/src/images/icons/close-circle.svg +5 -0
- package/src/images/icons/cloud-download.svg +4 -4
- package/src/images/icons/cloud-upload.svg +4 -4
- package/src/images/icons/download.svg +4 -4
- package/src/images/icons/expand.svg +5 -5
- package/src/images/icons/link-external.svg +4 -4
- package/src/images/icons/pull.svg +4 -4
- package/src/images/icons/push.svg +3 -3
- package/src/images/icons/shrink.svg +5 -5
- package/src/images/icons/sign-in.svg +4 -3
- package/src/images/icons/sign-out.svg +4 -3
- package/src/images/icons/sorting.svg +6 -0
- package/src/images/icons/upload.svg +4 -4
- package/src/js/components/countdown.js +10 -5
- package/src/js/components/lightbox-panel.js +181 -45
- package/src/js/components/lightbox.js +59 -6
- package/src/js/core/img.js +3 -5
- package/src/js/core/navbar.js +3 -6
- package/src/js/mixin/modal.js +1 -4
- package/src/js/mixin/slider-drag.js +3 -6
- package/src/js/mixin/slider-nav.js +1 -1
- package/src/js/mixin/togglable.js +7 -2
- package/src/js/util/dom.js +3 -1
- package/src/less/components/breadcrumb.less +6 -2
- package/src/less/components/button.less +1 -1
- package/src/less/components/form-range.less +52 -0
- package/src/less/components/form.less +1 -1
- package/src/less/components/lightbox.less +57 -89
- package/src/less/components/margin.less +14 -0
- package/src/less/components/search.less +49 -23
- package/src/less/components/subnav.less +8 -0
- package/src/less/components/text.less +11 -0
- package/src/less/components/totop.less +1 -1
- package/src/less/components/utility.less +2 -1
- package/src/less/components/visibility.less +2 -1
- package/src/less/theme/form-range.less +20 -8
- package/src/less/theme/lightbox.less +2 -20
- package/src/less/theme/search.less +24 -10
- package/src/scss/components/breadcrumb.scss +6 -2
- package/src/scss/components/button.scss +1 -1
- package/src/scss/components/form-range.scss +12 -0
- package/src/scss/components/form.scss +1 -1
- package/src/scss/components/lightbox.scss +50 -77
- package/src/scss/components/margin.scss +13 -0
- package/src/scss/components/search.scss +30 -12
- package/src/scss/components/subnav.scss +7 -0
- package/src/scss/components/text.scss +10 -0
- package/src/scss/components/totop.scss +1 -1
- package/src/scss/components/utility.scss +1 -1
- package/src/scss/components/visibility.scss +2 -1
- package/src/scss/mixins-theme.scss +51 -12
- package/src/scss/mixins.scss +45 -6
- package/src/scss/theme/form-range.scss +14 -4
- package/src/scss/theme/lightbox.scss +2 -20
- package/src/scss/theme/search.scss +10 -6
- package/src/scss/variables-theme.scss +36 -21
- package/src/scss/variables.scss +32 -24
- package/tests/badge.html +2 -2
- package/tests/base.html +1 -1
- package/tests/breadcrumb.html +23 -5
- package/tests/card.html +24 -24
- package/tests/countdown.html +6 -0
- package/tests/dropbar.html +15 -15
- package/tests/dropdown.html +6 -6
- package/tests/dropnav.html +100 -100
- package/tests/icon.html +8 -0
- package/tests/index.html +15 -15
- package/tests/lightbox.html +379 -28
- package/tests/margin.html +19 -0
- package/tests/nav.html +21 -21
- package/tests/navbar.html +273 -273
- package/tests/offcanvas.html +27 -27
- package/tests/placeholder.html +2 -2
- package/tests/sortable.html +5 -5
- package/tests/sticky-navbar.html +114 -114
- package/tests/sticky.html +1 -1
- package/tests/text.html +8 -0
|
@@ -1,64 +1,123 @@
|
|
|
1
1
|
import {
|
|
2
2
|
$,
|
|
3
|
+
$$,
|
|
4
|
+
Transition,
|
|
3
5
|
addClass,
|
|
4
6
|
append,
|
|
5
7
|
attr,
|
|
6
8
|
fragment,
|
|
7
9
|
getIndex,
|
|
8
10
|
html,
|
|
11
|
+
isTag,
|
|
12
|
+
matches,
|
|
9
13
|
on,
|
|
14
|
+
parent,
|
|
15
|
+
pick,
|
|
10
16
|
pointerDown,
|
|
11
17
|
pointerMove,
|
|
18
|
+
remove,
|
|
12
19
|
removeClass,
|
|
13
|
-
|
|
20
|
+
toggleClass,
|
|
14
21
|
trigger,
|
|
22
|
+
wrapAll,
|
|
15
23
|
} from 'uikit-util';
|
|
24
|
+
import { wrapInPicture } from '../core/img';
|
|
16
25
|
import Modal from '../mixin/modal';
|
|
17
26
|
import Slideshow from '../mixin/slideshow';
|
|
18
27
|
import { keyMap } from '../util/keys';
|
|
19
28
|
import Animations from './internal/lightbox-animations';
|
|
20
29
|
|
|
21
30
|
export default {
|
|
31
|
+
i18n: {
|
|
32
|
+
counter: '%s / %s',
|
|
33
|
+
},
|
|
34
|
+
|
|
22
35
|
mixins: [Modal, Slideshow],
|
|
23
36
|
|
|
24
37
|
functional: true,
|
|
25
38
|
|
|
26
39
|
props: {
|
|
27
|
-
|
|
40
|
+
counter: Boolean,
|
|
28
41
|
preload: Number,
|
|
42
|
+
nav: Boolean,
|
|
43
|
+
slidenav: Boolean,
|
|
44
|
+
delayControls: Number,
|
|
29
45
|
videoAutoplay: Boolean,
|
|
30
46
|
template: String,
|
|
31
47
|
},
|
|
32
48
|
|
|
33
49
|
data: () => ({
|
|
50
|
+
counter: false,
|
|
34
51
|
preload: 1,
|
|
35
|
-
|
|
52
|
+
nav: false,
|
|
53
|
+
slidenav: true,
|
|
36
54
|
delayControls: 3000,
|
|
55
|
+
videoAutoplay: false,
|
|
37
56
|
items: [],
|
|
38
57
|
cls: 'uk-open',
|
|
39
58
|
clsPage: 'uk-lightbox-page',
|
|
40
|
-
|
|
59
|
+
clsFit: 'uk-lightbox-items-fit',
|
|
60
|
+
clsZoom: 'uk-lightbox-zoom',
|
|
41
61
|
attrItem: 'uk-lightbox-item',
|
|
62
|
+
selList: '.uk-lightbox-items',
|
|
42
63
|
selClose: '.uk-close-large',
|
|
64
|
+
selNav: '.uk-lightbox-thumbnav, .uk-lightbox-dotnav',
|
|
43
65
|
selCaption: '.uk-lightbox-caption',
|
|
66
|
+
selCounter: '.uk-lightbox-counter',
|
|
44
67
|
pauseOnHover: false,
|
|
45
68
|
velocity: 2,
|
|
46
69
|
Animations,
|
|
47
70
|
template: `<div class="uk-lightbox uk-overflow-hidden">
|
|
48
71
|
<div class="uk-lightbox-items"></div>
|
|
49
|
-
<div class="uk-
|
|
50
|
-
<button class="uk-lightbox-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
72
|
+
<div class="uk-position-top-right uk-position-small uk-transition-fade" uk-inverse>
|
|
73
|
+
<button class="uk-lightbox-close uk-close-large" type="button" uk-close></button>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="uk-lightbox-slidenav uk-position-center-left uk-position-medium uk-transition-fade" uk-inverse>
|
|
76
|
+
<a href uk-slidenav-previous uk-lightbox-item="previous"></a>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="uk-lightbox-slidenav uk-position-center-right uk-position-medium uk-transition-fade" uk-inverse>
|
|
79
|
+
<a href uk-slidenav-next uk-lightbox-item="next"></a>
|
|
80
|
+
</div>
|
|
81
|
+
<div class="uk-position-center-right uk-position-medium uk-transition-fade" uk-inverse style="max-height: 90vh; overflow: auto;">
|
|
82
|
+
<ul class="uk-lightbox-thumbnav uk-lightbox-thumbnav-vertical uk-thumbnav uk-thumbnav-vertical"></ul>
|
|
83
|
+
<ul class="uk-lightbox-dotnav uk-dotnav uk-dotnav-vertical"></ul>
|
|
84
|
+
</div>
|
|
85
|
+
<div class="uk-lightbox-counter uk-text-large uk-position-top-left uk-position-small uk-transition-fade" uk-inverse></div>
|
|
86
|
+
<div class="uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div>
|
|
55
87
|
</div>`,
|
|
56
88
|
}),
|
|
57
89
|
|
|
58
90
|
created() {
|
|
59
|
-
|
|
91
|
+
let $el = $(this.template);
|
|
92
|
+
|
|
93
|
+
if (isTag($el, 'template')) {
|
|
94
|
+
$el = fragment(html($el));
|
|
95
|
+
}
|
|
96
|
+
|
|
60
97
|
const list = $(this.selList, $el);
|
|
61
|
-
|
|
98
|
+
const navType = this.$props.nav;
|
|
99
|
+
|
|
100
|
+
remove($$(this.selNav, $el).filter((el) => !matches(el, `.uk-${navType}`)));
|
|
101
|
+
|
|
102
|
+
for (const [i, item] of this.items.entries()) {
|
|
103
|
+
append(list, '<div>');
|
|
104
|
+
if (navType === 'thumbnav') {
|
|
105
|
+
wrapAll(
|
|
106
|
+
toThumbnavItem(item, this.videoAutoplay),
|
|
107
|
+
append($(this.selNav, $el), `<li uk-lightbox-item="${i}"><a href></a></li>`),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!this.slidenav) {
|
|
113
|
+
remove($$('.uk-lightbox-slidenav', $el));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!this.counter) {
|
|
117
|
+
remove($(this.selCounter, $el));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
addClass(list, this.clsFit);
|
|
62
121
|
|
|
63
122
|
const close = $('[uk-close]', $el);
|
|
64
123
|
const closeLabel = this.t('close');
|
|
@@ -71,10 +130,18 @@ export default {
|
|
|
71
130
|
|
|
72
131
|
events: [
|
|
73
132
|
{
|
|
74
|
-
name:
|
|
133
|
+
name: 'click',
|
|
75
134
|
|
|
76
|
-
|
|
77
|
-
|
|
135
|
+
self: true,
|
|
136
|
+
|
|
137
|
+
filter: ({ bgClose }) => bgClose,
|
|
138
|
+
|
|
139
|
+
delegate: ({ selList }) => `${selList} > *`,
|
|
140
|
+
|
|
141
|
+
handler(e) {
|
|
142
|
+
if (!e.defaultPrevented) {
|
|
143
|
+
this.hide();
|
|
144
|
+
}
|
|
78
145
|
},
|
|
79
146
|
},
|
|
80
147
|
|
|
@@ -83,15 +150,25 @@ export default {
|
|
|
83
150
|
|
|
84
151
|
self: true,
|
|
85
152
|
|
|
86
|
-
delegate: ({
|
|
153
|
+
delegate: ({ clsZoom }) => `.${clsZoom}`,
|
|
87
154
|
|
|
88
155
|
handler(e) {
|
|
89
156
|
if (!e.defaultPrevented) {
|
|
90
|
-
this.
|
|
157
|
+
toggleClass(this.list, this.clsFit);
|
|
91
158
|
}
|
|
92
159
|
},
|
|
93
160
|
},
|
|
94
161
|
|
|
162
|
+
{
|
|
163
|
+
name: `${pointerMove} ${pointerDown} keydown`,
|
|
164
|
+
|
|
165
|
+
filter: ({ delayControls }) => delayControls,
|
|
166
|
+
|
|
167
|
+
handler() {
|
|
168
|
+
this.showControls();
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
|
|
95
172
|
{
|
|
96
173
|
name: 'shown',
|
|
97
174
|
|
|
@@ -157,6 +234,16 @@ export default {
|
|
|
157
234
|
name: 'beforeitemshow',
|
|
158
235
|
|
|
159
236
|
handler(e) {
|
|
237
|
+
html($(this.selCaption, this.$el), this.getItem().caption || '');
|
|
238
|
+
html(
|
|
239
|
+
$(this.selCounter, this.$el),
|
|
240
|
+
this.t('counter', this.index + 1, this.slides.length),
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
for (let j = -this.preload; j <= this.preload; j++) {
|
|
244
|
+
this.loadItem(this.index + j);
|
|
245
|
+
}
|
|
246
|
+
|
|
160
247
|
if (this.isToggled()) {
|
|
161
248
|
return;
|
|
162
249
|
}
|
|
@@ -167,24 +254,12 @@ export default {
|
|
|
167
254
|
|
|
168
255
|
this.toggleElement(this.$el, true, false);
|
|
169
256
|
|
|
170
|
-
this.animation = Animations
|
|
257
|
+
this.animation = Animations.scale;
|
|
171
258
|
removeClass(e.target, this.clsActive);
|
|
172
259
|
this.stack.splice(1, 0, this.index);
|
|
173
260
|
},
|
|
174
261
|
},
|
|
175
262
|
|
|
176
|
-
{
|
|
177
|
-
name: 'itemshow',
|
|
178
|
-
|
|
179
|
-
handler() {
|
|
180
|
-
html($(this.selCaption, this.$el), this.getItem().caption || '');
|
|
181
|
-
|
|
182
|
-
for (let j = -this.preload; j <= this.preload; j++) {
|
|
183
|
-
this.loadItem(this.index + j);
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
|
|
188
263
|
{
|
|
189
264
|
name: 'itemshown',
|
|
190
265
|
|
|
@@ -197,9 +272,9 @@ export default {
|
|
|
197
272
|
name: 'itemload',
|
|
198
273
|
|
|
199
274
|
async handler(_, item) {
|
|
200
|
-
const { source: src, type,
|
|
275
|
+
const { source: src, type, attrs = {} } = item;
|
|
201
276
|
|
|
202
|
-
this.setItem(item, '<span uk-spinner></span>');
|
|
277
|
+
this.setItem(item, '<span uk-spinner uk-inverse></span>');
|
|
203
278
|
|
|
204
279
|
if (!src) {
|
|
205
280
|
return;
|
|
@@ -210,26 +285,33 @@ export default {
|
|
|
210
285
|
allowfullscreen: '',
|
|
211
286
|
style: 'max-width: 100%; box-sizing: border-box;',
|
|
212
287
|
'uk-responsive': '',
|
|
213
|
-
'uk-video': `${this.videoAutoplay}`,
|
|
288
|
+
'uk-video': `${Boolean(this.videoAutoplay)}`,
|
|
214
289
|
};
|
|
215
290
|
|
|
216
291
|
// Image
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
292
|
+
if (type === 'image' || isImage(src)) {
|
|
293
|
+
const img = createEl('img');
|
|
294
|
+
|
|
295
|
+
wrapInPicture(img, item.sources);
|
|
296
|
+
attr(img, {
|
|
297
|
+
src,
|
|
298
|
+
...pick(item, ['alt', 'srcset', 'sizes']),
|
|
299
|
+
...attrs,
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
on(img, 'load', () => this.setItem(item, parent(img) || img));
|
|
223
303
|
on(img, 'error', () => this.setError(item));
|
|
224
304
|
|
|
225
305
|
// Video
|
|
226
|
-
} else if (type === 'video' || src
|
|
306
|
+
} else if (type === 'video' || isVideo(src)) {
|
|
307
|
+
const inline = this.videoAutoplay === 'inline';
|
|
227
308
|
const video = createEl('video', {
|
|
228
309
|
src,
|
|
229
|
-
poster,
|
|
230
|
-
controls: '',
|
|
231
310
|
playsinline: '',
|
|
232
|
-
'
|
|
311
|
+
controls: inline ? null : '',
|
|
312
|
+
loop: inline ? '' : null,
|
|
313
|
+
poster: this.videoAutoplay ? null : item.poster,
|
|
314
|
+
'uk-video': inline ? 'automute: true' : Boolean(this.videoAutoplay),
|
|
233
315
|
...attrs,
|
|
234
316
|
});
|
|
235
317
|
|
|
@@ -297,8 +379,33 @@ export default {
|
|
|
297
379
|
}
|
|
298
380
|
},
|
|
299
381
|
},
|
|
382
|
+
|
|
383
|
+
{
|
|
384
|
+
name: 'itemloaded',
|
|
385
|
+
handler() {
|
|
386
|
+
this.$emit('resize');
|
|
387
|
+
},
|
|
388
|
+
},
|
|
300
389
|
],
|
|
301
390
|
|
|
391
|
+
update: {
|
|
392
|
+
read() {
|
|
393
|
+
for (const media of $$(`${this.selList} :not([controls]):is(img,video)`, this.$el)) {
|
|
394
|
+
toggleClass(
|
|
395
|
+
media,
|
|
396
|
+
this.clsZoom,
|
|
397
|
+
(media.naturalHeight || media.videoHeight) - this.$el.offsetHeight >
|
|
398
|
+
Math.max(
|
|
399
|
+
0,
|
|
400
|
+
(media.naturalWidth || media.videoWidth) - this.$el.offsetWidth,
|
|
401
|
+
),
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
events: ['resize'],
|
|
407
|
+
},
|
|
408
|
+
|
|
302
409
|
methods: {
|
|
303
410
|
loadItem(index = this.index) {
|
|
304
411
|
const item = this.getItem(index);
|
|
@@ -321,12 +428,13 @@ export default {
|
|
|
321
428
|
},
|
|
322
429
|
|
|
323
430
|
setError(item) {
|
|
324
|
-
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
|
|
431
|
+
this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2" uk-inverse></span>');
|
|
325
432
|
},
|
|
326
433
|
|
|
327
434
|
showControls() {
|
|
328
435
|
clearTimeout(this.controlsTimer);
|
|
329
|
-
this.controlsTimer =
|
|
436
|
+
this.controlsTimer =
|
|
437
|
+
this.delayControls && setTimeout(this.hideControls, this.delayControls);
|
|
330
438
|
|
|
331
439
|
addClass(this.$el, 'uk-active', 'uk-transition-active');
|
|
332
440
|
},
|
|
@@ -342,3 +450,31 @@ function createEl(tag, attrs) {
|
|
|
342
450
|
attr(el, attrs);
|
|
343
451
|
return el;
|
|
344
452
|
}
|
|
453
|
+
|
|
454
|
+
function toThumbnavItem(item, videoAutoplay) {
|
|
455
|
+
const el =
|
|
456
|
+
item.poster || (item.thumb && (item.type === 'image' || isImage(item.thumb)))
|
|
457
|
+
? createEl('img', { src: item.poster || item.thumb, alt: '' })
|
|
458
|
+
: item.thumb && (item.type === 'video' || isVideo(item.thumb))
|
|
459
|
+
? createEl('video', {
|
|
460
|
+
src: item.thumb,
|
|
461
|
+
loop: '',
|
|
462
|
+
playsinline: '',
|
|
463
|
+
'uk-video': `autoplay: ${Boolean(videoAutoplay)}; automute: true`,
|
|
464
|
+
})
|
|
465
|
+
: createEl('canvas');
|
|
466
|
+
|
|
467
|
+
if (item.thumbRatio) {
|
|
468
|
+
el.style.aspectRatio = item.thumbRatio;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return el;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
function isImage(src) {
|
|
475
|
+
return src?.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
function isVideo(src) {
|
|
479
|
+
return src?.match(/\.(mp4|webm|ogv)($|\?)/i);
|
|
480
|
+
}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
$,
|
|
3
|
+
$$,
|
|
4
|
+
assign,
|
|
5
|
+
attr,
|
|
6
|
+
findIndex,
|
|
7
|
+
isElement,
|
|
8
|
+
isTag,
|
|
9
|
+
matches,
|
|
10
|
+
on,
|
|
11
|
+
parents,
|
|
12
|
+
uniqueBy,
|
|
13
|
+
} from 'uikit-util';
|
|
2
14
|
import { parseOptions } from '../api/options';
|
|
3
15
|
import LightboxPanel from './lightbox-panel';
|
|
4
16
|
|
|
17
|
+
const selDisabled = '.uk-disabled *, .uk-disabled, [disabled]';
|
|
18
|
+
|
|
5
19
|
export default {
|
|
6
20
|
install,
|
|
7
21
|
|
|
@@ -31,19 +45,27 @@ export default {
|
|
|
31
45
|
events: {
|
|
32
46
|
name: 'click',
|
|
33
47
|
|
|
34
|
-
delegate: ({ toggle }) =>
|
|
48
|
+
delegate: ({ toggle }) => toggle,
|
|
35
49
|
|
|
36
50
|
handler(e) {
|
|
37
51
|
if (!e.defaultPrevented) {
|
|
38
52
|
e.preventDefault();
|
|
39
|
-
|
|
53
|
+
if (!matches(e.current, selDisabled)) {
|
|
54
|
+
this.show(e.current);
|
|
55
|
+
}
|
|
40
56
|
}
|
|
41
57
|
},
|
|
42
58
|
},
|
|
43
59
|
|
|
44
60
|
methods: {
|
|
45
61
|
show(index) {
|
|
46
|
-
|
|
62
|
+
let items = this.toggles.map(toItem);
|
|
63
|
+
|
|
64
|
+
if (this.nav === 'thumbnav') {
|
|
65
|
+
ensureThumb.call(this, this.toggles, items);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
items = uniqueBy(items, 'source');
|
|
47
69
|
|
|
48
70
|
if (isElement(index)) {
|
|
49
71
|
const { source } = toItem(index);
|
|
@@ -71,11 +93,42 @@ function install(UIkit, Lightbox) {
|
|
|
71
93
|
assign(Lightbox.props, UIkit.component('lightboxPanel').options.props);
|
|
72
94
|
}
|
|
73
95
|
|
|
96
|
+
function ensureThumb(toggles, items) {
|
|
97
|
+
for (const [i, toggle] of Object.entries(toggles)) {
|
|
98
|
+
if (items[i].thumb) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const parent = parents(toggle)
|
|
103
|
+
.reverse()
|
|
104
|
+
.concat(toggle)
|
|
105
|
+
.find(
|
|
106
|
+
(parent) =>
|
|
107
|
+
this.$el.contains(parent) &&
|
|
108
|
+
(parent === toggle || $$(this.toggle, parent).length === 1),
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (!parent) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const media = $('img,video', parent);
|
|
116
|
+
|
|
117
|
+
if (media) {
|
|
118
|
+
items[i].thumb = media.currentSrc || media.poster || media.src;
|
|
119
|
+
items[i].thumbRatio =
|
|
120
|
+
(media.naturalWidth || media.videoWidth) /
|
|
121
|
+
(media.naturalHeight || media.videoHeight);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
74
126
|
function toItem(el) {
|
|
75
127
|
const item = {};
|
|
76
128
|
|
|
77
|
-
for (const
|
|
78
|
-
|
|
129
|
+
for (const attribute of el.getAttributeNames()) {
|
|
130
|
+
const key = attribute.replace(/^data-/, '');
|
|
131
|
+
item[key === 'href' ? 'source' : key] = el.getAttribute(attribute);
|
|
79
132
|
}
|
|
80
133
|
|
|
81
134
|
item.attrs = parseOptions(item.attrs);
|
package/src/js/core/img.js
CHANGED
|
@@ -101,7 +101,7 @@ function setSourceProps(sourceEl, targetEl) {
|
|
|
101
101
|
for (const prop of srcProps) {
|
|
102
102
|
const value = data(sourceEl, prop);
|
|
103
103
|
if (value) {
|
|
104
|
-
attr(targetEl, prop.replace(
|
|
104
|
+
attr(targetEl, prop.replace(/data-/g, ''), value);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -111,14 +111,12 @@ function getImageFromElement(el, src, sources) {
|
|
|
111
111
|
|
|
112
112
|
wrapInPicture(img, sources);
|
|
113
113
|
setSourceProps(el, img);
|
|
114
|
-
img.onload = () =>
|
|
115
|
-
setSrcAttrs(el, img.currentSrc);
|
|
116
|
-
};
|
|
114
|
+
img.onload = () => setSrcAttrs(el, img.currentSrc);
|
|
117
115
|
attr(img, 'src', src);
|
|
118
116
|
return img;
|
|
119
117
|
}
|
|
120
118
|
|
|
121
|
-
function wrapInPicture(img, sources) {
|
|
119
|
+
export function wrapInPicture(img, sources) {
|
|
122
120
|
sources = parseSources(sources);
|
|
123
121
|
|
|
124
122
|
if (sources.length) {
|
package/src/js/core/navbar.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { $$, addClass, css, hasClass, offset, removeClass } from 'uikit-util';
|
|
2
|
+
import { active } from './drop';
|
|
2
3
|
import Dropnav from './dropnav';
|
|
3
4
|
|
|
4
5
|
const clsNavbarTransparent = 'uk-navbar-transparent';
|
|
@@ -56,14 +57,10 @@ export default {
|
|
|
56
57
|
|
|
57
58
|
el: ({ dropContainer }) => dropContainer,
|
|
58
59
|
|
|
59
|
-
async handler(
|
|
60
|
-
if (!this.getDropdown(e.target)) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
60
|
+
async handler() {
|
|
64
61
|
await awaitMacroTask();
|
|
65
62
|
|
|
66
|
-
if (
|
|
63
|
+
if (this._transparent && (!active || !this.dropContainer.contains(active.$el))) {
|
|
67
64
|
addClass(this.navbarContainer, clsNavbarTransparent);
|
|
68
65
|
this._transparent = null;
|
|
69
66
|
}
|
package/src/js/mixin/modal.js
CHANGED
|
@@ -53,10 +53,6 @@ export default {
|
|
|
53
53
|
transitionElement() {
|
|
54
54
|
return this.panel;
|
|
55
55
|
},
|
|
56
|
-
|
|
57
|
-
bgClose({ bgClose }) {
|
|
58
|
-
return bgClose && this.panel;
|
|
59
|
-
},
|
|
60
56
|
},
|
|
61
57
|
|
|
62
58
|
connected() {
|
|
@@ -266,6 +262,7 @@ function listenForBackgroundClose(modal) {
|
|
|
266
262
|
if (
|
|
267
263
|
last(active) !== modal ||
|
|
268
264
|
(modal.overlay && !modal.$el.contains(target)) ||
|
|
265
|
+
!modal.panel ||
|
|
269
266
|
modal.panel.contains(target)
|
|
270
267
|
) {
|
|
271
268
|
return;
|
|
@@ -17,7 +17,7 @@ const pointerUpOptions = { passive: true, capture: true };
|
|
|
17
17
|
const pointerDown = 'touchstart mousedown';
|
|
18
18
|
const pointerMove = 'touchmove mousemove';
|
|
19
19
|
const pointerUp = 'touchend touchcancel mouseup click input scroll';
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
export default {
|
|
22
22
|
props: {
|
|
23
23
|
draggable: Boolean,
|
|
@@ -120,10 +120,6 @@ export default {
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
if (!this.dragging) {
|
|
124
|
-
on(this.list, 'click', preventClick, pointerOptions);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
123
|
e.cancelable && e.preventDefault();
|
|
128
124
|
|
|
129
125
|
this.dragging = true;
|
|
@@ -188,6 +184,8 @@ export default {
|
|
|
188
184
|
off(document, pointerUp, this.end, pointerUpOptions);
|
|
189
185
|
|
|
190
186
|
if (this.dragging) {
|
|
187
|
+
setTimeout(on(this.list, 'click', (e) => e.preventDefault(), pointerOptions));
|
|
188
|
+
|
|
191
189
|
this.dragging = null;
|
|
192
190
|
|
|
193
191
|
if (this.index === this.prevIndex) {
|
|
@@ -216,7 +214,6 @@ export default {
|
|
|
216
214
|
}
|
|
217
215
|
}
|
|
218
216
|
|
|
219
|
-
setTimeout(() => off(this.list, 'click', preventClick, pointerOptions));
|
|
220
217
|
css(this.list, { userSelect: '' });
|
|
221
218
|
|
|
222
219
|
this.drag = this.percent = null;
|
|
@@ -211,7 +211,7 @@ export default {
|
|
|
211
211
|
const active = item === index;
|
|
212
212
|
|
|
213
213
|
toggleClass(el, this.clsActive, active);
|
|
214
|
-
toggleClass(button, 'uk-disabled', this.parallax);
|
|
214
|
+
toggleClass(button, 'uk-disabled', !!this.parallax);
|
|
215
215
|
|
|
216
216
|
attr(button, {
|
|
217
217
|
'aria-selected': active,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
unwrap,
|
|
21
21
|
wrapInner,
|
|
22
22
|
} from 'uikit-util';
|
|
23
|
+
import { storeScrollPosition } from './position';
|
|
23
24
|
|
|
24
25
|
export default {
|
|
25
26
|
props: {
|
|
@@ -79,6 +80,12 @@ export default {
|
|
|
79
80
|
const done = () => {
|
|
80
81
|
removeClass(el, cls);
|
|
81
82
|
trigger(el, show ? 'shown' : 'hidden', [this]);
|
|
83
|
+
|
|
84
|
+
if (show) {
|
|
85
|
+
const restoreScrollPosition = storeScrollPosition(el);
|
|
86
|
+
$$('[autofocus]', el).find(isVisible)?.focus();
|
|
87
|
+
restoreScrollPosition();
|
|
88
|
+
}
|
|
82
89
|
};
|
|
83
90
|
|
|
84
91
|
return promise
|
|
@@ -125,8 +132,6 @@ export default {
|
|
|
125
132
|
if (changed) {
|
|
126
133
|
trigger(el, 'toggled', [toggled, this]);
|
|
127
134
|
}
|
|
128
|
-
|
|
129
|
-
$$('[autofocus]', el).some((el) => (isVisible(el) ? el.focus() || true : el.blur()));
|
|
130
135
|
},
|
|
131
136
|
},
|
|
132
137
|
};
|
package/src/js/util/dom.js
CHANGED
|
@@ -28,12 +28,16 @@
|
|
|
28
28
|
========================================================================== */
|
|
29
29
|
|
|
30
30
|
/*
|
|
31
|
-
* Reset list
|
|
31
|
+
* 1. Reset list
|
|
32
|
+
* 2. Remove space between elements
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
35
|
.uk-breadcrumb {
|
|
36
|
+
/* 1 */
|
|
35
37
|
padding: 0;
|
|
36
38
|
list-style: none;
|
|
39
|
+
/* 2 */
|
|
40
|
+
font-size: 0;
|
|
37
41
|
.hook-breadcrumb();
|
|
38
42
|
}
|
|
39
43
|
|
|
@@ -83,7 +87,7 @@
|
|
|
83
87
|
content: @breadcrumb-divider;
|
|
84
88
|
display: inline-block;
|
|
85
89
|
/* 1 */
|
|
86
|
-
margin: 0 @breadcrumb-divider-margin-horizontal
|
|
90
|
+
margin: 0 @breadcrumb-divider-margin-horizontal;
|
|
87
91
|
/* 2 */
|
|
88
92
|
font-size: @breadcrumb-divider-font-size;
|
|
89
93
|
color: @breadcrumb-divider-color;
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
========================================================================== */
|
|
351
351
|
|
|
352
352
|
/*
|
|
353
|
-
* 1. Using `flex` instead of `inline-block` to prevent whitespace
|
|
353
|
+
* 1. Using `flex` instead of `inline-block` to prevent whitespace between child elements
|
|
354
354
|
* 2. Behave like button
|
|
355
355
|
* 3. Create position context
|
|
356
356
|
*/
|