uikit 3.11.2-dev.21a5b7139 → 3.11.2-dev.2b60845fb

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 (61) hide show
  1. package/dist/css/uikit-core-rtl.css +1 -1
  2. package/dist/css/uikit-core-rtl.min.css +1 -1
  3. package/dist/css/uikit-core.css +1 -1
  4. package/dist/css/uikit-core.min.css +1 -1
  5. package/dist/css/uikit-rtl.css +1 -1
  6. package/dist/css/uikit-rtl.min.css +1 -1
  7. package/dist/css/uikit.css +1 -1
  8. package/dist/css/uikit.min.css +1 -1
  9. package/dist/js/components/countdown.js +3 -3
  10. package/dist/js/components/countdown.min.js +1 -1
  11. package/dist/js/components/filter.js +5 -7
  12. package/dist/js/components/filter.min.js +1 -1
  13. package/dist/js/components/lightbox-panel.js +6 -6
  14. package/dist/js/components/lightbox-panel.min.js +1 -1
  15. package/dist/js/components/lightbox.js +8 -8
  16. package/dist/js/components/lightbox.min.js +1 -1
  17. package/dist/js/components/notification.js +1 -1
  18. package/dist/js/components/notification.min.js +1 -1
  19. package/dist/js/components/parallax.js +1 -1
  20. package/dist/js/components/parallax.min.js +1 -1
  21. package/dist/js/components/slider-parallax.js +1 -1
  22. package/dist/js/components/slider-parallax.min.js +1 -1
  23. package/dist/js/components/slider.js +16 -17
  24. package/dist/js/components/slider.min.js +1 -1
  25. package/dist/js/components/slideshow-parallax.js +1 -1
  26. package/dist/js/components/slideshow-parallax.min.js +1 -1
  27. package/dist/js/components/slideshow.js +6 -6
  28. package/dist/js/components/slideshow.min.js +1 -1
  29. package/dist/js/components/sortable.js +12 -14
  30. package/dist/js/components/sortable.min.js +1 -1
  31. package/dist/js/components/tooltip.js +1 -1
  32. package/dist/js/components/tooltip.min.js +1 -1
  33. package/dist/js/components/upload.js +10 -14
  34. package/dist/js/components/upload.min.js +1 -1
  35. package/dist/js/uikit-core.js +77 -90
  36. package/dist/js/uikit-core.min.js +1 -1
  37. package/dist/js/uikit-icons.js +1 -1
  38. package/dist/js/uikit-icons.min.js +1 -1
  39. package/dist/js/uikit.js +112 -130
  40. package/dist/js/uikit.min.js +1 -1
  41. package/package.json +1 -1
  42. package/src/js/api/state.js +2 -2
  43. package/src/js/components/countdown.js +2 -2
  44. package/src/js/components/internal/slider-transitioner.js +2 -2
  45. package/src/js/components/lightbox.js +2 -2
  46. package/src/js/components/slider.js +9 -10
  47. package/src/js/components/sortable.js +7 -7
  48. package/src/js/components/upload.js +9 -13
  49. package/src/js/core/accordion.js +3 -3
  50. package/src/js/core/height-match.js +3 -3
  51. package/src/js/core/img.js +3 -1
  52. package/src/js/core/margin.js +11 -13
  53. package/src/js/core/navbar.js +2 -2
  54. package/src/js/core/scrollspy.js +6 -6
  55. package/src/js/core/toggle.js +2 -2
  56. package/src/js/mixin/slider-drag.js +3 -3
  57. package/src/js/mixin/slider-nav.js +2 -2
  58. package/src/js/util/attr.js +14 -12
  59. package/src/js/util/dom.js +5 -20
  60. package/src/js/util/position.js +2 -2
  61. package/src/js/util/promise.js +0 -0
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.21a5b7139 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.2b60845fb | 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() :
@@ -304,17 +304,17 @@
304
304
  if (isUndefined(value)) {var _toNode;
305
305
  return (_toNode = toNode(element)) == null ? void 0 : _toNode.getAttribute(name);
306
306
  } else {
307
- toNodes(element).forEach((element) => {
307
+ for (const el of toNodes(element)) {
308
308
  if (isFunction(value)) {
309
- value = value.call(element, attr(element, name));
309
+ value = value.call(el, attr(el, name));
310
310
  }
311
311
 
312
312
  if (value === null) {
313
- removeAttr(element, name);
313
+ removeAttr(el, name);
314
314
  } else {
315
- element.setAttribute(name, value);
315
+ el.setAttribute(name, value);
316
316
  }
317
- });
317
+ }
318
318
  }
