uikit 3.10.2-dev.c8aa7eda2 → 3.11.1
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 +35 -14
- package/build/icons.js +4 -4
- package/build/scope.js +4 -6
- package/dist/css/uikit-core-rtl.css +10 -1
- package/dist/css/uikit-core-rtl.min.css +1 -1
- package/dist/css/uikit-core.css +10 -1
- package/dist/css/uikit-core.min.css +1 -1
- package/dist/css/uikit-rtl.css +10 -1
- package/dist/css/uikit-rtl.min.css +1 -1
- package/dist/css/uikit.css +10 -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 +257 -264
- package/dist/js/components/parallax.min.js +1 -1
- package/dist/js/components/slider-parallax.js +215 -257
- 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 +215 -257
- 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 +28 -26
- 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 +284 -289
- package/dist/js/uikit.min.js +1 -1
- package/package.json +5 -5
- package/src/js/components/parallax.js +38 -8
- package/src/js/core/grid.js +2 -2
- package/src/js/core/svg.js +9 -7
- package/src/js/mixin/parallax.js +209 -242
- package/src/js/util/dimensions.js +4 -2
- package/src/js/util/viewport.js +9 -13
- package/src/less/components/position.less +2 -0
- package/src/less/components/sticky.less +6 -0
- package/src/scss/components/position.scss +2 -0
- package/src/scss/components/sticky.scss +6 -0
- package/tests/index.html +1 -1
- package/tests/js/index.js +1 -1
- package/tests/notification.html +5 -5
- package/tests/parallax.html +66 -50
- package/tests/sticky-parallax.html +274 -0
- package/tests/sticky.html +2 -2
- package/tests/tab.html +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! UIkit 3.
|
|
1
|
+
/*! UIkit 3.11.1 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */(function(a,s){typeof exports=="object"&&typeof module<"u"?module.exports=s(require("uikit-util")):typeof define=="function"&&define.amd?define("uikitparallax",["uikit-util"],s):(a=typeof globalThis<"u"?globalThis:a||self,a.UIkitParallax=s(a.UIkit.util))})(this,function(a){"use strict";var s={props:{media:Boolean},data:{media:!1},computed:{matchMedia:function(){var r=p(this.media);return!r||window.matchMedia(r).matches}}};function p(r){if(a.isString(r)){if(r[0]==="@"){var t="breakpoint-"+r.substr(1);r=a.toFloat(a.getCssVar(t))}else if(isNaN(r))return r}return r&&!isNaN(r)?"(min-width: "+r+"px)":!1}a.memoize(function(r){return new a.Promise(function(t,n){if(!r){n();return}a.startsWith(r,"data:")?t(decodeURIComponent(r.split(",")[1])):a.ajax(r).then(function(e){return t(e.response)},function(){return n("SVG not found.")})})});function B(r){return Math.ceil(Math.max.apply(Math,[0].concat(a.$$("[stroke]",r).map(function(t){try{return t.getTotalLength()}catch{return 0}}))))}var m={x,y:x,rotate:x,scale:x,color:M,backgroundColor:M,borderColor:M,blur:c,hue:c,fopacity:c,grayscale:c,invert:c,saturate:c,sepia:c,opacity:q,stroke:H,bgx:C,bgy:C},l=Object.keys,E={mixins:[s],props:S(l(m),"list"),data:S(l(m),void 0),computed:{props:function(r,t){var n=this;return l(m).reduce(function(e,o){return a.isUndefined(r[o])||(e[o]=m[o].call(n,o,t,r[o].slice())),e},{})}},methods:{reset:function(){var r=this;a.each(this.getCss(0),function(t,n){return a.css(r.$el,n,"")})},getCss:function(r){var t=this;return l(this.props).reduce(function(n,e){return t.props[e](n,r),n},{transform:"",filter:""})}}};function x(r,t,n){var e=F(n)||{x:"px",y:"px",rotate:"deg"}[r]||"";return(r==="x"||r==="y")&&(r="translate"+a.ucfirst(r)),n=n.map(a.toFloat),n.length===1&&n.unshift(r==="scale"?1:0),function(o,f){var i=g(n,f);a.startsWith(r,"translate")&&(i=a.toFloat(i).toFixed(e==="px"?0:6)),o.transform+=" "+r+"("+i+e+")"}}function M(r,t,n){return n.length===1&&n.unshift(b(t,r,"")),n=n.map(function(e){return R(t,e)}),function(e,o){var f=P(n,o),i=f[0],v=f[1],y=f[2],h=i.map(function(d,u){return d+=y*(v[u]-d),u===3?a.toFloat(d):parseInt(d,10)}).join(",");e[r]="rgba("+h+")"}}function R(r,t){return b(r,"color",t).split(/[(),]/g).slice(1,-1).concat(1).slice(0,4).map(a.toFloat)}function c(r,t,n){n.length===1&&n.unshift(0);var e=F(n)||{blur:"px",hue:"deg"}[r]||"%";return r={fopacity:"opacity",hue:"hue-rotate"}[r]||r,n=n.map(a.toFloat),function(o,f){var i=g(n,f);o.filter+=" "+r+"("+(i+e)+")"}}function q(r,t,n){return n.length===1&&n.unshift(b(t,r,"")),n=n.map(a.toFloat),function(e,o){e[r]=g(n,o)}}function H(r,t,n){n.length===1&&n.unshift(0);var e=F(n);if(n=n.map(a.toFloat),!n.some(function(f){return f}))return a.noop;var o=B(t);return a.css(t,"strokeDasharray",o),e==="%"&&(n=n.map(function(f){return f*o/100})),n=n.reverse(),function(f,i){f.strokeDashoffset=g(n,i)}}function C(r,t,n){n.length===1&&n.unshift(0),r=r.substr(-1);var e=r==="y"?"height":"width";n=n.map(function(f){return a.toPx(f,e,t)}),a.css(t,"background-position-"+r,"");var o=a.css(t,"backgroundPosition").split(" ")[r==="x"?0:1];return b(t,"backgroundSize","")==="cover"?L.call(this,r,t,n,o,e):I(r,n,o)}function L(r,t,n,e,o){var f=_.call(this,t);if(!f.naturalWidth)return a.noop;var i=Math.min.apply(Math,n),v=Math.max.apply(Math,n),y=n.indexOf(i)<n.indexOf(v),h=v-i,d=(y?-h:0)-(y?i:v),u={width:t.offsetWidth,height:t.offsetHeight},j={width:f.naturalWidth,height:f.naturalHeight},z=a.Dimensions.cover(j,u),w=z[o]-u[o];if(w<h)u[o]=z[o]+h-w;else if(w>h){var T=u[o]/a.toPx(e,o,t,!0);T&&(d-=(w-h)/T)}var V=a.Dimensions.cover(j,u),A=I(r,n,d+"px");return function($,J){A($,J),$.backgroundSize=V.width+"px "+V.height+"px",$.backgroundRepeat="no-repeat"}}function I(r,t,n){return function(e,o){e["background-position-"+r]="calc("+n+" + "+g(t,o)+"px)"}}function _(r){var t=this,n=a.css(r,"backgroundImage").replace(/^none|url\(["']?(.+?)["']?\)$/,"$1"),e=this._data;if(e[n])return e[n];if(n){var o=new Image;return o.src=n,o.naturalWidth||(o.onload=function(){return t.$update()}),e[n]=o}}function P(r,t){var n=r.length-1,e=Math.min(Math.floor(n*t),n-1);return r.slice(e,e+2).concat(t===1?1:t%(1/n)*n)}function g(r,t){var n=P(r,t),e=n[0],o=n[1],f=n[2];return a.isNumber(e)?e+Math.abs(e-o)*f*(e<o?1:-1):+o}function F(r,t){return r.reduce(function(n,e){return n||a.isString(e)&&e.replace(/[\d-]/g,"").trim()},"")||t}function b(r,t,n){var e=r.style[t],o=a.css(a.css(r,t,n),t);return r.style[t]=e,o}function S(r,t){return r.reduce(function(n,e){return n[e]=t,n},{})}var N={mixins:[E],props:{target:String,viewport:Number,easing:Number,start:String,end:String},data:{target:!1,viewport:1,easing:1,start:0,end:0},computed:{target:function(r,t){var n=r.target;return D(n&&a.query(n,t)||t)},start:function(r){var t=r.start;return W(t,this.target)},end:function(r){var t=r.end,n=r.viewport;return W(t||(n=(1-n)*100)&&n+"vh+"+n+"%",this.target)}},update:{read:function(r,t){var n=r.percent;if(t.has("scroll")||(n=!1),!!this.matchMedia){var e=n;return n=G(a.scrolledOver(this.target,this.start,this.end),this.easing),{percent:n,style:e===n?!1:this.getCss(n)}}},write:function(r){var t=r.style;if(!this.matchMedia){this.reset();return}t&&a.css(this.$el,t)},events:["scroll","resize"]}},O=/-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;function W(r,t){var n,e=0;for(r=r.toString().replace(/\s/g,""),O.lastIndex=0;(n=O.exec(r))!==null;)e+=a.toPx(n[0],"height",t,!0);return e}function G(r,t){return t>=0?Math.pow(r,t+1):1-Math.pow(1-r,-t+1)}function D(r){return r?"offsetTop"in r?r:D(a.parent(r)):document.documentElement}return typeof window<"u"&&window.UIkit&&window.UIkit.component("parallax",N),N});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! UIkit 3.
|
|
1
|
+
/*! UIkit 3.11.1 | 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(require('uikit-util')) :
|
|
@@ -71,357 +71,315 @@
|
|
|
71
71
|
}) )));
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
var props =
|
|
74
|
+
var props = {
|
|
75
|
+
x: transformFn,
|
|
76
|
+
y: transformFn,
|
|
77
|
+
rotate: transformFn,
|
|
78
|
+
scale: transformFn,
|
|
79
|
+
color: colorFn,
|
|
80
|
+
backgroundColor: colorFn,
|
|
81
|
+
borderColor: colorFn,
|
|
82
|
+
blur: filterFn,
|
|
83
|
+
hue: filterFn,
|
|
84
|
+
fopacity: filterFn,
|
|
85
|
+
grayscale: filterFn,
|
|
86
|
+
invert: filterFn,
|
|
87
|
+
saturate: filterFn,
|
|
88
|
+
sepia: filterFn,
|
|
89
|
+
opacity: cssPropFn,
|
|
90
|
+
stroke: strokeFn,
|
|
91
|
+
bgx: backgroundFn,
|
|
92
|
+
bgy: backgroundFn
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
var keys = Object.keys;
|
|
75
96
|
|
|
76
97
|
var Parallax = {
|
|
77
98
|
|
|
78
99
|
mixins: [Media],
|
|
79
100
|
|
|
80
|
-
props:
|
|
81
|
-
props[prop] = 'list';
|
|
82
|
-
return props;
|
|
83
|
-
}, {}),
|
|
101
|
+
props: fillObject(keys(props), 'list'),
|
|
84
102
|
|
|
85
|
-
data:
|
|
86
|
-
data[prop] = undefined;
|
|
87
|
-
return data;
|
|
88
|
-
}, {}),
|
|
103
|
+
data: fillObject(keys(props), undefined),
|
|
89
104
|
|
|
90
105
|
computed: {
|
|
91
106
|
|
|
92
107
|
props: function(properties, $el) {
|
|
93
108
|
var this$1$1 = this;
|
|
94
109
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if (uikitUtil.isUndefined(properties[prop])) {
|
|
99
|
-
return props;
|
|
110
|
+
return keys(props).reduce(function (result, prop) {
|
|
111
|
+
if (!uikitUtil.isUndefined(properties[prop])) {
|
|
112
|
+
result[prop] = props[prop].call(this$1$1, prop, $el, properties[prop].slice());
|
|
100
113
|
}
|
|
114
|
+
return result;
|
|
115
|
+
}, {});
|
|
116
|
+
}
|
|
101
117
|
|
|
102
|
-
|
|
103
|
-
var isCssProp = isColor || prop === 'opacity';
|
|
104
|
-
|
|
105
|
-
var pos, bgPos, diff;
|
|
106
|
-
var steps = properties[prop].slice();
|
|
107
|
-
|
|
108
|
-
if (isCssProp) {
|
|
109
|
-
uikitUtil.css($el, prop, '');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
if (steps.length < 2) {
|
|
113
|
-
steps.unshift((prop === 'scale'
|
|
114
|
-
? 1
|
|
115
|
-
: isCssProp
|
|
116
|
-
? uikitUtil.css($el, prop)
|
|
117
|
-
: 0) || 0);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
var unit = getUnit(steps);
|
|
121
|
-
|
|
122
|
-
if (isColor) {
|
|
123
|
-
|
|
124
|
-
var ref = $el.style;
|
|
125
|
-
var color = ref.color;
|
|
126
|
-
steps = steps.map(function (step) { return parseColor($el, step); });
|
|
127
|
-
$el.style.color = color;
|
|
128
|
-
|
|
129
|
-
} else if (uikitUtil.startsWith(prop, 'bg')) {
|
|
118
|
+
},
|
|
130
119
|
|
|
131
|
-
|
|
132
|
-
steps = steps.map(function (step) { return uikitUtil.toPx(step, attr, $el); });
|
|
120
|
+
methods: {
|
|
133
121
|
|
|
134
|
-
|
|
135
|
-
|
|
122
|
+
reset: function() {
|
|
123
|
+
var this$1$1 = this;
|
|
136
124
|
|
|
137
|
-
|
|
125
|
+
uikitUtil.each(this.getCss(0), function (_, prop) { return uikitUtil.css(this$1$1.$el, prop, ''); });
|
|
126
|
+
},
|
|
138
127
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
var down = steps.indexOf(min) < steps.indexOf(max);
|
|
128
|
+
getCss: function(percent) {
|
|
129
|
+
var this$1$1 = this;
|
|
142
130
|
|
|
143
|
-
|
|
131
|
+
return keys(this.props).reduce(function (css, prop) {
|
|
132
|
+
this$1$1.props[prop](css, percent);
|
|
133
|
+
return css;
|
|
134
|
+
}, {transform: '', filter: ''});
|
|
135
|
+
}
|
|
144
136
|
|
|
145
|
-
|
|
146
|
-
pos = (down ? -diff : 0) + "px";
|
|
137
|
+
}
|
|
147
138
|
|
|
148
|
-
|
|
139
|
+
};
|
|
149
140
|
|
|
150
|
-
|
|
141
|
+
function transformFn(prop, el, steps) {
|
|
151
142
|
|
|
152
|
-
|
|
143
|
+
var unit = getUnit(steps) || {x: 'px', y: 'px', rotate: 'deg'}[prop] || '';
|
|
153
144
|
|
|
154
|
-
|
|
145
|
+
if (prop === 'x' || prop === 'y') {
|
|
146
|
+
prop = "translate" + (uikitUtil.ucfirst(prop));
|
|
147
|
+
}
|
|
155
148
|
|
|
156
|
-
|
|
149
|
+
steps = steps.map(uikitUtil.toFloat);
|
|
157
150
|
|
|
158
|
-
|
|
151
|
+
if (steps.length === 1) {
|
|
152
|
+
steps.unshift(prop === 'scale' ? 1 : 0);
|
|
153
|
+
}
|
|
159
154
|
|
|
160
|
-
|
|
155
|
+
return function (css, percent) {
|
|
156
|
+
var value = getValue(steps, percent);
|
|
161
157
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
if (uikitUtil.startsWith(prop, 'translate')) {
|
|
159
|
+
value = uikitUtil.toFloat(value).toFixed(unit === 'px' ? 0 : 6);
|
|
160
|
+
}
|
|
165
161
|
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
css.transform += " " + prop + "(" + value + unit + ")";
|
|
163
|
+
};
|
|
164
|
+
}
|
|
168
165
|
|
|
169
|
-
|
|
170
|
-
steps = steps.map(function (step) { return step * length / 100; });
|
|
171
|
-
}
|
|
166
|
+
function colorFn(prop, el, steps) {
|
|
172
167
|
|
|
173
|
-
|
|
168
|
+
if (steps.length === 1) {
|
|
169
|
+
steps.unshift(getCssValue(el, prop, ''));
|
|
170
|
+
}
|
|
174
171
|
|
|
175
|
-
|
|
176
|
-
}
|
|
172
|
+
steps = steps.map(function (step) { return parseColor(el, step); });
|
|
177
173
|
|
|
178
|
-
|
|
174
|
+
return function (css, percent) {
|
|
179
175
|
|
|
180
|
-
|
|
176
|
+
var ref = getStep(steps, percent);
|
|
177
|
+
var start = ref[0];
|
|
178
|
+
var end = ref[1];
|
|
179
|
+
var p = ref[2];
|
|
180
|
+
var value = start.map(function (value, i) {
|
|
181
|
+
value += p * (end[i] - value);
|
|
182
|
+
return i === 3 ? uikitUtil.toFloat(value) : parseInt(value, 10);
|
|
183
|
+
}).join(',');
|
|
184
|
+
css[prop] = "rgba(" + value + ")";
|
|
185
|
+
};
|
|
186
|
+
}
|
|
181
187
|
|
|
182
|
-
|
|
188
|
+
function parseColor(el, color) {
|
|
189
|
+
return getCssValue(el, 'color', color)
|
|
190
|
+
.split(/[(),]/g)
|
|
191
|
+
.slice(1, -1)
|
|
192
|
+
.concat(1)
|
|
193
|
+
.slice(0, 4)
|
|
194
|
+
.map(uikitUtil.toFloat);
|
|
195
|
+
}
|
|
183
196
|
|
|
184
|
-
|
|
197
|
+
function filterFn(prop, el, steps) {
|
|
185
198
|
|
|
186
|
-
|
|
187
|
-
|
|
199
|
+
if (steps.length === 1) {
|
|
200
|
+
steps.unshift(0);
|
|
201
|
+
}
|
|
188
202
|
|
|
189
|
-
|
|
190
|
-
|
|
203
|
+
var unit = getUnit(steps) || {blur: 'px', hue: 'deg'}[prop] || '%';
|
|
204
|
+
prop = {fopacity: 'opacity', hue: 'hue-rotate'}[prop] || prop;
|
|
205
|
+
steps = steps.map(uikitUtil.toFloat);
|
|
191
206
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
207
|
+
return function (css, percent) {
|
|
208
|
+
var value = getValue(steps, percent);
|
|
209
|
+
css.filter += " " + prop + "(" + (value + unit) + ")";
|
|
210
|
+
};
|
|
211
|
+
}
|
|
195
212
|
|
|
196
|
-
|
|
213
|
+
function cssPropFn(prop, el, steps) {
|
|
197
214
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
215
|
+
if (steps.length === 1) {
|
|
216
|
+
steps.unshift(getCssValue(el, prop, ''));
|
|
217
|
+
}
|
|
201
218
|
|
|
202
|
-
|
|
219
|
+
steps = steps.map(uikitUtil.toFloat);
|
|
203
220
|
|
|
204
|
-
|
|
205
|
-
|
|
221
|
+
return function (css, percent) {
|
|
222
|
+
css[prop] = getValue(steps, percent);
|
|
223
|
+
};
|
|
224
|
+
}
|
|
206
225
|
|
|
226
|
+
function strokeFn(prop, el, steps) {
|
|
207
227
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
228
|
+
if (steps.length === 1) {
|
|
229
|
+
steps.unshift(0);
|
|
230
|
+
}
|
|
211
231
|
|
|
212
|
-
|
|
213
|
-
|
|
232
|
+
var unit = getUnit(steps);
|
|
233
|
+
steps = steps.map(uikitUtil.toFloat);
|
|
214
234
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
data.image = img;
|
|
235
|
+
if (!steps.some(function (step) { return step; })) {
|
|
236
|
+
return uikitUtil.noop;
|
|
237
|
+
}
|
|
219
238
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
}
|
|
239
|
+
var length = getMaxPathLength(el);
|
|
240
|
+
uikitUtil.css(el, 'strokeDasharray', length);
|
|
224
241
|
|
|
225
|
-
|
|
242
|
+
if (unit === '%') {
|
|
243
|
+
steps = steps.map(function (step) { return step * length / 100; });
|
|
244
|
+
}
|
|
226
245
|
|
|
227
|
-
|
|
246
|
+
steps = steps.reverse();
|
|
228
247
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
248
|
+
return function (css, percent) {
|
|
249
|
+
css.strokeDashoffset = getValue(steps, percent);
|
|
250
|
+
};
|
|
251
|
+
}
|
|
232
252
|
|
|
233
|
-
|
|
234
|
-
width: this.$el.offsetWidth,
|
|
235
|
-
height: this.$el.offsetHeight
|
|
236
|
-
};
|
|
237
|
-
var dimImage = {
|
|
238
|
-
width: image.naturalWidth,
|
|
239
|
-
height: image.naturalHeight
|
|
240
|
-
};
|
|
253
|
+
function backgroundFn(prop, el, steps) {
|
|
241
254
|
|
|
242
|
-
|
|
255
|
+
if (steps.length === 1) {
|
|
256
|
+
steps.unshift(0);
|
|
257
|
+
}
|
|
243
258
|
|
|
244
|
-
|
|
259
|
+
prop = prop.substr(-1);
|
|
260
|
+
var attr = prop === 'y' ? 'height' : 'width';
|
|
261
|
+
steps = steps.map(function (step) { return uikitUtil.toPx(step, attr, el); });
|
|
245
262
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
var bgPos = ref.bgPos;
|
|
249
|
-
var steps = ref.steps;
|
|
250
|
-
var attr = prop === 'bgy' ? 'height' : 'width';
|
|
251
|
-
var span = dim[attr] - dimEl[attr];
|
|
263
|
+
uikitUtil.css(el, ("background-position-" + prop), '');
|
|
264
|
+
var bgPos = uikitUtil.css(el, 'backgroundPosition').split(' ')[prop === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
|
|
252
265
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
266
|
+
return getCssValue(el, 'backgroundSize', '') === 'cover'
|
|
267
|
+
? backgroundCoverFn.call(this, prop, el, steps, bgPos, attr)
|
|
268
|
+
: setBackgroundPosFn(prop, steps, bgPos);
|
|
269
|
+
}
|
|
256
270
|
|
|
257
|
-
|
|
271
|
+
function backgroundCoverFn(prop, el, steps, bgPos, attr) {
|
|
258
272
|
|
|
259
|
-
|
|
260
|
-
this$1$1.props[prop].steps = steps.map(function (step) { return step - (span - diff) / posPercentage; });
|
|
261
|
-
}
|
|
262
|
-
}
|
|
273
|
+
var image = getBackgroundImage.call(this, el);
|
|
263
274
|
|
|
264
|
-
|
|
265
|
-
|
|
275
|
+
if (!image.naturalWidth) {
|
|
276
|
+
return uikitUtil.noop;
|
|
277
|
+
}
|
|
266
278
|
|
|
267
|
-
|
|
268
|
-
|
|
279
|
+
var min = Math.min.apply(Math, steps);
|
|
280
|
+
var max = Math.max.apply(Math, steps);
|
|
281
|
+
var down = steps.indexOf(min) < steps.indexOf(max);
|
|
269
282
|
|
|
270
|
-
|
|
271
|
-
|
|
283
|
+
var diff = max - min;
|
|
284
|
+
var pos = (down ? -diff : 0) - (down ? min : max);
|
|
272
285
|
|
|
286
|
+
var dimEl = {
|
|
287
|
+
width: el.offsetWidth,
|
|
288
|
+
height: el.offsetHeight
|
|
289
|
+
};
|
|
273
290
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
291
|
+
var dimImage = {
|
|
292
|
+
width: image.naturalWidth,
|
|
293
|
+
height: image.naturalHeight
|
|
294
|
+
};
|
|
278
295
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
backgroundRepeat: 'no-repeat'
|
|
282
|
-
});
|
|
296
|
+
var baseDim = uikitUtil.Dimensions.cover(dimImage, dimEl);
|
|
297
|
+
var span = baseDim[attr] - dimEl[attr];
|
|
283
298
|
|
|
284
|
-
|
|
299
|
+
if (span < diff) {
|
|
300
|
+
dimEl[attr] = baseDim[attr] + diff - span;
|
|
301
|
+
} else if (span > diff) {
|
|
285
302
|
|
|
286
|
-
|
|
303
|
+
var posPercentage = dimEl[attr] / uikitUtil.toPx(bgPos, attr, el, true);
|
|
287
304
|
|
|
288
|
-
|
|
305
|
+
if (posPercentage) {
|
|
306
|
+
pos -= (span - diff) / posPercentage;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
289
309
|
|
|
290
|
-
|
|
310
|
+
var dim = uikitUtil.Dimensions.cover(dimImage, dimEl);
|
|
291
311
|
|
|
292
|
-
|
|
293
|
-
|
|
312
|
+
var fn = setBackgroundPosFn(prop, steps, (pos + "px"));
|
|
313
|
+
return function (css, percent) {
|
|
314
|
+
fn(css, percent);
|
|
315
|
+
css.backgroundSize = (dim.width) + "px " + (dim.height) + "px";
|
|
316
|
+
css.backgroundRepeat = 'no-repeat';
|
|
317
|
+
};
|
|
318
|
+
}
|
|
294
319
|
|
|
295
|
-
|
|
296
|
-
|
|
320
|
+
function setBackgroundPosFn(prop, steps, pos) {
|
|
321
|
+
return function (css, percent) {
|
|
322
|
+
css[("background-position-" + prop)] = "calc(" + pos + " + " + (getValue(steps, percent)) + "px)";
|
|
323
|
+
};
|
|
324
|
+
}
|
|
297
325
|
|
|
298
|
-
|
|
326
|
+
function getBackgroundImage(el) {
|
|
327
|
+
var this$1$1 = this;
|
|
299
328
|
|
|
300
|
-
|
|
301
|
-
var props = ref.props;
|
|
302
|
-
return Object.keys(props).reduce(function (css, prop) {
|
|
303
|
-
|
|
304
|
-
var ref = props[prop];
|
|
305
|
-
var steps = ref.steps;
|
|
306
|
-
var unit = ref.unit;
|
|
307
|
-
var pos = ref.pos;
|
|
308
|
-
var value = getValue(steps, percent);
|
|
309
|
-
|
|
310
|
-
switch (prop) {
|
|
311
|
-
|
|
312
|
-
// transforms
|
|
313
|
-
case 'x':
|
|
314
|
-
case 'y': {
|
|
315
|
-
unit = unit || 'px';
|
|
316
|
-
css.transform += " translate" + (uikitUtil.ucfirst(prop)) + "(" + (uikitUtil.toFloat(value).toFixed(unit === 'px' ? 0 : 2)) + unit + ")";
|
|
317
|
-
break;
|
|
318
|
-
}
|
|
319
|
-
case 'rotate':
|
|
320
|
-
unit = unit || 'deg';
|
|
321
|
-
css.transform += " rotate(" + (value + unit) + ")";
|
|
322
|
-
break;
|
|
323
|
-
case 'scale':
|
|
324
|
-
css.transform += " scale(" + value + ")";
|
|
325
|
-
break;
|
|
326
|
-
|
|
327
|
-
// bg image
|
|
328
|
-
case 'bgy':
|
|
329
|
-
case 'bgx':
|
|
330
|
-
css[("background-position-" + (prop[2]))] = "calc(" + pos + " + " + value + "px)";
|
|
331
|
-
break;
|
|
332
|
-
|
|
333
|
-
// color
|
|
334
|
-
case 'color':
|
|
335
|
-
case 'backgroundColor':
|
|
336
|
-
case 'borderColor': {
|
|
337
|
-
|
|
338
|
-
var ref$1 = getStep(steps, percent);
|
|
339
|
-
var start = ref$1[0];
|
|
340
|
-
var end = ref$1[1];
|
|
341
|
-
var p = ref$1[2];
|
|
342
|
-
|
|
343
|
-
css[prop] = "rgba(" + (start.map(function (value, i) {
|
|
344
|
-
value += p * (end[i] - value);
|
|
345
|
-
return i === 3 ? uikitUtil.toFloat(value) : parseInt(value, 10);
|
|
346
|
-
}).join(',')) + ")";
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
// CSS Filter
|
|
350
|
-
case 'blur':
|
|
351
|
-
unit = unit || 'px';
|
|
352
|
-
css.filter += " blur(" + (value + unit) + ")";
|
|
353
|
-
break;
|
|
354
|
-
case 'hue':
|
|
355
|
-
unit = unit || 'deg';
|
|
356
|
-
css.filter += " hue-rotate(" + (value + unit) + ")";
|
|
357
|
-
break;
|
|
358
|
-
case 'fopacity':
|
|
359
|
-
unit = unit || '%';
|
|
360
|
-
css.filter += " opacity(" + (value + unit) + ")";
|
|
361
|
-
break;
|
|
362
|
-
case 'grayscale':
|
|
363
|
-
case 'invert':
|
|
364
|
-
case 'saturate':
|
|
365
|
-
case 'sepia':
|
|
366
|
-
unit = unit || '%';
|
|
367
|
-
css.filter += " " + prop + "(" + (value + unit) + ")";
|
|
368
|
-
break;
|
|
369
|
-
default:
|
|
370
|
-
css[prop] = value;
|
|
371
|
-
}
|
|
329
|
+
var src = uikitUtil.css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
|
|
372
330
|
|
|
373
|
-
|
|
331
|
+
var data = this._data;
|
|
374
332
|
|
|
375
|
-
|
|
333
|
+
if (data[src]) {
|
|
334
|
+
return data[src];
|
|
335
|
+
}
|
|
376
336
|
|
|
337
|
+
if (src) {
|
|
338
|
+
var img = new Image();
|
|
339
|
+
img.src = src;
|
|
340
|
+
if (!img.naturalWidth) {
|
|
341
|
+
img.onload = function () { return this$1$1.$update(); };
|
|
377
342
|
}
|
|
378
343
|
|
|
344
|
+
return data[src] = img;
|
|
379
345
|
}
|
|
380
|
-
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
function parseColor(el, color) {
|
|
384
|
-
return uikitUtil.css(uikitUtil.css(el, 'color', color), 'color')
|
|
385
|
-
.split(/[(),]/g)
|
|
386
|
-
.slice(1, -1)
|
|
387
|
-
.concat(1)
|
|
388
|
-
.slice(0, 4)
|
|
389
|
-
.map(uikitUtil.toFloat);
|
|
390
346
|
}
|
|
391
347
|
|
|
392
348
|
function getStep(steps, percent) {
|
|
393
349
|
var count = steps.length - 1;
|
|
394
350
|
var index = Math.min(Math.floor(count * percent), count - 1);
|
|
395
|
-
var step = steps.slice(index, index + 2);
|
|
396
|
-
|
|
397
|
-
step.push(percent === 1 ? 1 : percent % (1 / count) * count);
|
|
398
351
|
|
|
399
|
-
return
|
|
352
|
+
return steps
|
|
353
|
+
.slice(index, index + 2)
|
|
354
|
+
.concat(percent === 1 ? 1 : percent % (1 / count) * count);
|
|
400
355
|
}
|
|
401
356
|
|
|
402
|
-
function getValue(steps, percent
|
|
403
|
-
if ( digits === void 0 ) digits = 2;
|
|
404
|
-
|
|
357
|
+
function getValue(steps, percent) {
|
|
405
358
|
var ref = getStep(steps, percent);
|
|
406
359
|
var start = ref[0];
|
|
407
360
|
var end = ref[1];
|
|
408
361
|
var p = ref[2];
|
|
409
|
-
return
|
|
362
|
+
return uikitUtil.isNumber(start)
|
|
410
363
|
? start + Math.abs(start - end) * p * (start < end ? 1 : -1)
|
|
411
|
-
: +end
|
|
412
|
-
).toFixed(digits);
|
|
364
|
+
: +end;
|
|
413
365
|
}
|
|
414
366
|
|
|
415
|
-
function getUnit(steps) {
|
|
416
|
-
return steps.reduce(function (unit, step) { return uikitUtil.isString(step) && step.replace(
|
|
367
|
+
function getUnit(steps, defaultUnit) {
|
|
368
|
+
return steps.reduce(function (unit, step) { return unit || uikitUtil.isString(step) && step.replace(/[\d-]/g, '').trim(); }, '') || defaultUnit;
|
|
417
369
|
}
|
|
418
370
|
|
|
419
|
-
function
|
|
420
|
-
var
|
|
421
|
-
var
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
371
|
+
function getCssValue(el, prop, value) {
|
|
372
|
+
var prev = el.style[prop];
|
|
373
|
+
var val = uikitUtil.css(uikitUtil.css(el, prop, value), prop);
|
|
374
|
+
el.style[prop] = prev;
|
|
375
|
+
return val;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function fillObject(keys, value) {
|
|
379
|
+
return keys.reduce(function (data, prop) {
|
|
380
|
+
data[prop] = value;
|
|
381
|
+
return data;
|
|
382
|
+
}, {});
|
|
425
383
|
}
|
|
426
384
|
|
|
427
385
|
var Component = {
|