uikit 3.11.2-dev.ae39176f2 → 3.11.2-dev.b4d9c97d5

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 (211) 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 +35 -17
  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 +80 -186
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +80 -186
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +82 -192
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +82 -192
  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 +324 -358
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +322 -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 +322 -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 +588 -622
  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 +5405 -6762
  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 +8120 -9875
  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 +65 -82
  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 +122 -104
  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 +38 -50
  95. package/src/js/core/img.js +154 -138
  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 +127 -90
  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 +128 -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 +39 -81
  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 +35 -49
  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/form-range.less +52 -97
  155. package/src/less/components/form.less +0 -1
  156. package/src/less/components/leader.less +0 -1
  157. package/src/less/components/lightbox.less +0 -1
  158. package/src/less/components/modal.less +3 -7
  159. package/src/less/components/progress.less +14 -36
  160. package/src/less/components/slider.less +0 -3
  161. package/src/less/components/slideshow.less +0 -3
  162. package/src/less/components/text.less +16 -32
  163. package/src/scss/components/base.scss +10 -33
  164. package/src/scss/components/form-range.scss +52 -97
  165. package/src/scss/components/form.scss +0 -1
  166. package/src/scss/components/leader.scss +0 -1
  167. package/src/scss/components/lightbox.scss +0 -1
  168. package/src/scss/components/modal.scss +3 -7
  169. package/src/scss/components/progress.scss +14 -36
  170. package/src/scss/components/slider.scss +0 -3
  171. package/src/scss/components/slideshow.scss +0 -3
  172. package/src/scss/components/text.scss +16 -32
  173. package/src/scss/mixins-theme.scss +1 -1
  174. package/src/scss/mixins.scss +1 -1
  175. package/src/scss/variables-theme.scss +3 -3
  176. package/src/scss/variables.scss +3 -3
  177. package/tests/align.html +10 -10
  178. package/tests/animation.html +2 -2
  179. package/tests/article.html +2 -2
  180. package/tests/base.html +3 -3
  181. package/tests/card.html +10 -10
  182. package/tests/column.html +3 -3
  183. package/tests/comment.html +9 -9
  184. package/tests/dotnav.html +3 -3
  185. package/tests/image.html +296 -64
  186. package/tests/images/image-type.avif +0 -0
  187. package/tests/images/image-type.jpeg +0 -0
  188. package/tests/images/image-type.webp +0 -0
  189. package/tests/index.html +8 -8
  190. package/tests/js/index.js +114 -85
  191. package/tests/lightbox.html +10 -10
  192. package/tests/marker.html +2 -2
  193. package/tests/modal.html +8 -9
  194. package/tests/navbar.html +2 -2
  195. package/tests/overlay.html +7 -7
  196. package/tests/parallax.html +14 -5
  197. package/tests/position.html +12 -12
  198. package/tests/slidenav.html +12 -12
  199. package/tests/slider.html +20 -20
  200. package/tests/sortable.html +1 -1
  201. package/tests/sticky-parallax.html +47 -62
  202. package/tests/svg.html +6 -6
  203. package/tests/table.html +11 -11
  204. package/tests/thumbnav.html +12 -12
  205. package/tests/transition.html +30 -30
  206. package/tests/utility.html +33 -33
  207. package/tests/video.html +1 -1
  208. package/tests/width.html +1 -1
  209. package/src/js/mixin/flex-bug.js +0 -56
  210. package/src/js/util/promise.js +0 -191
  211. package/tests/images/animated.gif +0 -0
@@ -2,16 +2,16 @@ import Class from '../mixin/class';
2
2
  import Slideshow from '../mixin/slideshow';
3
3
  import Animations from './internal/slideshow-animations';
4
4
  import SliderReactive from '../mixin/slider-reactive';
5
- import {boxModelAdjust, css} from 'uikit-util';
5
+ import SliderPreload from './internal/slider-preload';
6
+ import { boxModelAdjust, css } from 'uikit-util';
6
7
 
