uikit 3.13.11-dev.d3de726ee → 3.14.1-dev.b7e81c46b
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 +19 -0
- package/dist/css/uikit-core-rtl.css +4 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +4 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +4 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +4 -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 +19 -5
- package/dist/js/components/lightbox-panel.min.js +1 -1
- package/dist/js/components/lightbox.js +19 -5
- 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 +63 -61
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +63 -61
- 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 +63 -61
- 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 +19 -5
- 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 +121 -60
- 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 +183 -120
- package/dist/js/uikit.min.js +1 -1
- package/package.json +1 -1
- package/src/js/core/accordion.js +21 -5
- package/src/js/core/cover.js +27 -14
- package/src/js/core/drop.js +22 -2
- package/src/js/core/height-match.js +1 -1
- package/src/js/core/margin.js +9 -2
- package/src/js/mixin/parallax.js +62 -61
- package/src/js/mixin/togglable.js +16 -2
- package/src/js/util/lang.js +34 -38
- package/src/js/util/position.js +6 -3
- package/src/less/components/nav.less +1 -0
- package/src/less/components/utility.less +1 -0
- package/src/scss/components/nav.scss +1 -0
- package/src/scss/components/utility.scss +1 -0
- package/tests/alert.html +1 -1
- package/tests/drop.html +154 -80
- package/tests/navbar.html +1 -1
- package/tests/parallax.html +8 -8
- package/tests/sticky-parallax.html +8 -8
package/dist/js/uikit.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.
|
|
1
|
+
/*! UIkit 3.14.1-dev.b7e81c46b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
|
|
2
2
|
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
@@ -208,48 +208,44 @@
|
|
|
208
208
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const aProp = prop === 'width' ? 'height' : 'width';
|
|
211
|
+
function ratio(dimensions, prop, value) {
|
|
212
|
+
const aProp = prop === 'width' ? 'height' : 'width';
|
|
214
213
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
214
|
+
return {
|
|
215
|
+
[aProp]: dimensions[prop] ?
|
|
216
|
+
Math.round(value * dimensions[aProp] / dimensions[prop]) :
|
|
217
|
+
dimensions[aProp],
|
|
218
|
+
[prop]: value };
|
|
220
219
|
|
|
221
|
-
|
|
220
|
+
}
|
|
222
221
|
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
function contain(dimensions, maxDimensions) {
|
|
223
|
+
dimensions = { ...dimensions };
|
|
225
224
|
|
|
226
|
-
|
|
227
|
-
dimensions,
|
|
228
|
-
(_, prop) =>
|
|
225
|
+
for (const prop in dimensions) {
|
|
229
226
|
dimensions =
|
|
230
227
|
dimensions[prop] > maxDimensions[prop] ?
|
|
231
|
-
|
|
232
|
-
dimensions
|
|
233
|
-
|
|
228
|
+
ratio(dimensions, prop, maxDimensions[prop]) :
|
|
229
|
+
dimensions;
|
|
230
|
+
}
|
|
234
231
|
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
return dimensions;
|
|
233
|
+
}
|
|
237
234
|
|
|
238
|
-
|
|
239
|
-
|
|
235
|
+
function cover$1(dimensions, maxDimensions) {
|
|
236
|
+
dimensions = contain(dimensions, maxDimensions);
|
|
240
237
|
|
|
241
|
-
|
|
242
|
-
dimensions,
|
|
243
|
-
(_, prop) =>
|
|
238
|
+
for (const prop in dimensions) {
|
|
244
239
|
dimensions =
|
|
245
240
|
dimensions[prop] < maxDimensions[prop] ?
|
|
246
|
-
|
|
247
|
-
dimensions
|
|
248
|
-
|
|
241
|
+
ratio(dimensions, prop, maxDimensions[prop]) :
|
|
242
|
+
dimensions;
|
|
243
|
+
}
|
|
249
244
|
|
|
250
|
-
|
|
251
|
-
|
|
245
|
+
return dimensions;
|
|
246
|
+
}
|
|
252
247
|
|
|
248
|
+
const Dimensions = { ratio, contain, cover: cover$1 };
|
|
253
249
|
|
|
254
250
|
function getIndex(i, elements, current, finite) {if (current === void 0) {current = 0;}if (finite === void 0) {finite = false;}
|
|
255
251
|
elements = toNodes(elements);
|
|
@@ -1997,8 +1993,6 @@
|
|
|
1997
1993
|
function attachToWithFlip(element, target, options) {
|
|
1998
1994
|
const position = attachTo(element, target, options);
|
|
1999
1995
|
const targetDim = offset(target);
|
|
2000
|
-
const viewports = scrollParents(element, /auto|scroll/);
|
|
2001
|
-
const [scrollElement] = viewports;
|
|
2002
1996
|
|
|
2003
1997
|
let {
|
|
2004
1998
|
flip,
|
|
@@ -2009,6 +2003,11 @@
|
|
|
2009
2003
|
viewportPadding } =
|
|
2010
2004
|
options;
|
|
2011
2005
|
|
|
2006
|
+
let viewports = scrollParents(element);
|
|
2007
|
+
if (boundary === target) {
|
|
2008
|
+
viewports = viewports.filter((viewport) => viewport !== boundary);
|
|
2009
|
+
}
|
|
2010
|
+
const [scrollElement] = viewports;
|
|
2012
2011
|
viewports.push(viewport);
|
|
2013
2012
|
|
|
2014
2013
|
const offsetPosition = { ...position };
|
|
@@ -2027,7 +2026,7 @@
|
|
|
2027
2026
|
viewport[end] -= viewportPadding;
|
|
2028
2027
|
}
|
|
2029
2028
|
|
|
2030
|
-
if (boundary && !
|
|
2029
|
+
if (boundary && !willFlip && position[prop] <= offset(boundary)[prop]) {
|
|
2031
2030
|
viewport = getIntersectionArea(viewport, offset(boundary));
|
|
2032
2031
|
}
|
|
2033
2032
|
|
|
@@ -2955,7 +2954,7 @@
|
|
|
2955
2954
|
UIkit.data = '__uikit__';
|
|
2956
2955
|
UIkit.prefix = 'uk-';
|
|
2957
2956
|
UIkit.options = {};
|
|
2958
|
-
UIkit.version = '3.
|
|
2957
|
+
UIkit.version = '3.14.1-dev.b7e81c46b';
|
|
2959
2958
|
|
|
2960
2959
|
globalAPI(UIkit);
|
|
2961
2960
|
hooksAPI(UIkit);
|
|
@@ -3047,6 +3046,7 @@
|
|
|
3047
3046
|
cls: Boolean,
|
|
3048
3047
|
animation: 'list',
|
|
3049
3048
|
duration: Number,
|
|
3049
|
+
velocity: Number,
|
|
3050
3050
|
origin: String,
|
|
3051
3051
|
transition: String },
|
|
3052
3052
|
|
|
@@ -3055,8 +3055,9 @@
|
|
|
3055
3055
|
cls: false,
|
|
3056
3056
|
animation: [false],
|
|
3057
3057
|
duration: 200,
|
|
3058
|
+
velocity: 0.2,
|
|
3058
3059
|
origin: false,
|
|
3059
|
-
transition: '
|
|
3060
|
+
transition: 'ease',
|
|
3060
3061
|
clsEnter: 'uk-togglabe-enter',
|
|
3061
3062
|
clsLeave: 'uk-togglabe-leave',
|
|
3062
3063
|
|
|
@@ -3066,7 +3067,8 @@
|
|
|
3066
3067
|
paddingTop: '',
|
|
3067
3068
|
paddingBottom: '',
|
|
3068
3069
|
marginTop: '',
|
|
3069
|
-
marginBottom: ''
|
|
3070
|
+
marginBottom: '',
|
|
3071
|
+
boxShadow: '' },
|
|
3070
3072
|
|
|
3071
3073
|
|
|
3072
3074
|
hideProps: {
|
|
@@ -3075,7 +3077,8 @@
|
|
|
3075
3077
|
paddingTop: 0,
|
|
3076
3078
|
paddingBottom: 0,
|
|
3077
3079
|
marginTop: 0,
|
|
3078
|
-
marginBottom: 0
|
|
3080
|
+
marginBottom: 0,
|
|
3081
|
+
boxShadow: 'none' } },
|
|
3079
3082
|
|
|
3080
3083
|
|
|
3081
3084
|
|
|
@@ -3170,7 +3173,15 @@
|
|
|
3170
3173
|
|
|
3171
3174
|
|
|
3172
3175
|
|
|
3173
|
-
function toggleHeight(_ref3)
|
|
3176
|
+
function toggleHeight(_ref3)
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
{let { isToggled, duration, velocity, initProps, hideProps, transition, _toggle } = _ref3;
|
|
3174
3185
|
return (el, show) => {
|
|
3175
3186
|
const inProgress = Transition.inProgress(el);
|
|
3176
3187
|
const inner = el.hasChildNodes() ?
|
|
@@ -3191,6 +3202,8 @@
|
|
|
3191
3202
|
fastdom.flush();
|
|
3192
3203
|
|
|
3193
3204
|
const endHeight = height(el) + (inProgress ? 0 : inner);
|
|
3205
|
+
duration = velocity * el.offsetHeight + duration;
|
|
3206
|
+
|
|
3194
3207
|
height(el, currentHeight);
|
|
3195
3208
|
|
|
3196
3209
|
return (
|
|
@@ -3238,7 +3251,6 @@
|
|
|
3238
3251
|
multiple: Boolean,
|
|
3239
3252
|
toggle: String,
|
|
3240
3253
|
content: String,
|
|
3241
|
-
transition: String,
|
|
3242
3254
|
offset: Number },
|
|
3243
3255
|
|
|
3244
3256
|
|
|
@@ -3251,19 +3263,16 @@
|
|
|
3251
3263
|
clsOpen: 'uk-open',
|
|
3252
3264
|
toggle: '> .uk-accordion-title',
|
|
3253
3265
|
content: '> .uk-accordion-content',
|
|
3254
|
-
transition: 'ease',
|
|
3255
3266
|
offset: 0 },
|
|
3256
3267
|
|
|
3257
3268
|
|
|
3258
3269
|
computed: {
|
|
3259
3270
|
items: {
|
|
3260
3271
|
get(_ref, $el) {let { targets } = _ref;
|
|
3261
|
-
return $$(targets, $el)
|
|
3272
|
+
return $$(targets, $el);
|
|
3262
3273
|
},
|
|
3263
3274
|
|
|
3264
3275
|
watch(items, prev) {
|
|
3265
|
-
items.forEach((el) => hide($(this.content, el), !hasClass(el, this.clsOpen)));
|
|
3266
|
-
|
|
3267
3276
|
if (prev || hasClass(items, this.clsOpen)) {
|
|
3268
3277
|
return;
|
|
3269
3278
|
}
|
|
@@ -3282,7 +3291,27 @@
|
|
|
3282
3291
|
|
|
3283
3292
|
toggles(_ref2) {let { toggle } = _ref2;
|
|
3284
3293
|
return this.items.map((item) => $(toggle, item));
|
|
3285
|
-
}
|
|
3294
|
+
},
|
|
3295
|
+
|
|
3296
|
+
contents: {
|
|
3297
|
+
get(_ref3) {let { content } = _ref3;
|
|
3298
|
+
return this.items.map((item) => $(content, item));
|
|
3299
|
+
},
|
|
3300
|
+
|
|
3301
|
+
watch(items) {
|
|
3302
|
+
for (const el of items) {
|
|
3303
|
+
hide(
|
|
3304
|
+
el,
|
|
3305
|
+
!hasClass(
|
|
3306
|
+
this.items.find((item) => item.contains(el)),
|
|
3307
|
+
this.clsOpen));
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
}
|
|
3311
|
+
},
|
|
3312
|
+
|
|
3313
|
+
immediate: true } },
|
|
3314
|
+
|
|
3286
3315
|
|
|
3287
3316
|
|
|
3288
3317
|
connected() {
|
|
@@ -3479,25 +3508,38 @@
|
|
|
3479
3508
|
|
|
3480
3509
|
update: {
|
|
3481
3510
|
read() {
|
|
3482
|
-
const
|
|
3483
|
-
const {
|
|
3484
|
-
getPositionedParent(el) || parent(el);
|
|
3485
|
-
const dim = Dimensions.cover(
|
|
3486
|
-
{
|
|
3487
|
-
width: this.width || el.naturalWidth || el.videoWidth || el.clientWidth,
|
|
3488
|
-
height: this.height || el.naturalHeight || el.videoHeight || el.clientHeight },
|
|
3511
|
+
const { ratio, cover } = Dimensions;
|
|
3512
|
+
const { $el, width, height } = this;
|
|
3489
3513
|
|
|
3490
|
-
{
|
|
3491
|
-
width: width + (width % 2 ? 1 : 0),
|
|
3492
|
-
height: height + (height % 2 ? 1 : 0) });
|
|
3514
|
+
let dim = { width, height };
|
|
3493
3515
|
|
|
3516
|
+
if (!dim.width || !dim.height) {
|
|
3517
|
+
const intrinsic = {
|
|
3518
|
+
width: $el.naturalWidth || $el.videoWidth || $el.clientWidth,
|
|
3519
|
+
height: $el.naturalHeight || $el.videoHeight || $el.clientHeight };
|
|
3494
3520
|
|
|
3495
3521
|
|
|
3496
|
-
|
|
3522
|
+
if (dim.width) {
|
|
3523
|
+
dim = ratio(intrinsic, 'width', dim.width);
|
|
3524
|
+
} else if (height) {
|
|
3525
|
+
dim = ratio(intrinsic, 'height', dim.height);
|
|
3526
|
+
} else {
|
|
3527
|
+
dim = intrinsic;
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
const { offsetHeight: coverHeight, offsetWidth: coverWidth } =
|
|
3532
|
+
getPositionedParent($el) || parent($el);
|
|
3533
|
+
const coverDim = cover(dim, {
|
|
3534
|
+
width: coverWidth + (coverWidth % 2 ? 1 : 0),
|
|
3535
|
+
height: coverHeight + (coverHeight % 2 ? 1 : 0) });
|
|
3536
|
+
|
|
3537
|
+
|
|
3538
|
+
if (!coverDim.width || !coverDim.height) {
|
|
3497
3539
|
return false;
|
|
3498
3540
|
}
|
|
3499
3541
|
|
|
3500
|
-
return
|
|
3542
|
+
return coverDim;
|
|
3501
3543
|
},
|
|
3502
3544
|
|
|
3503
3545
|
write(_ref) {let { height, width } = _ref;
|
|
@@ -3599,6 +3641,7 @@
|
|
|
3599
3641
|
boundaryAlign: Boolean,
|
|
3600
3642
|
delayShow: Number,
|
|
3601
3643
|
delayHide: Number,
|
|
3644
|
+
display: String,
|
|
3602
3645
|
clsDrop: String },
|
|
3603
3646
|
|
|
3604
3647
|
|
|
@@ -3609,6 +3652,7 @@
|
|
|
3609
3652
|
boundaryAlign: false,
|
|
3610
3653
|
delayShow: 0,
|
|
3611
3654
|
delayHide: 800,
|
|
3655
|
+
display: null,
|
|
3612
3656
|
clsDrop: false,
|
|
3613
3657
|
animation: ['uk-animation-fade'],
|
|
3614
3658
|
cls: 'uk-open',
|
|
@@ -3799,7 +3843,23 @@
|
|
|
3799
3843
|
this.hide(false);
|
|
3800
3844
|
}
|
|
3801
3845
|
}),
|
|
3802
|
-
|
|
3846
|
+
|
|
3847
|
+
...(this.display === 'static' ?
|
|
3848
|
+
[] :
|
|
3849
|
+
(() => {
|
|
3850
|
+
const handler = () => this.$emit();
|
|
3851
|
+
return [
|
|
3852
|
+
on(window, 'resize', handler),
|
|
3853
|
+
on(document, 'scroll', handler, true),
|
|
3854
|
+
(() => {
|
|
3855
|
+
const observer = observeResize(
|
|
3856
|
+
scrollParents(this.$el),
|
|
3857
|
+
handler);
|
|
3858
|
+
|
|
3859
|
+
return () => observer.disconnect();
|
|
3860
|
+
})()];
|
|
3861
|
+
|
|
3862
|
+
})())])
|
|
3803
3863
|
{
|
|
3804
3864
|
once(this.$el, 'hide', handler, { self: true });
|
|
3805
3865
|
}
|
|
@@ -3919,7 +3979,8 @@
|
|
|
3919
3979
|
const boundaryOffset = boundary ? offset(boundary) : scrollParentOffset;
|
|
3920
3980
|
|
|
3921
3981
|
css(this.$el, 'maxWidth', '');
|
|
3922
|
-
const maxWidth =
|
|
3982
|
+
const maxWidth =
|
|
3983
|
+
scrollParentOffset.width - (this.boundaryAlign ? 0 : 2 * this.viewportPadding);
|
|
3923
3984
|
|
|
3924
3985
|
if (this.pos[1] === 'justify') {
|
|
3925
3986
|
const prop = this.axis === 'y' ? 'width' : 'height';
|
|
@@ -4034,7 +4095,7 @@
|
|
|
4034
4095
|
|
|
4035
4096
|
|
|
4036
4097
|
resizeTargets() {
|
|
4037
|
-
return [this.$el, this.$el.children];
|
|
4098
|
+
return [this.$el, ...toArray(this.$el.children)];
|
|
4038
4099
|
},
|
|
4039
4100
|
|
|
4040
4101
|
connected() {
|
|
@@ -4351,7 +4412,7 @@
|
|
|
4351
4412
|
|
|
4352
4413
|
|
|
4353
4414
|
resizeTargets() {
|
|
4354
|
-
return [this.$el, this.elements];
|
|
4415
|
+
return [this.$el, ...this.elements];
|
|
4355
4416
|
},
|
|
4356
4417
|
|
|
4357
4418
|
update: {
|
|
@@ -9302,7 +9363,9 @@
|
|
|
9302
9363
|
|
|
9303
9364
|
methods: {
|
|
9304
9365
|
reset() {
|
|
9305
|
-
|
|
9366
|
+
for (const prop in this.getCss(0)) {
|
|
9367
|
+
css(this.$el, prop, '');
|
|
9368
|
+
}
|
|
9306
9369
|
},
|
|
9307
9370
|
|
|
9308
9371
|
getCss(percent) {
|
|
@@ -9315,39 +9378,39 @@
|
|
|
9315
9378
|
|
|
9316
9379
|
|
|
9317
9380
|
|
|
9318
|
-
function transformFn(prop, el,
|
|
9319
|
-
let unit = getUnit(
|
|
9381
|
+
function transformFn(prop, el, steps) {
|
|
9382
|
+
let unit = getUnit(steps) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
|
|
9320
9383
|
let transformFn;
|
|
9321
9384
|
|
|
9322
9385
|
if (prop === 'x' || prop === 'y') {
|
|
9323
9386
|
prop = "translate" + ucfirst(prop);
|
|
9324
|
-
transformFn = (
|
|
9387
|
+
transformFn = (step) => toFloat(toFloat(step).toFixed(unit === 'px' ? 0 : 6));
|
|
9325
9388
|
} else if (prop === 'scale') {
|
|
9326
9389
|
unit = '';
|
|
9327
|
-
transformFn = (
|
|
9328
|
-
getUnit([
|
|
9390
|
+
transformFn = (step) =>
|
|
9391
|
+
getUnit([step]) ? toPx(step, 'width', el, true) / el.offsetWidth : step;
|
|
9329
9392
|
}
|
|
9330
9393
|
|
|
9331
|
-
if (
|
|
9332
|
-
|
|
9394
|
+
if (steps.length === 1) {
|
|
9395
|
+
steps.unshift(prop === 'scale' ? 1 : 0);
|
|
9333
9396
|
}
|
|
9334
9397
|
|
|
9335
|
-
|
|
9398
|
+
steps = parseSteps(steps, transformFn);
|
|
9336
9399
|
|
|
9337
9400
|
return (css, percent) => {
|
|
9338
|
-
css.transform += " " + prop + "(" + getValue(
|
|
9401
|
+
css.transform += " " + prop + "(" + getValue(steps, percent) + unit + ")";
|
|
9339
9402
|
};
|
|
9340
9403
|
}
|
|
9341
9404
|
|
|
9342
|
-
function colorFn(prop, el,
|
|
9343
|
-
if (
|
|
9344
|
-
|
|
9405
|
+
function colorFn(prop, el, steps) {
|
|
9406
|
+
if (steps.length === 1) {
|
|
9407
|
+
steps.unshift(getCssValue(el, prop, ''));
|
|
9345
9408
|
}
|
|
9346
9409
|
|
|
9347
|
-
|
|
9410
|
+
steps = parseSteps(steps, (step) => parseColor(el, step));
|
|
9348
9411
|
|
|
9349
9412
|
return (css, percent) => {
|
|
9350
|
-
const [start, end, p] =
|
|
9413
|
+
const [start, end, p] = getStep(steps, percent);
|
|
9351
9414
|
const value = start.
|
|
9352
9415
|
map((value, i) => {
|
|
9353
9416
|
value += p * (end[i] - value);
|
|
@@ -9367,80 +9430,80 @@
|
|
|
9367
9430
|
map(toFloat);
|
|
9368
9431
|
}
|
|
9369
9432
|
|
|
9370
|
-
function filterFn(prop, el,
|
|
9371
|
-
if (
|
|
9372
|
-
|
|
9433
|
+
function filterFn(prop, el, steps) {
|
|
9434
|
+
if (steps.length === 1) {
|
|
9435
|
+
steps.unshift(0);
|
|
9373
9436
|
}
|
|
9374
9437
|
|
|
9375
|
-
const unit = getUnit(
|
|
9438
|
+
const unit = getUnit(steps) || { blur: 'px', hue: 'deg' }[prop] || '%';
|
|
9376
9439
|
prop = { fopacity: 'opacity', hue: 'hue-rotate' }[prop] || prop;
|
|
9377
|
-
|
|
9440
|
+
steps = parseSteps(steps);
|
|
9378
9441
|
|
|
9379
9442
|
return (css, percent) => {
|
|
9380
|
-
const value = getValue(
|
|
9443
|
+
const value = getValue(steps, percent);
|
|
9381
9444
|
css.filter += " " + prop + "(" + (value + unit) + ")";
|
|
9382
9445
|
};
|
|
9383
9446
|
}
|
|
9384
9447
|
|
|
9385
|
-
function cssPropFn(prop, el,
|
|
9386
|
-
if (
|
|
9387
|
-
|
|
9448
|
+
function cssPropFn(prop, el, steps) {
|
|
9449
|
+
if (steps.length === 1) {
|
|
9450
|
+
steps.unshift(getCssValue(el, prop, ''));
|
|
9388
9451
|
}
|
|
9389
9452
|
|
|
9390
|
-
|
|
9453
|
+
steps = parseSteps(steps);
|
|
9391
9454
|
|
|
9392
9455
|
return (css, percent) => {
|
|
9393
|
-
css[prop] = getValue(
|
|
9456
|
+
css[prop] = getValue(steps, percent);
|
|
9394
9457
|
};
|
|
9395
9458
|
}
|
|
9396
9459
|
|
|
9397
|
-
function strokeFn(prop, el,
|
|
9398
|
-
if (
|
|
9399
|
-
|
|
9460
|
+
function strokeFn(prop, el, steps) {
|
|
9461
|
+
if (steps.length === 1) {
|
|
9462
|
+
steps.unshift(0);
|
|
9400
9463
|
}
|
|
9401
9464
|
|
|
9402
|
-
const unit = getUnit(
|
|
9465
|
+
const unit = getUnit(steps);
|
|
9403
9466
|
const length = getMaxPathLength(el);
|
|
9404
|
-
|
|
9405
|
-
|
|
9406
|
-
return unit === '%' ?
|
|
9467
|
+
steps = parseSteps(steps.reverse(), (step) => {
|
|
9468
|
+
step = toFloat(step);
|
|
9469
|
+
return unit === '%' ? step * length / 100 : step;
|
|
9407
9470
|
});
|
|
9408
9471
|
|
|
9409
|
-
if (!
|
|
9472
|
+
if (!steps.some((_ref) => {let [value] = _ref;return value;})) {
|
|
9410
9473
|
return noop;
|
|
9411
9474
|
}
|
|
9412
9475
|
|
|
9413
9476
|
css(el, 'strokeDasharray', length);
|
|
9414
9477
|
|
|
9415
9478
|
return (css, percent) => {
|
|
9416
|
-
css.strokeDashoffset = getValue(
|
|
9479
|
+
css.strokeDashoffset = getValue(steps, percent);
|
|
9417
9480
|
};
|
|
9418
9481
|
}
|
|
9419
9482
|
|
|
9420
|
-
function backgroundFn(prop, el,
|
|
9421
|
-
if (
|
|
9422
|
-
|
|
9483
|
+
function backgroundFn(prop, el, steps) {
|
|
9484
|
+
if (steps.length === 1) {
|
|
9485
|
+
steps.unshift(0);
|
|
9423
9486
|
}
|
|
9424
9487
|
|
|
9425
9488
|
prop = prop.substr(-1);
|
|
9426
9489
|
const attr = prop === 'y' ? 'height' : 'width';
|
|
9427
|
-
|
|
9490
|
+
steps = parseSteps(steps, (step) => toPx(step, attr, el));
|
|
9428
9491
|
|
|
9429
9492
|
const bgPos = getCssValue(el, "background-position-" + prop, '');
|
|
9430
9493
|
|
|
9431
9494
|
return getCssValue(el, 'backgroundSize', '') === 'cover' ?
|
|
9432
|
-
backgroundCoverFn(prop, el,
|
|
9433
|
-
setBackgroundPosFn(prop,
|
|
9495
|
+
backgroundCoverFn(prop, el, steps, bgPos, attr) :
|
|
9496
|
+
setBackgroundPosFn(prop, steps, bgPos);
|
|
9434
9497
|
}
|
|
9435
9498
|
|
|
9436
|
-
function backgroundCoverFn(prop, el,
|
|
9499
|
+
function backgroundCoverFn(prop, el, steps, bgPos, attr) {
|
|
9437
9500
|
const dimImage = getBackgroundImageDimensions(el);
|
|
9438
9501
|
|
|
9439
9502
|
if (!dimImage.width) {
|
|
9440
9503
|
return noop;
|
|
9441
9504
|
}
|
|
9442
9505
|
|
|
9443
|
-
const values =
|
|
9506
|
+
const values = steps.map((_ref2) => {let [value] = _ref2;return value;});
|
|
9444
9507
|
const min = Math.min(...values);
|
|
9445
9508
|
const max = Math.max(...values);
|
|
9446
9509
|
const down = values.indexOf(min) < values.indexOf(max);
|
|
@@ -9468,7 +9531,7 @@
|
|
|
9468
9531
|
|
|
9469
9532
|
const dim = Dimensions.cover(dimImage, dimEl);
|
|
9470
9533
|
|
|
9471
|
-
const fn = setBackgroundPosFn(prop,
|
|
9534
|
+
const fn = setBackgroundPosFn(prop, steps, pos + "px");
|
|
9472
9535
|
return (css, percent) => {
|
|
9473
9536
|
fn(css, percent);
|
|
9474
9537
|
css.backgroundSize = dim.width + "px " + dim.height + "px";
|
|
@@ -9476,9 +9539,9 @@
|
|
|
9476
9539
|
};
|
|
9477
9540
|
}
|
|
9478
9541
|
|
|
9479
|
-
function setBackgroundPosFn(prop,
|
|
9542
|
+
function setBackgroundPosFn(prop, steps, pos) {
|
|
9480
9543
|
return function (css, percent) {
|
|
9481
|
-
css["background-position-" + prop] = "calc(" + pos + " + " + getValue(
|
|
9544
|
+
css["background-position-" + prop] = "calc(" + pos + " + " + getValue(steps, percent) + "px)";
|
|
9482
9545
|
};
|
|
9483
9546
|
}
|
|
9484
9547
|
|
|
@@ -9513,12 +9576,12 @@
|
|
|
9513
9576
|
|
|
9514
9577
|
}
|
|
9515
9578
|
|
|
9516
|
-
function
|
|
9579
|
+
function parseSteps(steps, fn) {if (fn === void 0) {fn = toFloat;}
|
|
9517
9580
|
const result = [];
|
|
9518
|
-
const { length } =
|
|
9581
|
+
const { length } = steps;
|
|
9519
9582
|
let nullIndex = 0;
|
|
9520
9583
|
for (let i = 0; i < length; i++) {
|
|
9521
|
-
let [value, percent] = isString(
|
|
9584
|
+
let [value, percent] = isString(steps[i]) ? steps[i].trim().split(' ') : [steps[i]];
|
|
9522
9585
|
value = fn(value);
|
|
9523
9586
|
percent = percent ? toFloat(percent) / 100 : null;
|
|
9524
9587
|
|
|
@@ -9555,24 +9618,24 @@
|
|
|
9555
9618
|
return result;
|
|
9556
9619
|
}
|
|
9557
9620
|
|
|
9558
|
-
function
|
|
9559
|
-
const index = findIndex(
|
|
9621
|
+
function getStep(steps, percent) {
|
|
9622
|
+
const index = findIndex(steps.slice(1), (_ref3) => {let [, targetPercent] = _ref3;return percent <= targetPercent;}) + 1;
|
|
9560
9623
|
return [
|
|
9561
|
-
|
|
9562
|
-
|
|
9563
|
-
(percent -
|
|
9624
|
+
steps[index - 1][0],
|
|
9625
|
+
steps[index][0],
|
|
9626
|
+
(percent - steps[index - 1][1]) / (steps[index][1] - steps[index - 1][1])];
|
|
9564
9627
|
|
|
9565
9628
|
}
|
|
9566
9629
|
|
|
9567
|
-
function getValue(
|
|
9568
|
-
const [start, end, p] =
|
|
9630
|
+
function getValue(steps, percent) {
|
|
9631
|
+
const [start, end, p] = getStep(steps, percent);
|
|
9569
9632
|
return isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
|
|
9570
9633
|
}
|
|
9571
9634
|
|
|
9572
|
-
const unitRe = /^-?\d+(
|
|
9573
|
-
function getUnit(
|
|
9574
|
-
for (const
|
|
9575
|
-
const match =
|
|
9635
|
+
const unitRe = /^-?\d+(\S*)/;
|
|
9636
|
+
function getUnit(steps, defaultUnit) {
|
|
9637
|
+
for (const step of steps) {
|
|
9638
|
+
const match = step.match == null ? void 0 : step.match(unitRe);
|
|
9576
9639
|
if (match) {
|
|
9577
9640
|
return match[1];
|
|
9578
9641
|
}
|