uikit 3.11.2-dev.c2430c233 → 3.11.2-dev.c7ed3c19b

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 (154) hide show
  1. package/.eslintrc.json +4 -49
  2. package/.prettierignore +14 -0
  3. package/.prettierrc.json +13 -0
  4. package/.webstorm.js +3 -3
  5. package/CHANGELOG.md +5 -0
  6. package/build/.eslintrc.json +1 -3
  7. package/build/build.js +26 -28
  8. package/build/icons.js +7 -11
  9. package/build/less.js +48 -36
  10. package/build/package.json +2 -2
  11. package/build/prefix.js +21 -18
  12. package/build/publishDev.js +6 -8
  13. package/build/release.js +20 -17
  14. package/build/scope.js +21 -11
  15. package/build/scss.js +72 -39
  16. package/build/util.js +71 -62
  17. package/build/wrapper/icons.js +0 -2
  18. package/dist/css/uikit-core-rtl.css +1 -1
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +1 -1
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +1 -1
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +1 -1
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +88 -133
  27. package/dist/js/components/countdown.min.js +1 -1
  28. package/dist/js/components/filter.js +409 -438
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1116 -1305
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1164 -1383
  33. package/dist/js/components/lightbox.min.js +1 -1
  34. package/dist/js/components/notification.js +94 -114
  35. package/dist/js/components/notification.min.js +1 -1
  36. package/dist/js/components/parallax.js +294 -345
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +292 -344
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +727 -850
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +292 -344
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +615 -799
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +588 -619
  47. package/dist/js/components/sortable.min.js +1 -1
  48. package/dist/js/components/tooltip.js +324 -356
  49. package/dist/js/components/tooltip.min.js +1 -1
  50. package/dist/js/components/upload.js +155 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5356 -6705
  53. package/dist/js/uikit-core.min.js +1 -1
  54. package/dist/js/uikit-icons.js +7 -9
  55. package/dist/js/uikit-icons.min.js +1 -1
  56. package/dist/js/uikit.js +8116 -9909
  57. package/dist/js/uikit.min.js +1 -1
  58. package/jsconfig.json +1 -1
  59. package/package.json +64 -60
  60. package/src/js/api/boot.js +25 -32
  61. package/src/js/api/component.js +23 -27
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +13 -32
  64. package/src/js/api/instance.js +7 -15
  65. package/src/js/api/state.js +65 -82
  66. package/src/js/components/countdown.js +24 -50
  67. package/src/js/components/filter.js +71 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +11 -23
  70. package/src/js/components/internal/slider-transitioner.js +66 -45
  71. package/src/js/components/internal/slideshow-animations.js +42 -61
  72. package/src/js/components/lightbox-panel.js +135 -109
  73. package/src/js/components/lightbox.js +18 -39
  74. package/src/js/components/notification.js +49 -43
  75. package/src/js/components/parallax.js +16 -30
  76. package/src/js/components/slider-parallax.js +13 -23
  77. package/src/js/components/slider.js +75 -64
  78. package/src/js/components/slideshow-parallax.js +1 -1
  79. package/src/js/components/slideshow.js +8 -13
  80. package/src/js/components/sortable.js +125 -106
  81. package/src/js/components/tooltip.js +41 -31
  82. package/src/js/components/upload.js +52 -63
  83. package/src/js/core/accordion.js +53 -48
  84. package/src/js/core/alert.js +10 -17
  85. package/src/js/core/core.js +74 -53
  86. package/src/js/core/cover.js +11 -15
  87. package/src/js/core/drop.js +106 -92
  88. package/src/js/core/form-custom.js +20 -25
  89. package/src/js/core/gif.js +3 -7
  90. package/src/js/core/grid.js +57 -58
  91. package/src/js/core/height-match.js +16 -29
  92. package/src/js/core/height-viewport.js +28 -35
  93. package/src/js/core/icon.js +38 -50
  94. package/src/js/core/img.js +59 -58
  95. package/src/js/core/index.js +39 -39
  96. package/src/js/core/leader.js +9 -18
  97. package/src/js/core/margin.js +21 -37
  98. package/src/js/core/modal.js +50 -36
  99. package/src/js/core/nav.js +2 -4
  100. package/src/js/core/navbar.js +112 -88
  101. package/src/js/core/offcanvas.js +49 -53
  102. package/src/js/core/overflow-auto.js +13 -17
  103. package/src/js/core/responsive.js +14 -12
  104. package/src/js/core/scroll.js +10 -20
  105. package/src/js/core/scrollspy-nav.js +34 -31
  106. package/src/js/core/scrollspy.js +37 -54
  107. package/src/js/core/sticky.js +130 -91
  108. package/src/js/core/svg.js +60 -79
  109. package/src/js/core/switcher.js +47 -46
  110. package/src/js/core/tab.js +7 -10
  111. package/src/js/core/toggle.js +64 -66
  112. package/src/js/core/video.js +11 -22
  113. package/src/js/mixin/animate.js +19 -20
  114. package/src/js/mixin/class.js +2 -4
  115. package/src/js/mixin/container.js +7 -11
  116. package/src/js/mixin/internal/animate-fade.js +73 -30
  117. package/src/js/mixin/internal/animate-slide.js +61 -41
  118. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  119. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  120. package/src/js/mixin/media.js +5 -10
  121. package/src/js/mixin/modal.js +89 -66
  122. package/src/js/mixin/parallax.js +53 -48
  123. package/src/js/mixin/position.js +26 -20
  124. package/src/js/mixin/slider-autoplay.js +12 -21
  125. package/src/js/mixin/slider-drag.js +64 -65
  126. package/src/js/mixin/slider-nav.js +26 -35
  127. package/src/js/mixin/slider-reactive.js +2 -8
  128. package/src/js/mixin/slider.js +51 -50
  129. package/src/js/mixin/slideshow.js +13 -19
  130. package/src/js/mixin/togglable.js +90 -63
  131. package/src/js/uikit-core.js +2 -4
  132. package/src/js/uikit.js +2 -4
  133. package/src/js/util/ajax.js +27 -43
  134. package/src/js/util/animation.js +82 -75
  135. package/src/js/util/attr.js +17 -21
  136. package/src/js/util/class.js +14 -52
  137. package/src/js/util/dimensions.js +56 -43
  138. package/src/js/util/dom.js +40 -73
  139. package/src/js/util/env.js +7 -12
  140. package/src/js/util/event.js +60 -59
  141. package/src/js/util/fastdom.js +1 -6
  142. package/src/js/util/filter.js +17 -34
  143. package/src/js/util/index.js +0 -1
  144. package/src/js/util/lang.js +79 -119
  145. package/src/js/util/mouse.js +19 -17
  146. package/src/js/util/options.js +44 -49
  147. package/src/js/util/player.js +40 -36
  148. package/src/js/util/position.js +54 -46
  149. package/src/js/util/selector.js +34 -49
  150. package/src/js/util/style.js +36 -46
  151. package/src/js/util/viewport.js +75 -64
  152. package/tests/js/index.js +114 -85
  153. package/src/js/mixin/flex-bug.js +0 -56
  154. package/src/js/util/promise.js +0 -191
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.c2430c233 | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.c7ed3c19b | 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(require('uikit-util')) :
@@ -7,1840 +7,1621 @@
7
7
  })(this, (function (uikitUtil) { 'use strict';
8
8
 
9
9
  var Animations$1 = {
10
+ slide: {
11
+ show(dir) {
12
+ return [{ transform: translate(dir * -100) }, { transform: translate() }];
13
+ },
10
14
 
11
- slide: {
12
-
13
- show: function(dir) {
14
- return [
15
- {transform: translate(dir * -100)},
16
- {transform: translate()}
17
- ];
18
- },
15
+ percent(current) {
16
+ return translated(current);
17
+ },
19
18
 
20
- percent: function(current) {
21
- return translated(current);
22
- },
19
+ translate(percent, dir) {
20
+ return [
21
+ { transform: translate(dir * -100 * percent) },
22
+ { transform: translate(dir * 100 * (1 - percent)) }];
23
23
 
24
- translate: function(percent, dir) {
25
- return [
26
- {transform: translate(dir * -100 * percent)},
27
- {transform: translate(dir * 100 * (1 - percent))}
28
- ];
29
- }
24
+ } } };
30
25
 
31
- }
32
26
 
33
- };
34
27
 
35
28
  function translated(el) {
36
- return Math.abs(uikitUtil.css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
29
+ return Math.abs(uikitUtil.css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
37
30
  }
38
31
 
39
- function translate(value, unit) {
40
- if ( value === void 0 ) value = 0;
41
- if ( unit === void 0 ) unit = '%';
42
-
43
- value += value ? unit : '';
44
- return uikitUtil.isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently, not translate3d in IE, translate3d within translate3d does not work while transitioning
32
+ function translate(value, unit) {if (value === void 0) {value = 0;}if (unit === void 0) {unit = '%';}
33
+ value += value ? unit : '';
34
+ return "translate3d(" + value + ", 0, 0)";
45
35
  }
46
36
 
47
37
  function scale3d(value) {
48
- return ("scale3d(" + value + ", " + value + ", 1)");
38
+ return "scale3d(" + value + ", " + value + ", 1)";
49
39
  }
50
40
 
51
41
  var Animations = uikitUtil.assign({}, Animations$1, {
52
-
53
- fade: {
54
-
55
- show: function() {
56
- return [
57
- {opacity: 0},
58
- {opacity: 1}
59
- ];
60
- },
61
-
62
- percent: function(current) {
63
- return 1 - uikitUtil.css(current, 'opacity');
64
- },
65
-
66
- translate: function(percent) {
67
- return [
68
- {opacity: 1 - percent},
69
- {opacity: percent}
70
- ];
71
- }
72
-
42
+ fade: {
43
+ show() {
44
+ return [{ opacity: 0 }, { opacity: 1 }];
73
45
  },
74
46
 
75
- scale: {
76
-
77
- show: function() {
78
- return [
79
- {opacity: 0, transform: scale3d(1 - .2)},
80
- {opacity: 1, transform: scale3d(1)}
81
- ];
82
- },
83
-
84
- percent: function(current) {
85
- return 1 - uikitUtil.css(current, 'opacity');
86
- },
87
-
88
- translate: function(percent) {
89
- return [
90
- {opacity: 1 - percent, transform: scale3d(1 - .2 * percent)},
91
- {opacity: percent, transform: scale3d(1 - .2 + .2 * percent)}
92
- ];
93
- }
47
+ percent(current) {
48
+ return 1 - uikitUtil.css(current, 'opacity');
49
+ },
94
50
 
95
- }
51
+ translate(percent) {
52
+ return [{ opacity: 1 - percent }, { opacity: percent }];
53
+ } },
96
54
 
97
- });
98
55
 
99
- var Container = {
56
+ scale: {
57
+ show() {
58
+ return [
59
+ { opacity: 0, transform: scale3d(1 - 0.2) },
60
+ { opacity: 1, transform: scale3d(1) }];
100
61
 
101
- props: {
102
- container: Boolean
103
62
  },
104
63
 
105
- data: {
106
- container: true
64
+ percent(current) {
65
+ return 1 - uikitUtil.css(current, 'opacity');
107
66
  },
108
67
 
109
- computed: {
68
+ translate(percent) {
69
+ return [
70
+ { opacity: 1 - percent, transform: scale3d(1 - 0.2 * percent) },
71
+ { opacity: percent, transform: scale3d(1 - 0.2 + 0.2 * percent) }];
110
72
 
111
- container: function(ref) {
112
- var container = ref.container;
73
+ } } });
113
74
 
114
- return container === true && this.$container || container && uikitUtil.$(container);
115
- }
75
+ var Container = {
76
+ props: {
77
+ container: Boolean },
116
78
 
117
- }
118
79
 
119
- };
80
+ data: {
81
+ container: true },
120
82
 
121
- var Class = {
122
83
 
123
- connected: function() {
124
- !uikitUtil.hasClass(this.$el, this.$name) && uikitUtil.addClass(this.$el, this.$name);
125
- }
84
+ computed: {
85
+ container(_ref) {let { container } = _ref;
86
+ return container === true && this.$container || container && uikitUtil.$(container);
87
+ } } };
126
88
 
127
- };
89
+ var Class = {
90
+ connected() {
91
+ !uikitUtil.hasClass(this.$el, this.$name) && uikitUtil.addClass(this.$el, this.$name);
92
+ } };
128
93
 
129
94
  var Togglable = {
130
-
131
- props: {
132
- cls: Boolean,
133
- animation: 'list',
134
- duration: Number,
135
- origin: String,
136
- transition: String
95
+ props: {
96
+ cls: Boolean,
97
+ animation: 'list',
98
+ duration: Number,
99
+ origin: String,
100
+ transition: String },
101
+
102
+
103
+ data: {
104
+ cls: false,
105
+ animation: [false],
106
+ duration: 200,
107
+ origin: false,
108
+ transition: 'linear',
109
+ clsEnter: 'uk-togglabe-enter',
110
+ clsLeave: 'uk-togglabe-leave',
111
+
112
+ initProps: {
113
+ overflow: '',
114
+ height: '',
115
+ paddingTop: '',
116
+ paddingBottom: '',
117
+ marginTop: '',
118
+ marginBottom: '' },
119
+
120
+
121
+ hideProps: {
122
+ overflow: 'hidden',
123
+ height: 0,
124
+ paddingTop: 0,
125
+ paddingBottom: 0,
126
+ marginTop: 0,
127
+ marginBottom: 0 } },
128
+
129
+
130
+
131
+ computed: {
132
+ hasAnimation(_ref) {let { animation } = _ref;
133
+ return !!animation[0];
137
134
  },
138
135
 
139
- data: {
140
- cls: false,
141
- animation: [false],
142
- duration: 200,
143
- origin: false,
144
- transition: 'linear',
145
- clsEnter: 'uk-togglabe-enter',
146
- clsLeave: 'uk-togglabe-leave',
147
-
148
- initProps: {
149
- overflow: '',
150
- height: '',
151
- paddingTop: '',
152
- paddingBottom: '',
153
- marginTop: '',
154
- marginBottom: ''
155
- },
156
-
157
- hideProps: {
158
- overflow: 'hidden',
159
- height: 0,
160
- paddingTop: 0,
161
- paddingBottom: 0,
162
- marginTop: 0,
163
- marginBottom: 0
164
- }
165
-
166
- },
167
-
168
- computed: {
169
-
170
- hasAnimation: function(ref) {
171
- var animation = ref.animation;
136
+ hasTransition(_ref2) {let { animation } = _ref2;
137
+ return this.hasAnimation && animation[0] === true;
138
+ } },
172
139
 
173
- return !!animation[0];
174
- },
175
140
 
176
- hasTransition: function(ref) {
177
- var animation = ref.animation;
141
+ methods: {
142
+ toggleElement(targets, toggle, animate) {
143
+ return new Promise((resolve) =>
144
+ Promise.all(
145
+ uikitUtil.toNodes(targets).map((el) => {
146
+ const show = uikitUtil.isBoolean(toggle) ? toggle : !this.isToggled(el);
178
147
 
179
- return this.hasAnimation && animation[0] === true;
148
+ if (!uikitUtil.trigger(el, "before" + (show ? 'show' : 'hide'), [this])) {
149
+ return Promise.reject();
180
150
  }
181
151
 
182
- },
183
-
184
- methods: {
185
-
186
- toggleElement: function(targets, toggle, animate) {
187
- var this$1$1 = this;
188
-
189
- return new uikitUtil.Promise(function (resolve) { return uikitUtil.Promise.all(uikitUtil.toNodes(targets).map(function (el) {
190
-
191
- var show = uikitUtil.isBoolean(toggle) ? toggle : !this$1$1.isToggled(el);
192
-
193
- if (!uikitUtil.trigger(el, ("before" + (show ? 'show' : 'hide')), [this$1$1])) {
194
- return uikitUtil.Promise.reject();
195
- }
196
-
197
- var promise = (
198
- uikitUtil.isFunction(animate)
199
- ? animate
200
- : animate === false || !this$1$1.hasAnimation
201
- ? this$1$1._toggle
202
- : this$1$1.hasTransition
203
- ? toggleHeight(this$1$1)
204
- : toggleAnimation(this$1$1)
205
- )(el, show);
206
-
207
- var cls = show ? this$1$1.clsEnter : this$1$1.clsLeave;
208
-
209
- uikitUtil.addClass(el, cls);
210
-
211
- uikitUtil.trigger(el, show ? 'show' : 'hide', [this$1$1]);
152
+ const promise = (
153
+ uikitUtil.isFunction(animate) ?
154
+ animate :
155
+ animate === false || !this.hasAnimation ?
156
+ this._toggle :
157
+ this.hasTransition ?
158
+ toggleHeight(this) :
159
+ toggleAnimation(this))(
160
+ el, show);
161
+
162
+ const cls = show ? this.clsEnter : this.clsLeave;
163
+
164
+ uikitUtil.addClass(el, cls);
165
+
166
+ uikitUtil.trigger(el, show ? 'show' : 'hide', [this]);
167
+
168
+ const done = () => {
169
+ uikitUtil.removeClass(el, cls);
170
+ uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this]);
171
+ this.$update(el);
172
+ };
173
+
174
+ return promise ?
175
+ promise.then(done, () => {
176
+ uikitUtil.removeClass(el, cls);
177
+ return Promise.reject();
178
+ }) :
179
+ done();
180
+ })).
181
+ then(resolve, uikitUtil.noop));
212
182
 
213
- var done = function () {
214
- uikitUtil.removeClass(el, cls);
215
- uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this$1$1]);
216
- this$1$1.$update(el);
217
- };
183
+ },
218
184
 
219
- return promise ? promise.then(done, function () {
220
- uikitUtil.removeClass(el, cls);
221
- return uikitUtil.Promise.reject();
222
- }) : done();
185
+ isToggled(el) {if (el === void 0) {el = this.$el;}
186
+ [el] = uikitUtil.toNodes(el);
187
+ return uikitUtil.hasClass(el, this.clsEnter) ?
188
+ true :
189
+ uikitUtil.hasClass(el, this.clsLeave) ?
190
+ false :
191
+ this.cls ?
192
+ uikitUtil.hasClass(el, this.cls.split(' ')[0]) :
193
+ uikitUtil.isVisible(el);
194
+ },
223
195
 
224
- })).then(resolve, uikitUtil.noop); }
225
- );
226
- },
196
+ _toggle(el, toggled) {
197
+ if (!el) {
198
+ return;
199
+ }
227
200
 
228
- isToggled: function(el) {
229
- var assign;
201
+ toggled = Boolean(toggled);
230
202
 
231
- if ( el === void 0 ) el = this.$el;
232
- (assign = uikitUtil.toNodes(el), el = assign[0]);
233
- return uikitUtil.hasClass(el, this.clsEnter)
234
- ? true
235
- : uikitUtil.hasClass(el, this.clsLeave)
236
- ? false
237
- : this.cls
238
- ? uikitUtil.hasClass(el, this.cls.split(' ')[0])
239
- : uikitUtil.isVisible(el);
240
- },
203
+ let changed;
204
+ if (this.cls) {
205
+ changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls);
206
+ changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled);
207
+ } else {
208
+ changed = toggled === el.hidden;
209
+ changed && (el.hidden = !toggled);
210
+ }
241
211
 
242
- _toggle: function(el, toggled) {
212
+ uikitUtil.$$('[autofocus]', el).some((el) => uikitUtil.isVisible(el) ? el.focus() || true : el.blur());
243
213
 
244
- if (!el) {
245
- return;
246
- }
214
+ if (changed) {
215
+ uikitUtil.trigger(el, 'toggled', [toggled, this]);
216
+ this.$update(el);
217
+ }
218
+ } } };
247
219
 
248
- toggled = Boolean(toggled);
249
220
 
250
- var changed;
251
- if (this.cls) {
252
- changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls);
253
- changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled);
254
- } else {
255
- changed = toggled === el.hidden;
256
- changed && (el.hidden = !toggled);
257
- }
258
221
 
259
- uikitUtil.$$('[autofocus]', el).some(function (el) { return uikitUtil.isVisible(el) ? el.focus() || true : el.blur(); });
222
+ function toggleHeight(_ref3) {let { isToggled, duration, initProps, hideProps, transition, _toggle } = _ref3;
223
+ return (el, show) => {
224
+ const inProgress = uikitUtil.Transition.inProgress(el);
225
+ const inner = el.hasChildNodes ?
226
+ uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) +
227
+ uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) :
228
+ 0;
229
+ const currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0;
260
230
 
261
- if (changed) {
262
- uikitUtil.trigger(el, 'toggled', [toggled, this]);
263
- this.$update(el);
264
- }
265
- }
231
+ uikitUtil.Transition.cancel(el);
266
232
 
233
+ if (!isToggled(el)) {
234
+ _toggle(el, true);
267
235
  }
268
236
 
269
- };
270
-
271
- function toggleHeight(ref) {
272
- var isToggled = ref.isToggled;
273
- var duration = ref.duration;
274
- var initProps = ref.initProps;
275
- var hideProps = ref.hideProps;
276
- var transition = ref.transition;
277
- var _toggle = ref._toggle;
278
-
279
- return function (el, show) {
280
-
281
- var inProgress = uikitUtil.Transition.inProgress(el);
282
- var inner = el.hasChildNodes ? uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) + uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) : 0;
283
- var currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0;
284
-
285
- uikitUtil.Transition.cancel(el);
286
-
287
- if (!isToggled(el)) {
288
- _toggle(el, true);
289
- }
290
-
291
- uikitUtil.height(el, '');
292
-
293
- // Update child components first
294
- uikitUtil.fastdom.flush();
295
-
296
- var endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner);
297
- uikitUtil.height(el, currentHeight);
298
-
299
- return (show
300
- ? uikitUtil.Transition.start(el, uikitUtil.assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition)
301
- : uikitUtil.Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); })
302
- ).then(function () { return uikitUtil.css(el, initProps); });
303
-
304
- };
237
+ uikitUtil.height(el, '');
238
+
239
+ // Update child components first
240
+ uikitUtil.fastdom.flush();
241
+
242
+ const endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner);
243
+ uikitUtil.height(el, currentHeight);
244
+
245
+ return (
246
+ show ?
247
+ uikitUtil.Transition.start(
248
+ el,
249
+ uikitUtil.assign({}, initProps, { overflow: 'hidden', height: endHeight }),
250
+ Math.round(duration * (1 - currentHeight / endHeight)),
251
+ transition) :
252
+
253
+ uikitUtil.Transition.start(
254
+ el,
255
+ hideProps,
256
+ Math.round(duration * (currentHeight / endHeight)),
257
+ transition).
258
+ then(() => _toggle(el, false))).
259
+ then(() => uikitUtil.css(el, initProps));
260
+ };
305
261
  }
