uikit 3.11.1 → 3.11.2-dev.78e397546

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 (54) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -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 +37 -41
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +32 -25
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +2 -2
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +32 -25
  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 +2 -3
  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 +127 -67
  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 +190 -135
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/parallax.js +5 -16
  44. package/src/js/components/slider.js +1 -1
  45. package/src/js/components/sortable.js +1 -2
  46. package/src/js/core/core.js +2 -2
  47. package/src/js/core/height-viewport.js +2 -2
  48. package/src/js/core/sticky.js +68 -42
  49. package/src/js/mixin/parallax.js +32 -21
  50. package/src/js/util/dimensions.js +28 -12
  51. package/src/js/util/fastdom.js +2 -2
  52. package/src/js/util/viewport.js +7 -3
  53. package/tests/sticky-parallax.html +43 -40
  54. package/tests/sticky.html +45 -24
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.1 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.78e397546 | 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() :
@@ -1587,7 +1587,7 @@
1587
1587
  height: ['top', 'bottom']
1588
1588
  };
1589
1589
 
1590
- function dimensions(element) {
1590
+ function dimensions$1(element) {
1591
1591
 
1592
1592
  var rect = isElement(element)
1593
1593
  ? toNode(element).getBoundingClientRect()
@@ -1605,7 +1605,7 @@
1605
1605
 
1606
1606
  function offset(element, coordinates) {
1607
1607
 
1608
- var currentOffset = dimensions(element);
1608
+ var currentOffset = dimensions$1(element);
1609
1609
 
1610
1610
  if (element) {
1611
1611
  var ref = toWindow(element);
@@ -1750,19 +1750,35 @@
1750
1750
  if ( element === void 0 ) element = window;
1751
1751
  if ( offsetDim === void 0 ) offsetDim = false;
1752
1752
 
1753
- return isNumeric(value)
1754
- ? +value
1755
- : endsWith(value, 'vh')
1756
- ? percent(height(toWindow(element)), value)
1757
- : endsWith(value, 'vw')
1758
- ? percent(width(toWindow(element)), value)
1759
- : endsWith(value, '%')
1760
- ? percent(offsetDim
1761
- ? element[("offset" + (ucfirst(property)))]
1762
- : dimensions(element)[property], value)
1763
- : toFloat(value);
1753
+
1754
+ if (!isString(value)) {
1755
+ return toFloat(value);
1756
+ }
1757
+
1758
+ return parseCalc(value).reduce(function (result, value) {
1759
+ var unit = parseUnit(value);
1760
+ if (unit) {
1761
+ value = percent(
1762
+ unit === 'vh'
1763
+ ? height(toWindow(element))
1764
+ : unit === 'vw'
1765
+ ? width(toWindow(element))
1766
+ : offsetDim
1767
+ ? element[("offset" + (ucfirst(property)))]
1768
+ : dimensions$1(element)[property],
1769
+ value
1770
+ );
1771
+ }
1772
+
1773
+ return result + toFloat(value);
1774
+ }, 0);
1764
1775
  }
1765
1776
 
1777
+ var calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
1778
+ var parseCalc = memoize(function (calc) { return calc.toString().replace(/\s/g, '').match(calcRe) || []; });
1779
+ var unitRe = /(?:v[hw]|%)$/;
1780
+ var parseUnit = memoize(function (str) { return (str.match(unitRe) || [])[0]; });
1781
+
1766
1782
  function percent(base, value) {
1767
1783
  return base * toFloat(value) / 100;
1768
1784
  }
@@ -1800,8 +1816,6 @@
1800
1816
  };
1801
1817
 
1802
1818
  function flush(recursion) {
1803
- if ( recursion === void 0 ) recursion = 1;
1804
-
1805
1819
  runTasks(fastdom.reads);
1806
1820
  runTasks(fastdom.writes.splice(0));
1807
1821
 
@@ -1823,7 +1837,7 @@
1823
1837
  if (recursion && recursion < RECURSION_LIMIT) {
1824
1838
  Promise$1.resolve().then(function () { return flush(recursion); });
1825
1839
  } else {
1826
- requestAnimationFrame(function () { return flush(); });
1840
+ requestAnimationFrame(function () { return flush(1); });
1827
1841
  }
1828
1842
 
1829
1843
  }
@@ -2241,7 +2255,11 @@
2241
2255
  element = toNode(element);
2242
2256
  }
2243
2257
 
2244
- element.scrollTop = top;
2258
+ if (isUndefined(top)) {
2259
+ return element.scrollTop;
2260
+ } else {
2261
+ element.scrollTop = top;
2262
+ }
2245
2263
  }
