uikit 3.14.2-dev.e270e98f7 → 3.14.3-dev.5325d42a0

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 (96) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/build/util.js +8 -2
  3. package/dist/css/uikit-core-rtl.css +93 -21
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +93 -21
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +99 -33
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +99 -33
  10. package/dist/css/uikit.min.css +1 -1
  11. package/dist/js/components/countdown.js +1 -1
  12. package/dist/js/components/countdown.min.js +1 -1
  13. package/dist/js/components/filter.js +1 -1
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +106 -17
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +106 -17
  18. package/dist/js/components/lightbox.min.js +1 -1
  19. package/dist/js/components/notification.js +1 -1
  20. package/dist/js/components/notification.min.js +1 -1
  21. package/dist/js/components/parallax.js +71 -36
  22. package/dist/js/components/parallax.min.js +1 -1
  23. package/dist/js/components/slider-parallax.js +55 -35
  24. package/dist/js/components/slider-parallax.min.js +1 -1
  25. package/dist/js/components/slider.js +1 -1
  26. package/dist/js/components/slider.min.js +1 -1
  27. package/dist/js/components/slideshow-parallax.js +55 -35
  28. package/dist/js/components/slideshow-parallax.min.js +1 -1
  29. package/dist/js/components/slideshow.js +1 -1
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +1 -1
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +142 -36
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +1 -1
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +276 -129
  38. package/dist/js/uikit-core.min.js +1 -1
  39. package/dist/js/uikit-icons.js +1 -1
  40. package/dist/js/uikit-icons.min.js +1 -1
  41. package/dist/js/uikit.js +346 -164
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +11 -11
  44. package/src/js/components/parallax.js +16 -1
  45. package/src/js/core/accordion.js +3 -3
  46. package/src/js/core/alert.js +1 -1
  47. package/src/js/core/drop.js +47 -18
  48. package/src/js/core/height-viewport.js +15 -11
  49. package/src/js/core/navbar.js +19 -18
  50. package/src/js/core/scrollspy.js +4 -0
  51. package/src/js/core/toggle.js +9 -8
  52. package/src/js/mixin/parallax.js +54 -34
  53. package/src/js/mixin/position.js +36 -20
  54. package/src/js/mixin/togglable.js +110 -19
  55. package/src/js/util/animation.js +1 -0
  56. package/src/js/util/dom.js +4 -3
  57. package/src/js/util/position.js +24 -22
  58. package/src/js/util/viewport.js +7 -8
  59. package/src/less/components/drop.less +19 -4
  60. package/src/less/components/dropdown.less +21 -4
  61. package/src/less/components/margin.less +13 -14
  62. package/src/less/components/modal.less +19 -4
  63. package/src/less/components/nav.less +1 -1
  64. package/src/less/components/navbar.less +60 -19
  65. package/src/less/components/offcanvas.less +21 -21
  66. package/src/less/components/position.less +1 -1
  67. package/src/less/components/sticky.less +7 -0
  68. package/src/less/components/tooltip.less +1 -0
  69. package/src/less/components/utility.less +1 -2
  70. package/src/less/theme/dropdown.less +11 -0
  71. package/src/less/theme/navbar.less +10 -10
  72. package/src/scss/components/drop.scss +19 -4
  73. package/src/scss/components/dropdown.scss +21 -4
  74. package/src/scss/components/margin.scss +13 -14
  75. package/src/scss/components/modal.scss +19 -4
  76. package/src/scss/components/nav.scss +1 -1
  77. package/src/scss/components/navbar.scss +49 -8
  78. package/src/scss/components/offcanvas.scss +21 -21
  79. package/src/scss/components/position.scss +1 -1
  80. package/src/scss/components/sticky.scss +7 -0
  81. package/src/scss/components/tooltip.scss +1 -0
  82. package/src/scss/components/utility.scss +1 -2
  83. package/src/scss/mixins-theme.scss +8 -10
  84. package/src/scss/mixins.scss +2 -0
  85. package/src/scss/theme/dropdown.scss +8 -0
  86. package/src/scss/theme/navbar.scss +7 -0
  87. package/src/scss/variables-theme.scss +26 -11
  88. package/src/scss/variables.scss +24 -11
  89. package/tests/drop.html +165 -4
  90. package/tests/dropdown.html +234 -13
  91. package/tests/height-viewport.html +62 -0
  92. package/tests/navbar.html +333 -64
  93. package/tests/offcanvas.html +8 -8
  94. package/tests/sticky-navbar.html +132 -0
  95. package/tests/sticky-parallax.html +2 -1
  96. package/tests/sticky.html +5 -4
package/dist/js/uikit.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.14.2-dev.e270e98f7 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.14.3-dev.5325d42a0 | 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() :
@@ -868,6 +868,7 @@
868
868
  }
869
869
 