306
262
 
307
263
  function toggleAnimation(cmp) {
308
- return function (el, show) {
264
+ return (el, show) => {
265
+ uikitUtil.Animation.cancel(el);
309
266
 
310
- uikitUtil.Animation.cancel(el);
267
+ const { animation, duration, _toggle } = cmp;
311
268
 
312
- var animation = cmp.animation;
313
- var duration = cmp.duration;
314
- var _toggle = cmp._toggle;
269
+ if (show) {
270
+ _toggle(el, true);
271
+ return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin);
272
+ }
315
273
 
316
- if (show) {
317
- _toggle(el, true);
318
- return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin);
319
- }
274
+ return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(() =>
275
+ _toggle(el, false));
320
276
 
321
- return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(function () { return _toggle(el, false); });
322
- };
277
+ };
323
278
  }
324
279
 
325
- var active = [];
280
+ const active = [];
326
281
 
327
282
  var Modal = {
283
+ mixins: [Class, Container, Togglable],
328
284
 
329
- mixins: [Class, Container, Togglable],
285
+ props: {
286
+ selPanel: String,
287
+ selClose: String,
288
+ escClose: Boolean,
289
+ bgClose: Boolean,
290
+ stack: Boolean },
330
291
 
331
- props: {
332
- selPanel: String,
333
- selClose: String,
334
- escClose: Boolean,
335
- bgClose: Boolean,
336
- stack: Boolean
337
- },
338
292
 
339
- data: {
340
- cls: 'uk-open',
341
- escClose: true,
342
- bgClose: true,
343
- overlay: true,
344
- stack: false
345
- },
346
-
347
- computed: {
348
-
349
- panel: function(ref, $el) {
350
- var selPanel = ref.selPanel;
351
-
352
- return uikitUtil.$(selPanel, $el);
353
- },
354
-
355
- transitionElement: function() {
356
- return this.panel;
357
- },
293
+ data: {
294
+ cls: 'uk-open',
295
+ escClose: true,
296
+ bgClose: true,
297
+ overlay: true,
298
+ stack: false },
358
299
 
359
- bgClose: function(ref) {
360
- var bgClose = ref.bgClose;
361
-
362
- return bgClose && this.panel;
363
- }
364
300
 
301
+ computed: {
302
+ panel(_ref, $el) {let { selPanel } = _ref;
303
+ return uikitUtil.$(selPanel, $el);
365
304
  },
366
305
 
367
- beforeDisconnect: function() {
368
- if (uikitUtil.includes(active, this)) {
369
- this.toggleElement(this.$el, false, false);
370
- }
306
+ transitionElement() {
307
+ return this.panel;
371
308
  },
372
309
 
373
- events: [
374
-
375
- {
376
-
377
- name: 'click',
378
-
379
- delegate: function() {
380
- return this.selClose;
381
- },
382
-
383
- handler: function(e) {
384
- e.preventDefault();
385
- this.hide();
386
- }
387
-
388
- },
389
-
390
- {
391
-
392
- name: 'toggle',
393
-
394
- self: true,
395
-
396
- handler: function(e, toggle) {
310
+ bgClose(_ref2) {let { bgClose } = _ref2;
311
+ return bgClose && this.panel;
312
+ } },
397
313
 
398
- if (e.defaultPrevented) {
399
- return;
400
- }
401
314
 
402
- e.preventDefault();
315
+ beforeDisconnect() {
316
+ if (uikitUtil.includes(active, this)) {
317
+ this.toggleElement(this.$el, false, false);
318
+ }
319
+ },
403
320
 
404
- if (this.isToggled() === uikitUtil.includes(active, this)) {
405
- this.toggle();
406
- }
407
- }
321
+ events: [
322
+ {
323
+ name: 'click',
408
324
 
409
- },
325
+ delegate() {
326
+ return this.selClose;
327
+ },
410
328
 
411
- {
412
- name: 'beforeshow',
329
+ handler(e) {
330
+ e.preventDefault();
331
+ this.hide();
332
+ } },
413
333
 
414
- self: true,
415
334
 
416
- handler: function(e) {
335
+ {
336
+ name: 'toggle',
417
337
 
418
- if (uikitUtil.includes(active, this)) {
419
- return false;
420
- }
338
+ self: true,
421
339
 
422
- if (!this.stack && active.length) {
423
- uikitUtil.Promise.all(active.map(function (modal) { return modal.hide(); })).then(this.show);
424
- e.preventDefault();
425
- } else {
426
- active.push(this);
427
- }
428
- }
340
+ handler(e) {
341
+ if (e.defaultPrevented) {
342
+ return;
343
+ }
429
344
 
430
- },
345
+ e.preventDefault();
431
346
 
432
- {
347
+ if (this.isToggled() === uikitUtil.includes(active, this)) {
348
+ this.toggle();
349
+ }
350
+ } },
433
351
 
434
- name: 'show',
435
352
 
436
- self: true,
353
+ {
354
+ name: 'beforeshow',
437
355
 
438
- handler: function() {
439
- var this$1$1 = this;
356
+ self: true,
440
357
 
358
+ handler(e) {
359
+ if (uikitUtil.includes(active, this)) {
360
+ return false;
361
+ }
441
362
 
442
- var docEl = document.documentElement;
363
+ if (!this.stack && active.length) {
364
+ Promise.all(active.map((modal) => modal.hide())).then(this.show);
365
+ e.preventDefault();
366
+ } else {
367
+ active.push(this);
368
+ }
369
+ } },
443
370
 
444
- if (uikitUtil.width(window) > docEl.clientWidth && this.overlay) {
445
- uikitUtil.css(document.body, 'overflowY', 'scroll');
446
- }
447
371
 
448
- if (this.stack) {
449
- uikitUtil.css(this.$el, 'zIndex', uikitUtil.toFloat(uikitUtil.css(this.$el, 'zIndex')) + active.length);
450
- }
372
+ {
373
+ name: 'show',
451
374
 
452
- uikitUtil.addClass(docEl, this.clsPage);
375
+ self: true,
453
376
 
454
- if (this.bgClose) {
455
- uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, uikitUtil.pointerDown, function (ref) {
456
- var target = ref.target;
377
+ handler() {
378
+ const docEl = document.documentElement;
457
379
 
380
+ if (uikitUtil.width(window) > docEl.clientWidth && this.overlay) {
381
+ uikitUtil.css(document.body, 'overflowY', 'scroll');
382
+ }
458
383
 
459
- if (uikitUtil.last(active) !== this$1$1 || this$1$1.overlay && !uikitUtil.within(target, this$1$1.$el) || uikitUtil.within(target, this$1$1.panel)) {
460
- return;
461
- }
384
+ if (this.stack) {
385
+ uikitUtil.css(this.$el, 'zIndex', uikitUtil.toFloat(uikitUtil.css(this.$el, 'zIndex')) + active.length);
386
+ }
462
387
 
463
- uikitUtil.once(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " scroll"), function (ref) {
464
- var defaultPrevented = ref.defaultPrevented;
465
- var type = ref.type;
466
- var newTarget = ref.target;
388
+ uikitUtil.addClass(docEl, this.clsPage);
467
389
 
468
- if (!defaultPrevented && type === uikitUtil.pointerUp && target === newTarget) {
469
- this$1$1.hide();
470
- }
471
- }, true);
390
+ if (this.bgClose) {
391
+ uikitUtil.once(
392
+ this.$el,
393
+ 'hide',
394
+ uikitUtil.on(document, uikitUtil.pointerDown, (_ref3) => {let { target } = _ref3;
395
+ if (
396
+ uikitUtil.last(active) !== this ||
397
+ this.overlay && !uikitUtil.within(target, this.$el) ||
398
+ uikitUtil.within(target, this.panel))
399
+ {
400
+ return;
401
+ }
472
402
 
473
- }), {self: true});
474
- }
475
-
476
- if (this.escClose) {
477
- uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, 'keydown', function (e) {
478
- if (e.keyCode === 27 && uikitUtil.last(active) === this$1$1) {
479
- this$1$1.hide();
480
- }
481
- }), {self: true});
482
- }
403
+ uikitUtil.once(
404
+ document,
405
+ uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " scroll",
406
+ (_ref4) => {let { defaultPrevented, type, target: newTarget } = _ref4;
407
+ if (
408
+ !defaultPrevented &&
409
+ type === uikitUtil.pointerUp &&
410
+ target === newTarget)
411
+ {
412
+ this.hide();
483
413
  }
414
+ },
415
+ true);
484
416
 
485
- },
417
+ }),
418
+ { self: true });
486
419
 
487
- {
488
- name: 'shown',
420
+ }
489
421
 
490
- self: true,
422
+ if (this.escClose) {
423
+ uikitUtil.once(
424
+ this.$el,
425
+ 'hide',
426
+ uikitUtil.on(document, 'keydown', (e) => {
427
+ if (e.keyCode === 27 && uikitUtil.last(active) === this) {
428
+ this.hide();
429
+ }
430
+ }),
431
+ { self: true });
491
432
 
492
- handler: function() {
493
- if (!uikitUtil.isFocusable(this.$el)) {
494
- uikitUtil.attr(this.$el, 'tabindex', '-1');
495
- }
433
+ }
434
+ } },
496
435
 
497
- if (!uikitUtil.$(':focus', this.$el)) {
498
- this.$el.focus();
499
- }
500
- }
501
- },
502
436
 
503
- {
437
+ {
438
+ name: 'shown',
504
439
 
505
- name: 'hidden',
440
+ self: true,
506
441
 
507
- self: true,
442
+ handler() {
443
+ if (!uikitUtil.isFocusable(this.$el)) {
444
+ uikitUtil.attr(this.$el, 'tabindex', '-1');
445
+ }
508
446
 
509
- handler: function() {
510
- var this$1$1 = this;
447
+ if (!uikitUtil.$(':focus', this.$el)) {
448
+ this.$el.focus();
449
+ }
450
+ } },
511
451
 
512
452
 
513
- if (uikitUtil.includes(active, this)) {
514
- active.splice(active.indexOf(this), 1);
515
- }
453
+ {
454
+ name: 'hidden',
516
455
 
517
- if (!active.length) {
518
- uikitUtil.css(document.body, 'overflowY', '');
519
- }
456
+ self: true,
520
457
 
521
- uikitUtil.css(this.$el, 'zIndex', '');
458
+ handler() {
459
+ if (uikitUtil.includes(active, this)) {
460
+ active.splice(active.indexOf(this), 1);
461
+ }
522
462
 
523
- if (!active.some(function (modal) { return modal.clsPage === this$1$1.clsPage; })) {
524
- uikitUtil.removeClass(document.documentElement, this.clsPage);
525
- }
463
+ if (!active.length) {
464
+ uikitUtil.css(document.body, 'overflowY', '');
465
+ }
526
466
 
527
- }
467
+ uikitUtil.css(this.$el, 'zIndex', '');
528
468
 
529
- }
469
+ if (!active.some((modal) => modal.clsPage === this.clsPage)) {
470
+ uikitUtil.removeClass(document.documentElement, this.clsPage);
471
+ }
472
+ } }],
530
473
 