2246
2264
 
2247
2265
  function scrollIntoView(element, ref) {
@@ -2548,7 +2566,7 @@
2548
2566
  replaceClass: replaceClass,
2549
2567
  hasClass: hasClass,
2550
2568
  toggleClass: toggleClass,
2551
- dimensions: dimensions,
2569
+ dimensions: dimensions$1,
2552
2570
  offset: offset,
2553
2571
  position: position,
2554
2572
  offsetPosition: offsetPosition,
@@ -2673,7 +2691,8 @@
2673
2691
  scrolledOver: scrolledOver,
2674
2692
  scrollParents: scrollParents,
2675
2693
  getViewport: getViewport$1,
2676
- getViewportClientHeight: getViewportClientHeight
2694
+ getViewportClientHeight: getViewportClientHeight,
2695
+ getScrollingElement: getScrollingElement
2677
2696
  });
2678
2697
 
2679
2698
  function globalAPI (UIkit) {
@@ -3462,7 +3481,7 @@
3462
3481
  UIkit.data = '__uikit__';
3463
3482
  UIkit.prefix = 'uk-';
3464
3483
  UIkit.options = {};
3465
- UIkit.version = '3.11.1';
3484
+ UIkit.version = '3.11.2-dev.78e397546';
3466
3485
 
3467
3486
  globalAPI(UIkit);
3468
3487
  hooksAPI(UIkit);
@@ -3483,7 +3502,7 @@
3483
3502
  return;
3484
3503
  }
3485
3504
  pendingResize = true;
3486
- fastdom.write(function () { return pendingResize = false; });
3505
+ fastdom.read(function () { return pendingResize = false; });
3487
3506
  UIkit.update(null, 'resize');
3488
3507
  };
3489
3508
 
@@ -3502,7 +3521,7 @@
3502
3521
  return;
3503
3522
  }
3504
3523
  pending = true;
3505
- fastdom.write(function () { return pending = false; });
3524
+ fastdom.read(function () { return pending = false; });
3506
3525
 
3507
3526
  UIkit.update(null, e.type);
3508
3527
 
@@ -5222,7 +5241,7 @@
5222
5241
  css(element, 'display', 'block', 'important');
5223
5242
  }
5224
5243
 
5225
- var height = dimensions(element).height - boxModelAdjust(element, 'height', 'content-box');
5244
+ var height = dimensions$1(element).height - boxModelAdjust(element, 'height', 'content-box');
5226
5245
 
