uikit 3.11.2-dev.fb043abc2 → 3.12.2

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 (228) 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 +63 -20
  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 +144 -202
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +144 -202
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +146 -208
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +146 -208
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +66 -138
  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 +1091 -1319
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1137 -1396
  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 +347 -361
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +345 -360
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +749 -843
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +345 -360
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +628 -798
  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 +156 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5317 -6554
  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 +8018 -9698
  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 +199 -187
  66. package/src/js/components/countdown.js +32 -85
  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 +9 -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 +117 -89
  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 +53 -63
  84. package/src/js/core/accordion.js +58 -48
  85. package/src/js/core/alert.js +9 -17
  86. package/src/js/core/core.js +17 -69
  87. package/src/js/core/cover.js +15 -15
  88. package/src/js/core/drop.js +110 -94
  89. package/src/js/core/form-custom.js +22 -27
  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 +30 -34
  94. package/src/js/core/icon.js +47 -52
  95. package/src/js/core/img.js +153 -143
  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 +113 -85
  102. package/src/js/core/offcanvas.js +51 -54
  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 +161 -128
  109. package/src/js/core/svg.js +68 -83
  110. package/src/js/core/switcher.js +56 -47
  111. package/src/js/core/tab.js +7 -10
  112. package/src/js/core/toggle.js +69 -68
  113. package/src/js/core/video.js +22 -21
  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/lazyload.js +20 -0
  122. package/src/js/mixin/media.js +5 -10
  123. package/src/js/mixin/modal.js +89 -66
  124. package/src/js/mixin/parallax.js +149 -107
  125. package/src/js/mixin/position.js +26 -20
  126. package/src/js/mixin/slider-autoplay.js +12 -21
  127. package/src/js/mixin/slider-drag.js +64 -65
  128. package/src/js/mixin/slider-nav.js +26 -35
  129. package/src/js/mixin/slider-reactive.js +2 -8
  130. package/src/js/mixin/slider.js +47 -60
  131. package/src/js/mixin/slideshow.js +12 -22
  132. package/src/js/mixin/swipe.js +72 -0
  133. package/src/js/mixin/togglable.js +89 -63
  134. package/src/js/uikit-core.js +2 -4
  135. package/src/js/uikit.js +2 -4
  136. package/src/js/util/ajax.js +25 -40
  137. package/src/js/util/animation.js +77 -75
  138. package/src/js/util/attr.js +17 -21
  139. package/src/js/util/class.js +14 -52
  140. package/src/js/util/dimensions.js +58 -45
  141. package/src/js/util/dom.js +37 -66
  142. package/src/js/util/env.js +7 -12
  143. package/src/js/util/event.js +60 -59
  144. package/src/js/util/fastdom.js +1 -6
  145. package/src/js/util/filter.js +18 -36
  146. package/src/js/util/index.js +1 -1
  147. package/src/js/util/lang.js +82 -121
  148. package/src/js/util/mouse.js +19 -17
  149. package/src/js/util/observer.js +36 -0
  150. package/src/js/util/options.js +35 -49
  151. package/src/js/util/player.js +41 -36
  152. package/src/js/util/position.js +54 -46
  153. package/src/js/util/selector.js +43 -58
  154. package/src/js/util/style.js +39 -49
  155. package/src/js/util/viewport.js +75 -64
  156. package/src/less/components/base.less +10 -33
  157. package/src/less/components/flex.less +0 -9
  158. package/src/less/components/form-range.less +48 -95
  159. package/src/less/components/form.less +0 -1
  160. package/src/less/components/height.less +3 -0
  161. package/src/less/components/leader.less +0 -1
  162. package/src/less/components/lightbox.less +0 -1
  163. package/src/less/components/list.less +5 -1
  164. package/src/less/components/modal.less +3 -7
  165. package/src/less/components/navbar.less +0 -7
  166. package/src/less/components/progress.less +14 -36
  167. package/src/less/components/slider.less +3 -3
  168. package/src/less/components/slideshow.less +3 -3
  169. package/src/less/components/text.less +16 -32
  170. package/src/less/components/utility.less +25 -0
  171. package/src/scss/components/base.scss +10 -33
  172. package/src/scss/components/flex.scss +0 -9
  173. package/src/scss/components/form-range.scss +48 -95
  174. package/src/scss/components/form.scss +3 -4
  175. package/src/scss/components/height.scss +3 -0
  176. package/src/scss/components/icon.scss +2 -2
  177. package/src/scss/components/leader.scss +0 -1
  178. package/src/scss/components/lightbox.scss +0 -1
  179. package/src/scss/components/list.scss +5 -1
  180. package/src/scss/components/modal.scss +3 -7
  181. package/src/scss/components/navbar.scss +0 -7
  182. package/src/scss/components/progress.scss +14 -36
  183. package/src/scss/components/search.scss +1 -1
  184. package/src/scss/components/slider.scss +3 -3
  185. package/src/scss/components/slideshow.scss +3 -3
  186. package/src/scss/components/text.scss +16 -32
  187. package/src/scss/components/utility.scss +25 -0
  188. package/src/scss/mixins-theme.scss +1 -1
  189. package/src/scss/mixins.scss +1 -1
  190. package/src/scss/variables-theme.scss +9 -9
  191. package/src/scss/variables.scss +9 -9
  192. package/tests/align.html +10 -10
  193. package/tests/animation.html +2 -2
  194. package/tests/article.html +2 -2
  195. package/tests/base.html +3 -3
  196. package/tests/card.html +10 -10
  197. package/tests/column.html +3 -3
  198. package/tests/comment.html +9 -9
  199. package/tests/countdown.html +10 -8
  200. package/tests/dotnav.html +3 -3
  201. package/tests/image.html +296 -64
  202. package/tests/images/image-type.avif +0 -0
  203. package/tests/images/image-type.jpeg +0 -0
  204. package/tests/images/image-type.webp +0 -0
  205. package/tests/index.html +8 -8
  206. package/tests/js/index.js +114 -85
  207. package/tests/lightbox.html +10 -10
  208. package/tests/marker.html +2 -2
  209. package/tests/modal.html +8 -9
  210. package/tests/navbar.html +2 -2
  211. package/tests/overlay.html +7 -7
  212. package/tests/parallax.html +16 -7
  213. package/tests/position.html +12 -12
  214. package/tests/slidenav.html +12 -12
  215. package/tests/slider.html +20 -20
  216. package/tests/sortable.html +1 -1
  217. package/tests/sticky-parallax.html +57 -72
  218. package/tests/sticky.html +14 -3
  219. package/tests/svg.html +6 -6
  220. package/tests/table.html +11 -11
  221. package/tests/thumbnav.html +12 -12
  222. package/tests/transition.html +30 -30
  223. package/tests/utility.html +50 -33
  224. package/tests/video.html +1 -1
  225. package/tests/width.html +1 -1
  226. package/src/js/mixin/flex-bug.js +0 -56
  227. package/src/js/util/promise.js +0 -191
  228. package/tests/images/animated.gif +0 -0
