uikit 3.11.2-dev.bbaa4362f → 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 (165) 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 +8 -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 +42 -17
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +42 -17
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +42 -17
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +42 -17
  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 -6709
  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 -9913
  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 +79 -100
  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 +107 -93
  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/src/less/components/flex.less +0 -9
  153. package/src/less/components/navbar.less +0 -7
  154. package/src/less/components/utility.less +22 -0
  155. package/src/scss/components/flex.scss +0 -9
  156. package/src/scss/components/form.scss +3 -3
  157. package/src/scss/components/icon.scss +2 -2
  158. package/src/scss/components/navbar.scss +0 -7
  159. package/src/scss/components/search.scss +1 -1
  160. package/src/scss/components/utility.scss +22 -0
  161. package/src/scss/variables-theme.scss +6 -6
  162. package/src/scss/variables.scss +6 -6
  163. package/tests/js/index.js +114 -85
  164. package/src/js/mixin/flex-bug.js +0 -56
  165. package/src/js/util/promise.js +0 -191
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.bbaa4362f | 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,1729 +7,1540 @@
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: {
15
+ percent(current) {
16
+ return translated(current);
17
+ },
12
18
 
13
- show: function(dir) {
14
- return [
15
- {transform: translate(dir * -100)},
16
- {transform: translate()}
17
- ];
18
- },
19
+ translate(percent, dir) {
20
+ return [
21
+ { transform: translate(dir * -100 * percent) },
22
+ { transform: translate(dir * 100 * (1 - percent)) }];
19
23
 
20
- percent: function(current) {
21
- return translated(current);
22
- },
24
+ } } };
23
25
 
24
- translate: function(percent, dir) {
25
- return [
26
- {transform: translate(dir * -100 * percent)},
27
- {transform: translate(dir * 100 * (1 - percent))}
28
- ];
29
- }
30
-
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
137
- },
138
-
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
-
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];
166
134
  },
167
135
 
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
- }
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));
196
182
 
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]);
183
+ },
212
184
 
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
- };
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
+ },
218
195
 
219
- return promise ? promise.then(done, function () {
220
- uikitUtil.removeClass(el, cls);
221
- return uikitUtil.Promise.reject();
222
- }) : done();
196
+ _toggle(el, toggled) {
197
+ if (!el) {
198
+ return;
199
+ }
223
200
 
224
- })).then(resolve, uikitUtil.noop); }
225
- );
226
- },
201
+ toggled = Boolean(toggled);
227
202
 
228
- isToggled: function(el) {
229
- var assign;
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
+ }
230
211
 
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
- },
212
+ uikitUtil.$$('[autofocus]', el).some((el) => uikitUtil.isVisible(el) ? el.focus() || true : el.blur());
241
213
 
242
- _toggle: function(el, toggled) {
214
+ if (changed) {
215
+ uikitUtil.trigger(el, 'toggled', [toggled, this]);
216
+ this.$update(el);
217
+ }
218
+ } } };
243
219
 
244
- if (!el) {
245
- return;
246
- }
247
220
 
248
- toggled = Boolean(toggled);
249
221
 
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
- }
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;
258
230
 
259
- uikitUtil.$$('[autofocus]', el).some(function (el) { return uikitUtil.isVisible(el) ? el.focus() || true : el.blur(); });
260
-
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],
330
-
331
- props: {
332
- selPanel: String,
333
- selClose: String,
334
- escClose: Boolean,
335
- bgClose: Boolean,
336
- stack: Boolean
337
- },
338
-
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;
285
+ props: {
286
+ selPanel: String,
287
+ selClose: String,
288
+ escClose: Boolean,
289
+ bgClose: Boolean,
290
+ stack: Boolean },
351
291
 
352
- return uikitUtil.$(selPanel, $el);
353
- },
354
292
 
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
- },
310
+ bgClose(_ref2) {let { bgClose } = _ref2;
311
+ return bgClose && this.panel;
312
+ } },
382
313
 