319
319
  }
320
320
 
@@ -323,16 +323,18 @@
323
323
  }
324
324
 
325
325
  function removeAttr(element, name) {
326
- element = toNodes(element);
327
- name.split(' ').forEach((name) =>
328
- element.forEach((element) => element.hasAttribute(name) && element.removeAttribute(name)));
329
-
326
+ const elements = toNodes(element);
327
+ for (const attribute of name.split(' ')) {
328
+ for (const element of elements) {
329
+ element.removeAttribute(attribute);
330
+ }
331
+ }
330
332
  }
331
333
 
332
334
  function data(element, attribute) {
333
- for (let i = 0, attrs = [attribute, "data-" + attribute]; i < attrs.length; i++) {
334
- if (hasAttr(element, attrs[i])) {
335
- return attr(element, attrs[i]);
335
+ for (const name of [attribute, "data-" + attribute]) {
336
+ if (hasAttr(element, name)) {
337
+ return attr(element, name);
336
338
  }
337
339
  }
338
340
  }
@@ -1282,29 +1284,14 @@
1282
1284
  toNodes(element).
1283
1285
  map(parent).
1284
1286
  filter((value, index, self) => self.indexOf(value) === index).
1285
- forEach((parent) => {
1286
- before(parent, parent.childNodes);
1287
- remove$1(parent);
1288
- });
1287
+ forEach((parent) => parent.replaceWith(...parent.childNodes));
1289
1288
  }
1290
1289
 
1291
- const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
1292
- const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
1293
-
1294
1290
  function fragment(html) {
1295
- const matches = singleTagRe.exec(html);
1296
- if (matches) {
1297
- return document.createElement(matches[1]);
1298
- }
1299
-
1300
- const container = document.createElement('div');
1301
- if (fragmentRe.test(html)) {
1302
- container.insertAdjacentHTML('beforeend', html.trim());
1303
- } else {
1304
- container.textContent = html;
1305
- }
1306
-
1307
- return container.childNodes.length > 1 ? toNodes(container.childNodes) : container.firstChild;
1291
+ const template = document.createElement('template');
1292
+ template.innerHTML = html;
1293
+ const { childNodes } = template.content;
1294
+ return childNodes.length > 1 ? toNodes(childNodes) : childNodes[0];
1308
1295
  }
1309
1296
 
1310
1297
  function apply(node, fn) {
@@ -1980,14 +1967,14 @@
1980
1967
  if (newVal >= boundary[align] && newVal + dim[prop] <= boundary[alignFlip]) {
1981
1968
  position[align] = newVal;
1982
1969
 
1983
- ['element', 'target'].forEach((el) => {
1970
+ for (const el of ['element', 'target']) {
1984
1971
  if (elemOffset) {
1985
1972
  flipped[el][dir] =
1986
1973
  flipped[el][dir] === dirs[prop][1] ?
1987
1974
  dirs[prop][2] :
1988
1975
  dirs[prop][1];
1989
1976
  }
1990
- });
1977
+ }
1991
1978
 
1992
1979
  return true;
1993
1980
  }
@@ -2449,9 +2436,9 @@
2449
2436
  }
2450
2437
  };
2451
2438
 