7
8
  export default {
8
-
9
- mixins: [Class, Slideshow, SliderReactive],
9
+ mixins: [Class, Slideshow, SliderReactive, SliderPreload],
10
10
 
11
11
  props: {
12
12
  ratio: String,
13
13
  minHeight: Number,
14
- maxHeight: Number
14
+ maxHeight: Number,
15
15
  },
16
16
 
17
17
  data: {
@@ -21,20 +21,18 @@ export default {
21
21
  selList: '.uk-slideshow-items',
22
22
  attrItem: 'uk-slideshow-item',
23
23
  selNav: '.uk-slideshow-nav',
24
- Animations
24
+ Animations,
25
25
  },
26
26
 
27
27
  update: {
28
-
29
28
  read() {
30
-
31
29
  if (!this.list) {
32
30
  return false;
33
31
  }
34
32
 
35
33
  let [width, height] = this.ratio.split(':').map(Number);
36
34
 
37
- height = height * this.list.offsetWidth / width || 0;
35
+ height = (height * this.list.offsetWidth) / width || 0;
38
36
 
39
37
  if (this.minHeight) {
40
38
  height = Math.max(this.minHeight, height);
@@ -44,15 +42,19 @@ export default {
44
42
  height = Math.min(this.maxHeight, height);
45
43
  }
46
44
 
47
- return {height: height - boxModelAdjust(this.list, 'height', 'content-box')};
45
+ return { height: height - boxModelAdjust(this.list, 'height', 'content-box') };
48
46
  },
49
47
 
50
- write({height}) {
48
+ write({ height }) {
51
49
  height > 0 && css(this.list, 'minHeight', height);
52
50
  },
53
51
 
54
- events: ['resize']
55
-
56
- }
52
+ events: ['resize'],
53
+ },
57
54
 
55
+ methods: {
56
+ getAdjacentSlides() {
57
+ return [1, -1].map((i) => this.slides[this.getIndex(this.index + i)]);
58
+ },
59
+ },
58
60
  };
@@ -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 => {
322
+ scrollParents(document.elementFromPoint(x, pos.y), /auto|scroll/)
323
+ .reverse()
324
+ .some((scrollEl) => {
325
+ let { scrollTop: scroll, scrollHeight } = scrollEl;
303
326
 
304
- let {scrollTop: scroll, scrollHeight} = scrollEl;
327
+ const { top, bottom, height } = offset(getViewport(scrollEl));
305
328
 
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
- }
315
-
316
- if (scroll > 0 && scroll < scrollHeight - height) {
317
- scrollTop(scrollEl, scroll);
318
- return true;
319
- }
320
-
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,17 @@ 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
356
  css(clone, {
336
357
  boxSizing: 'border-box',
337
358
  width: element.offsetWidth,
338
359
  height: element.offsetHeight,
339
- padding: css(element, 'padding')
360
+ padding: css(element, 'padding'),
340
361
  });
341
362
 
342
363
  height(clone.firstElementChild, height(element.firstElementChild));
@@ -345,22 +366,18 @@ function appendDrag(container, element) {
345
366
  }
346
367
 
347
368
  function findTarget(items, point) {
348
- return items[findIndex(items, item => pointInRect(point, item.getBoundingClientRect()))];
369
+ return items[findIndex(items, (item) => pointInRect(point, item.getBoundingClientRect()))];
349
370
  }
350
371
 
351
372
  function findInsertTarget(list, target, placeholder, x, y, sameList) {
352
-
353
373
  if (!children(list).length) {
354
374
  return;
355
375
  }
356
376
 
357
377
  const rect = target.getBoundingClientRect();
358
378
  if (!sameList) {
359
-
360
379
  if (!isHorizontal(list, placeholder)) {
361
- return y < rect.top + rect.height / 2
362
- ? target
363
- : target.nextElementSibling;
380
+ return y < rect.top + rect.height / 2 ? target : target.nextElementSibling;
364
381
  }
365
382
 
366
383
  return target;
@@ -377,10 +394,12 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
377
394
  const startProp = sameRow ? 'left' : 'top';
378
395
  const endProp = sameRow ? 'right' : 'bottom';
379
396
 
380
- 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;
381
401
 
382
402
  if (placeholderRect[startProp] < rect[startProp]) {
383
-
384
403
  if (diff && pointerPos < rect[startProp] + diff) {
385
404
  return false;
386
405
  }
@@ -396,7 +415,6 @@ function findInsertTarget(list, target, placeholder, x, y, sameList) {
396
415
  }
397
416
 
398
417
  function isHorizontal(list, placeholder) {
399
-
400
418
  const single = children(list).length === 1;
401
419
 
402
420
  if (single) {
@@ -406,7 +424,7 @@ function isHorizontal(list, placeholder) {
406
424
  const items = children(list);
407
425
  const isHorizontal = items.some((el, i) => {
408
426
  const rectA = el.getBoundingClientRect();
409
- return items.slice(i + 1).some(el => {
427
+ return items.slice(i + 1).some((el) => {
410
428
  const rectB = el.getBoundingClientRect();
411
429
  return !linesIntersect([rectA.left, rectA.right], [rectB.left, rectB.right]);
412
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) {