383
- handler: function(e) {
384
- e.preventDefault();
385
- this.hide();
386
- }
387
-
388
- },
389
-
390
- {
391
-
392
- name: 'toggle',
393
314
 
394
- self: true,
395
-
396
- handler: function(e, toggle) {
397
-
398
- if (e.defaultPrevented) {
399
- return;
400
- }
401
-
402
- e.preventDefault();
403
-
404
- if (this.isToggled() === uikitUtil.includes(active, this)) {
405
- this.toggle();
406
- }
407
- }
315
+ beforeDisconnect() {
316
+ if (uikitUtil.includes(active, this)) {
317
+ this.toggleElement(this.$el, false, false);
318
+ }
319
+ },
408
320
 
409
- },
321
+ events: [
322
+ {
323
+ name: 'click',
410
324
 
411
- {
412
- name: 'beforeshow',
325
+ delegate() {
326
+ return this.selClose;
327
+ },
413
328
 
414
- self: true,
329
+ handler(e) {
330
+ e.preventDefault();
331
+ this.hide();
332
+ } },
415
333
 
416
- handler: function(e) {
417
334
 
418
- if (uikitUtil.includes(active, this)) {
419
- return false;
420
- }
335
+ {
336
+ name: 'toggle',
421
337
 
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
- }
338
+ self: true,
429
339
 
430
- },
340
+ handler(e) {
341
+ if (e.defaultPrevented) {
342
+ return;
343
+ }
431
344
 
432
- {
345
+ e.preventDefault();
433
346
 
434
- name: 'show',
347
+ if (this.isToggled() === uikitUtil.includes(active, this)) {
348
+ this.toggle();
349
+ }
350
+ } },
435
351
 
436
- self: true,
437
352
 
438
- handler: function() {
439
- var this$1$1 = this;
353
+ {
354
+ name: 'beforeshow',
440
355
 
356
+ self: true,
441
357
 
442
- var docEl = document.documentElement;
358
+ handler(e) {
359
+ if (uikitUtil.includes(active, this)) {
360
+ return false;
361
+ }
443
362
 
444
- if (uikitUtil.width(window) > docEl.clientWidth && this.overlay) {
445
- uikitUtil.css(document.body, 'overflowY', 'scroll');
446
- }
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
+ } },
447
370
 
448
- if (this.stack) {
449
- uikitUtil.css(this.$el, 'zIndex', uikitUtil.toFloat(uikitUtil.css(this.$el, 'zIndex')) + active.length);
450
- }
451
371
 
452
- uikitUtil.addClass(docEl, this.clsPage);
372
+ {
373
+ name: 'show',
453
374
 
454
- if (this.bgClose) {
455
- uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, uikitUtil.pointerDown, function (ref) {
456
- var target = ref.target;
375
+ self: true,
457
376
 
377
+ handler() {
378
+ const docEl = document.documentElement;
458
379
 
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
- }
380
+ if (uikitUtil.width(window) > docEl.clientWidth && this.overlay) {
381
+ uikitUtil.css(document.body, 'overflowY', 'scroll');
382
+ }
462
383
 
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;
384
+ if (this.stack) {
385
+ uikitUtil.css(this.$el, 'zIndex', uikitUtil.toFloat(uikitUtil.css(this.$el, 'zIndex')) + active.length);
386
+ }
467
387
 
468
- if (!defaultPrevented && type === uikitUtil.pointerUp && target === newTarget) {
469
- this$1$1.hide();
470
- }
471
- }, true);
388
+ uikitUtil.addClass(docEl, this.clsPage);
472
389
 
473
- }), {self: true});
474
- }
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
+ }
475
402
 
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 {
596
-
597
- dir: dir,
598
-
599
- show: function(duration, percent, linear) {
600
- var this$1$1 = this;
601
- if ( percent === void 0 ) percent = 0;
602
-
603
-
604
- var timing = linear ? 'linear' : easing;
605
- duration -= Math.round(duration * uikitUtil.clamp(percent, -1, 1));
606
-
607
- this.translate(percent);
608
-
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
- },
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();
622
531
 
623
- cancel: function() {
624
- uikitUtil.Transition.cancel([next, prev]);
625
- },
532
+ return {
533
+ dir,
626
534
 
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();
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));
643
538
 
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});
539
+ this.translate(percent);
649
540
 
650
- },
541
+ triggerUpdate(next, 'itemin', { percent, duration, timing, dir });
542
+ triggerUpdate(prev, 'itemout', { percent: 1 - percent, duration, timing, dir });
651
543
 
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
- }
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);
663
551
 
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
552
+ return deferred.promise;
674
553
  },
675
554
 
676
- data: {
677
- autoplay: false,
678
- autoplayInterval: 7000,
679
- pauseOnHover: true
555
+ cancel() {
556
+ uikitUtil.Transition.cancel([next, prev]);
680
557
  },
681
558
 
682
- connected: function() {
683
- this.autoplay && this.startAutoplay();
559
+ reset() {
560
+ for (const prop in props[0]) {
561
+ uikitUtil.css([next, prev], prop, '');
562
+ }
684
563
  },
685
564
 
686
- disconnected: function() {
687
- this.stopAutoplay();
688
- },
689
-
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: [
570
+ translate(percent) {
571
+ this.reset();
695
572
 
696
- {
697
-
698
- name: 'visibilitychange',
699
-
700
- el: function() {
701
- return document;
702
- },
703
-
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,
783
-
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: {
815
-
816
- start: function() {
655
+ stopAutoplay() {
656
+ this.interval && clearInterval(this.interval);
657
+ } } };
817
658
 
818
- this.drag = this.pos;
659
+ var SliderDrag = {
660
+ props: {
661
+ draggable: Boolean },
819
662
 
820
- if (this._transitioner) {
821
663
 
822
- this.percent = this._transitioner.percent();
823
- this.drag += this._transitioner.getDistance() * this.percent * this.dir;
664
+ data: {
665
+ draggable: true,
666
+ threshold: 10 },
824
667
 
825
- this._transitioner.cancel();
826
- this._transitioner.translate(this.percent);
827
668
 
828
- this.dragging = true;
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);
829
674
 
830
- this.stack = [];
675
+ this.prevPos = pos === this.pos ? this.prevPos : this.pos;
676
+ this.pos = pos;
831
677
 
832
- } else {
833
- this.prevIndex = this.index;
834
- }
835
-
836
- uikitUtil.on(document, uikitUtil.pointerMove, this.move, {passive: false});
678
+ fn(e);
679
+ };
680
+ }
681
+ },
837
682
 
838
- // 'input' event is triggered by video controls
839
- uikitUtil.on(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input"), this.end, true);
683
+ events: [
684
+ {
685
+ name: uikitUtil.pointerDown,
840
686
 
841
- uikitUtil.css(this.list, 'userSelect', 'none');
687
+ delegate() {
688
+ return this.selSlides;
689
+ },
842
690
 
843
- },
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
+ }
844
701
 
845
- move: function(e) {
846
- var this$1$1 = this;
702
+ this.start(e);
703
+ } },
847
704
 
848
705
 
849
- var distance = this.pos - this.drag;
706
+ {
707
+ name: 'dragstart',
850
708
 
851
- if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
852
- return;
853
- }
709
+ handler(e) {
710
+ e.preventDefault();
711
+ } }],
854
712
 