531
- ],
532
474
 
533
- methods: {
534
475
 
535
- toggle: function() {
536
- return this.isToggled() ? this.hide() : this.show();
537
- },
476
+ methods: {
477
+ toggle() {
478
+ return this.isToggled() ? this.hide() : this.show();
479
+ },
538
480
 
539
- show: function() {
540
- var this$1$1 = this;
481
+ show() {
482
+ if (this.container && uikitUtil.parent(this.$el) !== this.container) {
483
+ uikitUtil.append(this.container, this.$el);
484
+ return new Promise((resolve) =>
485
+ requestAnimationFrame(() => this.show().then(resolve)));
541
486
 
542
- if (this.container && uikitUtil.parent(this.$el) !== this.container) {
543
- uikitUtil.append(this.container, this.$el);
544
- return new uikitUtil.Promise(function (resolve) { return requestAnimationFrame(function () { return this$1$1.show().then(resolve); }
545
- ); }
546
- );
547
- }
487
+ }
548
488
 
549
- return this.toggleElement(this.$el, true, animate(this));
550
- },
489
+ return this.toggleElement(this.$el, true, animate(this));
490
+ },
551
491
 
552
- hide: function() {
553
- return this.toggleElement(this.$el, false, animate(this));
554
- }
492
+ hide() {
493
+ return this.toggleElement(this.$el, false, animate(this));
494
+ } } };
555
495
 
556
- }
557
496
 
558
- };
559
497
 
