uikit 3.11.2-dev.07abf1392 → 3.11.2-dev.0a73abee2

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 (55) hide show
  1. package/CHANGELOG.md +7 -2
  2. package/dist/css/uikit-core-rtl.css +10 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +10 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +10 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +10 -1
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +1 -1
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +1 -1
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +6 -8
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +6 -8
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +23 -32
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +6 -8
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +1 -1
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +1 -1
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +82 -71
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +109 -109
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/slider.js +22 -33
  44. package/src/js/core/height-viewport.js +3 -0
  45. package/src/js/core/img.js +3 -1
  46. package/src/js/core/sticky.js +50 -56
  47. package/src/js/core/toggle.js +1 -1
  48. package/src/js/mixin/parallax.js +6 -8
  49. package/src/js/util/ajax.js +6 -2
  50. package/src/js/util/dimensions.js +4 -4
  51. package/src/js/util/dom.js +15 -6
  52. package/src/less/components/height.less +3 -0
  53. package/src/scss/components/height.scss +3 -0
  54. package/tests/parallax.html +5 -5
  55. package/tests/sticky-parallax.html +9 -9
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.07abf1392 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.0a73abee2 | 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() :
@@ -729,8 +729,12 @@
729
729
  return new Promise((resolve, reject) => {
730
730
  const img = new Image();
731
731
 
732
- img.onerror = (e) => reject(e);
733
- img.onload = () => resolve(img);
732
+ img.onerror = (e) => {
733
+ reject(e);
734
+ };
735
+ img.onload = () => {
736
+ resolve(img);
737
+ };
734
738
 
735
739
  sizes && (img.sizes = sizes);
736
740
  srcset && (img.srcset = srcset);
@@ -1016,8 +1020,8 @@
1016
1020
  const currentOffset = dimensions$1(element);
1017
1021
 
1018
1022
  if (element) {
1019
- const { pageYOffset, pageXOffset } = toWindow(element);
1020
- const offsetBy = { height: pageYOffset, width: pageXOffset };
1023
+ const { scrollY, scrollX } = toWindow(element);
1024
+ const offsetBy = { height: scrollY, width: scrollX };
1021
1025
 
1022
1026
  for (const dir in dirs$1) {
1023
1027
  for (const i in dirs$1[dir]) {
@@ -1083,8 +1087,8 @@
1083
1087
 
1084
1088
  if (css(element, 'position') === 'fixed') {
1085
1089
  const win = toWindow(element);
1086
- offset[0] += win.pageYOffset;
1087
- offset[1] += win.pageXOffset;
1090
+ offset[0] += win.scrollY;
1091
+ offset[1] += win.scrollX;
1088
1092
  return offset;
1089
1093
  }
1090
1094
  } while (element = element.offsetParent);
@@ -1252,14 +1256,23 @@
1252
1256
  forEach((parent) => parent.replaceWith(...parent.childNodes));
1253
1257
  }
1254
1258
 
1259
+ const fragmentRe = /^\s*<(\w+|!)[^>]*>/;
1260
+ const singleTagRe = /^<(\w+)\s*\/?>(?:<\/\1>)?$/;
1261
+
1255
1262
  function fragment(html) {
1256
- const template = document.createElement('template');
1257
- template.innerHTML = html.trim();
1258
- const nodes = toNodes(template.content.childNodes);
1259
- for (const node of nodes) {
1260
- document.adoptNode(node);
1263
+ const matches = singleTagRe.exec(html);
1264
+ if (matches) {
1265
+ return document.createElement(matches[1]);
1261
1266
  }
1262
- return unwrapSingle(nodes);
1267
+
1268
+ const container = document.createElement('div');
1269
+ if (fragmentRe.test(html)) {
1270
+ container.insertAdjacentHTML('beforeend', html.trim());
1271
+ } else {
1272
+ container.textContent = html;
1273
+ }
1274
+
1275
+ return unwrapSingle(container.childNodes);
1263
1276
  }
1264
1277
 
1265
1278
  function unwrapSingle(nodes) {
@@ -2807,7 +2820,7 @@
2807
2820
  UIkit.data = '__uikit__';
2808
2821
  UIkit.prefix = 'uk-';
2809
2822
  UIkit.options = {};
2810
- UIkit.version = '3.11.2-dev.07abf1392';
2823
+ UIkit.version = '3.11.2-dev.0a73abee2';
2811
2824
 
2812
2825
  globalAPI(UIkit);
2813
2826
  hooksAPI(UIkit);
@@ -4312,6 +4325,8 @@
4312
4325
  }
4313
4326
 
4314
4327
  var heightViewport = {
4328
+ mixins: [Class],
4329
+
4315
4330
  props: {
4316
4331
  expand: Boolean,
4317
4332
  offsetTop: Boolean,
@@ -4920,7 +4935,9 @@
4920
4935
 
4921
4936
  wrapInPicture(img, sources);
4922
4937
  setSourceProps(el, img);
4923
- img.onload = () => setSrcAttrs(el, img.currentSrc);
4938
+ img.onload = () => {
4939
+ setSrcAttrs(el, img.currentSrc);
4940
+ };
4924
4941
  attr(img, 'src', src);
4925
4942
  return img;
4926
4943
  }
@@ -6490,26 +6507,11 @@
6490
6507
 
6491
6508
 
6492
6509
  computed: {
6493
- position(_ref, $el) {let { position } = _ref;
6494
- return position === 'auto' ?
6495
- (this.isFixed ? this.placeholder : $el).offsetHeight > height(window) ?
6496
- 'bottom' :
6497
- 'top' :
6498
- position;
6499
- },
6500
-
6501
- offset(_ref2, $el) {let { offset } = _ref2;
6502
- if (this.position === 'bottom') {
6503
- offset += '+100vh-100%';
6504
- }
6505
- return toPx(offset, 'height', $el);
6506
- },
6507
-
6508
- selTarget(_ref3, $el) {let { selTarget } = _ref3;
6510
+ selTarget(_ref, $el) {let { selTarget } = _ref;
6509
6511
  return selTarget && $(selTarget, $el) || $el;
6510
6512
  },
6511
6513
 
6512
- widthElement(_ref4, $el) {let { widthElement } = _ref4;
6514
+ widthElement(_ref2, $el) {let { widthElement } = _ref2;
6513
6515
  return query(widthElement, $el) || this.placeholder;
6514
6516
  },
6515
6517
 
@@ -6557,41 +6559,36 @@
6557
6559
  return window;
6558
6560
  },
6559
6561
 
6562
+ filter() {
6563
+ return this.targetOffset !== false;
6564
+ },
6565
+
6560
6566
  handler() {
6561
- if (!(this.targetOffset !== false && location.hash && scrollTop(window) > 0)) {
6567
+ if (!location.hash || scrollTop(window) === 0) {
6562
6568
  return;
6563
6569
  }
6564
6570
 
6565
- const target = $(location.hash);
6566
-
6567
- if (target) {
6568
- fastdom.read(() => {
6569
- const { top } = offset(target);
6570
- const elTop = offset(this.$el).top;
6571
- const elHeight = this.$el.offsetHeight;
6571
+ fastdom.read(() => {
6572
+ const targetOffset = offset($(location.hash));
6573
+ const elOffset = offset(this.$el);
6572
6574
 
6573
- if (
6574
- this.isFixed &&
6575
- elTop + elHeight >= top &&
6576
- elTop <= top + target.offsetHeight)
6577
- {
6578
- scrollTop(
6579
- window,
6580
- top -
6581
- elHeight - (
6582
- isNumeric(this.targetOffset) ? this.targetOffset : 0) -
6583
- this.offset);
6575
+ if (this.isFixed && intersectRect(targetOffset, elOffset)) {
6576
+ scrollTop(
6577
+ window,
6578
+ targetOffset.top -
6579
+ elOffset.height -
6580
+ toPx(this.targetOffset, 'height') -
6581
+ toPx(this.offset, 'height'));
6584
6582
 
6585
- }
6586
- });
6587
- }
6583
+ }
6584
+ });
6588
6585
  } }],
6589
6586
 
6590
6587
 
6591
6588
 
6592
6589
  update: [
6593
6590
  {
6594
- read(_ref5, types) {let { height: height$1, margin } = _ref5;
6591
+ read(_ref3, types) {let { height: height$1, margin } = _ref3;
6595
6592
  this.inactive = !this.matchMedia || !isVisible(this.$el);
6596
6593
 
6597
6594
  if (this.inactive) {
@@ -6600,35 +6597,49 @@
6600
6597
 
6601
6598
  const hide = this.isActive && types.has('resize');
6602
6599
  if (hide) {
6600
+ css(this.selTarget, 'transition', '0s');
6603
6601
  this.hide();
6604
6602
  }
6605
6603
 
6606
6604
  if (!this.isActive) {
6607
- height$1 = this.$el.offsetHeight;
6605
+ height$1 = offset(this.$el).height;
6608
6606
  margin = css(this.$el, 'margin');
6609
6607
  }
6610
6608
 
6611
6609
  if (hide) {
6612
6610
  this.show();
6611
+ fastdom.write(() => css(this.selTarget, 'transition', ''));
6613
6612
  }
6614
6613
 
6615
- const overflow = Math.max(0, height$1 + this.offset - height(window));
6616
-
6617
6614
  const referenceElement = this.isFixed ? this.placeholder : this.$el;
6615
+ const windowHeight = height(window);
6616
+
6617
+ let position = this.position;
6618
+ if (position === 'auto' && height$1 > windowHeight) {
6619
+ position = 'bottom';
6620
+ }
6621
+
6622
+ let offset$1 = toPx(this.offset, 'height', referenceElement);
6623
+ if (position === 'bottom') {
6624
+ offset$1 += windowHeight - height$1;
6625
+ }
6626
+
6627
+ const overflow = Math.max(0, height$1 + offset$1 - windowHeight);
6618
6628
  const topOffset = offset(referenceElement).top;
6619
6629
  const offsetParentTop = offset(referenceElement.offsetParent).top;
6620
6630
 
6621
6631
  const top = parseProp(this.top, this.$el, topOffset);
6622
6632
  const bottom = parseProp(this.bottom, this.$el, topOffset + height$1, true);
6623
6633
 
6624
- const start = Math.max(top, topOffset) - this.offset;
6634
+ const start = Math.max(top, topOffset) - offset$1;
6625
6635
  const end = bottom ?
6626
- bottom - this.$el.offsetHeight + overflow - this.offset :
6627
- getScrollingElement(this.$el).scrollHeight - height(window);
6636
+ bottom - offset(this.$el).height + overflow - offset$1 :
6637
+ getScrollingElement(this.$el).scrollHeight - windowHeight;
6628
6638
 
6629
6639
  return {
6630
6640
  start,
6631
6641
  end,
6642
+ offset: offset$1,
6632
6643
  overflow,
6633
6644
  topOffset,
6634
6645
  offsetParentTop,
@@ -6640,7 +6651,7 @@
6640
6651
 
6641
6652
  },
6642
6653
 
6643
- write(_ref6) {let { height, margin } = _ref6;
6654
+ write(_ref4) {let { height, margin } = _ref4;
6644
6655
  const { placeholder } = this;
6645
6656
 
6646
6657
  css(placeholder, { height, margin });
@@ -6657,14 +6668,14 @@
6657
6668
 
6658
6669
 
6659
6670
  {
6660
- read(_ref7)
6671
+ read(_ref5)
6661
6672
 
6662
6673
 
6663
6674
 
6664
6675
 
6665
6676
 
6666
6677
 
6667
- {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref7;
6678
+ {let { scroll: prevScroll = 0, dir: prevDir = 'down', overflow, overflowScroll = 0, start, end } = _ref5;
6668
6679
  const scroll = scrollTop(window);
6669
6680
  const dir = prevScroll <= scroll ? 'down' : 'up';
6670
6681
 
@@ -6745,7 +6756,7 @@
6745
6756
  }
6746
6757
  } else if (this.isFixed) {
6747
6758
  this.update();
6748
- } else if (this.animation) {
6759
+ } else if (this.animation && scroll > topOffset) {
6749
6760
  Animation.cancel(this.$el);
6750
6761
  this.show();
6751
6762
  Animation.in(this.$el, this.animation).catch(noop);
@@ -6773,33 +6784,33 @@
6773
6784
  },
6774
6785
 
6775
6786
  update() {
6776
- const {
6787
+ let {
6777
6788
  width,
6778
6789
  scroll = 0,
6779
6790
  overflow,
6780
6791
  overflowScroll = 0,
6781
6792
  start,
6782
6793
  end,
6794
+ offset,
6783
6795
  topOffset,
6784
6796
  height,
6785
6797
  offsetParentTop } =
6786
6798
  this._data;
6787
6799
  const active = start !== 0 || scroll > start;
6788
- let top = this.offset;
6789
6800
  let position = 'fixed';
6790
6801
 
6791
6802
  if (scroll > end) {
6792
- top = end + this.offset - offsetParentTop;
6803
+ offset += end - offsetParentTop;
6793
6804
  position = 'absolute';
6794
6805
  }
6795
6806
 
6796
6807
  if (overflow) {
6797
- top -= overflowScroll;
6808
+ offset -= overflowScroll;
6798
6809
  }
6799
6810
 
6800
6811
  css(this.$el, {
6801
6812
  position,
6802
- top: top + "px",
6813
+ top: offset + "px",
6803
6814
  width });
6804
6815
 
6805
6816
 
@@ -7114,7 +7125,7 @@
7114
7125
  name: 'keydown',
7115
7126
 
7116
7127
  filter() {
7117
- return includes(this.mode, 'click') && isTag(this.$el, 'input');
7128
+ return includes(this.mode, 'click') && !isTag(this.$el, 'input');
7118
7129
  },
7119
7130
 
7120
7131
  handler(e) {
@@ -9191,13 +9202,11 @@
9191
9202
  },
9192
9203
 
9193
9204
  getCss(percent) {
9194
- return keys(this.props).reduce(
9195
- (css, prop) => {
9205
+ const css = { transform: '', filter: '' };
9206
+ for (const prop in this.props) {
9196
9207
  this.props[prop](css, percent);
9197
- return css;
9198
- },
9199
- { transform: '', filter: '' });
9200
-
9208
+ }
9209
+ return css;
9201
9210
  } } };
9202
9211
 
9203
9212
 
@@ -9451,7 +9460,7 @@
9451
9460
  return isNumber(start) ? start + Math.abs(start - end) * p * (start < end ? 1 : -1) : +end;
9452
9461
  }
9453
9462
 
9454
- const unitRe = /^[\d-]+([^\s]+)/;
9463
+ const unitRe = /^-?\d+([^\s]*)/;
9455
9464
  function getUnit(stops, defaultUnit) {
9456
9465
  for (const stop of stops) {
9457
9466
  const match = stop.match == null ? void 0 : stop.match(unitRe);
@@ -9825,48 +9834,39 @@
9825
9834
  return ~index ? index : this.length - 1;
9826
9835
  },
9827
9836
 
9828
- sets(_ref2) {let { sets } = _ref2;
9829
- if (!sets) {
9837
+ sets(_ref2) {let { sets: enabled } = _ref2;
9838
+ if (!enabled) {
9830
9839
  return;
9831
9840
  }
9832
9841
 
9833
- const width = dimensions$1(this.list).width / (this.center ? 2 : 1);
9834
-
9835
9842
  let left = 0;
9836
- let leftCenter = width;
9837
- let slideLeft = 0;
9843
+ const sets = [];
9844
+ const width = dimensions$1(this.list).width;
9845
+ for (let i in this.slides) {
9846
+ const slideWidth = dimensions$1(this.slides[i]).width;
9838
9847
 
9839
- sets = sortBy$1(this.slides, 'offsetLeft').reduce((sets, slide, i) => {
9840
- const slideWidth = dimensions$1(slide).width;
9841
- const slideRight = slideLeft + slideWidth;
9842
-
9843
- if (slideRight > left) {
9844
- if (!this.center && i > this.maxIndex) {
9845
- i = this.maxIndex;
9846
- }
9848
+ if (left + slideWidth > width) {
9849
+ left = 0;
9850
+ }
9847
9851
 
9848
- if (!includes(sets, i)) {
9849
- const cmp = this.slides[i + 1];
9850
- if (
9851
- this.center &&
9852
- cmp &&
9853
- slideWidth < leftCenter - dimensions$1(cmp).width / 2)
9854
- {
9855
- leftCenter -= slideWidth;
9856
- } else {
9857
- leftCenter = width;
9858
- sets.push(i);
9859
- left = slideLeft + width + (this.center ? slideWidth / 2 : 0);
9860
- }
9852
+ if (this.center) {
9853
+ if (
9854
+ left < width / 2 &&
9855
+ left + slideWidth + dimensions$1(this.slides[+i + 1]).width / 2 > width / 2)
9856
+ {
9857
+ sets.push(+i);
9858
+ left = width / 2 - slideWidth / 2;
9861
9859
  }
9860
+ } else if (left === 0) {
9861
+ sets.push(Math.min(+i, this.maxIndex));
9862
9862
  }
9863
9863
 
9864
- slideLeft += slideWidth;
9864
+ left += slideWidth;
9865
+ }
9865
9866
 
9867
+ if (sets.length) {
9866
9868
  return sets;
9867
- }, []);
9868
-
9869
- return !isEmpty(sets) && sets;
9869
+ }
9870
9870
  },
9871
9871
 
9872
9872
  transitionOptions() {