855
- // prevent click event
856
- uikitUtil.css(this.list, 'pointerEvents', 'none');
857
713
 
858
- e.cancelable && e.preventDefault();
859
714
 
860
- this.dragging = true;
861
- this.dir = (distance < 0 ? 1 : -1);
715
+ methods: {
716
+ start() {
717
+ this.drag = this.pos;
862
718
 
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;
719
+ if (this._transitioner) {
720
+ this.percent = this._transitioner.percent();
721
+ this.drag += this._transitioner.getDistance() * this.percent * this.dir;
870
722
 
871
- while (nextIndex !== prevIndex && dis > width) {
723
+ this._transitioner.cancel();
724
+ this._transitioner.translate(this.percent);
872
725
 
873
- this.drag -= width * this.dir;
726
+ this.dragging = true;
874
727
 
875
- prevIndex = nextIndex;
876
- dis -= width;
877
- nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
878
- width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
728
+ this.stack = [];
729
+ } else {
730
+ this.prevIndex = this.index;
731
+ }
879
732
 
880
- }
733
+ uikitUtil.on(document, uikitUtil.pointerMove, this.move, { passive: false });
881
734
 
882
- this.percent = dis / width;
735
+ // 'input' event is triggered by video controls
736
+ uikitUtil.on(document, uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input", this.end, true);
883
737
 
884
- var prev = slides[prevIndex];
885
- var next = slides[nextIndex];
886
- var changed = this.index !== nextIndex;
887
- var edge = prevIndex === nextIndex;
738
+ uikitUtil.css(this.list, 'userSelect', 'none');
739
+ },
888
740
 
889
- var itemShown;
741
+ move(e) {
742
+ const distance = this.pos - this.drag;
890
743
 
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]);
744
+ if (
745
+ distance === 0 ||
746
+ this.prevPos === this.pos ||
747
+ !this.dragging && Math.abs(distance) < this.threshold)
748
+ {
749
+ return;
750
+ }
893
751
 
894
- if (edge) {
895
- itemShown = true;
896
- this$1$1.prevIndex = prevIndex;
897
- }
752
+ // prevent click event
753
+ uikitUtil.css(this.list, 'pointerEvents', 'none');
898
754
 
899
- });
755
+ e.cancelable && e.preventDefault();
900
756
 
901
- if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
902
- uikitUtil.trigger(slides[this.index], 'itemshown', [this]);
903
- }
757
+ this.dragging = true;
758
+ this.dir = distance < 0 ? 1 : -1;
904
759
 
905
- if (changed) {
906
- this.prevIndex = prevIndex;
907
- this.index = nextIndex;
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;
908
765
 
909
- !edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]);
910
- uikitUtil.trigger(next, 'beforeitemshow', [this]);
911
- }
766
+ while (nextIndex !== prevIndex && dis > width) {
767
+ this.drag -= width * this.dir;
912
768
 
913
- this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
769
+ prevIndex = nextIndex;
770
+ dis -= width;
771
+ nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
772
+ width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
773
+ }
914
774
 
915
- if (changed) {
916
- !edge && uikitUtil.trigger(prev, 'itemhide', [this]);
917
- uikitUtil.trigger(next, 'itemshow', [this]);
918
- }
775
+ this.percent = dis / width;
919
776
 
920
- },
777
+ const prev = slides[prevIndex];
778
+ const next = slides[nextIndex];
779
+ const changed = this.index !== nextIndex;
780
+ const edge = prevIndex === nextIndex;
921
781
 
922
- end: function() {
782
+ let itemShown;
923
783
 
924
- uikitUtil.off(document, uikitUtil.pointerMove, this.move, {passive: false});
925
- uikitUtil.off(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input"), this.end, true);
784
+ [this.index, this.prevIndex].
785
+ filter((i) => !uikitUtil.includes([nextIndex, prevIndex], i)).
786
+ forEach((i) => {
787
+ uikitUtil.trigger(slides[i], 'itemhidden', [this]);
926
788
 
927
- if (this.dragging) {
789
+ if (edge) {
790
+ itemShown = true;
791
+ this.prevIndex = prevIndex;
792
+ }
793
+ });
928
794
 
929
- this.dragging = null;
795
+ if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
796
+ uikitUtil.trigger(slides[this.index], 'itemshown', [this]);
797
+ }
930
798
 
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 {
799
+ if (changed) {
800
+ this.prevIndex = prevIndex;
801
+ this.index = nextIndex;
937
802
 
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;
803
+ !edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]);
804
+ uikitUtil.trigger(next, 'beforeitemshow', [this]);
805
+ }
940
806
 
941
- if (dirChange) {
942
- this.percent = 1 - this.percent;
943
- }
807
+ this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
944
808
 
945
- this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
946
- }
809
+ if (changed) {
810
+ !edge && uikitUtil.trigger(prev, 'itemhide', [this]);
811
+ uikitUtil.trigger(next, 'itemshow', [this]);
812
+ }
813
+ },
947
814
 
948
- }
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);
949
842
 
950
- uikitUtil.css(this.list, {userSelect: '', pointerEvents: ''});
843
+ }
844
+ }
951
845
 