870
870
  function transition(element, props, duration, timing) {if (duration === void 0) {duration = 400;}if (timing === void 0) {timing = 'linear';}
871
+ duration = Math.round(duration);
871
872
  return Promise.all(
872
873
  toNodes(element).map(
873
874
  (element) =>
@@ -1182,14 +1183,15 @@
1182
1183
  }
1183
1184
 
1184
1185
  function empty(element) {
1185
- return replaceChildren(element, '');
1186
+ element = $(element);
1187
+ element.innerHTML = '';
1188
+ return element;
1186
1189
  }
1187
1190
 
1188
1191
  function html(parent, html) {
1189
- return isUndefined(html) ? $(parent).innerHTML : replaceChildren(parent, html);
1192
+ return isUndefined(html) ? $(parent).innerHTML : append(empty(parent), html);
1190
1193
  }
1191
1194
 
1192
- const replaceChildren = applyFn('replaceChildren');
1193
1195
  const prepend = applyFn('prepend');
1194
1196
  const append = applyFn('append');
1195
1197
  const before = applyFn('before');
@@ -1886,7 +1888,7 @@
1886
1888
  return clamp((scrollTop - start) / (end - start));
1887
1889
  }
1888
1890
 
1889
- function scrollParents(element, overflowRe, scrollable) {if (overflowRe === void 0) {overflowRe = /auto|scroll|hidden/;}if (scrollable === void 0) {scrollable = false;}
1891
+ function scrollParents(element, overflowRe, scrollable) {if (overflowRe === void 0) {overflowRe = /auto|scroll|hidden|clip/;}if (scrollable === void 0) {scrollable = false;}
1890
1892
  const scrollEl = scrollingElement(element);
1891
1893
 
1892
1894
  let ancestors = parents(element).reverse();
@@ -1916,21 +1918,20 @@
1916
1918
  ['width', 'x', 'left', 'right'],
1917
1919
  ['height', 'y', 'top', 'bottom']])
1918
1920
  {
1919
- if (!isWindow(getViewport$1(viewportElement))) {
1921
+ if (!isWindow(viewportElement)) {
1920
1922
  rect[start] += toFloat(css(viewportElement, "border" + ucfirst(start) + "Width"));
1923
+ } else {
1924
+ // iOS 12 returns <body> as scrollingElement
1925
+ viewportElement = viewportElement.document.documentElement;
1921
1926
  }
1922
- rect[prop] = rect[dir] =
1923
- viewportElement[(isWindow(viewportElement) ? 'inner' : 'client') + ucfirst(prop)];
1927
+ rect[prop] = rect[dir] = viewportElement["client" + ucfirst(prop)];
1924
1928
  rect[end] = rect[prop] + rect[start];
1925
1929
  }
1926
1930
  return rect;
1927
1931
  }
1928
1932
 
1929
1933
  function scrollingElement(element) {
1930
- const {
1931
- document: { scrollingElement } } =
1932
- toWindow(element);
1933
- return scrollingElement;
1934
+ return toWindow(element).document.scrollingElement;
1934
1935
  }
1935
1936
 
1936
1937
  function getViewport$1(scrollElement) {
@@ -1984,6 +1985,10 @@
1984
1985
  return position;
1985
1986
  }
1986
1987
 
1988
+ function moveBy(start, end, dim) {
1989
+ return start === 'center' ? dim / 2 : start === end ? dim : 0;
1990
+ }
1991
+
1987
1992
  function attachToWithFlip(element, target, options) {
1988
1993
  const position = attachTo(element, target, options);
1989
1994
  const targetDim = offset(target);
@@ -1994,7 +1999,7 @@
1994
1999
  offset: elOffset,
1995
2000
  boundary,
1996
2001
  viewport,
1997
- viewportPadding } =
2002
+ viewportOffset } =
1998
2003
  options;
1999
2004
 
2000
2005
  let viewports = scrollParents(element);
@@ -2015,9 +2020,9 @@
2015
2020
 
2016
2021
  viewport = getIntersectionArea(...viewports.filter(Boolean).map(offsetViewport));
2017
2022
 
2018
- if (viewportPadding) {
2019
- viewport[start] += viewportPadding;
2020
- viewport[end] -= viewportPadding;
2023
+ if (viewportOffset) {
2024
+ viewport[start] += viewportOffset;
2025
+ viewport[end] -= viewportOffset;
2021
2026
  }
2022
2027
 
2023
2028
  if (boundary && !willFlip && position[prop] <= offset(boundary)[prop]) {
@@ -2074,19 +2079,21 @@
2074
2079
  return false;
2075
2080
  }
2076
2081
 
2077
- const newPos = attachToWithFlip(element, target, {
2078
- ...options,
2079
- attach: {
2080
- element: elAttach.map(flipDir).reverse(),
2081
- target: targetAttach.map(flipDir).reverse() },
2082
+ if (flip === true || includes(flip, dirs[1 - i][1])) {
2083
+ const newPos = attachToWithFlip(element, target, {
2084
+ ...options,
2085
+ attach: {
2086
+ element: elAttach.map(flipDir).reverse(),
2087
+ target: targetAttach.map(flipDir).reverse() },
2082
2088
 
2083
- offset: elOffset.reverse(),
2084
- flip: flip === true ? flip : [...flip, dirs[1 - i][1]],
2085
- recursion: true });
2089
+ offset: elOffset.reverse(),
2090
+ flip: flip === true ? flip : [...flip, dirs[1 - i][1]],
2091
+ recursion: true });
2086
2092
 
2087
2093
 
2088
- if (newPos && isInScrollArea(newPos, scrollElement, 1 - i)) {
2089
- return newPos;
2094
+ if (newPos && isInScrollArea(newPos, scrollElement, 1 - i)) {
2095
+ return newPos;
2096
+ }
2090
2097
  }
2091
2098
  }
2092
2099
 
@@ -2107,10 +2114,6 @@
2107
2114
  return offsetPosition;
2108
2115
  }
2109
2116
 