560
- function animate(ref) {
561
- var transitionElement = ref.transitionElement;
562
- var _toggle = ref._toggle;
498
+ function animate(_ref5) {let { transitionElement, _toggle } = _ref5;
499
+ return (el, show) =>
500
+ new Promise((resolve, reject) =>
501
+ uikitUtil.once(el, 'show hide', () => {
502
+ el._reject && el._reject();
503
+ el._reject = reject;
563
504
 
564
- return function (el, show) { return new uikitUtil.Promise(function (resolve, reject) { return uikitUtil.once(el, 'show hide', function () {
565
- el._reject && el._reject();
566
- el._reject = reject;
505
+ _toggle(el, show);
567
506
 
568
- _toggle(el, show);
507
+ const off = uikitUtil.once(
508
+ transitionElement,
509
+ 'transitionstart',
510
+ () => {
511
+ uikitUtil.once(transitionElement, 'transitionend transitioncancel', resolve, {
512
+ self: true });
569
513
 
570
- var off = uikitUtil.once(transitionElement, 'transitionstart', function () {
571
- uikitUtil.once(transitionElement, 'transitionend transitioncancel', resolve, {self: true});
572
- clearTimeout(timer);
573
- }, {self: true});
514
+ clearTimeout(timer);
515
+ },
516
+ { self: true });
574
517
 
575
- var timer = setTimeout(function () {
576
- off();
577
- resolve();
578
- }, uikitUtil.toMs(uikitUtil.css(transitionElement, 'transitionDuration')));
579
518
 
580
- }); }
581
- ).then(function () { return delete el._reject; }); };
519
+ const timer = setTimeout(() => {
520
+ off();
521
+ resolve();
522
+ }, uikitUtil.toMs(uikitUtil.css(transitionElement, 'transitionDuration')));
523
+ })).
524
+ then(() => delete el._reject);
582
525
  }
583
526
 
584
- function Transitioner(prev, next, dir, ref) {
585
- var animation = ref.animation;
586
- var easing = ref.easing;
587
-
588
-
589
- var percent = animation.percent;
590
- var translate = animation.translate;
591
- var show = animation.show; if ( show === void 0 ) show = uikitUtil.noop;
592
- var props = show(dir);
593
- var deferred = new uikitUtil.Deferred();
594
-
595
- return {
527
+ function Transitioner(prev, next, dir, _ref) {let { animation, easing } = _ref;
528
+ const { percent, translate, show = uikitUtil.noop } = animation;
529
+ const props = show(dir);
530
+ const deferred = new uikitUtil.Deferred();
596
531
 
597
- dir: dir,
532
+ return {
533
+ dir,
598
534
 
599
- show: function(duration, percent, linear) {
600
- var this$1$1 = this;
601
- if ( percent === void 0 ) percent = 0;
535
+ show(duration, percent, linear) {if (percent === void 0) {percent = 0;}
536
+ const timing = linear ? 'linear' : easing;
537
+ duration -= Math.round(duration * uikitUtil.clamp(percent, -1, 1));
602
538
 
539
+ this.translate(percent);
603
540
 
604
- var timing = linear ? 'linear' : easing;
605
- duration -= Math.round(duration * uikitUtil.clamp(percent, -1, 1));
541
+ triggerUpdate(next, 'itemin', { percent, duration, timing, dir });
542
+ triggerUpdate(prev, 'itemout', { percent: 1 - percent, duration, timing, dir });
606
543
 
607
- this.translate(percent);
544
+ Promise.all([
545
+ uikitUtil.Transition.start(next, props[1], duration, timing),
546
+ uikitUtil.Transition.start(prev, props[0], duration, timing)]).
547
+ then(() => {
548
+ this.reset();
549
+ deferred.resolve();
550
+ }, uikitUtil.noop);
608
551
 
609
- triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
610
- triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
611
-
612
- uikitUtil.Promise.all([
613
- uikitUtil.Transition.start(next, props[1], duration, timing),
614
- uikitUtil.Transition.start(prev, props[0], duration, timing)
615
- ]).then(function () {
616
- this$1$1.reset();
617
- deferred.resolve();
618
- }, uikitUtil.noop);
619
-
620
- return deferred.promise;
621
- },
622
-
623
- cancel: function() {
624
- uikitUtil.Transition.cancel([next, prev]);
625
- },
626
-
627
- reset: function() {
628
- for (var prop in props[0]) {
629
- uikitUtil.css([next, prev], prop, '');
630
- }
631
- },
632
-
633
- forward: function(duration, percent) {
634
- if ( percent === void 0 ) percent = this.percent();
635
-
636
- uikitUtil.Transition.cancel([next, prev]);
637
- return this.show(duration, percent, true);
638
- },
639
-
640
- translate: function(percent) {
641
-
642
- this.reset();
643
-
644
- var props = translate(percent, dir);
645
- uikitUtil.css(next, props[1]);
646
- uikitUtil.css(prev, props[0]);
647
- triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir});
648
- triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir});
649
-
650
- },
651
-
652
- percent: function() {
653
- return percent(prev || next, next, dir);
654
- },
655
-
656
- getDistance: function() {
657
- return prev && prev.offsetWidth;
658
- }
659
-
660
- };
661
-
662
- }
663
-
664
- function triggerUpdate(el, type, data) {
665
- uikitUtil.trigger(el, uikitUtil.createEvent(type, false, false, data));
666
- }
667
-
668
- var SliderAutoplay = {
669
-
670
- props: {
671
- autoplay: Boolean,
672
- autoplayInterval: Number,
673
- pauseOnHover: Boolean
674
- },
675
-
676
- data: {
677
- autoplay: false,
678
- autoplayInterval: 7000,
679
- pauseOnHover: true
552
+ return deferred.promise;
680
553
  },
681
554
 
682
- connected: function() {
683
- this.autoplay && this.startAutoplay();
555
+ cancel() {
556
+ uikitUtil.Transition.cancel([next, prev]);
684
557
  },
685
558
 
686
- disconnected: function() {
687
- this.stopAutoplay();
559
+ reset() {
560
+ for (const prop in props[0]) {
561
+ uikitUtil.css([next, prev], prop, '');
562
+ }
688
563
  },
689
564
 
690
- update: function() {
691
- uikitUtil.attr(this.slides, 'tabindex', '-1');
565
+ forward(duration, percent) {if (percent === void 0) {percent = this.percent();}
566
+ uikitUtil.Transition.cancel([next, prev]);
567
+ return this.show(duration, percent, true);
692
568
  },
693
569
 
694
- events: [
695
-
696
- {
697
-
698
- name: 'visibilitychange',
699
-
700
- el: function() {
701
- return document;
702
- },
570
+ translate(percent) {
571
+ this.reset();
703
572
 
704
- filter: function() {
705
- return this.autoplay;
706
- },
707
-
708
- handler: function() {
709
- if (document.hidden) {
710
- this.stopAutoplay();
711
- } else {
712
- this.startAutoplay();
713
- }
714
- }
573
+ const props = translate(percent, dir);
574
+ uikitUtil.css(next, props[1]);
575
+ uikitUtil.css(prev, props[0]);
576
+ triggerUpdate(next, 'itemtranslatein', { percent, dir });
577
+ triggerUpdate(prev, 'itemtranslateout', { percent: 1 - percent, dir });
578
+ },
715
579
 
716
- }
580
+ percent() {
581
+ return percent(prev || next, next, dir);
582
+ },
717
583
 
718
- ],
584
+ getDistance() {
585
+ return prev == null ? void 0 : prev.offsetWidth;
586
+ } };
719
587
 
720
- methods: {
588
+ }
721
589
 
722
- startAutoplay: function() {
723
- var this$1$1 = this;
590
+ function triggerUpdate(el, type, data) {
591
+ uikitUtil.trigger(el, uikitUtil.createEvent(type, false, false, data));
592
+ }
724
593
 
594
+ var SliderAutoplay = {
595
+ props: {
596
+ autoplay: Boolean,
597
+ autoplayInterval: Number,
598
+ pauseOnHover: Boolean },
725
599
 
726
- this.stopAutoplay();
727
600
 
728
- this.interval = setInterval(
729
- function () { return (!this$1$1.draggable || !uikitUtil.$(':focus', this$1$1.$el))
730
- && (!this$1$1.pauseOnHover || !uikitUtil.matches(this$1$1.$el, ':hover'))
731
- && !this$1$1.stack.length
732
- && this$1$1.show('next'); },
733
- this.autoplayInterval
734
- );
601
+ data: {
602
+ autoplay: false,
603
+ autoplayInterval: 7000,
604
+ pauseOnHover: true },
735
605
 
736
- },
737
606
 
738
- stopAutoplay: function() {
739
- this.interval && clearInterval(this.interval);
740
- }
607
+ connected() {
608
+ this.autoplay && this.startAutoplay();
609
+ },
741
610
 
742
- }
611
+ disconnected() {
612
+ this.stopAutoplay();
613
+ },
743
614
 
744
- };
615
+ update() {
616
+ uikitUtil.attr(this.slides, 'tabindex', '-1');
617
+ },
745
618
 
746
- var SliderDrag = {
619
+ events: [
620
+ {
621
+ name: 'visibilitychange',
747
622
 
748
- props: {
749
- draggable: Boolean
623
+ el() {
624
+ return document;
750
625
  },
751
626
 
752
- data: {
753
- draggable: true,
754
- threshold: 10
627
+ filter() {
628
+ return this.autoplay;
755
629
  },
756
630
 
757
- created: function() {
758
- var this$1$1 = this;
759
-
760
-
761
- ['start', 'move', 'end'].forEach(function (key) {
762
-
763
- var fn = this$1$1[key];
764
- this$1$1[key] = function (e) {
631
+ handler() {
632
+ if (document.hidden) {
633
+ this.stopAutoplay();
634
+ } else {
635
+ this.startAutoplay();
636
+ }
637
+ } }],
765
638
 
766
- var pos = uikitUtil.getEventPos(e).x * (uikitUtil.isRtl ? -1 : 1);
767
639
 
768
- this$1$1.prevPos = pos !== this$1$1.pos ? this$1$1.pos : this$1$1.prevPos;
769
- this$1$1.pos = pos;
770
640
 
771
- fn(e);
772
- };
641
+ methods: {
642
+ startAutoplay() {
643
+ this.stopAutoplay();
773
644
 
774
- });
645
+ this.interval = setInterval(
646
+ () =>
647
+ (!this.draggable || !uikitUtil.$(':focus', this.$el)) && (
648
+ !this.pauseOnHover || !uikitUtil.matches(this.$el, ':hover')) &&
649
+ !this.stack.length &&
650
+ this.show('next'),
651
+ this.autoplayInterval);
775
652
 
776
653
  },
777
654
 
778
- events: [
779
-
780
- {
781
-
782
- name: uikitUtil.pointerDown,
655
+ stopAutoplay() {
656
+ this.interval && clearInterval(this.interval);
657
+ } } };
783
658
 
784
- delegate: function() {
785
- return this.selSlides;
786
- },
787
-
788
- handler: function(e) {
789
-
790
- if (!this.draggable
791
- || !uikitUtil.isTouch(e) && hasTextNodesOnly(e.target)
792
- || uikitUtil.closest(e.target, uikitUtil.selInput)
793
- || e.button > 0
794
- || this.length < 2
795
- ) {
796
- return;
797
- }
798
-
799
- this.start(e);
800
- }
801
-
802
- },
803
-
804
- {
805
- name: 'dragstart',
806
-
807
- handler: function(e) {
808
- e.preventDefault();
809
- }
810
- }
811
-
812
- ],
813
-
814
- methods: {
659
+ var SliderDrag = {
660
+ props: {
661
+ draggable: Boolean },
815
662
 
816
- start: function() {
817
663
 
818
- this.drag = this.pos;
664
+ data: {
665
+ draggable: true,
666
+ threshold: 10 },
819
667
 
820
- if (this._transitioner) {
821
668
 
822
- this.percent = this._transitioner.percent();
823
- this.drag += this._transitioner.getDistance() * this.percent * this.dir;
669
+ created() {
670
+ for (const key of ['start', 'move', 'end']) {
671
+ const fn = this[key];
672
+ this[key] = (e) => {
673
+ const pos = uikitUtil.getEventPos(e).x * (uikitUtil.isRtl ? -1 : 1);
824
674
 
825
- this._transitioner.cancel();
826
- this._transitioner.translate(this.percent);
675
+ this.prevPos = pos === this.pos ? this.prevPos : this.pos;
676
+ this.pos = pos;
827
677
 
828
- this.dragging = true;
678
+ fn(e);
679
+ };
680
+ }
681
+ },
829
682
 
830
- this.stack = [];
683
+ events: [
684
+ {
685
+ name: uikitUtil.pointerDown,
831
686
 
832
- } else {
833
- this.prevIndex = this.index;
834
- }
835
-
836
- uikitUtil.on(document, uikitUtil.pointerMove, this.move, {passive: false});
687
+ delegate() {
688
+ return this.selSlides;
689
+ },
837
690
 
838
- // 'input' event is triggered by video controls
839
- uikitUtil.on(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input"), this.end, true);
691
+ handler(e) {
692
+ if (
693
+ !this.draggable ||
694
+ !uikitUtil.isTouch(e) && hasTextNodesOnly(e.target) ||
695
+ uikitUtil.closest(e.target, uikitUtil.selInput) ||
696
+ e.button > 0 ||
697
+ this.length < 2)
698
+ {
699
+ return;
700
+ }
840
701
 
841
- uikitUtil.css(this.list, 'userSelect', 'none');
702
+ this.start(e);
703
+ } },
842
704
 
843
- },
844
705
 
845
- move: function(e) {
846
- var this$1$1 = this;
706
+ {
707
+ name: 'dragstart',
847
708
 
709
+ handler(e) {
710
+ e.preventDefault();
711
+ } }],
848
712
 
849
- var distance = this.pos - this.drag;
850
713
 
851
- if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
852
- return;
853
- }
854
714
 
855
- // prevent click event
856
- uikitUtil.css(this.list, 'pointerEvents', 'none');
715
+ methods: {
716
+ start() {
717
+ this.drag = this.pos;
857
718
 
858
- e.cancelable && e.preventDefault();
719
+ if (this._transitioner) {
720
+ this.percent = this._transitioner.percent();
721
+ this.drag += this._transitioner.getDistance() * this.percent * this.dir;
859
722
 
860
- this.dragging = true;
861
- this.dir = (distance < 0 ? 1 : -1);
723
+ this._transitioner.cancel();
724
+ this._transitioner.translate(this.percent);
862
725
 
863
- var ref = this;
864
- var slides = ref.slides;
865
- var ref$1 = this;
866
- var prevIndex = ref$1.prevIndex;
867
- var dis = Math.abs(distance);
868
- var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
869
- var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
726
+ this.dragging = true;
870
727
 
871
- while (nextIndex !== prevIndex && dis > width) {
728
+ this.stack = [];
729
+ } else {
730
+ this.prevIndex = this.index;
731
+ }
872
732
 
873
- this.drag -= width * this.dir;
733
+ uikitUtil.on(document, uikitUtil.pointerMove, this.move, { passive: false });
874
734
 
875
- prevIndex = nextIndex;
876
- dis -= width;
877
- nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
878
- width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
735
+ // 'input' event is triggered by video controls
736
+ uikitUtil.on(document, uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input", this.end, true);
879
737
 
880
- }
738
+ uikitUtil.css(this.list, 'userSelect', 'none');
739
+ },
881
740
 
882
- this.percent = dis / width;
741
+ move(e) {
742
+ const distance = this.pos - this.drag;
883
743
 
884
- var prev = slides[prevIndex];
885
- var next = slides[nextIndex];
886
- var changed = this.index !== nextIndex;
887
- var edge = prevIndex === nextIndex;
744
+ if (
745
+ distance === 0 ||
746
+ this.prevPos === this.pos ||
747
+ !this.dragging && Math.abs(distance) < this.threshold)
748
+ {
749
+ return;
750
+ }
888
751
 
889
- var itemShown;
752
+ // prevent click event
753
+ uikitUtil.css(this.list, 'pointerEvents', 'none');
890
754
 
891
- [this.index, this.prevIndex].filter(function (i) { return !uikitUtil.includes([nextIndex, prevIndex], i); }).forEach(function (i) {
892
- uikitUtil.trigger(slides[i], 'itemhidden', [this$1$1]);
755
+ e.cancelable && e.preventDefault();
893
756
 
894
- if (edge) {
895
- itemShown = true;
896
- this$1$1.prevIndex = prevIndex;
897
- }
757
+ this.dragging = true;
758
+ this.dir = distance < 0 ? 1 : -1;
898
759
 
899
- });
760
+ const { slides } = this;
761
+ let { prevIndex } = this;
762
+ let dis = Math.abs(distance);
763
+ let nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
764
+ let width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
900
765
 
901
- if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
902
- uikitUtil.trigger(slides[this.index], 'itemshown', [this]);
903
- }
766
+ while (nextIndex !== prevIndex && dis > width) {
767
+ this.drag -= width * this.dir;
904
768
 
905
- if (changed) {
906
- this.prevIndex = prevIndex;
907
- this.index = nextIndex;
769
+ prevIndex = nextIndex;
770
+ dis -= width;
771
+ nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
772
+ width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
773
+ }
908
774
 
909
- !edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]);
910
- uikitUtil.trigger(next, 'beforeitemshow', [this]);
911
- }
775
+ this.percent = dis / width;
912
776
 
913
- this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
777
+ const prev = slides[prevIndex];
778
+ const next = slides[nextIndex];
779
+ const changed = this.index !== nextIndex;
780
+ const edge = prevIndex === nextIndex;
914
781
 
915
- if (changed) {
916
- !edge && uikitUtil.trigger(prev, 'itemhide', [this]);
917
- uikitUtil.trigger(next, 'itemshow', [this]);
918
- }
782
+ let itemShown;
919
783
 
920
- },
784
+ [this.index, this.prevIndex].
785
+ filter((i) => !uikitUtil.includes([nextIndex, prevIndex], i)).
786
+ forEach((i) => {
787
+ uikitUtil.trigger(slides[i], 'itemhidden', [this]);
921
788
 
922
- end: function() {
789
+ if (edge) {
790
+ itemShown = true;
791
+ this.prevIndex = prevIndex;
792
+ }
793
+ });
923
794
 
924
- uikitUtil.off(document, uikitUtil.pointerMove, this.move, {passive: false});
925
- uikitUtil.off(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input"), this.end, true);
795
+ if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
796
+ uikitUtil.trigger(slides[this.index], 'itemshown', [this]);
797
+ }
926
798
 
927
- if (this.dragging) {
799
+ if (changed) {
800
+ this.prevIndex = prevIndex;
801
+ this.index = nextIndex;
928
802
 
929
- this.dragging = null;
803
+ !edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]);
804
+ uikitUtil.trigger(next, 'beforeitemshow', [this]);
805
+ }
930
806
 
931
- if (this.index === this.prevIndex) {
932
- this.percent = 1 - this.percent;
933
- this.dir *= -1;
934
- this._show(false, this.index, true);
935
- this._transitioner = null;
936
- } else {
807
+ this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
937
808
 
938
- var dirChange = (uikitUtil.isRtl ? this.dir * (uikitUtil.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
939
- this.index = dirChange ? this.index : this.prevIndex;
809
+ if (changed) {
810
+ !edge && uikitUtil.trigger(prev, 'itemhide', [this]);
811
+ uikitUtil.trigger(next, 'itemshow', [this]);
812
+ }
813
+ },
940
814
 
941
- if (dirChange) {
942
- this.percent = 1 - this.percent;
943
- }
815
+ end() {
816
+ uikitUtil.off(document, uikitUtil.pointerMove, this.move, { passive: false });
817
+ uikitUtil.off(document, uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input", this.end, true);
818
+
819
+ if (this.dragging) {
820
+ this.dragging = null;
821
+
822
+ if (this.index === this.prevIndex) {
823
+ this.percent = 1 - this.percent;
824
+ this.dir *= -1;
825
+ this._show(false, this.index, true);
826
+ this._transitioner = null;
827
+ } else {
828
+ const dirChange =
829
+ (uikitUtil.isRtl ? this.dir * (uikitUtil.isRtl ? 1 : -1) : this.dir) < 0 ===
830
+ this.prevPos > this.pos;
831
+ this.index = dirChange ? this.index : this.prevIndex;
832
+
833
+ if (dirChange) {
834
+ this.percent = 1 - this.percent;
835
+ }
836
+
837
+ this.show(
838
+ this.dir > 0 && !dirChange || this.dir < 0 && dirChange ?
839
+ 'next' :
840
+ 'previous',
841
+ true);
944
842
 
945
- this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
946
- }
843
+ }
844
+ }
947
845
 
948
- }
846
+ uikitUtil.css(this.list, { userSelect: '', pointerEvents: '' });
949
847
 
950
- uikitUtil.css(this.list, {userSelect: '', pointerEvents: ''});
848
+ this.drag = this.percent = null;
849
+ } } };
951
850
 
952
- this.drag
953
- = this.percent
954
- = null;
955
851
 
956
- }
957
-
958
- }
959
-
960
- };
961
852
 
962
853
  function hasTextNodesOnly(el) {
963
- return !el.children.length && el.childNodes.length;
854
+ return !el.children.length && el.childNodes.length;
964
855
  }
965
856
 
966
857
  var SliderNav = {
858
+ data: {
859
+ selNav: false },
967
860
 
968
- data: {
969
- selNav: false
970
- },
971
-
972
- computed: {
973
-
974
- nav: function(ref, $el) {
975
- var selNav = ref.selNav;
976
-
977
- return uikitUtil.$(selNav, $el);
978
- },
979
-
980
- selNavItem: function(ref) {
981
- var attrItem = ref.attrItem;
982
-
983
- return ("[" + attrItem + "],[data-" + attrItem + "]");
984
- },
985
-
986
- navItems: function(_, $el) {
987
- return uikitUtil.$$(this.selNavItem, $el);
988
- }
989
861
 
862
+ computed: {
863
+ nav(_ref, $el) {let { selNav } = _ref;
864
+ return uikitUtil.$(selNav, $el);
990
865
  },
991
866
 
992
- update: {
993
-
994
- write: function() {
995
- var this$1$1 = this;
996
-
997
-
998
- if (this.nav && this.length !== this.nav.children.length) {
999
- uikitUtil.html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1$1.attrItem) + "=\"" + i + "\"><a href></a></li>"); }).join(''));
1000
- }
1001
-
1002
- this.navItems.concat(this.nav).forEach(function (el) { return el && (el.hidden = !this$1$1.maxIndex); });
1003
-
1004
- this.updateNav();
1005
-
1006
- },
1007
-
1008
- events: ['resize']
1009
-
867
+ selNavItem(_ref2) {let { attrItem } = _ref2;
868
+ return "[" + attrItem + "],[data-" + attrItem + "]";
1010
869
  },
1011
870
 
1012
- events: [
871
+ navItems(_, $el) {
872
+ return uikitUtil.$$(this.selNavItem, $el);
873
+ } },
1013
874
 
1014
- {
1015
875
 
1016
- name: 'click',
876
+ update: {
877
+ write() {
878
+ if (this.nav && this.length !== this.nav.children.length) {
879
+ uikitUtil.html(
880
+ this.nav,
881
+ this.slides.
882
+ map((_, i) => "<li " + this.attrItem + "=\"" + i + "\"><a href></a></li>").
883
+ join(''));
1017
884
 
1018
- delegate: function() {
1019
- return this.selNavItem;
1020
- },
885
+ }
1021
886
 
1022
- handler: function(e) {
1023
- e.preventDefault();
1024
- this.show(uikitUtil.data(e.current, this.attrItem));
1025
- }
1026
-
1027
- },
887
+ this.navItems.concat(this.nav).forEach((el) => el && (el.hidden = !this.maxIndex));
1028
888
 
1029
- {
889
+ this.updateNav();
890
+ },
1030
891
 
1031
- name: 'itemshow',
1032
- handler: 'updateNav'
892
+ events: ['resize'] },
1033
893
 
1034
- }
1035
894
 
1036
- ],
895
+ events: [
896
+ {
897
+ name: 'click',
1037
898
 
1038
- methods: {
899
+ delegate() {
900
+ return this.selNavItem;
901
+ },
1039
902
 
1040
- updateNav: function() {
1041
- var this$1$1 = this;
903
+ handler(e) {
904
+ e.preventDefault();
905
+ this.show(uikitUtil.data(e.current, this.attrItem));
906
+ } },
1042
907
 
1043
908
 
1044
- var i = this.getValidIndex();
1045
- this.navItems.forEach(function (el) {
909
+ {
910
+ name: 'itemshow',
911
+ handler: 'updateNav' }],
1046
912
 
1047
- var cmd = uikitUtil.data(el, this$1$1.attrItem);
1048
913
 
1049
- uikitUtil.toggleClass(el, this$1$1.clsActive, uikitUtil.toNumber(cmd) === i);
1050
- uikitUtil.toggleClass(el, 'uk-invisible', this$1$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1$1.maxIndex));
1051
- });
1052
914
 
1053
- }
915
+ methods: {
916
+ updateNav() {
917
+ const i = this.getValidIndex();
918
+ for (const el of this.navItems) {
919
+ const cmd = uikitUtil.data(el, this.attrItem);
1054
920
 
1055
- }
921
+ uikitUtil.toggleClass(el, this.clsActive, uikitUtil.toNumber(cmd) === i);
922
+ uikitUtil.toggleClass(
923
+ el,
924
+ 'uk-invisible',
925
+ this.finite && (
926
+ cmd === 'previous' && i === 0 || cmd === 'next' && i >= this.maxIndex));
1056
927
 
1057
- };
928
+ }
929
+ } } };
1058
930
 
