uikit 3.14.4-dev.07daf8fb8 → 3.14.4-dev.154737924

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 (49) 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 +1 -1
  10. package/dist/js/components/countdown.min.js +1 -1
  11. package/dist/js/components/filter.js +1 -1
  12. package/dist/js/components/filter.min.js +1 -1
  13. package/dist/js/components/lightbox-panel.js +19 -4
  14. package/dist/js/components/lightbox-panel.min.js +1 -1
  15. package/dist/js/components/lightbox.js +19 -4
  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 +1 -1
  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 +1 -1
  28. package/dist/js/components/slideshow.min.js +1 -1
  29. package/dist/js/components/sortable.js +1 -1
  30. package/dist/js/components/sortable.min.js +1 -1
  31. package/dist/js/components/tooltip.js +22 -6
  32. package/dist/js/components/tooltip.min.js +1 -1
  33. package/dist/js/components/upload.js +1 -1
  34. package/dist/js/components/upload.min.js +1 -1
  35. package/dist/js/uikit-core.js +112 -91
  36. package/dist/js/uikit-core.min.js +2 -2
  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 -91
  40. package/dist/js/uikit.min.js +2 -2
  41. package/package.json +1 -1
  42. package/src/js/core/navbar.js +2 -0
  43. package/src/js/core/toggle.js +3 -5
  44. package/src/js/mixin/modal.js +2 -2
  45. package/src/js/mixin/position.js +5 -4
  46. package/src/js/mixin/togglable.js +16 -1
  47. package/src/js/util/position.js +81 -76
  48. package/tests/navbar.html +13 -1
  49. package/tests/position.html +17 -4
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.14.4-dev.07daf8fb8 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.14.4-dev.154737924 | 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() :
@@ -1933,6 +1933,7 @@
1933
1933
  ...options.attach },
1934
1934
 
1935
1935
  offset: [0, 0],
1936
+ placement: [],
1936
1937
  ...options };
1937
1938
 
1938
1939
 
@@ -1943,55 +1944,19 @@
1943
1944
  offset(element, getPosition(element, target, options));
1944
1945
  }
1945
1946
 
1946
- function attachTo(element, target, options) {
1947
- let { attach, offset: offsetBy } = {
1948
- attach: {
1949
- element: ['left', 'top'],
1950
- target: ['left', 'top'],
1951
- ...options.attach },
1952
-
1953
- offset: [0, 0],
1954
- ...options };
1955
-
1956
-
1957
- const position = offset(element);
1958
-
1959
- for (const [i, [prop, dir, start, end]] of Object.entries(dirs)) {
1960
- const targetOffset =
1961
- attach.target[i] === attach.element[i] ? offsetViewport(target[i]) : offset(target[i]);
1962
-
1963
- position[start] = position[dir] =
1964
- targetOffset[start] +
1965
- moveBy(attach.target[i], end, targetOffset[prop]) -
1966
- moveBy(attach.element[i], end, position[prop]) +
1967
- +offsetBy[i];
1968
- position[end] = position[start] + position[prop];
1969
- }
1970
- return position;
1971
- }
1972
-
1973
- function moveBy(start, end, dim) {
1974
- return start === 'center' ? dim / 2 : start === end ? dim : 0;
1975
- }
1976
-
1977
1947
  function getPosition(element, target, options) {
1978
1948
  const position = attachTo(element, target, options);
1979
1949
 
1980
1950
  let {
1981
- flip,
1982
- shift,
1983
1951
  attach: { element: elAttach, target: targetAttach },
1984
1952
  offset: elOffset,
1985
1953
  boundary,
1986
- viewportOffset } =
1954
+ viewportOffset,
1955
+ placement } =
1987
1956
  options;
1988
1957
 