952
- this.drag
953
- = this.percent
954
- = null;
846
+ uikitUtil.css(this.list, { userSelect: '', pointerEvents: '' });
955
847
 
956
- }
848
+ this.drag = this.percent = null;
849
+ } } };
957
850
 
958
- }
959
851
 
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 },
860
+
967
861
 
968
- data: {
969
- selNav: false
862
+ computed: {
863
+ nav(_ref, $el) {let { selNav } = _ref;
864
+ return uikitUtil.$(selNav, $el);
970
865
  },
971
866
 
972
- computed: {
867
+ selNavItem(_ref2) {let { attrItem } = _ref2;
868
+ return "[" + attrItem + "],[data-" + attrItem + "]";
869
+ },
973
870
 
974
- nav: function(ref, $el) {
975
- var selNav = ref.selNav;
871
+ navItems(_, $el) {
872
+ return uikitUtil.$$(this.selNavItem, $el);
873
+ } },
976
874
 
977
- return uikitUtil.$(selNav, $el);
978
- },
979
875
 
980
- selNavItem: function(ref) {
981
- var attrItem = ref.attrItem;
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(''));
982
884
 
983
- return ("[" + attrItem + "],[data-" + attrItem + "]");
984
- },
885
+ }
985
886
 
986
- navItems: function(_, $el) {
987
- return uikitUtil.$$(this.selNavItem, $el);
988
- }
887
+ this.navItems.concat(this.nav).forEach((el) => el && (el.hidden = !this.maxIndex));
989
888
 
889
+ this.updateNav();
990
890
  },
991
891
 
992
- update: {
892
+ events: ['resize'] },
993
893
 
994
- write: function() {
995
- var this$1$1 = this;
996
894
 
895
+ events: [
896
+ {
897
+ name: 'click',
997
898
 
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
- }
899
+ delegate() {
900
+ return this.selNavItem;
901
+ },
1001
902
 
1002
- this.navItems.concat(this.nav).forEach(function (el) { return el && (el.hidden = !this$1$1.maxIndex); });
903
+ handler(e) {
904
+ e.preventDefault();
905
+ this.show(uikitUtil.data(e.current, this.attrItem));
906
+ } },
1003
907
 
1004
- this.updateNav();
1005
908
 
1006
- },
909
+ {
910
+ name: 'itemshow',
911
+ handler: 'updateNav' }],
1007
912
 
1008
- events: ['resize']
1009
913
 
1010
- },
1011
914
 
1012
- events: [
915
+ methods: {
916
+ updateNav() {
917
+ const i = this.getValidIndex();
918
+ for (const el of this.navItems) {
919
+ const cmd = uikitUtil.data(el, this.attrItem);
1013
920
 
1014
- {
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));
1015
927
 
1016
- name: 'click',
928
+ }
929
+ } } };
1017
930
 
1018
- delegate: function() {
1019
- return this.selNavItem;
1020
- },
931
+ var Slider = {
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);
970
+ },
1021
971
 
1022
- handler: function(e) {
1023
- e.preventDefault();
1024
- this.show(uikitUtil.data(e.current, this.attrItem));
1025
- }
972
+ list(_ref2, $el) {let { selList } = _ref2;
973
+ return uikitUtil.$(selList, $el);
974
+ },
1026
975
 
1027
- },
976
+ maxIndex() {
977
+ return this.length - 1;
978
+ },
1028
979
 
1029
- {
980
+ selSlides(_ref3) {let { selList, selSlides } = _ref3;
981
+ return selList + " " + (selSlides || '> *');
982
+ },
1030
983
 
1031
- name: 'itemshow',
1032
- handler: 'updateNav'
984
+ slides: {
985
+ get() {
986
+ return uikitUtil.$$(this.selSlides, this.$el);
987
+ },
1033
988
 
1034
- }
989
+ watch() {
990
+ this.$reset();
991
+ } },
1035
992
 
1036
- ],
1037
993
 
1038
- methods: {
994
+ length() {
995
+ return this.slides.length;
996
+ } },
1039
997
 
1040
- updateNav: function() {
1041
- var this$1$1 = this;
1042
998
 
999
+ events: {
1000
+ itemshown() {
1001
+ this.$update(this.list);
1002
+ } },
1043
1003
 
1044
- var i = this.getValidIndex();
1045
- this.navItems.forEach(function (el) {
1046
1004
 
1047
- var cmd = uikitUtil.data(el, this$1$1.attrItem);
1005
+ methods: {
1006
+ show(index, force) {if (force === void 0) {force = false;}
1007
+ if (this.dragging || !this.length) {
1008
+ return;
1009
+ }
1048
1010
 
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
- });
1011
+ const { stack } = this;
1012
+ const queueIndex = force ? 0 : stack.length;
1013
+ const reset = () => {
1014
+ stack.splice(queueIndex, 1);
1052
1015
 
1016
+ if (stack.length) {
1017
+ this.show(stack.shift(), true);
1053
1018
  }
1019
+ };
1054
1020
 
1055
- }
1021
+ stack[force ? 'unshift' : 'push'](index);
1056
1022
 
1057
- };
1023
+ if (!force && stack.length > 1) {
1024
+ if (stack.length === 2) {
1025
+ this._transitioner.forward(Math.min(this.duration, 200));
1026
+ }
1058
1027
 
1059
- var Slider = {
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;
1065
+ }
1066
+ resolve();
1067
+ });
1068
+ });
1069
+ });
1060
1070
 