2110
- function moveBy(start, end, dim) {
2111
- return start === 'center' ? dim / 2 : start === end ? dim : 0;
2112
- }
2113
-
2114
2117
  function getIntersectionArea() {
2115
2118
  let area = {};for (var _len = arguments.length, rects = new Array(_len), _key = 0; _key < _len; _key++) {rects[_key] = arguments[_key];}
2116
2119
  for (const rect of rects) {
@@ -2176,7 +2179,6 @@
2176
2179
  isTag: isTag,
2177
2180
  empty: empty,
2178
2181
  html: html,
2179
- replaceChildren: replaceChildren,
2180
2182
  prepend: prepend,
2181
2183
  append: append,
2182
2184
  before: before,
@@ -2948,7 +2950,7 @@
2948
2950
  UIkit.data = '__uikit__';
2949
2951
  UIkit.prefix = 'uk-';
2950
2952
  UIkit.options = {};
2951
- UIkit.version = '3.14.2-dev.e270e98f7';
2953
+ UIkit.version = '3.14.3-dev.5325d42a0';
2952
2954
 
2953
2955
  globalAPI(UIkit);
2954
2956
  hooksAPI(UIkit);
@@ -3057,7 +3059,7 @@
3057
3059
 
3058
3060
  initProps: {
3059
3061
  overflow: '',
3060
- height: '',
3062
+ maxHeight: '',
3061
3063
  paddingTop: '',
3062
3064
  paddingBottom: '',
3063
3065
  marginTop: '',
@@ -3067,7 +3069,7 @@
3067
3069
 
3068
3070
  hideProps: {
3069
3071
  overflow: 'hidden',
3070
- height: 0,
3072
+ maxHeight: 0,
3071
3073
  paddingTop: 0,
3072
3074
  paddingBottom: 0,
3073
3075
  marginTop: 0,
@@ -3082,7 +3084,7 @@
3082
3084
  },
3083
3085
 
3084
3086
  hasTransition(_ref2) {let { animation } = _ref2;
3085
- return this.hasAnimation && animation[0] === true;
3087
+ return startsWith(animation[0], 'slide');
3086
3088
  } },
3087
3089
 
3088
3090
 
@@ -3097,13 +3099,18 @@
3097
3099
  return Promise.reject();
3098
3100
  }
3099
3101
 
3102
+ if (!animate) {
3103
+ Animation.cancel(el);
3104
+ Transition.cancel(el);
3105
+ }
3106
+
3100
3107
  const promise = (
3101
3108
  isFunction(animate) ?
3102
3109
  animate :
3103
3110
  animate === false || !this.hasAnimation ?
3104
- this._toggle :
3111
+ toggleInstant(this) :
3105
3112
  this.hasTransition ?
3106
- toggleHeight(this) :
3113
+ toggleTransition(this) :
3107
3114
  toggleAnimation(this))(
3108
3115
  el, show);
3109
3116
 
@@ -3167,7 +3174,25 @@
3167
3174
 
3168
3175
 
3169
3176
 
3170
- function toggleHeight(_ref3)
3177
+ function toggleInstant(_ref3) {let { _toggle } = _ref3;
3178
+ return (el, show) => {
3179
+ Animation.cancel(el);
3180
+ Transition.cancel(el);
3181
+ return _toggle(el, show);
3182
+ };
3183
+ }
3184
+
3185
+ function toggleTransition(cmp) {
3186
+ switch (cmp.animation[0]) {
3187
+ case 'slide-left':
3188
+ return slideHorizontal(cmp);
3189
+ case 'slide-right':
3190
+ return slideHorizontal(cmp, true);}
3191
+
3192
+ return slide$1(cmp);
3193
+ }
3194
+
3195
+ function slide$1(_ref4)
3171
3196
 
3172
3197
 
3173
3198
 
@@ -3175,14 +3200,17 @@
3175
3200
 
3176
3201
 
3177
3202
 
3178
- {let { isToggled, duration, velocity, initProps, hideProps, transition, _toggle } = _ref3;
3203
+ {let { isToggled, duration, velocity, initProps, hideProps, transition, _toggle } = _ref4;
3179
3204
  return (el, show) => {
3180
3205
  const inProgress = Transition.inProgress(el);
3181
- const inner = el.hasChildNodes() ?
3206
+ const inner =
3207
+ !inProgress && el.hasChildNodes() ?
3182
3208
  toFloat(css(el.firstElementChild, 'marginTop')) +
3183
3209
  toFloat(css(el.lastElementChild, 'marginBottom')) :
3184
3210
  0;
3185
- const currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
3211
+ const currentHeight = isVisible(el) ? toFloat(css(el, 'height')) + inner : 0;
3212
+
3213
+ const props = inProgress ? css(el, Object.keys(initProps)) : show ? hideProps : initProps;
3186
3214
 
3187
3215
  Transition.cancel(el);
3188
3216
 
@@ -3190,34 +3218,97 @@
3190
3218
  _toggle(el, true);
3191
3219
  }
3192
3220
 
3193
- height(el, '');
3221
+ css(el, 'maxHeight', '');
3194
3222
 
3195
3223
  // Update child components first
3196
3224
  fastdom.flush();
3197
3225
 
3198
- const endHeight = height(el) + (inProgress ? 0 : inner);
3199
- duration = velocity * el.offsetHeight + duration;
3226
+ const endHeight = toFloat(css(el, 'height')) + inner;
3227
+ duration = velocity * endHeight + duration;
3200
3228
 
3201
- height(el, currentHeight);
3229
+ css(el, { ...props, maxHeight: currentHeight });
3202
3230
 
3203
3231
  return (
3204
3232
  show ?
3205
3233
  Transition.start(
3206
3234
  el,
3207
- { ...initProps, overflow: 'hidden', height: endHeight },
3208
- Math.round(duration * (1 - currentHeight / endHeight)),
3235
+ { ...initProps, overflow: 'hidden', maxHeight: endHeight },
3236
+ duration * (1 - currentHeight / endHeight),
3209
3237
  transition) :
3210
3238
 
3211
3239
  Transition.start(
3212
3240
  el,
3213
3241
  hideProps,
3214
- Math.round(duration * (currentHeight / endHeight)),
3242
+ duration * (currentHeight / endHeight),
3215
3243
  transition).
3216
3244
  then(() => _toggle(el, false))).
3217
3245
  then(() => css(el, initProps));
3218
3246
  };
3219
3247
  }
3220
3248
 
3249
+ function slideHorizontal(_ref5, right) {let { isToggled, duration, velocity, transition, _toggle } = _ref5;
3250
+ return (el, show) => {
3251
+ const visible = isVisible(el);
3252
+ const marginLeft = toFloat(css(el, 'marginLeft'));
3253
+
3254
+ Transition.cancel(el);
3255
+
3256
+ const [scrollElement] = scrollParents(el);
3257
+ css(scrollElement, 'overflowX', 'hidden');
3258
+
3259
+ if (!isToggled(el)) {
3260
+ _toggle(el, true);
3261
+ }
3262
+
3263
+ const width = toFloat(css(el, 'width'));
3264
+ duration = velocity * width + duration;
3265
+
3266
+ const percent = visible ? (width + marginLeft * (right ? -1 : 1)) / width * 100 : 0;
3267
+ const offsetEl = offset(el);
3268
+ const useClipPath = right ?
3269
+ offsetEl.right < scrollElement.clientWidth :
3270
+ Math.round(offsetEl.left) > 0;
3271
+
3272
+ css(el, {
3273
+ clipPath: useClipPath ?
3274
+ right ? "polygon(0 0," +
3275
+ percent + "% 0," + percent + "% 100%,0 100%)" : "polygon(" + (
3276
+ 100 - percent) + "% 0,100% 0,100% 100%," + (100 - percent) + "% 100%)" :
3277
+ '',
3278
+ marginLeft: (100 - percent) * (right ? 1 : -1) / 100 * width });
3279
+
3280
+
3281
+ return (
3282
+ show ?
3283
+ Transition.start(
3284
+ el,
3285
+ {
3286
+ clipPath: useClipPath ? "polygon(0 0,100% 0,100% 100%,0 100%)" : '',
3287
+ marginLeft: 0 },
3288
+
3289
+ duration * (1 - percent / 100),
3290
+ transition) :
3291
+
3292
+ Transition.start(
3293
+ el,
3294
+ {
3295
+ clipPath: useClipPath ?
3296
+ right ? "polygon(0 0,0 0,0 100%,0 100%)" : "polygon(100% 0,100% 0,100% 100%,100% 100%)" :
3297
+
3298
+
3299
+ '',
3300
+ marginLeft: (right ? 1 : -1) * width },
3301
+
3302
+ duration * (percent / 100),
3303
+ transition).
3304
+ then(() => _toggle(el, false))).
3305
+ then(() => {
3306
+ css(scrollElement, 'overflowX', '');
3307
+ css(el, { clipPath: '', marginLeft: '' });
3308
+ });
3309
+ };
3310
+ }
3311
+
3221
3312
  function toggleAnimation(cmp) {
3222
3313
  return (el, show) => {
3223
3314
  Animation.cancel(el);
@@ -3251,7 +3342,7 @@
3251
3342
  data: {
3252
3343
  targets: '> *',
3253
3344
  active: false,
3254
- animation: [true],
3345
+ animation: ['slide'],
3255
3346
  collapsible: true,
3256
3347
  multiple: false,
3257
3348
  clsOpen: 'uk-open',
@@ -3361,7 +3452,7 @@
3361
3452
  }
3362
3453
 
3363
3454
  hide(content, false);
3364
- await toggleHeight(this)(el._wrapper, show);
3455
+ await slide$1(this)(el._wrapper, show);
3365
3456
  hide(content, !show);
3366
3457
 
3367
3458
  delete el._wrapper;
@@ -3395,7 +3486,7 @@
3395
3486
 
3396
3487
 
3397
3488
  data: {
3398
- animation: [true],
3489
+ animation: ['slide'],
3399
3490
  selClose: '.uk-alert-close',
3400
3491
  duration: 150,
3401
3492
  hideProps: { opacity: 0, ...Togglable.data.hideProps } },
@@ -3576,49 +3667,66 @@
3576
3667
  data: {
3577
3668
  pos: "bottom-" + (isRtl ? 'right' : 'left'),
3578
3669
  flip: true,
3579
- offset: false,
3580
- viewportPadding: 10 },
3670
+ offset: false },
3581
3671
 
3582
3672
 
3583
3673
  connected() {
3584
3674
  this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
3585
- this.axis = includes(['top', 'bottom'], this.pos[0]) ? 'y' : 'x';
3675
+ [this.dir, this.align] = this.pos;
3676
+ this.axis = includes(['top', 'bottom'], this.dir) ? 'y' : 'x';
3586
3677
  },
3587
3678
 
3588
3679
  methods: {
3589
3680
  positionAt(element, target, boundary) {
3590
- const [dir, align] = this.pos;
3591
-
3592
- let { offset: offset$1 } = this;
3593
- if (!isNumeric(offset$1)) {
3594
- const node = $(offset$1);
3595
- offset$1 = node ?
3596
- offset(node)[this.axis === 'x' ? 'left' : 'top'] -
3597
- offset(target)[this.axis === 'x' ? 'right' : 'bottom'] :
3598
- 0;
3599
- }
3600
- offset$1 = toPx(offset$1) + toPx(getCssVar('position-offset', element));
3601
- offset$1 = [includes(['left', 'top'], dir) ? -offset$1 : +offset$1, 0];
3681
+ let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
3602
3682
 
3603
3683
  const attach = {
3604
- element: [flipPosition(dir), align],
3605
- target: [dir, align] };
3684
+ element: [flipPosition(this.dir), this.align],
3685
+ target: [this.dir, this.align] };
3606
3686
 
3607
3687
 
3608
3688
  if (this.axis === 'y') {
3609
3689
  for (const prop in attach) {
3610
3690
  attach[prop] = attach[prop].reverse();
3611
3691
  }
3612
- offset$1 = offset$1.reverse();
3692
+ offset = offset.reverse();
3613
3693
  }
3614
3694
 
3695
+ // Ensure none positioned element does not generate scrollbars
3696
+ const elDim = dimensions$1(element);
3697
+ css(element, { top: -elDim.height, left: -elDim.width });
3698
+
3615
3699
  positionAt(element, target, {
3616
3700
  attach,
3617
- offset: offset$1,
3701
+ offset,
3618
3702
  boundary,
3619
- viewportPadding: this.boundaryAlign ? 0 : this.viewportPadding,
3620
- flip: this.flip });
3703
+ flip: this.flip,
3704
+ viewportOffset: this.getViewportOffset(element) });
3705
+
3706
+ },
3707
+
3708
+ getPositionOffset(element) {
3709
+ return (
3710
+ toPx(
3711
+ this.offset === false ? getCssVar('position-offset', element) : this.offset,
3712
+ this.axis === 'x' ? 'width' : 'height',
3713
+ element) * (
3714
+ includes(['left', 'top'], this.dir) ? -1 : 1));
3715
+
3716
+ },
3621
3717
 
