uikit 3.11.2-dev.9433cd5fd → 3.11.2-dev.a87448e52

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