uikit 3.14.3 → 3.14.4-dev.0097ef093

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 (88) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/css/uikit-core-rtl.css +100 -31
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +100 -31
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +103 -46
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +103 -46
  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 +189 -26
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +189 -26
  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 +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +1 -1
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  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 +135 -34
  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 +801 -617
  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 +801 -617
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/core/accordion.js +3 -3
  44. package/src/js/core/alert.js +1 -1
  45. package/src/js/core/drop.js +47 -20
  46. package/src/js/core/height-viewport.js +14 -9
  47. package/src/js/core/navbar.js +11 -9
  48. package/src/js/core/offcanvas.js +1 -47
  49. package/src/js/core/switcher.js +1 -1
  50. package/src/js/mixin/modal.js +90 -4
  51. package/src/js/mixin/position.js +44 -13
  52. package/src/js/mixin/togglable.js +105 -24
  53. package/src/js/util/animation.js +1 -0
  54. package/src/js/util/viewport.js +21 -10
  55. package/src/less/components/drop.less +19 -5
  56. package/src/less/components/dropdown.less +21 -5
  57. package/src/less/components/margin.less +13 -14
  58. package/src/less/components/modal.less +19 -4
  59. package/src/less/components/nav.less +23 -5
  60. package/src/less/components/navbar.less +56 -25
  61. package/src/less/components/offcanvas.less +21 -21
  62. package/src/less/components/position.less +1 -1
  63. package/src/less/components/utility.less +0 -1
  64. package/src/less/theme/dropdown.less +11 -0
  65. package/src/less/theme/nav.less +3 -7
  66. package/src/less/theme/navbar.less +12 -12
  67. package/src/scss/components/drop.scss +19 -5
  68. package/src/scss/components/dropdown.scss +21 -5
  69. package/src/scss/components/margin.scss +13 -14
  70. package/src/scss/components/modal.scss +19 -4
  71. package/src/scss/components/nav.scss +23 -5
  72. package/src/scss/components/navbar.scss +45 -14
  73. package/src/scss/components/offcanvas.scss +21 -21
  74. package/src/scss/components/position.scss +1 -1
  75. package/src/scss/components/utility.scss +0 -1
  76. package/src/scss/mixins-theme.scss +9 -13
  77. package/src/scss/mixins.scss +2 -0
  78. package/src/scss/theme/dropdown.scss +8 -0
  79. package/src/scss/theme/nav.scss +3 -7
  80. package/src/scss/theme/navbar.scss +9 -0
  81. package/src/scss/variables-theme.scss +35 -14
  82. package/src/scss/variables.scss +33 -13
  83. package/tests/drop.html +151 -2
  84. package/tests/dropdown.html +228 -13
  85. package/tests/height-viewport.html +62 -0
  86. package/tests/navbar.html +325 -18
  87. package/tests/offcanvas.html +8 -8
  88. package/tests/sticky-navbar.html +132 -0
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.14.3 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.14.4-dev.0097ef093 | 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) =>
@@ -1887,7 +1888,7 @@
1887
1888
  return clamp((scrollTop - start) / (end - start));
1888
1889
  }
1889
1890
 
1890
- 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;}
1891
1892
  const scrollEl = scrollingElement(element);
1892
1893
 
1893
1894
  let ancestors = parents(element).reverse();
@@ -1910,18 +1911,33 @@
1910
1911
  }
1911
1912
 