1061
- mixins: [SliderAutoplay, SliderDrag, SliderNav],
1071
+ prev && uikitUtil.trigger(prev, 'itemhide', [this]);
1072
+ uikitUtil.trigger(next, 'itemshow', [this]);
1062
1073
 
1063
- props: {
1064
- clsActivated: Boolean,
1065
- easing: String,
1066
- index: Number,
1067
- finite: Boolean,
1068
- velocity: Number,
1069
- selSlides: String
1074
+ return promise;
1070
1075
  },
1071
1076
 
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 = [];
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);
1090
1079
  },
1091
1080
 
1092
- disconnected: function() {
1093
- uikitUtil.removeClass(this.slides, this.clsActive);
1081
+ getValidIndex(index, prevIndex) {if (index === void 0) {index = this.index;}if (prevIndex === void 0) {prevIndex = this.prevIndex;}
1082
+ return this.getIndex(index, prevIndex);
1094
1083
  },
1095
1084
 
1096
- computed: {
1097
-
1098
- duration: function(ref, $el) {
1099
- var velocity = ref.velocity;
1100
-
1101
- return speedUp($el.offsetWidth / velocity);
1102
- },
1103
-
1104
- list: function(ref, $el) {
1105
- var selList = ref.selList;
1106
-
1107
- return uikitUtil.$(selList, $el);
1108
- },
1109
-
1110
- maxIndex: function() {
1111
- return this.length - 1;
1112
- },
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 },
1113
1097
 
1114
- selSlides: function(ref) {
1115
- var selList = ref.selList;
1116
- var selSlides = ref.selSlides;
1098
+ this.transitionOptions));
1117
1099
 
1118
- return (selList + " " + (selSlides || '> *'));
1119
- },
1120
1100
 
1121
- slides: {
1122
1101
 
1123
- get: function() {
1124
- return uikitUtil.$$(this.selSlides, this.$el);
1125
- },
1102
+ if (!force && !prev) {
1103
+ this._translate(1);
1104
+ return Promise.resolve();
1105
+ }
1126
1106
 
1127
- watch: function() {
1128
- this.$reset();
1129
- }
1130
-
1131
- },
1132
-
1133
- length: function() {
1134
- return this.slides.length;
1135
- }
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);
1136
1111
 
1137
1112
  },
1138
1113
 
1139
- events: {
1140
-
1141
- itemshown: function() {
1142
- this.$update(this.list);
1143
- }
1114
+ _getDistance(prev, next) {
1115
+ return this._getTransitioner(prev, prev !== next && next).getDistance();
1116
+ },
1144
1117
 
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;
1145
1122
  },
1146
1123
 
1147
- methods: {
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);
1148
1135
 
1149
- show: function(index, force) {
1150
- var this$1$1 = this;
1151
- if ( force === void 0 ) force = false;
1136
+ } } };
1152
1137
 
1153
1138
 
1154
- if (this.dragging || !this.length) {
1155
- return;
1156
- }
1157
1139
 
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);
1140
+ function getDirection(index, prevIndex) {
1141
+ return index === 'next' ? 1 : index === 'previous' ? -1 : index < prevIndex ? -1 : 1;
1142
+ }
1163
1143
 
1164
- if (stack.length) {
1165
- this$1$1.show(stack.shift(), true);
1166
- }
1167
- };
1144
+ function speedUp(x) {
1145
+ return 0.5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
1146
+ }
1168
1147
 
1169
- stack[force ? 'unshift' : 'push'](index);
1148
+ var Slideshow = {
1149
+ mixins: [Slider],
1170
1150
 
1171
- if (!force && stack.length > 1) {
1151
+ props: {
1152
+ animation: String },
1172
1153
 
1173
- if (stack.length === 2) {
1174
- this._transitioner.forward(Math.min(this.duration, 200));
1175
- }
1176
1154
 
1177
- return;
1178
- }
1155
+ data: {
1156
+ animation: 'slide',
1157
+ clsActivated: 'uk-transition-active',
1158
+ Animations: Animations$1,
1159
+ Transitioner },
1179
1160
 
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
1161
 
1185
- if (prev === next) {
1186
- reset();
1187
- return;
1188
- }
1162
+ computed: {
1163
+ animation(_ref) {let { animation, Animations } = _ref;
1164
+ return uikitUtil.assign(Animations[animation] || Animations.slide, { name: animation });
1165
+ },
1189
1166
 
1190
- this.dir = getDirection(index, prevIndex);
1191
- this.prevIndex = prevIndex;
1192
- this.index = nextIndex;
1167
+ transitionOptions() {
1168
+ return { animation: this.animation };
1169
+ } },
1193
1170
 
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;
1200
- }
1201
1171
 
1202
- var promise = this._show(prev, next, force).then(function () {
1172
+ events: {
1173
+ 'itemshow itemhide itemshown itemhidden'(_ref2) {let { target } = _ref2;
1174
+ this.$update(target);
1175
+ },
1203
1176
 
1204
- prev && uikitUtil.trigger(prev, 'itemhidden', [this$1$1]);
1205
- uikitUtil.trigger(next, 'itemshown', [this$1$1]);
1177
+ beforeitemshow(_ref3) {let { target } = _ref3;
1178
+ uikitUtil.addClass(target, this.clsActive);
1179
+ },
1206
1180
 
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
- });
1181
+ itemshown(_ref4) {let { target } = _ref4;
1182
+ uikitUtil.addClass(target, this.clsActivated);
1183
+ },
1218
1184
 
1219
- });
1185
+ itemhidden(_ref5) {let { target } = _ref5;
1186
+ uikitUtil.removeClass(target, this.clsActive, this.clsActivated);
1187
+ } } };
1220
1188
 