1059
931
  var Slider = {
1060
-
1061
- mixins: [SliderAutoplay, SliderDrag, SliderNav],
1062
-
1063
- props: {
1064
- clsActivated: Boolean,
1065
- easing: String,
1066
- index: Number,
1067
- finite: Boolean,
1068
- velocity: Number,
1069
- selSlides: String
932
+ mixins: [SliderAutoplay, SliderDrag, SliderNav],
933
+
934
+ props: {
935
+ clsActivated: Boolean,
936
+ easing: String,
937
+ index: Number,
938
+ finite: Boolean,
939
+ velocity: Number,
940
+ selSlides: String },
941
+
942
+
943
+ data: () => ({
944
+ easing: 'ease',
945
+ finite: false,
946
+ velocity: 1,
947
+ index: 0,
948
+ prevIndex: -1,
949
+ stack: [],
950
+ percent: 0,
951
+ clsActive: 'uk-active',
952
+ clsActivated: false,
953
+ Transitioner: false,
954
+ transitionOptions: {} }),
955
+
956
+
957
+ connected() {
958
+ this.prevIndex = -1;
959
+ this.index = this.getValidIndex(this.$props.index);
960
+ this.stack = [];
961
+ },
962
+
963
+ disconnected() {
964
+ uikitUtil.removeClass(this.slides, this.clsActive);
965
+ },
966
+
967
+ computed: {
968
+ duration(_ref, $el) {let { velocity } = _ref;
969
+ return speedUp($el.offsetWidth / velocity);
1070
970
  },
1071
971
 
1072
- data: function () { return ({
1073
- easing: 'ease',
1074
- finite: false,
1075
- velocity: 1,
1076
- index: 0,
1077
- prevIndex: -1,
1078
- stack: [],
1079
- percent: 0,
1080
- clsActive: 'uk-active',
1081
- clsActivated: false,
1082
- Transitioner: false,
1083
- transitionOptions: {}
1084
- }); },
1085
-
1086
- connected: function() {
1087
- this.prevIndex = -1;
1088
- this.index = this.getValidIndex(this.$props.index);
1089
- this.stack = [];
972
+ list(_ref2, $el) {let { selList } = _ref2;
973
+ return uikitUtil.$(selList, $el);
1090
974
  },
1091
975
 
1092
- disconnected: function() {
1093
- uikitUtil.removeClass(this.slides, this.clsActive);
976
+ maxIndex() {
977
+ return this.length - 1;
1094
978
  },
1095
979
 
1096
- computed: {
1097
-
1098
- duration: function(ref, $el) {
1099
- var velocity = ref.velocity;
1100
-
1101
- return speedUp($el.offsetWidth / velocity);
1102
- },
980
+ selSlides(_ref3) {let { selList, selSlides } = _ref3;
981
+ return selList + " " + (selSlides || '> *');
982
+ },
1103
983
 
1104
- list: function(ref, $el) {
1105
- var selList = ref.selList;
984
+ slides: {
985
+ get() {
986
+ return uikitUtil.$$(this.selSlides, this.$el);
987
+ },
1106
988
 
1107
- return uikitUtil.$(selList, $el);
1108
- },
989
+ watch() {
990
+ this.$reset();
991
+ } },
1109
992
 
1110
- maxIndex: function() {
1111
- return this.length - 1;
1112
- },
1113
993
 
1114
- selSlides: function(ref) {
1115
- var selList = ref.selList;
1116
- var selSlides = ref.selSlides;
994
+ length() {
995
+ return this.slides.length;
996
+ } },
1117
997
 
1118
- return (selList + " " + (selSlides || '> *'));
1119
- },
1120
998
 
1121
- slides: {
999
+ events: {
1000
+ itemshown() {
1001
+ this.$update(this.list);
1002
+ } },
1122
1003
 
1123
- get: function() {
1124
- return uikitUtil.$$(this.selSlides, this.$el);
1125
- },
1126
1004
 
1127
- watch: function() {
1128
- this.$reset();
1129
- }
1005
+ methods: {
1006
+ show(index, force) {if (force === void 0) {force = false;}
1007
+ if (this.dragging || !this.length) {
1008
+ return;
1009
+ }
1130
1010
 
1131
- },
1011
+ const { stack } = this;
1012
+ const queueIndex = force ? 0 : stack.length;
1013
+ const reset = () => {
1014
+ stack.splice(queueIndex, 1);
1132
1015
 
1133
- length: function() {
1134
- return this.slides.length;
1016
+ if (stack.length) {
1017
+ this.show(stack.shift(), true);
1135
1018
  }
1019
+ };
1136
1020
 
1137
- },
1138
-
1139
- events: {
1021
+ stack[force ? 'unshift' : 'push'](index);
1140
1022
 
1141
- itemshown: function() {
1142
- this.$update(this.list);
1023
+ if (!force && stack.length > 1) {
1024
+ if (stack.length === 2) {
1025
+ this._transitioner.forward(Math.min(this.duration, 200));
1143
1026
  }
1144
1027
 
1145
- },
1146
-
1147
- methods: {
1148
-
1149
- show: function(index, force) {
1150
- var this$1$1 = this;
1151
- if ( force === void 0 ) force = false;
1152
-
1153
-
1154
- if (this.dragging || !this.length) {
1155
- return;
1156
- }
1157
-
1158
- var ref = this;
1159
- var stack = ref.stack;
1160
- var queueIndex = force ? 0 : stack.length;
1161
- var reset = function () {
1162
- stack.splice(queueIndex, 1);
1163
-
1164
- if (stack.length) {
1165
- this$1$1.show(stack.shift(), true);
1166
- }
1167
- };
1168
-
1169
- stack[force ? 'unshift' : 'push'](index);
1170
-
1171
- if (!force && stack.length > 1) {
1172
-
1173
- if (stack.length === 2) {
1174
- this._transitioner.forward(Math.min(this.duration, 200));
1175
- }
1176
-
1177
- return;
1178
- }
1179
-
1180
- var prevIndex = this.getIndex(this.index);
1181
- var prev = uikitUtil.hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
1182
- var nextIndex = this.getIndex(index, this.index);
1183
- var next = this.slides[nextIndex];
1184
-
1185
- if (prev === next) {
1186
- reset();
1187
- return;
1188
- }
1189
-
1190
- this.dir = getDirection(index, prevIndex);
1191
- this.prevIndex = prevIndex;
1192
- this.index = nextIndex;
1193
-
1194
- if (prev && !uikitUtil.trigger(prev, 'beforeitemhide', [this])
1195
- || !uikitUtil.trigger(next, 'beforeitemshow', [this, prev])
1196
- ) {
1197
- this.index = this.prevIndex;
1198
- reset();
1199
- return;
1028
+ return;
1029
+ }
1030
+
1031
+ const prevIndex = this.getIndex(this.index);
1032
+ const prev = uikitUtil.hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
1033
+ const nextIndex = this.getIndex(index, this.index);
1034
+ const next = this.slides[nextIndex];
1035
+
1036
+ if (prev === next) {
1037
+ reset();
1038
+ return;
1039
+ }
1040
+
1041
+ this.dir = getDirection(index, prevIndex);
1042
+ this.prevIndex = prevIndex;
1043
+ this.index = nextIndex;
1044
+
1045
+ if (
1046
+ prev && !uikitUtil.trigger(prev, 'beforeitemhide', [this]) ||
1047
+ !uikitUtil.trigger(next, 'beforeitemshow', [this, prev]))
1048
+ {
1049
+ this.index = this.prevIndex;
1050
+ reset();
1051
+ return;
1052
+ }
1053
+
1054
+ const promise = this._show(prev, next, force).then(() => {
1055
+ prev && uikitUtil.trigger(prev, 'itemhidden', [this]);
1056
+ uikitUtil.trigger(next, 'itemshown', [this]);
1057
+
1058
+ return new Promise((resolve) => {
1059
+ uikitUtil.fastdom.write(() => {
1060
+ stack.shift();
1061
+ if (stack.length) {
1062
+ this.show(stack.shift(), true);
1063
+ } else {
1064
+ this._transitioner = null;
1200
1065
  }
1066
+ resolve();
1067
+ });
1068
+ });
1069
+ });
1201
1070
 
1202
- var promise = this._show(prev, next, force).then(function () {
1071
+ prev && uikitUtil.trigger(prev, 'itemhide', [this]);
1072
+ uikitUtil.trigger(next, 'itemshow', [this]);
1203
1073
 
1204
- prev && uikitUtil.trigger(prev, 'itemhidden', [this$1$1]);
1205
- uikitUtil.trigger(next, 'itemshown', [this$1$1]);
1074
+ return promise;
1075
+ },
1206
1076
 
1207
- return new uikitUtil.Promise(function (resolve) {
1208
- uikitUtil.fastdom.write(function () {
1209
- stack.shift();
1210
- if (stack.length) {
1211
- this$1$1.show(stack.shift(), true);
1212
- } else {
1213
- this$1$1._transitioner = null;
1214
- }
1215
- resolve();
1216
- });
1217
- });
1077
+ getIndex(index, prev) {if (index === void 0) {index = this.index;}if (prev === void 0) {prev = this.index;}
1078
+ return uikitUtil.clamp(uikitUtil.getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
1079
+ },
1218
1080
 
1219
- });
1081
+ getValidIndex(index, prevIndex) {if (index === void 0) {index = this.index;}if (prevIndex === void 0) {prevIndex = this.prevIndex;}
1082
+ return this.getIndex(index, prevIndex);
1083
+ },
1220
1084
 
1221
- prev && uikitUtil.trigger(prev, 'itemhide', [this]);
1222
- uikitUtil.trigger(next, 'itemshow', [this]);
1085
+ _show(prev, next, force) {
1086
+ this._transitioner = this._getTransitioner(
1087
+ prev,
1088
+ next,
1089
+ this.dir,
1090
+ uikitUtil.assign(
1091
+ {
1092
+ easing: force ?
1093
+ next.offsetWidth < 600 ?
1094
+ 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */ :
1095
+ 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */ :
1096
+ this.easing },
1223
1097
 
1224
- return promise;
1098
+ this.transitionOptions));
1225
1099
 
1226
- },
1227
1100
 
1228
- getIndex: function(index, prev) {
1229
- if ( index === void 0 ) index = this.index;
1230
- if ( prev === void 0 ) prev = this.index;
1231
1101
 
1232
- return uikitUtil.clamp(uikitUtil.getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
1233
- },
1102
+ if (!force && !prev) {
1103
+ this._translate(1);
1104
+ return Promise.resolve();
1105
+ }
1234
1106
 
1235
- getValidIndex: function(index, prevIndex) {
1236
- if ( index === void 0 ) index = this.index;
1237
- if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
1107
+ const { length } = this.stack;
1108
+ return this._transitioner[length > 1 ? 'forward' : 'show'](
1109
+ length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration,
1110
+ this.percent);
1238
1111
 
1239
- return this.getIndex(index, prevIndex);
1240
- },
1112
+ },
1241
1113
 
1242
- _show: function(prev, next, force) {
1114
+ _getDistance(prev, next) {
1115
+ return this._getTransitioner(prev, prev !== next && next).getDistance();
1116
+ },
1243
1117
 
1244
- this._transitioner = this._getTransitioner(
1245
- prev,
1246
- next,
1247
- this.dir,
1248
- uikitUtil.assign({
1249
- easing: force
1250
- ? next.offsetWidth < 600
1251
- ? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
1252
- : 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
1253
- : this.easing
1254
- }, this.transitionOptions)
1255
- );
1118
+ _translate(percent, prev, next) {if (prev === void 0) {prev = this.prevIndex;}if (next === void 0) {next = this.index;}
1119
+ const transitioner = this._getTransitioner(prev !== next ? prev : false, next);
1120
+ transitioner.translate(percent);
1121
+ return transitioner;
1122
+ },
1256
1123
 
1257
- if (!force && !prev) {
1258
- this._translate(1);
1259
- return uikitUtil.Promise.resolve();
1260
- }
1124
+ _getTransitioner(
1125
+ prev,
1126
+ next,
1127
+ dir,
1128
+ options)
1129
+ {if (prev === void 0) {prev = this.prevIndex;}if (next === void 0) {next = this.index;}if (dir === void 0) {dir = this.dir || 1;}if (options === void 0) {options = this.transitionOptions;}
1130
+ return new this.Transitioner(
1131
+ uikitUtil.isNumber(prev) ? this.slides[prev] : prev,
1132
+ uikitUtil.isNumber(next) ? this.slides[next] : next,
1133
+ dir * (uikitUtil.isRtl ? -1 : 1),
1134
+ options);
1261
1135
 
1262
- var ref = this.stack;
1263
- var length = ref.length;
1264
- return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent);
1265
-
1266
- },
1267
-
1268
- _getDistance: function(prev, next) {
1269
- return this._getTransitioner(prev, prev !== next && next).getDistance();
1270
- },
1271
-
1272
- _translate: function(percent, prev, next) {
1273
- if ( prev === void 0 ) prev = this.prevIndex;
1274
- if ( next === void 0 ) next = this.index;
1275
-
1276
- var transitioner = this._getTransitioner(prev !== next ? prev : false, next);
1277
- transitioner.translate(percent);
1278
- return transitioner;
1279
- },
1280
-
1281
- _getTransitioner: function(prev, next, dir, options) {
1282
- if ( prev === void 0 ) prev = this.prevIndex;
1283
- if ( next === void 0 ) next = this.index;
1284
- if ( dir === void 0 ) dir = this.dir || 1;
1285
- if ( options === void 0 ) options = this.transitionOptions;
1286
-
1287
- return new this.Transitioner(
1288
- uikitUtil.isNumber(prev) ? this.slides[prev] : prev,
1289
- uikitUtil.isNumber(next) ? this.slides[next] : next,
1290
- dir * (uikitUtil.isRtl ? -1 : 1),
1291
- options
1292
- );
1293
- }
1136
+ } } };
1294
1137
 
1295
- }
1296
1138
 
1297
- };
1298
1139
 
1299
1140
  function getDirection(index, prevIndex) {
1300
- return index === 'next'
1301
- ? 1
1302
- : index === 'previous'
1303
- ? -1
1304
- : index < prevIndex
1305
- ? -1
1306
- : 1;
1141
+ return index === 'next' ? 1 : index === 'previous' ? -1 : index < prevIndex ? -1 : 1;
1307
1142
  }
1308
1143
 
1309
1144
  function speedUp(x) {
1310
- return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
1145
+ return 0.5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
1311
1146
  }
1312
1147
 
1313
1148
  var Slideshow = {
1149
+ mixins: [Slider],
1314
1150
 
1315
- mixins: [Slider],
1151
+ props: {
1152
+ animation: String },
1316
1153
 
1317
- props: {
1318
- animation: String
1319
- },
1320
1154
 
1321
- data: {
1322
- animation: 'slide',
1323
- clsActivated: 'uk-transition-active',
1324
- Animations: Animations$1,
1325
- Transitioner: Transitioner
1326
- },
1155
+ data: {
1156
+ animation: 'slide',
1157
+ clsActivated: 'uk-transition-active',
1158
+ Animations: Animations$1,
1159
+ Transitioner },
1327
1160
 
1328
- computed: {
1329
1161
 
1330
- animation: function(ref) {
1331
- var animation = ref.animation;
1332
- var Animations = ref.Animations;
1162
+ computed: {
1163
+ animation(_ref) {let { animation, Animations } = _ref;
1164
+ return uikitUtil.assign(Animations[animation] || Animations.slide, { name: animation });
1165
+ },
1333
1166
 
1334
- return uikitUtil.assign(Animations[animation] || Animations.slide, {name: animation});
1335
- },
1167
+ transitionOptions() {
1168
+ return { animation: this.animation };
1169
+ } },
1336
1170
 
1337
- transitionOptions: function() {
1338
- return {animation: this.animation};
1339
- }
1340
1171
 
1172
+ events: {
1173
+ 'itemshow itemhide itemshown itemhidden'(_ref2) {let { target } = _ref2;
1174
+ this.$update(target);
1341
1175
  },
1342
1176
 
1343
- events: {
1177
+ beforeitemshow(_ref3) {let { target } = _ref3;
1178
+ uikitUtil.addClass(target, this.clsActive);
1179
+ },
1344
1180
 
1345
- 'itemshow itemhide itemshown itemhidden': function(ref) {
1346
- var target = ref.target;
1181
+ itemshown(_ref4) {let { target } = _ref4;
1182
+ uikitUtil.addClass(target, this.clsActivated);
1183
+ },
1347
1184
 
1348
- this.$update(target);
1349
- },
1185
+ itemhidden(_ref5) {let { target } = _ref5;
1186
+ uikitUtil.removeClass(target, this.clsActive, this.clsActivated);
1187
+ } } };
1350
1188
 
1351
- beforeitemshow: function(ref) {
1352
- var target = ref.target;
1189
+ var LightboxPanel = {
1190
+ mixins: [Container, Modal, Togglable, Slideshow],
1353
1191
 
1354
- uikitUtil.addClass(target, this.clsActive);
1355
- },
1192
+ functional: true,
1356
1193
 
1357
- itemshown: function(ref) {
1358
- var target = ref.target;
1194
+ props: {
1195
+ delayControls: Number,
1196
+ preload: Number,
1197
+ videoAutoplay: Boolean,
1198
+ template: String },
1359
1199
 
1360
- uikitUtil.addClass(target, this.clsActivated);
1361
- },
1362
1200
 
1363
- itemhidden: function(ref) {
1364
- var target = ref.target;
1201
+ data: () => ({
1202
+ preload: 1,
1203
+ videoAutoplay: false,
1204
+ delayControls: 3000,
1205
+ items: [],
1206
+ cls: 'uk-open',
1207
+ clsPage: 'uk-lightbox-page',
1208
+ selList: '.uk-lightbox-items',
1209
+ attrItem: 'uk-lightbox-item',
1210
+ selClose: '.uk-close-large',
1211
+ selCaption: '.uk-lightbox-caption',
1212
+ pauseOnHover: false,
1213
+ velocity: 2,
1214
+ Animations,
1215
+ template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>" }),
1365
1216
 
1366
- uikitUtil.removeClass(target, this.clsActive, this.clsActivated);
1367
- }
1368
1217
 
1369
- }
1370
1218
 
1371
- };
1372
1219
 
1373
- var LightboxPanel = {
1374
1220
 
1375
- mixins: [Container, Modal, Togglable, Slideshow],
1376
1221
 
1377
- functional: true,
1378
1222
 
1379
- props: {
1380
- delayControls: Number,
1381
- preload: Number,
1382
- videoAutoplay: Boolean,
1383
- template: String
1384
- },
1385
1223
 
1386
- data: function () { return ({
1387
- preload: 1,
1388
- videoAutoplay: false,
1389
- delayControls: 3000,
1390
- items: [],
1391
- cls: 'uk-open',
1392
- clsPage: 'uk-lightbox-page',
1393
- selList: '.uk-lightbox-items',
1394
- attrItem: 'uk-lightbox-item',
1395
- selClose: '.uk-close-large',
1396
- selCaption: '.uk-lightbox-caption',
1397
- pauseOnHover: false,
1398
- velocity: 2,
1399
- Animations: Animations,
1400
- template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>"
1401
- }); },
1402
-
1403
- created: function() {
1404
-
1405
- var $el = uikitUtil.$(this.template);
1406
- var list = uikitUtil.$(this.selList, $el);
1407
- this.items.forEach(function () { return uikitUtil.append(list, '<li>'); });
1408
-
1409
- this.$mount(uikitUtil.append(this.container, $el));
1410
1224
 
1411
- },
1412
1225
 
1413
- computed: {
1226
+ created() {
1227
+ const $el = uikitUtil.$(this.template);
1228
+ const list = uikitUtil.$(this.selList, $el);
1229
+ this.items.forEach(() => uikitUtil.append(list, '<li>'));
1414
1230
 
1415
- caption: function(ref, $el) {
1416
- var selCaption = ref.selCaption;
1231
+ this.$mount(uikitUtil.append(this.container, $el));
1232
+ },
1417
1233
 
1418
- return uikitUtil.$(selCaption, $el);
1419
- }
1234
+ computed: {
1235
+ caption(_ref, $el) {let { selCaption } = _ref;
1236
+ return uikitUtil.$(selCaption, $el);
1237
+ } },
1420
1238
 
1421
- },
1422
1239
 
1423
- events: [
1240
+ events: [
1241
+ {
1242
+ name: uikitUtil.pointerMove + " " + uikitUtil.pointerDown + " keydown",
1424
1243
 
1425
- {
1244
+ handler: 'showControls' },
1426
1245
 
1427
- name: (uikitUtil.pointerMove + " " + uikitUtil.pointerDown + " keydown"),
1428
1246
 
1429
- handler: 'showControls'
1247
+ {
1248
+ name: 'click',
1430
1249
 
1431
- },
1250
+ self: true,
1432
1251
 
1433
- {
1434
-
1435
- name: 'click',
1436
-
1437
- self: true,
1438
-
1439
- delegate: function() {
1440
- return this.selSlides;
1441
- },
1252
+ delegate() {
1253
+ return this.selSlides;
1254
+ },
1442
1255
 
1443
- handler: function(e) {
1256
+ handler(e) {
1257
+ if (e.defaultPrevented) {
1258
+ return;
1259
+ }
1444
1260
 
1445
- if (e.defaultPrevented) {
1446
- return;
1447
- }
1261
+ this.hide();
1262
+ } },
1448
1263
 
1449
- this.hide();
1450
- }
1451
1264
 
1452
- },
1265
+ {
1266
+ name: 'shown',
1453
1267
 
1454
- {
1268
+ self: true,
1455
1269
 
1456
- name: 'shown',
1270
+ handler() {
1271
+ this.showControls();
1272
+ } },
1457
1273
 
1458
- self: true,
1459
1274
 
1460
- handler: function() {
1461
- this.showControls();
1462
- }
1275
+ {
1276
+ name: 'hide',
1463
1277
 
1464
- },
1278
+ self: true,
1465
1279
 
1466
- {
1280
+ handler() {
1281
+ this.hideControls();
1467
1282
 
1468
- name: 'hide',
1283
+ uikitUtil.removeClass(this.slides, this.clsActive);
1284
+ uikitUtil.Transition.stop(this.slides);
1285
+ } },
1469
1286
 
1470
- self: true,
1471
1287
 
1472
- handler: function() {
1288
+ {
1289
+ name: 'hidden',
1473
1290
 
1474
- this.hideControls();
1291
+ self: true,
1475
1292
 
1476
- uikitUtil.removeClass(this.slides, this.clsActive);
1477
- uikitUtil.Transition.stop(this.slides);
1293
+ handler() {
1294
+ this.$destroy(true);
1295
+ } },
1478
1296
 
1479
- }
1480
- },
1481
1297
 
1482
- {
1298
+ {
1299
+ name: 'keyup',
1483
1300
 
1484
- name: 'hidden',
1301
+ el() {
1302
+ return document;
1303
+ },
1485
1304
 
1486
- self: true,
1305
+ handler(e) {
1306
+ if (!this.isToggled(this.$el) || !this.draggable) {
1307
+ return;
1308
+ }
1487
1309
 
1488
- handler: function() {
1489
- this.$destroy(true);
1490
- }
1310
+ switch (e.keyCode) {
1311
+ case 37:
1312
+ this.show('previous');
1313
+ break;
1314
+ case 39:
1315
+ this.show('next');
1316
+ break;}
1491
1317
 
1492
- },
1318
+ } },
1493
1319
 
1494
- {
1495
1320
 
1496
- name: 'keyup',
1321
+ {
1322
+ name: 'beforeitemshow',
1497
1323
 
1498
- el: function() {
1499
- return document;
1500
- },
1324
+ handler(e) {
1325
+ if (this.isToggled()) {
1326
+ return;
1327
+ }
1501
1328
 
1502
- handler: function(e) {
1329
+ this.draggable = false;
1503
1330
 
1504
- if (!this.isToggled(this.$el) || !this.draggable) {
1505
- return;
1506
- }
1331
+ e.preventDefault();
1507
1332
 
1508
- switch (e.keyCode) {
1509
- case 37:
1510
- this.show('previous');
1511
- break;
1512
- case 39:
1513
- this.show('next');
1514
- break;
1515
- }
1516
- }
1517
- },
1333
+ this.toggleElement(this.$el, true, false);
1518
1334
 
1519
- {
1335
+ this.animation = Animations['scale'];
1336
+ uikitUtil.removeClass(e.target, this.clsActive);
1337
+ this.stack.splice(1, 0, this.index);
1338
+ } },
1520
1339
 
1521
- name: 'beforeitemshow',
1522
1340
 
1523
- handler: function(e) {
1341
+ {
1342
+ name: 'itemshow',
1524
1343
 
1525
- if (this.isToggled()) {
1526
- return;
1527
- }
1344
+ handler() {
1345
+ uikitUtil.html(this.caption, this.getItem().caption || '');
1528
1346
 
1529
- this.draggable = false;
1347
+ for (let j = -this.preload; j <= this.preload; j++) {
1348
+ this.loadItem(this.index + j);
1349
+ }
1350
+ } },
1530
1351
 
1531
- e.preventDefault();
1532
1352
 
1533
- this.toggleElement(this.$el, true, false);
1353
+ {
1354
+ name: 'itemshown',
1534
1355
 
1535
- this.animation = Animations['scale'];
1536
- uikitUtil.removeClass(e.target, this.clsActive);
1537
- this.stack.splice(1, 0, this.index);
1356
+ handler() {
1357
+ this.draggable = this.$props.draggable;
1358
+ } },
1538
1359
 
1539
- }
1540
1360
 
1541
- },
1361
+ {
1362
+ name: 'itemload',
1542
1363
 
1543
- {
1364
+ async handler(_, item) {
1365
+ const { source: src, type, alt = '', poster, attrs = {} } = item;
1544
1366
 
1545
- name: 'itemshow',
1367
+ this.setItem(item, '<span uk-spinner></span>');
1546
1368
 
1547
- handler: function() {
1369
+ if (!src) {
1370
+ return;
1371
+ }
1548
1372
 
1549
- uikitUtil.html(this.caption, this.getItem().caption || '');
1373
+ let matches;
1374
+ const iframeAttrs = {
1375
+ frameborder: '0',
1376
+ allow: 'autoplay',
1377
+ allowfullscreen: '',
1378
+ style: 'max-width: 100%; box-sizing: border-box;',
1379
+ 'uk-responsive': '',
1380
+ 'uk-video': "" + this.videoAutoplay };
1550
1381
 
1551
- for (var j = -this.preload; j <= this.preload; j++) {
1552
- this.loadItem(this.index + j);
1553
- }
1554
1382
 
1555
- }
1383
+ // Image
1384
+ if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
1385
+ try {
1386
+ const { width, height } = await uikitUtil.getImage(src, attrs.srcset, attrs.size);
1387
+ this.setItem(
1388
+ item,
1389
+ createEl('img', uikitUtil.assign({ src, width, height, alt }, attrs)));
1556
1390
 
1557
- },
1391
+ } catch (e) {
1392
+ this.setError(item);
1393
+ }
1558
1394
 
1395
+ // Video
1396
+ } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
1397
+ const video = createEl(
1398
+ 'video',
1399
+ uikitUtil.assign(
1559
1400
  {
1401
+ src,
1402
+ poster,
1403
+ controls: '',
1404
+ playsinline: '',
1405
+ 'uk-video': "" + this.videoAutoplay },
1560
1406
 
1561
- name: 'itemshown',
1407
+ attrs));
1562
1408
 
1563
- handler: function() {
1564
- this.draggable = this.$props.draggable;
1565
- }
1566
1409
 
1567
- },
1568
1410
 
1411
+ uikitUtil.on(video, 'loadedmetadata', () => {
1412
+ uikitUtil.attr(video, { width: video.videoWidth, height: video.videoHeight });
1413
+ this.setItem(item, video);
1414
+ });
1415
+ uikitUtil.on(video, 'error', () => this.setError(item));
1416
+
1417
+ // Iframe
1418
+ } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
1419
+ this.setItem(
1420
+ item,
1421
+ createEl(
1422
+ 'iframe',
1423
+ uikitUtil.assign(
1569
1424
  {
1425
+ src,
1426
+ frameborder: '0',
1427
+ allowfullscreen: '',
1428
+ class: 'uk-lightbox-iframe' },
1570
1429
 
1571
- name: 'itemload',
1572
-
1573
- handler: function(_, item) {
1574
- var this$1$1 = this;
1575
-
1576
-
1577
- var src = item.source;
1578
- var type = item.type;
1579
- var alt = item.alt; if ( alt === void 0 ) alt = '';
1580
- var poster = item.poster;
1581
- var attrs = item.attrs; if ( attrs === void 0 ) attrs = {};
1582
-
1583
- this.setItem(item, '<span uk-spinner></span>');
1584
-
1585
- if (!src) {
1586
- return;
1587
- }
1588
-
1589
- var matches;
1590
- var iframeAttrs = {
1591
- frameborder: '0',
1592
- allow: 'autoplay',
1593
- allowfullscreen: '',
1594
- style: 'max-width: 100%; box-sizing: border-box;',
1595
- 'uk-responsive': '',
1596
- 'uk-video': ("" + (this.videoAutoplay))
1597
- };
1598
-
1599
- // Image
1600
- if (type === 'image' || src.match(/\.(avif|jpe?g|a?png|gif|svg|webp)($|\?)/i)) {
1601
-
1602
- uikitUtil.getImage(src, attrs.srcset, attrs.size).then(
1603
- function (ref) {
1604
- var width = ref.width;
1605
- var height = ref.height;
1606
-
1607
- return this$1$1.setItem(item, createEl('img', uikitUtil.assign({src: src, width: width, height: height, alt: alt}, attrs)));
1608
- },
1609
- function () { return this$1$1.setError(item); }
1610
- );
1611
-
1612
- // Video
1613
- } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
1614
-
1615
- var video = createEl('video', uikitUtil.assign({
1616
- src: src,
1617
- poster: poster,
1618
- controls: '',
1619
- playsinline: '',
1620
- 'uk-video': ("" + (this.videoAutoplay))
1621
- }, attrs));
1622
-
1623
- uikitUtil.on(video, 'loadedmetadata', function () {
1624
- uikitUtil.attr(video, {width: video.videoWidth, height: video.videoHeight});
1625
- this$1$1.setItem(item, video);
1626
- });
1627
- uikitUtil.on(video, 'error', function () { return this$1$1.setError(item); });
1628
-
1629
- // Iframe
1630
- } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
1631
-
1632
- this.setItem(item, createEl('iframe', uikitUtil.assign({
1633
- src: src,
1634
- frameborder: '0',
1635
- allowfullscreen: '',
1636
- class: 'uk-lightbox-iframe'
1637
- }, attrs)));
1638
-
1639
- // YouTube
1640
- } else if ((matches = src.match(/\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))) {
1641
-
1642
- this.setItem(item, createEl('iframe', uikitUtil.assign({
1643
- src: ("https://www.youtube" + (matches[1] || '') + ".com/embed/" + (matches[2]) + (matches[3] ? ("?" + (matches[3])) : '')),
1644
- width: 1920,
1645
- height: 1080
1646
- }, iframeAttrs, attrs)));
1647
-
1648
- // Vimeo
1649
- } else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) {
1650
-
1651
- uikitUtil.ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(src))), {
1652
- responseType: 'json',
1653
- withCredentials: false
1654
- }).then(
1655
- function (ref) {
1656
- var ref_response = ref.response;
1657
- var height = ref_response.height;
1658
- var width = ref_response.width;
1659
-
1660
- return this$1$1.setItem(item, createEl('iframe', uikitUtil.assign({
1661
- src: ("https://player.vimeo.com/video/" + (matches[1]) + (matches[2] ? ("?" + (matches[2])) : '')),
1662
- width: width,
1663
- height: height
1664
- }, iframeAttrs, attrs)));
1665
- },
1666
- function () { return this$1$1.setError(item); }
1667
- );
1668
-
1669
- }
1670
-
1671
- }
1672
-
1673
- }
1674
-
1675
- ],
1430
+ attrs)));
1676
1431
 
1677
- methods: {
1678
1432
 
1679
- loadItem: function(index) {
1680
- if ( index === void 0 ) index = this.index;
1681
1433
 
1682
1434
 
1683
- var item = this.getItem(index);
1435
+ // YouTube
1436
+ } else if (
1437
+ matches = src.match(
1438
+ /\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))
1684
1439
 
1685
- if (!this.getSlide(item).childElementCount) {
1686
- uikitUtil.trigger(this.$el, 'itemload', [item]);
1687
- }
1688
- },
1440
+ {
1441
+ this.setItem(
1442
+ item,
1443
+ createEl(
1444
+ 'iframe',
1445
+ uikitUtil.assign(
1446
+ {
1447
+ src: "https://www.youtube" + (matches[1] || '') + ".com/embed/" +
1448
+ matches[2] + (
1449
+ matches[3] ? "?" + matches[3] : ''),
1450
+ width: 1920,
1451
+ height: 1080 },
1689
1452
 
1690
- getItem: function(index) {
1691
- if ( index === void 0 ) index = this.index;
1453
+ iframeAttrs,
1454
+ attrs)));
1692
1455
 
1693
- return this.items[uikitUtil.getIndex(index, this.slides)];
1694
- },
1695
1456
 
1696
- setItem: function(item, content) {
1697
- uikitUtil.trigger(this.$el, 'itemloaded', [this, uikitUtil.html(this.getSlide(item), content) ]);
1698
- },
1699
1457
 
1700
- getSlide: function(item) {
1701
- return this.slides[this.items.indexOf(item)];
1702
- },
1703
1458
 
1704
- setError: function(item) {
1705
- this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
1706
- },
1459
+ // Vimeo
1460
+ } else if (matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/)) {
1461
+ try {
1462
+ const { height, width } = await (
1463
+ await fetch("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" +
1464
+ encodeURI(
1465
+ src),
1707
1466
 
1708
- showControls: function() {
1467
+ {
1468
+ credentials: 'omit' })).
1709
1469
 
1710
- clearTimeout(this.controlsTimer);
1711
- this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
1712
1470
 
1713
- uikitUtil.addClass(this.$el, 'uk-active', 'uk-transition-active');
1471
+ json();
1714
1472
 
1715
- },
1473
+ this.setItem(
1474
+ item,
1475
+ createEl(
1476
+ 'iframe',
1477
+ uikitUtil.assign(
1478
+ {
1479
+ src: "https://player.vimeo.com/video/" + matches[1] + (
1480
+ matches[2] ? "?" + matches[2] : ''),
1716
1481
 
1717
- hideControls: function() {
1718
- uikitUtil.removeClass(this.$el, 'uk-active', 'uk-transition-active');
1719
- }
1482
+ width,
1483
+ height },
1720
1484
 
1721
- }
1485
+ iframeAttrs,
1486
+ attrs)));
1722
1487
 
1723
- };
1724
1488
 
1725
- function createEl(tag, attrs) {
1726
- var el = uikitUtil.fragment(("<" + tag + ">"));
1727
- uikitUtil.attr(el, attrs);
1728
- return el;
1729
- }
1730
1489
 
1731
- var Component = {
1490
+ } catch (e) {
1491
+ this.setError(item);
1492
+ }
1493
+ }
1494
+ } }],
1732
1495
 
