uikit 3.9.3 → 3.9.5-dev.600ee2ba9
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 +13 -0
- package/build/build.js +4 -1
- package/build/util.js +4 -1
- package/dist/css/uikit-core-rtl.css +1 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +1 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +1 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +1 -1
- 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 +1 -1
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +1 -1
- 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 +1 -1
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +1 -1
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +1 -1
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +1 -1
- package/dist/js/components/slideshow-parallax.min.js +1 -1
- package/dist/js/components/slideshow.js +1 -1
- 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 +1 -1
- 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 +62 -53
- 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 +62 -53
- package/dist/js/uikit.min.js +1 -1
- package/package.json +2 -2
- package/src/js/core/drop.js +3 -2
- package/src/js/core/img.js +57 -40
- package/src/js/core/sticky.js +3 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "uikit",
|
|
3
3
|
"title": "UIkit",
|
|
4
4
|
"description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
|
|
5
|
-
"version": "3.9.
|
|
5
|
+
"version": "3.9.5-dev.600ee2ba9",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"prefix": "node build/prefix",
|
|
21
21
|
"scope": "node build/scope",
|
|
22
22
|
"release": "node build/release",
|
|
23
|
-
"watch
|
|
23
|
+
"watch": "watch-run -i -p 'src/less/**/*.less' yarn compile-less",
|
|
24
24
|
"eslint": "eslint src/js",
|
|
25
25
|
"eslint-fix": "eslint --fix src/js"
|
|
26
26
|
},
|
package/src/js/core/drop.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Container from '../mixin/container';
|
|
2
2
|
import Position from '../mixin/position';
|
|
3
3
|
import Togglable from '../mixin/togglable';
|
|
4
|
-
import {addClass, append, apply, css, hasClass, includes, isTouch, matches, MouseTracker, offset, on, once, parent, pointerCancel, pointerDown, pointerEnter, pointerLeave, pointerUp, query, removeClass, toggleClass, within} from 'uikit-util';
|
|
4
|
+
import {addClass, append, apply, attr, css, hasClass, includes, isTouch, matches, MouseTracker, offset, on, once, parent, pointerCancel, pointerDown, pointerEnter, pointerLeave, pointerUp, query, removeClass, toggleClass, within} from 'uikit-util';
|
|
5
5
|
|
|
6
6
|
export let active;
|
|
7
7
|
|
|
@@ -62,7 +62,8 @@ export default {
|
|
|
62
62
|
this.target = this.$create('toggle', query(this.toggle, this.$el), {
|
|
63
63
|
target: this.$el,
|
|
64
64
|
mode: this.mode
|
|
65
|
-
});
|
|
65
|
+
}).$el;
|
|
66
|
+
attr(this.target, 'aria-haspopup', true);
|
|
66
67
|
}
|
|
67
68
|
|
|
68
69
|
},
|
package/src/js/core/img.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createEvent, css, Dimensions, escape, getImage, includes, isUndefined, queryAll, startsWith, toFloat, toPx, trigger} from 'uikit-util';
|
|
1
|
+
import {attr, children, createEvent, css, data, Dimensions, escape, getImage, includes, isUndefined, once, parent, queryAll, startsWith, toFloat, toPx, trigger} from 'uikit-util';
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
|
|
@@ -6,8 +6,6 @@ export default {
|
|
|
6
6
|
|
|
7
7
|
props: {
|
|
8
8
|
dataSrc: String,
|
|
9
|
-
dataSrcset: Boolean,
|
|
10
|
-
sizes: String,
|
|
11
9
|
width: Number,
|
|
12
10
|
height: Number,
|
|
13
11
|
offsetTop: String,
|
|
@@ -17,8 +15,6 @@ export default {
|
|
|
17
15
|
|
|
18
16
|
data: {
|
|
19
17
|
dataSrc: '',
|
|
20
|
-
dataSrcset: false,
|
|
21
|
-
sizes: false,
|
|
22
18
|
width: false,
|
|
23
19
|
height: false,
|
|
24
20
|
offsetTop: '50vh',
|
|
@@ -32,22 +28,6 @@ export default {
|
|
|
32
28
|
return `${this.$name}.${dataSrc}`;
|
|
33
29
|
},
|
|
34
30
|
|
|
35
|
-
width({width, dataWidth}) {
|
|
36
|
-
return width || dataWidth;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
height({height, dataHeight}) {
|
|
40
|
-
return height || dataHeight;
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
sizes({sizes, dataSizes}) {
|
|
44
|
-
return sizes || dataSizes;
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
isImg(_, $el) {
|
|
48
|
-
return isImg($el);
|
|
49
|
-
},
|
|
50
|
-
|
|
51
31
|
target: {
|
|
52
32
|
|
|
53
33
|
get({target}) {
|
|
@@ -73,14 +53,14 @@ export default {
|
|
|
73
53
|
connected() {
|
|
74
54
|
|
|
75
55
|
if (!window.IntersectionObserver) {
|
|
76
|
-
setSrcAttrs(this.$el
|
|
56
|
+
setSrcAttrs(this.$el);
|
|
77
57
|
return;
|
|
78
58
|
}
|
|
79
59
|
|
|
80
60
|
if (storage[this.cacheKey]) {
|
|
81
|
-
setSrcAttrs(this.$el, storage[this.cacheKey]
|
|
82
|
-
} else if (this
|
|
83
|
-
|
|
61
|
+
setSrcAttrs(this.$el, storage[this.cacheKey]);
|
|
62
|
+
} else if (isImg(this.$el) && this.width && this.height) {
|
|
63
|
+
attr(this.$el, 'src', getPlaceholderImage(this.$el));
|
|
84
64
|
}
|
|
85
65
|
|
|
86
66
|
this.observer = new IntersectionObserver(this.load, {
|
|
@@ -107,7 +87,7 @@ export default {
|
|
|
107
87
|
this.load(this.observer.takeRecords());
|
|
108
88
|
}
|
|
109
89
|
|
|
110
|
-
if (this
|
|
90
|
+
if (isImg(this.$el)) {
|
|
111
91
|
return false;
|
|
112
92
|
}
|
|
113
93
|
|
|
@@ -115,14 +95,15 @@ export default {
|
|
|
115
95
|
|
|
116
96
|
},
|
|
117
97
|
|
|
118
|
-
write(
|
|
98
|
+
write(store) {
|
|
119
99
|
|
|
120
|
-
|
|
100
|
+
const srcset = data(this.$el, 'data-srcset');
|
|
101
|
+
if (srcset && window.devicePixelRatio !== 1) {
|
|
121
102
|
|
|
122
103
|
const bgSize = css(this.$el, 'backgroundSize');
|
|
123
|
-
if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) ===
|
|
124
|
-
|
|
125
|
-
css(this.$el, 'backgroundSize', `${
|
|
104
|
+
if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
|
|
105
|
+
store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
|
|
106
|
+
css(this.$el, 'backgroundSize', `${store.bgSize}px`);
|
|
126
107
|
}
|
|
127
108
|
|
|
128
109
|
}
|
|
@@ -142,9 +123,9 @@ export default {
|
|
|
142
123
|
return;
|
|
143
124
|
}
|
|
144
125
|
|
|
145
|
-
this._data.image =
|
|
126
|
+
this._data.image = getImageFromElement(this.$el, this.dataSrc).then(img => {
|
|
146
127
|
|
|
147
|
-
setSrcAttrs(this.$el, currentSrc(img)
|
|
128
|
+
setSrcAttrs(this.$el, currentSrc(img));
|
|
148
129
|
storage[this.cacheKey] = currentSrc(img);
|
|
149
130
|
return img;
|
|
150
131
|
|
|
@@ -163,13 +144,20 @@ export default {
|
|
|
163
144
|
|
|
164
145
|
};
|
|
165
146
|
|
|
166
|
-
|
|
147
|
+
const srcProps = ['data-src', 'data-srcset', 'sizes'];
|
|
148
|
+
function setSrcAttrs(el, src) {
|
|
167
149
|
|
|
150
|
+
const parentNode = parent(el);
|
|
168
151
|
if (isImg(el)) {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
152
|
+
(isPicture(parentNode) ? children(parentNode) : [el]).forEach(el =>
|
|
153
|
+
srcProps.forEach(prop => {
|
|
154
|
+
const value = data(el, prop);
|
|
155
|
+
if (value) {
|
|
156
|
+
attr(el, prop.replace(/^(data-)+/, ''), value);
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
);
|
|
160
|
+
attr(el, 'src', src);
|
|
173
161
|
} else if (src) {
|
|
174
162
|
|
|
175
163
|
const change = !includes(el.style.backgroundImage, src);
|
|
@@ -182,7 +170,10 @@ function setSrcAttrs(el, src, srcset, sizes) {
|
|
|
182
170
|
|
|
183
171
|
}
|
|
184
172
|
|
|
185
|
-
function getPlaceholderImage(
|
|
173
|
+
function getPlaceholderImage(el) {
|
|
174
|
+
const sizes = data(el, 'sizes');
|
|
175
|
+
let width = data(el, 'width');
|
|
176
|
+
let height = data(el, 'height');
|
|
186
177
|
|
|
187
178
|
if (sizes) {
|
|
188
179
|
({width, height} = Dimensions.ratio({width, height}, 'width', toPx(sizesToPixel(sizes))));
|
|
@@ -207,6 +198,24 @@ function sizesToPixel(sizes) {
|
|
|
207
198
|
return matches || '100vw';
|
|
208
199
|
}
|
|
209
200
|
|
|
201
|
+
function getImageFromElement(el, src) {
|
|
202
|
+
const parentNode = parent(el);
|
|
203
|
+
|
|
204
|
+
if (!src) {
|
|
205
|
+
return Promise.reject(createEvent('error', false));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (!isPicture(parentNode)) {
|
|
209
|
+
return getImage(src, ...srcProps.slice(1).map(prop => data(el, prop)));
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return new Promise((resolve, reject) => {
|
|
213
|
+
const picture = parentNode.cloneNode(true);
|
|
214
|
+
once(picture, 'load error', e => e.type === 'error' ? reject(e) : resolve(e.target), true);
|
|
215
|
+
setSrcAttrs(el);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
210
219
|
const sizeRe = /\d+(?:\w+|%)/g;
|
|
211
220
|
const additionRe = /[+-]?(\d+)/g;
|
|
212
221
|
function evaluateSize(size) {
|
|
@@ -228,8 +237,16 @@ function getSourceSize(srcset, sizes) {
|
|
|
228
237
|
return descriptors.filter(size => size >= srcSize)[0] || descriptors.pop() || '';
|
|
229
238
|
}
|
|
230
239
|
|
|
240
|
+
function isPicture(el) {
|
|
241
|
+
return isA(el, 'PICTURE');
|
|
242
|
+
}
|
|
243
|
+
|
|
231
244
|
function isImg(el) {
|
|
232
|
-
return el
|
|
245
|
+
return isA(el, 'IMG');
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function isA(el, tagName) {
|
|
249
|
+
return el && el.tagName === tagName;
|
|
233
250
|
}
|
|
234
251
|
|
|
235
252
|
function currentSrc(el) {
|
package/src/js/core/sticky.js
CHANGED
|
@@ -146,9 +146,10 @@ export default {
|
|
|
146
146
|
|
|
147
147
|
height = !this.isActive ? this.$el.offsetHeight : height;
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
const referenceElement = this.isFixed ? this.placeholder : this.$el;
|
|
150
|
+
this.topOffset = offset(referenceElement).top;
|
|
150
151
|
this.bottomOffset = this.topOffset + height;
|
|
151
|
-
this.offsetParentTop = offset(
|
|
152
|
+
this.offsetParentTop = offset(referenceElement.offsetParent).top;
|
|
152
153
|
|
|
153
154
|
const bottom = parseProp('bottom', this);
|
|
154
155
|
|