uikit 3.11.2-dev.f2970ffaa → 3.11.2-dev.f3ade19c4
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 +54 -18
- 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 +133 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +133 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +135 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +135 -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 +1091 -1319
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1137 -1396
- 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 +347 -372
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +345 -360
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +749 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +345 -360
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +628 -798
- 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 +5326 -6526
- 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 +8031 -9659
- 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 +199 -187
- package/src/js/components/countdown.js +26 -52
- 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 +9 -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 +21 -46
- package/src/js/components/slider-parallax.js +13 -23
- package/src/js/components/slider.js +117 -89
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -13
- 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 +58 -48
- package/src/js/core/alert.js +9 -17
- package/src/js/core/core.js +17 -69
- package/src/js/core/cover.js +15 -15
- package/src/js/core/drop.js +110 -94
- package/src/js/core/form-custom.js +22 -27
- 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 +30 -34
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +153 -143
- 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 +113 -85
- package/src/js/core/offcanvas.js +51 -54
- 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 +175 -123
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +56 -47
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +69 -68
- package/src/js/core/video.js +22 -21
- 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/lazyload.js +20 -0
- package/src/js/mixin/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +149 -107
- 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 +47 -60
- package/src/js/mixin/slideshow.js +12 -22
- package/src/js/mixin/swipe.js +72 -0
- 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 +78 -49
- 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 +1 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/observer.js +36 -0
- package/src/js/util/options.js +35 -49
- 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 +25 -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 +25 -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 -64
- 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 +16 -7
- 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 +87 -99
- package/tests/sticky.html +56 -24
- 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 +50 -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
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import Animations, {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import Animations, {
|
|
2
|
+
scale3d,
|
|
3
|
+
translate,
|
|
4
|
+
translated,
|
|
5
|
+
} from '../../mixin/internal/slideshow-animations';
|
|
6
|
+
import { css } from 'uikit-util';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
...Animations,
|
|
6
10
|
fade: {
|
|
7
|
-
|
|
8
11
|
show() {
|
|
9
|
-
return [
|
|
10
|
-
{opacity: 0, zIndex: 0},
|
|
11
|
-
{zIndex: -1}
|
|
12
|
-
];
|
|
12
|
+
return [{ opacity: 0, zIndex: 0 }, { zIndex: -1 }];
|
|
13
13
|
},
|
|
14
14
|
|
|
15
15
|
percent(current) {
|
|
@@ -17,21 +17,13 @@ export default assign({}, Animations, {
|
|
|
17
17
|
},
|
|
18
18
|
|
|
19
19
|
translate(percent) {
|
|
20
|
-
return [
|
|
21
|
-
|
|
22
|
-
{zIndex: -1}
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
|
|
20
|
+
return [{ opacity: 1 - percent, zIndex: 0 }, { zIndex: -1 }];
|
|
21
|
+
},
|
|
26
22
|
},
|
|
27
23
|
|
|
28
24
|
scale: {
|
|
29
|
-
|
|
30
25
|
show() {
|
|
31
|
-
return [
|
|
32
|
-
{opacity: 0, transform: scale3d(1 + .5), zIndex: 0},
|
|
33
|
-
{zIndex: -1}
|
|
34
|
-
];
|
|
26
|
+
return [{ opacity: 0, transform: scale3d(1 + 0.5), zIndex: 0 }, { zIndex: -1 }];
|
|
35
27
|
},
|
|
36
28
|
|
|
37
29
|
percent(current) {
|
|
@@ -40,79 +32,69 @@ export default assign({}, Animations, {
|
|
|
40
32
|
|
|
41
33
|
translate(percent) {
|
|
42
34
|
return [
|
|
43
|
-
{opacity: 1 - percent, transform: scale3d(1 + .5 * percent), zIndex: 0},
|
|
44
|
-
{zIndex: -1}
|
|
35
|
+
{ opacity: 1 - percent, transform: scale3d(1 + 0.5 * percent), zIndex: 0 },
|
|
36
|
+
{ zIndex: -1 },
|
|
45
37
|
];
|
|
46
|
-
}
|
|
47
|
-
|
|
38
|
+
},
|
|
48
39
|
},
|
|
49
40
|
|
|
50
41
|
pull: {
|
|
51
|
-
|
|
52
42
|
show(dir) {
|
|
53
43
|
return dir < 0
|
|
54
44
|
? [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
{ transform: translate(30), zIndex: -1 },
|
|
46
|
+
{ transform: translate(), zIndex: 0 },
|
|
47
|
+
]
|
|
58
48
|
: [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
{ transform: translate(-100), zIndex: 0 },
|
|
50
|
+
{ transform: translate(), zIndex: -1 },
|
|
51
|
+
];
|
|
62
52
|
},
|
|
63
53
|
|
|
64
54
|
percent(current, next, dir) {
|
|
65
|
-
return dir < 0
|
|
66
|
-
? 1 - translated(next)
|
|
67
|
-
: translated(current);
|
|
55
|
+
return dir < 0 ? 1 - translated(next) : translated(current);
|
|
68
56
|
},
|
|
69
57
|
|
|
70
58
|
translate(percent, dir) {
|
|
71
59
|
return dir < 0
|
|
72
60
|
? [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
{ transform: translate(30 * percent), zIndex: -1 },
|
|
62
|
+
{ transform: translate(-100 * (1 - percent)), zIndex: 0 },
|
|
63
|
+
]
|
|
76
64
|
: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
65
|
+
{ transform: translate(-percent * 100), zIndex: 0 },
|
|
66
|
+
{ transform: translate(30 * (1 - percent)), zIndex: -1 },
|
|
67
|
+
];
|
|
68
|
+
},
|
|
82
69
|
},
|
|
83
70
|
|
|
84
71
|
push: {
|
|
85
|
-
|
|
86
72
|
show(dir) {
|
|
87
73
|
return dir < 0
|
|
88
74
|
? [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
75
|
+
{ transform: translate(100), zIndex: 0 },
|
|
76
|
+
{ transform: translate(), zIndex: -1 },
|
|
77
|
+
]
|
|
92
78
|
: [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
79
|
+
{ transform: translate(-30), zIndex: -1 },
|
|
80
|
+
{ transform: translate(), zIndex: 0 },
|
|
81
|
+
];
|
|
96
82
|
},
|
|
97
83
|
|
|
98
84
|
percent(current, next, dir) {
|
|
99
|
-
return dir > 0
|
|
100
|
-
? 1 - translated(next)
|
|
101
|
-
: translated(current);
|
|
85
|
+
return dir > 0 ? 1 - translated(next) : translated(current);
|
|
102
86
|
},
|
|
103
87
|
|
|
104
88
|
translate(percent, dir) {
|
|
105
89
|
return dir < 0
|
|
106
90
|
? [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
91
|
+
{ transform: translate(percent * 100), zIndex: 0 },
|
|
92
|
+
{ transform: translate(-30 * (1 - percent)), zIndex: -1 },
|
|
93
|
+
]
|
|
110
94
|
: [
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
});
|
|
95
|
+
{ transform: translate(-30 * percent), zIndex: -1 },
|
|
96
|
+
{ transform: translate(100 * (1 - percent)), zIndex: 0 },
|
|
97
|
+
];
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
@@ -3,10 +3,24 @@ import Container from '../mixin/container';
|
|
|
3
3
|
import Modal from '../mixin/modal';
|
|
4
4
|
import Slideshow from '../mixin/slideshow';
|
|
5
5
|
import Togglable from '../mixin/togglable';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
$,
|
|
8
|
+
addClass,
|
|
9
|
+
append,
|
|
10
|
+
attr,
|
|
11
|
+
fragment,
|
|
12
|
+
getImage,
|
|
13
|
+
getIndex,
|
|
14
|
+
html,
|
|
15
|
+
on,
|
|
16
|
+
pointerDown,
|
|
17
|
+
pointerMove,
|
|
18
|
+
removeClass,
|
|
19
|
+
Transition,
|
|
20
|
+
trigger,
|
|
21
|
+
} from 'uikit-util';
|
|
7
22
|
|
|
8
23
|
export default {
|
|
9
|
-
|
|
10
24
|
mixins: [Container, Modal, Togglable, Slideshow],
|
|
11
25
|
|
|
12
26
|
functional: true,
|
|
@@ -15,7 +29,7 @@ export default {
|
|
|
15
29
|
delayControls: Number,
|
|
16
30
|
preload: Number,
|
|
17
31
|
videoAutoplay: Boolean,
|
|
18
|
-
template: String
|
|
32
|
+
template: String,
|
|
19
33
|
},
|
|
20
34
|
|
|
21
35
|
data: () => ({
|
|
@@ -40,39 +54,31 @@ export default {
|
|
|
40
54
|
<a class="uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade" href uk-slidenav-previous uk-lightbox-item="previous"></a>
|
|
41
55
|
<a class="uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade" href uk-slidenav-next uk-lightbox-item="next"></a>
|
|
42
56
|
<div class="uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque"></div>
|
|
43
|
-
</div
|
|
57
|
+
</div>`,
|
|
44
58
|
}),
|
|
45
59
|
|
|
46
60
|
created() {
|
|
47
|
-
|
|
48
61
|
const $el = $(this.template);
|
|
49
62
|
const list = $(this.selList, $el);
|
|
50
63
|
this.items.forEach(() => append(list, '<li>'));
|
|
51
64
|
|
|
52
65
|
this.$mount(append(this.container, $el));
|
|
53
|
-
|
|
54
66
|
},
|
|
55
67
|
|
|
56
68
|
computed: {
|
|
57
|
-
|
|
58
|
-
caption({selCaption}, $el) {
|
|
69
|
+
caption({ selCaption }, $el) {
|
|
59
70
|
return $(selCaption, $el);
|
|
60
|
-
}
|
|
61
|
-
|
|
71
|
+
},
|
|
62
72
|
},
|
|
63
73
|
|
|
64
74
|
events: [
|
|
65
|
-
|
|
66
75
|
{
|
|
67
|
-
|
|
68
76
|
name: `${pointerMove} ${pointerDown} keydown`,
|
|
69
77
|
|
|
70
|
-
handler: 'showControls'
|
|
71
|
-
|
|
78
|
+
handler: 'showControls',
|
|
72
79
|
},
|
|
73
80
|
|
|
74
81
|
{
|
|
75
|
-
|
|
76
82
|
name: 'click',
|
|
77
83
|
|
|
78
84
|
self: true,
|
|
@@ -82,58 +88,48 @@ export default {
|
|
|
82
88
|
},
|
|
83
89
|
|
|
84
90
|
handler(e) {
|
|
85
|
-
|
|
86
91
|
if (e.defaultPrevented) {
|
|
87
92
|
return;
|
|
88
93
|
}
|
|
89
94
|
|
|
90
95
|
this.hide();
|
|
91
|
-
}
|
|
92
|
-
|
|
96
|
+
},
|
|
93
97
|
},
|
|
94
98
|
|
|
95
99
|
{
|
|
96
|
-
|
|
97
100
|
name: 'shown',
|
|
98
101
|
|
|
99
102
|
self: true,
|
|
100
103
|
|
|
101
104
|
handler() {
|
|
102
105
|
this.showControls();
|
|
103
|
-
}
|
|
104
|
-
|
|
106
|
+
},
|
|
105
107
|
},
|
|
106
108
|
|
|
107
109
|
{
|
|
108
|
-
|
|
109
110
|
name: 'hide',
|
|
110
111
|
|
|
111
112
|
self: true,
|
|
112
113
|
|
|
113
114
|
handler() {
|
|
114
|
-
|
|
115
115
|
this.hideControls();
|
|
116
116
|
|
|
117
117
|
removeClass(this.slides, this.clsActive);
|
|
118
118
|
Transition.stop(this.slides);
|
|
119
|
-
|
|
120
|
-
}
|
|
119
|
+
},
|
|
121
120
|
},
|
|
122
121
|
|
|
123
122
|
{
|
|
124
|
-
|
|
125
123
|
name: 'hidden',
|
|
126
124
|
|
|
127
125
|
self: true,
|
|
128
126
|
|
|
129
127
|
handler() {
|
|
130
128
|
this.$destroy(true);
|
|
131
|
-
}
|
|
132
|
-
|
|
129
|
+
},
|
|
133
130
|
},
|
|
134
131
|
|
|
135
132
|
{
|
|
136
|
-
|
|
137
133
|
name: 'keyup',
|
|
138
134
|
|
|
139
135
|
el() {
|
|
@@ -141,7 +137,6 @@ export default {
|
|
|
141
137
|
},
|
|
142
138
|
|
|
143
139
|
handler(e) {
|
|
144
|
-
|
|
145
140
|
if (!this.isToggled(this.$el) || !this.draggable) {
|
|
146
141
|
return;
|
|
147
142
|
}
|
|
@@ -154,15 +149,13 @@ export default {
|
|
|
154
149
|
this.show('next');
|
|
155
150
|
break;
|
|
156
151
|
}
|
|
157
|
-
}
|
|
152
|
+
},
|
|
158
153
|
},
|
|
159
154
|
|
|
160
155
|
{
|
|
161
|
-
|
|
162
156
|
name: 'beforeitemshow',
|
|
163
157
|
|
|
164
158
|
handler(e) {
|
|
165
|
-
|
|
166
159
|
if (this.isToggled()) {
|
|
167
160
|
return;
|
|
168
161
|
}
|
|
@@ -176,44 +169,34 @@ export default {
|
|
|
176
169
|
this.animation = Animations['scale'];
|
|
177
170
|
removeClass(e.target, this.clsActive);
|
|
178
171
|
this.stack.splice(1, 0, this.index);
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
172
|
+
},
|
|
182
173
|
},
|
|
183
174
|
|
|
184
175
|
{
|
|
185
|
-
|
|
186
176
|
name: 'itemshow',
|
|
187
177
|
|
|
188
178
|
handler() {
|
|
189
|
-
|
|
190
179
|
html(this.caption, this.getItem().caption || '');
|
|
191
180
|
|
|
192
181
|
for (let j = -this.preload; j <= this.preload; j++) {
|
|
193
182
|
this.loadItem(this.index + j);
|
|
194
183
|
}
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
184
|
+
},
|
|
198
185
|
},
|
|
199
186
|
|
|
200
187
|
{
|
|
201
|
-
|
|
202
188
|
name: 'itemshown',
|
|
203
189
|
|
|
204
190
|
handler() {
|
|
205
191
|
this.draggable = this.$props.draggable;
|
|
206
|
-
}
|
|
207
|
-
|
|
192
|
+
},
|
|
208
193
|
},
|
|
209
194
|
|
|
210
195
|
{
|
|
211
|
-
|
|
212
196
|
name: 'itemload',
|
|
213
197
|
|
|
214
|
-
handler(_, item) {
|
|
215
|
-
|
|
216
|
-
const {source: src, type, alt = '', poster, attrs = {}} = item;
|
|
198
|
+
async handler(_, item) {
|
|
199
|
+
const { source: src, type, alt = '', poster, attrs = {} } = item;
|
|
217
200
|
|
|
218
201
|
this.setItem(item, '<span uk-spinner></span>');
|
|
219
202
|
|
|
@@ -228,80 +211,103 @@ export default {
|
|
|
228
211
|
allowfullscreen: '',
|
|
229
212
|
style: 'max-width: 100%; box-sizing: border-box;',
|
|
230
213
|
'uk-responsive': '',
|
|
231
|
-
'uk-video': `${this.videoAutoplay}
|
|
214
|
+
'uk-video': `${this.videoAutoplay}`,
|
|
232
215
|
};
|
|
233
216
|
|
|
234
217
|
// Image
|
|
235
218
|
if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
219
|
+
try {
|
|
220
|
+
const { width, height } = await getImage(src, attrs.srcset, attrs.size);
|
|
221
|
+
this.setItem(item, createEl('img', { src, width, height, alt, ...attrs }));
|
|
222
|
+
} catch (e) {
|
|
223
|
+
this.setError(item);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Video
|
|
243
227
|
} else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
|
|
244
|
-
|
|
245
|
-
const video = createEl('video', assign({
|
|
228
|
+
const video = createEl('video', {
|
|
246
229
|
src,
|
|
247
230
|
poster,
|
|
248
231
|
controls: '',
|
|
249
232
|
playsinline: '',
|
|
250
|
-
'uk-video': `${this.videoAutoplay}
|
|
251
|
-
|
|
233
|
+
'uk-video': `${this.videoAutoplay}`,
|
|
234
|
+
...attrs,
|
|
235
|
+
});
|
|
252
236
|
|
|
253
237
|
on(video, 'loadedmetadata', () => {
|
|
254
|
-
attr(video, {width: video.videoWidth, height: video.videoHeight});
|
|
238
|
+
attr(video, { width: video.videoWidth, height: video.videoHeight });
|
|
255
239
|
this.setItem(item, video);
|
|
256
240
|
});
|
|
257
241
|
on(video, 'error', () => this.setError(item));
|
|
258
242
|
|
|
259
|
-
|
|
243
|
+
// Iframe
|
|
260
244
|
} else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
|
|
245
|
+
this.setItem(
|
|
246
|
+
item,
|
|
247
|
+
createEl('iframe', {
|
|
248
|
+
src,
|
|
249
|
+
frameborder: '0',
|
|
250
|
+
allowfullscreen: '',
|
|
251
|
+
class: 'uk-lightbox-iframe',
|
|
252
|
+
...attrs,
|
|
253
|
+
})
|
|
254
|
+
);
|
|
261
255
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
} else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) {
|
|
280
|
-
|
|
281
|
-
ajax(`https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(src)}`, {
|
|
282
|
-
responseType: 'json',
|
|
283
|
-
withCredentials: false
|
|
284
|
-
}).then(
|
|
285
|
-
({response: {height, width}}) => this.setItem(item, createEl('iframe', assign({
|
|
286
|
-
src: `https://player.vimeo.com/video/${matches[1]}${matches[2] ? `?${matches[2]}` : ''}`,
|
|
287
|
-
width,
|
|
288
|
-
height
|
|
289
|
-
}, iframeAttrs, attrs))),
|
|
290
|
-
() => this.setError(item)
|
|
256
|
+
// YouTube
|
|
257
|
+
} else if (
|
|
258
|
+
(matches = src.match(
|
|
259
|
+
/\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/
|
|
260
|
+
))
|
|
261
|
+
) {
|
|
262
|
+
this.setItem(
|
|
263
|
+
item,
|
|
264
|
+
createEl('iframe', {
|
|
265
|
+
src: `https://www.youtube${matches[1] || ''}.com/embed/${matches[2]}${
|
|
266
|
+
matches[3] ? `?${matches[3]}` : ''
|
|
267
|
+
}`,
|
|
268
|
+
width: 1920,
|
|
269
|
+
height: 1080,
|
|
270
|
+
...iframeAttrs,
|
|
271
|
+
...attrs,
|
|
272
|
+
})
|
|
291
273
|
);
|
|
292
274
|
|
|
275
|
+
// Vimeo
|
|
276
|
+
} else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) {
|
|
277
|
+
try {
|
|
278
|
+
const { height, width } = await (
|
|
279
|
+
await fetch(
|
|
280
|
+
`https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(
|
|
281
|
+
src
|
|
282
|
+
)}`,
|
|
283
|
+
{
|
|
284
|
+
credentials: 'omit',
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
).json();
|
|
288
|
+
|
|
289
|
+
this.setItem(
|
|
290
|
+
item,
|
|
291
|
+
createEl('iframe', {
|
|
292
|
+
src: `https://player.vimeo.com/video/${matches[1]}${
|
|
293
|
+
matches[2] ? `?${matches[2]}` : ''
|
|
294
|
+
}`,
|
|
295
|
+
width,
|
|
296
|
+
height,
|
|
297
|
+
...iframeAttrs,
|
|
298
|
+
...attrs,
|
|
299
|
+
})
|
|
300
|
+
);
|
|
301
|
+
} catch (e) {
|
|
302
|
+
this.setError(item);
|
|
303
|
+
}
|
|
293
304
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
}
|
|
298
|
-
|
|
305
|
+
},
|
|
306
|
+
},
|
|
299
307
|
],
|
|
300
308
|
|
|
301
309
|
methods: {
|
|
302
|
-
|
|
303
310
|
loadItem(index = this.index) {
|
|
304
|
-
|
|
305
311
|
const item = this.getItem(index);
|
|
306
312
|
|
|
307
313
|
if (!this.getSlide(item).childElementCount) {
|
|
@@ -314,7 +320,7 @@ export default {
|
|
|
314
320
|
},
|
|
315
321
|
|
|
316
322
|
setItem(item, content) {
|
|
317
|
-
trigger(this.$el, 'itemloaded', [this, html(this.getSlide(item), content)
|
|
323
|
+
trigger(this.$el, 'itemloaded', [this, html(this.getSlide(item), content)]);
|
|
318
324
|
},
|
|
319
325
|
|
|
320
326
|
getSlide(item) {
|
|
@@ -326,20 +332,16 @@ export default {
|
|
|
326
332
|
},
|
|
327
333
|
|
|
328
334
|
showControls() {
|
|
329
|
-
|
|
330
335
|
clearTimeout(this.controlsTimer);
|
|
331
336
|
this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
|
|
332
337
|
|
|
333
338
|
addClass(this.$el, 'uk-active', 'uk-transition-active');
|
|
334
|
-
|
|
335
339
|
},
|
|
336
340
|
|
|
337
341
|
hideControls() {
|
|
338
342
|
removeClass(this.$el, 'uk-active', 'uk-transition-active');
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
+
},
|
|
344
|
+
},
|
|
343
345
|
};
|
|
344
346
|
|
|
345
347
|
function createEl(tag, attrs) {
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import LightboxPanel from './lightbox-panel';
|
|
2
|
-
import {$$, assign, data, findIndex, isElement, on, parseOptions, uniqueBy} from 'uikit-util';
|
|
2
|
+
import { $$, assign, data, findIndex, isElement, on, parseOptions, uniqueBy } from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
|
|
6
5
|
install,
|
|
7
6
|
|
|
8
|
-
props: {toggle: String},
|
|
7
|
+
props: { toggle: String },
|
|
9
8
|
|
|
10
|
-
data: {toggle: 'a'},
|
|
9
|
+
data: { toggle: 'a' },
|
|
11
10
|
|
|
12
11
|
computed: {
|
|
13
|
-
|
|
14
12
|
toggles: {
|
|
15
|
-
|
|
16
|
-
get({toggle}, $el) {
|
|
13
|
+
get({ toggle }, $el) {
|
|
17
14
|
return $$(toggle, $el);
|
|
18
15
|
},
|
|
19
16
|
|
|
20
17
|
watch() {
|
|
21
18
|
this.hide();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
19
|
+
},
|
|
20
|
+
},
|
|
26
21
|
},
|
|
27
22
|
|
|
28
23
|
disconnected() {
|
|
@@ -30,9 +25,7 @@ export default {
|
|
|
30
25
|
},
|
|
31
26
|
|
|
32
27
|
events: [
|
|
33
|
-
|
|
34
28
|
{
|
|
35
|
-
|
|
36
29
|
name: 'click',
|
|
37
30
|
|
|
38
31
|
delegate() {
|
|
@@ -42,61 +35,46 @@ export default {
|
|
|
42
35
|
handler(e) {
|
|
43
36
|
e.preventDefault();
|
|
44
37
|
this.show(e.current);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
38
|
+
},
|
|
39
|
+
},
|
|
49
40
|
],
|
|
50
41
|
|
|
51
42
|
methods: {
|
|
52
|
-
|
|
53
43
|
show(index) {
|
|
54
|
-
|
|
55
44
|
const items = uniqueBy(this.toggles.map(toItem), 'source');
|
|
56
45
|
|
|
57
46
|
if (isElement(index)) {
|
|
58
|
-
const {source} = toItem(index);
|
|
59
|
-
index = findIndex(items, ({source: src}) => source === src);
|
|
47
|
+
const { source } = toItem(index);
|
|
48
|
+
index = findIndex(items, ({ source: src }) => source === src);
|
|
60
49
|
}
|
|
61
50
|
|
|
62
|
-
this.panel = this.panel || this.$create('lightboxPanel',
|
|
51
|
+
this.panel = this.panel || this.$create('lightboxPanel', { ...this.$props, items });
|
|
63
52
|
|
|
64
|
-
on(this.panel.$el, 'hidden', () => this.panel = false);
|
|
53
|
+
on(this.panel.$el, 'hidden', () => (this.panel = false));
|
|
65
54
|
|
|
66
55
|
return this.panel.show(index);
|
|
67
|
-
|
|
68
56
|
},
|
|
69
57
|
|
|
70
58
|
hide() {
|
|
71
|
-
|
|
72
59
|
return this.panel && this.panel.hide();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
60
|
+
},
|
|
61
|
+
},
|
|
78
62
|
};
|
|
79
63
|
|
|
80
64
|
function install(UIkit, Lightbox) {
|
|
81
|
-
|
|
82
65
|
if (!UIkit.lightboxPanel) {
|
|
83
66
|
UIkit.component('lightboxPanel', LightboxPanel);
|
|
84
67
|
}
|
|
85
68
|
|
|
86
|
-
assign(
|
|
87
|
-
Lightbox.props,
|
|
88
|
-
UIkit.component('lightboxPanel').options.props
|
|
89
|
-
);
|
|
90
|
-
|
|
69
|
+
assign(Lightbox.props, UIkit.component('lightboxPanel').options.props);
|
|
91
70
|
}
|
|
92
71
|
|
|
93
72
|
function toItem(el) {
|
|
94
|
-
|
|
95
73
|
const item = {};
|
|
96
74
|
|
|
97
|
-
['href', 'caption', 'type', 'poster', 'alt', 'attrs']
|
|
75
|
+
for (const attr of ['href', 'caption', 'type', 'poster', 'alt', 'attrs']) {
|
|
98
76
|
item[attr === 'href' ? 'source' : attr] = data(el, attr);
|
|
99
|
-
}
|
|
77
|
+
}
|
|
100
78
|
|
|
101
79
|
item.attrs = parseOptions(item.attrs);
|
|
102
80
|
|