1733
- install: install,
1734
1496
 
1735
- props: {toggle: String},
1736
1497
 
1737
- data: {toggle: 'a'},
1498
+ methods: {
1499
+ loadItem(index) {if (index === void 0) {index = this.index;}
1500
+ const item = this.getItem(index);
1738
1501
 
1739
- computed: {
1502
+ if (!this.getSlide(item).childElementCount) {
1503
+ uikitUtil.trigger(this.$el, 'itemload', [item]);
1504
+ }
1505
+ },
1740
1506
 
1741
- toggles: {
1507
+ getItem(index) {if (index === void 0) {index = this.index;}
1508
+ return this.items[uikitUtil.getIndex(index, this.slides)];
1509
+ },
1742
1510
 
1743
- get: function(ref, $el) {
1744
- var toggle = ref.toggle;
1511
+ setItem(item, content) {
1512
+ uikitUtil.trigger(this.$el, 'itemloaded', [this, uikitUtil.html(this.getSlide(item), content)]);
1513
+ },
1745
1514
 
1746
- return uikitUtil.$$(toggle, $el);
1747
- },
1515
+ getSlide(item) {
1516
+ return this.slides[this.items.indexOf(item)];
1517
+ },
1748
1518
 
1749
- watch: function() {
1750
- this.hide();
1751
- }
1519
+ setError(item) {
1520
+ this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
1521
+ },
1752
1522
 
1753
- }
1523
+ showControls() {
1524
+ clearTimeout(this.controlsTimer);
1525
+ this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
1754
1526
 
1527
+ uikitUtil.addClass(this.$el, 'uk-active', 'uk-transition-active');
1755
1528
  },
1756
1529
 
1757
- disconnected: function() {
1758
- this.hide();
1759
- },
1530
+ hideControls() {
1531
+ uikitUtil.removeClass(this.$el, 'uk-active', 'uk-transition-active');
1532
+ } } };
1760
1533
 