3718
+ getShiftOffset(element) {
3719
+ return includes(['center', 'justify', 'stretch'], this.align) ?
3720
+ 0 :
3721
+ toPx(
3722
+ getCssVar('position-shift-offset', element),
3723
+ this.axis === 'y' ? 'width' : 'height',
3724
+ element) * (
3725
+ includes(['left', 'top'], this.align) ? 1 : -1);
3726
+ },
3727
+
3728
+ getViewportOffset(element) {
3729
+ return toPx(getCssVar('position-viewport-offset', element));
3622
3730
  } } };
3623
3731
 
3624
3732
  let active$1;
@@ -3636,7 +3744,8 @@
3636
3744
  delayShow: Number,
3637
3745
  delayHide: Number,
3638
3746
  display: String,
3639
- clsDrop: String },
3747
+ clsDrop: String,
3748
+ animateOut: Boolean },
3640
3749
 
3641
3750
 
3642
3751
  data: {
@@ -3650,7 +3759,8 @@
3650
3759
  clsDrop: false,
3651
3760
  animation: ['uk-animation-fade'],
3652
3761
  cls: 'uk-open',
3653
- container: false },
3762
+ container: false,
3763
+ animateOut: false },
3654
3764
 
3655
3765
 
3656
3766
  created() {
@@ -3838,7 +3948,7 @@
3838
3948
  }