1912
1913
  function offsetViewport(scrollElement) {
1913
- let viewportElement = getViewport$1(scrollElement);
1914
+ const window = toWindow(scrollElement);
1915
+ const {
1916
+ document: { body, documentElement } } =
1917
+ window;
1918
+ let viewportElement =
1919
+ scrollElement === scrollingElement(scrollElement) || scrollElement === body ?
1920
+ window :
1921
+ scrollElement;
1922
+
1923
+ const { visualViewport } = window;
1924
+ if (isWindow(viewportElement) && visualViewport) {
1925
+ let { height, width, scale, pageTop: top, pageLeft: left } = visualViewport;
1926
+ height = Math.round(height * scale);
1927
+ width = Math.round(width * scale);
1928
+ return { height, width, top, left, bottom: top + height, right: left + width };
1929
+ }
1914
1930
 
1915
1931
  let rect = offset(viewportElement);
1916
1932
  for (let [prop, dir, start, end] of [
1917
1933
  ['width', 'x', 'left', 'right'],
1918
1934
  ['height', 'y', 'top', 'bottom']])
1919
1935
  {
1920
- if (!isWindow(viewportElement)) {
1921
- rect[start] += toFloat(css(viewportElement, "border" + ucfirst(start) + "Width"));
1922
- } else {
1936
+ if (isWindow(viewportElement)) {
1923
1937
  // iOS 12 returns <body> as scrollingElement
1924
- viewportElement = viewportElement.document.documentElement;
1938
+ viewportElement = documentElement;
1939
+ } else {
1940
+ rect[start] += toFloat(css(viewportElement, "border" + ucfirst(start) + "Width"));
1925
1941
  }
1926
1942
  rect[prop] = rect[dir] = viewportElement["client" + ucfirst(prop)];
1927
1943
  rect[end] = rect[prop] + rect[start];
@@ -1933,10 +1949,6 @@
1933
1949
  return toWindow(element).document.scrollingElement;
1934
1950
  }
1935
1951
 
1936
- function getViewport$1(scrollElement) {
1937
- return scrollElement === scrollingElement(scrollElement) ? window : scrollElement;
1938
- }
1939
-
1940
1952
  const dirs = [
1941
1953
  ['width', 'x', 'left', 'right'],
1942
1954
  ['height', 'y', 'top', 'bottom']];
@@ -2949,7 +2961,7 @@
2949
2961
  UIkit.data = '__uikit__';
2950
2962
  UIkit.prefix = 'uk-';
2951
2963
  UIkit.options = {};
2952
- UIkit.version = '3.14.3';
2964
+ UIkit.version = '3.14.4-dev.0097ef093';
2953
2965
 
2954
2966
  globalAPI(UIkit);
2955
2967
  hooksAPI(UIkit);
@@ -3058,7 +3070,7 @@
3058
3070
 
3059
3071
  initProps: {
3060
3072
  overflow: '',
3061
- height: '',
3073
+ maxHeight: '',
3062
3074
  paddingTop: '',
3063
3075
  paddingBottom: '',
3064
3076
  marginTop: '',
@@ -3068,7 +3080,7 @@
3068
3080
 
3069
3081
  hideProps: {
3070
3082
  overflow: 'hidden',
3071
- height: 0,
3083
+ maxHeight: 0,
3072
3084
  paddingTop: 0,
3073
3085
  paddingBottom: 0,
3074
3086
  marginTop: 0,
@@ -3083,7 +3095,7 @@
3083
3095
  },
3084
3096
 
3085
3097
  hasTransition(_ref2) {let { animation } = _ref2;
3086
- return this.hasAnimation && animation[0] === true;
3098
+ return startsWith(animation[0], 'slide');
3087
3099
  } },
3088
3100
 
3089
3101
 
@@ -3098,18 +3110,13 @@
3098
3110
  return Promise.reject();
3099
3111
  }
3100
3112
 
3101
- if (!animate) {
3102
- Animation.cancel(el);
3103
- Transition.cancel(el);
3104
- }
3105
-
3106
3113
  const promise = (
3107
3114
  isFunction(animate) ?
3108
3115
  animate :
3109
3116
  animate === false || !this.hasAnimation ?
3110
- this._toggle :
3117
+ toggleInstant(this) :
3111
3118
  this.hasTransition ?
3112
- toggleHeight(this) :
3119
+ toggleTransition(this) :
3113
3120
  toggleAnimation(this))(
3114
3121
  el, show);
3115
3122
 
@@ -3173,7 +3180,25 @@
3173
3180
 
3174
3181
 
3175
3182
 
3176
- function toggleHeight(_ref3)
3183
+ function toggleInstant(_ref3) {let { _toggle } = _ref3;
3184
+ return (el, show) => {
3185
+ Animation.cancel(el);
3186
+ Transition.cancel(el);
3187
+ return _toggle(el, show);
3188
+ };
3189
+ }
3190
+
3191
+ function toggleTransition(cmp) {
3192
+ switch (cmp.animation[0]) {
3193
+ case 'slide-left':
3194
+ return slideHorizontal(cmp);
3195
+ case 'slide-right':
3196
+ return slideHorizontal(cmp, true);}
3197
+
3198
+ return slide(cmp);
3199
+ }
3200
+
3201
+ function slide(_ref4)
3177
3202
 
3178
3203
 
3179
3204
 
@@ -3181,14 +3206,17 @@
3181
3206
 
3182
3207
 
3183
3208
 
3184
- {let { isToggled, duration, velocity, initProps, hideProps, transition, _toggle } = _ref3;
3209
+ {let { isToggled, duration, velocity, initProps, hideProps, transition, _toggle } = _ref4;
3185
3210
  return (el, show) => {
3186
3211
  const inProgress = Transition.inProgress(el);
3187
- const inner = el.hasChildNodes() ?
3212
+ const inner =
3213
+ !inProgress && el.hasChildNodes() ?
3188
3214
  toFloat(css(el.firstElementChild, 'marginTop')) +
3189
3215
  toFloat(css(el.lastElementChild, 'marginBottom')) :
3190
3216
  0;
3191
- const currentHeight = isVisible(el) ? height(el) + (inProgress ? 0 : inner) : 0;
3217
+ const currentHeight = isVisible(el) ? toFloat(css(el, 'height')) + inner : 0;
3218
+
3219
+ const props = inProgress ? css(el, Object.keys(initProps)) : show ? hideProps : initProps;
3192
3220
 
3193
3221
  Transition.cancel(el);
3194
3222
 
@@ -3196,34 +3224,97 @@
3196
3224
  _toggle(el, true);
3197
3225
  }
3198
3226
 
3199
- height(el, '');
3227
+ css(el, 'maxHeight', '');
3200
3228
 
3201
3229
  // Update child components first
3202
3230
  fastdom.flush();
3203
3231
 
3204
- const endHeight = height(el) + (inProgress ? 0 : inner);
3205
- duration = velocity * el.offsetHeight + duration;
3232
+ const endHeight = toFloat(css(el, 'height')) + inner;
3233
+ duration = velocity * endHeight + duration;
3206
3234
 
3207
- height(el, currentHeight);
3235
+ css(el, { ...props, maxHeight: currentHeight });
3208
3236
 
3209
3237
  return (
3210
3238
  show ?
3211
3239
  Transition.start(
3212
3240
  el,
3213
- { ...initProps, overflow: 'hidden', height: endHeight },
3214
- Math.round(duration * (1 - currentHeight / endHeight)),
3241
+ { ...initProps, overflow: 'hidden', maxHeight: endHeight },
3242
+ duration * (1 - currentHeight / endHeight),
3215
3243
  transition) :
3216
3244
 
3217
3245
  Transition.start(
3218
3246
  el,
3219
3247
  hideProps,
3220
- Math.round(duration * (currentHeight / endHeight)),
3248
+ duration * (currentHeight / endHeight),
3221
3249
  transition).
3222
3250
  then(() => _toggle(el, false))).
3223
3251
  then(() => css(el, initProps));
3224
3252
  };
3225
3253
  }
3226
3254
 
3255
+ function slideHorizontal(_ref5, right) {let { isToggled, duration, velocity, transition, _toggle } = _ref5;
3256
+ return (el, show) => {
3257
+ const visible = isVisible(el);
3258
+ const marginLeft = toFloat(css(el, 'marginLeft'));
3259
+
3260
+ Transition.cancel(el);
3261
+
3262
+ const [scrollElement] = scrollParents(el);
3263
+ css(scrollElement, 'overflowX', 'hidden');
3264
+
3265
+ if (!isToggled(el)) {
3266
+ _toggle(el, true);
3267
+ }
3268
+
3269
+ const width = toFloat(css(el, 'width'));
3270
+ duration = velocity * width + duration;
3271
+
3272
+ const percent = visible ? (width + marginLeft * (right ? -1 : 1)) / width * 100 : 0;
3273
+ const offsetEl = offset(el);
3274
+ const useClipPath = right ?
3275
+ offsetEl.right < scrollElement.clientWidth :
3276
+ Math.round(offsetEl.left) > 0;
3277
+
3278
+ css(el, {
3279
+ clipPath: useClipPath ?
3280
+ right ? "polygon(0 0," +
3281
+ percent + "% 0," + percent + "% 100%,0 100%)" : "polygon(" + (
3282
+ 100 - percent) + "% 0,100% 0,100% 100%," + (100 - percent) + "% 100%)" :
3283
+ '',
3284
+ marginLeft: (100 - percent) * (right ? 1 : -1) / 100 * width });
3285
+
3286
+
3287
+ return (
3288
+ show ?
3289
+ Transition.start(
3290
+ el,
3291
+ {
3292
+ clipPath: useClipPath ? "polygon(0 0,100% 0,100% 100%,0 100%)" : '',
3293
+ marginLeft: 0 },
3294
+
3295
+ duration * (1 - percent / 100),
3296
+ transition) :
3297
+
3298
+ Transition.start(
3299
+ el,
3300
+ {
3301
+ clipPath: useClipPath ?
3302
+ right ? "polygon(0 0,0 0,0 100%,0 100%)" : "polygon(100% 0,100% 0,100% 100%,100% 100%)" :
3303
+
3304
+
3305
+ '',
3306
+ marginLeft: (right ? 1 : -1) * width },
3307
+
3308
+ duration * (percent / 100),
3309
+ transition).
3310
+ then(() => _toggle(el, false))).
3311
+ then(() => {
3312
+ css(scrollElement, 'overflowX', '');
3313
+ css(el, { clipPath: '', marginLeft: '' });
3314
+ });
3315
+ };
3316
+ }
3317
+
3227
3318
  function toggleAnimation(cmp) {
3228
3319
  return (el, show) => {
3229
3320
  Animation.cancel(el);
@@ -3257,7 +3348,7 @@
3257
3348
  data: {
3258
3349
  targets: '> *',
3259
3350
  active: false,
3260
- animation: [true],
3351
+ animation: ['slide'],
3261
3352
  collapsible: true,
3262
3353
  multiple: false,
3263
3354
  clsOpen: 'uk-open',
@@ -3367,7 +3458,7 @@
3367
3458
  }
3368
3459
 
3369
3460
  hide(content, false);
3370
- await toggleHeight(this)(el._wrapper, show);
3461
+ await slide(this)(el._wrapper, show);
3371
3462
  hide(content, !show);
3372
3463
 
3373
3464
  delete el._wrapper;
@@ -3401,7 +3492,7 @@
3401
3492
 
3402
3493
 
3403
3494
  data: {
3404
- animation: [true],
3495
+ animation: ['slide'],
3405
3496
  selClose: '.uk-alert-close',
3406
3497
  duration: 150,
3407
3498
  hideProps: { opacity: 0, ...Togglable.data.hideProps } },
@@ -3587,23 +3678,17 @@
3587
3678
 
3588
3679
  connected() {
3589
3680
  this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
3590
- this.axis = includes(['top', 'bottom'], this.pos[0]) ? 'y' : 'x';
3681
+ [this.dir, this.align] = this.pos;
3682
+ this.axis = includes(['top', 'bottom'], this.dir) ? 'y' : 'x';
3591
3683
  },
3592
3684
 
3593
3685
  methods: {
3594
3686
  positionAt(element, target, boundary) {
3595
- const [dir, align] = this.pos;
3596
-
3597
- let offset = toPx(
3598
- this.offset === false ? getCssVar('position-offset', element) : this.offset,
3599
- this.axis === 'x' ? 'width' : 'height',
3600
- element);
3601
-
3602
- offset = [includes(['left', 'top'], dir) ? -offset : +offset, 0];
3687
+ let offset = [this.getPositionOffset(element), this.getShiftOffset(element)];
3603
3688
 
3604
3689
  const attach = {
3605
- element: [flipPosition(dir), align],
3606
- target: [dir, align] };
3690
+ element: [flipPosition(this.dir), this.align],
3691
+ target: [this.dir, this.align] };
3607
3692
 
3608
3693
 
3609
3694
  if (this.axis === 'y') {
@@ -3613,71 +3698,81 @@
3613
3698
  offset = offset.reverse();
3614
3699
  }
3615
3700
 
3701
+ // Ensure none positioned element does not generate scrollbars
3702
+ const elDim = dimensions(element);
3703
+ css(element, { top: -elDim.height, left: -elDim.width });
3704
+
3616
3705
  positionAt(element, target, {
3617
3706
  attach,
3618
3707
  offset,
3619
3708
  boundary,
3620
3709
  flip: this.flip,
3621
- viewportOffset: toPx(getCssVar('position-viewport-offset', element)) });
3710
+ viewportOffset: this.getViewportOffset(element) });
3622
3711
 
3623
- } } };
3712
+ },
3624
3713
 
