uikit 3.11.2-dev.ec95eb0c7 → 3.11.2-dev.f2970ffaa
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 +6 -2
- 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 +32 -25
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +32 -25
- package/dist/js/components/slider-parallax.min.js +1 -1
- package/dist/js/components/slider.js +3 -3
- package/dist/js/components/slider.min.js +1 -1
- package/dist/js/components/slideshow-parallax.js +32 -25
- 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 +2 -3
- 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 +77 -44
- 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 +137 -98
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/components/slider.js +2 -2
- package/src/js/components/sortable.js +1 -2
- package/src/js/core/core.js +2 -2
- package/src/js/core/height-viewport.js +2 -2
- package/src/js/core/sticky.js +47 -34
- package/src/js/mixin/parallax.js +32 -21
- package/src/js/util/fastdom.js +2 -2
- package/src/js/util/viewport.js +7 -3
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.11.2-dev.
|
|
5
|
+
"version": "3.11.2-dev.f2970ffaa",
|
|
6
6
|
"main": "dist/js/uikit.js",
|
|
7
7
|
"style": "dist/css/uikit.css",
|
|
8
8
|
"sideEffects": [
|
|
@@ -30,7 +30,7 @@ export default {
|
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
finite({finite}) {
|
|
33
|
-
return finite || Math.ceil(getWidth(this.list)) < Math.floor(dimensions(this.list).width + getMaxElWidth(this.list));
|
|
33
|
+
return finite || Math.ceil(getWidth(this.list)) < Math.floor(dimensions(this.list).width + getMaxElWidth(this.list) + this.center);
|
|
34
34
|
},
|
|
35
35
|
|
|
36
36
|
maxIndex() {
|
|
@@ -212,7 +212,7 @@ export default {
|
|
|
212
212
|
let width = dimensions(this.list).width / 2 - dimensions(next).width / 2;
|
|
213
213
|
let j = 0;
|
|
214
214
|
|
|
215
|
-
while (
|
|
215
|
+
while (width > 0) {
|
|
216
216
|
const slideIndex = this.getIndex(--j + index, index);
|
|
217
217
|
const slide = this.slides[slideIndex];
|
|
218
218
|
|
|
@@ -218,7 +218,6 @@ export default {
|
|
|
218
218
|
|
|
219
219
|
off(document, pointerMove, this.move);
|
|
220
220
|
off(document, pointerUp, this.end);
|
|
221
|
-
off(window, 'scroll', this.scroll);
|
|
222
221
|
|
|
223
222
|
if (!this.drag) {
|
|
224
223
|
return;
|
|
@@ -295,7 +294,7 @@ function trackScroll(pos) {
|
|
|
295
294
|
trackTimer = setInterval(() => {
|
|
296
295
|
|
|
297
296
|
let {x, y} = pos;
|
|
298
|
-
y += window
|
|
297
|
+
y += scrollTop(window);
|
|
299
298
|
|
|
300
299
|
const dist = (Date.now() - last) * .3;
|
|
301
300
|
last = Date.now();
|
package/src/js/core/core.js
CHANGED
|
@@ -13,7 +13,7 @@ export default function (UIkit) {
|
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
15
|
pendingResize = true;
|
|
16
|
-
fastdom.
|
|
16
|
+
fastdom.read(() => pendingResize = false);
|
|
17
17
|
UIkit.update(null, 'resize');
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -32,7 +32,7 @@ export default function (UIkit) {
|
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
pending = true;
|
|
35
|
-
fastdom.
|
|
35
|
+
fastdom.read(() => pending = false);
|
|
36
36
|
|
|
37
37
|
UIkit.update(null, e.type);
|
|
38
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import FlexBug from '../mixin/flex-bug';
|
|
2
|
-
import {boxModelAdjust, css, dimensions, endsWith, height, isNumeric, isString, isVisible, offset, query, toFloat} from 'uikit-util';
|
|
2
|
+
import {boxModelAdjust, css, dimensions, endsWith, height, isNumeric, isString, isVisible, offset, query, toFloat, trigger} from 'uikit-util';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
|
|
@@ -76,7 +76,7 @@ export default {
|
|
|
76
76
|
css(this.$el, {minHeight});
|
|
77
77
|
|
|
78
78
|
if (minHeight !== prev) {
|
|
79
|
-
|
|
79
|
+
trigger(this.$el, 'resize');
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
|
package/src/js/core/sticky.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Class from '../mixin/class';
|
|
2
2
|
import Media from '../mixin/media';
|
|
3
|
-
import {$, addClass, after, Animation, assign, css, dimensions, fastdom, height as getHeight, hasClass, isNumeric, isString, isVisible, noop, offset, offsetPosition, parent, query, remove, removeClass, replaceClass, scrollTop, toFloat, toggleClass, toPx, trigger, within} from 'uikit-util';
|
|
3
|
+
import {$, addClass, after, Animation, assign, clamp, css, dimensions, fastdom, height as getHeight, getScrollingElement, hasClass, isNumeric, isString, isVisible, noop, offset, offsetPosition, parent, query, remove, removeClass, replaceClass, scrollTop, toFloat, toggleClass, toPx, trigger, within} from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
|
|
@@ -100,7 +100,7 @@ export default {
|
|
|
100
100
|
|
|
101
101
|
handler() {
|
|
102
102
|
|
|
103
|
-
if (!(this.targetOffset !== false && location.hash && window
|
|
103
|
+
if (!(this.targetOffset !== false && location.hash && scrollTop(window) > 0)) {
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -146,24 +146,26 @@ export default {
|
|
|
146
146
|
|
|
147
147
|
height = this.isActive ? height : this.$el.offsetHeight;
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
this.inactive = true;
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
149
|
+
const overflow = Math.max(0, height + this.offset - getHeight(window));
|
|
153
150
|
|
|
154
151
|
const referenceElement = this.isFixed ? this.placeholder : this.$el;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
this.offsetParentTop = offset(referenceElement.offsetParent).top;
|
|
152
|
+
const topOffset = offset(referenceElement).top;
|
|
153
|
+
const offsetParentTop = offset(referenceElement.offsetParent).top;
|
|
158
154
|
|
|
159
155
|
const bottom = parseProp('bottom', this);
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
156
|
+
const start = Math.max(toFloat(parseProp('top', this)), topOffset) - this.offset;
|
|
157
|
+
const end = bottom
|
|
158
|
+
? bottom - this.$el.offsetHeight + overflow - this.offset
|
|
159
|
+
: getScrollingElement(this.$el).scrollHeight - getHeight(window);
|
|
164
160
|
|
|
165
161
|
return {
|
|
162
|
+
start,
|
|
163
|
+
end,
|
|
164
|
+
overflow,
|
|
165
|
+
topOffset,
|
|
166
|
+
offsetParentTop,
|
|
166
167
|
height,
|
|
168
|
+
width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).width,
|
|
167
169
|
top: offsetPosition(this.placeholder)[0],
|
|
168
170
|
margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
|
|
169
171
|
};
|
|
@@ -190,42 +192,48 @@ export default {
|
|
|
190
192
|
|
|
191
193
|
{
|
|
192
194
|
|
|
193
|
-
read({scroll = 0}) {
|
|
195
|
+
read({scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end}) {
|
|
194
196
|
|
|
195
|
-
|
|
197
|
+
const scroll = scrollTop(window);
|
|
198
|
+
const dir = prevScroll <= scroll ? 'down' : 'up';
|
|
196
199
|
|
|
197
200
|
return {
|
|
198
|
-
dir
|
|
199
|
-
|
|
201
|
+
dir,
|
|
202
|
+
prevDir,
|
|
203
|
+
scroll,
|
|
204
|
+
prevScroll,
|
|
205
|
+
overflowScroll: clamp(
|
|
206
|
+
overflowScroll
|
|
207
|
+
+ clamp(scroll, start, end)
|
|
208
|
+
- clamp(prevScroll, start, end),
|
|
209
|
+
0,
|
|
210
|
+
overflow
|
|
211
|
+
)
|
|
200
212
|
};
|
|
201
213
|
},
|
|
202
214
|
|
|
203
215
|
write(data, types) {
|
|
204
216
|
|
|
205
|
-
const now = Date.now();
|
|
206
217
|
const isScrollUpdate = types.has('scroll');
|
|
207
|
-
const {initTimestamp = 0, dir,
|
|
208
|
-
|
|
209
|
-
data.lastScroll = scroll;
|
|
218
|
+
const {initTimestamp = 0, dir, prevDir, scroll, prevScroll = 0, top, start, topOffset, height} = data;
|
|
210
219
|
|
|
211
|
-
if (scroll < 0 || scroll ===
|
|
220
|
+
if (scroll < 0 || scroll === prevScroll && isScrollUpdate || this.showOnUp && !isScrollUpdate && !this.isFixed) {
|
|
212
221
|
return;
|
|
213
222
|
}
|
|
214
223
|
|
|
215
|
-
|
|
224
|
+
const now = Date.now();
|
|
225
|
+
if (now - initTimestamp > 300 || dir !== prevDir) {
|
|
216
226
|
data.initScroll = scroll;
|
|
217
227
|
data.initTimestamp = now;
|
|
218
228
|
}
|
|
219
229
|
|
|
220
|
-
data.
|
|
221
|
-
|
|
222
|
-
if (this.showOnUp && !this.isFixed && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(lastScroll - scroll) <= 10) {
|
|
230
|
+
if (this.showOnUp && !this.isFixed && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(prevScroll - scroll) <= 10) {
|
|
223
231
|
return;
|
|
224
232
|
}
|
|
225
233
|
|
|
226
234
|
if (this.inactive
|
|
227
|
-
|| scroll <
|
|
228
|
-
|| this.showOnUp && (scroll <=
|
|
235
|
+
|| scroll < start
|
|
236
|
+
|| this.showOnUp && (scroll <= start || dir === 'down' && isScrollUpdate || dir === 'up' && !this.isFixed && scroll <= topOffset + height)
|
|
229
237
|
) {
|
|
230
238
|
|
|
231
239
|
if (!this.isFixed) {
|
|
@@ -240,7 +248,7 @@ export default {
|
|
|
240
248
|
|
|
241
249
|
this.isFixed = false;
|
|
242
250
|
|
|
243
|
-
if (this.animation && scroll >
|
|
251
|
+
if (this.animation && scroll > topOffset) {
|
|
244
252
|
Animation.cancel(this.$el);
|
|
245
253
|
Animation.out(this.$el, this.animation).then(() => this.hide(), noop);
|
|
246
254
|
} else {
|
|
@@ -290,23 +298,28 @@ export default {
|
|
|
290
298
|
|
|
291
299
|
update() {
|
|
292
300
|
|
|
293
|
-
const
|
|
301
|
+
const {width, scroll = 0, overflow, overflowScroll = 0, start, end, topOffset, height, offsetParentTop} = this._data;
|
|
302
|
+
const active = start !== 0 || scroll > start;
|
|
294
303
|
let top = Math.max(0, this.offset);
|
|
295
304
|
let position = 'fixed';
|
|
296
305
|
|
|
297
|
-
if (
|
|
298
|
-
top = this.
|
|
306
|
+
if (scroll > end) {
|
|
307
|
+
top = end + this.offset - offsetParentTop;
|
|
299
308
|
position = 'absolute';
|
|
300
309
|
}
|
|
301
310
|
|
|
311
|
+
if (overflow) {
|
|
312
|
+
top -= overflowScroll;
|
|
313
|
+
}
|
|
314
|
+
|
|
302
315
|
css(this.$el, {
|
|
303
316
|
position,
|
|
304
317
|
top: `${top}px`,
|
|
305
|
-
width
|
|
318
|
+
width
|
|
306
319
|
});
|
|
307
320
|
|
|
308
321
|
this.isActive = active;
|
|
309
|
-
toggleClass(this.$el, this.clsBelow,
|
|
322
|
+
toggleClass(this.$el, this.clsBelow, scroll > topOffset + height);
|
|
310
323
|
addClass(this.$el, this.clsFixed);
|
|
311
324
|
|
|
312
325
|
}
|
package/src/js/mixin/parallax.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Media from '../mixin/media';
|
|
2
2
|
import {getMaxPathLength} from '../core/svg';
|
|
3
|
-
import {css, Dimensions, each, isNumber, isString, isUndefined, noop, startsWith, toFloat, toPx, ucfirst} from 'uikit-util';
|
|
3
|
+
import {css, Dimensions, each, isNumber, isString, isUndefined, noop, startsWith, toFloat, toPx, trigger, ucfirst} from 'uikit-util';
|
|
4
4
|
|
|
5
5
|
const props = {
|
|
6
6
|
x: transformFn,
|
|
@@ -38,7 +38,7 @@ export default {
|
|
|
38
38
|
props(properties, $el) {
|
|
39
39
|
return keys(props).reduce((result, prop) => {
|
|
40
40
|
if (!isUndefined(properties[prop])) {
|
|
41
|
-
result[prop] = props[prop]
|
|
41
|
+
result[prop] = props[prop](prop, $el, properties[prop].slice());
|
|
42
42
|
}
|
|
43
43
|
return result;
|
|
44
44
|
}, {});
|
|
@@ -46,6 +46,12 @@ export default {
|
|
|
46
46
|
|
|
47
47
|
},
|
|
48
48
|
|
|
49
|
+
events: {
|
|
50
|
+
bgimageload() {
|
|
51
|
+
this.$emit();
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
|
|
49
55
|
methods: {
|
|
50
56
|
|
|
51
57
|
reset() {
|
|
@@ -186,15 +192,15 @@ function backgroundFn(prop, el, steps) {
|
|
|
186
192
|
const bgPos = css(el, 'backgroundPosition').split(' ')[prop === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
|
|
187
193
|
|
|
188
194
|
return getCssValue(el, 'backgroundSize', '') === 'cover'
|
|
189
|
-
? backgroundCoverFn
|
|
195
|
+
? backgroundCoverFn(prop, el, steps, bgPos, attr)
|
|
190
196
|
: setBackgroundPosFn(prop, steps, bgPos);
|
|
191
197
|
}
|
|
192
198
|
|
|
193
199
|
function backgroundCoverFn(prop, el, steps, bgPos, attr) {
|
|
194
200
|
|
|
195
|
-
const
|
|
201
|
+
const dimImage = getBackgroundImageDimensions(el);
|
|
196
202
|
|
|
197
|
-
if (!
|
|
203
|
+
if (!dimImage.width) {
|
|
198
204
|
return noop;
|
|
199
205
|
}
|
|
200
206
|
|
|
@@ -210,11 +216,6 @@ function backgroundCoverFn(prop, el, steps, bgPos, attr) {
|
|
|
210
216
|
height: el.offsetHeight
|
|
211
217
|
};
|
|
212
218
|
|
|
213
|
-
const dimImage = {
|
|
214
|
-
width: image.naturalWidth,
|
|
215
|
-
height: image.naturalHeight
|
|
216
|
-
};
|
|
217
|
-
|
|
218
219
|
const baseDim = Dimensions.cover(dimImage, dimEl);
|
|
219
220
|
const span = baseDim[attr] - dimEl[attr];
|
|
220
221
|
|
|
@@ -245,24 +246,34 @@ function setBackgroundPosFn(prop, steps, pos) {
|
|
|
245
246
|
};
|
|
246
247
|
}
|
|
247
248
|
|
|
248
|
-
|
|
249
|
+
const dimensions = {};
|
|
250
|
+
function getBackgroundImageDimensions(el) {
|
|
249
251
|
const src = css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
|
|
250
252
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
if (data[src]) {
|
|
254
|
-
return data[src];
|
|
253
|
+
if (dimensions[src]) {
|
|
254
|
+
return dimensions[src];
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
const image = new Image();
|
|
257
258
|
if (src) {
|
|
258
|
-
|
|
259
|
-
img.src = src;
|
|
260
|
-
if (!img.naturalWidth) {
|
|
261
|
-
img.onload = () => this.$update();
|
|
262
|
-
}
|
|
259
|
+
image.src = src;
|
|
263
260
|
|
|
264
|
-
|
|
261
|
+
if (!image.naturalWidth) {
|
|
262
|
+
image.onload = () => {
|
|
263
|
+
dimensions[src] = toDimensions(image);
|
|
264
|
+
trigger(el, 'bgimageload');
|
|
265
|
+
};
|
|
266
|
+
}
|
|
265
267
|
}
|
|
268
|
+
|
|
269
|
+
return dimensions[src] = toDimensions(image);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function toDimensions(image) {
|
|
273
|
+
return {
|
|
274
|
+
width: image.naturalWidth,
|
|
275
|
+
height: image.naturalHeight
|
|
276
|
+
};
|
|
266
277
|
}
|
|
267
278
|
|
|
268
279
|
function getStep(steps, percent) {
|
package/src/js/util/fastdom.js
CHANGED
|
@@ -31,7 +31,7 @@ export const fastdom = {
|
|
|
31
31
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
function flush(recursion
|
|
34
|
+
function flush(recursion) {
|
|
35
35
|
runTasks(fastdom.reads);
|
|
36
36
|
runTasks(fastdom.writes.splice(0));
|
|
37
37
|
|
|
@@ -53,7 +53,7 @@ function scheduleFlush(recursion) {
|
|
|
53
53
|
if (recursion && recursion < RECURSION_LIMIT) {
|
|
54
54
|
Promise.resolve().then(() => flush(recursion));
|
|
55
55
|
} else {
|
|
56
|
-
requestAnimationFrame(() => flush());
|
|
56
|
+
requestAnimationFrame(() => flush(1));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
}
|
package/src/js/util/viewport.js
CHANGED
|
@@ -2,7 +2,7 @@ import {css} from './style';
|
|
|
2
2
|
import {Promise} from './promise';
|
|
3
3
|
import {isVisible, parents} from './filter';
|
|
4
4
|
import {offset, offsetPosition} from './dimensions';
|
|
5
|
-
import {clamp, findIndex, intersectRect, isDocument, isWindow, toNode, toWindow} from './lang';
|
|
5
|
+
import {clamp, findIndex, intersectRect, isDocument, isUndefined, isWindow, toNode, toWindow} from './lang';
|
|
6
6
|
|
|
7
7
|
export function isInView(element, offsetTop = 0, offsetLeft = 0) {
|
|
8
8
|
|
|
@@ -31,7 +31,11 @@ export function scrollTop(element, top) {
|
|
|
31
31
|
element = toNode(element);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
if (isUndefined(top)) {
|
|
35
|
+
return element.scrollTop;
|
|
36
|
+
} else {
|
|
37
|
+
element.scrollTop = top;
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export function scrollIntoView(element, {offset: offsetBy = 0} = {}) {
|
|
@@ -145,7 +149,7 @@ export function getViewportClientHeight(scrollElement) {
|
|
|
145
149
|
return (scrollElement === getScrollingElement(scrollElement) ? document.documentElement : scrollElement).clientHeight;
|
|
146
150
|
}
|
|
147
151
|
|
|
148
|
-
function getScrollingElement(element) {
|
|
152
|
+
export function getScrollingElement(element) {
|
|
149
153
|
const {document} = toWindow(element);
|
|
150
154
|
return document.scrollingElement || document.documentElement;
|
|
151
155
|
}
|