uikit 3.25.20-dev.e4f47fc → 3.25.20
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 +2 -33
- package/build/prefix.js +1 -1
- package/build/publishDev.js +1 -1
- package/build/scope.js +1 -1
- package/build/scss.js +1 -1
- package/dist/css/uikit-core-rtl.css +917 -1045
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +917 -1045
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +936 -1064
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +936 -1064
- 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 +132 -133
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +133 -134
- 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 +12 -8
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +12 -8
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +25 -41
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +12 -8
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +102 -71
- 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 +19 -19
- 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 +262 -752
- 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 +374 -627
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/component.js +3 -2
- package/src/js/api/observables.js +4 -2
- package/src/js/api/options.js +3 -6
- package/src/js/api/props.js +4 -1
- package/src/js/api/state.js +8 -7
- package/src/js/components/index.js +0 -1
- package/src/js/components/internal/lightbox-animations.js +26 -7
- package/src/js/components/internal/slideshow-animations.js +62 -15
- package/src/js/components/lightbox-panel.js +96 -121
- package/src/js/components/lightbox.js +8 -5
- package/src/js/components/tooltip.js +2 -4
- package/src/js/core/accordion.js +29 -78
- package/src/js/core/drop.js +4 -5
- package/src/js/core/dropnav.js +3 -3
- package/src/js/core/grid.js +19 -5
- package/src/js/core/height-match.js +2 -1
- package/src/js/core/margin.js +0 -3
- package/src/js/core/overflow-fade.js +5 -5
- package/src/js/core/sticky.js +1 -1
- package/src/js/core/switcher.js +44 -24
- package/src/js/core/video.js +15 -172
- package/src/js/mixin/internal/slideshow-animations.js +13 -5
- package/src/js/mixin/internal/slideshow-transitioner.js +2 -2
- package/src/js/mixin/modal.js +3 -4
- package/src/js/mixin/parallax.js +4 -1
- package/src/js/mixin/position.js +1 -1
- package/src/js/mixin/slider-nav.js +1 -1
- package/src/js/mixin/slider-parallax.js +38 -9
- package/src/js/mixin/togglable.js +14 -13
- package/src/js/util/attr.js +7 -7
- package/src/js/util/class.js +1 -1
- package/src/js/util/dom.js +4 -3
- package/src/js/util/lang.js +1 -1
- package/src/js/util/player.js +4 -4
- package/src/js/util/style.js +15 -10
- package/src/js/util/viewport.js +25 -22
- package/src/less/components/_import.less +1 -6
- package/src/less/components/base.less +1 -1
- package/src/less/components/button.less +1 -1
- package/src/less/components/form.less +5 -5
- package/src/less/components/grid.less +65 -58
- package/src/less/components/margin.less +124 -155
- package/src/less/components/nav.less +1 -1
- package/src/less/components/padding.less +9 -9
- package/src/less/components/text.less +0 -6
- package/src/less/components/utility.less +163 -0
- package/src/less/theme/_import.less +1 -5
- package/src/less/theme/utility.less +32 -0
- package/src/scss/components/_import.scss +1 -6
- package/src/scss/components/base.scss +1 -1
- package/src/scss/components/button.scss +1 -1
- package/src/scss/components/form.scss +5 -5
- package/src/scss/components/grid.scss +64 -57
- package/src/scss/components/margin.scss +124 -155
- package/src/scss/components/nav.scss +1 -1
- package/src/scss/components/padding.scss +9 -9
- package/src/scss/components/text.scss +0 -6
- package/src/scss/components/utility.scss +129 -0
- package/src/scss/mixins-theme.scss +33 -42
- package/src/scss/mixins.scss +30 -39
- package/src/scss/variables-theme.scss +14 -14
- package/src/scss/variables.scss +14 -14
- package/tests/accordion.html +10 -77
- package/tests/alert.html +1 -1
- package/tests/align.html +5 -5
- package/tests/animation.html +4 -4
- package/tests/article.html +7 -7
- package/tests/background.html +2 -2
- package/tests/badge.html +1 -1
- package/tests/base.html +3 -3
- package/tests/button.html +1 -1
- package/tests/card.html +15 -15
- package/tests/close.html +2 -2
- package/tests/comment.html +9 -9
- package/tests/container.html +2 -2
- package/tests/countdown.html +21 -21
- package/tests/cover.html +6 -6
- package/tests/description-list.html +1 -1
- package/tests/divider.html +3 -3
- package/tests/dotnav.html +1 -1
- package/tests/drop.html +7 -7
- package/tests/dropbar.html +5 -5
- package/tests/dropdown.html +1 -1
- package/tests/dropnav.html +18 -18
- package/tests/filter.html +3 -3
- package/tests/form.html +14 -14
- package/tests/grid.html +47 -41
- package/tests/heading.html +2 -2
- package/tests/height-viewport.html +4 -4
- package/tests/height.html +5 -5
- package/tests/icon.html +8 -8
- package/tests/image.html +6 -6
- package/tests/index.html +13 -13
- package/tests/js/index.js +1 -1
- package/tests/leader.html +5 -5
- package/tests/lightbox.html +14 -14
- package/tests/link.html +1 -1
- package/tests/list.html +4 -4
- package/tests/margin.html +7 -7
- package/tests/marker.html +3 -3
- package/tests/modal.html +4 -4
- package/tests/nav.html +5 -5
- package/tests/navbar.html +27 -27
- package/tests/notification.html +2 -2
- package/tests/offcanvas.html +12 -12
- package/tests/overlay.html +3 -3
- package/tests/padding.html +1 -1
- package/tests/pagination.html +3 -3
- package/tests/parallax.html +1 -1
- package/tests/position.html +6 -6
- package/tests/scrollspy.html +12 -12
- package/tests/search.html +5 -5
- package/tests/section.html +17 -17
- package/tests/slidenav.html +3 -3
- package/tests/slider.html +5 -5
- package/tests/slideshow.html +4 -34
- package/tests/sortable.html +15 -15
- package/tests/sticky-navbar.html +4 -4
- package/tests/sticky-parallax.html +3 -3
- package/tests/sticky.html +3 -3
- package/tests/svg.html +2 -3
- package/tests/switcher.html +6 -6
- package/tests/tab.html +4 -4
- package/tests/text.html +3 -3
- package/tests/tile.html +4 -4
- package/tests/toggle.html +1 -1
- package/tests/tooltip.html +3 -3
- package/tests/totop.html +2 -2
- package/tests/transition.html +1 -1
- package/tests/upload.html +5 -5
- package/tests/utility.html +116 -16
- package/tests/video.html +27 -227
- package/tests/visibility.html +4 -4
- package/tests/width.html +12 -12
- package/dist/js/components/marquee.js +0 -179
- package/dist/js/components/marquee.min.js +0 -1
- package/src/js/components/marquee.js +0 -123
- package/src/js/mixin/connect.js +0 -55
- package/src/js/mixin/scroll-driven.js +0 -57
- package/src/less/components/dropcap.less +0 -71
- package/src/less/components/floating-shadow.less +0 -66
- package/src/less/components/logo.less +0 -94
- package/src/less/components/marquee.less +0 -133
- package/src/less/theme/dropcap.less +0 -29
- package/src/less/theme/floating-shadow.less +0 -20
- package/src/less/theme/logo.less +0 -29
- package/src/less/theme/marquee.less +0 -14
- package/src/scss/components/dropcap.scss +0 -63
- package/src/scss/components/floating-shadow.scss +0 -63
- package/src/scss/components/logo.scss +0 -75
- package/src/scss/components/marquee.scss +0 -136
- package/tests/dropcap.html +0 -26
- package/tests/floating-shadow.html +0 -44
- package/tests/logo.html +0 -84
- package/tests/marquee.html +0 -617
package/src/js/core/video.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
hasAttr,
|
|
3
|
-
isFocusable,
|
|
4
3
|
isTag,
|
|
5
4
|
isTouch,
|
|
6
5
|
mute,
|
|
@@ -12,50 +11,26 @@ import {
|
|
|
12
11
|
query,
|
|
13
12
|
} from 'uikit-util';
|
|
14
13
|
import { intersection } from '../api/observables';
|
|
15
|
-
import ScrollDriven from '../mixin/scroll-driven';
|
|
16
|
-
|
|
17
|
-
const loopKey = Symbol();
|
|
18
14
|
|
|
19
15
|
export default {
|
|
20
|
-
mixins: [ScrollDriven],
|
|
21
|
-
|
|
22
16
|
args: 'autoplay',
|
|
23
17
|
|
|
24
18
|
props: {
|
|
25
19
|
automute: Boolean,
|
|
26
20
|
autoplay: Boolean,
|
|
27
21
|
restart: Boolean,
|
|
28
|
-
inviewMargin: String,
|
|
29
|
-
inviewQueued: Number,
|
|
30
22
|
hoverTarget: Boolean,
|
|
31
|
-
hoverRewind: Number,
|
|
32
|
-
reducedMotionTime: Number,
|
|
33
23
|
},
|
|
34
24
|
|
|
35
25
|
data: {
|
|
36
26
|
automute: false,
|
|
37
27
|
autoplay: true,
|
|
38
28
|
restart: false,
|
|
39
|
-
inviewMargin: '0px',
|
|
40
|
-
inviewQueued: 0,
|
|
41
29
|
hoverTarget: false,
|
|
42
|
-
hoverRewind: 0,
|
|
43
|
-
reducedMotionTime: 0,
|
|
44
30
|
},
|
|
45
31
|
|
|
46
32
|
beforeConnect() {
|
|
47
33
|
const isVideo = isTag(this.$el, 'video');
|
|
48
|
-
|
|
49
|
-
this.restart = isVideo && this.restart;
|
|
50
|
-
this.parallax = isVideo && this.autoplay === 'parallax';
|
|
51
|
-
this.manualControl = ['hover', 'parallax'].includes(this.autoplay);
|
|
52
|
-
this.inviewQueued = this.autoplay === 'inview' && this.inviewQueued;
|
|
53
|
-
|
|
54
|
-
if (this.inviewQueued) {
|
|
55
|
-
this.$el[loopKey] = this.$el.loop;
|
|
56
|
-
this.$el.loop = false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
34
|
if (this.autoplay === 'inview' && isVideo && !hasAttr(this.$el, 'preload')) {
|
|
60
35
|
this.$el.preload = 'none';
|
|
61
36
|
}
|
|
@@ -66,11 +41,7 @@ export default {
|
|
|
66
41
|
|
|
67
42
|
if (this.autoplay === 'hover') {
|
|
68
43
|
if (isVideo) {
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
if (!isFocusable(this.hoverTarget)) {
|
|
72
|
-
this.hoverTarget.tabIndex = 0;
|
|
73
|
-
}
|
|
44
|
+
this.$el.tabIndex = 0;
|
|
74
45
|
} else {
|
|
75
46
|
this.autoplay = true;
|
|
76
47
|
}
|
|
@@ -82,29 +53,19 @@ export default {
|
|
|
82
53
|
}
|
|
83
54
|
},
|
|
84
55
|
|
|
85
|
-
disconnected() {
|
|
86
|
-
if (this.$el[loopKey]) {
|
|
87
|
-
this.$el.loop = true;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
queue.delete(this.$el);
|
|
91
|
-
},
|
|
92
|
-
|
|
93
56
|
events: [
|
|
94
57
|
{
|
|
95
58
|
name: `${pointerEnter} focusin`,
|
|
96
59
|
|
|
97
|
-
el: ({ hoverTarget }) => hoverTarget,
|
|
60
|
+
el: ({ hoverTarget, $el }) => query(hoverTarget, $el) || $el,
|
|
98
61
|
|
|
99
62
|
filter: ({ autoplay }) => autoplay === 'hover',
|
|
100
63
|
|
|
101
64
|
handler(e) {
|
|
102
|
-
this._reverseAbort?.abort();
|
|
103
|
-
|
|
104
65
|
if (!isTouch(e) || !isPlaying(this.$el)) {
|
|
105
|
-
|
|
66
|
+
play(this.$el);
|
|
106
67
|
} else {
|
|
107
|
-
this.
|
|
68
|
+
pauseHover(this.$el, this.restart);
|
|
108
69
|
}
|
|
109
70
|
},
|
|
110
71
|
},
|
|
@@ -112,27 +73,14 @@ export default {
|
|
|
112
73
|
{
|
|
113
74
|
name: `${pointerLeave} focusout`,
|
|
114
75
|
|
|
115
|
-
el: ({ hoverTarget }) => hoverTarget,
|
|
76
|
+
el: ({ hoverTarget, $el }) => query(hoverTarget, $el) || $el,
|
|
116
77
|
|
|
117
78
|
filter: ({ autoplay }) => autoplay === 'hover',
|
|
118
79
|
|
|
119
80
|
handler(e) {
|
|
120
81
|
if (!isTouch(e)) {
|
|
121
|
-
this.
|
|
122
|
-
this.pause();
|
|
123
|
-
this._reverseAbort = playReverse(this.$el, this.hoverRewind);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'error pause ended',
|
|
129
|
-
filter: ({ inviewQueued }) => inviewQueued,
|
|
130
|
-
handler(e) {
|
|
131
|
-
if (e.type === 'error' || (e.type === 'ended' && !this.$el[loopKey])) {
|
|
132
|
-
queue.delete(this.$el);
|
|
82
|
+
pauseHover(this.$el, this.restart);
|
|
133
83
|
}
|
|
134
|
-
|
|
135
|
-
playNextQueued();
|
|
136
84
|
},
|
|
137
85
|
},
|
|
138
86
|
],
|
|
@@ -147,138 +95,33 @@ export default {
|
|
|
147
95
|
}),
|
|
148
96
|
|
|
149
97
|
intersection({
|
|
150
|
-
filter: ({ $el,
|
|
151
|
-
handler([{ isIntersecting }]) {
|
|
98
|
+
filter: ({ $el, autoplay }) => autoplay !== 'hover' && $el.preload !== 'none',
|
|
99
|
+
handler([{ isIntersecting, target }]) {
|
|
152
100
|
if (!document.fullscreenElement) {
|
|
153
101
|
if (isIntersecting) {
|
|
154
102
|
if (this.autoplay) {
|
|
155
|
-
|
|
103
|
+
play(target);
|
|
156
104
|
}
|
|
157
105
|
} else {
|
|
158
|
-
this.
|
|
106
|
+
pauseHover(target, this.restart);
|
|
159
107
|
}
|
|
160
108
|
}
|
|
161
109
|
},
|
|
162
110
|
args: { intersecting: false },
|
|
163
|
-
options: ({ $el, autoplay
|
|
111
|
+
options: ({ $el, autoplay }) => ({
|
|
164
112
|
root: autoplay === 'inview' ? null : parent($el).closest(':not(a)'),
|
|
165
|
-
rootMargin: autoplay === 'inview' ? inviewMargin : '0px',
|
|
166
113
|
}),
|
|
167
114
|
}),
|
|
168
115
|
],
|
|
169
|
-
|
|
170
|
-
update: {
|
|
171
|
-
write({ percent }) {
|
|
172
|
-
if (!this.parallax) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const { duration, seeking } = this.$el;
|
|
177
|
-
|
|
178
|
-
if (!isNaN(duration) && !seeking) {
|
|
179
|
-
this.$el.currentTime = percent * duration;
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
events: ['scroll', 'resize'],
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
methods: {
|
|
187
|
-
_autoplay() {
|
|
188
|
-
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
189
|
-
this.pause();
|
|
190
|
-
|
|
191
|
-
if (isTag(this.$el, 'video')) {
|
|
192
|
-
this.$el.currentTime = this.reducedMotionTime;
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
this.play();
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
|
|
199
|
-
play() {
|
|
200
|
-
if (this.inviewQueued) {
|
|
201
|
-
queue.set(this.$el, this.inviewQueued);
|
|
202
|
-
playNextQueued();
|
|
203
|
-
} else {
|
|
204
|
-
play(this.$el);
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
pause() {
|
|
209
|
-
pause(this.$el);
|
|
210
|
-
|
|
211
|
-
queue.delete(this.$el);
|
|
212
|
-
|
|
213
|
-
if (this.restart) {
|
|
214
|
-
this.$el.currentTime = 0;
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
116
|
};
|
|
219
117
|
|
|
220
118
|
function isPlaying(videoEl) {
|
|
221
119
|
return !videoEl.paused && !videoEl.ended;
|
|
222
120
|
}
|
|
223
121
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
async function playNextQueued() {
|
|
229
|
-
cancelAnimationFrame(frame);
|
|
230
|
-
await new Promise((resolve) => (frame = requestAnimationFrame(resolve)));
|
|
231
|
-
|
|
232
|
-
const getPlayed = (el) => played.get(el) ?? 0;
|
|
233
|
-
const videos = shuffle(queue.keys()).sort((a, b) => getPlayed(a) - getPlayed(b));
|
|
234
|
-
|
|
235
|
-
for (const el of videos) {
|
|
236
|
-
const maxQueued = queue.get(el);
|
|
237
|
-
|
|
238
|
-
if (isPlaying(el) || videos.filter(isPlaying).length / queue.size >= maxQueued) {
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
played.set(el, getPlayed(el) + 1);
|
|
243
|
-
play(el);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function shuffle(array) {
|
|
248
|
-
array = [...array];
|
|
249
|
-
for (let i = array.length - 1; i > 0; i--) {
|
|
250
|
-
let j = Math.floor(Math.random() * (i + 1));
|
|
251
|
-
[array[i], array[j]] = [array[j], array[i]];
|
|
252
|
-
}
|
|
253
|
-
return array;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function playReverse(el, playbackRate) {
|
|
257
|
-
const start = el.currentTime;
|
|
258
|
-
|
|
259
|
-
if (isNaN(start) || !playbackRate) {
|
|
260
|
-
return;
|
|
122
|
+
function pauseHover(el, restart) {
|
|
123
|
+
pause(el);
|
|
124
|
+
if (restart && isTag(el, 'video')) {
|
|
125
|
+
el.currentTime = 0;
|
|
261
126
|
}
|
|
262
|
-
|
|
263
|
-
playbackRate *= Math.max(1, start / 10 + 0.5);
|
|
264
|
-
|
|
265
|
-
const controller = new AbortController();
|
|
266
|
-
const time = Date.now();
|
|
267
|
-
(function next() {
|
|
268
|
-
requestAnimationFrame(() => {
|
|
269
|
-
if (controller.signal.aborted) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if (!el.seeking) {
|
|
274
|
-
el.currentTime = Math.max(0, start - ((Date.now() - time) * playbackRate) / 1000);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (el.currentTime > 0) {
|
|
278
|
-
next();
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
})();
|
|
282
|
-
|
|
283
|
-
return controller;
|
|
284
127
|
}
|
|
@@ -2,12 +2,20 @@ import { css } from 'uikit-util';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
slide: {
|
|
5
|
-
|
|
5
|
+
show(dir) {
|
|
6
|
+
return [{ transform: translate(dir * -100) }, { transform: translate() }];
|
|
7
|
+
},
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
percent(current) {
|
|
10
|
+
return translated(current);
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
translate(percent, dir) {
|
|
14
|
+
return [
|
|
15
|
+
{ transform: translate(dir * -100 * percent) },
|
|
16
|
+
{ transform: translate(dir * 100 * (1 - percent)) },
|
|
17
|
+
];
|
|
18
|
+
},
|
|
11
19
|
},
|
|
12
20
|
};
|
|
13
21
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { clamp, createEvent, css, noop, resetProps, Transition, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default function Transitioner(prev, next, dir, { animation, easing }) {
|
|
4
|
-
const { percent, translate } = animation;
|
|
5
|
-
const props =
|
|
4
|
+
const { percent, translate, show = noop } = animation;
|
|
5
|
+
const props = show(dir);
|
|
6
6
|
|
|
7
7
|
const { promise, resolve } = withResolvers();
|
|
8
8
|
|
package/src/js/mixin/modal.js
CHANGED
|
@@ -229,12 +229,11 @@ export default {
|
|
|
229
229
|
},
|
|
230
230
|
};
|
|
231
231
|
|
|
232
|
-
const rejectKey = Symbol();
|
|
233
232
|
function animate(el, show, { transitionElement, _toggle }) {
|
|
234
233
|
return new Promise((resolve, reject) =>
|
|
235
234
|
once(el, 'show hide', () => {
|
|
236
|
-
el
|
|
237
|
-
el
|
|
235
|
+
el._reject?.();
|
|
236
|
+
el._reject = reject;
|
|
238
237
|
|
|
239
238
|
_toggle(el, show);
|
|
240
239
|
|
|
@@ -258,7 +257,7 @@ function animate(el, show, { transitionElement, _toggle }) {
|
|
|
258
257
|
toMs(css(transitionElement, 'transitionDuration')),
|
|
259
258
|
);
|
|
260
259
|
}),
|
|
261
|
-
).then(() => delete el
|
|
260
|
+
).then(() => delete el._reject);
|
|
262
261
|
}
|
|
263
262
|
|
|
264
263
|
function toMs(time) {
|
package/src/js/mixin/parallax.js
CHANGED
|
@@ -382,7 +382,10 @@ function getCssValue(el, prop, value) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
function fillObject(keys, value) {
|
|
385
|
-
return
|
|
385
|
+
return keys.reduce((data, prop) => {
|
|
386
|
+
data[prop] = value;
|
|
387
|
+
return data;
|
|
388
|
+
}, {});
|
|
386
389
|
}
|
|
387
390
|
|
|
388
391
|
/*
|
package/src/js/mixin/position.js
CHANGED
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
},
|
|
28
28
|
|
|
29
29
|
connected() {
|
|
30
|
-
this.pos =
|
|
30
|
+
this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
|
|
31
31
|
[this.dir, this.align] = this.pos;
|
|
32
32
|
this.axis = includes(['top', 'bottom'], this.dir) ? 'y' : 'x';
|
|
33
33
|
},
|
|
@@ -35,7 +35,7 @@ export default {
|
|
|
35
35
|
nav: ({ selNav }, $el) => $$(selNav, $el),
|
|
36
36
|
|
|
37
37
|
navChildren() {
|
|
38
|
-
return this.nav.
|
|
38
|
+
return this.nav.map((nav) => children(nav)).flat();
|
|
39
39
|
},
|
|
40
40
|
|
|
41
41
|
selNavItem: ({ attrItem }) => `[${attrItem}],[data-${attrItem}]`,
|
|
@@ -1,30 +1,59 @@
|
|
|
1
|
-
import { hasClass, includes, trigger } from 'uikit-util';
|
|
2
|
-
import
|
|
1
|
+
import { hasClass, includes, query, scrolledOver, toPx, trigger } from 'uikit-util';
|
|
2
|
+
import { resize, scroll } from '../api/observables';
|
|
3
|
+
import { ease } from './parallax';
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
|
-
mixins: [ScrollDriven],
|
|
6
|
-
|
|
7
6
|
props: {
|
|
8
7
|
parallax: Boolean,
|
|
8
|
+
parallaxTarget: Boolean,
|
|
9
|
+
parallaxStart: String,
|
|
10
|
+
parallaxEnd: String,
|
|
11
|
+
parallaxEasing: Number,
|
|
9
12
|
},
|
|
10
13
|
|
|
11
14
|
data: {
|
|
12
15
|
parallax: false,
|
|
16
|
+
parallaxTarget: false,
|
|
17
|
+
parallaxStart: 0,
|
|
18
|
+
parallaxEnd: 0,
|
|
19
|
+
parallaxEasing: 0,
|
|
13
20
|
},
|
|
14
21
|
|
|
22
|
+
observe: [
|
|
23
|
+
resize({
|
|
24
|
+
target: ({ $el, parallaxTarget }) => [$el, parallaxTarget],
|
|
25
|
+
filter: ({ parallax }) => parallax,
|
|
26
|
+
}),
|
|
27
|
+
scroll({ filter: ({ parallax }) => parallax }),
|
|
28
|
+
],
|
|
29
|
+
|
|
15
30
|
computed: {
|
|
16
|
-
|
|
17
|
-
return this.list;
|
|
31
|
+
parallaxTarget({ parallaxTarget }, $el) {
|
|
32
|
+
return (parallaxTarget && query(parallaxTarget, $el)) || this.list;
|
|
18
33
|
},
|
|
19
34
|
},
|
|
20
35
|
|
|
21
36
|
update: {
|
|
22
|
-
|
|
37
|
+
read() {
|
|
23
38
|
if (!this.parallax) {
|
|
24
|
-
return;
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const target = this.parallaxTarget;
|
|
43
|
+
|
|
44
|
+
if (!target) {
|
|
45
|
+
return false;
|
|
25
46
|
}
|
|
26
47
|
|
|
27
|
-
const
|
|
48
|
+
const start = toPx(this.parallaxStart, 'height', target, true);
|
|
49
|
+
const end = toPx(this.parallaxEnd, 'height', target, true);
|
|
50
|
+
const percent = ease(scrolledOver(target, start, end), this.parallaxEasing);
|
|
51
|
+
|
|
52
|
+
return { parallax: this.getIndexAt(percent) };
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
write({ parallax }) {
|
|
56
|
+
const [prevIndex, slidePercent] = parallax;
|
|
28
57
|
|
|
29
58
|
const nextIndex = this.getValidIndex(prevIndex + Math.ceil(slidePercent));
|
|
30
59
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
isBoolean,
|
|
10
10
|
isFunction,
|
|
11
11
|
isVisible,
|
|
12
|
-
pick,
|
|
13
12
|
removeClass,
|
|
14
13
|
startsWith,
|
|
15
14
|
toFloat,
|
|
@@ -164,18 +163,20 @@ async function toggleTransition(el, show, { animation, duration, velocity, trans
|
|
|
164
163
|
_toggle(el, true);
|
|
165
164
|
}
|
|
166
165
|
|
|
167
|
-
const prevProps =
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
166
|
+
const prevProps = Object.fromEntries(
|
|
167
|
+
[
|
|
168
|
+
'padding',
|
|
169
|
+
'border',
|
|
170
|
+
'width',
|
|
171
|
+
'height',
|
|
172
|
+
'minWidth',
|
|
173
|
+
'minHeight',
|
|
174
|
+
'overflowY',
|
|
175
|
+
'overflowX',
|
|
176
|
+
marginProp,
|
|
177
|
+
marginStartProp,
|
|
178
|
+
].map((key) => [key, el.style[key]]),
|
|
179
|
+
);
|
|
179
180
|
|
|
180
181
|
const dim = dimensions(el);
|
|
181
182
|
const currentMargin = toFloat(css(el, marginProp));
|
package/src/js/util/attr.js
CHANGED
|
@@ -10,13 +10,13 @@ export function attr(element, name, value) {
|
|
|
10
10
|
|
|
11
11
|
if (isUndefined(value)) {
|
|
12
12
|
return toNode(element)?.getAttribute(name);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
} else {
|
|
14
|
+
for (const el of toNodes(element)) {
|
|
15
|
+
if (value === null) {
|
|
16
|
+
removeAttr(el, name);
|
|
17
|
+
} else {
|
|
18
|
+
el.setAttribute(name, value);
|
|
19
|
+
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
package/src/js/util/class.js
CHANGED
package/src/js/util/dom.js
CHANGED
|
@@ -68,9 +68,10 @@ export function wrapInner(element, structure) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export function unwrap(element) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
toNodes(element)
|
|
72
|
+
.map(parent)
|
|
73
|
+
.filter((value, index, self) => self.indexOf(value) === index)
|
|
74
|
+
.forEach((parent) => parent.replaceWith(...parent.childNodes));
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
|
package/src/js/util/lang.js
CHANGED
|
@@ -177,7 +177,7 @@ export function uniqueBy(array, prop) {
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
export function pick(obj, props) {
|
|
180
|
-
return
|
|
180
|
+
return props.reduce((res, prop) => ({ ...res, [prop]: obj[prop] }), {});
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
export function clamp(number, min = 0, max = 1) {
|
package/src/js/util/player.js
CHANGED
|
@@ -42,13 +42,13 @@ function isIFrame(el) {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
function isYoutube(el) {
|
|
45
|
-
return
|
|
46
|
-
|
|
45
|
+
return !!el.src.match(
|
|
46
|
+
/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/,
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
function isVimeo(el) {
|
|
51
|
-
return /vimeo\.com\/video
|
|
51
|
+
return !!el.src.match(/vimeo\.com\/video\/.*/);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
async function call(el, cmd) {
|
|
@@ -60,7 +60,7 @@ function post(el, cmd) {
|
|
|
60
60
|
el.contentWindow.postMessage(JSON.stringify({ event: 'command', ...cmd }), '*');
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
const stateKey =
|
|
63
|
+
const stateKey = '_ukPlayer';
|
|
64
64
|
let counter = 0;
|
|
65
65
|
function enableApi(el) {
|
|
66
66
|
if (el[stateKey]) {
|
package/src/js/util/style.js
CHANGED
|
@@ -37,18 +37,23 @@ export function css(element, property, value, priority) {
|
|
|
37
37
|
|
|
38
38
|
if (isUndefined(value)) {
|
|
39
39
|
return getComputedStyle(element).getPropertyValue(property);
|
|
40
|
+
} else {
|
|
41
|
+
element.style.setProperty(
|
|
42
|
+
property,
|
|
43
|
+
isNumeric(value) && !cssNumber[property] && !isCustomProperty(property)
|
|
44
|
+
? `${value}px`
|
|
45
|
+
: value || isNumber(value)
|
|
46
|
+
? value
|
|
47
|
+
: '',
|
|
48
|
+
priority,
|
|
49
|
+
);
|
|
40
50
|
}
|
|
41
|
-
element.style.setProperty(
|
|
42
|
-
property,
|
|
43
|
-
isNumeric(value) && !cssNumber[property] && !isCustomProperty(property)
|
|
44
|
-
? `${value}px`
|
|
45
|
-
: value || isNumber(value)
|
|
46
|
-
? value
|
|
47
|
-
: '',
|
|
48
|
-
priority,
|
|
49
|
-
);
|
|
50
51
|
} else if (isArray(property)) {
|
|
51
|
-
|
|
52
|
+
const props = {};
|
|
53
|
+
for (const prop of property) {
|
|
54
|
+
props[prop] = css(element, prop);
|
|
55
|
+
}
|
|
56
|
+
return props;
|
|
52
57
|
} else if (isObject(property)) {
|
|
53
58
|
for (const prop in property) {
|
|
54
59
|
css(element, prop, property[prop], value);
|
package/src/js/util/viewport.js
CHANGED
|
@@ -18,18 +18,20 @@ export function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
|
18
18
|
return false;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
21
|
+
return intersectRect(
|
|
22
|
+
...overflowParents(element)
|
|
23
|
+
.map((parent) => {
|
|
24
|
+
const { top, left, bottom, right } = offsetViewport(parent);
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
top: top - offsetTop,
|
|
28
|
+
left: left - offsetLeft,
|
|
29
|
+
bottom: bottom + offsetTop,
|
|
30
|
+
right: right + offsetLeft,
|
|
31
|
+
};
|
|
32
|
+
})
|
|
33
|
+
.concat(offset(element)),
|
|
34
|
+
);
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
export function scrollIntoView(element, { offset: offsetBy = 0 } = {}) {
|
|
@@ -143,16 +145,17 @@ export function scrollParents(element, scrollable = false, props = []) {
|
|
|
143
145
|
ancestors = ancestors.slice(fixedIndex);
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
return [
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
148
|
+
return [scrollEl]
|
|
149
|
+
.concat(
|
|
150
|
+
ancestors.filter(
|
|
151
|
+
(parent) =>
|
|
152
|
+
css(parent, 'overflow')
|
|
153
|
+
.split(' ')
|
|
154
|
+
.some((prop) => includes(['auto', 'scroll', ...props], prop)) &&
|
|
155
|
+
(!scrollable || parent.scrollHeight > offsetViewport(parent).height),
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
.reverse();
|
|
156
159
|
}
|
|
157
160
|
|
|
158
161
|
export function scrollParent(...args) {
|