3625
- let active$1;
3714
+ getPositionOffset(element) {
3715
+ return (
3716
+ toPx(
3717
+ this.offset === false ? getCssVar('position-offset', element) : this.offset,
3718
+ this.axis === 'x' ? 'width' : 'height',
3719
+ element) * (
3720
+ includes(['left', 'top'], this.dir) ? -1 : 1));
3626
3721
 
3627
- var drop = {
3628
- mixins: [Container, Lazyload, Position, Togglable],
3722
+ },
3629
3723
 
3630
- args: 'pos',
3724
+ getShiftOffset(element) {
3725
+ return includes(['center', 'justify', 'stretch'], this.align) ?
3726
+ 0 :
3727
+ toPx(
3728
+ getCssVar('position-shift-offset', element),
3729
+ this.axis === 'y' ? 'width' : 'height',
3730
+ element) * (
3731
+ includes(['left', 'top'], this.align) ? 1 : -1);
3732
+ },
3733
+
3734
+ getViewportOffset(element) {
3735
+ return toPx(getCssVar('position-viewport-offset', element));
3736
+ } } };
3737
+
3738
+ const active$1 = [];
3739
+
3740
+ var Modal = {
3741
+ mixins: [Class, Container, Togglable],
3631
3742
 
3632
3743
  props: {
3633
- mode: 'list',
3634
- toggle: Boolean,
3635
- boundary: Boolean,
3636
- boundaryAlign: Boolean,
3637
- delayShow: Number,
3638
- delayHide: Number,
3639
- display: String,
3640
- clsDrop: String },
3744
+ selPanel: String,
3745
+ selClose: String,
3746
+ escClose: Boolean,
3747
+ bgClose: Boolean,
3748
+ stack: Boolean },
3641
3749
 
3642
3750
 
3643
3751
  data: {
3644
- mode: ['click', 'hover'],
3645
- toggle: '- *',
3646
- boundary: true,
3647
- boundaryAlign: false,
3648
- delayShow: 0,
3649
- delayHide: 800,
3650
- display: null,
3651
- clsDrop: false,
3652
- animation: ['uk-animation-fade'],
3653
3752
  cls: 'uk-open',
3654
- container: false },
3753
+ escClose: true,
3754
+ bgClose: true,
3755
+ overlay: true,
3756
+ stack: false },
3655
3757
 
3656
3758
 
3657
- created() {
3658
- this.tracker = new MouseTracker();
3659
- },
3759
+ computed: {
3760
+ panel(_ref, $el) {let { selPanel } = _ref;
3761
+ return $(selPanel, $el);
3762
+ },
3660
3763
 
3661
- beforeConnect() {
3662
- this.clsDrop = this.$props.clsDrop || "uk-" + this.$options.name;
3663
- },
3764
+ transitionElement() {
3765
+ return this.panel;
3766
+ },
3664
3767
 
3665
- connected() {
3666
- addClass(this.$el, this.clsDrop);
3768
+ bgClose(_ref2) {let { bgClose } = _ref2;
3769
+ return bgClose && this.panel;
3770
+ } },
3667
3771
 
3668
- if (this.toggle && !this.target) {
3669
- this.target = this.$create('toggle', query(this.toggle, this.$el), {
3670
- target: this.$el,
3671
- mode: this.mode }).
3672
- $el;
3673
- attr(this.target, 'aria-haspopup', true);
3674
- this.lazyload(this.target);
3675
- }
3676
- },
3677
3772
 