2452
- UIkit.prototype._initEvents = function () {var _this$$options$events;
2439
+ UIkit.prototype._initEvents = function () {
2453
2440
  this._events = [];
2454
- (_this$$options$events = this.$options.events) == null ? void 0 : _this$$options$events.forEach((event) => {
2441
+ for (const event of this.$options.events || []) {
2455
2442
  if (hasOwn(event, 'handler')) {
2456
2443
  registerEvent(this, event);
2457
2444
  } else {
@@ -2459,7 +2446,7 @@
2459
2446
  registerEvent(this, event[key], key);
2460
2447
  }
2461
2448
  }
2462
- });
2449
+ }
2463
2450
  };
2464
2451
 
2465
2452
  UIkit.prototype._unbindEvents = function () {
@@ -2834,7 +2821,7 @@
2834
2821
  UIkit.data = '__uikit__';
2835
2822
  UIkit.prefix = 'uk-';
2836
2823
  UIkit.options = {};
2837
- UIkit.version = '3.11.2-dev.21a5b7139';
2824
+ UIkit.version = '3.11.2-dev.2b60845fb';
2838
2825
 
2839
2826
  globalAPI(UIkit);
2840
2827
  hooksAPI(UIkit);
@@ -3277,37 +3264,37 @@
3277
3264
  return;
3278
3265
  }
3279
3266
 
3280
- items.forEach((el) =>
3281
- this.toggleElement(el, !hasClass(el, this.clsOpen), async (el, show) => {
3282
- toggleClass(el, this.clsOpen, show);
3283
- attr($(this.$props.toggle, el), 'aria-expanded', show);
3267
+ for (const el of items) {
3268
+ this.toggleElement(el, !hasClass(el, this.clsOpen), async (el, show) => {
3269
+ toggleClass(el, this.clsOpen, show);
3270
+ attr($(this.$props.toggle, el), 'aria-expanded', show);
3284
3271
 
3285
- const content = $("" + (el._wrapper ? '> * ' : '') + this.content, el);
3272
+ const content = $("" + (el._wrapper ? '> * ' : '') + this.content, el);
3286
3273
 
3287
- if (animate === false || !this.hasTransition) {
3288
- hide(content, !show);
3289
- return;
3290
- }
3274
+ if (animate === false || !this.hasTransition) {
3275
+ hide(content, !show);
3276
+ return;
3277
+ }
3291
3278
 
3292
- if (!el._wrapper) {
3293
- el._wrapper = wrapAll(content, "<div" + (show ? ' hidden' : '') + ">");
3294
- }
3279
+ if (!el._wrapper) {
3280
+ el._wrapper = wrapAll(content, "<div" + (show ? ' hidden' : '') + ">");
3281
+ }
3295
3282
 
3296
- hide(content, false);
3297
- await toggleHeight(this)(el._wrapper, show);
3298
- hide(content, !show);
3283
+ hide(content, false);
3284
+ await toggleHeight(this)(el._wrapper, show);
3285
+ hide(content, !show);
3299
3286
 
3300
- delete el._wrapper;
3301
- unwrap(content);
3287
+ delete el._wrapper;
3288
+ unwrap(content);
3302
3289
 
3303
- if (show) {
3304
- const toggle = $(this.$props.toggle, el);
3305
- if (!isInView(toggle)) {
3306
- scrollIntoView(toggle, { offset: this.offset });
3290
+ if (show) {
3291
+ const toggle = $(this.$props.toggle, el);
3292
+ if (!isInView(toggle)) {
3293
+ scrollIntoView(toggle, { offset: this.offset });
3294
+ }
3307
3295
  }
3308
- }
3309
- }));
3310
-
3296
+ });
3297
+ }
3311
3298
  } } };
3312
3299
 
3313
3300
 
@@ -4026,10 +4013,10 @@
4026
4013
  },
4027
4014
 