@@ -1,9 +1,40 @@
1
1
  import Animate from '../mixin/animate';
2
2
  import Class from '../mixin/class';
3
- import {$$, addClass, append, assign, before, children, css, findIndex, getEventPos, getViewport, hasTouch, height, index, isEmpty, isInput, off, offset, on, parent, pointerDown, pointerMove, pointerUp, pointInRect, remove, removeClass, scrollParents, scrollTop, toggleClass, Transition, trigger, within} from 'uikit-util';
3
+ import {
4
+ $$,
5
+ addClass,
6
+ append,
7
+ assign,
8
+ before,
9
+ children,
10
+ css,
11
+ findIndex,
12
+ getEventPos,
13
+ getViewport,
14
+ hasTouch,
15
+ height,
16
+ index,
17
+ isEmpty,
18
+ isInput,
19
+ off,
20
+ offset,
21
+ on,
22
+ parent,
23
+ pointerDown,
24
+ pointerMove,
25
+ pointerUp,
26
+ pointInRect,
27
+ remove,
28
+ removeClass,
29
+ scrollParents,
30
+ scrollTop,
31
+ toggleClass,
32
+ Transition,
33
+ trigger,
34
+ within,
35
+ } from 'uikit-util';
4
36
 
5
37
  export default {
6
-
7
38
  mixins: [Class, Animate],
8
39
 
9
40
  props: {
@@ -17,7 +48,7 @@ export default {
17
48
  clsNoDrag: String,
18
49
  clsEmpty: String,
19
50
  clsCustom: String,
20
- handle: String
51
+ handle: String,
21
52
  },
22
53
 
23
54
  data: {
@@ -32,29 +63,26 @@ export default {
32
63
  clsEmpty: 'uk-sortable-empty',
33
64
  clsCustom: '',
34
65
  handle: false,
35
- pos: {}
66
+ pos: {},
36
67
  },
37
68
 
38
69
  created() {
39
- ['init', 'start', 'move', 'end'].forEach(key => {
70
+ for (const key of ['init', 'start', 'move', 'end']) {
40
71
  const fn = this[key];
41
- this[key] = e => {
72
+ this[key] = (e) => {
42
73
  assign(this.pos, getEventPos(e));
43
74
  fn(e);
44
75
  };
45
- });
76
+ }
46
77
  },
47
78
 
48
79
  events: {
49
-
50
80
  name: pointerDown,
51
81
  passive: false,
52
- handler: 'init'
53
-
82
+ handler: 'init',
54
83
  },
55
84
 
56
85
  computed: {
57
-
58
86
  target() {
59
87
  return (this.$el.tBodies || [this.$el])[0];
60
88
  },
@@ -64,7 +92,6 @@ export default {
64
92
  },
65
93
 
66
94
  isEmpty: {
67
-
68
95
  get() {
69
96
  return isEmpty(this.items);
70
97
  },
@@ -73,40 +100,38 @@ export default {
73
100
  toggleClass(this.target, this.clsEmpty, empty);
74
101
  },
75
102
 
76
- immediate: true
77
-
103
+ immediate: true,
78
104
  },
79
105
 
80
106
  handles: {
81
-
82
- get({handle}, el) {
107
+ get({ handle }, el) {
83
108
  return handle ? $$(handle, el) : this.items;
84
109
  },
85
110
 
86
111
  watch(handles, prev) {
87
- css(prev, {touchAction: '', userSelect: ''});
88
- css(handles, {touchAction: hasTouch ? 'none' : '', userSelect: 'none'}); // touchAction set to 'none' causes a performance drop in Chrome 80
112
+ css(prev, { touchAction: '', userSelect: '' });
113
+ css(handles, { touchAction: hasTouch ? 'none' : '', userSelect: 'none' }); // touchAction set to 'none' causes a performance drop in Chrome 80
89
114
  },
90
115
 
91
- immediate: true
92
-
93
- }
94
-
116
+ immediate: true,
117
+ },
95
118
  },
96
119
 
97
120
  update: {
98
-
99
121
  write(data) {
100
-
101
122
  if (!this.drag || !parent(this.placeholder)) {
102
123
  return;
103
124
  }
104
125
 
105
- const {pos: {x, y}, origin: {offsetTop, offsetLeft}, placeholder} = this;
126
+ const {
127
+ pos: { x, y },
128
+ origin: { offsetTop, offsetLeft },
129
+ placeholder,
130
+ } = this;
106
131
 
107
132
  css(this.drag, {
108
133
  top: y - offsetTop,
109
- left: x - offsetLeft
134
+ left: x - offsetLeft,
110
135
  });
111
136
 
112
137
  const sortable = this.getSortable(document.elementFromPoint(x, y));
@@ -115,20 +140,27 @@ export default {
115
140
  return;
116
141
  }
117
142
 
118
- const {items} = sortable;
143
+ const { items } = sortable;
119
144
 
120
145
  if (items.some(Transition.inProgress)) {
121
146
  return;
122
147
  }
123
148
 
124
- const target = findTarget(items, {x, y});
149
+ const target = findTarget(items, { x, y });
125
150
 
126
151
  if (items.length && (!target || target === placeholder)) {
127
152
  return;
128
153
  }
129
154
 
130
155
  const previous = this.getSortable(placeholder);
131
- const insertTarget = findInsertTarget(sortable.target, target, placeholder, x, y, sortable === previous && data.moved !== target);
156
+ const insertTarget = findInsertTarget(
157
+ sortable.target,
158
+ target,
159
+ placeholder,
160
+ x,
161
+ y,
162
+ sortable === previous && data.moved !== target
163
+ );
132
164
 
133
165
  if (insertTarget === false) {
134
166
  return;
@@ -150,23 +182,21 @@ export default {
150
182
  this.touched.add(sortable);
151
183
  },
152
184
 
153
- events: ['move']
154
-
185
+ events: ['move'],
155
186
  },
156
187
 
157
188
  methods: {
158
-
159
189
  init(e) {
160
-
161
- const {target, button, defaultPrevented} = e;
162
- const [placeholder] = this.items.filter(el => within(target, el));
163
-
164
- if (!placeholder
165
- || defaultPrevented
166
- || button > 0
167
- || isInput(target)
168
- || within(target, `.${this.clsNoDrag}`)
169
- || this.handle && !within(target, this.handle)
190
+ const { target, button, defaultPrevented } = e;
191
+ const [placeholder] = this.items.filter((el) => within(target, el));
192
+
193
+ if (
194
+ !placeholder ||
195
+ defaultPrevented ||
196
+ button > 0 ||
197
+ isInput(target) ||
198
+ within(target, `.${this.clsNoDrag}`) ||
199
+ (this.handle && !within(target, this.handle))
170
200
  ) {
171
201
  return;
172
202
  }
@@ -175,7 +205,7 @@ export default {
175
205
 
176
206
  this.touched = new Set([this]);
177
207
  this.placeholder = placeholder;
178
- this.origin = assign({target, index: index(placeholder)}, this.pos);
208
+ this.origin = { target, index: index(placeholder), ...this.pos };
179
209
 
180
210
  on(document, pointerMove, this.move);
181
211
  on(document, pointerUp, this.end);
@@ -183,14 +213,12 @@ export default {
183
213
  if (!this.threshold) {
184
214
  this.start(e);
185
215
  }
186
-
187
216
  },
188
217
 
189
218
  start(e) {
190
-
191
219
  this.drag = appendDrag(this.$container, this.placeholder);
192
- const {left, top} = this.placeholder.getBoundingClientRect();
193
- assign(this.origin, {offsetLeft: this.pos.x - left, offsetTop: this.pos.y - top});
220
+ const { left, top } = this.placeholder.getBoundingClientRect();
221
+ assign(this.origin, { offsetLeft: this.pos.x - left, offsetTop: this.pos.y - top });
194
222
 
195
223
  addClass(this.drag, this.clsDrag, this.clsCustom);
196
224
  addClass(this.placeholder, this.clsPlaceholder);
@@ -205,17 +233,17 @@ export default {
205
233
  },
206
234
 
207
235
  move(e) {
208
-
209
236
  if (this.drag) {
210
237
  this.$emit('move');
211
- } else if (Math.abs(this.pos.x - this.origin.x) > this.threshold || Math.abs(this.pos.y - this.origin.y) > this.threshold) {
238
+ } else if (
239
+ Math.abs(this.pos.x - this.origin.x) > this.threshold ||
240
+ Math.abs(this.pos.y - this.origin.y) > this.threshold
241
+ ) {
212
242
  this.start(e);
213
243
  }
214
-
215
244
  },
216
245
 
217
246
  end() {
218
-
219
247
  off(document, pointerMove, this.move);
220
248
  off(document, pointerUp, this.end);
221
249
 
@@ -241,87 +269,77 @@ export default {
241
269
  remove(this.drag);
242
270
  this.drag = null;
243
271
 
244
- this.touched.forEach(({clsPlaceholder, clsItem}) =>
245
- this.touched.forEach(sortable =>
246
- removeClass(sortable.items, clsPlaceholder, clsItem)
247
- )
248
- );
272
+ for (const { clsPlaceholder, clsItem } of this.touched) {
273
+ for (const sortable of this.touched) {
274
+ removeClass(sortable.items, clsPlaceholder, clsItem);
275
+ }
276
+ }
249
277
  this.touched = null;
250
278
  removeClass(document.documentElement, this.clsDragState);
251
-
252
279
  },
253
280
 
254
281
  insert(element, target) {
255
-
256
282
  addClass(this.items, this.clsItem);
257
283
 
258
- const insert = () => target
259
- ? before(target, element)
260
- : append(this.target, element);
284
+ const insert = () => (target ? before(target, element) : append(this.target, element));
261
285
 
262
286
  this.animate(insert);
263
-
264
287
  },
265
288
 
266
289
  remove(element) {
267
-
268
290
  if (!within(element, this.target)) {
269
291
  return;
270
292
  }
271
293
 
272
294
  this.animate(() => remove(element));
273
-
274
295
  },
275
296
 
276
297
  getSortable(element) {
277
298
  do {
278
299
  const sortable = this.$getComponent(element, 'sortable');
279
300
 
280
- if (sortable && (sortable === this || this.group !== false && sortable.group === this.group)) {
301
+ if (
302
+ sortable &&
303
+ (sortable === this || (this.group !== false && sortable.group === this.group))
304
+ ) {
281
305
  return sortable;
282
306
  }
283
307
  } while ((element = parent(element)));
284
- }
285
-
286
- }
287
-
308
+ },
309
+ },
288
310
  };
289
311
 
290
312
  let trackTimer;
291
313
  function trackScroll(pos) {
292
-
293
314
  let last = Date.now();
294
315
  trackTimer = setInterval(() => {
295
-
296
- let {x, y} = pos;
316
+ let { x, y } = pos;
297
317
  y += scrollTop(window);
298
318
 
299
- const dist = (Date.now() - last) * .3;
319
+ const dist = (Date.now() - last) * 0.3;
300
320
  last = Date.now();
301
321
 
302
- scrollParents(document.elementFromPoint(x, pos.y), /auto|scroll/).reverse().some(scrollEl => {
303
-
304
- let {scrollTop: scroll, scrollHeight} = scrollEl;
305
-
306
- const {top, bottom, height} = offset(getViewport(scrollEl));
307
-
308
- if (top < y && top + 35 > y) {
309
- scroll -= dist;
310
- } else if (bottom > y && bottom - 35 < y) {
311
- scroll += dist;
312
- } else {
313
- return;
314
- }
322
+ scrollParents(document.elementFromPoint(x, pos.y), /auto|scroll/)
323
+ .reverse()
324
+ .some((scrollEl) => {
325
+ let { scrollTop: scroll, scrollHeight } = scrollEl;
315
326
 
316
- if (scroll > 0 && scroll < scrollHeight - height) {
317
- scrollTop(scrollEl, scroll);
318
- return true;
319
- }
327
+ const { top, bottom, height } = offset(getViewport(scrollEl));
320
328
 
321
- });
329
+ if (top < y && top + 35 > y) {
330
+ scroll -= dist;
331
+ } else if (bottom > y && bottom - 35 < y) {
332
+ scroll += dist;
333
+ } else {
334
+ return;
335
+ }
322
336
 
337
+ if (scroll > 0 && scroll < scrollHeight - height) {
338
+ scrollTop(scrollEl, scroll);
339
+ return true;
340
+ }
341
+ });
323
342
  }, 15);
324
-
325
343
  }
326
344
 
327
345
  function untrackScroll() {
@@ -329,14 +347,18 @@ function untrackScroll() {
329
347
  }
330
348
 
331
349
  function appendDrag(container, element) {
332
- const clone = append(container, element.outerHTML.replace(/(^<)(?:li|tr)|(?:li|tr)(\/>$)/g, '$1div$2'));
350
+ const clone = append(
351
+ container,
352
+ element.outerHTML.replace(/(^<)(?:li|tr)|(?:li|tr)(\/>$)/g, '$1div$2')
353
+ );
333
354
 
334
355
  css(clone, 'margin', '0', 'important');
335
- css(clone, assign({
356
+ css(clone, {
336
357
  boxSizing: 'border-box',
337
358
  width: element.offsetWidth,
338
- height: element.offsetHeight
339
- }, css(element, ['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'])));
359
+ height: element.offsetHeight,
360
+ padding: css(element, 'padding'),
361
+ });
340
362
 
341
363
  height(clone.firstElementChild, height(element.firstElementChild));
342
364
 
@@ -344,22 +366,18 @@ function appendDrag(container, element) {
344
366
  }
345
367
 
346
368
  function findTarget(items, point) {
347
- return items[findIndex(items, item => pointInRect(point, item.getBoundingClientRect()))];
369
+ return items[findIndex(items, (item) => pointInRect(point, item.getBoundingClientRect()))];
348
370
  }
349
371
 
350
372
  function findInsertTarget(list, target, placeholder, x, y, sameList) {
351
-
352
373
  if (!children(list).length) {
353
374
  return;
354
375
  }
355
376
 
356
377
  const rect = target.getBoundingClientRect();
357
378
  if (!sameList) {
358
-
359
379
  if (!isHorizontal(list, placeholder)) {
360
- return y < rect.top + rect.height / 2
361
- ? target
362
- : target.nextElementSibling;
380
+ return y < rect.top + rect.height / 2 ? target : target.nextElementSibling;
363
381
  }
364
382
 
365
383
  return target;
@@ -376,10 +394,12 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
376
394
  const startProp = sameRow ? 'left' : 'top';
377
395
  const endProp = sameRow ? 'right' : 'bottom';
378
396
 
379
- const diff = placeholderRect[lengthProp] < rect[lengthProp] ? rect[lengthProp] - placeholderRect[lengthProp] : 0;
397
+ const diff =
398
+ placeholderRect[lengthProp] < rect[lengthProp]
399
+ ? rect[lengthProp] - placeholderRect[lengthProp]
400
+ : 0;
380
401
 
381
402
  if (placeholderRect[startProp] < rect[startProp]) {
382
-
383
403
  if (diff && pointerPos < rect[startProp] + diff) {
384
404
  return false;
385
405
  }
@@ -395,7 +415,6 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
395
415
  }
396
416
 
397
417
  function isHorizontal(list, placeholder) {
398
-
399
418
  const single = children(list).length === 1;
400
419
 
401
420
  if (single) {
@@ -405,7 +424,7 @@ function isHorizontal(list, placeholder) {
405
424
  const items = children(list);
406
425
  const isHorizontal = items.some((el, i) => {
407
426
  const rectA = el.getBoundingClientRect();
408
- return items.slice(i + 1).some(el => {
427
+ return items.slice(i + 1).some((el) => {
409
428
  const rectB = el.getBoundingClientRect();
410
429
  return !linesIntersect([rectA.left, rectA.right], [rectB.left, rectB.right]);
411
430
  });
@@ -1,17 +1,31 @@
1
1
  import Container from '../mixin/container';
2
2
  import Togglable from '../mixin/togglable';
3
3
  import Position from '../mixin/position';
4
- import {append, attr, flipPosition, hasAttr, isFocusable, isTouch, matches, on, once, pointerDown, pointerEnter, pointerLeave, remove, within} from 'uikit-util';
4
+ import {
5
+ append,
6
+ attr,
7
+ flipPosition,
8
+ hasAttr,
9
+ isFocusable,
10
+ isTouch,
11
+ matches,
12
+ on,
13
+ once,
14
+ pointerDown,
15
+ pointerEnter,
16
+ pointerLeave,
17
+ remove,
18
+ within,
19
+ } from 'uikit-util';
5
20
 
6
21
  export default {
7
-
8
22
  mixins: [Container, Togglable, Position],
9
23
 
10
24
  args: 'title',
11
25
 
12
26
  props: {
13
27
  delay: Number,
14
- title: String
28
+ title: String,
15
29
  },
16
30
 
17
31
  data: {
@@ -21,7 +35,7 @@ export default {
21
35
  animation: ['uk-animation-scale-up'],
22
36
  duration: 100,
23
37
  cls: 'uk-active',
24
- clsPos: 'uk-tooltip'
38
+ clsPos: 'uk-tooltip',
25
39
  },
26
40
 
27
41
  beforeConnect() {
@@ -37,25 +51,27 @@ export default {
37
51
  },
38
52
 
39
53
  methods: {
40
-
41
54
  show() {
42
-
43
55
  if (this.isToggled(this.tooltip || null) || !this.title) {
44
56
  return;
45
57
  }
46
58
 
47
- this._unbind = once(document, `show keydown ${pointerDown}`, this.hide, false, e =>
48
- e.type === pointerDown && !within(e.target, this.$el)
49
- || e.type === 'keydown' && e.keyCode === 27
50
- || e.type === 'show' && e.detail[0] !== this && e.detail[0].$name === this.$name
59
+ this._unbind = once(
60
+ document,
61
+ `show keydown ${pointerDown}`,
62
+ this.hide,
63
+ false,
64
+ (e) =>
65
+ (e.type === pointerDown && !within(e.target, this.$el)) ||
66
+ (e.type === 'keydown' && e.keyCode === 27) ||
67
+ (e.type === 'show' && e.detail[0] !== this && e.detail[0].$name === this.$name)
51
68
  );
52
69
 
53
70
  clearTimeout(this.showTimer);
54
71
  this.showTimer = setTimeout(this._show, this.delay);
55
72
  },
56
73
 
57
- hide() {
58
-
74
+ async hide() {
59
75
  if (matches(this.$el, 'input:focus')) {
60
76
  return;
61
77
  }
@@ -66,23 +82,21 @@ export default {
66
82
  return;
67
83
  }
68
84
 
69
- this.toggleElement(this.tooltip, false, false).then(() => {
70
- remove(this.tooltip);
71
- this.tooltip = null;
72
- this._unbind();
73
- });
85
+ await this.toggleElement(this.tooltip, false, false);
86
+ remove(this.tooltip);
87
+ this.tooltip = null;
88
+ this._unbind();
74
89
  },
75
90
 
76
91
  _show() {
77
-
78
- this.tooltip = append(this.container,
92
+ this.tooltip = append(
93
+ this.container,
79
94
  `<div class="${this.clsPos}">
80
95
  <div class="${this.clsPos}-inner">${this.title}</div>
81
96
  </div>`
82
97
  );
83
98
 
84
99
  on(this.tooltip, 'toggled', (e, toggled) => {
85
-
86
100
  this.updateAria(toggled);
87
101
 
88
102
  if (!toggled) {
@@ -91,23 +105,21 @@ export default {
91
105
 
92
106
  this.positionAt(this.tooltip, this.$el);
93
107
 
94
- this.origin = this.getAxis() === 'y'
95
- ? `${flipPosition(this.dir)}-${this.align}`
96
- : `${this.align}-${flipPosition(this.dir)}`;
108
+ this.origin =
109
+ this.getAxis() === 'y'
110
+ ? `${flipPosition(this.dir)}-${this.align}`
111
+ : `${this.align}-${flipPosition(this.dir)}`;
97
112
  });
98
113
 
99
114
  this.toggleElement(this.tooltip, true);
100
-
101
115
  },
102
116
 
103
117
  updateAria(toggled) {
104
118
  attr(this.$el, 'aria-expanded', toggled);
105
- }
106
-
119
+ },
107
120
  },
108
121
 
109
122
  events: {
110
-
111
123
  focus: 'show',
112
124
  blur: 'hide',
113
125
 
@@ -123,10 +135,8 @@ export default {
123
135
  if (isTouch(e)) {
124
136
  this.show();
125
137
  }
126
- }
127
-
128
- }
129
-
138
+ },
139
+ },
130
140
  };
131
141
 
132
142
  function makeFocusable(el) {