uikit 3.11.2-dev.44c622843 → 3.11.2-dev.536e1a374
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 +40 -19
- package/dist/css/uikit-core-rtl.css +97 -190
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +97 -190
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +99 -196
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +99 -196
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +24 -51
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +6 -8
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +30 -69
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +31 -71
- 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 +117 -80
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +117 -80
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +87 -58
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +117 -80
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +43 -29
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +5 -7
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +3 -3
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +2 -1
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +600 -508
- 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 +857 -764
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/component.js +2 -11
- package/src/js/api/hooks.js +3 -3
- package/src/js/api/state.js +173 -140
- package/src/js/components/countdown.js +24 -51
- package/src/js/components/filter.js +2 -3
- package/src/js/components/internal/lightbox-animations.js +4 -3
- package/src/js/components/internal/slider-preload.js +9 -0
- package/src/js/components/internal/slideshow-animations.js +4 -3
- package/src/js/components/lightbox-panel.js +34 -58
- package/src/js/components/lightbox.js +1 -2
- package/src/js/components/slider.js +60 -43
- package/src/js/components/slideshow.js +8 -1
- package/src/js/components/sortable.js +1 -1
- package/src/js/components/upload.js +2 -1
- package/src/js/core/accordion.js +6 -1
- package/src/js/core/alert.js +1 -2
- package/src/js/core/core.js +2 -75
- package/src/js/core/cover.js +5 -1
- package/src/js/core/drop.js +3 -1
- package/src/js/core/form-custom.js +2 -2
- package/src/js/core/height-viewport.js +3 -0
- package/src/js/core/icon.js +13 -6
- package/src/js/core/img.js +131 -122
- package/src/js/core/modal.js +1 -2
- package/src/js/core/navbar.js +3 -3
- package/src/js/core/offcanvas.js +2 -1
- package/src/js/core/sticky.js +51 -57
- package/src/js/core/svg.js +10 -6
- package/src/js/core/switcher.js +11 -3
- package/src/js/core/toggle.js +5 -2
- package/src/js/core/video.js +13 -1
- package/src/js/mixin/internal/animate-slide.js +9 -12
- package/src/js/mixin/lazyload.js +20 -0
- package/src/js/mixin/parallax.js +118 -81
- package/src/js/mixin/slider.js +8 -22
- package/src/js/mixin/slideshow.js +2 -6
- package/src/js/mixin/swipe.js +72 -0
- package/src/js/mixin/togglable.js +2 -3
- package/src/js/util/ajax.js +15 -14
- package/src/js/util/animation.js +7 -12
- package/src/js/util/dimensions.js +4 -4
- package/src/js/util/dom.js +22 -33
- package/src/js/util/filter.js +1 -2
- package/src/js/util/index.js +1 -0
- package/src/js/util/lang.js +7 -6
- package/src/js/util/observer.js +36 -0
- package/src/js/util/options.js +2 -11
- package/src/js/util/player.js +5 -4
- package/src/js/util/selector.js +12 -18
- package/src/js/util/style.js +4 -4
- package/src/less/components/base.less +10 -33
- 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/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 +6 -3
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +0 -1
- package/src/scss/components/height.scss +3 -0
- 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/progress.scss +14 -36
- 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 +6 -3
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +3 -3
- package/src/scss/variables.scss +3 -3
- 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/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 +56 -71
- 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/util/promise.js +0 -0
- package/tests/images/animated.gif +0 -0
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
$,
|
|
8
8
|
addClass,
|
|
9
9
|
append,
|
|
10
|
-
assign,
|
|
11
10
|
attr,
|
|
12
11
|
fragment,
|
|
13
12
|
getImage,
|
|
@@ -219,29 +218,21 @@ export default {
|
|
|
219
218
|
if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
|
|
220
219
|
try {
|
|
221
220
|
const { width, height } = await getImage(src, attrs.srcset, attrs.size);
|
|
222
|
-
this.setItem(
|
|
223
|
-
item,
|
|
224
|
-
createEl('img', assign({ src, width, height, alt }, attrs))
|
|
225
|
-
);
|
|
221
|
+
this.setItem(item, createEl('img', { src, width, height, alt, ...attrs }));
|
|
226
222
|
} catch (e) {
|
|
227
223
|
this.setError(item);
|
|
228
224
|
}
|
|
229
225
|
|
|
230
226
|
// Video
|
|
231
227
|
} else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
|
|
232
|
-
const video = createEl(
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
'uk-video': `${this.videoAutoplay}`,
|
|
241
|
-
},
|
|
242
|
-
attrs
|
|
243
|
-
)
|
|
244
|
-
);
|
|
228
|
+
const video = createEl('video', {
|
|
229
|
+
src,
|
|
230
|
+
poster,
|
|
231
|
+
controls: '',
|
|
232
|
+
playsinline: '',
|
|
233
|
+
'uk-video': `${this.videoAutoplay}`,
|
|
234
|
+
...attrs,
|
|
235
|
+
});
|
|
245
236
|
|
|
246
237
|
on(video, 'loadedmetadata', () => {
|
|
247
238
|
attr(video, { width: video.videoWidth, height: video.videoHeight });
|
|
@@ -253,18 +244,13 @@ export default {
|
|
|
253
244
|
} else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
|
|
254
245
|
this.setItem(
|
|
255
246
|
item,
|
|
256
|
-
createEl(
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
class: 'uk-lightbox-iframe',
|
|
264
|
-
},
|
|
265
|
-
attrs
|
|
266
|
-
)
|
|
267
|
-
)
|
|
247
|
+
createEl('iframe', {
|
|
248
|
+
src,
|
|
249
|
+
frameborder: '0',
|
|
250
|
+
allowfullscreen: '',
|
|
251
|
+
class: 'uk-lightbox-iframe',
|
|
252
|
+
...attrs,
|
|
253
|
+
})
|
|
268
254
|
);
|
|
269
255
|
|
|
270
256
|
// YouTube
|
|
@@ -275,20 +261,15 @@ export default {
|
|
|
275
261
|
) {
|
|
276
262
|
this.setItem(
|
|
277
263
|
item,
|
|
278
|
-
createEl(
|
|
279
|
-
'
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
},
|
|
288
|
-
iframeAttrs,
|
|
289
|
-
attrs
|
|
290
|
-
)
|
|
291
|
-
)
|
|
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
|
+
})
|
|
292
273
|
);
|
|
293
274
|
|
|
294
275
|
// Vimeo
|
|
@@ -307,20 +288,15 @@ export default {
|
|
|
307
288
|
|
|
308
289
|
this.setItem(
|
|
309
290
|
item,
|
|
310
|
-
createEl(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
iframeAttrs,
|
|
321
|
-
attrs
|
|
322
|
-
)
|
|
323
|
-
)
|
|
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
|
+
})
|
|
324
300
|
);
|
|
325
301
|
} catch (e) {
|
|
326
302
|
this.setError(item);
|
|
@@ -48,8 +48,7 @@ export default {
|
|
|
48
48
|
index = findIndex(items, ({ source: src }) => source === src);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
this.panel =
|
|
52
|
-
this.panel || this.$create('lightboxPanel', assign({}, this.$props, { items }));
|
|
51
|
+
this.panel = this.panel || this.$create('lightboxPanel', { ...this.$props, items });
|
|
53
52
|
|
|
54
53
|
on(this.panel.$el, 'hidden', () => (this.panel = false));
|
|
55
54
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Slider, { speedUp } from '../mixin/slider';
|
|
3
3
|
import SliderReactive from '../mixin/slider-reactive';
|
|
4
|
+
import SliderPreload from './internal/slider-preload';
|
|
4
5
|
import Transitioner, { getMax, getWidth } from './internal/slider-transitioner';
|
|
5
6
|
import {
|
|
6
7
|
$,
|
|
@@ -11,16 +12,14 @@ import {
|
|
|
11
12
|
dimensions,
|
|
12
13
|
findIndex,
|
|
13
14
|
includes,
|
|
14
|
-
isEmpty,
|
|
15
15
|
last,
|
|
16
|
-
sortBy,
|
|
17
16
|
toFloat,
|
|
18
17
|
toggleClass,
|
|
19
18
|
toNumber,
|
|
20
19
|
} from 'uikit-util';
|
|
21
20
|
|
|
22
21
|
export default {
|
|
23
|
-
mixins: [Class, Slider, SliderReactive],
|
|
22
|
+
mixins: [Class, Slider, SliderReactive, SliderPreload],
|
|
24
23
|
|
|
25
24
|
props: {
|
|
26
25
|
center: Boolean,
|
|
@@ -72,48 +71,39 @@ export default {
|
|
|
72
71
|
return ~index ? index : this.length - 1;
|
|
73
72
|
},
|
|
74
73
|
|
|
75
|
-
sets({ sets }) {
|
|
76
|
-
if (!
|
|
74
|
+
sets({ sets: enabled }) {
|
|
75
|
+
if (!enabled) {
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
const width = dimensions(this.list).width / (this.center ? 2 : 1);
|
|
81
|
-
|
|
82
79
|
let left = 0;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const slideWidth = dimensions(slide).width;
|
|
88
|
-
const slideRight = slideLeft + slideWidth;
|
|
80
|
+
const sets = [];
|
|
81
|
+
const width = dimensions(this.list).width;
|
|
82
|
+
for (let i in this.slides) {
|
|
83
|
+
const slideWidth = dimensions(this.slides[i]).width;
|
|
89
84
|
|
|
90
|
-
if (
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
85
|
+
if (left + slideWidth > width) {
|
|
86
|
+
left = 0;
|
|
87
|
+
}
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
leftCenter -= slideWidth;
|
|
103
|
-
} else {
|
|
104
|
-
leftCenter = width;
|
|
105
|
-
sets.push(i);
|
|
106
|
-
left = slideLeft + width + (this.center ? slideWidth / 2 : 0);
|
|
107
|
-
}
|
|
89
|
+
if (this.center) {
|
|
90
|
+
if (
|
|
91
|
+
left < width / 2 &&
|
|
92
|
+
left + slideWidth + dimensions(this.slides[+i + 1]).width / 2 > width / 2
|
|
93
|
+
) {
|
|
94
|
+
sets.push(+i);
|
|
95
|
+
left = width / 2 - slideWidth / 2;
|
|
108
96
|
}
|
|
97
|
+
} else if (left === 0) {
|
|
98
|
+
sets.push(Math.min(+i, this.maxIndex));
|
|
109
99
|
}
|
|
110
100
|
|
|
111
|
-
|
|
101
|
+
left += slideWidth;
|
|
102
|
+
}
|
|
112
103
|
|
|
104
|
+
if (sets.length) {
|
|
113
105
|
return sets;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return !isEmpty(sets) && sets;
|
|
106
|
+
}
|
|
117
107
|
},
|
|
118
108
|
|
|
119
109
|
transitionOptions() {
|
|
@@ -145,15 +135,7 @@ export default {
|
|
|
145
135
|
this._translate(1);
|
|
146
136
|
}
|
|
147
137
|
|
|
148
|
-
|
|
149
|
-
const activeClasses = [
|
|
150
|
-
this.clsActive,
|
|
151
|
-
((!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated) ||
|
|
152
|
-
'',
|
|
153
|
-
];
|
|
154
|
-
for (const slide of this.slides) {
|
|
155
|
-
toggleClass(slide, activeClasses, includes(actives, slide));
|
|
156
|
-
}
|
|
138
|
+
this.updateActiveClasses();
|
|
157
139
|
},
|
|
158
140
|
|
|
159
141
|
events: ['resize'],
|
|
@@ -202,6 +184,10 @@ export default {
|
|
|
202
184
|
addClass(this._getTransitioner().getItemIn(), this.clsActive);
|
|
203
185
|
}
|
|
204
186
|
},
|
|
187
|
+
|
|
188
|
+
itemshown() {
|
|
189
|
+
this.updateActiveClasses();
|
|
190
|
+
},
|
|
205
191
|
},
|
|
206
192
|
|
|
207
193
|
methods: {
|
|
@@ -238,6 +224,18 @@ export default {
|
|
|
238
224
|
}
|
|
239
225
|
},
|
|
240
226
|
|
|
227
|
+
updateActiveClasses() {
|
|
228
|
+
const actives = this._getTransitioner(this.index).getActives();
|
|
229
|
+
const activeClasses = [
|
|
230
|
+
this.clsActive,
|
|
231
|
+
((!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated) ||
|
|
232
|
+
'',
|
|
233
|
+
];
|
|
234
|
+
for (const slide of this.slides) {
|
|
235
|
+
toggleClass(slide, activeClasses, includes(actives, slide));
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
|
|
241
239
|
getValidIndex(index = this.index, prevIndex = this.prevIndex) {
|
|
242
240
|
index = this.getIndex(index, prevIndex);
|
|
243
241
|
|
|
@@ -258,6 +256,25 @@ export default {
|
|
|
258
256
|
|
|
259
257
|
return index;
|
|
260
258
|
},
|
|
259
|
+
|
|
260
|
+
getAdjacentSlides() {
|
|
261
|
+
const { width } = dimensions(this.list);
|
|
262
|
+
const left = -width;
|
|
263
|
+
const right = width * 2;
|
|
264
|
+
const slideWidth = dimensions(this.slides[this.index]).width;
|
|
265
|
+
const slideLeft = this.center ? width / 2 - slideWidth / 2 : 0;
|
|
266
|
+
const slides = new Set();
|
|
267
|
+
for (const i of [-1, 1]) {
|
|
268
|
+
let currentLeft = slideLeft + (i > 0 ? slideWidth : 0);
|
|
269
|
+
let j = 0;
|
|
270
|
+
do {
|
|
271
|
+
const slide = this.slides[this.getIndex(this.index + i + j++ * i)];
|
|
272
|
+
currentLeft += dimensions(slide).width * i;
|
|
273
|
+
slides.add(slide);
|
|
274
|
+
} while (this.slides.length > j && currentLeft > left && currentLeft < right);
|
|
275
|
+
}
|
|
276
|
+
return Array.from(slides);
|
|
277
|
+
},
|
|
261
278
|
},
|
|
262
279
|
};
|
|
263
280
|
|
|
@@ -2,10 +2,11 @@ import Class from '../mixin/class';
|
|
|
2
2
|
import Slideshow from '../mixin/slideshow';
|
|
3
3
|
import Animations from './internal/slideshow-animations';
|
|
4
4
|
import SliderReactive from '../mixin/slider-reactive';
|
|
5
|
+
import SliderPreload from './internal/slider-preload';
|
|
5
6
|
import { boxModelAdjust, css } from 'uikit-util';
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
|
-
mixins: [Class, Slideshow, SliderReactive],
|
|
9
|
+
mixins: [Class, Slideshow, SliderReactive, SliderPreload],
|
|
9
10
|
|
|
10
11
|
props: {
|
|
11
12
|
ratio: String,
|
|
@@ -50,4 +51,10 @@ export default {
|
|
|
50
51
|
|
|
51
52
|
events: ['resize'],
|
|
52
53
|
},
|
|
54
|
+
|
|
55
|
+
methods: {
|
|
56
|
+
getAdjacentSlides() {
|
|
57
|
+
return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
|
|
58
|
+
},
|
|
59
|
+
},
|
|
53
60
|
};
|
|
@@ -205,7 +205,7 @@ export default {
|
|
|
205
205
|
|
|
206
206
|
this.touched = new Set([this]);
|
|
207
207
|
this.placeholder = placeholder;
|
|
208
|
-
this.origin =
|
|
208
|
+
this.origin = { target, index: index(placeholder), ...this.pos };
|
|
209
209
|
|
|
210
210
|
on(document, pointerMove, this.move);
|
|
211
211
|
on(document, pointerUp, this.end);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addClass, ajax, matches, noop, on, removeClass, trigger } from 'uikit-util';
|
|
1
|
+
import { addClass, ajax, matches, noop, on, removeClass, toArray, trigger } from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
props: {
|
|
@@ -178,6 +178,7 @@ function match(pattern, path) {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
function chunk(files, size) {
|
|
181
|
+
files = toArray(files);
|
|
181
182
|
const chunks = [];
|
|
182
183
|
for (let i = 0; i < files.length; i += size) {
|
|
183
184
|
chunks.push(files.slice(i, i + size));
|
package/src/js/core/accordion.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
|
+
import Lazyload from '../mixin/lazyload';
|
|
2
3
|
import { default as Togglable, toggleHeight } from '../mixin/togglable';
|
|
3
4
|
import {
|
|
4
5
|
$,
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
} from 'uikit-util';
|
|
18
19
|
|
|
19
20
|
export default {
|
|
20
|
-
mixins: [Class, Togglable],
|
|
21
|
+
mixins: [Class, Lazyload, Togglable],
|
|
21
22
|
|
|
22
23
|
props: {
|
|
23
24
|
targets: String,
|
|
@@ -73,6 +74,10 @@ export default {
|
|
|
73
74
|
},
|
|
74
75
|
},
|
|
75
76
|
|
|
77
|
+
connected() {
|
|
78
|
+
this.lazyload();
|
|
79
|
+
},
|
|
80
|
+
|
|
76
81
|
events: [
|
|
77
82
|
{
|
|
78
83
|
name: 'click',
|
package/src/js/core/alert.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Togglable from '../mixin/togglable';
|
|
3
|
-
import { assign } from 'uikit-util';
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
mixins: [Class, Togglable],
|
|
@@ -15,7 +14,7 @@ export default {
|
|
|
15
14
|
animation: [true],
|
|
16
15
|
selClose: '.uk-alert-close',
|
|
17
16
|
duration: 150,
|
|
18
|
-
hideProps:
|
|
17
|
+
hideProps: { opacity: 0, ...Togglable.data.hideProps },
|
|
19
18
|
},
|
|
20
19
|
|
|
21
20
|
events: [
|
package/src/js/core/core.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
css,
|
|
3
|
-
fastdom,
|
|
4
|
-
getEventPos,
|
|
5
|
-
inBrowser,
|
|
6
|
-
isTouch,
|
|
7
|
-
on,
|
|
8
|
-
once,
|
|
9
|
-
parent,
|
|
10
|
-
pointerCancel,
|
|
11
|
-
pointerDown,
|
|
12
|
-
pointerUp,
|
|
13
|
-
toMs,
|
|
14
|
-
trigger,
|
|
15
|
-
} from 'uikit-util';
|
|
1
|
+
import { css, fastdom, inBrowser, observeResize, on, toMs } from 'uikit-util';
|
|
16
2
|
|
|
17
3
|
export default function (UIkit) {
|
|
18
4
|
if (!inBrowser) {
|
|
@@ -32,27 +18,7 @@ export default function (UIkit) {
|
|
|
32
18
|
|
|
33
19
|
on(window, 'load resize', handleResize);
|
|
34
20
|
on(document, 'loadedmetadata load', handleResize, true);
|
|
35
|
-
|
|
36
|
-
if ('ResizeObserver' in window) {
|
|
37
|
-
new ResizeObserver(handleResize).observe(document.documentElement);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// throttle `scroll` event (Safari triggers multiple `scroll` events per frame)
|
|
41
|
-
let pending;
|
|
42
|
-
on(
|
|
43
|
-
window,
|
|
44
|
-
'scroll',
|
|
45
|
-
(e) => {
|
|
46
|
-
if (pending) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
pending = true;
|
|
50
|
-
fastdom.read(() => (pending = false));
|
|
51
|
-
|
|
52
|
-
UIkit.update(null, e.type);
|
|
53
|
-
},
|
|
54
|
-
{ passive: true, capture: true }
|
|
55
|
-
);
|
|
21
|
+
observeResize(document.documentElement, handleResize);
|
|
56
22
|
|
|
57
23
|
let started = 0;
|
|
58
24
|
on(
|
|
@@ -71,43 +37,4 @@ export default function (UIkit) {
|
|
|
71
37
|
},
|
|
72
38
|
true
|
|
73
39
|
);
|
|
74
|
-
|
|
75
|
-
on(
|
|
76
|
-
document,
|
|
77
|
-
pointerDown,
|
|
78
|
-
(e) => {
|
|
79
|
-
if (!isTouch(e)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Handle Swipe Gesture
|
|
84
|
-
const pos = getEventPos(e);
|
|
85
|
-
const target = 'tagName' in e.target ? e.target : parent(e.target);
|
|
86
|
-
once(document, `${pointerUp} ${pointerCancel} scroll`, (e) => {
|
|
87
|
-
const { x, y } = getEventPos(e);
|
|
88
|
-
|
|
89
|
-
// swipe
|
|
90
|
-
if (
|
|
91
|
-
(e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100) ||
|
|
92
|
-
(y && Math.abs(pos.y - y) > 100)
|
|
93
|
-
) {
|
|
94
|
-
setTimeout(() => {
|
|
95
|
-
trigger(target, 'swipe');
|
|
96
|
-
trigger(target, `swipe${swipeDirection(pos.x, pos.y, x, y)}`);
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
{ passive: true }
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function swipeDirection(x1, y1, x2, y2) {
|
|
106
|
-
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
|
|
107
|
-
? x1 - x2 > 0
|
|
108
|
-
? 'Left'
|
|
109
|
-
: 'Right'
|
|
110
|
-
: y1 - y2 > 0
|
|
111
|
-
? 'Up'
|
|
112
|
-
: 'Down';
|
|
113
40
|
}
|
package/src/js/core/cover.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Video from './video';
|
|
2
|
-
import { css, Dimensions, parent } from 'uikit-util';
|
|
2
|
+
import { css, Dimensions, observeResize, parent } from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
mixins: [Video],
|
|
@@ -13,6 +13,10 @@ export default {
|
|
|
13
13
|
automute: true,
|
|
14
14
|
},
|
|
15
15
|
|
|
16
|
+
connected() {
|
|
17
|
+
this.registerObserver(observeResize(this.$el, () => this.$emit('resize')));
|
|
18
|
+
},
|
|
19
|
+
|
|
16
20
|
update: {
|
|
17
21
|
read() {
|
|
18
22
|
const el = this.$el;
|
package/src/js/core/drop.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Container from '../mixin/container';
|
|
2
|
+
import Lazyload from '../mixin/lazyload';
|
|
2
3
|
import Position from '../mixin/position';
|
|
3
4
|
import Togglable from '../mixin/togglable';
|
|
4
5
|
import {
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
export let active;
|
|
31
32
|
|
|
32
33
|
export default {
|
|
33
|
-
mixins: [Container, Position, Togglable],
|
|
34
|
+
mixins: [Container, Lazyload, Position, Togglable],
|
|
34
35
|
|
|
35
36
|
args: 'pos',
|
|
36
37
|
|
|
@@ -84,6 +85,7 @@ export default {
|
|
|
84
85
|
mode: this.mode,
|
|
85
86
|
}).$el;
|
|
86
87
|
attr(this.target, 'aria-haspopup', true);
|
|
88
|
+
this.lazyload(this.target);
|
|
87
89
|
}
|
|
88
90
|
},
|
|
89
91
|
|
package/src/js/core/icon.js
CHANGED
|
@@ -68,14 +68,14 @@ const Icon = {
|
|
|
68
68
|
},
|
|
69
69
|
|
|
70
70
|
methods: {
|
|
71
|
-
getSvg() {
|
|
71
|
+
async getSvg() {
|
|
72
72
|
const icon = getIcon(this.icon);
|
|
73
73
|
|
|
74
74
|
if (!icon) {
|
|
75
|
-
|
|
75
|
+
throw 'Icon not found.';
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
return
|
|
78
|
+
return icon;
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
};
|
|
@@ -137,9 +137,16 @@ export const Close = {
|
|
|
137
137
|
export const Spinner = {
|
|
138
138
|
extends: IconComponent,
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
methods: {
|
|
141
|
+
async getSvg() {
|
|
142
|
+
const icon = await Icon.methods.getSvg.call(this);
|
|
143
|
+
|
|
144
|
+
if (this.ratio !== 1) {
|
|
145
|
+
css($('circle', icon), 'strokeWidth', 1 / this.ratio);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return icon;
|
|
149
|
+
},
|
|
143
150
|
},
|
|
144
151
|
};
|
|
145
152
|
|