4028
4015
  write(_ref) {let { columns, rows } = _ref;
4029
- for (let i = 0; i < rows.length; i++) {
4030
- for (let j = 0; j < rows[i].length; j++) {
4031
- toggleClass(rows[i][j], this.margin, i !== 0);
4032
- toggleClass(rows[i][j], this.firstColumn, !!~columns[0].indexOf(rows[i][j]));
4016
+ for (const row of rows) {
4017
+ for (const column of row) {
4018
+ toggleClass(column, this.margin, rows[0] !== row);
4019
+ toggleClass(column, this.firstColumn, !!~columns[0].indexOf(column));
4033
4020
  }
4034
4021
  }
4035
4022
  },
@@ -4045,10 +4032,10 @@
4045
4032
  function getColumns(rows) {
4046
4033
  const columns = [];
4047
4034
 
4048
- for (let i = 0; i < rows.length; i++) {
4049
- const sorted = sortBy(rows[i], 'left', 'right');
4035
+ for (const row of rows) {
4036
+ const sorted = sortBy(row, 'left', 'right');
4050
4037
  for (let j = 0; j < sorted.length; j++) {
4051
- columns[j] = !columns[j] ? sorted[j] : columns[j].concat(sorted[j]);
4038
+ columns[j] = columns[j] ? columns[j].concat(sorted[j]) : sorted[j];
4052
4039
  }
4053
4040
  }
4054
4041
 
@@ -4058,17 +4045,15 @@
4058
4045
  function sortBy(items, startProp, endProp) {
4059
4046
  const sorted = [[]];
4060
4047
 
4061
- for (let i = 0; i < items.length; i++) {
4062
- const el = items[i];
4063
-
4048
+ for (const el of items) {
4064
4049
  if (!isVisible(el)) {
4065
4050
  continue;
4066
4051
  }
4067
4052
 
4068
4053
  let dim = getOffset(el);
4069
4054
 
4070
- for (let j = sorted.length - 1; j >= 0; j--) {
4071
- const current = sorted[j];
4055
+ for (let i = sorted.length - 1; i >= 0; i--) {
4056
+ const current = sorted[i];
4072
4057
 
4073
4058
  if (!current[0]) {
4074
4059
  current.push(el);
@@ -4093,7 +4078,7 @@
4093
4078
  break;
4094
4079
  }
4095
4080
 
4096
- if (j === 0) {
4081
+ if (i === 0) {
4097
4082
  sorted.unshift([el]);
4098
4083
  break;
4099
4084
  }
@@ -4292,9 +4277,9 @@
4292
4277
  },
4293
4278
 
4294
4279
  write(_ref2) {let { rows } = _ref2;
4295
- rows.forEach((_ref3) => {let { heights, elements } = _ref3;return (
4296
- elements.forEach((el, i) => css(el, 'minHeight', heights[i])));});
4297
-
4280
+ for (const { heights, elements } of rows) {
4281
+ elements.forEach((el, i) => css(el, 'minHeight', heights[i]));
4282
+ }
4298
4283
  },
4299
4284
 
4300
4285
  events: ['resize'] } };
@@ -4934,7 +4919,9 @@
4934
4919
 
4935
4920
  observe() {
4936
4921
  if (this._connected && !this._data.image) {
4937
- this.target.forEach((el) => this.observer.observe(el));
4922
+ for (const el of this.target) {
4923
+ this.observer.observe(el);
4924
+ }
4938
4925
  }
4939
4926
  } } };
4940
4927
 
@@ -5591,12 +5578,12 @@
5591
5578
  const dropdowns = $$("." + clsDrop, $el);
5592
5579
 
5593
5580
  if (this.dropContainer !== $el) {
5594
- $$("." + clsDrop, this.dropContainer).forEach((el) => {var _this$getDropdown;
5581
+ for (const el of $$("." + clsDrop, this.dropContainer)) {var _this$getDropdown;
5595
5582
  const target = (_this$getDropdown = this.getDropdown(el)) == null ? void 0 : _this$getDropdown.target;
5596
5583
  if (!includes(dropdowns, el) && target && within(target, this.$el)) {
5597
5584
  dropdowns.push(el);
5598
5585
  }
5599
- });
5586
+ }
5600
5587
  }
5601
5588
 
5602
5589
  return dropdowns;
@@ -6298,10 +6285,10 @@
6298
6285
 
6299
6286
 
6300
6287
  disconnected() {
6301
- this.elements.forEach((el) => {
6288
+ for (const el of this.elements) {
6302
6289
  removeClass(el, this.inViewClass, el[stateKey] ? el[stateKey].cls : '');
6303
6290
  delete el[stateKey];
6304
- });
6291
+ }
6305
6292
  },
6306
6293
 
6307
6294
  update: [
@@ -6316,17 +6303,17 @@
6316
6303
  return false;
6317
6304
  }
6318
6305
 
6319
- this.elements.forEach((el) => {
6306
+ for (const el of this.elements) {
6320
6307
  if (!el[stateKey]) {
6321
6308
  el[stateKey] = { cls: data(el, 'uk-scrollspy-class') || this.cls };
6322
6309
  }
6323
6310
 
6324
6311
  el[stateKey].show = isInView(el, this.offsetTop, this.offsetLeft);
6325
- });
6312
+ }
6326
6313
  },
6327
6314
 
6328
6315
  write(data) {
6329
- this.elements.forEach((el) => {
6316
+ for (const el of this.elements) {
6330
6317
  const state = el[stateKey];
6331
6318
 
6332
6319
  if (state.show && !state.inview && !state.queued) {
@@ -6344,7 +6331,7 @@
6344
6331
  } else if (!state.show && state.inview && !state.queued && this.repeat) {
6345
6332
  this.toggle(el, false);
6346
6333
  }
6347
- });
6334
+ }
6348
6335
  },
6349
6336
 
6350
6337
  events: ['scroll', 'resize'] }],
@@ -7207,10 +7194,10 @@
7207
7194
  const leaving = this.target.filter((el) => hasClass(el, this.clsLeave));
7208
7195
 
7209
7196
  if (leaving.length) {
7210
- this.target.forEach((el) => {
7197
+ for (const el of this.target) {
7211
7198
  const isLeaving = includes(leaving, el);
7212
7199
  this.toggleElement(el, isLeaving, isLeaving);
7213
- });
7200
+ }
7214
7201
  return;
7215
7202
  }
7216
7203
 
@@ -7362,7 +7349,7 @@
7362
7349
  timespan.days = timespan.hours = timespan.minutes = timespan.seconds = 0;
7363
7350
  }
7364
7351
 
7365
- this.units.forEach((unit) => {
7352
+ for (const unit of this.units) {
7366
7353
  let digits = String(Math.floor(timespan[unit]));
7367
7354
 
7368
7355
  digits = digits.length < 2 ? "0" + digits : digits;
@@ -7377,7 +7364,7 @@
7377
7364
 
7378
7365
  digits.forEach((digit, i) => el.children[i].textContent = digit);
7379
7366
  }
7380
- });
7367
+ }
7381
7368
  } },