1761
- events: [
1762
1534
 
1763
- {
1764
1535
 
1765
- name: 'click',
1536
+ function createEl(tag, attrs) {
1537
+ const el = uikitUtil.fragment("<" + tag + ">");
1538
+ uikitUtil.attr(el, attrs);
1539
+ return el;
1540
+ }
1766
1541
 
1767
- delegate: function() {
1768
- return ((this.toggle) + ":not(.uk-disabled)");
1769
- },
1542
+ var Component = {
1543
+ install,
1770
1544
 
1771
- handler: function(e) {
1772
- e.preventDefault();
1773
- this.show(e.current);
1774
- }
1545
+ props: { toggle: String },
1775
1546
 
1776
- }
1547
+ data: { toggle: 'a' },
1777
1548
 
1778
- ],
1549
+ computed: {
1550
+ toggles: {
1551
+ get(_ref, $el) {let { toggle } = _ref;
1552
+ return uikitUtil.$$(toggle, $el);
1553
+ },
1779
1554
 
1780
- methods: {
1555
+ watch() {
1556
+ this.hide();
1557
+ } } },
1781
1558
 
1782
- show: function(index) {
1783
- var this$1$1 = this;
1784
1559
 
1785
1560
 
1786
- var items = uikitUtil.uniqueBy(this.toggles.map(toItem), 'source');
1561
+ disconnected() {
1562
+ this.hide();
1563
+ },
1787
1564
 
1788
- if (uikitUtil.isElement(index)) {
1789
- var ref = toItem(index);
1790
- var source = ref.source;
1791
- index = uikitUtil.findIndex(items, function (ref) {
1792
- var src = ref.source;
1565
+ events: [
1566
+ {
1567
+ name: 'click',
1793
1568
 
1794
- return source === src;
1795
- });
1796
- }
1569
+ delegate() {
1570
+ return this.toggle + ":not(.uk-disabled)";
1571
+ },
1797
1572
 
1798
- this.panel = this.panel || this.$create('lightboxPanel', uikitUtil.assign({}, this.$props, {items: items}));
1573
+ handler(e) {
1574
+ e.preventDefault();
1575
+ this.show(e.current);
1576
+ } }],
1799
1577
 
1800
- uikitUtil.on(this.panel.$el, 'hidden', function () { return this$1$1.panel = false; });
1801
1578
 
1802
- return this.panel.show(index);
1803
1579
 
1804
- },
1580
+ methods: {
1581
+ show(index) {
1582
+ const items = uikitUtil.uniqueBy(this.toggles.map(toItem), 'source');
1805
1583
 
1806
- hide: function() {
1584
+ if (uikitUtil.isElement(index)) {
1585
+ const { source } = toItem(index);
1586
+ index = uikitUtil.findIndex(items, (_ref2) => {let { source: src } = _ref2;return source === src;});
1587
+ }
1807
1588
 
1808
- return this.panel && this.panel.hide();
1589
+ this.panel =
1590
+ this.panel || this.$create('lightboxPanel', uikitUtil.assign({}, this.$props, { items }));
1809
1591
 
1810
- }
1592
+ uikitUtil.on(this.panel.$el, 'hidden', () => this.panel = false);
1811
1593
 
1812
- }
1594
+ return this.panel.show(index);
1595
+ },
1813
1596
 
1814
- };
1597
+ hide() {
1598
+ return this.panel && this.panel.hide();
1599
+ } } };
1815
1600
 