5227
5246
  if (style !== false) {
5228
5247
  css(element, 'display', style);
@@ -5264,7 +5283,7 @@
5264
5283
 
5265
5284
  if (this.expand) {
5266
5285
 
5267
- minHeight = height(window) - (dimensions(document.documentElement).height - dimensions(this.$el).height) - box || '';
5286
+ minHeight = height(window) - (dimensions$1(document.documentElement).height - dimensions$1(this.$el).height) - box || '';
5268
5287
 
5269
5288
  } else {
5270
5289
 
@@ -5281,7 +5300,7 @@
5281
5300
 
5282
5301
  if (this.offsetBottom === true) {
5283
5302
 
5284
- minHeight += " - " + (dimensions(this.$el.nextElementSibling).height) + "px";
5303
+ minHeight += " - " + (dimensions$1(this.$el.nextElementSibling).height) + "px";
5285
5304
 
5286
5305
  } else if (isNumeric(this.offsetBottom)) {
5287
5306
 
@@ -5293,7 +5312,7 @@
5293
5312
 
5294
5313
  } else if (isString(this.offsetBottom)) {
5295
5314
 
5296
- minHeight += " - " + (dimensions(query(this.offsetBottom, this.$el)).height) + "px";
5315
+ minHeight += " - " + (dimensions$1(query(this.offsetBottom, this.$el)).height) + "px";
5297
5316
 
5298
5317
  }
5299
5318
 
@@ -5312,7 +5331,7 @@
5312
5331
  css(this.$el, {minHeight: minHeight});
5313
5332
 
5314
5333
  if (minHeight !== prev) {
5315
- this.$update(this.$el, 'resize');
5334
+ trigger(this.$el, 'resize');
5316
5335
  }
5317
5336
 
5318
5337
  if (this.minHeight && toFloat(css(this.$el, 'minHeight')) < this.minHeight) {
@@ -7325,7 +7344,7 @@
7325
7344
 
7326
7345
  return {
7327
7346
  current: toFloat(css(this.$el, 'maxHeight')),
7328
- max: Math.max(this.minHeight, height(this.container) - (dimensions(this.content).height - height(this.$el)))
7347
+ max: Math.max(this.minHeight, height(this.container) - (dimensions$1(this.content).height - height(this.$el)))
7329
7348
  };
7330
7349
  },
7331
7350
 
@@ -7687,6 +7706,7 @@
7687
7706
  mixins: [Class, Media],
7688
7707
 
7689
7708
  props: {
7709
+ position: String,
7690
7710
  top: null,
7691
7711
  bottom: Boolean,
7692
7712
  offset: String,
@@ -7702,6 +7722,7 @@
7702
7722
  },
7703
7723
 
7704
7724
  data: {
7725
+ position: 'top',
7705
7726
  top: 0,
7706
7727
  bottom: false,
7707
7728
  offset: 0,
@@ -7718,10 +7739,23 @@
7718
7739
 
7719
7740
  computed: {
7720
7741
 
7721
- offset: function(ref) {
7742
+ position: function(ref, $el) {
7743
+ var position = ref.position;
7744
+
7745
+ return position === 'auto'
7746
+ ? (this.isFixed ? this.placeholder : $el).offsetHeight > height(window)
7747
+ ? 'bottom'
7748
+ : 'top'
7749
+ : position;
7750
+ },
7751
+
7752
+ offset: function(ref, $el) {
7722
7753
  var offset = ref.offset;
7723
7754
 
7724
- return toPx(offset);
7755
+ if (this.position === 'bottom') {
7756
+ offset += '+100vh-100%';
7757
+ }
7758
+ return toPx(offset, 'height', $el);
7725
7759
  },
7726
7760
 
7727
7761
  selTarget: function(ref, $el) {
@@ -7788,7 +7822,7 @@
7788
7822
  var this$1$1 = this;
7789
7823
 
7790
7824
 
7791
- if (!(this.targetOffset !== false && location.hash && window.pageYOffset > 0)) {
7825
+ if (!(this.targetOffset !== false && location.hash && scrollTop(window) > 0)) {
7792
7826
  return;
7793
7827
  }
7794
7828
 
@@ -7837,24 +7871,28 @@
7837
7871
 
7838
7872
  height$1 = this.isActive ? height$1 : this.$el.offsetHeight;
7839
7873
 
7840
- if (height$1 + this.offset > height(window)) {
7841
- this.inactive = true;
7842
- return false;
7843
- }
7874
+ var overflow = Math.max(0, height$1 + this.offset - height(window));
7844
7875
 
7845
7876
  var referenceElement = this.isFixed ? this.placeholder : this.$el;
7846
- this.topOffset = offset(referenceElement).top;
7847
- this.bottomOffset = this.topOffset + height$1;
7848
- this.offsetParentTop = offset(referenceElement.offsetParent).top;
7877
+ var topOffset = offset(referenceElement).top;
7878
+ var offsetParentTop = offset(referenceElement.offsetParent).top;
7849
7879
 
7850
- var bottom = parseProp('bottom', this);
7880
+ var top = parseProp(this.top, this.$el, topOffset);
7881
+ var bottom = parseProp(this.bottom, this.$el, topOffset + height$1);
7851
7882
 
7852
- this.top = Math.max(toFloat(parseProp('top', this)), this.topOffset) - this.offset;
7853
- this.bottom = bottom && bottom - this.$el.offsetHeight;
7854
- this.width = dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el).width;
7883
+ var start = Math.max(top, topOffset) - this.offset;
7884
+ var end = bottom
7885
+ ? bottom - this.$el.offsetHeight + overflow - this.offset
7886
+ : getScrollingElement(this.$el).scrollHeight - height(window);
7855
7887
 
7856
7888
  return {
7889
+ start: start,
7890
+ end: end,
7891
+ overflow: overflow,
7892
+ topOffset: topOffset,
7893
+ offsetParentTop: offsetParentTop,
7857
7894
  height: height$1,
7895
+ width: dimensions$1(isVisible(this.widthElement) ? this.widthElement : this.$el).width,
7858
7896
  top: offsetPosition(this.placeholder)[0],
7859
7897
  margins: css(this.$el, ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'])
7860
7898
  };
@@ -7886,14 +7924,29 @@
7886
7924
  {
7887
7925
 
7888
7926
  read: function(ref) {
7889
- var scroll = ref.scroll; if ( scroll === void 0 ) scroll = 0;
7927
+ var prevScroll = ref.scroll; if ( prevScroll === void 0 ) prevScroll = 0;
7928
+ var prevDir = ref.dir; if ( prevDir === void 0 ) prevDir = 'down';
7929
+ var overflow = ref.overflow;
7930
+ var overflowScroll = ref.overflowScroll; if ( overflowScroll === void 0 ) overflowScroll = 0;
7931
+ var start = ref.start;
7932
+ var end = ref.end;
7890
7933
 
7891
7934
 
7892
- this.scroll = window.pageYOffset;
7935
+ var scroll = scrollTop(window);
7936
+ var dir = prevScroll <= scroll ? 'down' : 'up';
7893
7937
 
7894
7938
  return {
7895
- dir: scroll <= this.scroll ? 'down' : 'up',
7896
- scroll: this.scroll
7939
+ dir: dir,
7940
+ prevDir: prevDir,
7941
+ scroll: scroll,
7942
+ prevScroll: prevScroll,
7943
+ overflowScroll: clamp(
7944
+ overflowScroll
7945
+ + clamp(scroll, start, end)
7946
+ - clamp(prevScroll, start, end),
7947
+ 0,
7948
+ overflow
7949
+ )
7897
7950
  };
7898
7951
  },
7899
7952
 
@@ -7901,35 +7954,34 @@
7901
7954
  var this$1$1 = this;
7902
7955
 
7903
7956
 
7904
- var now = Date.now();
7905
7957
  var isScrollUpdate = types.has('scroll');
7906
7958
  var initTimestamp = data.initTimestamp; if ( initTimestamp === void 0 ) initTimestamp = 0;
7907
7959
  var dir = data.dir;
7908
- var lastDir = data.lastDir;
7909
- var lastScroll = data.lastScroll;
7960
+ var prevDir = data.prevDir;
7910
7961
  var scroll = data.scroll;
7962
+ var prevScroll = data.prevScroll; if ( prevScroll === void 0 ) prevScroll = 0;
7911
7963
  var top = data.top;
7964
+ var start = data.start;
7965
+ var topOffset = data.topOffset;
7966
+ var height = data.height;
7912
7967
 
7913
- data.lastScroll = scroll;
7914
-
7915
- if (scroll < 0 || scroll === lastScroll && isScrollUpdate || this.showOnUp && !isScrollUpdate && !this.isFixed) {
7968
+ if (scroll < 0 || scroll === prevScroll && isScrollUpdate || this.showOnUp && !isScrollUpdate && !this.isFixed) {
7916
7969
  return;
7917
7970
  }
7918
7971
 
7919
- if (now - initTimestamp > 300 || dir !== lastDir) {
7972
+ var now = Date.now();
7973
+ if (now - initTimestamp > 300 || dir !== prevDir) {
7920
7974
  data.initScroll = scroll;
7921
7975
  data.initTimestamp = now;
7922
7976
  }
7923
7977
 
7924
- data.lastDir = dir;
7925
-
7926
- if (this.showOnUp && !this.isFixed && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(lastScroll - scroll) <= 10) {
7978
+ if (this.showOnUp && !this.isFixed && Math.abs(data.initScroll - scroll) <= 30 && Math.abs(prevScroll - scroll) <= 10) {
7927
7979
  return;
7928
7980
  }
7929
7981
 
7930
7982
  if (this.inactive
7931
- || scroll < this.top
7932
- || this.showOnUp && (scroll <= this.top || dir === 'down' && isScrollUpdate || dir === 'up' && !this.isFixed && scroll <= this.bottomOffset)
7983
+ || scroll < start
7984
+ || this.showOnUp && (scroll <= start || dir === 'down' && isScrollUpdate || dir === 'up' && !this.isFixed && scroll <= topOffset + height)
7933
7985
  ) {
7934
7986
 
7935
7987
  if (!this.isFixed) {
@@ -7944,7 +7996,7 @@
7944
7996
 
7945
7997
  this.isFixed = false;
7946
7998
 
7947
- if (this.animation && scroll > this.topOffset) {
7999
+ if (this.animation && scroll > topOffset) {
7948
8000
  Animation.cancel(this.$el);
7949
8001
  Animation.out(this.$el, this.animation).then(function () { return this$1$1.hide(); }, noop);
7950
8002
  } else {
@@ -7994,23 +8046,37 @@
7994
8046
 
7995
8047
  update: function() {
7996
8048
 
7997
- var active = this.top !== 0 || this.scroll > this.top;
7998
- var top = Math.max(0, this.offset);
8049
+ var ref = this._data;
8050
+ var width = ref.width;
8051
+ var scroll = ref.scroll; if ( scroll === void 0 ) scroll = 0;
8052
+ var overflow = ref.overflow;
8053
+ var overflowScroll = ref.overflowScroll; if ( overflowScroll === void 0 ) overflowScroll = 0;
8054
+ var start = ref.start;
8055
+ var end = ref.end;
8056
+ var topOffset = ref.topOffset;
8057
+ var height = ref.height;
8058
+ var offsetParentTop = ref.offsetParentTop;
8059
+ var active = start !== 0 || scroll > start;
8060
+ var top = this.offset;
7999
8061
  var position = 'fixed';
8000
8062
 
8001
- if (isNumeric(this.bottom) && this.scroll > this.bottom - this.offset) {
8002
- top = this.bottom - this.offsetParentTop;
8063
+ if (scroll > end) {
8064
+ top = end + this.offset - offsetParentTop;
8003
8065
  position = 'absolute';
8004
8066
  }
8005
8067
 
8068
+ if (overflow) {
8069
+ top -= overflowScroll;
8070
+ }
8071
+
8006
8072
  css(this.$el, {
8007
8073
  position: position,
8008
8074
  top: (top + "px"),
8009
- width: this.width
8075
+ width: width
8010
8076
  });
8011
8077
 
8012
8078
  this.isActive = active;
8013
- toggleClass(this.$el, this.clsBelow, this.scroll > this.bottomOffset);
8079
+ toggleClass(this.$el, this.clsBelow, scroll > topOffset + height);
8014
8080
  addClass(this.$el, this.clsFixed);
8015
8081
 
8016
8082
  }
@@ -8019,16 +8085,10 @@
8019
8085
 
8020
8086
  };
8021
8087
 
8022
- function parseProp(prop, ref) {
8023
- var $props = ref.$props;
8024
- var $el = ref.$el;
8025
- var propOffset = ref[(prop + "Offset")];
8026
-
8027
-
8028
- var value = $props[prop];
8088
+ function parseProp(value, el, propOffset) {
8029
8089
 
8030
8090
  if (!value) {
8031
- return;
8091
+ return 0;
8032
8092
  }
8033
8093
 
8034
8094
  if (isString(value) && value.match(/^-?\d/)) {
@@ -8037,7 +8097,7 @@
8037
8097
 
8038
8098
  } else {
8039
8099
 
8040
- return offset(value === true ? parent($el) : query(value, $el)).bottom;
8100
+ return offset(value === true ? parent(el) : query(value, el)).bottom;
8041
8101
 
8042
8102
  }
8043
8103
  }
@@ -10734,11 +10794,9 @@
10734
10794
  computed: {
10735
10795
 
10736
10796
  props: function(properties, $el) {
10737
- var this$1$1 = this;
10738
-
10739
10797
  return keys(props).reduce(function (result, prop) {
10740
10798
  if (!isUndefined(properties[prop])) {
10741
- result[prop] = props[prop].call(this$1$1, prop, $el, properties[prop].slice());
10799
+ result[prop] = props[prop](prop, $el, properties[prop].slice());
10742
10800
  }
10743
10801
  return result;
10744
10802
  }, {});
@@ -10746,6 +10804,12 @@
10746
10804
 
10747
10805
  },
10748
10806
 
10807
+ events: {
10808
+ bgimageload: function() {
10809
+ this.$emit();
10810
+ }
10811
+ },
10812
+
10749
10813
  methods: {
10750
10814
 
10751
10815
  reset: function() {
@@ -10893,15 +10957,15 @@
10893
10957
  var bgPos = css(el, 'backgroundPosition').split(' ')[prop === 'x' ? 0 : 1]; // IE 11 can't read background-position-[x|y]
10894
10958
 
10895
10959
  return getCssValue(el, 'backgroundSize', '') === 'cover'
10896
- ? backgroundCoverFn.call(this, prop, el, steps, bgPos, attr)
10960
+ ? backgroundCoverFn(prop, el, steps, bgPos, attr)
10897
10961
  : setBackgroundPosFn(prop, steps, bgPos);
10898
10962
  }
10899
10963
 
10900
10964
  function backgroundCoverFn(prop, el, steps, bgPos, attr) {
10901
10965
 
10902
- var image = getBackgroundImage.call(this, el);
10966
+ var dimImage = getBackgroundImageDimensions(el);
10903
10967
 
10904
- if (!image.naturalWidth) {
10968
+ if (!dimImage.width) {
10905
10969
  return noop;
10906
10970
  }
10907
10971
 
@@ -10917,11 +10981,6 @@
10917
10981
  height: el.offsetHeight
10918
10982
  };
10919
10983
 
10920
- var dimImage = {
10921
- width: image.naturalWidth,
10922
- height: image.naturalHeight
10923
- };
10924
-
10925
10984
  var baseDim = Dimensions.cover(dimImage, dimEl);
10926
10985
  var span = baseDim[attr] - dimEl[attr];
10927
10986
 
@@ -10952,26 +11011,34 @@
10952
11011
  };
10953
11012
  }
10954
11013
 
10955
- function getBackgroundImage(el) {
10956
- var this$1$1 = this;
10957
-
11014
+ var dimensions = {};
11015
+ function getBackgroundImageDimensions(el) {
10958
11016
  var src = css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
10959
11017
 
10960
- var data = this._data;
10961
-
10962
- if (data[src]) {
10963
- return data[src];
11018
+ if (dimensions[src]) {
11019
+ return dimensions[src];
10964
11020
  }
10965
11021
 
11022
+ var image = new Image();
10966
11023
  if (src) {
10967
- var img = new Image();
10968
- img.src = src;
10969
- if (!img.naturalWidth) {
10970
- img.onload = function () { return this$1$1.$update(); };
10971
- }
11024
+ image.src = src;
10972
11025
 
10973
- return data[src] = img;
11026
+ if (!image.naturalWidth) {
11027
+ image.onload = function () {
11028
+ dimensions[src] = toDimensions(image);
11029
+ trigger(el, 'bgimageload');
11030
+ };
11031
+ }
10974
11032
  }
11033
+
11034
+ return dimensions[src] = toDimensions(image);
11035
+ }
11036
+
11037
+ function toDimensions(image) {
11038
+ return {
11039
+ width: image.naturalWidth,
11040
+ height: image.naturalHeight
11041
+ };
10975
11042
  }
10976
11043
 
10977
11044
  function getStep(steps, percent) {
@@ -11042,16 +11109,18 @@
11042
11109
  start: function(ref) {
11043
11110
  var start = ref.start;
11044
11111
 
11045
- return parseCalc(start, this.target);
11112
+ return toPx(start, 'height', this.target, true);
11046
11113
  },
11047
11114
 
11048
11115
  end: function(ref) {
11049
11116
  var end = ref.end;
11050
11117
  var viewport = ref.viewport;
11051
11118
 
11052
- return parseCalc(
11119
+ return toPx(
11053
11120
  end || (viewport = (1 - viewport) * 100) && (viewport + "vh+" + viewport + "%"),
11054
- this.target
11121
+ 'height',
11122
+ this.target,
11123
+ true
11055
11124
  );
11056
11125
  }
11057
11126
 
@@ -11098,19 +11167,6 @@
11098
11167
 
11099
11168
  };
11100
11169
 
11101
- var calcRe = /-?\d+(?:\.\d+)?(?:v[wh]|%|px)?/g;
11102
- function parseCalc(calc, el) {
11103
- var match;
11104
- var result = 0;
11105
- calc = calc.toString().replace(/\s/g, '');
11106
- calcRe.lastIndex = 0;
11107
- while ((match = calcRe.exec(calc)) !== null) {
11108
- result += toPx(match[0], 'height', el, true);
11109
- }
11110
-
11111
- return result;
11112
- }
11113
-
11114
11170
  function ease(percent, easing) {
11115
11171
  return easing >= 0
11116
11172
  ? Math.pow(percent, easing + 1)
@@ -11160,10 +11216,10 @@
11160
11216
 
11161
11217
  var from = prev
11162
11218
  ? getLeft(prev, list, center)
11163
- : getLeft(next, list, center) + dimensions(next).width * dir;
11219
+ : getLeft(next, list, center) + dimensions$1(next).width * dir;
11164
11220
  var to = next
11165
11221
  ? getLeft(next, list, center)
11166
- : from + dimensions(prev).width * dir * (isRtl ? -1 : 1);
11222
+ : from + dimensions$1(prev).width * dir * (isRtl ? -1 : 1);
11167
11223
 
11168
11224
  return {
11169
11225
 
@@ -11212,7 +11268,7 @@
11212
11268
  css(list, 'transform', translate(clamp(
11213
11269
  -to + (distance - distance * percent),
11214
11270
  -getWidth(list),
11215
- dimensions(list).width
11271
+ dimensions$1(list).width
11216
11272
  ) * (isRtl ? -1 : 1), 'px'));
11217
11273
 
11218
11274
  var actives = this.getActives();
@@ -11285,30 +11341,30 @@
11285
11341
  }
11286
11342
 
11287
11343
  function getMax(list) {
11288
- return Math.max(0, getWidth(list) - dimensions(list).width);
11344
+ return Math.max(0, getWidth(list) - dimensions$1(list).width);
11289
11345
  }
11290
11346
 
11291
11347
  function getWidth(list) {
11292
- return children(list).reduce(function (right, el) { return dimensions(el).width + right; }, 0);
11348
+ return children(list).reduce(function (right, el) { return dimensions$1(el).width + right; }, 0);
11293
11349
  }
11294
11350
 
11295
11351
  function centerEl(el, list) {
11296
- return dimensions(list).width / 2 - dimensions(el).width / 2;
11352
+ return dimensions$1(list).width / 2 - dimensions$1(el).width / 2;
11297
11353
  }
11298
11354
 
11299
11355
  function getElLeft(el, list) {
11300
- return el && (position(el).left + (isRtl ? dimensions(el).width - dimensions(list).width : 0)) * (isRtl ? -1 : 1) || 0;
11356
+ return el && (position(el).left + (isRtl ? dimensions$1(el).width - dimensions$1(list).width : 0)) * (isRtl ? -1 : 1) || 0;
11301
11357
  }
11302
11358
 
11303
11359
  function inView(list, listLeft) {
11304
11360
 
11305
11361
  listLeft -= 1;
11306
- var listWidth = dimensions(list).width;
11362
+ var listWidth = dimensions$1(list).width;
11307
11363
  var listRight = listLeft + listWidth + 2;
11308
11364
 
11309
11365
  return children(list).filter(function (slide) {
11310
11366
  var slideLeft = getElLeft(slide, list);
11311
- var slideRight = slideLeft + Math.min(dimensions(slide).width, listWidth);
11367
+ var slideRight = slideLeft + Math.min(dimensions$1(slide).width, listWidth);
11312
11368
 
11313
11369
  return slideLeft >= listLeft && slideRight <= listRight;
11314
11370
  });
@@ -11346,7 +11402,7 @@
11346
11402
  finite: function(ref) {
11347
11403
  var finite = ref.finite;
11348
11404
 
11349
- return finite || Math.ceil(getWidth(this.list)) < dimensions(this.list).width + getMaxElWidth(this.list) + this.center;
11405
+ return finite || Math.ceil(getWidth(this.list)) < Math.floor(dimensions$1(this.list).width + getMaxElWidth(this.list) + this.center);
11350
11406
  },
11351
11407
 
11352
11408
  maxIndex: function() {
@@ -11367,7 +11423,7 @@
11367
11423
  return true;
11368
11424
  }
11369
11425
 
11370
- lft += dimensions(el).width;
11426
+ lft += dimensions$1(el).width;
11371
11427
 
11372
11428
  });
11373
11429
 
@@ -11383,7 +11439,7 @@
11383
11439
  return;
11384
11440
  }
11385
11441
 
11386
- var width = dimensions(this.list).width / (this.center ? 2 : 1);
11442
+ var width = dimensions$1(this.list).width / (this.center ? 2 : 1);
11387
11443
 
11388
11444
  var left = 0;
11389
11445
  var leftCenter = width;
@@ -11391,7 +11447,7 @@
11391
11447
 
11392
11448
  sets = sortBy$1(this.slides, 'offsetLeft').reduce(function (sets, slide, i) {
11393
11449
 
11394
- var slideWidth = dimensions(slide).width;
11450
+ var slideWidth = dimensions$1(slide).width;
11395
11451
  var slideRight = slideLeft + slideWidth;
11396
11452
 
11397
11453
  if (slideRight > left) {
@@ -11403,7 +11459,7 @@
11403
11459
  if (!includes(sets, i)) {
11404
11460
 
11405
11461
  var cmp = this$1$1.slides[i + 1];
11406
- if (this$1$1.center && cmp && slideWidth < leftCenter - dimensions(cmp).width / 2) {
11462
+ if (this$1$1.center && cmp && slideWidth < leftCenter - dimensions$1(cmp).width / 2) {
11407
11463
  leftCenter -= slideWidth;
11408
11464
  } else {
11409
11465
  leftCenter = width;
@@ -11491,7 +11547,7 @@
11491
11547
  }
11492
11548
 
11493
11549
  var index = this.dir < 0 || !this.slides[this.prevIndex] ? this.index : this.prevIndex;
11494
- this.duration = speedUp(this.avgWidth / this.velocity) * (dimensions(this.slides[index]).width / this.avgWidth);
11550
+ this.duration = speedUp(this.avgWidth / this.velocity) * (dimensions$1(this.slides[index]).width / this.avgWidth);
11495
11551
 
11496
11552
  this.reorder();
11497
11553
 
@@ -11531,7 +11587,7 @@
11531
11587
  }
11532
11588
 
11533
11589
  var next = this.slides[index];
11534
- var width = dimensions(this.list).width / 2 - dimensions(next).width / 2;
11590
+ var width = dimensions$1(this.list).width / 2 - dimensions$1(next).width / 2;
11535
11591
  var j = 0;
11536
11592
 
11537
11593
  while (width > 0) {
@@ -11539,7 +11595,7 @@
11539
11595
  var slide = this.slides[slideIndex];
11540
11596
 
11541
11597
  css(slide, 'order', slideIndex > index ? -2 : -1);
11542
- width -= dimensions(slide).width;
11598
+ width -= dimensions$1(slide).width;
11543
11599
  }
11544
11600
 
11545
11601
  },
@@ -11576,7 +11632,7 @@
11576
11632
  };
11577
11633
 
11578
11634
  function getMaxElWidth(list) {
11579
- return Math.max.apply(Math, [ 0 ].concat( children(list).map(function (el) { return dimensions(el).width; }) ));
11635
+ return Math.max.apply(Math, [ 0 ].concat( children(list).map(function (el) { return dimensions$1(el).width; }) ));
11580
11636
  }
11581
11637
 
11582
11638
  var sliderParallax = {
@@ -12090,7 +12146,6 @@
12090
12146
 
12091
12147
  off(document, pointerMove, this.move);
12092
12148
  off(document, pointerUp, this.end);
12093
- off(window, 'scroll', this.scroll);
12094
12149
 
12095
12150
  if (!this.drag) {
12096
12151
  return;
@@ -12173,7 +12228,7 @@
12173
12228
 
12174
12229
  var x = pos.x;
12175
12230
  var y = pos.y;
12176
- y += window.pageYOffset;
12231
+ y += scrollTop(window);
12177
12232
 
12178
12233
  var dist = (Date.now() - last) * .3;
12179
12234
  last = Date.now();