7382
7369
 
7383
7370
 
@@ -8109,17 +8096,17 @@
8109
8096
 
8110
8097
 
8111
8098
  created() {
8112
- ['start', 'move', 'end'].forEach((key) => {
8099
+ for (const key of ['start', 'move', 'end']) {
8113
8100
  const fn = this[key];
8114
8101
  this[key] = (e) => {
8115
8102
  const pos = getEventPos(e).x * (isRtl ? -1 : 1);
8116
8103
 
8117
- this.prevPos = pos !== this.pos ? this.pos : this.prevPos;
8104
+ this.prevPos = pos === this.pos ? this.prevPos : this.pos;
8118
8105
  this.pos = pos;
8119
8106
 
8120
8107
  fn(e);
8121
8108
  };
8122
- });
8109
+ }
8123
8110
  },
8124
8111
 
8125
8112
  events: [
@@ -8357,7 +8344,7 @@
8357
8344
  methods: {
8358
8345
  updateNav() {
8359
8346
  const i = this.getValidIndex();
8360
- this.navItems.forEach((el) => {
8347
+ for (const el of this.navItems) {
8361
8348
  const cmd = data(el, this.attrItem);
8362
8349
 
8363
8350
  toggleClass(el, this.clsActive, toNumber(cmd) === i);
@@ -8367,7 +8354,7 @@
8367
8354
  this.finite && (
8368
8355
  cmd === 'previous' && i === 0 || cmd === 'next' && i >= this.maxIndex));
8369
8356
 
8370
- });
8357
+ }
8371
8358
  } } };
