uikit 3.12.1 → 3.12.3-dev.4c7275bdd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -2
- package/build/scss.js +9 -17
- package/dist/css/uikit-core-rtl.css +15 -81
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +15 -81
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +15 -81
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +15 -81
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +2 -2
- 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 +13 -2
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +15 -4
- 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 +65 -8
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +30 -13
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +14 -3
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +30 -13
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +13 -2
- 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 +12 -20
- 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 +281 -224
- 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 +295 -236
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/api/hooks.js +3 -3
- package/src/js/api/state.js +14 -39
- package/src/js/components/countdown.js +1 -1
- package/src/js/components/lightbox.js +1 -1
- package/src/js/components/parallax.js +3 -1
- package/src/js/components/slider-parallax.js +6 -4
- package/src/js/components/slider.js +1 -1
- package/src/js/core/core.js +2 -17
- package/src/js/core/cover.js +3 -6
- package/src/js/core/drop.js +5 -10
- package/src/js/core/form-custom.js +6 -7
- package/src/js/core/gif.js +5 -3
- package/src/js/core/grid.js +2 -1
- package/src/js/core/height-match.js +21 -1
- package/src/js/core/height-viewport.js +10 -7
- package/src/js/core/img.js +1 -2
- package/src/js/core/leader.js +7 -13
- package/src/js/core/margin.js +18 -1
- package/src/js/core/overflow-auto.js +8 -7
- package/src/js/core/scroll.js +6 -2
- package/src/js/core/scrollspy-nav.js +19 -16
- package/src/js/core/scrollspy.js +12 -15
- package/src/js/core/sticky.js +8 -3
- package/src/js/core/svg.js +16 -14
- package/src/js/core/toggle.js +16 -13
- package/src/js/core/video.js +2 -8
- package/src/js/mixin/media.js +29 -5
- package/src/js/mixin/position.js +10 -18
- package/src/js/mixin/resize.js +13 -0
- package/src/js/mixin/scroll.js +32 -0
- package/src/js/mixin/slider.js +2 -1
- package/src/js/util/class.js +1 -6
- package/src/js/util/mouse.js +1 -1
- package/src/js/util/observer.js +57 -20
- package/src/js/util/style.js +1 -1
- package/src/less/components/base.less +0 -19
- package/src/less/components/form.less +1 -9
- package/src/less/components/icon.less +6 -0
- package/src/less/components/list.less +1 -0
- package/src/less/components/search.less +0 -3
- package/src/less/components/slider.less +3 -0
- package/src/less/components/slideshow.less +3 -0
- package/src/less/components/utility.less +0 -9
- package/src/scss/components/base.scss +0 -19
- package/src/scss/components/form.scss +1 -7
- package/src/scss/components/icon.scss +6 -0
- package/src/scss/components/list.scss +1 -0
- package/src/scss/components/search.scss +0 -1
- package/src/scss/components/slider.scss +3 -0
- package/src/scss/components/slideshow.scss +3 -0
- package/src/scss/components/utility.scss +0 -9
- package/src/scss/mixins-theme.scss +0 -4
- package/src/scss/mixins.scss +0 -4
- package/tests/js/index.js +1 -1
package/src/js/core/scrollspy.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Scroll from '../mixin/scroll';
|
|
1
2
|
import {
|
|
2
3
|
$$,
|
|
3
4
|
css,
|
|
@@ -13,6 +14,8 @@ import {
|
|
|
13
14
|
|
|
14
15
|
const stateKey = '_ukScrollspy';
|
|
15
16
|
export default {
|
|
17
|
+
mixins: [Scroll],
|
|
18
|
+
|
|
16
19
|
args: 'cls',
|
|
17
20
|
|
|
18
21
|
props: {
|
|
@@ -54,23 +57,14 @@ export default {
|
|
|
54
57
|
|
|
55
58
|
disconnected() {
|
|
56
59
|
for (const el of this.elements) {
|
|
57
|
-
removeClass(el, this.inViewClass, el[stateKey]
|
|
60
|
+
removeClass(el, this.inViewClass, el[stateKey]?.cls || '');
|
|
58
61
|
delete el[stateKey];
|
|
59
62
|
}
|
|
60
63
|
},
|
|
61
64
|
|
|
62
65
|
update: [
|
|
63
66
|
{
|
|
64
|
-
read(
|
|
65
|
-
// Let child components be applied at least once first
|
|
66
|
-
if (!data.update) {
|
|
67
|
-
Promise.resolve().then(() => {
|
|
68
|
-
this.$emit();
|
|
69
|
-
data.update = true;
|
|
70
|
-
});
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
|
|
67
|
+
read() {
|
|
74
68
|
for (const el of this.elements) {
|
|
75
69
|
if (!el[stateKey]) {
|
|
76
70
|
el[stateKey] = { cls: getData(el, 'uk-scrollspy-class') || this.cls };
|
|
@@ -110,7 +104,7 @@ export default {
|
|
|
110
104
|
toggle(el, inview) {
|
|
111
105
|
const state = el[stateKey];
|
|
112
106
|
|
|
113
|
-
state.off
|
|
107
|
+
state.off?.();
|
|
114
108
|
|
|
115
109
|
css(el, 'visibility', !inview && this.hidden ? 'hidden' : '');
|
|
116
110
|
|
|
@@ -118,9 +112,12 @@ export default {
|
|
|
118
112
|
toggleClass(el, state.cls);
|
|
119
113
|
|
|
120
114
|
if (/\buk-animation-/.test(state.cls)) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
115
|
+
const removeAnimationClasses = () => removeClasses(el, 'uk-animation-[\\w-]+');
|
|
116
|
+
if (inview) {
|
|
117
|
+
state.off = once(el, 'animationcancel animationend', removeAnimationClasses);
|
|
118
|
+
} else {
|
|
119
|
+
removeAnimationClasses();
|
|
120
|
+
}
|
|
124
121
|
}
|
|
125
122
|
|
|
126
123
|
trigger(el, inview ? 'inview' : 'outview');
|
package/src/js/core/sticky.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Media from '../mixin/media';
|
|
3
|
+
import Resize from '../mixin/resize';
|
|
4
|
+
import Scroll from '../mixin/scroll';
|
|
3
5
|
import {
|
|
4
6
|
$,
|
|
5
7
|
addClass,
|
|
@@ -32,7 +34,7 @@ import {
|
|
|
32
34
|
} from 'uikit-util';
|
|
33
35
|
|
|
34
36
|
export default {
|
|
35
|
-
mixins: [Class, Media],
|
|
37
|
+
mixins: [Class, Media, Resize, Scroll],
|
|
36
38
|
|
|
37
39
|
props: {
|
|
38
40
|
position: String,
|
|
@@ -75,6 +77,10 @@ export default {
|
|
|
75
77
|
return query(widthElement, $el) || this.placeholder;
|
|
76
78
|
},
|
|
77
79
|
|
|
80
|
+
resizeTargets() {
|
|
81
|
+
return document.documentElement;
|
|
82
|
+
},
|
|
83
|
+
|
|
78
84
|
isActive: {
|
|
79
85
|
get() {
|
|
80
86
|
return hasClass(this.selTarget, this.clsActive);
|
|
@@ -186,7 +192,6 @@ export default {
|
|
|
186
192
|
|
|
187
193
|
const overflow = Math.max(0, height + offset - windowHeight);
|
|
188
194
|
const topOffset = getOffset(referenceElement).top;
|
|
189
|
-
const offsetParentTop = getOffset(referenceElement.offsetParent).top;
|
|
190
195
|
|
|
191
196
|
const top = parseProp(this.top, this.$el, topOffset);
|
|
192
197
|
const bottom = parseProp(this.bottom, this.$el, topOffset + height, true);
|
|
@@ -202,7 +207,6 @@ export default {
|
|
|
202
207
|
offset,
|
|
203
208
|
overflow,
|
|
204
209
|
topOffset,
|
|
205
|
-
offsetParentTop,
|
|
206
210
|
height,
|
|
207
211
|
margin,
|
|
208
212
|
width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el)
|
|
@@ -244,6 +248,7 @@ export default {
|
|
|
244
248
|
prevDir,
|
|
245
249
|
scroll,
|
|
246
250
|
prevScroll,
|
|
251
|
+
offsetParentTop: getOffset(this.$el.offsetParent).top,
|
|
247
252
|
overflowScroll: clamp(
|
|
248
253
|
overflowScroll + clamp(scroll, start, end) - clamp(prevScroll, start, end),
|
|
249
254
|
0,
|
package/src/js/core/svg.js
CHANGED
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
attr,
|
|
7
7
|
includes,
|
|
8
8
|
isTag,
|
|
9
|
-
isVisible,
|
|
10
9
|
isVoidElement,
|
|
11
10
|
memoize,
|
|
12
11
|
noop,
|
|
12
|
+
observeIntersection,
|
|
13
13
|
once,
|
|
14
14
|
remove,
|
|
15
15
|
removeAttr,
|
|
@@ -59,10 +59,24 @@ export default {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
this.applyAttributes(svg, el);
|
|
62
|
-
|
|
62
|
+
|
|
63
63
|
return (this.svgEl = svg);
|
|
64
64
|
}
|
|
65
65
|
}, noop);
|
|
66
|
+
|
|
67
|
+
if (this.strokeAnimation) {
|
|
68
|
+
this.svg.then((el) => {
|
|
69
|
+
if (this._connected) {
|
|
70
|
+
applyAnimation(el);
|
|
71
|
+
this.registerObserver(
|
|
72
|
+
observeIntersection(el, (records, observer) => {
|
|
73
|
+
applyAnimation(el);
|
|
74
|
+
observer.disconnect();
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
66
80
|
},
|
|
67
81
|
|
|
68
82
|
disconnected() {
|
|
@@ -82,18 +96,6 @@ export default {
|
|
|
82
96
|
this.svg = null;
|
|
83
97
|
},
|
|
84
98
|
|
|
85
|
-
update: {
|
|
86
|
-
read() {
|
|
87
|
-
return !!(this.strokeAnimation && this.svgEl && isVisible(this.svgEl));
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
write() {
|
|
91
|
-
applyAnimation(this.svgEl);
|
|
92
|
-
},
|
|
93
|
-
|
|
94
|
-
type: ['resize'],
|
|
95
|
-
},
|
|
96
|
-
|
|
97
99
|
methods: {
|
|
98
100
|
async getSvg() {
|
|
99
101
|
if (isTag(this.$el, 'img') && !this.$el.complete && this.$el.loading === 'lazy') {
|
package/src/js/core/toggle.js
CHANGED
|
@@ -189,22 +189,25 @@ export default {
|
|
|
189
189
|
}
|
|
190
190
|
},
|
|
191
191
|
},
|
|
192
|
-
],
|
|
193
192
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return includes(this.mode, 'media') && this.media ? { match: this.matchMedia } : false;
|
|
197
|
-
},
|
|
193
|
+
{
|
|
194
|
+
name: 'mediachange',
|
|
198
195
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
this.toggle();
|
|
203
|
-
}
|
|
204
|
-
},
|
|
196
|
+
filter() {
|
|
197
|
+
return includes(this.mode, 'media');
|
|
198
|
+
},
|
|
205
199
|
|
|
206
|
-
|
|
207
|
-
|
|
200
|
+
el() {
|
|
201
|
+
return this.target;
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
handler(e, mediaObj) {
|
|
205
|
+
if (mediaObj.matches ^ this.isToggled(this.target)) {
|
|
206
|
+
this.toggle();
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
],
|
|
208
211
|
|
|
209
212
|
methods: {
|
|
210
213
|
async toggle(type) {
|
package/src/js/core/video.js
CHANGED
|
@@ -23,13 +23,9 @@ export default {
|
|
|
23
23
|
autoplay: true,
|
|
24
24
|
},
|
|
25
25
|
|
|
26
|
-
computed: {
|
|
27
|
-
inView({ autoplay }) {
|
|
28
|
-
return autoplay === 'inview';
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
|
|
32
26
|
connected() {
|
|
27
|
+
this.inView = this.autoplay === 'inview';
|
|
28
|
+
|
|
33
29
|
if (this.inView && !hasAttr(this.$el, 'preload')) {
|
|
34
30
|
this.$el.preload = 'none';
|
|
35
31
|
}
|
|
@@ -60,7 +56,5 @@ export default {
|
|
|
60
56
|
play(this.$el);
|
|
61
57
|
}
|
|
62
58
|
},
|
|
63
|
-
|
|
64
|
-
events: ['resize', 'scroll'],
|
|
65
59
|
},
|
|
66
60
|
};
|
package/src/js/mixin/media.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getCssVar,
|
|
3
|
+
isString,
|
|
4
|
+
on,
|
|
5
|
+
trigger,
|
|
6
|
+
toFloat,
|
|
7
|
+
startsWith,
|
|
8
|
+
isNumeric,
|
|
9
|
+
createEvent,
|
|
10
|
+
} from 'uikit-util';
|
|
2
11
|
|
|
3
12
|
export default {
|
|
4
13
|
props: {
|
|
@@ -11,15 +20,30 @@ export default {
|
|
|
11
20
|
|
|
12
21
|
computed: {
|
|
13
22
|
matchMedia() {
|
|
14
|
-
|
|
15
|
-
return !media || window.matchMedia(media).matches;
|
|
23
|
+
return this.mediaObj?.matches;
|
|
16
24
|
},
|
|
17
25
|
},
|
|
26
|
+
|
|
27
|
+
connected() {
|
|
28
|
+
const media = toMedia(this.media);
|
|
29
|
+
this.mediaObj = window.matchMedia(media);
|
|
30
|
+
const handler = () =>
|
|
31
|
+
trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
|
|
32
|
+
this.offMediaObj = on(this.mediaObj, 'change', () => {
|
|
33
|
+
handler();
|
|
34
|
+
this.$emit('resize');
|
|
35
|
+
});
|
|
36
|
+
handler();
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
disconnected() {
|
|
40
|
+
this.offMediaObj?.();
|
|
41
|
+
},
|
|
18
42
|
};
|
|
19
43
|
|
|
20
44
|
function toMedia(value) {
|
|
21
45
|
if (isString(value)) {
|
|
22
|
-
if (value
|
|
46
|
+
if (startsWith(value, '@')) {
|
|
23
47
|
const name = `breakpoint-${value.substr(1)}`;
|
|
24
48
|
value = toFloat(getCssVar(name));
|
|
25
49
|
} else if (isNaN(value)) {
|
|
@@ -27,5 +51,5 @@ function toMedia(value) {
|
|
|
27
51
|
}
|
|
28
52
|
}
|
|
29
53
|
|
|
30
|
-
return value &&
|
|
54
|
+
return value && isNumeric(value) ? `(min-width: ${value}px)` : '';
|
|
31
55
|
}
|
package/src/js/mixin/position.js
CHANGED
|
@@ -24,18 +24,10 @@ export default {
|
|
|
24
24
|
clsPos: '',
|
|
25
25
|
},
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
pos
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
dir() {
|
|
33
|
-
return this.pos[0];
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
align() {
|
|
37
|
-
return this.pos[1];
|
|
38
|
-
},
|
|
27
|
+
connected() {
|
|
28
|
+
this.pos = this.pos.split('-').concat('center').slice(0, 2);
|
|
29
|
+
this.dir = this.pos[0];
|
|
30
|
+
this.align = this.pos[1];
|
|
39
31
|
},
|
|
40
32
|
|
|
41
33
|
methods: {
|
|
@@ -44,6 +36,8 @@ export default {
|
|
|
44
36
|
|
|
45
37
|
let { offset } = this;
|
|
46
38
|
const axis = this.getAxis();
|
|
39
|
+
const dir = this.pos[0];
|
|
40
|
+
const align = this.pos[1];
|
|
47
41
|
|
|
48
42
|
if (!isNumeric(offset)) {
|
|
49
43
|
const node = $(offset);
|
|
@@ -56,13 +50,11 @@ export default {
|
|
|
56
50
|
const { x, y } = positionAt(
|
|
57
51
|
element,
|
|
58
52
|
target,
|
|
53
|
+
axis === 'x' ? `${flipPosition(dir)} ${align}` : `${align} ${flipPosition(dir)}`,
|
|
54
|
+
axis === 'x' ? `${dir} ${align}` : `${align} ${dir}`,
|
|
59
55
|
axis === 'x'
|
|
60
|
-
? `${
|
|
61
|
-
:
|
|
62
|
-
axis === 'x' ? `${this.dir} ${this.align}` : `${this.align} ${this.dir}`,
|
|
63
|
-
axis === 'x'
|
|
64
|
-
? `${this.dir === 'left' ? -offset : offset}`
|
|
65
|
-
: ` ${this.dir === 'top' ? -offset : offset}`,
|
|
56
|
+
? `${dir === 'left' ? -offset : offset}`
|
|
57
|
+
: ` ${dir === 'top' ? -offset : offset}`,
|
|
66
58
|
null,
|
|
67
59
|
this.flip,
|
|
68
60
|
boundary
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { on } from 'uikit-util';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
connected() {
|
|
5
|
+
registerScrollListener(this._uid, () => this.$emit('scroll'));
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
disconnected() {
|
|
9
|
+
unregisterScrollListener(this._uid);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const scrollListeners = new Map();
|
|
14
|
+
let unbindScrollListener;
|
|
15
|
+
function registerScrollListener(id, listener) {
|
|
16
|
+
unbindScrollListener =
|
|
17
|
+
unbindScrollListener ||
|
|
18
|
+
on(window, 'scroll', () => scrollListeners.forEach((listener) => listener()), {
|
|
19
|
+
passive: true,
|
|
20
|
+
capture: true,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
scrollListeners.set(id, listener);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function unregisterScrollListener(id) {
|
|
27
|
+
scrollListeners.delete(id);
|
|
28
|
+
if (unbindScrollListener && !scrollListeners.size) {
|
|
29
|
+
unbindScrollListener();
|
|
30
|
+
unbindScrollListener = null;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/js/mixin/slider.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Resize from './resize';
|
|
1
2
|
import SliderAutoplay from './slider-autoplay';
|
|
2
3
|
import SliderDrag from './slider-drag';
|
|
3
4
|
import SliderNav from './slider-nav';
|
|
@@ -15,7 +16,7 @@ import {
|
|
|
15
16
|
} from 'uikit-util';
|
|
16
17
|
|
|
17
18
|
export default {
|
|
18
|
-
mixins: [SliderAutoplay, SliderDrag, SliderNav],
|
|
19
|
+
mixins: [SliderAutoplay, SliderDrag, SliderNav, Resize],
|
|
19
20
|
|
|
20
21
|
props: {
|
|
21
22
|
clsActivated: Boolean,
|
package/src/js/util/class.js
CHANGED
|
@@ -20,12 +20,7 @@ export function replaceClass(element, ...args) {
|
|
|
20
20
|
|
|
21
21
|
export function hasClass(element, cls) {
|
|
22
22
|
[cls] = getClasses(cls);
|
|
23
|
-
|
|
24
|
-
if (cls && node.classList.contains(cls)) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return false;
|
|
23
|
+
return !!cls && toNodes(element).some((node) => node.classList.contains(cls));
|
|
29
24
|
}
|
|
30
25
|
|
|
31
26
|
export function toggleClass(element, cls, force) {
|
package/src/js/util/mouse.js
CHANGED
package/src/js/util/observer.js
CHANGED
|
@@ -1,33 +1,70 @@
|
|
|
1
|
+
import { on } from './event';
|
|
1
2
|
import { toNodes } from './lang';
|
|
3
|
+
import { fastdom } from './fastdom';
|
|
2
4
|
|
|
3
|
-
// Old chromium based browsers (UC Browser) did not implement `isIntersecting`
|
|
4
|
-
export const hasIntersectionObserver =
|
|
5
|
-
window.IntersectionObserver && 'isIntersecting' in IntersectionObserverEntry.prototype;
|
|
6
5
|
export function observeIntersection(targets, cb, options, intersecting = true) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return observer;
|
|
6
|
+
return observe(
|
|
7
|
+
IntersectionObserver,
|
|
8
|
+
targets,
|
|
9
|
+
intersecting
|
|
10
|
+
? (entries, observer) => {
|
|
11
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
12
|
+
cb(entries, observer);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
: cb,
|
|
16
|
+
options
|
|
17
|
+
);
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
const hasResizeObserver = window.ResizeObserver;
|
|
23
21
|
export function observeResize(targets, cb, options = { box: 'border-box' }) {
|
|
24
|
-
if (
|
|
22
|
+
if (hasResizeObserver) {
|
|
23
|
+
return observe(ResizeObserver, targets, cb, options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Fallback Safari < 13.1
|
|
27
|
+
initResizeListener();
|
|
28
|
+
listeners.add(cb);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
disconnect() {
|
|
32
|
+
listeners.delete(cb);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let listeners;
|
|
38
|
+
function initResizeListener() {
|
|
39
|
+
if (listeners) {
|
|
25
40
|
return;
|
|
26
41
|
}
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
43
|
+
listeners = new Set();
|
|
44
|
+
|
|
45
|
+
// throttle 'resize'
|
|
46
|
+
let pendingResize;
|
|
47
|
+
const handleResize = () => {
|
|
48
|
+
if (pendingResize) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
pendingResize = true;
|
|
52
|
+
fastdom.read(() => (pendingResize = false));
|
|
53
|
+
for (const listener of listeners) {
|
|
54
|
+
listener();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
on(window, 'load resize', handleResize);
|
|
59
|
+
on(document, 'loadedmetadata load', handleResize, true);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function observeMutation(targets, cb, options) {
|
|
63
|
+
return observe(MutationObserver, targets, cb, options);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function observe(Observer, targets, cb, options) {
|
|
67
|
+
const observer = new Observer(cb);
|
|
31
68
|
for (const el of toNodes(targets)) {
|
|
32
69
|
observer.observe(el, options);
|
|
33
70
|
}
|
package/src/js/util/style.js
CHANGED
|
@@ -80,7 +80,7 @@ export function getCssVar(name) {
|
|
|
80
80
|
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-setproperty
|
|
81
81
|
export const propName = memoize((name) => vendorPropName(name));
|
|
82
82
|
|
|
83
|
-
const cssPrefixes = ['webkit', 'moz'
|
|
83
|
+
const cssPrefixes = ['webkit', 'moz'];
|
|
84
84
|
|
|
85
85
|
function vendorPropName(name) {
|
|
86
86
|
name = hyphenate(name);
|
|
@@ -504,27 +504,8 @@ pre code { font-family: @base-pre-font-family; }
|
|
|
504
504
|
/* Focus
|
|
505
505
|
========================================================================== */
|
|
506
506
|
|
|
507
|
-
/*
|
|
508
|
-
* Safari doesn't support `:focus-visible` yet. It also doesn't set focus if clicking a button or anchor.
|
|
509
|
-
* 1. Fallback: Remove `:focus` for a negative tabindexes.
|
|
510
|
-
* 2. Fallback: Set `:focus` style but not for negative tabindexes.
|
|
511
|
-
* 3. Fallback: Remove `:focus` style for browsers which support `:focus-visible`.
|
|
512
|
-
* 4. Set `:focus-visible` style for browsers which support it.
|
|
513
|
-
*/
|
|
514
|
-
|
|
515
|
-
/* 1 */
|
|
516
507
|
:focus { outline: none; }
|
|
517
508
|
|
|
518
|
-
/* 2 */
|
|
519
|
-
:focus:not([tabindex^='-']) {
|
|
520
|
-
outline: @base-focus-outline-width @base-focus-outline-style @base-focus-outline;
|
|
521
|
-
outline-offset: @base-focus-outline-offset;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
/* 3 */
|
|
525
|
-
:focus:not(:focus-visible) { outline: none; }
|
|
526
|
-
|
|
527
|
-
/* 4 */
|
|
528
509
|
:focus-visible { outline: @base-focus-outline-width @base-focus-outline-style @base-focus-outline; }
|
|
529
510
|
|
|
530
511
|
|
|
@@ -310,10 +310,8 @@
|
|
|
310
310
|
* Placeholder
|
|
311
311
|
*/
|
|
312
312
|
|
|
313
|
-
.uk-input::-ms-input-placeholder { color: @form-placeholder-color !important; }
|
|
314
313
|
.uk-input::placeholder { color: @form-placeholder-color; }
|
|
315
314
|
|
|
316
|
-
.uk-textarea::-ms-input-placeholder { color: @form-placeholder-color !important; }
|
|
317
315
|
.uk-textarea::placeholder { color: @form-placeholder-color; }
|
|
318
316
|
|
|
319
317
|
|
|
@@ -423,8 +421,7 @@ select.uk-form-width-xsmall { width: (@form-width-xsmall + 25px); }
|
|
|
423
421
|
/*
|
|
424
422
|
* 1. Remove default style. Also works in Firefox
|
|
425
423
|
* 2. Style
|
|
426
|
-
* 3.
|
|
427
|
-
* 4. Set `color` for options in the select dropdown, because the inherited `color` might be too light.
|
|
424
|
+
* 3. Set `color` for options in the select dropdown, because the inherited `color` might be too light.
|
|
428
425
|
*/
|
|
429
426
|
|
|
430
427
|
.uk-select:not([multiple]):not([size]) {
|
|
@@ -439,9 +436,6 @@ select.uk-form-width-xsmall { width: (@form-width-xsmall + 25px); }
|
|
|
439
436
|
}
|
|
440
437
|
|
|
441
438
|
/* 3 */
|
|
442
|
-
.uk-select:not([multiple]):not([size])::-ms-expand { display: none; }
|
|
443
|
-
|
|
444
|
-
/* 4 */
|
|
445
439
|
.uk-select:not([multiple]):not([size]) option { color: @form-select-option-color; }
|
|
446
440
|
|
|
447
441
|
/*
|
|
@@ -820,10 +814,8 @@ select.uk-form-width-xsmall { width: (@form-width-xsmall + 25px); }
|
|
|
820
814
|
// Placeholder
|
|
821
815
|
//
|
|
822
816
|
|
|
823
|
-
.uk-input::-ms-input-placeholder { color: @inverse-form-placeholder-color !important; }
|
|
824
817
|
.uk-input::placeholder { color: @inverse-form-placeholder-color; }
|
|
825
818
|
|
|
826
|
-
.uk-textarea::-ms-input-placeholder { color: @inverse-form-placeholder-color !important; }
|
|
827
819
|
.uk-textarea::placeholder { color: @inverse-form-placeholder-color; }
|
|
828
820
|
|
|
829
821
|
//
|
|
@@ -107,15 +107,21 @@ button.uk-icon:not(:disabled) { cursor: pointer; }
|
|
|
107
107
|
|
|
108
108
|
/*
|
|
109
109
|
* Display images in icon dimensions
|
|
110
|
+
* 1. Required for `span` with background image
|
|
111
|
+
* 2. Required for `image`
|
|
110
112
|
*/
|
|
111
113
|
|
|
112
114
|
.uk-icon-image {
|
|
113
115
|
width: @icon-image-size;
|
|
114
116
|
height: @icon-image-size;
|
|
117
|
+
/* 1 */
|
|
115
118
|
background-position: 50% 50%;
|
|
116
119
|
background-repeat: no-repeat;
|
|
117
120
|
background-size: contain;
|
|
118
121
|
vertical-align: middle;
|
|
122
|
+
/* 2 */
|
|
123
|
+
object-fit: scale-down;
|
|
124
|
+
max-width: none;
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
|
|
@@ -129,7 +129,6 @@
|
|
|
129
129
|
.uk-search-input:focus { outline: none; }
|
|
130
130
|
|
|
131
131
|
/* Placeholder */
|
|
132
|
-
.uk-search-input:-ms-input-placeholder { color: @search-placeholder-color !important; }
|
|
133
132
|
.uk-search-input::placeholder { color: @search-placeholder-color; }
|
|
134
133
|
|
|
135
134
|
|
|
@@ -334,10 +333,8 @@
|
|
|
334
333
|
|
|
335
334
|
.uk-search-input { color: @inverse-search-color; }
|
|
336
335
|
|
|
337
|
-
.uk-search-input:-ms-input-placeholder { color: @inverse-search-placeholder-color !important; }
|
|
338
336
|
.uk-search-input::placeholder { color: @inverse-search-placeholder-color; }
|
|
339
337
|
|
|
340
|
-
|
|
341
338
|
//
|
|
342
339
|
// Icon
|
|
343
340
|
//
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
/*
|
|
60
60
|
* 1. Optimize animation
|
|
61
61
|
* 2. Create a containing block. In Safari it's neither created by `transform` nor `will-change`.
|
|
62
|
+
* 3. Disable horizontal panning gestures
|
|
62
63
|
*/
|
|
63
64
|
|
|
64
65
|
.uk-slider-items {
|
|
@@ -66,6 +67,8 @@
|
|
|
66
67
|
will-change: transform;
|
|
67
68
|
/* 2 */
|
|
68
69
|
position: relative;
|
|
70
|
+
/* 3 */
|
|
71
|
+
touch-action: pan-y;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
/*
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
* 2. Reset list
|
|
34
34
|
* 3. Clip child elements
|
|
35
35
|
* 4. Prevent displaying the callout information on iOS.
|
|
36
|
+
* 5. Disable horizontal panning gestures
|
|
36
37
|
*/
|
|
37
38
|
|
|
38
39
|
.uk-slideshow-items {
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
overflow: hidden;
|
|
48
49
|
/* 4 */
|
|
49
50
|
-webkit-touch-callout: none;
|
|
51
|
+
/* 5 */
|
|
52
|
+
touch-action: pan-y;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
|