1989
- if (!flip && !shift) {
1990
- return position;
1991
- }
1992
-
1993
- const offsetPosition = { ...position };
1994
- for (const [i, [prop, dir, start, end]] of Object.entries(dirs)) {
1958
+ let offsetPosition = position;
1959
+ for (const [i, [prop,, start, end]] of Object.entries(dirs)) {
1995
1960
  let viewports = scrollParents(target[i]);
1996
1961
  const [scrollElement] = viewports;
1997
1962
 
@@ -2014,42 +1979,19 @@
2014
1979
  }
2015
1980
 
2016
1981
  let offsetBy = 0;
2017
- const targetDim = offset(target[i]);
2018
1982
 
2019
1983
  // Flip
2020
- if (!intersectLine(position, targetDim, i) && intersectLine(position, targetDim, 1 - i)) {
1984
+ if (placement[i] === 'flip') {
2021
1985
  if (
2022
- !flip ||
2023
- elAttach[i] === end && isInStartViewport ||
2024
- elAttach[i] === start && isInEndViewport)
1986
+ targetAttach[i] === end && isInEndViewport ||
1987
+ targetAttach[i] === start && isInStartViewport)
2025
1988
  {
2026
1989
  continue;
2027
1990
  }
2028
1991
 
2029
- offsetBy =
2030
- (elAttach[i] === start ?
2031
- -position[prop] :
2032
- elAttach[i] === end ?
2033
- position[prop] :
2034
- 0) + (
2035
- targetAttach[i] === start ?
2036
- targetDim[prop] :
2037
- targetAttach[i] === end ?
2038
- -targetDim[prop] :
2039
- 0) -
2040
- elOffset[i] * 2;
2041
-
2042
- if (
2043
- !isInScrollArea(
2044
- {
2045
- ...position,
2046
- [start]: position[start] + offsetBy,
2047
- [end]: position[end] + offsetBy },
2048
-
2049
- scrollElement,
2050
- i))
1992
+ offsetBy = flip(element, target, options, i)[start] - position[start];
2051
1993
 
2052
- {
1994
+ if (!isInScrollArea(applyOffset(position, offsetBy, i), scrollElement, i)) {
2053
1995
  if (isInScrollArea(position, scrollElement, i)) {
2054
1996
  continue;
2055
1997
  }
@@ -2061,10 +2003,11 @@
2061
2003
  const newPos = getPosition(element, target, {
2062
2004
  ...options,
2063
2005
  attach: {
2064
- element: elAttach.map(flipDir).reverse(),
2065
- target: targetAttach.map(flipDir).reverse() },
2006
+ element: elAttach.map(flipAxis).reverse(),
2007
+ target: targetAttach.map(flipAxis).reverse() },
2066
2008
 
2067
2009
  offset: elOffset.reverse(),
2010
+ placement: placement.reverse(),
2068
2011
  recursion: true });
2069
2012
 
2070
2013
 
@@ -2076,7 +2019,8 @@
2076
2019
  }
2077
2020
 
2078
2021
  // Shift
2079
- } else if (shift) {
2022
+ } else if (placement[i] === 'shift') {
2023
+ const targetDim = offset(target[i]);
2080
2024
  offsetBy =
2081
2025
  clamp(
2082
2026
  clamp(position[start], viewport[start], viewport[end] - position[prop]),
@@ -2085,13 +2029,54 @@
2085
2029
  position[start];
2086
2030
  }
2087
2031
 
2088
- offsetPosition[start] = position[dir] = position[start] + offsetBy;
2089
- offsetPosition[end] += offsetBy;
2032
+ offsetPosition = applyOffset(offsetPosition, offsetBy, i);
2090
2033
  }
2091
2034
 
2092
2035
  return offsetPosition;
2093
2036
  }
2094
2037
 