1816
- function install(UIkit, Lightbox) {
1817
1601
 
1818
- if (!UIkit.lightboxPanel) {
1819
- UIkit.component('lightboxPanel', LightboxPanel);
1820
- }
1821
1602
 
1822
- uikitUtil.assign(
1823
- Lightbox.props,
1824
- UIkit.component('lightboxPanel').options.props
1825
- );
1603
+ function install(UIkit, Lightbox) {
1604
+ if (!UIkit.lightboxPanel) {
1605
+ UIkit.component('lightboxPanel', LightboxPanel);
1606
+ }
1826
1607
 
1608
+ uikitUtil.assign(Lightbox.props, UIkit.component('lightboxPanel').options.props);
1827
1609
  }
1828
1610
 
1829
1611
  function toItem(el) {
1612
+ const item = {};
1830
1613
 
1831
- var item = {};
1832
-
1833
- ['href', 'caption', 'type', 'poster', 'alt', 'attrs'].forEach(function (attr) {
1834
- item[attr === 'href' ? 'source' : attr] = uikitUtil.data(el, attr);
1835
- });
1614
+ for (const attr of ['href', 'caption', 'type', 'poster', 'alt', 'attrs']) {
1615
+ item[attr === 'href' ? 'source' : attr] = uikitUtil.data(el, attr);
1616
+ }
1836
1617
 
1837
- item.attrs = uikitUtil.parseOptions(item.attrs);
1618
+ item.attrs = uikitUtil.parseOptions(item.attrs);
1838
1619
 
1839
- return item;
1620
+ return item;
1840
1621
  }
1841
1622
 
1842
1623
  if (typeof window !== 'undefined' && window.UIkit) {
1843
- window.UIkit.component('lightbox', Component);
1624
+ window.UIkit.component('lightbox', Component);
1844
1625
  }
1845
1626
 
1846
1627
  return Component;