8372
8359
 
8373
8360
  var Slider = {
@@ -9053,9 +9040,9 @@
9053
9040
  function toItem(el) {
9054
9041
  const item = {};
9055
9042
 
9056
- ['href', 'caption', 'type', 'poster', 'alt', 'attrs'].forEach((attr) => {
9043
+ for (const attr of ['href', 'caption', 'type', 'poster', 'alt', 'attrs']) {
9057
9044
  item[attr === 'href' ? 'source' : attr] = data(el, attr);
9058
- });
9045
+ }
9059
9046
 
9060
9047
  item.attrs = parseOptions(item.attrs);
9061
9048
 
@@ -9650,7 +9637,7 @@
9650
9637
 
9651
9638
  percent = prev ? clamp(percent, -1, 1) : 0;
9652
9639
 
9653
- children(list).forEach((slide) => {
9640
+ for (const slide of children(list)) {
9654
9641
  const isActive = includes(actives, slide);
9655
9642
  const isIn = slide === itemIn;
9656
9643
  const isOut = slide === itemOut;
@@ -9665,7 +9652,7 @@
9665
9652
  dir,
9666
9653
  percent: isOut ? 1 - percent : isIn ? percent : isActive ? 1 : 0 });
9667
9654
 
9668
- });
9655
+ }
9669
9656
  },
9670
9657
 