3678
- disconnected() {
3679
- if (this.isActive()) {
3680
- active$1 = null;
3773
+ beforeDisconnect() {
3774
+ if (includes(active$1, this)) {
3775
+ this.toggleElement(this.$el, false, false);
3681
3776
  }
3682
3777
  },
3683
3778
 
@@ -3686,127 +3781,484 @@
3686
3781
  name: 'click',
3687
3782
 
3688
3783
  delegate() {
3689
- return "." + this.clsDrop + "-close";
3784
+ return this.selClose;
3690
3785
  },
3691
3786
 
3692
3787
  handler(e) {
3693
3788
  e.preventDefault();
3694
- this.hide(false);
3789
+ this.hide();
3695
3790
  } },
3696
3791
 
3697
3792
 
3698
3793
  {
3699
- name: 'click',
3794
+ name: 'toggle',
3700
3795
 
3701
- delegate() {
3702
- return 'a[href^="#"]';
3703
- },
3796
+ self: true,
3704
3797
 
3705
- handler(_ref) {let { defaultPrevented, current: { hash } } = _ref;
3706
- if (!defaultPrevented && hash && !within(hash, this.$el)) {
3707
- this.hide(false);
3798
+ handler(e) {
3799
+ if (e.defaultPrevented) {
3800
+ return;
3708
3801
  }
3709
- } },
3710
3802
 
3803
+ e.preventDefault();
3711
3804
 
3712
- {
3713
- name: 'beforescroll',
3714
-
3715
- handler() {
3716
- this.hide(false);
3805
+ if (this.isToggled() === includes(active$1, this)) {
3806
+ this.toggle();
3807
+ }
3717
3808
  } },
3718
3809
 
3719
3810
 
3720
3811
  {
3721
- name: 'toggle',
3812
+ name: 'beforeshow',
3722
3813
 
3723
3814
  self: true,
3724
3815
 
3725
- handler(e, toggle) {
3726
- e.preventDefault();
3816
+ handler(e) {
3817
+ if (includes(active$1, this)) {
3818
+ return false;
3819
+ }
3727
3820
 
3728
- if (this.isToggled()) {
3729
- this.hide(false);
3821
+ if (!this.stack && active$1.length) {
3822
+ Promise.all(active$1.map((modal) => modal.hide())).then(this.show);
3823
+ e.preventDefault();
3730
3824
  } else {
3731
- this.show(toggle == null ? void 0 : toggle.$el, false);
3825
+ active$1.push(this);
3732
3826
  }
3733
3827
  } },
3734
3828
 
3735
3829
 
3736
3830
  {
3737
- name: 'toggleshow',
3831
+ name: 'show',
3738
3832
 
3739
3833
  self: true,
3740
3834
 
3741
- handler(e, toggle) {
3742
- e.preventDefault();
3743
- this.show(toggle == null ? void 0 : toggle.$el);
3744
- } },
3745
-
3746
-
3747
- {
3748
- name: 'togglehide',
3835
+ handler() {
3836
+ once(
3837
+ this.$el,
3838
+ 'hide',
3839
+ on(document, 'focusin', (e) => {
3840
+ if (last(active$1) === this && !within(e.target, this.$el)) {
3841
+ this.$el.focus();
3842
+ }
3843
+ }));
3749
3844
 
3750
- self: true,
3751
3845
 
3752
- handler(e) {
3753
- e.preventDefault();
3754
- if (!matches(this.$el, ':focus,:hover')) {
3755
- this.hide();
3846
+ if (this.overlay) {
3847
+ once(this.$el, 'hide', preventOverscroll(this.$el));
3848
+ once(this.$el, 'hide', preventBackgroundScroll());
3756
3849
  }
3757
- } },
3758
3850
 
3851
+ if (this.stack) {
3852
+ css(this.$el, 'zIndex', toFloat(css(this.$el, 'zIndex')) + active$1.length);
3853
+ }
3759
3854
 
3760
- {
3761
- name: pointerEnter + " focusin",
3855
+ addClass(document.documentElement, this.clsPage);
3762
3856
 
3763
- filter() {
3764
- return includes(this.mode, 'hover');
3765
- },
3857
+ if (this.bgClose) {
3858
+ once(
3859
+ this.$el,
3860
+ 'hide',
3861
+ on(document, pointerDown, (_ref3) => {let { target } = _ref3;
3862
+ if (
3863
+ last(active$1) !== this ||
3864
+ this.overlay && !within(target, this.$el) ||
3865
+ within(target, this.panel))
3866
+ {
3867
+ return;
3868
+ }
3766
3869
 
3767
- handler(e) {
3768
- if (!isTouch(e)) {
3769
- this.clearTimers();
3770
- }
3771
- } },
3870
+ once(
3871
+ document,
3872
+ pointerUp + " " + pointerCancel + " scroll",
3873
+ (_ref4) => {let { defaultPrevented, type, target: newTarget } = _ref4;
3874
+ if (
3875
+ !defaultPrevented &&
3876
+ type === pointerUp &&
3877
+ target === newTarget)
3878
+ {
3879
+ this.hide();
3880
+ }
3881
+ },
3882
+ true);
3772
3883
 
3884
+ }),
3885
+ { self: true });
3773
3886
 
3774
- {
3775
- name: pointerLeave + " focusout",
3887
+ }
3776
3888
 
3777
- filter() {
3778
- return includes(this.mode, 'hover');
3779
- },
3889
+ if (this.escClose) {
3890
+ once(
3891
+ this.$el,
3892
+ 'hide',
3893
+ on(document, 'keydown', (e) => {
3894
+ if (e.keyCode === 27 && last(active$1) === this) {
3895
+ this.hide();
3896
+ }
3897
+ }),
3898
+ { self: true });
3780
3899
 
3781
- handler(e) {
3782
- if (!isTouch(e) && e.relatedTarget) {
3783
- this.hide();
3784
3900
  }
3785
3901
  } },
3786
3902
 
3787
3903
 
3788
3904
  {
3789
- name: 'toggled',
3905
+ name: 'shown',
3790
3906
 
3791
3907
  self: true,
3792
3908
 
3793
- handler(e, toggled) {
3794
- if (!toggled) {
3795
- return;
3909
+ handler() {
3910
+ if (!isFocusable(this.$el)) {
3911
+ attr(this.$el, 'tabindex', '-1');
3796
3912
  }
3797
3913
 
3798
- this.clearTimers();
3799
- this.position();
3914
+ if (!$(':focus', this.$el)) {
3915
+ this.$el.focus();
3916
+ }
3800
3917
  } },
3801
3918
 
3802
3919
 
3803
3920
  {
3804
- name: 'show',
3921
+ name: 'hidden',
3805
3922
 
3806
3923
  self: true,
3807
3924
 
3808
3925
  handler() {
3809
- active$1 = this;
3926
+ if (includes(active$1, this)) {
3927
+ active$1.splice(active$1.indexOf(this), 1);
3928
+ }
3929
+
3930
+ if (!active$1.length) {
3931
+ css(document.body, 'overflowY', '');
3932
+ }
3933
+
3934
+ css(this.$el, 'zIndex', '');
3935
+
3936
+ if (!active$1.some((modal) => modal.clsPage === this.clsPage)) {
3937
+ removeClass(document.documentElement, this.clsPage);
3938
+ }
3939
+ } }],
3940
+
3941
+
3942
+
3943
+ methods: {
3944
+ toggle() {
3945
+ return this.isToggled() ? this.hide() : this.show();
3946
+ },
3947
+
3948
+ show() {
3949
+ if (this.container && parent(this.$el) !== this.container) {
3950
+ append(this.container, this.$el);
3951
+ return new Promise((resolve) =>
3952
+ requestAnimationFrame(() => this.show().then(resolve)));
3953
+
3954
+ }
3955
+
3956
+ return this.toggleElement(this.$el, true, animate(this));
3957
+ },
3958
+
3959
+ hide() {
3960
+ return this.toggleElement(this.$el, false, animate(this));
3961
+ } } };
3962
+
3963
+
3964
+
3965
+ function animate(_ref5) {let { transitionElement, _toggle } = _ref5;
3966
+ return (el, show) =>
3967
+ new Promise((resolve, reject) =>
3968
+ once(el, 'show hide', () => {
3969
+ el._reject == null ? void 0 : el._reject();
3970
+ el._reject = reject;
3971
+
3972
+ _toggle(el, show);
3973
+
3974
+ const off = once(
3975
+ transitionElement,
3976
+ 'transitionstart',
3977
+ () => {
3978
+ once(transitionElement, 'transitionend transitioncancel', resolve, {
3979
+ self: true });
3980
+
3981
+ clearTimeout(timer);
3982
+ },
3983
+ { self: true });
3984
+
3985
+
3986
+ const timer = setTimeout(() => {
3987
+ off();
3988
+ resolve();
3989
+ }, toMs(css(transitionElement, 'transitionDuration')));
3990
+ })).
3991
+ then(() => delete el._reject);
3992
+ }
3993
+
3994
+ function toMs(time) {
3995
+ return time ? endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000 : 0;
3996
+ }
3997
+
3998
+ function preventOverscroll(el) {
3999
+ if (CSS.supports('overscroll-behavior', 'contain')) {
4000
+ const elements = filterChildren(el, (child) => /auto|scroll/.test(css(child, 'overflow')));
4001
+ css(elements, 'overscrollBehavior', 'contain');
4002
+ return () => css(elements, 'overscrollBehavior', '');
4003
+ }
4004
+
4005
+ let startClientY;
4006
+
4007
+ const events = [
4008
+ on(
4009
+ el,
4010
+ 'touchstart',
4011
+ (_ref6) => {let { targetTouches } = _ref6;
4012
+ if (targetTouches.length === 1) {
4013
+ startClientY = targetTouches[0].clientY;
4014
+ }
4015
+ },
4016
+ { passive: true }),
4017
+
4018
+
4019
+ on(
4020
+ el,
4021
+ 'touchmove',
4022
+ (e) => {
4023
+ if (e.targetTouches.length !== 1) {
4024
+ return;
4025
+ }
4026
+
4027
+ let [scrollParent] = scrollParents(e.target, /auto|scroll/);
4028
+ if (!within(scrollParent, el)) {
4029
+ scrollParent = el;
4030
+ }
4031
+
4032
+ const clientY = e.targetTouches[0].clientY - startClientY;
4033
+ const { scrollTop, scrollHeight, clientHeight } = scrollParent;
4034
+
4035
+ if (
4036
+ clientHeight >= scrollHeight ||
4037
+ scrollTop === 0 && clientY > 0 ||
4038
+ scrollHeight - scrollTop <= clientHeight && clientY < 0)
4039
+ {
4040
+ e.cancelable && e.preventDefault();
4041
+ }
4042
+ },
4043
+ { passive: false })];
4044
+
4045
+
4046
+
4047
+ return () => events.forEach((fn) => fn());
4048
+ }
4049
+
4050
+ function preventBackgroundScroll() {
4051
+ const { body, documentElement } = document;
4052
+ css(body, {
4053
+ overflowY: width(window) > documentElement.clientWidth ? 'scroll' : '',
4054
+ touchAction: 'none' });
4055
+
4056
+ css(documentElement, 'overflowY', 'hidden');
4057
+ return () => {
4058
+ css(documentElement, 'overflowY', '');
4059
+ css(body, { overflowY: '', touchAction: '' });
4060
+ };
4061
+ }
4062
+
4063
+ function filterChildren(el, fn) {
4064
+ const children = [];
4065
+ apply(el, (node) => {
4066
+ if (fn(node)) {
4067
+ children.push(node);
4068
+ }
4069
+ });
4070
+ return children;
4071
+ }
4072
+
4073
+ let active;
4074
+
4075
+ var drop = {
4076
+ mixins: [Container, Lazyload, Position, Togglable],
4077
+
4078
+ args: 'pos',
4079
+
4080
+ props: {
4081
+ mode: 'list',
4082
+ toggle: Boolean,
4083
+ boundary: Boolean,
4084
+ boundaryAlign: Boolean,
4085
+ delayShow: Number,
4086
+ delayHide: Number,
4087
+ display: String,
4088
+ clsDrop: String,
4089
+ animateOut: Boolean,
4090
+ bgScroll: Boolean },
4091
+
4092
+
4093
+ data: {
4094
+ mode: ['click', 'hover'],
4095
+ toggle: '- *',
4096
+ boundary: true,
4097
+ boundaryAlign: false,
4098
+ delayShow: 0,
4099
+ delayHide: 800,
4100
+ display: null,
4101
+ clsDrop: false,
4102
+ animation: ['uk-animation-fade'],
4103
+ cls: 'uk-open',
4104
+ container: false,
4105
+ animateOut: false,
4106
+ bgScroll: true },
4107
+
4108
+
4109
+ created() {
4110
+ this.tracker = new MouseTracker();
4111
+ },
4112
+
4113
+ beforeConnect() {
4114
+ this.clsDrop = this.$props.clsDrop || "uk-" + this.$options.name;
4115
+ },
4116
+
4117
+ connected() {
4118
+ addClass(this.$el, this.clsDrop);
4119
+
4120
+ if (this.toggle && !this.target) {
4121
+ this.target = this.$create('toggle', query(this.toggle, this.$el), {
4122
+ target: this.$el,
4123
+ mode: this.mode }).
4124
+ $el;
4125
+ attr(this.target, 'aria-haspopup', true);
4126
+ this.lazyload(this.target);
4127
+ }
4128
+ },
4129
+
4130
+ disconnected() {
4131
+ if (this.isActive()) {
4132
+ active = null;
4133
+ }
4134
+ },
4135
+
4136
+ events: [
4137
+ {
4138
+ name: 'click',
4139
+
4140
+ delegate() {
4141
+ return "." + this.clsDrop + "-close";
4142
+ },
4143
+
4144
+ handler(e) {
4145
+ e.preventDefault();
4146
+ this.hide(false);
4147
+ } },
4148
+
4149
+
4150
+ {
4151
+ name: 'click',
4152
+
4153
+ delegate() {
4154
+ return 'a[href^="#"]';
4155
+ },
4156
+
4157
+ handler(_ref) {let { defaultPrevented, current: { hash } } = _ref;
4158
+ if (!defaultPrevented && hash && !within(hash, this.$el)) {
4159
+ this.hide(false);
4160
+ }
4161
+ } },
4162
+
4163
+
4164
+ {
4165
+ name: 'beforescroll',
4166
+
4167
+ handler() {
4168
+ this.hide(false);
4169
+ } },
4170
+
4171
+
4172
+ {
4173
+ name: 'toggle',
4174
+
4175
+ self: true,
4176
+
4177
+ handler(e, toggle) {
4178
+ e.preventDefault();
4179
+
4180
+ if (this.isToggled()) {
4181
+ this.hide(false);
4182
+ } else {
4183
+ this.show(toggle == null ? void 0 : toggle.$el, false);
4184
+ }
4185
+ } },
4186
+
4187
+
4188
+ {
4189
+ name: 'toggleshow',
4190
+
4191
+ self: true,
4192
+
4193
+ handler(e, toggle) {
4194
+ e.preventDefault();
4195
+ this.show(toggle == null ? void 0 : toggle.$el);
4196
+ } },
4197
+
4198
+
4199
+ {
4200
+ name: 'togglehide',
4201
+
4202
+ self: true,
4203
+
4204
+ handler(e) {
4205
+ e.preventDefault();
4206
+ if (!matches(this.$el, ':focus,:hover')) {
4207
+ this.hide();
4208
+ }
4209
+ } },
4210
+
4211
+
4212
+ {
4213
+ name: pointerEnter + " focusin",
4214
+
4215
+ filter() {
4216
+ return includes(this.mode, 'hover');
4217
+ },
4218
+
4219
+ handler(e) {
4220
+ if (!isTouch(e)) {
4221
+ this.clearTimers();
4222
+ }
4223
+ } },
4224
+
4225
+
4226
+ {
4227
+ name: pointerLeave + " focusout",
4228
+
4229
+ filter() {
4230
+ return includes(this.mode, 'hover');
4231
+ },
4232
+
4233
+ handler(e) {
4234
+ if (!isTouch(e) && e.relatedTarget) {
4235
+ this.hide();
4236
+ }
4237
+ } },
4238
+
4239
+
4240
+ {
4241
+ name: 'toggled',
4242
+
4243
+ self: true,
4244
+
4245
+ handler(e, toggled) {
4246
+ if (!toggled) {
4247
+ return;
4248
+ }
4249
+
4250
+ this.clearTimers();
4251
+ this.position();
4252
+ } },
4253
+
4254
+
4255
+ {
4256
+ name: 'show',
4257
+
4258
+ self: true,
4259
+
4260
+ handler() {
4261
+ active = this;
3810
4262
 
3811
4263
  this.tracker.init();
3812
4264
 
@@ -3839,7 +4291,11 @@
3839
4291
  }
3840
4292
  }),
3841
4293
 
3842
- ...(this.display === 'static' ?
4294
+ ...(this.bgScroll ?
4295
+ [] :
4296
+ [preventOverscroll(this.$el), preventBackgroundScroll()]),
4297
+
4298
+ ...(this.display === 'static' && this.align !== 'stretch' ?
3843
4299
  [] :
3844
4300
  (() => {
3845
4301
  const handler = () => this.$emit();
@@ -3876,14 +4332,14 @@
3876
4332
 
3877
4333
  handler(_ref4) {let { target } = _ref4;
3878
4334
  if (this.$el !== target) {
3879
- active$1 =
3880
- active$1 === null && within(target, this.$el) && this.isToggled() ?
4335
+ active =
4336
+ active === null && within(target, this.$el) && this.isToggled() ?
3881
4337
  this :
3882
- active$1;
4338
+ active;
3883
4339
  return;
3884
4340
  }
3885
4341
 
3886
- active$1 = this.isActive() ? null : active$1;
4342
+ active = this.isActive() ? null : active;
3887
4343
  this.tracker.cancel();
3888
4344
  } }],
3889
4345
 
@@ -3900,7 +4356,7 @@
3900
4356
  methods: {
3901
4357
  show(target, delay) {if (target === void 0) {target = this.target;}if (delay === void 0) {delay = true;}
3902
4358
  if (this.isToggled() && target && this.target && target !== this.target) {
3903
- this.hide(false);
4359
+ this.hide(false, false);
3904
4360
  }
3905
4361
 
3906
4362
  this.target = target;
@@ -3911,16 +4367,16 @@
3911
4367
  return;
3912
4368
  }
3913
4369
 
3914
- if (active$1) {
3915
- if (delay && active$1.isDelaying) {
4370
+ if (active) {
4371
+ if (delay && active.isDelaying) {
3916
4372
  this.showTimer = setTimeout(() => matches(target, ':hover') && this.show(), 10);
3917
4373
  return;
3918
4374
  }
3919
4375
 
3920
4376
  let prev;
3921
- while (active$1 && prev !== active$1 && !within(this.$el, active$1.$el)) {
3922
- prev = active$1;
3923
- active$1.hide(false);
4377
+ while (active && prev !== active && !within(this.$el, active.$el)) {
4378
+ prev = active;
4379
+ active.hide(false, false);
3924
4380
  }
3925
4381
  }
3926
4382
 
@@ -3934,8 +4390,8 @@
3934
4390
 
3935
4391
  },
3936
4392
 
3937
- hide(delay) {if (delay === void 0) {delay = true;}
3938
- const hide = () => this.toggleElement(this.$el, false, false);
4393
+ hide(delay, animate) {if (delay === void 0) {delay = true;}if (animate === void 0) {animate = true;}
4394
+ const hide = () => this.toggleElement(this.$el, false, this.animateOut && animate);
3939
4395
 
3940
4396
  this.clearTimers();
3941
4397
 
@@ -3961,34 +4417,57 @@
3961
4417
  },
3962
4418
 
3963
4419
  isActive() {
3964
- return active$1 === this;
4420
+ return active === this;
3965
4421
  },
3966
4422
 
3967
4423
  position() {
3968
4424
  removeClass(this.$el, this.clsDrop + "-stack");
3969
4425
  toggleClass(this.$el, this.clsDrop + "-boundary", this.boundaryAlign);
4426
+ toggleClass(this.$el, this.clsDrop + "-stretch", this.align === 'stretch');
3970
4427
 
3971
4428
  const boundary = query(this.boundary, this.$el);
3972
- const scrollParentOffset = offset(
3973
- scrollParents(boundary && this.boundaryAlign ? boundary : this.$el)[0]);
4429
+ const target = boundary && this.boundaryAlign ? boundary : this.target;
4430
+ const [scrollParent] = scrollParents(
4431
+ boundary && this.boundaryAlign ? boundary : this.$el);
3974
4432
 
4433
+ const scrollParentOffset = offset(scrollParent);
3975
4434
  const boundaryOffset = boundary ? offset(boundary) : scrollParentOffset;
4435
+ const viewportOffset = this.getViewportOffset(this.$el);
3976
4436
 
3977
4437
  css(this.$el, 'maxWidth', '');
3978
- const maxWidth =
3979
- scrollParentOffset.width -
3980
- 2 * toPx(getCssVar('position-viewport-offset', this.$el));
4438
+ const maxWidth = scrollParentOffset.width - 2 * viewportOffset;
3981
4439
 
3982
- if (this.pos[1] === 'justify') {
4440
+ if (this.align === 'justify') {
3983
4441
  const prop = this.axis === 'y' ? 'width' : 'height';
3984
4442
  css(
3985
4443
  this.$el,
3986
4444
  prop,
3987
4445
  Math.min(
3988
4446
  (boundary ? boundaryOffset : offset(this.target))[prop],
3989
- scrollParentOffset[prop] -
3990
- 2 * toPx(getCssVar('position-viewport-offset', this.$el))));
3991
-
4447
+ scrollParentOffset[prop] - 2 * viewportOffset));
4448
+
4449
+
4450
+ } else if (this.align === 'stretch') {
4451
+ this.flip = this.axis === 'y' ? 'x' : 'y';
4452
+ this.display = 'static';
4453
+
4454
+ const viewport = offsetViewport(scrollParent);
4455
+ const targetDim = offset(target);
4456
+ const elOffset = Math.abs(this.getPositionOffset(this.$el)) + viewportOffset;
4457
+
4458
+ css(this.$el, {
4459
+ width:
4460
+ this.axis === 'y' ?
4461
+ viewport.width :
4462
+ (this.dir === 'left' ?
4463
+ targetDim.left - viewport.left :
4464
+ viewport.right - targetDim.right) - elOffset,
4465
+ height:
4466
+ this.axis === 'x' ?
4467
+ viewport.height :
4468
+ (this.dir === 'top' ?
4469
+ targetDim.top - viewport.top :
4470
+ viewport.bottom - targetDim.bottom) - elOffset });
3992
4471
 
3993
4472
  } else if (this.$el.offsetWidth > maxWidth) {
3994
4473
  addClass(this.$el, this.clsDrop + "-stack");
@@ -3996,11 +4475,7 @@
3996
4475
 
3997
4476
  css(this.$el, 'maxWidth', maxWidth);
3998
4477
 
3999
- this.positionAt(
4000
- this.$el,
4001
- boundary && this.boundaryAlign ? boundary : this.target,
4002
- boundary);
4003
-
4478
+ this.positionAt(this.$el, target, boundary);
4004
4479
  } } };
4005
4480
 
4006
4481
 
@@ -4485,7 +4960,7 @@
4485
4960
 
4486
4961
  resizeTargets() {
4487
4962
  // check for offsetTop change
4488
- return [this.$el, document.documentElement];
4963
+ return [this.$el, ...scrollParents(this.$el, /auto|scroll/)];
4489
4964
  },
4490
4965
 
4491
4966
  update: {
@@ -4497,21 +4972,25 @@
4497
4972
  let minHeight = '';
4498
4973
  const box = boxModelAdjust(this.$el, 'height', 'content-box');
4499
4974
 
4975
+ const [scrollElement] = scrollParents(this.$el, /auto|scroll/);
4976
+ const { height: viewportHeight } = offsetViewport(scrollElement);
4977
+
4500
4978
  if (this.expand) {
4501
4979
  minHeight = Math.max(
4502
- height(window) - (
4503
- dimensions(document.documentElement).height -
4504
- dimensions(this.$el).height) -
4980
+ viewportHeight - (
4981
+ dimensions(scrollElement).height - dimensions(this.$el).height) -
4505
4982
  box,
4506
4983
  0);
4507
4984
 
4508
4985
  } else {
4509
4986
  // on mobile devices (iOS and Android) window.innerHeight !== 100vh
4510
- minHeight = 'calc(100vh';
4987
+ minHeight = "calc(" + (
4988
+ document.scrollingElement === scrollElement ? '100vh' : viewportHeight + "px");
4989
+
4511
4990
 
4512
4991
  if (this.offsetTop) {
4513
- const { top } = offset(this.$el);
4514
- minHeight += top > 0 && top < height(window) / 2 ? " - " + top + "px" : '';
4992
+ const top = offsetPosition(this.$el)[0] - offsetPosition(scrollElement)[0];
4993
+ minHeight += top > 0 && top < viewportHeight / 2 ? " - " + top + "px" : '';
4515
4994
  }
4516
4995
 
4517
4996
  if (this.offsetBottom === true) {
@@ -5027,412 +5506,161 @@
5027
5506
  const value = data(sourceEl, prop);
5028
5507
  if (value) {
5029
5508
  attr(targetEl, prop.replace(/^(data-)+/, ''), value);
5030
- }
5031
- });
5032
- }
5033
-
5034
- function getImageFromElement(el, src, sources) {
5035
- const img = new Image();
5036
-
5037
- wrapInPicture(img, sources);
5038
- setSourceProps(el, img);
5039
- img.onload = () => {
5040
- setSrcAttrs(el, img.currentSrc);
5041
- };
5042
- attr(img, 'src', src);
5043
- return img;
5044
- }
5045
-
5046
- function wrapInPicture(img, sources) {
5047
- sources = parseSources(sources);
5048
-
5049
- if (sources.length) {
5050
- const picture = fragment('<picture>');
5051
- for (const attrs of sources) {
5052
- const source = fragment('<source>');
5053
- attr(source, attrs);
5054
- append(picture, source);
5055
- }
5056
- append(picture, img);
5057
- }
5058
- }
5059
-
5060
- function parseSources(sources) {
5061
- if (!sources) {
5062
- return [];
5063
- }
5064
-
5065
- if (startsWith(sources, '[')) {
5066
- try {
5067
- sources = JSON.parse(sources);
5068
- } catch (e) {
5069
- sources = [];
5070
- }
5071
- } else {
5072
- sources = parseOptions(sources);
5073
- }
5074
-
5075
- if (!isArray(sources)) {
5076
- sources = [sources];
5077
- }
5078
-
5079
- return sources.filter((source) => !isEmpty(source));
5080
- }
5081
-
5082
- function ensureSrcAttribute(el) {
5083
- if (isImg(el) && !hasAttr(el, 'src')) {
5084
- attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
5085
- }
5086
- }
5087
-
5088
- function isPicture(el) {
5089
- return isTag(el, 'picture');
5090
- }
5091
-
5092
- function isImg(el) {
5093
- return isTag(el, 'img');
5094
- }
5095
-
5096
- var Media = {
5097
- props: {
5098
- media: Boolean },
5099
-
5100
-
5101
- data: {
5102
- media: false },
5103
-
5104
-
5105
- connected() {
5106
- const media = toMedia(this.media);
5107
- this.matchMedia = true;
5108
- if (media) {
5109
- this.mediaObj = window.matchMedia(media);
5110
- const handler = () => {
5111
- this.matchMedia = this.mediaObj.matches;
5112
- trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
5113
- };
5114
- this.offMediaObj = on(this.mediaObj, 'change', () => {
5115
- handler();
5116
- this.$emit('resize');
5117
- });
5118
- handler();
5119
- }
5120
- },
5121
-
5122
- disconnected() {var _this$offMediaObj;
5123
- (_this$offMediaObj = this.offMediaObj) == null ? void 0 : _this$offMediaObj.call(this);
5124
- } };
5125
-
5126
-
5127
- function toMedia(value) {
5128
- if (isString(value)) {
5129
- if (startsWith(value, '@')) {
5130
- const name = "breakpoint-" + value.substr(1);
5131
- value = toFloat(getCssVar(name));
5132
- } else if (isNaN(value)) {
5133
- return value;
5134
- }
5135
- }
5136
-
5137
- return value && isNumeric(value) ? "(min-width: " + value + "px)" : '';
5138
- }
5139
-
5140
- var leader = {
5141
- mixins: [Class, Media, Resize],
5142
-
5143
- props: {
5144
- fill: String },
5145
-
5146
-
5147
- data: {
5148
- fill: '',
5149
- clsWrapper: 'uk-leader-fill',
5150
- clsHide: 'uk-leader-hide',
5151
- attrFill: 'data-fill' },
5152
-
5153
-
5154
- computed: {
5155
- fill(_ref) {let { fill } = _ref;
5156
- return fill || getCssVar('leader-fill-content');
5157
- } },
5158
-
5159
-
5160
- connected() {
5161
- [this.wrapper] = wrapInner(this.$el, "<span class=\"" + this.clsWrapper + "\">");
5162
- },
5163
-
5164
- disconnected() {
5165
- unwrap(this.wrapper.childNodes);
5166
- },
5167
-
5168
- update: {
5169
- read() {
5170
- const width = Math.trunc(this.$el.offsetWidth / 2);
5171
-
5172
- return {
5173
- width,
5174
- fill: this.fill,
5175
- hide: !this.matchMedia };
5176
-
5177
- },
5178
-
5179
- write(_ref2) {let { width, fill, hide } = _ref2;
5180
- toggleClass(this.wrapper, this.clsHide, hide);
5181
- attr(this.wrapper, this.attrFill, new Array(width).join(fill));
5182
- },
5183
-
5184
- events: ['resize'] } };
5185
-
5186
- const active = [];
5187
-
5188
- var Modal = {
5189
- mixins: [Class, Container, Togglable],
5190
-
5191
- props: {
5192
- selPanel: String,
5193
- selClose: String,
5194
- escClose: Boolean,
5195
- bgClose: Boolean,
5196
- stack: Boolean },
5197
-
5198
-
5199
- data: {
5200
- cls: 'uk-open',
5201
- escClose: true,
5202
- bgClose: true,
5203
- overlay: true,
5204
- stack: false },
5205
-
5206
-
5207
- computed: {
5208
- panel(_ref, $el) {let { selPanel } = _ref;
5209
- return $(selPanel, $el);
5210
- },
5211
-
5212
- transitionElement() {
5213
- return this.panel;
5214
- },
5215
-
5216
- bgClose(_ref2) {let { bgClose } = _ref2;
5217
- return bgClose && this.panel;
5218
- } },
5219
-
5220
-
5221
- beforeDisconnect() {
5222
- if (includes(active, this)) {
5223
- this.toggleElement(this.$el, false, false);
5224
- }
5225
- },
5226
-
5227
- events: [
5228
- {
5229
- name: 'click',
5230
-
5231
- delegate() {
5232
- return this.selClose;
5233
- },
5234
-
5235
- handler(e) {
5236
- e.preventDefault();
5237
- this.hide();
5238
- } },
5239
-
5240
-
5241
- {
5242
- name: 'toggle',
5243
-
5244
- self: true,
5245
-
5246
- handler(e) {
5247
- if (e.defaultPrevented) {
5248
- return;
5249
- }
5250
-
5251
- e.preventDefault();
5252
-
5253
- if (this.isToggled() === includes(active, this)) {
5254
- this.toggle();
5255
- }
5256
- } },
5257
-
5258
-
5259
- {
5260
- name: 'beforeshow',
5261
-
5262
- self: true,
5263
-
5264
- handler(e) {
5265
- if (includes(active, this)) {
5266
- return false;
5267
- }
5268
-
5269
- if (!this.stack && active.length) {
5270
- Promise.all(active.map((modal) => modal.hide())).then(this.show);
5271
- e.preventDefault();
5272
- } else {
5273
- active.push(this);
5274
- }
5275
- } },
5276
-
5277
-
5278
- {
5279
- name: 'show',
5280
-
5281
- self: true,
5282
-
5283
- handler() {
5284
- const docEl = document.documentElement;
5285
-
5286
- if (width(window) > docEl.clientWidth && this.overlay) {
5287
- css(document.body, 'overflowY', 'scroll');
5288
- }
5289
-
5290
- if (this.stack) {
5291
- css(this.$el, 'zIndex', toFloat(css(this.$el, 'zIndex')) + active.length);
5292
- }
5509
+ }
5510
+ });
5511
+ }
5293
5512
 
5294
- addClass(docEl, this.clsPage);
5513
+ function getImageFromElement(el, src, sources) {
5514
+ const img = new Image();
5295
5515
 
5296
- if (this.bgClose) {
5297
- once(
5298
- this.$el,
5299
- 'hide',
5300
- on(document, pointerDown, (_ref3) => {let { target } = _ref3;
5301
- if (
5302
- last(active) !== this ||
5303
- this.overlay && !within(target, this.$el) ||
5304
- within(target, this.panel))
5305
- {
5306
- return;
5307
- }
5516
+ wrapInPicture(img, sources);
5517
+ setSourceProps(el, img);
5518
+ img.onload = () => {
5519
+ setSrcAttrs(el, img.currentSrc);
5520
+ };
5521
+ attr(img, 'src', src);
5522
+ return img;
5523
+ }
5308
5524
 
5309
- once(
5310
- document,
5311
- pointerUp + " " + pointerCancel + " scroll",
5312
- (_ref4) => {let { defaultPrevented, type, target: newTarget } = _ref4;
5313
- if (
5314
- !defaultPrevented &&
5315
- type === pointerUp &&
5316
- target === newTarget)
5317
- {
5318
- this.hide();
5319
- }
5320
- },
5321
- true);
5525
+ function wrapInPicture(img, sources) {
5526
+ sources = parseSources(sources);
5322
5527
 
5323
- }),
5324
- { self: true });
5528
+ if (sources.length) {
5529
+ const picture = fragment('<picture>');
5530
+ for (const attrs of sources) {
5531
+ const source = fragment('<source>');
5532
+ attr(source, attrs);
5533
+ append(picture, source);
5534
+ }
5535
+ append(picture, img);
5536
+ }
5537
+ }
5325
5538
 
5326
- }
5539
+ function parseSources(sources) {
5540
+ if (!sources) {
5541
+ return [];
5542
+ }
5327
5543
 
5328
- if (this.escClose) {
5329
- once(
5330
- this.$el,
5331
- 'hide',
5332
- on(document, 'keydown', (e) => {
5333
- if (e.keyCode === 27 && last(active) === this) {
5334
- this.hide();
5335
- }
5336
- }),
5337
- { self: true });
5544
+ if (startsWith(sources, '[')) {
5545
+ try {
5546
+ sources = JSON.parse(sources);
5547
+ } catch (e) {
5548
+ sources = [];
5549
+ }
5550
+ } else {
5551
+ sources = parseOptions(sources);
5552
+ }
5338
5553
 
5339
- }
5340
- } },
5554
+ if (!isArray(sources)) {
5555
+ sources = [sources];
5556
+ }
5341
5557
 
5558
+ return sources.filter((source) => !isEmpty(source));
5559
+ }
5342
5560
 
5343
- {
5344
- name: 'shown',
5561
+ function ensureSrcAttribute(el) {
5562
+ if (isImg(el) && !hasAttr(el, 'src')) {
5563
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
5564
+ }
5565
+ }
5345
5566
 
5346
- self: true,
5567
+ function isPicture(el) {
5568
+ return isTag(el, 'picture');
5569
+ }
5347
5570
 
5348
- handler() {
5349
- if (!isFocusable(this.$el)) {
5350
- attr(this.$el, 'tabindex', '-1');
5351
- }
5571
+ function isImg(el) {
5572
+ return isTag(el, 'img');
5573
+ }
5352
5574
 
5353
- if (!$(':focus', this.$el)) {
5354
- this.$el.focus();
5355
- }
5356
- } },
5575
+ var Media = {
5576
+ props: {
5577
+ media: Boolean },
5357
5578
 
5358
5579
 
5359
- {
5360
- name: 'hidden',
5580
+ data: {
5581
+ media: false },
5361
5582
 
5362
- self: true,
5363
5583
 
5364
- handler() {
5365
- if (includes(active, this)) {
5366
- active.splice(active.indexOf(this), 1);
5367
- }
5584
+ connected() {
5585
+ const media = toMedia(this.media);
5586
+ this.matchMedia = true;
5587
+ if (media) {
5588
+ this.mediaObj = window.matchMedia(media);
5589
+ const handler = () => {
5590
+ this.matchMedia = this.mediaObj.matches;
5591
+ trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
5592
+ };
5593
+ this.offMediaObj = on(this.mediaObj, 'change', () => {
5594
+ handler();
5595
+ this.$emit('resize');
5596
+ });
5597
+ handler();
5598
+ }
5599
+ },
5368
5600
 
5369
- if (!active.length) {
5370
- css(document.body, 'overflowY', '');
5371
- }
5601
+ disconnected() {var _this$offMediaObj;
5602
+ (_this$offMediaObj = this.offMediaObj) == null ? void 0 : _this$offMediaObj.call(this);
5603
+ } };
5372
5604
 
5373
- css(this.$el, 'zIndex', '');
5374
5605
 
5375
- if (!active.some((modal) => modal.clsPage === this.clsPage)) {
5376
- removeClass(document.documentElement, this.clsPage);
5377
- }
5378
- } }],
5606
+ function toMedia(value) {
5607
+ if (isString(value)) {
5608
+ if (startsWith(value, '@')) {
5609
+ const name = "breakpoint-" + value.substr(1);
5610
+ value = toFloat(getCssVar(name));
5611
+ } else if (isNaN(value)) {
5612
+ return value;
5613
+ }
5614
+ }
5379
5615
 
5616
+ return value && isNumeric(value) ? "(min-width: " + value + "px)" : '';
5617
+ }
5380
5618
 
5619
+ var leader = {
5620
+ mixins: [Class, Media, Resize],
5381
5621
 
5382
- methods: {
5383
- toggle() {
5384
- return this.isToggled() ? this.hide() : this.show();
5385
- },
5622
+ props: {
5623
+ fill: String },
5386
5624
 
5387
- show() {
5388
- if (this.container && parent(this.$el) !== this.container) {
5389
- append(this.container, this.$el);
5390
- return new Promise((resolve) =>
5391
- requestAnimationFrame(() => this.show().then(resolve)));
5392
5625
 
5393
- }
5626
+ data: {
5627
+ fill: '',
5628
+ clsWrapper: 'uk-leader-fill',
5629
+ clsHide: 'uk-leader-hide',
5630
+ attrFill: 'data-fill' },
5394
5631
 
5395
- return this.toggleElement(this.$el, true, animate(this));
5396
- },
5397
5632
 
5398
- hide() {
5399
- return this.toggleElement(this.$el, false, animate(this));
5400
- } } };
5633
+ computed: {
5634
+ fill(_ref) {let { fill } = _ref;
5635
+ return fill || getCssVar('leader-fill-content');
5636
+ } },
5401
5637
 
5402
5638
 
5639
+ connected() {
5640
+ [this.wrapper] = wrapInner(this.$el, "<span class=\"" + this.clsWrapper + "\">");
5641
+ },
5403
5642
 
5404
- function animate(_ref5) {let { transitionElement, _toggle } = _ref5;
5405
- return (el, show) =>
5406
- new Promise((resolve, reject) =>
5407
- once(el, 'show hide', () => {
5408
- el._reject == null ? void 0 : el._reject();
5409
- el._reject = reject;
5643
+ disconnected() {
5644
+ unwrap(this.wrapper.childNodes);
5645
+ },
5410
5646
 
5411
- _toggle(el, show);
5647
+ update: {
5648
+ read() {
5649
+ const width = Math.trunc(this.$el.offsetWidth / 2);
5412
5650
 
5413
- const off = once(
5414
- transitionElement,
5415
- 'transitionstart',
5416
- () => {
5417
- once(transitionElement, 'transitionend transitioncancel', resolve, {
5418
- self: true });
5651
+ return {
5652
+ width,
5653
+ fill: this.fill,
5654
+ hide: !this.matchMedia };
5419
5655
 
5420
- clearTimeout(timer);
5421
5656
  },
5422
- { self: true });
5423
-
5424
5657
 
5425
- const timer = setTimeout(() => {
5426
- off();
5427
- resolve();
5428
- }, toMs(css(transitionElement, 'transitionDuration')));
5429
- })).
5430
- then(() => delete el._reject);
5431
- }
5658
+ write(_ref2) {let { width, fill, hide } = _ref2;
5659
+ toggleClass(this.wrapper, this.clsHide, hide);
5660
+ attr(this.wrapper, this.attrFill, new Array(width).join(fill));
5661
+ },
5432
5662
 
5433
- function toMs(time) {
5434
- return time ? endsWith(time, 'ms') ? toFloat(time) : toFloat(time) * 1000 : 0;
5435
- }
5663
+ events: ['resize'] } };
5436
5664
 
5437
5665
  var modal = {
5438
5666
  install,
@@ -5845,8 +6073,8 @@
5845
6073
  return this.dropbar;
5846
6074
  },
5847
6075
 
5848
- handler(_, _ref9) {let { $el } = _ref9;
5849
- if (!hasClass($el, this.clsDrop)) {
6076
+ handler(_, _ref9) {let { $el, align } = _ref9;
6077
+ if (!hasClass($el, this.clsDrop) || align === 'stretch') {
5850
6078
  return;
5851
6079
  }
5852
6080
 
@@ -5869,8 +6097,8 @@
5869
6097
  return this.dropbar;
5870
6098
  },
5871
6099
 
5872
- handler(_, _ref10) {let { $el } = _ref10;
5873
- if (!hasClass($el, this.clsDrop)) {
6100
+ handler(_, _ref10) {let { $el, align } = _ref10;
6101
+ if (!hasClass($el, this.clsDrop) || align === 'stretch') {
5874
6102
  return;
5875
6103
  }
5876
6104
 
@@ -5920,8 +6148,8 @@
5920
6148
  return this.dropbar;
5921
6149
  },
5922
6150
 
5923
- handler(_, _ref12) {let { $el } = _ref12;
5924
- if (!hasClass($el, this.clsDrop)) {
6151
+ handler(_, _ref12) {let { $el, align } = _ref12;
6152
+ if (!hasClass($el, this.clsDrop) || align === 'stretch') {
5925
6153
  return;
5926
6154
  }
5927
6155
 
@@ -5938,7 +6166,7 @@
5938
6166
 
5939
6167
  methods: {
5940
6168
  getActive() {
5941
- return active$1 && within(active$1.target, this.$el) && active$1;
6169
+ return active && within(active.target, this.$el) && active;
5942
6170
  },
5943
6171
 
5944
6172
  transitionTo(newHeight, el) {
@@ -5947,7 +6175,7 @@
5947
6175
 
5948
6176
  el = oldHeight < newHeight && el;
5949
6177
 
5950
- css(el, 'clip', "rect(0," + el.offsetWidth + "px," + oldHeight + "px,0)");
6178
+ css(el, 'clipPath', "polygon(0 0,100% 0,100% " + oldHeight + "px,0 " + oldHeight + "px)");
5951
6179
 
5952
6180
  height(dropbar, oldHeight);
5953
6181
 
@@ -5956,12 +6184,14 @@
5956
6184
  Transition.start(dropbar, { height: newHeight }, this.duration),
5957
6185
  Transition.start(
5958
6186
  el,
5959
- { clip: "rect(0," + el.offsetWidth + "px," + newHeight + "px,0)" },
6187
+ {
6188
+ clipPath: "polygon(0 0,100% 0,100% " + newHeight + "px,0 " + newHeight + "px)" },
6189
+
5960
6190
  this.duration)]).
5961
6191
 
5962
6192
 
5963
6193
  catch(noop).
5964
- then(() => css(el, { clip: '' }));
6194
+ then(() => css(el, { clipPath: '' }));
5965
6195
  },
5966
6196
 
5967
6197
  getDropdown(el) {
@@ -6146,22 +6376,6 @@
6146
6376
  } },
6147
6377
 
6148
6378
 
6149
- {
6150
- name: 'touchstart',
6151
-
6152
- passive: true,
6153
-
6154
- el() {
6155
- return this.panel;
6156
- },
6157
-
6158
- handler(_ref8) {let { targetTouches } = _ref8;
6159
- if (targetTouches.length === 1) {
6160
- this.clientY = targetTouches[0].clientY;
6161
- }
6162
- } },
6163
-
6164
-
6165
6379
  {
6166
6380
  name: 'touchmove',
6167
6381
 
@@ -6177,33 +6391,6 @@
6177
6391
  } },
6178
6392
 
6179
6393
 
6180
- {
6181
- name: 'touchmove',
6182
-
6183
- passive: false,
6184
-
6185
- el() {
6186
- return this.panel;
6187
- },
6188
-
6189
- handler(e) {
6190
- if (e.targetTouches.length !== 1) {
6191
- return;
6192
- }
6193
-
6194
- const clientY = e.targetTouches[0].clientY - this.clientY;
6195
- const { scrollTop, scrollHeight, clientHeight } = this.panel;
6196
-
6197
- if (
6198
- clientHeight >= scrollHeight ||
6199
- scrollTop === 0 && clientY > 0 ||
6200
- scrollHeight - scrollTop <= clientHeight && clientY < 0)
6201
- {
6202
- e.cancelable && e.preventDefault();
6203
- }
6204
- } },
6205
-
6206
-
6207
6394
  {
6208
6395
  name: 'show',
6209
6396
 
@@ -6215,7 +6402,6 @@
6215
6402
  addClass(parent(this.panel), this.clsMode);
6216
6403
  }
6217
6404
 
6218
- css(document.documentElement, 'overflowY', this.overlay ? 'hidden' : '');
6219
6405
  addClass(document.body, this.clsContainer, this.clsFlip);
6220
6406
  css(document.body, 'touch-action', 'pan-y pinch-zoom');
6221
6407
  css(this.$el, 'display', 'block');
@@ -6223,7 +6409,7 @@
6223
6409
  addClass(
6224
6410
  this.panel,
6225
6411
  this.clsSidebarAnimation,
6226
- this.mode !== 'reveal' ? this.clsMode : '');
6412
+ this.mode === 'reveal' ? '' : this.clsMode);
6227
6413
 
6228
6414
 
6229
6415
  height(document.body); // force reflow
@@ -6260,8 +6446,6 @@
6260
6446
  removeClass(this.$el, this.clsOverlay);
6261
6447
  css(this.$el, 'display', '');
6262
6448
  removeClass(document.body, this.clsContainer, this.clsFlip);
6263
-
6264
- css(document.documentElement, 'overflowY', '');
6265
6449
  } },
6266
6450
 
6267
6451
 
@@ -7066,7 +7250,7 @@
7066
7250
 
7067
7251
  watch(connects) {
7068
7252
  if (this.swiping) {
7069
- css(connects, 'touch-action', 'pan-y pinch-zoom');
7253
+ css(connects, 'touchAction', 'pan-y pinch-zoom');
7070
7254
  }
7071
7255
 
7072
7256
  const index = this.index();