1221
- prev && uikitUtil.trigger(prev, 'itemhide', [this]);
1222
- uikitUtil.trigger(next, 'itemshow', [this]);
1189
+ var Component = {
1190
+ mixins: [Container, Modal, Togglable, Slideshow],
1223
1191
 
1224
- return promise;
1192
+ functional: true,
1225
1193
 
1226
- },
1194
+ props: {
1195
+ delayControls: Number,
1196
+ preload: Number,
1197
+ videoAutoplay: Boolean,
1198
+ template: String },
1227
1199
 
1228
- getIndex: function(index, prev) {
1229
- if ( index === void 0 ) index = this.index;
1230
- if ( prev === void 0 ) prev = this.index;
1231
1200
 
1232
- return uikitUtil.clamp(uikitUtil.getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
1233
- },
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>" }),
1234
1216
 
1235
- getValidIndex: function(index, prevIndex) {
1236
- if ( index === void 0 ) index = this.index;
1237
- if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
1238
1217
 
1239
- return this.getIndex(index, prevIndex);
1240
- },
1241
1218
 
1242
- _show: function(prev, next, force) {
1243
1219
 
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
- );
1256
1220
 
1257
- if (!force && !prev) {
1258
- this._translate(1);
1259
- return uikitUtil.Promise.resolve();
1260
- }
1261
1221
 
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
- }
1294
1222
 
1295
- }
1296
1223
 
1297
- };
1298
1224
 
1299
- function getDirection(index, prevIndex) {
1300
- return index === 'next'
1301
- ? 1
1302
- : index === 'previous'
1303
- ? -1
1304
- : index < prevIndex
1305
- ? -1
1306
- : 1;
1307
- }
1308
1225
 
