uikit 3.21.14-dev.60ed95dfb → 3.21.14-dev.b1911d7ca
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 +30 -0
- package/dist/css/uikit-core-rtl.css +216 -85
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +216 -85
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +220 -81
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +220 -81
- 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 +406 -109
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +423 -114
- 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 +15 -20
- 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 +20 -26
- 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 +5 -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 +125 -130
- package/dist/js/uikit-core.min.js +1 -1
- package/dist/js/uikit-icons.js +1 -1
- package/dist/js/uikit-icons.min.js +1 -1
- package/dist/js/uikit.js +478 -368
- package/dist/js/uikit.min.js +1 -1
- package/package.json +2 -2
- package/src/js/api/instance.js +1 -1
- package/src/js/components/internal/lightbox-animations.js +2 -1
- package/src/js/components/internal/slideshow-animations.js +5 -5
- package/src/js/components/lightbox-panel.js +172 -31
- package/src/js/components/lightbox.js +59 -6
- package/src/js/components/slideshow.js +1 -2
- package/src/js/core/icon.js +2 -2
- package/src/js/core/img.js +3 -5
- package/src/js/core/svg.js +8 -10
- package/src/js/core/video.js +4 -3
- package/src/js/mixin/internal/slideshow-animations.js +1 -6
- package/src/js/mixin/modal.js +1 -4
- package/src/js/mixin/slider-drag.js +5 -6
- package/src/js/mixin/slider-nav.js +1 -1
- package/src/js/mixin/slider.js +11 -13
- package/src/js/mixin/slideshow.js +1 -1
- package/src/js/mixin/togglable.js +4 -2
- package/src/js/util/dom.js +3 -1
- package/src/js/util/player.js +0 -4
- package/src/less/components/background.less +1 -9
- 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/search.less +49 -23
- package/src/less/components/sticky.less +1 -10
- package/src/less/components/totop.less +1 -1
- package/src/less/components/transition.less +4 -4
- package/src/less/components/visibility.less +3 -2
- package/src/less/theme/form-range.less +12 -0
- package/src/less/theme/lightbox.less +2 -20
- package/src/less/theme/search.less +24 -10
- package/src/scss/components/background.scss +1 -9
- 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 +49 -77
- package/src/scss/components/search.scss +30 -12
- package/src/scss/components/sticky.scss +1 -10
- package/src/scss/components/totop.scss +1 -1
- package/src/scss/components/transition.scss +4 -4
- package/src/scss/components/visibility.scss +3 -2
- package/src/scss/mixins-theme.scss +51 -12
- package/src/scss/mixins.scss +45 -6
- package/src/scss/theme/form-range.scss +10 -0
- package/src/scss/theme/lightbox.scss +2 -20
- package/src/scss/theme/search.scss +10 -6
- package/src/scss/variables-theme.scss +32 -20
- package/src/scss/variables.scss +29 -24
- package/tests/breadcrumb.html +23 -5
- package/tests/lightbox.html +345 -30
- package/tests/navbar.html +19 -19
- package/tests/slideshow.html +1 -1
- package/tests/transition.html +2 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "uikit",
|
|
3
3
|
"title": "UIkit",
|
|
4
4
|
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
-
"version": "3.21.14-dev.
|
|
5
|
+
"version": "3.21.14-dev.b1911d7ca",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"fs-extra": "^11.2.0",
|
|
36
36
|
"glob": "^11.0.0",
|
|
37
37
|
"globals": "^15.7.0",
|
|
38
|
-
"inquirer": "^
|
|
38
|
+
"inquirer": "^12.0.0",
|
|
39
39
|
"less": "^4.2.0",
|
|
40
40
|
"minimist": "^1.2.8",
|
|
41
41
|
"number-precision": "^1.6.0",
|
package/src/js/api/instance.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'uikit-util';
|
|
2
|
-
import Animations
|
|
2
|
+
import Animations from '../../mixin/internal/slideshow-animations';
|
|
3
|
+
import { scale3d } from './slideshow-animations';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
...Animations,
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { css } from 'uikit-util';
|
|
2
|
-
import Animations, {
|
|
3
|
-
scale3d,
|
|
4
|
-
translate,
|
|
5
|
-
translated,
|
|
6
|
-
} from '../../mixin/internal/slideshow-animations';
|
|
2
|
+
import Animations, { translate, translated } from '../../mixin/internal/slideshow-animations';
|
|
7
3
|
|
|
8
4
|
export default {
|
|
9
5
|
...Animations,
|
|
@@ -98,3 +94,7 @@ export default {
|
|
|
98
94
|
},
|
|
99
95
|
},
|
|
100
96
|
};
|
|
97
|
+
|
|
98
|
+
export function scale3d(value) {
|
|
99
|
+
return `scale3d(${value}, ${value}, 1)`;
|
|
100
|
+
}
|
|
@@ -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
|
|
|
@@ -167,7 +244,7 @@ export default {
|
|
|
167
244
|
|
|
168
245
|
this.toggleElement(this.$el, true, false);
|
|
169
246
|
|
|
170
|
-
this.animation = Animations
|
|
247
|
+
this.animation = Animations.scale;
|
|
171
248
|
removeClass(e.target, this.clsActive);
|
|
172
249
|
this.stack.splice(1, 0, this.index);
|
|
173
250
|
},
|
|
@@ -178,6 +255,10 @@ export default {
|
|
|
178
255
|
|
|
179
256
|
handler() {
|
|
180
257
|
html($(this.selCaption, this.$el), this.getItem().caption || '');
|
|
258
|
+
html(
|
|
259
|
+
$(this.selCounter, this.$el),
|
|
260
|
+
this.t('counter', this.index + 1, this.slides.length),
|
|
261
|
+
);
|
|
181
262
|
|
|
182
263
|
for (let j = -this.preload; j <= this.preload; j++) {
|
|
183
264
|
this.loadItem(this.index + j);
|
|
@@ -197,7 +278,7 @@ export default {
|
|
|
197
278
|
name: 'itemload',
|
|
198
279
|
|
|
199
280
|
async handler(_, item) {
|
|
200
|
-
const { source: src, type,
|
|
281
|
+
const { source: src, type, attrs = {} } = item;
|
|
201
282
|
|
|
202
283
|
this.setItem(item, '<span uk-spinner></span>');
|
|
203
284
|
|
|
@@ -210,26 +291,32 @@ export default {
|
|
|
210
291
|
allowfullscreen: '',
|
|
211
292
|
style: 'max-width: 100%; box-sizing: border-box;',
|
|
212
293
|
'uk-responsive': '',
|
|
213
|
-
'uk-video': `${this.videoAutoplay}`,
|
|
294
|
+
'uk-video': `${Boolean(this.videoAutoplay)}`,
|
|
214
295
|
};
|
|
215
296
|
|
|
216
297
|
// Image
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
298
|
+
if (type === 'image' || isImage(src)) {
|
|
299
|
+
const img = createEl('img');
|
|
300
|
+
|
|
301
|
+
wrapInPicture(img, item.sources);
|
|
302
|
+
attr(img, {
|
|
303
|
+
src,
|
|
304
|
+
...pick(item, ['alt', 'srcset', 'sizes']),
|
|
305
|
+
...attrs,
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
on(img, 'load', () => this.setItem(item, parent(img) || img));
|
|
223
309
|
on(img, 'error', () => this.setError(item));
|
|
224
310
|
|
|
225
311
|
// Video
|
|
226
|
-
} else if (type === 'video' || src
|
|
312
|
+
} else if (type === 'video' || isVideo(src)) {
|
|
313
|
+
const inline = this.videoAutoplay === 'inline';
|
|
227
314
|
const video = createEl('video', {
|
|
228
315
|
src,
|
|
229
|
-
poster,
|
|
230
|
-
controls: '',
|
|
231
316
|
playsinline: '',
|
|
232
|
-
'
|
|
317
|
+
controls: inline ? null : '',
|
|
318
|
+
poster: this.videoAutoplay ? null : item.poster,
|
|
319
|
+
'uk-video': inline ? 'automute: true' : Boolean(this.videoAutoplay),
|
|
233
320
|
...attrs,
|
|
234
321
|
});
|
|
235
322
|
|
|
@@ -297,8 +384,33 @@ export default {
|
|
|
297
384
|
}
|
|
298
385
|
},
|
|
299
386
|
},
|
|
387
|
+
|
|
388
|
+
{
|
|
389
|
+
name: 'itemloaded',
|
|
390
|
+
handler() {
|
|
391
|
+
this.$emit('resize');
|
|
392
|
+
},
|
|
393
|
+
},
|
|
300
394
|
],
|
|
301
395
|
|
|
396
|
+
update: {
|
|
397
|
+
read() {
|
|
398
|
+
for (const media of $$(`${this.selList} :not([controls]):is(img,video)`, this.$el)) {
|
|
399
|
+
toggleClass(
|
|
400
|
+
media,
|
|
401
|
+
this.clsZoom,
|
|
402
|
+
(media.naturalHeight || media.videoHeight) - this.$el.offsetHeight >
|
|
403
|
+
Math.max(
|
|
404
|
+
0,
|
|
405
|
+
(media.naturalWidth || media.videoWidth) - this.$el.offsetWidth,
|
|
406
|
+
),
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
},
|
|
410
|
+
|
|
411
|
+
events: ['resize'],
|
|
412
|
+
},
|
|
413
|
+
|
|
302
414
|
methods: {
|
|
303
415
|
loadItem(index = this.index) {
|
|
304
416
|
const item = this.getItem(index);
|
|
@@ -326,7 +438,8 @@ export default {
|
|
|
326
438
|
|
|
327
439
|
showControls() {
|
|
328
440
|
clearTimeout(this.controlsTimer);
|
|
329
|
-
this.controlsTimer =
|
|
441
|
+
this.controlsTimer =
|
|
442
|
+
this.delayControls && setTimeout(this.hideControls, this.delayControls);
|
|
330
443
|
|
|
331
444
|
addClass(this.$el, 'uk-active', 'uk-transition-active');
|
|
332
445
|
},
|
|
@@ -342,3 +455,31 @@ function createEl(tag, attrs) {
|
|
|
342
455
|
attr(el, attrs);
|
|
343
456
|
return el;
|
|
344
457
|
}
|
|
458
|
+
|
|
459
|
+
function toThumbnavItem(item, videoAutoplay) {
|
|
460
|
+
const el =
|
|
461
|
+
item.poster || (item.thumb && (item.type === 'image' || isImage(item.thumb)))
|
|
462
|
+
? createEl('img', { src: item.poster || item.thumb, alt: '' })
|
|
463
|
+
: item.thumb && (item.type === 'video' || isVideo(item.thumb))
|
|
464
|
+
? createEl('video', {
|
|
465
|
+
src: item.thumb,
|
|
466
|
+
loop: '',
|
|
467
|
+
playsinline: '',
|
|
468
|
+
'uk-video': `autoplay: ${Boolean(videoAutoplay)}; automute: true`,
|
|
469
|
+
})
|
|
470
|
+
: createEl('canvas');
|
|
471
|
+
|
|
472
|
+
if (item.thumbRatio) {
|
|
473
|
+
el.style.aspectRatio = item.thumbRatio;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
return el;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
function isImage(src) {
|
|
480
|
+
return src?.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i);
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function isVideo(src) {
|
|
484
|
+
return src?.match(/\.(mp4|webm|ogv)($|\?)/i);
|
|
485
|
+
}
|
|
@@ -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/icon.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
attr,
|
|
6
6
|
css,
|
|
7
7
|
each,
|
|
8
|
+
fragment,
|
|
8
9
|
hasAttr,
|
|
9
10
|
hasClass,
|
|
10
11
|
hyphenate,
|
|
@@ -35,7 +36,6 @@ import spinner from '../../images/components/spinner.svg';
|
|
|
35
36
|
import totop from '../../images/components/totop.svg';
|
|
36
37
|
import I18n from '../mixin/i18n';
|
|
37
38
|
import Svg from '../mixin/svg';
|
|
38
|
-
import { stringToSvg } from './svg';
|
|
39
39
|
|
|
40
40
|
const icons = {
|
|
41
41
|
spinner,
|
|
@@ -262,7 +262,7 @@ function getIcon(icon) {
|
|
|
262
262
|
}
|
|
263
263
|
|
|
264
264
|
if (!parsed[icon]) {
|
|
265
|
-
parsed[icon] =
|
|
265
|
+
parsed[icon] = fragment(icons[applyRtl(icon)] || icons[icon]);
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
return parsed[icon].cloneNode(true);
|
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/svg.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
addClass,
|
|
3
3
|
attr,
|
|
4
4
|
css,
|
|
5
|
+
fragment,
|
|
5
6
|
includes,
|
|
6
7
|
isTag,
|
|
7
8
|
memoize,
|
|
@@ -94,11 +95,14 @@ const loadSVG = memoize(async (src) => {
|
|
|
94
95
|
if (startsWith(src, 'data:')) {
|
|
95
96
|
return decodeURIComponent(src.split(',')[1]);
|
|
96
97
|
} else {
|
|
97
|
-
|
|
98
|
+
const response = await fetch(src);
|
|
99
|
+
if (response.headers.get('Content-Type') === 'image/svg+xml') {
|
|
100
|
+
return response.text();
|
|
101
|
+
}
|
|
98
102
|
}
|
|
99
|
-
} else {
|
|
100
|
-
return Promise.reject();
|
|
101
103
|
}
|
|
104
|
+
|
|
105
|
+
return Promise.reject();
|
|
102
106
|
});
|
|
103
107
|
|
|
104
108
|
function parseSVG(svg, icon) {
|
|
@@ -106,7 +110,7 @@ function parseSVG(svg, icon) {
|
|
|
106
110
|
svg = parseSymbols(svg)[icon] || svg;
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
return
|
|
113
|
+
return fragment(svg);
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
const symbolRe = /<symbol([^]*?id=(['"])(.+?)\2[^]*?<\/)symbol>/g;
|
|
@@ -131,9 +135,3 @@ function applyAnimation(el) {
|
|
|
131
135
|
css(el, '--uk-animation-stroke', length);
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
|
-
|
|
135
|
-
export function stringToSvg(string) {
|
|
136
|
-
const container = document.createElement('template');
|
|
137
|
-
container.innerHTML = string;
|
|
138
|
-
return container.content.firstElementChild;
|
|
139
|
-
}
|
package/src/js/core/video.js
CHANGED
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
includes,
|
|
4
4
|
isTag,
|
|
5
5
|
isTouch,
|
|
6
|
-
isVideo,
|
|
7
6
|
mute,
|
|
8
7
|
parent,
|
|
9
8
|
pause,
|
|
@@ -78,7 +77,7 @@ export default {
|
|
|
78
77
|
|
|
79
78
|
observe: [
|
|
80
79
|
intersection({
|
|
81
|
-
filter: ({
|
|
80
|
+
filter: ({ autoplay }) => autoplay !== 'hover',
|
|
82
81
|
handler([{ isIntersecting }]) {
|
|
83
82
|
if (!document.fullscreenElement) {
|
|
84
83
|
if (isIntersecting) {
|
|
@@ -91,7 +90,9 @@ export default {
|
|
|
91
90
|
}
|
|
92
91
|
},
|
|
93
92
|
args: { intersecting: false },
|
|
94
|
-
options: ({ $el, autoplay }) => ({
|
|
93
|
+
options: ({ $el, autoplay }) => ({
|
|
94
|
+
root: autoplay === 'inview' ? null : parent($el).closest(':not(a)'),
|
|
95
|
+
}),
|
|
95
96
|
}),
|
|
96
97
|
],
|
|
97
98
|
};
|
|
@@ -24,10 +24,5 @@ export function translated(el) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function translate(value = 0, unit = '%') {
|
|
27
|
-
value
|
|
28
|
-
return `translate3d(${value}, 0, 0)`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function scale3d(value) {
|
|
32
|
-
return `scale3d(${value}, ${value}, 1)`;
|
|
27
|
+
return value ? `translate3d(${value + unit}, 0, 0)` : '';
|
|
33
28
|
}
|
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;
|