3839
3949
  }),
3840
3950
 
3841
- ...(this.display === 'static' ?
3951
+ ...(this.display === 'static' && this.align !== 'stretch' ?
3842
3952
  [] :
3843
3953
  (() => {
3844
3954
  const handler = () => this.$emit();
@@ -3899,7 +4009,7 @@
3899
4009
  methods: {
3900
4010
  show(target, delay) {if (target === void 0) {target = this.target;}if (delay === void 0) {delay = true;}
3901
4011
  if (this.isToggled() && target && this.target && target !== this.target) {
3902
- this.hide(false);
4012
+ this.hide(false, false);
3903
4013
  }
3904
4014
 
3905
4015
  this.target = target;
@@ -3919,7 +4029,7 @@
3919
4029
  let prev;
3920
4030
  while (active$1 && prev !== active$1 && !within(this.$el, active$1.$el)) {
3921
4031
  prev = active$1;
3922
- active$1.hide(false);
4032
+ active$1.hide(false, false);
3923
4033
  }
3924
4034
  }
3925
4035
 
@@ -3933,8 +4043,8 @@
3933
4043
 
3934
4044
  },
3935
4045
 
3936
- hide(delay) {if (delay === void 0) {delay = true;}
3937
- const hide = () => this.toggleElement(this.$el, false, false);
4046
+ hide(delay, animate) {if (delay === void 0) {delay = true;}if (animate === void 0) {animate = true;}
4047
+ const hide = () => this.toggleElement(this.$el, false, this.animateOut && animate);
3938
4048
 
3939
4049
  this.clearTimers();
3940
4050
 
@@ -3966,32 +4076,59 @@
3966
4076
  position() {
3967
4077
  removeClass(this.$el, this.clsDrop + "-stack");
3968
4078
  toggleClass(this.$el, this.clsDrop + "-boundary", this.boundaryAlign);
4079
+ toggleClass(this.$el, this.clsDrop + "-stretch", this.align === 'stretch');
3969
4080
 
3970
4081
  const boundary = query(this.boundary, this.$el);
3971
- const [scrollParent] = scrollParents(this.$el);
3972
- const scrollParentOffset = offsetViewport(scrollParent);
4082
+ const target = boundary && this.boundaryAlign ? boundary : this.target;
4083
+ const [scrollParent] = scrollParents(
4084
+ boundary && this.boundaryAlign ? boundary : this.$el);
4085
+
4086
+ const scrollParentOffset = offset(scrollParent);
3973
4087
  const boundaryOffset = boundary ? offset(boundary) : scrollParentOffset;
4088
+ const viewportOffset = this.getViewportOffset(this.$el);
3974
4089
 
3975
4090
  css(this.$el, 'maxWidth', '');
3976
- const maxWidth =
3977
- scrollParentOffset.width - (this.boundaryAlign ? 0 : 2 * this.viewportPadding);
4091
+ const maxWidth = scrollParentOffset.width - 2 * viewportOffset;
3978
4092
 
3979
- if (this.pos[1] === 'justify') {
4093
+ if (this.align === 'justify') {
3980
4094
  const prop = this.axis === 'y' ? 'width' : 'height';
3981
- const targetOffset = offset(this.target);
3982
- const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
3983
- css(this.$el, prop, alignTo[prop]);
4095
+ css(
4096
+ this.$el,
4097
+ prop,
4098
+ Math.min(
4099
+ (boundary ? boundaryOffset : offset(this.target))[prop],
4100
+ scrollParentOffset[prop] - 2 * viewportOffset));
4101
+
4102
+
4103
+ } else if (this.align === 'stretch') {
4104
+ this.flip = this.axis === 'y' ? 'x' : 'y';
4105
+ this.display = 'static';
4106
+
4107
+ const viewport = offsetViewport(scrollParent);
4108
+ const targetDim = offset(target);
4109
+ const elOffset = Math.abs(this.getPositionOffset(this.$el)) + viewportOffset;
4110
+
4111
+ css(this.$el, {
4112
+ width:
4113
+ this.axis === 'y' ?
4114
+ viewport.width :
4115
+ (this.dir === 'left' ?
4116
+ targetDim.left - viewport.left :
4117
+ viewport.right - targetDim.right) - elOffset,
4118
+ height:
4119
+ this.axis === 'x' ?
4120
+ viewport.height :
4121
+ (this.dir === 'top' ?
4122
+ targetDim.top - viewport.top :
4123
+ viewport.bottom - targetDim.bottom) - elOffset });
4124
+
3984
4125
  } else if (this.$el.offsetWidth > maxWidth) {
3985
4126
  addClass(this.$el, this.clsDrop + "-stack");
3986
4127
  }
3987
4128
 
3988
4129
  css(this.$el, 'maxWidth', maxWidth);
3989
4130
 
3990
- this.positionAt(
3991
- this.$el,
3992
- boundary && this.boundaryAlign ? boundary : this.target,
3993
- boundary);
3994
-
4131
+ this.positionAt(this.$el, target, boundary);
3995
4132
  } } };
3996
4133
 
3997
4134
 
@@ -4458,7 +4595,7 @@
4458
4595
  }
4459
4596
 
4460
4597
  var heightViewport = {
4461
- mixins: [Class, Resize],
4598
+ mixins: [Resize],
4462
4599
 
4463
4600
  props: {
4464
4601
  expand: Boolean,
@@ -4476,7 +4613,7 @@
4476
4613
 
4477
4614
  resizeTargets() {
4478
4615
  // check for offsetTop change
4479
- return [this.$el, document.documentElement];
4616
+ return [this.$el, ...scrollParents(this.$el, /auto|scroll/)];
4480
4617
  },
4481
4618
 
4482
4619
  update: {
@@ -4488,21 +4625,25 @@
4488
4625
  let minHeight = '';
4489
4626
  const box = boxModelAdjust(this.$el, 'height', 'content-box');
4490
4627
 
4628
+ const [scrollElement] = scrollParents(this.$el, /auto|scroll/);
4629
+ const { height: viewportHeight } = offsetViewport(scrollElement);
4630
+
4491
4631
  if (this.expand) {
4492
4632
  minHeight = Math.max(
4493
- height(window) - (
4494
- dimensions$1(document.documentElement).height -
4495
- dimensions$1(this.$el).height) -
4633
+ viewportHeight - (
4634
+ dimensions$1(scrollElement).height - dimensions$1(this.$el).height) -
4496
4635
  box,
4497
4636
  0);
4498
4637
 
4499
4638
  } else {
4500
4639
  // on mobile devices (iOS and Android) window.innerHeight !== 100vh
4501
- minHeight = 'calc(100vh';
4640
+ minHeight = "calc(" + (
4641
+ document.scrollingElement === scrollElement ? '100vh' : viewportHeight + "px");
4642
+
4502
4643
 
4503
4644
  if (this.offsetTop) {
4504
- const { top } = offset(this.$el);
4505
- minHeight += top > 0 && top < height(window) / 2 ? " - " + top + "px" : '';
4645
+ const top = offsetPosition(this.$el)[0] - offsetPosition(scrollElement)[0];
4646
+ minHeight += top > 0 && top < viewportHeight / 2 ? " - " + top + "px" : '';
4506
4647
  }
4507
4648
 
4508
4649
  if (this.offsetBottom === true) {
@@ -5836,8 +5977,8 @@
5836
5977
  return this.dropbar;
5837
5978
  },
5838
5979
 
5839
- handler(_, _ref9) {let { $el } = _ref9;
5840
- if (!hasClass($el, this.clsDrop)) {
5980
+ handler(_, _ref9) {let { $el, align } = _ref9;
5981
+ if (!hasClass($el, this.clsDrop) || align === 'stretch') {
5841
5982
  return;
5842
5983
  }
5843
5984
 
@@ -5860,19 +6001,19 @@
5860
6001
  return this.dropbar;
5861
6002
  },
5862
6003
 
5863
- handler(_, _ref10) {let { $el, pos: [dir] = [] } = _ref10;
5864
- if (!hasClass($el, this.clsDrop)) {
6004
+ handler(_, _ref10) {let { $el, align } = _ref10;
6005
+ if (!hasClass($el, this.clsDrop) || align === 'stretch') {
5865
6006
  return;
5866
6007
  }
5867
6008
 
5868
- if (dir === 'bottom') {
5869
- this.transitionTo(
5870
- offset($el).bottom -
5871
- offset(this.dropbar).top +
5872
- toFloat(css($el, 'marginBottom')),
5873
- $el);
6009
+ this._observer = observeResize($el, () =>
6010
+ this.transitionTo(
6011
+ offset($el).bottom -
6012
+ offset(this.dropbar).top +
6013
+ toFloat(css($el, 'marginBottom')),
6014
+ $el));
6015
+
5874
6016
 
5875
- }
5876
6017
  } },
5877
6018
 
5878
6019
 
@@ -5911,11 +6052,13 @@
5911
6052
  return this.dropbar;
5912
6053
  },
5913
6054
 
5914
- handler(_, _ref12) {let { $el } = _ref12;
5915
- if (!hasClass($el, this.clsDrop)) {
6055
+ handler(_, _ref12) {let { $el, align } = _ref12;
6056
+ if (!hasClass($el, this.clsDrop) || align === 'stretch') {
5916
6057
  return;
5917
6058
  }
5918
6059
 
6060
+ this._observer.disconnect();
6061
+
5919
6062
  const active = this.getActive();
5920
6063
 
5921
6064
  if (!active || (active == null ? void 0 : active.$el) === $el) {
@@ -5932,28 +6075,27 @@
5932
6075
 
5933
6076
  transitionTo(newHeight, el) {
5934
6077
  const { dropbar } = this;
5935
- const oldHeight = isVisible(dropbar) ? height(dropbar) : 0;
6078
+ const oldHeight = height(dropbar);
5936
6079
 
5937
6080
  el = oldHeight < newHeight && el;
5938
6081
 
5939
- css(el, 'clip', "rect(0," + el.offsetWidth + "px," + oldHeight + "px,0)");
6082
+ css(el, 'clipPath', "polygon(0 0,100% 0,100% " + oldHeight + "px,0 " + oldHeight + "px)");
5940
6083
 
5941
6084
  height(dropbar, oldHeight);
5942
6085
 
5943
6086
  Transition.cancel([el, dropbar]);
5944
- return Promise.all([
6087
+ Promise.all([
5945
6088
  Transition.start(dropbar, { height: newHeight }, this.duration),
5946
6089
  Transition.start(
5947
6090
  el,
5948
- { clip: "rect(0," + el.offsetWidth + "px," + newHeight + "px,0)" },
6091
+ {
6092
+ clipPath: "polygon(0 0,100% 0,100% " + newHeight + "px,0 " + newHeight + "px)" },
6093
+
5949
6094
  this.duration)]).
5950
6095
 
5951
6096
 
5952
6097
  catch(noop).
5953
- then(() => {
5954
- css(el, { clip: '' });
5955
- this.$update(dropbar);
5956
- });
6098
+ then(() => css(el, { clipPath: '' }));
5957
6099
  },
5958
6100
 
5959
6101
  getDropdown(el) {
@@ -6519,6 +6661,10 @@
6519
6661
  toggle(el, inview) {
6520
6662
  const state = this._data.elements.get(el);
6521
6663
 
6664
+ if (!state) {
6665
+ return;
6666
+ }
6667
+
6522
6668
  state.off == null ? void 0 : state.off();
6523
6669
 
6524
6670
  css(el, 'visibility', !inview && this.hidden ? 'hidden' : '');
@@ -7254,6 +7400,8 @@
7254
7400
  },
7255
7401
 
7256
7402
  handler(e) {
7403
+ this._preventClick = null;
7404
+
7257
7405
  if (!isTouch(e) || this._showState) {
7258
7406
  return;
7259
7407
  }
@@ -7333,9 +7481,14 @@
7333
7481
  {
7334
7482
  name: 'click',
7335
7483
 
7484
+ filter() {
7485
+ return ['click', 'hover'].some((mode) => includes(this.mode, mode));
7486
+ },
7487
+
7336
7488
  handler(e) {
7337
7489
  let link;
7338
7490
  if (
7491
+ this._preventClick ||
7339
7492
  closest(e.target, 'a[href="#"], a[href=""]') ||
7340
7493
  (link = closest(e.target, 'a[href]')) && (
7341
7494
  attr(this.$el, 'aria-expanded') !== 'true' ||
@@ -7344,15 +7497,9 @@
7344
7497
  e.preventDefault();
7345
7498
  }
7346
7499
 
7347
- if (this._preventClick) {
7348
- return this._preventClick = null;
7349
- }
7350
-
7351
- if (!includes(this.mode, 'click')) {
7352
- return;
7500
+ if (!this._preventClick && includes(this.mode, 'click')) {
7501
+ this.toggle();
7353
7502
  }
7354
-
7355
- this.toggle();
7356
7503
  } },
7357
7504
 
7358
7505
 
@@ -9340,12 +9487,17 @@
9340
9487
 
9341
9488
  computed: {
9342
9489
  props(properties, $el) {
9343
- return keys(props).reduce((result, prop) => {
9344
- if (!isUndefined(properties[prop])) {
9345
- result[prop] = props[prop](prop, $el, properties[prop].slice());
9490
+ const stops = {};
9491
+ for (const prop in properties) {
9492
+ if (prop in props && !isUndefined(properties[prop])) {
9493
+ stops[prop] = properties[prop].slice();
9346
9494
  }
9347
- return result;
9348
- }, {});
9495
+ }
9496
+ const result = {};
9497
+ for (const prop in stops) {
9498
+ result[prop] = props[prop](prop, $el, stops[prop], stops);
9499
+ }
9500
+ return result;
9349
9501
  } },
9350
9502
 
9351
9503
 
@@ -9474,58 +9626,66 @@
9474
9626
  };
9475
9627
  }
9476
9628
 
9477
- function backgroundFn(prop, el, stops) {
9629
+ function backgroundFn(prop, el, stops, props) {
9478
9630
  if (stops.length === 1) {
9479
9631
  stops.unshift(0);
9480
9632
  }
9481
9633
 
9482
- prop = prop.substr(-1);
9483
- const attr = prop === 'y' ? 'height' : 'width';
9484
- stops = parseStops(stops, (stop) => toPx(stop, attr, el));
9634
+ const attr = prop === 'bgy' ? 'height' : 'width';
9635
+ props[prop] = parseStops(stops, (stop) => toPx(stop, attr, el));
9485
9636
 
9486
- const bgPos = getCssValue(el, "background-position-" + prop, '');
9637
+ const bgProps = ['bgx', 'bgy'].filter((prop) => prop in props);
9638
+ if (bgProps.length === 2 && prop === 'bgx') {
9639
+ return noop;
9640
+ }
9641
+
9642
+ if (getCssValue(el, 'backgroundSize', '') === 'cover') {
9643
+ return backgroundCoverFn(prop, el, stops, props);
9644
+ }
9487
9645
 
9488
- return getCssValue(el, 'backgroundSize', '') === 'cover' ?
9489
- backgroundCoverFn(prop, el, stops, bgPos, attr) :
9490
- setBackgroundPosFn(prop, stops, bgPos);
9646
+ const positions = {};
9647
+ for (const prop of bgProps) {
9648
+ positions[prop] = getBackgroundPos(el, prop);
9649
+ }
9650
+
9651
+ return setBackgroundPosFn(bgProps, props, positions);
9491
9652
  }
9492
9653
 
9493
- function backgroundCoverFn(prop, el, stops, bgPos, attr) {
9654
+ function backgroundCoverFn(prop, el, stops, props) {
9494
9655
  const dimImage = getBackgroundImageDimensions(el);
9495
9656
 
9496
9657
  if (!dimImage.width) {
9497
9658
  return noop;
9498
9659
  }
9499
9660
 
9500
- const values = stops.map((_ref2) => {let [value] = _ref2;return value;});
9501
- const min = Math.min(...values);
9502
- const max = Math.max(...values);
9503
- const down = values.indexOf(min) < values.indexOf(max);
9504
-
9505
- const diff = max - min;
9506
- let pos = (down ? -diff : 0) - (down ? min : max);
9507
-
9508
9661
  const dimEl = {
9509
9662
  width: el.offsetWidth,
9510
9663
  height: el.offsetHeight };
9511
9664
 
9512
9665
 
9513
- const baseDim = Dimensions.cover(dimImage, dimEl);
9514
- const span = baseDim[attr] - dimEl[attr];
9666
+ const bgProps = ['bgx', 'bgy'].filter((prop) => prop in props);
9515
9667
 
9516
- if (span < diff) {
9517
- dimEl[attr] = baseDim[attr] + diff - span;
9518
- } else if (span > diff) {
9519
- const posPercentage = dimEl[attr] / toPx(bgPos, attr, el, true);
9668
+ const positions = {};
9669
+ for (const prop of bgProps) {
9670
+ const values = props[prop].map((_ref2) => {let [value] = _ref2;return value;});
9671
+ const min = Math.min(...values);
9672
+ const max = Math.max(...values);
9673
+ const down = values.indexOf(min) < values.indexOf(max);
9674
+ const diff = max - min;
9520
9675
 
9521
- if (posPercentage) {
9522
- pos -= (span - diff) / posPercentage;
9523
- }
9676
+ positions[prop] = (down ? -diff : 0) - (down ? min : max) + "px";
9677
+ dimEl[prop === 'bgy' ? 'height' : 'width'] += diff;
9524
9678
  }
9525
9679
 
9526
9680
  const dim = Dimensions.cover(dimImage, dimEl);
9527
9681
 
9528
- const fn = setBackgroundPosFn(prop, stops, pos + "px");
9682
+ for (const prop of bgProps) {
9683
+ const attr = prop === 'bgy' ? 'height' : 'width';
9684
+ const overflow = dim[attr] - dimEl[attr];
9685
+ positions[prop] = "max(" + getBackgroundPos(el, prop) + ",-" + overflow + "px) + " + positions[prop];
9686
+ }
9687
+
9688
+ const fn = setBackgroundPosFn(bgProps, positions, props);
9529
9689
  return (css, percent) => {
9530
9690
  fn(css, percent);
9531
9691
  css.backgroundSize = dim.width + "px " + dim.height + "px";
@@ -9533,9 +9693,16 @@
9533
9693
  };
9534
9694
  }
9535
9695
 
9536
- function setBackgroundPosFn(prop, stops, pos) {
9696
+ function getBackgroundPos(el, prop) {
9697
+ return getCssValue(el, "background-position-" + prop.substr(-1), '');
9698
+ }
9699
+
9700
+ function setBackgroundPosFn(bgProps, positions, props) {
9537
9701
  return function (css, percent) {
9538
- css["background-position-" + prop] = "calc(" + pos + " + " + getValue(stops, percent) + "px)";
9702
+ for (const prop of bgProps) {
9703
+ const value = getValue(props[prop], percent);
9704
+ css["background-position-" + prop.substr(-1)] = "calc(" + positions[prop] + " + " + value + "px)";
9705
+ }
9539
9706
  };
9540
9707
  }
9541
9708
 
@@ -9721,8 +9888,23 @@
9721
9888
 
9722
9889
 
9723
9890
 
9891
+ /*
9892
+ * Inspired by https://gist.github.com/gre/1650294?permalink_comment_id=3477425#gistcomment-3477425
9893
+ *
9894
+ * linear: 0
9895
+ * easeInSine: 0.5
9896
+ * easeOutSine: -0.5
9897
+ * easeInQuad: 1
9898
+ * easeOutQuad: -1
9899
+ * easeInCubic: 2
9900
+ * easeOutCubic: -2
9901
+ * easeInQuart: 3
9902
+ * easeOutQuart: -3
9903
+ * easeInQuint: 4
9904
+ * easeOutQuint: -4
9905
+ */
9724
9906
  function ease(percent, easing) {
9725
- return easing >= 0 ? Math.pow(percent, easing + 1) : 1 - Math.pow(1 - percent, -easing + 1);
9907
+ return easing >= 0 ? Math.pow(percent, easing + 1) : 1 - Math.pow(1 - percent, 1 - easing);
9726
9908
  }
9727
9909
 
9728
9910
  // SVG elements do not inherit from HTMLElement