1309
- function speedUp(x) {
1310
- return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
1311
- }
1226
+ created() {
1227
+ const $el = uikitUtil.$(this.template);
1228
+ const list = uikitUtil.$(this.selList, $el);
1229
+ this.items.forEach(() => uikitUtil.append(list, '<li>'));
1312
1230
 
1313
- var Slideshow = {
1231
+ this.$mount(uikitUtil.append(this.container, $el));
1232
+ },
1314
1233
 
1315
- mixins: [Slider],
1234
+ computed: {
1235
+ caption(_ref, $el) {let { selCaption } = _ref;
1236
+ return uikitUtil.$(selCaption, $el);
1237
+ } },
1316
1238
 
1317
- props: {
1318
- animation: String
1319
- },
1320
1239
 
1321
- data: {
1322
- animation: 'slide',
1323
- clsActivated: 'uk-transition-active',
1324
- Animations: Animations$1,
1325
- Transitioner: Transitioner
1326
- },
1240
+ events: [
1241
+ {
1242
+ name: uikitUtil.pointerMove + " " + uikitUtil.pointerDown + " keydown",
1327
1243
 
1328
- computed: {
1244
+ handler: 'showControls' },
1329
1245
 
1330
- animation: function(ref) {
1331
- var animation = ref.animation;
1332
- var Animations = ref.Animations;
1333
1246
 
1334
- return uikitUtil.assign(Animations[animation] || Animations.slide, {name: animation});
1335
- },
1247
+ {
1248
+ name: 'click',
1336
1249
 
1337
- transitionOptions: function() {
1338
- return {animation: this.animation};
1339
- }
1250
+ self: true,
1340
1251
 
1252
+ delegate() {
1253
+ return this.selSlides;
1341
1254
  },
1342
1255
 
1343
- events: {
1344
-
1345
- 'itemshow itemhide itemshown itemhidden': function(ref) {
1346
- var target = ref.target;
1256
+ handler(e) {
1257
+ if (e.defaultPrevented) {
1258
+ return;
1259
+ }
1347
1260
 
1348
- this.$update(target);
1349
- },
1261
+ this.hide();
1262
+ } },
1350
1263
 
1351
- beforeitemshow: function(ref) {
1352
- var target = ref.target;
1353
1264
 
1354
- uikitUtil.addClass(target, this.clsActive);
1355
- },
1265
+ {
1266
+ name: 'shown',
1356
1267
 
1357
- itemshown: function(ref) {
1358
- var target = ref.target;
1268
+ self: true,
1359
1269
 
1360
- uikitUtil.addClass(target, this.clsActivated);
1361
- },
1270
+ handler() {
1271
+ this.showControls();
1272
+ } },
1362
1273
 
1363
- itemhidden: function(ref) {
1364
- var target = ref.target;
1365
-
1366
- uikitUtil.removeClass(target, this.clsActive, this.clsActivated);
1367
- }
1368
-
1369
- }
1370
1274
 
1371
- };
1275
+ {
1276
+ name: 'hide',
1372
1277
 
1373
- var Component = {
1278
+ self: true,
1374
1279
 
1375
- mixins: [Container, Modal, Togglable, Slideshow],
1280
+ handler() {
1281
+ this.hideControls();
1376
1282
 
1377
- functional: true,
1283
+ uikitUtil.removeClass(this.slides, this.clsActive);
1284
+ uikitUtil.Transition.stop(this.slides);
1285
+ } },
1378
1286
 
1379
- props: {
1380
- delayControls: Number,
1381
- preload: Number,
1382
- videoAutoplay: Boolean,
1383
- template: String
1384
- },
1385
1287
 
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));
1288
+ {
1289
+ name: 'hidden',
1410
1290
 
1411
- },
1291
+ self: true,
1412
1292
 
1413
- computed: {
1293
+ handler() {
1294
+ this.$destroy(true);
1295
+ } },
1414
1296
 
1415
- caption: function(ref, $el) {
1416
- var selCaption = ref.selCaption;
1417
1297
 
1418
- return uikitUtil.$(selCaption, $el);
1419
- }
1298
+ {
1299
+ name: 'keyup',
1420
1300
 
1301
+ el() {
1302
+ return document;
1421
1303
  },
1422
1304
 
1423
- events: [
1424
-
1425
- {
1426
-
1427
- name: (uikitUtil.pointerMove + " " + uikitUtil.pointerDown + " keydown"),
1428
-
1429
- handler: 'showControls'
1430
-
1431
- },
1305
+ handler(e) {
1306
+ if (!this.isToggled(this.$el) || !this.draggable) {
1307
+ return;
1308
+ }
1432
1309
 
1433
- {
1310
+ switch (e.keyCode) {
1311
+ case 37:
1312
+ this.show('previous');
1313
+ break;
1314
+ case 39:
1315
+ this.show('next');
1316
+ break;}
1434
1317
 
1435
- name: 'click',
1318
+ } },
1436
1319
 
1437
- self: true,
1438
1320
 
1439
- delegate: function() {
1440
- return this.selSlides;
1441
- },
1321
+ {
1322
+ name: 'beforeitemshow',
1442
1323
 
1443
- handler: function(e) {
1324
+ handler(e) {
1325
+ if (this.isToggled()) {
1326
+ return;
1327
+ }
1444
1328
 
1445
- if (e.defaultPrevented) {
1446
- return;
1447
- }
1329
+ this.draggable = false;
1448
1330
 
1449
- this.hide();
1450
- }
1331
+ e.preventDefault();
1451
1332
 
1452
- },
1333
+ this.toggleElement(this.$el, true, false);
1453
1334
 
1454
- {
1335
+ this.animation = Animations['scale'];
1336
+ uikitUtil.removeClass(e.target, this.clsActive);
1337
+ this.stack.splice(1, 0, this.index);
1338
+ } },
1455
1339
 
1456
- name: 'shown',
1457
1340
 
1458
- self: true,
1341
+ {
1342
+ name: 'itemshow',
1459
1343
 
1460
- handler: function() {
1461
- this.showControls();
1462
- }
1344
+ handler() {
1345
+ uikitUtil.html(this.caption, this.getItem().caption || '');
1463
1346
 
1464
- },
1347
+ for (let j = -this.preload; j <= this.preload; j++) {
1348
+ this.loadItem(this.index + j);
1349
+ }
1350
+ } },
1465
1351
 
1466
- {
1467
1352
 
1468
- name: 'hide',
1353
+ {
1354
+ name: 'itemshown',
1469
1355
 
1470
- self: true,
1356
+ handler() {
1357
+ this.draggable = this.$props.draggable;
1358
+ } },
1471
1359
 
1472
- handler: function() {
1473
1360
 
1474
- this.hideControls();
1361
+ {
1362
+ name: 'itemload',
1475
1363
 
1476
- uikitUtil.removeClass(this.slides, this.clsActive);
1477
- uikitUtil.Transition.stop(this.slides);
1364
+ async handler(_, item) {
1365
+ const { source: src, type, alt = '', poster, attrs = {} } = item;
1478
1366
 
1479
- }
1480
- },
1367
+ this.setItem(item, '<span uk-spinner></span>');
1481
1368
 
1482
- {
1369
+ if (!src) {
1370
+ return;
1371
+ }
1483
1372
 
1484
- name: 'hidden',
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 };
1485
1381
 
1486
- self: true,
1487
1382
 
1488
- handler: function() {
1489
- this.$destroy(true);
1490
- }
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)));
1491
1390
 
1492
- },
1391
+ } catch (e) {
1392
+ this.setError(item);
1393
+ }
1493
1394
 
1395
+ // Video
1396
+ } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) {
1397
+ const video = createEl(
1398
+ 'video',
1399
+ uikitUtil.assign(
1494
1400
  {
1401
+ src,
1402
+ poster,
1403
+ controls: '',
1404
+ playsinline: '',
1405
+ 'uk-video': "" + this.videoAutoplay },
1495
1406
 
1496
- name: 'keyup',
1497
-
1498
- el: function() {
1499
- return document;
1500
- },
1407
+ attrs));
1501
1408
 
1502
- handler: function(e) {
1503
1409
 
1504
- if (!this.isToggled(this.$el) || !this.draggable) {
1505
- return;
1506
- }
1507
-
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
- },
1518
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(
1519
1424
  {
1425
+ src,
1426
+ frameborder: '0',
1427
+ allowfullscreen: '',
1428
+ class: 'uk-lightbox-iframe' },
1520
1429
 
1521
- name: 'beforeitemshow',
1522
-
1523
- handler: function(e) {
1524
-
1525
- if (this.isToggled()) {
1526
- return;
1527
- }
1430
+ attrs)));
1528
1431
 
1529
- this.draggable = false;
1530
1432
 
1531
- e.preventDefault();
1532
1433
 
1533
- this.toggleElement(this.$el, true, false);
1534
1434
 