2038
+ function attachTo(element, target, options) {
2039
+ let { attach, offset: offsetBy } = {
2040
+ attach: {
2041
+ element: ['left', 'top'],
2042
+ target: ['left', 'top'],
2043
+ ...options.attach },
2044
+
2045
+ offset: [0, 0],
2046
+ ...options };
2047
+
2048
+
2049
+ let elOffset = offset(element);
2050
+
2051
+ for (const [i, [prop,, start, end]] of Object.entries(dirs)) {
2052
+ const targetOffset =
2053
+ attach.target[i] === attach.element[i] ? offsetViewport(target[i]) : offset(target[i]);
2054
+
2055
+ elOffset = applyOffset(
2056
+ elOffset,
2057
+ targetOffset[start] -
2058
+ elOffset[start] +
2059
+ moveBy(attach.target[i], end, targetOffset[prop]) -
2060
+ moveBy(attach.element[i], end, elOffset[prop]) +
2061
+ +offsetBy[i],
2062
+ i);
2063
+
2064
+ }
2065
+ return elOffset;
2066
+ }
2067
+
2068
+ function applyOffset(position, offset, i) {
2069
+ const [, dir, start, end] = dirs[i];
2070
+ const newPos = { ...position };
2071
+ newPos[start] = position[dir] = position[start] + offset;
2072
+ newPos[end] += offset;
2073
+ return newPos;
2074
+ }
2075
+
2076
+ function moveBy(attach, end, dim) {
2077
+ return attach === 'center' ? dim / 2 : attach === end ? dim : 0;
2078
+ }
2079
+
2095
2080
  function getIntersectionArea() {
2096
2081
  let area = {};for (var _len = arguments.length, rects = new Array(_len), _key = 0; _key < _len; _key++) {rects[_key] = arguments[_key];}
2097
2082
  for (const rect of rects) {
@@ -2112,12 +2097,32 @@
2112
2097
  return position[start] >= viewport[start] && position[end] <= viewport[end];
2113
2098
  }
2114
2099
 
2115
- function intersectLine(dimA, dimB, dir) {
2116
- const [,, start, end] = dirs[dir];
2117
- return dimA[end] > dimB[start] && dimB[end] > dimA[start];
2100
+ function flip(element, target, _ref, i) {let { offset, attach } = _ref;
2101
+ return attachTo(element, target, {
2102
+ attach: {
2103
+ element: flipAttach(attach.element, i),
2104
+ target: flipAttach(attach.target, i) },
2105
+
2106
+ offset: flipOffset(offset, i) });
2107
+
2108
+ }
2109
+
2110
+ function flipAttach(attach, i) {
2111
+ const newAttach = [...attach];
2112
+ const index = dirs[i].indexOf(attach[i]);
2113
+ if (~index) {
2114
+ newAttach[i] = dirs[i][1 - index % 2 + 2];
2115
+ }
2116
+ return newAttach;
2118
2117
  }
2119
2118
 
2120
- function flipDir(prop) {
2119
+ function flipOffset(offset, i) {
2120
+ offset = [...offset];
2121
+ offset[i] *= -1;
2122
+ return offset;
2123
+ }
2124
+
2125
+ function flipAxis(prop) {
2121
2126
  for (let i = 0; i < dirs.length; i++) {
2122
2127
  const index = dirs[i].indexOf(prop);
2123
2128
  if (~index) {
@@ -2926,7 +2931,7 @@
2926
2931
  UIkit.data = '__uikit__';
2927
2932
  UIkit.prefix = 'uk-';
2928
2933
  UIkit.options = {};
2929
- UIkit.version = '3.14.4-dev.07daf8fb8';
2934
+ UIkit.version = '3.14.4-dev.154737924';
2930
2935
 
2931
2936
  globalAPI(UIkit);
2932
2937
  hooksAPI(UIkit);
@@ -3169,6 +3174,7 @@
3169
3174
  const currentMargin = toFloat(css(el, marginProp));
3170
3175
  const marginStart = toFloat(css(el, marginStartProp));
3171
3176
  const endDim = dim[dimProp] + marginStart;
3177
+ const overflow = getOverflow(el);
3172
3178
 
3173
3179
  if (!inProgress && !show) {
3174
3180
  currentDim += marginStart;
@@ -3191,12 +3197,12 @@
3191
3197
 
3192
3198
 
3193
3199
  css(el, {
3200
+ overflow,
3194
3201
  padding: 0,
3195
3202
  border: 0,
3196
3203
  [marginStartProp]: 0,
3197
3204
  width: dim.width,
3198
3205
  height: dim.height,
3199
- overflow: 'hidden',
3200
3206
  [dimProp]: currentDim });
3201
3207
 
3202
3208
 
@@ -3244,6 +3250,20 @@
3244
3250
  };
3245
3251
  }
3246
3252
 
3253
+ function getOverflow(el) {
3254
+ return [
3255
+ ['X', 'Width'],
3256
+ ['Y', 'Height']].
3257
+
3258
+ map((_ref4) => {let [axis, prop] = _ref4;return (
3259
+ includes(['auto', 'scroll'], css(el, "overflow" + axis)) &&
3260
+ el["scroll" + prop] > el["client" + prop] ?
3261
+ 'scroll' :
3262
+ 'hidden');}).
3263
+
3264
+ join(' ');
3265
+ }
3266
+
3247
3267
  var Accordion = {
3248
3268
  mixins: [Class, Lazyload, Togglable],
3249
3269
 
@@ -3616,6 +3636,7 @@
3616
3636
  methods: {
3617
3637
  positionAt(element, target, boundary) {
3618
3638
  let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
3639
+ const placement = [this.flip && 'flip', this.shift && 'shift'];
3619
3640
 
3620
3641
  const attach = {
3621
3642
  element: [this.inset ? this.dir : flipPosition(this.dir), this.align],
@@ -3624,9 +3645,10 @@
3624
3645
 
3625
3646
  if (this.axis === 'y') {
3626
3647
  for (const prop in attach) {
3627
- attach[prop] = attach[prop].reverse();
3648
+ attach[prop].reverse();
3628
3649
  }
3629
- offset = offset.reverse();
3650
+ offset.reverse();
3651
+ placement.reverse();
3630
3652
  }
3631
3653
 
3632
3654
  const [scrollElement] = scrollParents(element, /auto|scroll/);
@@ -3640,8 +3662,7 @@
3640
3662
  attach,
3641
3663
  offset,
3642
3664
  boundary,
3643
- flip: this.flip,
3644
- shift: this.shift,
3665
+ placement,
3645
3666
  viewportOffset: this.getViewportOffset(element) });
3646
3667
 
3647
3668
 
@@ -3794,8 +3815,8 @@
3794
3815
 
3795
3816
 
3796
3817
  if (this.overlay) {
3797
- once(this.$el, 'hidden', preventOverscroll(this.$el));
3798
- once(this.$el, 'hidden', preventBackgroundScroll());
3818
+ once(this.$el, 'hidden', preventOverscroll(this.$el), { self: true });
3819
+ once(this.$el, 'hidden', preventBackgroundScroll(), { self: true });
3799
3820
  }
3800
3821
 
3801
3822
  if (this.stack) {
@@ -5829,6 +5850,8 @@
5829
5850
  offset: Number,
5830
5851
  boundary: Boolean,
5831
5852
  target: Boolean,
5853
+ targetX: Boolean,
5854
+ targetY: Boolean,
5832
5855
  clsDrop: String,
5833
5856
  delayShow: Number,
5834
5857
  delayHide: Number,
@@ -7596,7 +7619,7 @@
7596
7619
 
7597
7620
 
7598
7621
  {
7599
- name: 'toggled',
7622
+ name: 'hide show',
7600
7623
 
7601
7624
  self: true,
7602
7625
 
@@ -7604,10 +7627,8 @@
7604
7627
  return this.target;
7605
7628
  },
7606
7629
 
7607
- handler(e, toggled) {
7608
- if (e.target === this.target[0]) {
7609
- this.updateAria(toggled);
7610
- }
7630
+ handler(_ref2) {let { type } = _ref2;
7631
+ this.updateAria(type === 'show');
7611
7632
  } },
7612
7633
 
7613
7634