9671
9658
  percent() {
@@ -9852,7 +9839,7 @@
9852
9839
 
9853
9840
  update: {
9854
9841
  write() {
9855
- this.navItems.forEach((el) => {
9842
+ for (const el of this.navItems) {
9856
9843
  const index = toNumber(data(el, this.attrItem));
9857
9844
  if (index !== false) {
9858
9845
  el.hidden =
@@ -9860,7 +9847,7 @@
9860
9847
  index > this.maxIndex ||
9861
9848
  this.sets && !includes(this.sets, index);
9862
9849
  }
9863
- });
9850
+ }
9864
9851
 
9865
9852
  if (this.length && !this.dragging && !this.stack.length) {
9866
9853
  this.reorder();
@@ -9868,14 +9855,13 @@
9868
9855
  }
9869
9856
 
9870
9857
  const actives = this._getTransitioner(this.index).getActives();
9871
- this.slides.forEach((slide) =>
9872
- toggleClass(slide, this.clsActive, includes(actives, slide)));
9873
-
9874
-
9875
- if (this.clsActivated && (!this.sets || includes(this.sets, toFloat(this.index)))) {
9876
- this.slides.forEach((slide) =>
9877
- toggleClass(slide, this.clsActivated || '', includes(actives, slide)));
9858
+ const activeClasses = [
9859
+ this.clsActive,
9860
+ (!this.sets || includes(this.sets, toFloat(this.index))) && this.clsActivated ||
9861
+ ''];
9878
9862
 
9863
+ for (const slide of this.slides) {
9864
+ toggleClass(slide, activeClasses, includes(actives, slide));
9879
9865
  }
9880
9866
  },
9881
9867
 
@@ -10236,13 +10222,13 @@
10236
10222
 
10237
10223
 
10238
10224
  created() {
10239
- ['init', 'start', 'move', 'end'].forEach((key) => {
10225
+ for (const key of ['init', 'start', 'move', 'end']) {
10240
10226
  const fn = this[key];
10241
10227
  this[key] = (e) => {
10242
10228
  assign(this.pos, getEventPos(e));
10243
10229
  fn(e);
10244
10230
  };
10245
- });
10231
+ }
10246
10232
  },
10247
10233
 
10248
10234
  events: {
@@ -10438,11 +10424,11 @@
10438
10424
  remove$1(this.drag);
10439
10425
  this.drag = null;
10440
10426
 
10441
- this.touched.forEach((_ref2) => {let { clsPlaceholder, clsItem } = _ref2;return (
10442
- this.touched.forEach((sortable) =>
10443
- removeClass(sortable.items, clsPlaceholder, clsItem)));});
10444
-
10445
-
10427
+ for (const { clsPlaceholder, clsItem } of this.touched) {
10428
+ for (const sortable of this.touched) {
10429
+ removeClass(sortable.items, clsPlaceholder, clsItem);
10430
+ }
10431
+ }
10446
10432
  this.touched = null;
10447
10433
  removeClass(document.documentElement, this.clsDragState);
10448
10434
  },
@@ -10835,25 +10821,25 @@
10835
10821
 
10836
10822
  trigger(this.$el, 'upload', [files]);
10837
10823
 
10838
- for (let i = 0; i < files.length; i++) {
10839
- if (this.maxSize && this.maxSize * 1000 < files[i].size) {
10824
+ for (const file of files) {
10825
+ if (this.maxSize && this.maxSize * 1000 < file.size) {
10840
10826
  this.fail(this.msgInvalidSize.replace('%s', this.maxSize));
10841
10827
  return;
10842
10828
  }
10843
10829
 
10844
- if (this.allow && !match(this.allow, files[i].name)) {
10830
+ if (this.allow && !match(this.allow, file.name)) {
10845
10831
  this.fail(this.msgInvalidName.replace('%s', this.allow));
10846
10832
  return;
10847
10833
  }
10848
10834
 
10849
- if (this.mime && !match(this.mime, files[i].type)) {
10835
+ if (this.mime && !match(this.mime, file.type)) {
10850
10836
  this.fail(this.msgInvalidMime.replace('%s', this.mime));
10851
10837
  return;
10852
10838
  }
10853
10839
  }
10854
10840
 
10855
10841
  if (!this.multiple) {
10856
- files = [files[0]];
10842
+ files = files.slice(0, 1);
10857
10843
  }
10858
10844
 
10859
10845
  this.beforeAll(this, files);
@@ -10876,9 +10862,9 @@
10876
10862
  beforeSend: (env) => {
10877
10863
  const { xhr } = env;
10878
10864
  xhr.upload && on(xhr.upload, 'progress', this.progress);
10879
- ['loadStart', 'load', 'loadEnd', 'abort'].forEach((type) =>
10880
- on(xhr, type.toLowerCase(), this[type]));
10881
-
10865
+ for (const type of ['loadStart', 'load', 'loadEnd', 'abort']) {
10866
+ on(xhr, type.toLowerCase(), this[type]);
10867
+ }
10882
10868
 
10883
10869
  return this.beforeSend(env);
10884
10870
  } });
@@ -10917,11 +10903,7 @@
10917
10903
  function chunk(files, size) {
10918
10904
  const chunks = [];
10919
10905
  for (let i = 0; i < files.length; i += size) {
10920
- const chunk = [];
10921
- for (let j = 0; j < size; j++) {
10922
- chunk.push(files[i + j]);
10923
- }
10924
- chunks.push(chunk);
10906
+ chunks.push(files.slice(i, i + size));
10925
10907
  }
10926
10908
  return chunks;
10927
10909
  }