1535
- this.animation = Animations['scale'];
1536
- uikitUtil.removeClass(e.target, this.clsActive);
1537
- this.stack.splice(1, 0, this.index);
1538
-
1539
- }
1540
-
1541
- },
1435
+ // YouTube
1436
+ } else if (
1437
+ matches = src.match(
1438
+ /\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))
1542
1439
 
1440
+ {
1441
+ this.setItem(
1442
+ item,
1443
+ createEl(
1444
+ 'iframe',
1445
+ uikitUtil.assign(
1543
1446
  {
1447
+ src: "https://www.youtube" + (matches[1] || '') + ".com/embed/" +
1448
+ matches[2] + (
1449
+ matches[3] ? "?" + matches[3] : ''),
1450
+ width: 1920,
1451
+ height: 1080 },
1544
1452
 
1545
- name: 'itemshow',
1453
+ iframeAttrs,
1454
+ attrs)));
1546
1455
 
1547
- handler: function() {
1548
1456
 
1549
- uikitUtil.html(this.caption, this.getItem().caption || '');
1550
1457
 
1551
- for (var j = -this.preload; j <= this.preload; j++) {
1552
- this.loadItem(this.index + j);
1553
- }
1554
1458
 
1555
- }
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),
1556
1466
 
1557
- },
1467
+ {
1468
+ credentials: 'omit' })).
1558
1469
 
1559
- {
1560
1470
 
1561
- name: 'itemshown',
1471
+ json();
1562
1472
 
1563
- handler: function() {
1564
- this.draggable = this.$props.draggable;
1565
- }
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] : ''),
1566
1481
 
1567
- },
1482
+ width,
1483
+ height },
1568
1484
 
1569
- {
1485
+ iframeAttrs,
1486
+ attrs)));
1570
1487
 
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
1488
 
1671
- }
1672
1489
 
1490
+ } catch (e) {
1491
+ this.setError(item);
1673
1492
  }
1493
+ }
1494
+ } }],
1674
1495
 
1675
- ],
1676
-
1677
- methods: {
1678
-
1679
- loadItem: function(index) {
1680
- if ( index === void 0 ) index = this.index;
1681
-
1682
-
1683
- var item = this.getItem(index);
1684
-
1685
- if (!this.getSlide(item).childElementCount) {
1686
- uikitUtil.trigger(this.$el, 'itemload', [item]);
1687
- }
1688
- },
1689
1496
 
1690
- getItem: function(index) {
1691
- if ( index === void 0 ) index = this.index;
1692
1497
 
1693
- return this.items[uikitUtil.getIndex(index, this.slides)];
1694
- },
1498
+ methods: {
1499
+ loadItem(index) {if (index === void 0) {index = this.index;}
1500
+ const item = this.getItem(index);
1695
1501
 
1696
- setItem: function(item, content) {
1697
- uikitUtil.trigger(this.$el, 'itemloaded', [this, uikitUtil.html(this.getSlide(item), content) ]);
1698
- },
1502
+ if (!this.getSlide(item).childElementCount) {
1503
+ uikitUtil.trigger(this.$el, 'itemload', [item]);
1504
+ }
1505
+ },
1699
1506
 
1700
- getSlide: function(item) {
1701
- return this.slides[this.items.indexOf(item)];
1702
- },
1507
+ getItem(index) {if (index === void 0) {index = this.index;}
1508
+ return this.items[uikitUtil.getIndex(index, this.slides)];
1509
+ },
1703
1510
 
1704
- setError: function(item) {
1705
- this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
1706
- },
1511
+ setItem(item, content) {
1512
+ uikitUtil.trigger(this.$el, 'itemloaded', [this, uikitUtil.html(this.getSlide(item), content)]);
1513
+ },
1707
1514
 
1708
- showControls: function() {
1515
+ getSlide(item) {
1516
+ return this.slides[this.items.indexOf(item)];
1517
+ },
1709
1518
 
1710
- clearTimeout(this.controlsTimer);
1711
- this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
1519
+ setError(item) {
1520
+ this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>');
1521
+ },
1712
1522
 
1713
- uikitUtil.addClass(this.$el, 'uk-active', 'uk-transition-active');
1523
+ showControls() {
1524
+ clearTimeout(this.controlsTimer);
1525
+ this.controlsTimer = setTimeout(this.hideControls, this.delayControls);
1714
1526
 
1715
- },
1527
+ uikitUtil.addClass(this.$el, 'uk-active', 'uk-transition-active');
1528
+ },
1716
1529
 
1717
- hideControls: function() {
1718
- uikitUtil.removeClass(this.$el, 'uk-active', 'uk-transition-active');
1719
- }
1530
+ hideControls() {
1531
+ uikitUtil.removeClass(this.$el, 'uk-active', 'uk-transition-active');
1532
+ } } };
1720
1533
 
1721
- }
1722
1534
 
1723
- };
1724
1535
 
1725
1536
  function createEl(tag, attrs) {
1726
- var el = uikitUtil.fragment(("<" + tag + ">"));
1727
- uikitUtil.attr(el, attrs);
1728
- return el;
1537
+ const el = uikitUtil.fragment("<" + tag + ">");
1538
+ uikitUtil.attr(el, attrs);
1539
+ return el;
1729
1540
  }
1730
1541
 
1731
1542
  if (typeof window !== 'undefined' && window.UIkit) {
1732
- window.UIkit.component('lightboxPanel', Component);
1543
+ window.UIkit.component('lightboxPanel', Component);
1733
1544
  }
1734
1545
 
1735
1546
  return Component;