uikit 3.11.2-dev.31cd2ba38 → 3.11.2-dev.3dfa2c50b

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.
Files changed (168) hide show
  1. package/.eslintrc.json +4 -49
  2. package/.prettierignore +14 -0
  3. package/.prettierrc.json +13 -0
  4. package/.webstorm.js +3 -3
  5. package/CHANGELOG.md +7 -11
  6. package/build/.eslintrc.json +1 -3
  7. package/build/build.js +26 -28
  8. package/build/icons.js +7 -11
  9. package/build/less.js +48 -36
  10. package/build/package.json +2 -2
  11. package/build/prefix.js +21 -18
  12. package/build/publishDev.js +6 -8
  13. package/build/release.js +20 -17
  14. package/build/scope.js +21 -11
  15. package/build/scss.js +72 -39
  16. package/build/util.js +71 -62
  17. package/build/wrapper/icons.js +0 -2
  18. package/dist/css/uikit-core-rtl.css +42 -17
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +42 -17
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +42 -17
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +42 -17
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +88 -133
  27. package/dist/js/components/countdown.min.js +1 -1
  28. package/dist/js/components/filter.js +409 -438
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1116 -1305
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1164 -1383
  33. package/dist/js/components/lightbox.min.js +1 -1
  34. package/dist/js/components/notification.js +94 -114
  35. package/dist/js/components/notification.min.js +1 -1
  36. package/dist/js/components/parallax.js +294 -345
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +292 -344
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +727 -850
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +292 -344
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +615 -799
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +588 -619
  47. package/dist/js/components/sortable.min.js +1 -1
  48. package/dist/js/components/tooltip.js +324 -356
  49. package/dist/js/components/tooltip.min.js +1 -1
  50. package/dist/js/components/upload.js +155 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5266 -6572
  53. package/dist/js/uikit-core.min.js +1 -1
  54. package/dist/js/uikit-icons.js +7 -9
  55. package/dist/js/uikit-icons.min.js +1 -1
  56. package/dist/js/uikit.js +8126 -9876
  57. package/dist/js/uikit.min.js +1 -1
  58. package/jsconfig.json +1 -1
  59. package/package.json +64 -60
  60. package/src/js/api/boot.js +25 -32
  61. package/src/js/api/component.js +23 -27
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +13 -32
  64. package/src/js/api/instance.js +7 -15
  65. package/src/js/api/state.js +79 -100
  66. package/src/js/components/countdown.js +24 -50
  67. package/src/js/components/filter.js +71 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +11 -23
  70. package/src/js/components/internal/slider-transitioner.js +66 -45
  71. package/src/js/components/internal/slideshow-animations.js +42 -61
  72. package/src/js/components/lightbox-panel.js +135 -109
  73. package/src/js/components/lightbox.js +18 -39
  74. package/src/js/components/notification.js +49 -43
  75. package/src/js/components/parallax.js +16 -30
  76. package/src/js/components/slider-parallax.js +13 -23
  77. package/src/js/components/slider.js +75 -64
  78. package/src/js/components/slideshow-parallax.js +1 -1
  79. package/src/js/components/slideshow.js +8 -13
  80. package/src/js/components/sortable.js +125 -106
  81. package/src/js/components/tooltip.js +41 -31
  82. package/src/js/components/upload.js +52 -63
  83. package/src/js/core/accordion.js +53 -48
  84. package/src/js/core/alert.js +10 -17
  85. package/src/js/core/core.js +74 -53
  86. package/src/js/core/cover.js +11 -15
  87. package/src/js/core/drop.js +106 -92
  88. package/src/js/core/form-custom.js +20 -25
  89. package/src/js/core/gif.js +3 -7
  90. package/src/js/core/grid.js +57 -58
  91. package/src/js/core/height-match.js +16 -29
  92. package/src/js/core/height-viewport.js +28 -35
  93. package/src/js/core/icon.js +38 -50
  94. package/src/js/core/img.js +130 -105
  95. package/src/js/core/index.js +39 -39
  96. package/src/js/core/leader.js +9 -18
  97. package/src/js/core/margin.js +21 -37
  98. package/src/js/core/modal.js +50 -36
  99. package/src/js/core/nav.js +2 -4
  100. package/src/js/core/navbar.js +112 -88
  101. package/src/js/core/offcanvas.js +49 -53
  102. package/src/js/core/overflow-auto.js +13 -17
  103. package/src/js/core/responsive.js +14 -12
  104. package/src/js/core/scroll.js +10 -20
  105. package/src/js/core/scrollspy-nav.js +34 -31
  106. package/src/js/core/scrollspy.js +37 -54
  107. package/src/js/core/sticky.js +130 -91
  108. package/src/js/core/svg.js +60 -79
  109. package/src/js/core/switcher.js +47 -46
  110. package/src/js/core/tab.js +7 -10
  111. package/src/js/core/toggle.js +64 -66
  112. package/src/js/core/video.js +11 -22
  113. package/src/js/mixin/animate.js +19 -20
  114. package/src/js/mixin/class.js +2 -4
  115. package/src/js/mixin/container.js +7 -11
  116. package/src/js/mixin/internal/animate-fade.js +73 -30
  117. package/src/js/mixin/internal/animate-slide.js +61 -41
  118. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  119. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  120. package/src/js/mixin/media.js +5 -10
  121. package/src/js/mixin/modal.js +89 -66
  122. package/src/js/mixin/parallax.js +53 -48
  123. package/src/js/mixin/position.js +26 -20
  124. package/src/js/mixin/slider-autoplay.js +12 -21
  125. package/src/js/mixin/slider-drag.js +64 -65
  126. package/src/js/mixin/slider-nav.js +26 -35
  127. package/src/js/mixin/slider-reactive.js +2 -8
  128. package/src/js/mixin/slider.js +51 -50
  129. package/src/js/mixin/slideshow.js +13 -19
  130. package/src/js/mixin/togglable.js +90 -63
  131. package/src/js/uikit-core.js +2 -4
  132. package/src/js/uikit.js +2 -4
  133. package/src/js/util/ajax.js +27 -43
  134. package/src/js/util/animation.js +82 -75
  135. package/src/js/util/attr.js +17 -21
  136. package/src/js/util/class.js +14 -52
  137. package/src/js/util/dimensions.js +56 -43
  138. package/src/js/util/dom.js +40 -73
  139. package/src/js/util/env.js +7 -12
  140. package/src/js/util/event.js +60 -59
  141. package/src/js/util/fastdom.js +1 -6
  142. package/src/js/util/filter.js +17 -34
  143. package/src/js/util/index.js +0 -1
  144. package/src/js/util/lang.js +79 -119
  145. package/src/js/util/mouse.js +19 -17
  146. package/src/js/util/options.js +42 -47
  147. package/src/js/util/player.js +40 -36
  148. package/src/js/util/position.js +54 -46
  149. package/src/js/util/promise.js +0 -191
  150. package/src/js/util/selector.js +39 -48
  151. package/src/js/util/style.js +36 -46
  152. package/src/js/util/viewport.js +75 -64
  153. package/src/less/components/flex.less +0 -9
  154. package/src/less/components/navbar.less +0 -7
  155. package/src/less/components/utility.less +22 -0
  156. package/src/scss/components/flex.scss +0 -9
  157. package/src/scss/components/form.scss +3 -3
  158. package/src/scss/components/icon.scss +2 -2
  159. package/src/scss/components/navbar.scss +0 -7
  160. package/src/scss/components/search.scss +1 -1
  161. package/src/scss/components/utility.scss +22 -0
  162. package/src/scss/variables-theme.scss +6 -6
  163. package/src/scss/variables.scss +6 -6
  164. package/tests/image.html +38 -22
  165. package/tests/js/index.js +114 -85
  166. package/src/js/mixin/flex-bug.js +0 -56
  167. package/tests/images/test.avif +0 -0
  168. package/tests/images/test.webp +0 -0
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.31cd2ba38 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.3dfa2c50b | 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')) :
@@ -7,494 +7,442 @@
7
7
  })(this, (function (uikitUtil) { 'use strict';
8
8
 
9
9
  var Media = {
10
+ props: {
11
+ media: Boolean },
10
12
 
11
- props: {
12
- media: Boolean
13
- },
14
13
 
15
- data: {
16
- media: false
17
- },
14
+ data: {
15
+ media: false },
18
16
 
19
- computed: {
20
17
 
21
- matchMedia: function() {
22
- var media = toMedia(this.media);
23
- return !media || window.matchMedia(media).matches;
24
- }
18
+ computed: {
19
+ matchMedia() {
20
+ const media = toMedia(this.media);
21
+ return !media || window.matchMedia(media).matches;
22
+ } } };
25
23
 
26
- }
27
24
 
28
- };
29
25
 
30
26
  function toMedia(value) {
31
-
32
- if (uikitUtil.isString(value)) {
33
- if (value[0] === '@') {
34
- var name = "breakpoint-" + (value.substr(1));
35
- value = uikitUtil.toFloat(uikitUtil.getCssVar(name));
36
- } else if (isNaN(value)) {
37
- return value;
38
- }
27
+ if (uikitUtil.isString(value)) {
28
+ if (value[0] === '@') {
29
+ const name = "breakpoint-" + value.substr(1);
30
+ value = uikitUtil.toFloat(uikitUtil.getCssVar(name));
31
+ } else if (isNaN(value)) {
32
+ return value;
39
33
  }
34
+ }
40
35
 
41
- return value && !isNaN(value) ? ("(min-width: " + value + "px)") : false;
36
+ return value && !isNaN(value) ? "(min-width: " + value + "px)" : false;
42
37
  }
43
38
 
44
- uikitUtil.memoize(function (src) { return new uikitUtil.Promise(function (resolve, reject) {
45
-
46
- if (!src) {
47
- reject();
48
- return;
49
- }
50
-
51
- if (uikitUtil.startsWith(src, 'data:')) {
52
- resolve(decodeURIComponent(src.split(',')[1]));
53
- } else {
39
+ uikitUtil.memoize(async (src) => {
40
+ if (src) {
41
+ if (uikitUtil.startsWith(src, 'data:')) {
42
+ return decodeURIComponent(src.split(',')[1]);
43
+ } else {
44
+ return (await fetch(src)).text();
45
+ }
46
+ } else {
47
+ return Promise.reject();
48
+ }
49
+ });
54
50
 
55
- uikitUtil.ajax(src).then(
56
- function (xhr) { return resolve(xhr.response); },
57
- function () { return reject('SVG not found.'); }
58
- );
51
+ function getMaxPathLength(el) {
52
+ return Math.ceil(
53
+ Math.max(
54
+ 0,
55
+ ...uikitUtil.$$('[stroke]', el).map((stroke) => {
56
+ try {
57
+ return stroke.getTotalLength();
58
+ } catch (e) {
59
+ return 0;
60
+ }
61
+ })));
59
62
 
60
- }
61
- }); }
62
- );
63
63
 
64
- function getMaxPathLength(el) {
65
- return Math.ceil(Math.max.apply(Math, [ 0 ].concat( uikitUtil.$$('[stroke]', el).map(function (stroke) {
66
- try {
67
- return stroke.getTotalLength();
68
- } catch (e) {
69
- return 0;
70
- }
71
- }) )));
72
64
  }
73
65
 
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;
66
+ const props = {
67
+ x: transformFn,
68
+ y: transformFn,
69
+ rotate: transformFn,
70
+ scale: transformFn,
71
+ color: colorFn,
72
+ backgroundColor: colorFn,
73
+ borderColor: colorFn,
74
+ blur: filterFn,
75
+ hue: filterFn,
76
+ fopacity: filterFn,
77
+ grayscale: filterFn,
78
+ invert: filterFn,
79
+ saturate: filterFn,
80
+ sepia: filterFn,
81
+ opacity: cssPropFn,
82
+ stroke: strokeFn,
83
+ bgx: backgroundFn,
84
+ bgy: backgroundFn };
85
+
86
+
87
+ const { keys } = Object;
96
88
 
97
89
  var Parallax = {
90
+ mixins: [Media],
98
91
 
99
- mixins: [Media],
100
-
101
- props: fillObject(keys(props), 'list'),
102
-
103
- data: fillObject(keys(props), undefined),
92
+ props: fillObject(keys(props), 'list'),
104
93
 
105
- computed: {
94
+ data: fillObject(keys(props), undefined),
106
95
 
107
- props: function(properties, $el) {
108
- return keys(props).reduce(function (result, prop) {
109
- if (!uikitUtil.isUndefined(properties[prop])) {
110
- result[prop] = props[prop](prop, $el, properties[prop].slice());
111
- }
112
- return result;
113
- }, {});
96
+ computed: {
97
+ props(properties, $el) {
98
+ return keys(props).reduce((result, prop) => {
99
+ if (!uikitUtil.isUndefined(properties[prop])) {
100
+ result[prop] = props[prop](prop, $el, properties[prop].slice());
114
101
  }
102
+ return result;
103
+ }, {});
104
+ } },
115
105
 
116
- },
117
-
118
- events: {
119
- bgimageload: function() {
120
- this.$emit();
121
- }
122
- },
123
106
 
124
- methods: {
107
+ events: {
108
+ bgimageload() {
109
+ this.$emit();
110
+ } },
125
111
 
126
- reset: function() {
127
- var this$1$1 = this;
128
112
 
129
- uikitUtil.each(this.getCss(0), function (_, prop) { return uikitUtil.css(this$1$1.$el, prop, ''); });
130
- },
113
+ methods: {
114
+ reset() {
115
+ uikitUtil.each(this.getCss(0), (_, prop) => uikitUtil.css(this.$el, prop, ''));
116
+ },
131
117
 
132
- getCss: function(percent) {
133
- var this$1$1 = this;
118
+ getCss(percent) {
119
+ return keys(this.props).reduce(
120
+ (css, prop) => {
121
+ this.props[prop](css, percent);
122
+ return css;
123
+ },
124
+ { transform: '', filter: '' });
134
125
 
135
- return keys(this.props).reduce(function (css, prop) {
136
- this$1$1.props[prop](css, percent);
137
- return css;
138
- }, {transform: '', filter: ''});
139
- }
126
+ } } };
140
127
 
141
- }
142
128
 
143
- };
144
129
 
145
130
  function transformFn(prop, el, steps) {
131
+ const unit = getUnit(steps) || { x: 'px', y: 'px', rotate: 'deg' }[prop] || '';
146
132
 
147
- var unit = getUnit(steps) || {x: 'px', y: 'px', rotate: 'deg'}[prop] || '';
148
-
149
- if (prop === 'x' || prop === 'y') {
150
- prop = "translate" + (uikitUtil.ucfirst(prop));
151
- }
133
+ if (prop === 'x' || prop === 'y') {
134
+ prop = "translate" + uikitUtil.ucfirst(prop);
135
+ }
152
136
 
153
- steps = steps.map(uikitUtil.toFloat);
137
+ steps = steps.map(uikitUtil.toFloat);
154
138
 
155
- if (steps.length === 1) {
156
- steps.unshift(prop === 'scale' ? 1 : 0);
157
- }
139
+ if (steps.length === 1) {
140
+ steps.unshift(prop === 'scale' ? 1 : 0);
141
+ }
158
142
 
159
- return function (css, percent) {
160
- var value = getValue(steps, percent);
143
+ return (css, percent) => {
144
+ let value = getValue(steps, percent);
161
145
 
162
- if (uikitUtil.startsWith(prop, 'translate')) {
163
- value = uikitUtil.toFloat(value).toFixed(unit === 'px' ? 0 : 6);
164
- }
146
+ if (uikitUtil.startsWith(prop, 'translate')) {
147
+ value = uikitUtil.toFloat(value).toFixed(unit === 'px' ? 0 : 6);
148
+ }
165
149
 
166
- css.transform += " " + prop + "(" + value + unit + ")";
167
- };
150
+ css.transform += " " + prop + "(" + value + unit + ")";
151
+ };
168
152
  }
169
153
 
170
154
  function colorFn(prop, el, steps) {
171
-
172
- if (steps.length === 1) {
173
- steps.unshift(getCssValue(el, prop, ''));
174
- }
175
-
176
- steps = steps.map(function (step) { return parseColor(el, step); });
177
-
178
- return function (css, percent) {
179
-
180
- var ref = getStep(steps, percent);
181
- var start = ref[0];
182
- var end = ref[1];
183
- var p = ref[2];
184
- var value = start.map(function (value, i) {
185
- value += p * (end[i] - value);
186
- return i === 3 ? uikitUtil.toFloat(value) : parseInt(value, 10);
187
- }).join(',');
188
- css[prop] = "rgba(" + value + ")";
189
- };
155
+ if (steps.length === 1) {
156
+ steps.unshift(getCssValue(el, prop, ''));
157
+ }
158
+
159
+ steps = steps.map((step) => parseColor(el, step));
160
+
161
+ return (css, percent) => {
162
+ const [start, end, p] = getStep(steps, percent);
163
+ const value = start.
164
+ map((value, i) => {
165
+ value += p * (end[i] - value);
166
+ return i === 3 ? uikitUtil.toFloat(value) : parseInt(value, 10);
167
+ }).
168
+ join(',');
169
+ css[prop] = "rgba(" + value + ")";
170
+ };
190
171
  }
191
172
 
192
173
  function parseColor(el, color) {
193
- return getCssValue(el, 'color', color)
194
- .split(/[(),]/g)
195
- .slice(1, -1)
196
- .concat(1)
197
- .slice(0, 4)
198
- .map(uikitUtil.toFloat);
174
+ return getCssValue(el, 'color', color).
175
+ split(/[(),]/g).
176
+ slice(1, -1).
177
+ concat(1).
178
+ slice(0, 4).
179
+ map(uikitUtil.toFloat);
199
180
  }
200
181
 
201
182
  function filterFn(prop, el, steps) {
202
-
203
- if (steps.length === 1) {
204
- steps.unshift(0);
205
- }
206
-
207
- var unit = getUnit(steps) || {blur: 'px', hue: 'deg'}[prop] || '%';
208
- prop = {fopacity: 'opacity', hue: 'hue-rotate'}[prop] || prop;
209
- steps = steps.map(uikitUtil.toFloat);
210
-
211
- return function (css, percent) {
212
- var value = getValue(steps, percent);
213
- css.filter += " " + prop + "(" + (value + unit) + ")";
214
- };
183
+ if (steps.length === 1) {
184
+ steps.unshift(0);
185
+ }
186
+
187
+ const unit = getUnit(steps) || { blur: 'px', hue: 'deg' }[prop] || '%';
188
+ prop = { fopacity: 'opacity', hue: 'hue-rotate' }[prop] || prop;
189
+ steps = steps.map(uikitUtil.toFloat);
190
+
191
+ return (css, percent) => {
192
+ const value = getValue(steps, percent);
193
+ css.filter += " " + prop + "(" + (value + unit) + ")";
194
+ };
215
195
  }
216
196
 
217
197
  function cssPropFn(prop, el, steps) {
198
+ if (steps.length === 1) {
199
+ steps.unshift(getCssValue(el, prop, ''));
200
+ }
218
201
 
219
- if (steps.length === 1) {
220
- steps.unshift(getCssValue(el, prop, ''));
221
- }
222
-
223
- steps = steps.map(uikitUtil.toFloat);
202
+ steps = steps.map(uikitUtil.toFloat);
224
203
 
225
- return function (css, percent) {
226
- css[prop] = getValue(steps, percent);
227
- };
204
+ return (css, percent) => {
205
+ css[prop] = getValue(steps, percent);
206
+ };
228
207
  }
229
208
 
230
209
  function strokeFn(prop, el, steps) {
210
+ if (steps.length === 1) {
211
+ steps.unshift(0);
212
+ }
231
213
 
232
- if (steps.length === 1) {
233
- steps.unshift(0);
234
- }
214
+ const unit = getUnit(steps);
215
+ steps = steps.map(uikitUtil.toFloat);
235
216
 
236
- var unit = getUnit(steps);
237
- steps = steps.map(uikitUtil.toFloat);
217
+ if (!steps.some((step) => step)) {
218
+ return uikitUtil.noop;
219
+ }
238
220
 
239
- if (!steps.some(function (step) { return step; })) {
240
- return uikitUtil.noop;
241
- }
221
+ const length = getMaxPathLength(el);
222
+ uikitUtil.css(el, 'strokeDasharray', length);
242
223
 
243
- var length = getMaxPathLength(el);
244
- uikitUtil.css(el, 'strokeDasharray', length);
224
+ if (unit === '%') {
225
+ steps = steps.map((step) => step * length / 100);
226
+ }
245
227
 
246
- if (unit === '%') {
247
- steps = steps.map(function (step) { return step * length / 100; });
248
- }
249
-
250
- steps = steps.reverse();
228
+ steps = steps.reverse();
251
229
 
252
- return function (css, percent) {
253
- css.strokeDashoffset = getValue(steps, percent);
254
- };
230
+ return (css, percent) => {
231
+ css.strokeDashoffset = getValue(steps, percent);
232
+ };
255
233
  }
256
234
 
257
235
  function backgroundFn(prop, el, steps) {
236
+ if (steps.length === 1) {
237
+ steps.unshift(0);
238
+ }
258
239
 
259
- if (steps.length === 1) {
260
- steps.unshift(0);
261
- }
262
-
263
- prop = prop.substr(-1);
264
- var attr = prop === 'y' ? 'height' : 'width';
265
- steps = steps.map(function (step) { return uikitUtil.toPx(step, attr, el); });
240
+ prop = prop.substr(-1);
241
+ const attr = prop === 'y' ? 'height' : 'width';
242
+ steps = steps.map((step) => uikitUtil.toPx(step, attr, el));
266
243
 
267
- uikitUtil.css(el, ("background-position-" + prop), '');
268
- var bgPos = uikitUtil.css(el, 'backgroundPosition').split(' ')[prop === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
244
+ const bgPos = getCssValue(el, "background-position-" + prop, '');
269
245
 
270
- return getCssValue(el, 'backgroundSize', '') === 'cover'
271
- ? backgroundCoverFn(prop, el, steps, bgPos, attr)
272
- : setBackgroundPosFn(prop, steps, bgPos);
246
+ return getCssValue(el, 'backgroundSize', '') === 'cover' ?
247
+ backgroundCoverFn(prop, el, steps, bgPos, attr) :
248
+ setBackgroundPosFn(prop, steps, bgPos);
273
249
  }
274
250
 
275
251
  function backgroundCoverFn(prop, el, steps, bgPos, attr) {
252
+ const dimImage = getBackgroundImageDimensions(el);
276
253
 
277
- var dimImage = getBackgroundImageDimensions(el);
254
+ if (!dimImage.width) {
255
+ return uikitUtil.noop;
256
+ }
278
257
 
279
- if (!dimImage.width) {
280
- return uikitUtil.noop;
281
- }
282
-
283
- var min = Math.min.apply(Math, steps);
284
- var max = Math.max.apply(Math, steps);
285
- var down = steps.indexOf(min) < steps.indexOf(max);
258
+ const min = Math.min(...steps);
259
+ const max = Math.max(...steps);
260
+ const down = steps.indexOf(min) < steps.indexOf(max);
286
261
 
287
- var diff = max - min;
288
- var pos = (down ? -diff : 0) - (down ? min : max);
262
+ const diff = max - min;
263
+ let pos = (down ? -diff : 0) - (down ? min : max);
289
264
 
290
- var dimEl = {
291
- width: el.offsetWidth,
292
- height: el.offsetHeight
293
- };
265
+ const dimEl = {
266
+ width: el.offsetWidth,
267
+ height: el.offsetHeight };
294
268
 
295
- var baseDim = uikitUtil.Dimensions.cover(dimImage, dimEl);
296
- var span = baseDim[attr] - dimEl[attr];
297
269
 
298
- if (span < diff) {
299
- dimEl[attr] = baseDim[attr] + diff - span;
300
- } else if (span > diff) {
270
+ const baseDim = uikitUtil.Dimensions.cover(dimImage, dimEl);
271
+ const span = baseDim[attr] - dimEl[attr];
301
272
 
302
- var posPercentage = dimEl[attr] / uikitUtil.toPx(bgPos, attr, el, true);
273
+ if (span < diff) {
274
+ dimEl[attr] = baseDim[attr] + diff - span;
275
+ } else if (span > diff) {
276
+ const posPercentage = dimEl[attr] / uikitUtil.toPx(bgPos, attr, el, true);
303
277
 
304
- if (posPercentage) {
305
- pos -= (span - diff) / posPercentage;
306
- }
278
+ if (posPercentage) {
279
+ pos -= (span - diff) / posPercentage;
307
280
  }
281
+ }
308
282
 
309
- var dim = uikitUtil.Dimensions.cover(dimImage, dimEl);
283
+ const dim = uikitUtil.Dimensions.cover(dimImage, dimEl);
310
284
 
311
- var fn = setBackgroundPosFn(prop, steps, (pos + "px"));
312
- return function (css, percent) {
313
- fn(css, percent);
314
- css.backgroundSize = (dim.width) + "px " + (dim.height) + "px";
315
- css.backgroundRepeat = 'no-repeat';
316
- };
285
+ const fn = setBackgroundPosFn(prop, steps, pos + "px");
286
+ return (css, percent) => {
287
+ fn(css, percent);
288
+ css.backgroundSize = dim.width + "px " + dim.height + "px";
289
+ css.backgroundRepeat = 'no-repeat';
290
+ };
317
291
  }
318
292
 
319
293
  function setBackgroundPosFn(prop, steps, pos) {
320
- return function (css, percent) {
321
- css[("background-position-" + prop)] = "calc(" + pos + " + " + (getValue(steps, percent)) + "px)";
322
- };
294
+ return function (css, percent) {
295
+ css["background-position-" + prop] = "calc(" + pos + " + " + getValue(steps, percent) + "px)";
296
+ };
323
297
  }
324
298
 
325
- var dimensions = {};
299
+ const dimensions = {};
326
300
  function getBackgroundImageDimensions(el) {
327
- var src = uikitUtil.css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
301
+ const src = uikitUtil.css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
328
302
 
329
- if (dimensions[src]) {
330
- return dimensions[src];
331
- }
303
+ if (dimensions[src]) {
304
+ return dimensions[src];
305
+ }
332
306
 
333
- var image = new Image();
334
- if (src) {
335
- image.src = src;
307
+ const image = new Image();
308
+ if (src) {
309
+ image.src = src;
336
310
 
337
- if (!image.naturalWidth) {
338
- image.onload = function () {
339
- dimensions[src] = toDimensions(image);
340
- uikitUtil.trigger(el, 'bgimageload');
341
- };
342
- }
311
+ if (!image.naturalWidth) {
312
+ image.onload = () => {
313
+ dimensions[src] = toDimensions(image);
314
+ uikitUtil.trigger(el, 'bgimageload');
315
+ };
343
316
  }
317
+ }
344
318
 
345
- return dimensions[src] = toDimensions(image);
319
+ return dimensions[src] = toDimensions(image);
346
320
  }
347
321
 
348
322
  function toDimensions(image) {
349
- return {
350
- width: image.naturalWidth,
351
- height: image.naturalHeight
352
- };
323
+ return {
324
+ width: image.naturalWidth,
325
+ height: image.naturalHeight };
326
+
353
327
  }
354
328
 
355
329
  function getStep(steps, percent) {
356
- var count = steps.length - 1;
357
- var index = Math.min(Math.floor(count * percent), count - 1);
330
+ const count = steps.length - 1;
331
+ const index = Math.min(Math.floor(count * percent), count - 1);
358
332
 
359
- return steps
360
- .slice(index, index + 2)
361
- .concat(percent === 1 ? 1 : percent % (1 / count) * count);
333
+ return steps.
334
+ slice(index, index + 2).
335
+ concat(percent === 1 ? 1 : percent % (1 / count) * count);
362
336
  }
363
337
 
364
338
  function getValue(steps, percent) {
365
- var ref = getStep(steps, percent);
366
- var start = ref[0];
367
- var end = ref[1];
368
- var p = ref[2];
369
- return uikitUtil.isNumber(start)
370
- ? start + Math.abs(start - end) * p * (start < end ? 1 : -1)
371
- : +end;
339
+ const [start, end, p] = getStep(steps, percent);
340
+ return uikitUtil.isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
372
341
  }
373
342
 
374
343
  function getUnit(steps, defaultUnit) {
375
- return steps.reduce(function (unit, step) { return unit || uikitUtil.isString(step) && step.replace(/[\d-]/g, '').trim(); }, '') || defaultUnit;
344
+ return (
345
+ steps.reduce(
346
+ (unit, step) => unit || uikitUtil.isString(step) && step.replace(/[\d-]/g, '').trim(),
347
+ '') ||
348
+ defaultUnit);
349
+
376
350
  }
377
351
 
378
352
  function getCssValue(el, prop, value) {
379
- var prev = el.style[prop];
380
- var val = uikitUtil.css(uikitUtil.css(el, prop, value), prop);
381
- el.style[prop] = prev;
382
- return val;
353
+ const prev = el.style[prop];
354
+ const val = uikitUtil.css(uikitUtil.css(el, prop, value), prop);
355
+ el.style[prop] = prev;
356
+ return val;
383
357
  }
384
358
 
385
359
  function fillObject(keys, value) {
386
- return keys.reduce(function (data, prop) {
387
- data[prop] = value;
388
- return data;
389
- }, {});
360
+ return keys.reduce((data, prop) => {
361
+ data[prop] = value;
362
+ return data;
363
+ }, {});
390
364
  }
391
365
 
392
366
  var Component = {
367
+ mixins: [Parallax],
393
368
 
394
- mixins: [Parallax],
395
-
396
- data: {
397
- selItem: '!li'
398
- },
399
-
400
- computed: {
401
-
402
- item: function(ref, $el) {
403
- var selItem = ref.selItem;
404
-
405
- return uikitUtil.query(selItem, $el);
406
- }
407
-
408
- },
369
+ data: {
370
+ selItem: '!li' },
409
371
 
410
- events: [
411
372
 
412
- {
413
- name: 'itemin itemout',
373
+ computed: {
374
+ item(_ref, $el) {let { selItem } = _ref;
375
+ return uikitUtil.query(selItem, $el);
376
+ } },
414
377
 
415
- self: true,
416
378
 
417
- el: function() {
418
- return this.item;
419
- },
379
+ events: [
380
+ {
381
+ name: 'itemin itemout',
420
382
 
421
- handler: function(ref) {
422
- var this$1$1 = this;
423
- var type = ref.type;
424
- var ref_detail = ref.detail;
425
- var percent = ref_detail.percent;
426
- var duration = ref_detail.duration;
427
- var timing = ref_detail.timing;
428
- var dir = ref_detail.dir;
383
+ self: true,
429
384
 
385
+ el() {
386
+ return this.item;
387
+ },
430
388
 
431
- uikitUtil.fastdom.read(function () {
432
- var propsFrom = this$1$1.getCss(getCurrentPercent(type, dir, percent));
433
- var propsTo = this$1$1.getCss(isIn(type) ? .5 : dir > 0 ? 1 : 0);
434
- uikitUtil.fastdom.write(function () {
435
- uikitUtil.css(this$1$1.$el, propsFrom);
436
- uikitUtil.Transition.start(this$1$1.$el, propsTo, duration, timing).catch(uikitUtil.noop);
437
- });
438
- });
389
+ handler(_ref2) {let { type, detail: { percent, duration, timing, dir } } = _ref2;
390
+ uikitUtil.fastdom.read(() => {
391
+ const propsFrom = this.getCss(getCurrentPercent(type, dir, percent));
392
+ const propsTo = this.getCss(isIn(type) ? 0.5 : dir > 0 ? 1 : 0);
393
+ uikitUtil.fastdom.write(() => {
394
+ uikitUtil.css(this.$el, propsFrom);
395
+ uikitUtil.Transition.start(this.$el, propsTo, duration, timing).catch(uikitUtil.noop);
396
+ });
397
+ });
398
+ } },
439
399
 
440
- }
441
- },
442
400
 
443
- {
444
- name: 'transitioncanceled transitionend',
401
+ {
402
+ name: 'transitioncanceled transitionend',
445
403
 
446
- self: true,
404
+ self: true,
447
405
 
448
- el: function() {
449
- return this.item;
450
- },
406
+ el() {
407
+ return this.item;
408
+ },
451
409
 
452
- handler: function() {
453
- uikitUtil.Transition.cancel(this.$el);
454
- }
410
+ handler() {
411
+ uikitUtil.Transition.cancel(this.$el);
412
+ } },
455
413
 
456
- },
457
414
 
458
- {
459
- name: 'itemtranslatein itemtranslateout',
415
+ {
416
+ name: 'itemtranslatein itemtranslateout',
460
417
 
461
- self: true,
418
+ self: true,
462
419
 
463
- el: function() {
464
- return this.item;
465
- },
420
+ el() {
421
+ return this.item;
422
+ },
466
423
 
467
- handler: function(ref) {
468
- var this$1$1 = this;
469
- var type = ref.type;
470
- var ref_detail = ref.detail;
471
- var percent = ref_detail.percent;
472
- var dir = ref_detail.dir;
424
+ handler(_ref3) {let { type, detail: { percent, dir } } = _ref3;
425
+ uikitUtil.fastdom.read(() => {
426
+ const props = this.getCss(getCurrentPercent(type, dir, percent));
427
+ uikitUtil.fastdom.write(() => uikitUtil.css(this.$el, props));
428
+ });
429
+ } }] };
473
430
 
474
- uikitUtil.fastdom.read(function () {
475
- var props = this$1$1.getCss(getCurrentPercent(type, dir, percent));
476
- uikitUtil.fastdom.write(function () { return uikitUtil.css(this$1$1.$el, props); });
477
- });
478
- }
479
- }
480
431
 
481
- ]
482
432
 
483
- };
484
433
 
485
434
  function isIn(type) {
486
- return uikitUtil.endsWith(type, 'in');
435
+ return uikitUtil.endsWith(type, 'in');
487
436
  }
488
437
 
489
438
  function getCurrentPercent(type, dir, percent) {
439
+ percent /= 2;
490
440
 
491
- percent /= 2;
492
-
493
- return isIn(type) ^ dir < 0 ? percent : 1 - percent;
441
+ return isIn(type) ^ dir < 0 ? percent : 1 - percent;
494
442
  }
495
443
 
496
444
  if (typeof window !== 'undefined' && window.UIkit) {
497
- window.UIkit.component('slideshowParallax', Component);
445
+ window.UIkit.component('slideshowParallax', Component);
498
446
  }
499
447
 
500
448
  return Component;