uikit 3.11.2-dev.28b7953b9 → 3.11.2-dev.29f2881ed
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 +42 -29
- 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 +127 -201
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +127 -201
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +129 -207
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +129 -207
- package/dist/css/uikit.min.css +1 -1
- package/dist/js/components/countdown.js +88 -133
- package/dist/js/components/countdown.min.js +1 -1
- package/dist/js/components/filter.js +408 -439
- package/dist/js/components/filter.min.js +1 -1
- package/dist/js/components/lightbox-panel.js +1098 -1316
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1144 -1393
- 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 +345 -358
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +343 -357
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +768 -843
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +343 -357
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +643 -826
- package/dist/js/components/slideshow.min.js +1 -1
- package/dist/js/components/sortable.js +587 -620
- package/dist/js/components/sortable.min.js +1 -1
- package/dist/js/components/tooltip.js +324 -356
- package/dist/js/components/tooltip.min.js +1 -1
- package/dist/js/components/upload.js +155 -167
- package/dist/js/components/upload.min.js +1 -1
- package/dist/js/uikit-core.js +5339 -6661
- 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 +8156 -9889
- 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 +65 -82
- package/src/js/components/countdown.js +24 -50
- 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 +37 -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 +95 -64
- package/src/js/components/slideshow-parallax.js +1 -1
- package/src/js/components/slideshow.js +15 -44
- package/src/js/components/sortable.js +125 -106
- package/src/js/components/tooltip.js +41 -31
- package/src/js/components/upload.js +52 -63
- package/src/js/core/accordion.js +53 -48
- package/src/js/core/alert.js +9 -17
- package/src/js/core/core.js +74 -53
- package/src/js/core/cover.js +11 -15
- package/src/js/core/drop.js +106 -92
- package/src/js/core/form-custom.js +20 -25
- 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 +28 -35
- package/src/js/core/icon.js +47 -52
- package/src/js/core/img.js +80 -78
- 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 +112 -88
- package/src/js/core/offcanvas.js +49 -53
- 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 +156 -118
- package/src/js/core/svg.js +68 -83
- package/src/js/core/switcher.js +47 -46
- package/src/js/core/tab.js +7 -10
- package/src/js/core/toggle.js +66 -67
- package/src/js/core/video.js +11 -22
- 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/media.js +5 -10
- package/src/js/mixin/modal.js +89 -66
- package/src/js/mixin/parallax.js +149 -106
- 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 +48 -55
- package/src/js/mixin/slideshow.js +13 -19
- 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 +39 -66
- package/src/js/util/env.js +7 -12
- package/src/js/util/event.js +60 -59
- package/src/js/util/fastdom.js +1 -6
- package/src/js/util/filter.js +17 -34
- package/src/js/util/index.js +0 -1
- package/src/js/util/lang.js +82 -121
- package/src/js/util/mouse.js +19 -17
- package/src/js/util/options.js +32 -46
- package/src/js/util/player.js +41 -36
- package/src/js/util/position.js +54 -46
- package/src/js/util/selector.js +43 -58
- package/src/js/util/style.js +39 -49
- package/src/js/util/viewport.js +75 -64
- package/src/less/components/base.less +10 -33
- package/src/less/components/flex.less +0 -9
- package/src/less/components/form-range.less +48 -95
- package/src/less/components/form.less +0 -1
- package/src/less/components/height.less +3 -0
- package/src/less/components/leader.less +0 -1
- package/src/less/components/lightbox.less +0 -1
- package/src/less/components/modal.less +3 -7
- package/src/less/components/navbar.less +0 -7
- package/src/less/components/progress.less +14 -36
- package/src/less/components/slider.less +0 -3
- package/src/less/components/slideshow.less +0 -3
- package/src/less/components/text.less +16 -32
- package/src/less/components/utility.less +22 -0
- package/src/scss/components/base.scss +10 -33
- package/src/scss/components/flex.scss +0 -9
- package/src/scss/components/form-range.scss +48 -95
- package/src/scss/components/form.scss +3 -4
- package/src/scss/components/height.scss +3 -0
- package/src/scss/components/icon.scss +2 -2
- package/src/scss/components/leader.scss +0 -1
- package/src/scss/components/lightbox.scss +0 -1
- package/src/scss/components/modal.scss +3 -7
- package/src/scss/components/navbar.scss +0 -7
- package/src/scss/components/progress.scss +14 -36
- package/src/scss/components/search.scss +1 -1
- package/src/scss/components/slider.scss +0 -3
- package/src/scss/components/slideshow.scss +0 -3
- package/src/scss/components/text.scss +16 -32
- package/src/scss/components/utility.scss +22 -0
- package/src/scss/mixins-theme.scss +1 -1
- package/src/scss/mixins.scss +1 -1
- package/src/scss/variables-theme.scss +9 -9
- package/src/scss/variables.scss +9 -9
- package/tests/align.html +10 -10
- package/tests/animation.html +2 -2
- package/tests/article.html +2 -2
- package/tests/base.html +3 -3
- package/tests/card.html +10 -10
- package/tests/column.html +3 -3
- package/tests/comment.html +9 -9
- package/tests/dotnav.html +3 -3
- package/tests/image.html +296 -54
- 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 +14 -5
- 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 +55 -70
- 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 +33 -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/tests/images/test.avif +0 -0
- package/tests/images/test.webp +0 -0
package/src/js/core/icon.js
CHANGED
|
@@ -15,7 +15,19 @@ import slidenavPrevious from '../../images/components/slidenav-previous.svg';
|
|
|
15
15
|
import slidenavPreviousLarge from '../../images/components/slidenav-previous-large.svg';
|
|
16
16
|
import spinner from '../../images/components/spinner.svg';
|
|
17
17
|
import totop from '../../images/components/totop.svg';
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
$,
|
|
20
|
+
addClass,
|
|
21
|
+
apply,
|
|
22
|
+
css,
|
|
23
|
+
each,
|
|
24
|
+
hasClass,
|
|
25
|
+
hyphenate,
|
|
26
|
+
isRtl,
|
|
27
|
+
isString,
|
|
28
|
+
parents,
|
|
29
|
+
swap,
|
|
30
|
+
} from 'uikit-util';
|
|
19
31
|
|
|
20
32
|
const icons = {
|
|
21
33
|
spinner,
|
|
@@ -33,11 +45,10 @@ const icons = {
|
|
|
33
45
|
'slidenav-next': slidenavNext,
|
|
34
46
|
'slidenav-next-large': slidenavNextLarge,
|
|
35
47
|
'slidenav-previous': slidenavPrevious,
|
|
36
|
-
'slidenav-previous-large': slidenavPreviousLarge
|
|
48
|
+
'slidenav-previous-large': slidenavPreviousLarge,
|
|
37
49
|
};
|
|
38
50
|
|
|
39
51
|
const Icon = {
|
|
40
|
-
|
|
41
52
|
install,
|
|
42
53
|
|
|
43
54
|
extends: SVG,
|
|
@@ -47,7 +58,7 @@ const Icon = {
|
|
|
47
58
|
props: ['icon'],
|
|
48
59
|
|
|
49
60
|
data: {
|
|
50
|
-
include: ['focusable']
|
|
61
|
+
include: ['focusable'],
|
|
51
62
|
},
|
|
52
63
|
|
|
53
64
|
isIcon: true,
|
|
@@ -57,42 +68,35 @@ const Icon = {
|
|
|
57
68
|
},
|
|
58
69
|
|
|
59
70
|
methods: {
|
|
60
|
-
|
|
61
|
-
getSvg() {
|
|
62
|
-
|
|
71
|
+
async getSvg() {
|
|
63
72
|
const icon = getIcon(this.icon);
|
|
64
73
|
|
|
65
74
|
if (!icon) {
|
|
66
|
-
|
|
75
|
+
throw 'Icon not found.';
|
|
67
76
|
}
|
|
68
77
|
|
|
69
|
-
return
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
78
|
+
return icon;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
74
81
|
};
|
|
75
82
|
|
|
76
83
|
export default Icon;
|
|
77
84
|
|
|
78
85
|
export const IconComponent = {
|
|
79
|
-
|
|
80
86
|
args: false,
|
|
81
87
|
|
|
82
88
|
extends: Icon,
|
|
83
89
|
|
|
84
|
-
data: vm => ({
|
|
85
|
-
icon: hyphenate(vm.constructor.options.name)
|
|
90
|
+
data: (vm) => ({
|
|
91
|
+
icon: hyphenate(vm.constructor.options.name),
|
|
86
92
|
}),
|
|
87
93
|
|
|
88
94
|
beforeConnect() {
|
|
89
95
|
addClass(this.$el, this.$name);
|
|
90
|
-
}
|
|
91
|
-
|
|
96
|
+
},
|
|
92
97
|
};
|
|
93
98
|
|
|
94
99
|
export const Slidenav = {
|
|
95
|
-
|
|
96
100
|
extends: IconComponent,
|
|
97
101
|
|
|
98
102
|
beforeConnect() {
|
|
@@ -100,72 +104,64 @@ export const Slidenav = {
|
|
|
100
104
|
},
|
|
101
105
|
|
|
102
106
|
computed: {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
: icon;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
107
|
+
icon({ icon }, $el) {
|
|
108
|
+
return hasClass($el, 'uk-slidenav-large') ? `${icon}-large` : icon;
|
|
109
|
+
},
|
|
110
|
+
},
|
|
112
111
|
};
|
|
113
112
|
|
|
114
113
|
export const Search = {
|
|
115
|
-
|
|
116
114
|
extends: IconComponent,
|
|
117
115
|
|
|
118
116
|
computed: {
|
|
119
|
-
|
|
120
|
-
icon({icon}, $el) {
|
|
117
|
+
icon({ icon }, $el) {
|
|
121
118
|
return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
|
|
122
119
|
? 'search-large'
|
|
123
120
|
: parents($el, '.uk-search-navbar').length
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
|
|
121
|
+
? 'search-navbar'
|
|
122
|
+
: icon;
|
|
123
|
+
},
|
|
124
|
+
},
|
|
130
125
|
};
|
|
131
126
|
|
|
132
127
|
export const Close = {
|
|
133
|
-
|
|
134
128
|
extends: IconComponent,
|
|
135
129
|
|
|
136
130
|
computed: {
|
|
137
|
-
|
|
138
131
|
icon() {
|
|
139
132
|
return `close-${hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'}`;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
133
|
+
},
|
|
134
|
+
},
|
|
144
135
|
};
|
|
145
136
|
|
|
146
137
|
export const Spinner = {
|
|
147
|
-
|
|
148
138
|
extends: IconComponent,
|
|
149
139
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
140
|
+
methods: {
|
|
141
|
+
async getSvg() {
|
|
142
|
+
const icon = await Icon.methods.getSvg.call(this);
|
|
153
143
|
|
|
144
|
+
if (this.ratio !== 1) {
|
|
145
|
+
css($('circle', icon), 'strokeWidth', 1 / this.ratio);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return icon;
|
|
149
|
+
},
|
|
150
|
+
},
|
|
154
151
|
};
|
|
155
152
|
|
|
156
153
|
const parsed = {};
|
|
157
154
|
function install(UIkit) {
|
|
158
155
|
UIkit.icon.add = (name, svg) => {
|
|
159
|
-
|
|
160
|
-
const added = isString(name) ? ({[name]: svg}) : name;
|
|
156
|
+
const added = isString(name) ? { [name]: svg } : name;
|
|
161
157
|
each(added, (svg, name) => {
|
|
162
158
|
icons[name] = svg;
|
|
163
159
|
delete parsed[name];
|
|
164
160
|
});
|
|
165
161
|
|
|
166
162
|
if (UIkit._initialized) {
|
|
167
|
-
apply(document.body, el =>
|
|
168
|
-
each(UIkit.getComponents(el), cmp => {
|
|
163
|
+
apply(document.body, (el) =>
|
|
164
|
+
each(UIkit.getComponents(el), (cmp) => {
|
|
169
165
|
cmp.$options.isIcon && cmp.icon in added && cmp.$reset();
|
|
170
166
|
})
|
|
171
167
|
);
|
|
@@ -174,7 +170,6 @@ function install(UIkit) {
|
|
|
174
170
|
}
|
|
175
171
|
|
|
176
172
|
function getIcon(icon) {
|
|
177
|
-
|
|
178
173
|
if (!icons[icon]) {
|
|
179
174
|
return null;
|
|
180
175
|
}
|
package/src/js/core/img.js
CHANGED
|
@@ -1,48 +1,66 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
append,
|
|
3
|
+
attr,
|
|
4
|
+
children,
|
|
5
|
+
createEvent,
|
|
6
|
+
css,
|
|
7
|
+
data,
|
|
8
|
+
escape,
|
|
9
|
+
fragment,
|
|
10
|
+
hasAttr,
|
|
11
|
+
includes,
|
|
12
|
+
isArray,
|
|
13
|
+
isEmpty,
|
|
14
|
+
isTag,
|
|
15
|
+
parent,
|
|
16
|
+
parseOptions,
|
|
17
|
+
queryAll,
|
|
18
|
+
removeAttr,
|
|
19
|
+
startsWith,
|
|
20
|
+
toFloat,
|
|
21
|
+
toPx,
|
|
22
|
+
trigger,
|
|
23
|
+
} from 'uikit-util';
|
|
2
24
|
|
|
3
25
|
const nativeLazyLoad = 'loading' in HTMLImageElement.prototype;
|
|
4
26
|
const nativeIsIntersecting = 'isIntersecting' in IntersectionObserverEntry.prototype; // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
|
|
5
27
|
|
|
6
28
|
export default {
|
|
7
|
-
|
|
8
29
|
args: 'dataSrc',
|
|
9
30
|
|
|
10
31
|
props: {
|
|
11
32
|
dataSrc: String,
|
|
12
|
-
|
|
33
|
+
sources: String,
|
|
13
34
|
offsetTop: String,
|
|
14
35
|
offsetLeft: String,
|
|
15
|
-
target: String
|
|
36
|
+
target: String,
|
|
37
|
+
loading: String,
|
|
16
38
|
},
|
|
17
39
|
|
|
18
40
|
data: {
|
|
19
41
|
dataSrc: '',
|
|
20
|
-
|
|
42
|
+
sources: false,
|
|
21
43
|
offsetTop: '50vh',
|
|
22
44
|
offsetLeft: '50vw',
|
|
23
|
-
target: false
|
|
45
|
+
target: false,
|
|
46
|
+
loading: 'lazy',
|
|
24
47
|
},
|
|
25
48
|
|
|
26
49
|
computed: {
|
|
27
|
-
|
|
28
50
|
target: {
|
|
29
|
-
|
|
30
|
-
get({target}) {
|
|
51
|
+
get({ target }) {
|
|
31
52
|
return [this.$el, ...queryAll(target, this.$el)];
|
|
32
53
|
},
|
|
33
54
|
|
|
34
55
|
watch() {
|
|
35
56
|
this.observe();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
57
|
+
},
|
|
58
|
+
},
|
|
40
59
|
},
|
|
41
60
|
|
|
42
61
|
connected() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
setSrcAttrs(this.$el, this.dataSrc);
|
|
62
|
+
if (this.loading !== 'lazy' || !window.IntersectionObserver || !nativeIsIntersecting) {
|
|
63
|
+
this.load();
|
|
46
64
|
return;
|
|
47
65
|
}
|
|
48
66
|
|
|
@@ -57,99 +75,91 @@ export default {
|
|
|
57
75
|
|
|
58
76
|
ensureSrcAttribute(this.$el);
|
|
59
77
|
|
|
60
|
-
const rootMargin = `${toPx(this.offsetTop, 'height')}px ${toPx(
|
|
61
|
-
|
|
78
|
+
const rootMargin = `${toPx(this.offsetTop, 'height')}px ${toPx(
|
|
79
|
+
this.offsetLeft,
|
|
80
|
+
'width'
|
|
81
|
+
)}px`;
|
|
82
|
+
this.observer = new IntersectionObserver(
|
|
83
|
+
(entries) => {
|
|
84
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
85
|
+
this.load();
|
|
86
|
+
this.observer.disconnect();
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{ rootMargin }
|
|
90
|
+
);
|
|
62
91
|
this.observe();
|
|
63
|
-
|
|
64
92
|
},
|
|
65
93
|
|
|
66
94
|
disconnected() {
|
|
67
|
-
|
|
95
|
+
if (this._data.image) {
|
|
96
|
+
this._data.image.onload = '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.observer?.disconnect();
|
|
68
100
|
},
|
|
69
101
|
|
|
70
102
|
update: {
|
|
71
|
-
|
|
72
103
|
write(store) {
|
|
73
104
|
if (!this.observer || isImg(this.$el)) {
|
|
74
105
|
return false;
|
|
75
106
|
}
|
|
107
|
+
|
|
76
108
|
const srcset = data(this.$el, 'data-srcset');
|
|
77
109
|
if (srcset && window.devicePixelRatio !== 1) {
|
|
78
|
-
|
|
79
110
|
const bgSize = css(this.$el, 'backgroundSize');
|
|
80
111
|
if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
|
|
81
112
|
store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
|
|
82
113
|
css(this.$el, 'backgroundSize', `${store.bgSize}px`);
|
|
83
114
|
}
|
|
84
|
-
|
|
85
115
|
}
|
|
86
|
-
|
|
87
116
|
},
|
|
88
117
|
|
|
89
|
-
events: ['resize']
|
|
90
|
-
|
|
118
|
+
events: ['resize'],
|
|
91
119
|
},
|
|
92
120
|
|
|
93
121
|
methods: {
|
|
94
|
-
|
|
95
|
-
load(entries) {
|
|
96
|
-
|
|
97
|
-
if (!entries.some(entry => entry.isIntersecting)) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
122
|
+
load() {
|
|
101
123
|
if (this._data.image) {
|
|
102
124
|
return this._data.image;
|
|
103
125
|
}
|
|
104
126
|
|
|
105
127
|
const image = isImg(this.$el)
|
|
106
128
|
? this.$el
|
|
107
|
-
: getImageFromElement(
|
|
108
|
-
this.$el,
|
|
109
|
-
this.dataSrc,
|
|
110
|
-
this.dataSources
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
this._data.image = image;
|
|
114
|
-
image.loading = 'eager';
|
|
115
|
-
setSrcAttrs(this.$el, image.currentSrc);
|
|
129
|
+
: getImageFromElement(this.$el, this.dataSrc, this.sources);
|
|
116
130
|
|
|
117
|
-
|
|
131
|
+
removeAttr(image, 'loading');
|
|
132
|
+
setSrcAttrs(this.$el, image.currentSrc);
|
|
133
|
+
return (this._data.image = image);
|
|
118
134
|
},
|
|
119
135
|
|
|
120
136
|
observe() {
|
|
121
137
|
if (this._connected && !this._data.image) {
|
|
122
|
-
|
|
138
|
+
for (const el of this.target) {
|
|
139
|
+
this.observer.observe(el);
|
|
140
|
+
}
|
|
123
141
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
142
|
+
},
|
|
143
|
+
},
|
|
128
144
|
};
|
|
129
145
|
|
|
130
146
|
function setSrcAttrs(el, src) {
|
|
131
|
-
|
|
132
147
|
if (isImg(el)) {
|
|
133
|
-
|
|
134
148
|
const parentNode = parent(el);
|
|
135
149
|
const elements = isPicture(parentNode) ? children(parentNode) : [el];
|
|
136
|
-
elements.forEach(el => setSourceProps(el, el));
|
|
137
|
-
|
|
150
|
+
elements.forEach((el) => setSourceProps(el, el));
|
|
138
151
|
} else if (src) {
|
|
139
|
-
|
|
140
152
|
const change = !includes(el.style.backgroundImage, src);
|
|
141
153
|
if (change) {
|
|
142
154
|
css(el, 'backgroundImage', `url(${escape(src)})`);
|
|
143
155
|
trigger(el, createEvent('load', false));
|
|
144
156
|
}
|
|
145
|
-
|
|
146
157
|
}
|
|
147
|
-
|
|
148
158
|
}
|
|
149
159
|
|
|
150
160
|
const srcProps = ['data-src', 'data-srcset', 'sizes'];
|
|
151
161
|
function setSourceProps(sourceEl, targetEl) {
|
|
152
|
-
srcProps.forEach(prop => {
|
|
162
|
+
srcProps.forEach((prop) => {
|
|
153
163
|
const value = data(sourceEl, prop);
|
|
154
164
|
if (value) {
|
|
155
165
|
attr(targetEl, prop.replace(/^(data-)+/, ''), value);
|
|
@@ -158,31 +168,27 @@ function setSourceProps(sourceEl, targetEl) {
|
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
function getImageFromElement(el, src, sources) {
|
|
161
|
-
|
|
162
|
-
if (!src) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
171
|
const img = new Image();
|
|
167
172
|
|
|
168
173
|
wrapInPicture(img, sources);
|
|
169
174
|
setSourceProps(el, img);
|
|
170
|
-
img.onload = () =>
|
|
175
|
+
img.onload = () => {
|
|
176
|
+
setSrcAttrs(el, img.currentSrc);
|
|
177
|
+
};
|
|
171
178
|
attr(img, 'src', src);
|
|
172
179
|
return img;
|
|
173
180
|
}
|
|
174
181
|
|
|
175
182
|
function wrapInPicture(img, sources) {
|
|
176
|
-
|
|
177
183
|
sources = parseSources(sources);
|
|
178
184
|
|
|
179
185
|
if (sources.length) {
|
|
180
186
|
const picture = fragment('<picture>');
|
|
181
|
-
|
|
187
|
+
for (const attrs of sources) {
|
|
182
188
|
const source = fragment('<source>');
|
|
183
189
|
attr(source, attrs);
|
|
184
190
|
append(picture, source);
|
|
185
|
-
}
|
|
191
|
+
}
|
|
186
192
|
append(picture, img);
|
|
187
193
|
}
|
|
188
194
|
}
|
|
@@ -206,7 +212,7 @@ function parseSources(sources) {
|
|
|
206
212
|
sources = [sources];
|
|
207
213
|
}
|
|
208
214
|
|
|
209
|
-
return sources.filter(source => !isEmpty(source));
|
|
215
|
+
return sources.filter((source) => !isEmpty(source));
|
|
210
216
|
}
|
|
211
217
|
|
|
212
218
|
const sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
|
|
@@ -230,11 +236,11 @@ const additionRe = /[+-]?(\d+)/g;
|
|
|
230
236
|
function evaluateSize(size) {
|
|
231
237
|
return startsWith(size, 'calc')
|
|
232
238
|
? size
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
239
|
+
.slice(5, -1)
|
|
240
|
+
.replace(sizeRe, (size) => toPx(size))
|
|
241
|
+
.replace(/ /g, '')
|
|
242
|
+
.match(additionRe)
|
|
243
|
+
.reduce((a, b) => a + +b, 0)
|
|
238
244
|
: size;
|
|
239
245
|
}
|
|
240
246
|
|
|
@@ -243,7 +249,7 @@ function getSourceSize(srcset, sizes) {
|
|
|
243
249
|
const srcSize = toPx(sizesToPixel(sizes));
|
|
244
250
|
const descriptors = (srcset.match(srcSetRe) || []).map(toFloat).sort((a, b) => a - b);
|
|
245
251
|
|
|
246
|
-
return descriptors.filter(size => size >= srcSize)[0] || descriptors.pop() || '';
|
|
252
|
+
return descriptors.filter((size) => size >= srcSize)[0] || descriptors.pop() || '';
|
|
247
253
|
}
|
|
248
254
|
|
|
249
255
|
function ensureSrcAttribute(el) {
|
|
@@ -253,13 +259,9 @@ function ensureSrcAttribute(el) {
|
|
|
253
259
|
}
|
|
254
260
|
|
|
255
261
|
function isPicture(el) {
|
|
256
|
-
return
|
|
262
|
+
return isTag(el, 'picture');
|
|
257
263
|
}
|
|
258
264
|
|
|
259
265
|
function isImg(el) {
|
|
260
|
-
return
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function isA(el, tagName) {
|
|
264
|
-
return el && el.tagName === tagName;
|
|
266
|
+
return isTag(el, 'img');
|
|
265
267
|
}
|
package/src/js/core/index.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
export {default as Accordion} from './accordion';
|
|
2
|
-
export {default as Alert} from './alert';
|
|
3
|
-
export {default as Cover} from './cover';
|
|
4
|
-
export {default as Drop, default as Dropdown} from './drop';
|
|
5
|
-
export {default as FormCustom} from './form-custom';
|
|
6
|
-
export {default as Gif} from './gif';
|
|
7
|
-
export {default as Grid} from './grid';
|
|
8
|
-
export {default as HeightMatch} from './height-match';
|
|
9
|
-
export {default as HeightViewport} from './height-viewport';
|
|
10
|
-
export {default as Icon} from './icon';
|
|
11
|
-
export {default as Img} from './img';
|
|
12
|
-
export {default as Leader} from './leader';
|
|
13
|
-
export {default as Margin} from './margin';
|
|
14
|
-
export {default as Modal} from './modal';
|
|
15
|
-
export {default as Nav} from './nav';
|
|
16
|
-
export {default as Navbar} from './navbar';
|
|
17
|
-
export {default as Offcanvas} from './offcanvas';
|
|
18
|
-
export {default as OverflowAuto} from './overflow-auto';
|
|
19
|
-
export {default as Responsive} from './responsive';
|
|
20
|
-
export {default as Scroll} from './scroll';
|
|
21
|
-
export {default as Scrollspy} from './scrollspy';
|
|
22
|
-
export {default as ScrollspyNav} from './scrollspy-nav';
|
|
23
|
-
export {default as Sticky} from './sticky';
|
|
24
|
-
export {default as Svg} from './svg';
|
|
25
|
-
export {default as Switcher} from './switcher';
|
|
26
|
-
export {default as Tab} from './tab';
|
|
27
|
-
export {default as Toggle} from './toggle';
|
|
28
|
-
export {default as Video} from './video';
|
|
1
|
+
export { default as Accordion } from './accordion';
|
|
2
|
+
export { default as Alert } from './alert';
|
|
3
|
+
export { default as Cover } from './cover';
|
|
4
|
+
export { default as Drop, default as Dropdown } from './drop';
|
|
5
|
+
export { default as FormCustom } from './form-custom';
|
|
6
|
+
export { default as Gif } from './gif';
|
|
7
|
+
export { default as Grid } from './grid';
|
|
8
|
+
export { default as HeightMatch } from './height-match';
|
|
9
|
+
export { default as HeightViewport } from './height-viewport';
|
|
10
|
+
export { default as Icon } from './icon';
|
|
11
|
+
export { default as Img } from './img';
|
|
12
|
+
export { default as Leader } from './leader';
|
|
13
|
+
export { default as Margin } from './margin';
|
|
14
|
+
export { default as Modal } from './modal';
|
|
15
|
+
export { default as Nav } from './nav';
|
|
16
|
+
export { default as Navbar } from './navbar';
|
|
17
|
+
export { default as Offcanvas } from './offcanvas';
|
|
18
|
+
export { default as OverflowAuto } from './overflow-auto';
|
|
19
|
+
export { default as Responsive } from './responsive';
|
|
20
|
+
export { default as Scroll } from './scroll';
|
|
21
|
+
export { default as Scrollspy } from './scrollspy';
|
|
22
|
+
export { default as ScrollspyNav } from './scrollspy-nav';
|
|
23
|
+
export { default as Sticky } from './sticky';
|
|
24
|
+
export { default as Svg } from './svg';
|
|
25
|
+
export { default as Switcher } from './switcher';
|
|
26
|
+
export { default as Tab } from './tab';
|
|
27
|
+
export { default as Toggle } from './toggle';
|
|
28
|
+
export { default as Video } from './video';
|
|
29
29
|
|
|
30
30
|
// Icon components
|
|
31
|
-
export {Close} from './icon';
|
|
32
|
-
export {Spinner} from './icon';
|
|
33
|
-
export {Slidenav as SlidenavNext} from './icon';
|
|
34
|
-
export {Slidenav as SlidenavPrevious} from './icon';
|
|
35
|
-
export {Search as SearchIcon} from './icon';
|
|
36
|
-
export {IconComponent as Marker} from './icon';
|
|
37
|
-
export {IconComponent as NavbarToggleIcon} from './icon';
|
|
38
|
-
export {IconComponent as OverlayIcon} from './icon';
|
|
39
|
-
export {IconComponent as PaginationNext} from './icon';
|
|
40
|
-
export {IconComponent as PaginationPrevious} from './icon';
|
|
41
|
-
export {IconComponent as Totop} from './icon';
|
|
31
|
+
export { Close } from './icon';
|
|
32
|
+
export { Spinner } from './icon';
|
|
33
|
+
export { Slidenav as SlidenavNext } from './icon';
|
|
34
|
+
export { Slidenav as SlidenavPrevious } from './icon';
|
|
35
|
+
export { Search as SearchIcon } from './icon';
|
|
36
|
+
export { IconComponent as Marker } from './icon';
|
|
37
|
+
export { IconComponent as NavbarToggleIcon } from './icon';
|
|
38
|
+
export { IconComponent as OverlayIcon } from './icon';
|
|
39
|
+
export { IconComponent as PaginationNext } from './icon';
|
|
40
|
+
export { IconComponent as PaginationPrevious } from './icon';
|
|
41
|
+
export { IconComponent as Totop } from './icon';
|
package/src/js/core/leader.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Media from '../mixin/media';
|
|
3
|
-
import {attr, getCssVar, toggleClass, unwrap, wrapInner} from 'uikit-util';
|
|
3
|
+
import { attr, getCssVar, toggleClass, unwrap, wrapInner } from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
|
|
7
6
|
mixins: [Class, Media],
|
|
8
7
|
|
|
9
8
|
props: {
|
|
10
|
-
fill: String
|
|
9
|
+
fill: String,
|
|
11
10
|
},
|
|
12
11
|
|
|
13
12
|
data: {
|
|
14
13
|
fill: '',
|
|
15
14
|
clsWrapper: 'uk-leader-fill',
|
|
16
15
|
clsHide: 'uk-leader-hide',
|
|
17
|
-
attrFill: 'data-fill'
|
|
16
|
+
attrFill: 'data-fill',
|
|
18
17
|
},
|
|
19
18
|
|
|
20
19
|
computed: {
|
|
21
|
-
|
|
22
|
-
fill({fill}) {
|
|
20
|
+
fill({ fill }) {
|
|
23
21
|
return fill || getCssVar('leader-fill-content');
|
|
24
|
-
}
|
|
25
|
-
|
|
22
|
+
},
|
|
26
23
|
},
|
|
27
24
|
|
|
28
25
|
connected() {
|
|
@@ -34,9 +31,7 @@ export default {
|
|
|
34
31
|
},
|
|
35
32
|
|
|
36
33
|
update: {
|
|
37
|
-
|
|
38
|
-
read({changed, width}) {
|
|
39
|
-
|
|
34
|
+
read({ changed, width }) {
|
|
40
35
|
const prev = width;
|
|
41
36
|
|
|
42
37
|
width = Math.floor(this.$el.offsetWidth / 2);
|
|
@@ -45,23 +40,19 @@ export default {
|
|
|
45
40
|
width,
|
|
46
41
|
fill: this.fill,
|
|
47
42
|
changed: changed || prev !== width,
|
|
48
|
-
hide: !this.matchMedia
|
|
43
|
+
hide: !this.matchMedia,
|
|
49
44
|
};
|
|
50
45
|
},
|
|
51
46
|
|
|
52
47
|
write(data) {
|
|
53
|
-
|
|
54
48
|
toggleClass(this.wrapper, this.clsHide, data.hide);
|
|
55
49
|
|
|
56
50
|
if (data.changed) {
|
|
57
51
|
data.changed = false;
|
|
58
52
|
attr(this.wrapper, this.attrFill, new Array(data.width).join(data.fill));
|
|
59
53
|
}
|
|
60
|
-
|
|
61
54
|
},
|
|
62
55
|
|
|
63
|
-
events: ['resize']
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
56
|
+
events: ['resize'],
|
|
57
|
+
},
|
|
67
58
|
};
|