uikit 3.11.2-dev.fb043abc2 → 3.12.2
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 +63 -20
- 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 +144 -202
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +144 -202
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +146 -208
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +146 -208
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +66 -138
- 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 -361
- 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 +156 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5317 -6554
- 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 +8018 -9698
- 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 +32 -85
- 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 +16 -30
- 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 +53 -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 +161 -128
- 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 +58 -45
- package/src/js/util/dom.js +37 -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 +18 -36
- 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/list.less +5 -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 +3 -3
- package/src/less/components/slideshow.less +3 -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/list.scss +5 -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 +3 -3
- package/src/scss/components/slideshow.scss +3 -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/countdown.html +10 -8
- 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 +57 -72
- package/tests/sticky.html +14 -3
- 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
package/src/js/core/toggle.js
CHANGED
|
@@ -1,12 +1,29 @@
|
|
|
1
|
+
import Lazyload from '../mixin/lazyload';
|
|
1
2
|
import Media from '../mixin/media';
|
|
2
3
|
import Togglable from '../mixin/togglable';
|
|
3
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
attr,
|
|
6
|
+
closest,
|
|
7
|
+
hasClass,
|
|
8
|
+
includes,
|
|
9
|
+
isBoolean,
|
|
10
|
+
isFocusable,
|
|
11
|
+
isTag,
|
|
12
|
+
isTouch,
|
|
13
|
+
matches,
|
|
14
|
+
once,
|
|
15
|
+
pointerDown,
|
|
16
|
+
pointerEnter,
|
|
17
|
+
pointerLeave,
|
|
18
|
+
queryAll,
|
|
19
|
+
trigger,
|
|
20
|
+
within,
|
|
21
|
+
} from 'uikit-util';
|
|
4
22
|
|
|
5
23
|
const KEY_SPACE = 32;
|
|
6
24
|
|
|
7
25
|
export default {
|
|
8
|
-
|
|
9
|
-
mixins: [Media, Togglable],
|
|
26
|
+
mixins: [Lazyload, Media, Togglable],
|
|
10
27
|
|
|
11
28
|
args: 'target',
|
|
12
29
|
|
|
@@ -14,43 +31,39 @@ export default {
|
|
|
14
31
|
href: String,
|
|
15
32
|
target: null,
|
|
16
33
|
mode: 'list',
|
|
17
|
-
queued: Boolean
|
|
34
|
+
queued: Boolean,
|
|
18
35
|
},
|
|
19
36
|
|
|
20
37
|
data: {
|
|
21
38
|
href: false,
|
|
22
39
|
target: false,
|
|
23
40
|
mode: 'click',
|
|
24
|
-
queued: true
|
|
41
|
+
queued: true,
|
|
25
42
|
},
|
|
26
43
|
|
|
27
44
|
connected() {
|
|
28
45
|
if (!includes(this.mode, 'media') && !isFocusable(this.$el)) {
|
|
29
46
|
attr(this.$el, 'tabindex', '0');
|
|
30
47
|
}
|
|
48
|
+
this.lazyload(this.$el, this.target);
|
|
31
49
|
},
|
|
32
50
|
|
|
33
51
|
computed: {
|
|
34
|
-
|
|
35
52
|
target: {
|
|
36
|
-
|
|
37
|
-
get({href, target}, $el) {
|
|
53
|
+
get({ href, target }, $el) {
|
|
38
54
|
target = queryAll(target || href, $el);
|
|
39
|
-
return target.length && target || [$el];
|
|
55
|
+
return (target.length && target) || [$el];
|
|
40
56
|
},
|
|
41
57
|
|
|
42
58
|
watch() {
|
|
43
59
|
this.updateAria();
|
|
44
60
|
},
|
|
45
61
|
|
|
46
|
-
immediate: true
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
62
|
+
immediate: true,
|
|
63
|
+
},
|
|
50
64
|
},
|
|
51
65
|
|
|
52
66
|
events: [
|
|
53
|
-
|
|
54
67
|
{
|
|
55
68
|
name: pointerDown,
|
|
56
69
|
|
|
@@ -59,7 +72,6 @@ export default {
|
|
|
59
72
|
},
|
|
60
73
|
|
|
61
74
|
handler(e) {
|
|
62
|
-
|
|
63
75
|
if (!isTouch(e) || this._showState) {
|
|
64
76
|
return;
|
|
65
77
|
}
|
|
@@ -67,17 +79,22 @@ export default {
|
|
|
67
79
|
// Clicking a button does not give it focus on all browsers and platforms
|
|
68
80
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
|
|
69
81
|
trigger(this.$el, 'focus');
|
|
70
|
-
once(
|
|
82
|
+
once(
|
|
83
|
+
document,
|
|
84
|
+
pointerDown,
|
|
85
|
+
() => trigger(this.$el, 'blur'),
|
|
86
|
+
true,
|
|
87
|
+
(e) => !within(e.target, this.$el)
|
|
88
|
+
);
|
|
71
89
|
|
|
72
90
|
// Prevent initial click to prevent double toggle through focus + click
|
|
73
91
|
if (includes(this.mode, 'click')) {
|
|
74
92
|
this._preventClick = true;
|
|
75
93
|
}
|
|
76
|
-
}
|
|
94
|
+
},
|
|
77
95
|
},
|
|
78
96
|
|
|
79
97
|
{
|
|
80
|
-
|
|
81
98
|
name: `${pointerEnter} ${pointerLeave} focus blur`,
|
|
82
99
|
|
|
83
100
|
filter() {
|
|
@@ -93,16 +110,16 @@ export default {
|
|
|
93
110
|
const expanded = attr(this.$el, 'aria-expanded');
|
|
94
111
|
|
|
95
112
|
// Skip hide if still hovered or focused
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
113
|
+
if (
|
|
114
|
+
!show &&
|
|
115
|
+
((e.type === pointerLeave && matches(this.$el, ':focus')) ||
|
|
116
|
+
(e.type === 'blur' && matches(this.$el, ':hover')))
|
|
117
|
+
) {
|
|
100
118
|
return;
|
|
101
119
|
}
|
|
102
120
|
|
|
103
121
|
// Skip if state does not change e.g. hover + focus received
|
|
104
122
|
if (this._showState && show === (expanded !== this._showState)) {
|
|
105
|
-
|
|
106
123
|
// Ensure reset if state has changed through click
|
|
107
124
|
if (!show) {
|
|
108
125
|
this._showState = null;
|
|
@@ -113,15 +130,14 @@ export default {
|
|
|
113
130
|
this._showState = show ? expanded : null;
|
|
114
131
|
|
|
115
132
|
this.toggle(`toggle${show ? 'show' : 'hide'}`);
|
|
116
|
-
}
|
|
117
|
-
|
|
133
|
+
},
|
|
118
134
|
},
|
|
119
135
|
|
|
120
136
|
{
|
|
121
137
|
name: 'keydown',
|
|
122
138
|
|
|
123
139
|
filter() {
|
|
124
|
-
return includes(this.mode, 'click') && this.$el
|
|
140
|
+
return includes(this.mode, 'click') && !isTag(this.$el, 'input');
|
|
125
141
|
},
|
|
126
142
|
|
|
127
143
|
handler(e) {
|
|
@@ -129,11 +145,10 @@ export default {
|
|
|
129
145
|
e.preventDefault();
|
|
130
146
|
this.$el.click();
|
|
131
147
|
}
|
|
132
|
-
}
|
|
148
|
+
},
|
|
133
149
|
},
|
|
134
150
|
|
|
135
151
|
{
|
|
136
|
-
|
|
137
152
|
name: 'click',
|
|
138
153
|
|
|
139
154
|
filter() {
|
|
@@ -141,28 +156,25 @@ export default {
|
|
|
141
156
|
},
|
|
142
157
|
|
|
143
158
|
handler(e) {
|
|
144
|
-
|
|
145
159
|
if (this._preventClick) {
|
|
146
|
-
return this._preventClick = null;
|
|
160
|
+
return (this._preventClick = null);
|
|
147
161
|
}
|
|
148
162
|
|
|
149
163
|
let link;
|
|
150
|
-
if (
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
if (
|
|
165
|
+
closest(e.target, 'a[href="#"], a[href=""]') ||
|
|
166
|
+
((link = closest(e.target, 'a[href]')) &&
|
|
167
|
+
(attr(this.$el, 'aria-expanded') !== 'true' ||
|
|
168
|
+
(link.hash && matches(this.target, link.hash))))
|
|
155
169
|
) {
|
|
156
170
|
e.preventDefault();
|
|
157
171
|
}
|
|
158
172
|
|
|
159
173
|
this.toggle();
|
|
160
|
-
}
|
|
161
|
-
|
|
174
|
+
},
|
|
162
175
|
},
|
|
163
176
|
|
|
164
177
|
{
|
|
165
|
-
|
|
166
178
|
name: 'toggled',
|
|
167
179
|
|
|
168
180
|
self: true,
|
|
@@ -175,36 +187,27 @@ export default {
|
|
|
175
187
|
if (e.target === this.target[0]) {
|
|
176
188
|
this.updateAria(toggled);
|
|
177
189
|
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
190
|
+
},
|
|
191
|
+
},
|
|
181
192
|
],
|
|
182
193
|
|
|
183
194
|
update: {
|
|
184
|
-
|
|
185
195
|
read() {
|
|
186
|
-
return includes(this.mode, 'media') && this.media
|
|
187
|
-
? {match: this.matchMedia}
|
|
188
|
-
: false;
|
|
196
|
+
return includes(this.mode, 'media') && this.media ? { match: this.matchMedia } : false;
|
|
189
197
|
},
|
|
190
198
|
|
|
191
|
-
write({match}) {
|
|
192
|
-
|
|
199
|
+
write({ match }) {
|
|
193
200
|
const toggled = this.isToggled(this.target);
|
|
194
201
|
if (match ? !toggled : toggled) {
|
|
195
202
|
this.toggle();
|
|
196
203
|
}
|
|
197
|
-
|
|
198
204
|
},
|
|
199
205
|
|
|
200
|
-
events: ['resize']
|
|
201
|
-
|
|
206
|
+
events: ['resize'],
|
|
202
207
|
},
|
|
203
208
|
|
|
204
209
|
methods: {
|
|
205
|
-
|
|
206
|
-
toggle(type) {
|
|
207
|
-
|
|
210
|
+
async toggle(type) {
|
|
208
211
|
if (!trigger(this.target, type || 'toggle', [this])) {
|
|
209
212
|
return;
|
|
210
213
|
}
|
|
@@ -213,23 +216,22 @@ export default {
|
|
|
213
216
|
return this.toggleElement(this.target);
|
|
214
217
|
}
|
|
215
218
|
|
|
216
|
-
const leaving = this.target.filter(el => hasClass(el, this.clsLeave));
|
|
219
|
+
const leaving = this.target.filter((el) => hasClass(el, this.clsLeave));
|
|
217
220
|
|
|
218
221
|
if (leaving.length) {
|
|
219
|
-
this.target
|
|
222
|
+
for (const el of this.target) {
|
|
220
223
|
const isLeaving = includes(leaving, el);
|
|
221
224
|
this.toggleElement(el, isLeaving, isLeaving);
|
|
222
|
-
}
|
|
225
|
+
}
|
|
223
226
|
return;
|
|
224
227
|
}
|
|
225
228
|
|
|
226
229
|
const toggled = this.target.filter(this.isToggled);
|
|
227
|
-
this.toggleElement(toggled, false)
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
230
|
+
await this.toggleElement(toggled, false);
|
|
231
|
+
await this.toggleElement(
|
|
232
|
+
this.target.filter((el) => !includes(toggled, el)),
|
|
233
|
+
true
|
|
231
234
|
);
|
|
232
|
-
|
|
233
235
|
},
|
|
234
236
|
|
|
235
237
|
updateAria(toggled) {
|
|
@@ -237,12 +239,11 @@ export default {
|
|
|
237
239
|
return;
|
|
238
240
|
}
|
|
239
241
|
|
|
240
|
-
attr(
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
attr(
|
|
243
|
+
this.$el,
|
|
244
|
+
'aria-expanded',
|
|
245
|
+
isBoolean(toggled) ? toggled : this.isToggled(this.target)
|
|
243
246
|
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
|
|
247
|
+
},
|
|
248
|
+
},
|
|
248
249
|
};
|
package/src/js/core/video.js
CHANGED
|
@@ -1,29 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
css,
|
|
3
|
+
hasAttr,
|
|
4
|
+
isInView,
|
|
5
|
+
isVideo,
|
|
6
|
+
isVisible,
|
|
7
|
+
mute,
|
|
8
|
+
observeIntersection,
|
|
9
|
+
pause,
|
|
10
|
+
play,
|
|
11
|
+
} from 'uikit-util';
|
|
2
12
|
|
|
3
13
|
export default {
|
|
4
|
-
|
|
5
14
|
args: 'autoplay',
|
|
6
15
|
|
|
7
16
|
props: {
|
|
8
17
|
automute: Boolean,
|
|
9
|
-
autoplay: Boolean
|
|
18
|
+
autoplay: Boolean,
|
|
10
19
|
},
|
|
11
20
|
|
|
12
21
|
data: {
|
|
13
22
|
automute: false,
|
|
14
|
-
autoplay: true
|
|
23
|
+
autoplay: true,
|
|
15
24
|
},
|
|
16
25
|
|
|
17
26
|
computed: {
|
|
18
|
-
|
|
19
|
-
inView({autoplay}) {
|
|
27
|
+
inView({ autoplay }) {
|
|
20
28
|
return autoplay === 'inview';
|
|
21
|
-
}
|
|
22
|
-
|
|
29
|
+
},
|
|
23
30
|
},
|
|
24
31
|
|
|
25
32
|
connected() {
|
|
26
|
-
|
|
27
33
|
if (this.inView && !hasAttr(this.$el, 'preload')) {
|
|
28
34
|
this.$el.preload = 'none';
|
|
29
35
|
}
|
|
@@ -32,34 +38,29 @@ export default {
|
|
|
32
38
|
mute(this.$el);
|
|
33
39
|
}
|
|
34
40
|
|
|
41
|
+
this.registerObserver(observeIntersection(this.$el, () => this.$emit('scroll'), {}, false));
|
|
35
42
|
},
|
|
36
43
|
|
|
37
44
|
update: {
|
|
38
|
-
|
|
39
45
|
read() {
|
|
40
|
-
|
|
41
46
|
if (!isVideo(this.$el)) {
|
|
42
47
|
return false;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
return {
|
|
46
51
|
visible: isVisible(this.$el) && css(this.$el, 'visibility') !== 'hidden',
|
|
47
|
-
inView: this.inView && isInView(this.$el)
|
|
52
|
+
inView: this.inView && isInView(this.$el),
|
|
48
53
|
};
|
|
49
54
|
},
|
|
50
55
|
|
|
51
|
-
write({visible, inView}) {
|
|
52
|
-
|
|
53
|
-
if (!visible || this.inView && !inView) {
|
|
56
|
+
write({ visible, inView }) {
|
|
57
|
+
if (!visible || (this.inView && !inView)) {
|
|
54
58
|
pause(this.$el);
|
|
55
|
-
} else if (this.autoplay === true || this.inView && inView) {
|
|
59
|
+
} else if (this.autoplay === true || (this.inView && inView)) {
|
|
56
60
|
play(this.$el);
|
|
57
61
|
}
|
|
58
|
-
|
|
59
62
|
},
|
|
60
63
|
|
|
61
|
-
events: ['resize', 'scroll']
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
64
|
+
events: ['resize', 'scroll'],
|
|
65
|
+
},
|
|
65
66
|
};
|
package/src/js/mixin/animate.js
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
1
|
import fade from './internal/animate-fade';
|
|
2
2
|
import slide from './internal/animate-slide';
|
|
3
|
-
import {noop
|
|
3
|
+
import { noop } from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
|
|
7
6
|
props: {
|
|
8
7
|
duration: Number,
|
|
9
|
-
animation: Boolean
|
|
8
|
+
animation: Boolean,
|
|
10
9
|
},
|
|
11
10
|
|
|
12
11
|
data: {
|
|
13
12
|
duration: 150,
|
|
14
|
-
animation: 'slide'
|
|
13
|
+
animation: 'slide',
|
|
15
14
|
},
|
|
16
15
|
|
|
17
16
|
methods: {
|
|
18
|
-
|
|
19
17
|
animate(action, target = this.$el) {
|
|
20
|
-
|
|
21
18
|
const name = this.animation;
|
|
22
|
-
const animationFn =
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
const animationFn =
|
|
20
|
+
name === 'fade'
|
|
21
|
+
? fade
|
|
22
|
+
: name === 'delayed-fade'
|
|
25
23
|
? (...args) => fade(...args, 40)
|
|
26
24
|
: name
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return animationFn(action, target, this.duration)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
? slide
|
|
26
|
+
: () => {
|
|
27
|
+
action();
|
|
28
|
+
return Promise.resolve();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return animationFn(action, target, this.duration).then(
|
|
32
|
+
() => this.$update(target, 'resize'),
|
|
33
|
+
noop
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
38
37
|
};
|
package/src/js/mixin/class.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import {$} from 'uikit-util';
|
|
1
|
+
import { $ } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
4
|
props: {
|
|
6
|
-
container: Boolean
|
|
5
|
+
container: Boolean,
|
|
7
6
|
},
|
|
8
7
|
|
|
9
8
|
data: {
|
|
10
|
-
container: true
|
|
9
|
+
container: true,
|
|
11
10
|
},
|
|
12
11
|
|
|
13
12
|
computed: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
13
|
+
container({ container }) {
|
|
14
|
+
return (container === true && this.$container) || (container && $(container));
|
|
15
|
+
},
|
|
16
|
+
},
|
|
21
17
|
};
|
|
@@ -1,43 +1,58 @@
|
|
|
1
|
-
import {getRows} from '../../core/margin';
|
|
2
|
-
import {
|
|
1
|
+
import { getRows } from '../../core/margin';
|
|
2
|
+
import {
|
|
3
|
+
addClass,
|
|
4
|
+
children,
|
|
5
|
+
css,
|
|
6
|
+
hasClass,
|
|
7
|
+
height,
|
|
8
|
+
isInView,
|
|
9
|
+
once,
|
|
10
|
+
removeClass,
|
|
11
|
+
sortBy,
|
|
12
|
+
toNumber,
|
|
13
|
+
Transition,
|
|
14
|
+
} from 'uikit-util';
|
|
3
15
|
|
|
4
16
|
const clsLeave = 'uk-transition-leave';
|
|
5
17
|
const clsEnter = 'uk-transition-enter';
|
|
6
18
|
|
|
7
19
|
export default function fade(action, target, duration, stagger = 0) {
|
|
8
|
-
|
|
9
20
|
const index = transitionIndex(target, true);
|
|
10
|
-
const propsIn = {opacity: 1};
|
|
11
|
-
const propsOut = {opacity: 0};
|
|
21
|
+
const propsIn = { opacity: 1 };
|
|
22
|
+
const propsOut = { opacity: 0 };
|
|
12
23
|
|
|
13
|
-
const wrapIndexFn = fn =>
|
|
14
|
-
() => index === transitionIndex(target) ? fn() : Promise.reject();
|
|
24
|
+
const wrapIndexFn = (fn) => () => index === transitionIndex(target) ? fn() : Promise.reject();
|
|
15
25
|
|
|
16
26
|
const leaveFn = wrapIndexFn(() => {
|
|
17
|
-
|
|
18
27
|
addClass(target, clsLeave);
|
|
19
28
|
|
|
20
|
-
return Promise.all(
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
return Promise.all(
|
|
30
|
+
getTransitionNodes(target).map(
|
|
31
|
+
(child, i) =>
|
|
32
|
+
new Promise((resolve) =>
|
|
33
|
+
setTimeout(
|
|
34
|
+
() =>
|
|
35
|
+
Transition.start(child, propsOut, duration / 2, 'ease').then(
|
|
36
|
+
resolve
|
|
37
|
+
),
|
|
38
|
+
i * stagger
|
|
39
|
+
)
|
|
40
|
+
)
|
|
23
41
|
)
|
|
24
|
-
)
|
|
25
|
-
|
|
42
|
+
).then(() => removeClass(target, clsLeave));
|
|
26
43
|
});
|
|
27
44
|
|
|
28
45
|
const enterFn = wrapIndexFn(() => {
|
|
29
|
-
|
|
30
46
|
const oldHeight = height(target);
|
|
31
47
|
|
|
32
48
|
addClass(target, clsEnter);
|
|
33
49
|
action();
|
|
34
50
|
|
|
35
|
-
css(children(target), {opacity: 0});
|
|
51
|
+
css(children(target), { opacity: 0 });
|
|
36
52
|
|
|
37
53
|
// Ensure UIkit updates have propagated
|
|
38
|
-
return new Promise(resolve =>
|
|
54
|
+
return new Promise((resolve) =>
|
|
39
55
|
requestAnimationFrame(() => {
|
|
40
|
-
|
|
41
56
|
const nodes = children(target);
|
|
42
57
|
const newHeight = height(target);
|
|
43
58
|
|
|
@@ -48,21 +63,35 @@ export default function fade(action, target, duration, stagger = 0) {
|
|
|
48
63
|
const transitionNodes = getTransitionNodes(target);
|
|
49
64
|
css(nodes, propsOut);
|
|
50
65
|
|
|
51
|
-
const transitions = transitionNodes.map(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
const transitions = transitionNodes.map(
|
|
67
|
+
(child, i) =>
|
|
68
|
+
new Promise((resolve) =>
|
|
69
|
+
setTimeout(
|
|
70
|
+
() =>
|
|
71
|
+
Transition.start(child, propsIn, duration / 2, 'ease').then(
|
|
72
|
+
resolve
|
|
73
|
+
),
|
|
74
|
+
i * stagger
|
|
75
|
+
)
|
|
76
|
+
)
|
|
55
77
|
);
|
|
56
78
|
|
|
57
79
|
if (oldHeight !== newHeight) {
|
|
58
|
-
transitions.push(
|
|
80
|
+
transitions.push(
|
|
81
|
+
Transition.start(
|
|
82
|
+
target,
|
|
83
|
+
{ height: newHeight },
|
|
84
|
+
duration / 2 + transitionNodes.length * stagger,
|
|
85
|
+
'ease'
|
|
86
|
+
)
|
|
87
|
+
);
|
|
59
88
|
}
|
|
60
89
|
|
|
61
90
|
Promise.all(transitions).then(() => {
|
|
62
91
|
removeClass(target, clsEnter);
|
|
63
92
|
if (index === transitionIndex(target)) {
|
|
64
|
-
css(target, {height: '', alignContent: ''});
|
|
65
|
-
css(nodes, {opacity: ''});
|
|
93
|
+
css(target, { height: '', alignContent: '' });
|
|
94
|
+
css(nodes, { opacity: '' });
|
|
66
95
|
delete target.dataset.transition;
|
|
67
96
|
}
|
|
68
97
|
resolve();
|
|
@@ -74,8 +103,8 @@ export default function fade(action, target, duration, stagger = 0) {
|
|
|
74
103
|
return hasClass(target, clsLeave)
|
|
75
104
|
? waitTransitionend(target).then(enterFn)
|
|
76
105
|
: hasClass(target, clsEnter)
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
? waitTransitionend(target).then(leaveFn).then(enterFn)
|
|
107
|
+
: leaveFn().then(enterFn);
|
|
79
108
|
}
|
|
80
109
|
|
|
81
110
|
function transitionIndex(target, next) {
|
|
@@ -87,11 +116,25 @@ function transitionIndex(target, next) {
|
|
|
87
116
|
}
|
|
88
117
|
|
|
89
118
|
function waitTransitionend(target) {
|
|
90
|
-
return Promise.all(
|
|
91
|
-
|
|
92
|
-
|
|
119
|
+
return Promise.all(
|
|
120
|
+
children(target)
|
|
121
|
+
.filter(Transition.inProgress)
|
|
122
|
+
.map(
|
|
123
|
+
(el) =>
|
|
124
|
+
new Promise((resolve) => once(el, 'transitionend transitioncanceled', resolve))
|
|
125
|
+
)
|
|
126
|
+
);
|
|
93
127
|
}
|
|
94
128
|
|
|
95
129
|
function getTransitionNodes(target) {
|
|
96
|
-
return getRows(children(target)).reduce(
|
|
130
|
+
return getRows(children(target)).reduce(
|
|
131
|
+
(nodes, row) =>
|
|
132
|
+
nodes.concat(
|
|
133
|
+
sortBy(
|
|
134
|
+
row.filter((el) => isInView(el)),
|
|
135
|
+
'offsetLeft'
|
|
136
|
+
)
|
|
137
|
+
),
|
|
138
|
+
[]
|
|
139
|
+
);
|
|
97
140
|
}
|