uikit 3.25.27-dev.2d5695a → 3.25.27-dev.9e97c1f

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 (224) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/build/prefix.js +1 -1
  3. package/build/publishDev.js +1 -1
  4. package/build/scope.js +1 -1
  5. package/build/scss.js +1 -1
  6. package/build/util.js +0 -2
  7. package/dist/css/uikit-core-rtl.css +1327 -1204
  8. package/dist/css/uikit-core-rtl.min.css +1 -1
  9. package/dist/css/uikit-core.css +1327 -1204
  10. package/dist/css/uikit-core.min.css +1 -1
  11. package/dist/css/uikit-rtl.css +1339 -1223
  12. package/dist/css/uikit-rtl.min.css +1 -1
  13. package/dist/css/uikit.css +1339 -1223
  14. package/dist/css/uikit.min.css +1 -1
  15. package/dist/js/components/countdown.js +1 -1
  16. package/dist/js/components/countdown.min.js +1 -1
  17. package/dist/js/components/filter.js +1 -1
  18. package/dist/js/components/filter.min.js +1 -1
  19. package/dist/js/components/lightbox-panel.js +134 -135
  20. package/dist/js/components/lightbox-panel.min.js +1 -1
  21. package/dist/js/components/lightbox.js +135 -136
  22. package/dist/js/components/lightbox.min.js +1 -1
  23. package/dist/js/components/marquee.js +215 -0
  24. package/dist/js/components/marquee.min.js +1 -0
  25. package/dist/js/components/notification.js +8 -6
  26. package/dist/js/components/notification.min.js +1 -1
  27. package/dist/js/components/parallax.js +8 -12
  28. package/dist/js/components/parallax.min.js +1 -1
  29. package/dist/js/components/slider-parallax.js +8 -12
  30. package/dist/js/components/slider-parallax.min.js +1 -1
  31. package/dist/js/components/slider.js +51 -25
  32. package/dist/js/components/slider.min.js +1 -1
  33. package/dist/js/components/slideshow-parallax.js +8 -12
  34. package/dist/js/components/slideshow-parallax.min.js +1 -1
  35. package/dist/js/components/slideshow.js +81 -102
  36. package/dist/js/components/slideshow.min.js +1 -1
  37. package/dist/js/components/sortable.js +1 -1
  38. package/dist/js/components/sortable.min.js +1 -1
  39. package/dist/js/components/tooltip.js +15 -17
  40. package/dist/js/components/tooltip.min.js +1 -1
  41. package/dist/js/components/upload.js +1 -1
  42. package/dist/js/components/upload.min.js +1 -1
  43. package/dist/js/uikit-core.js +874 -323
  44. package/dist/js/uikit-core.min.js +1 -1
  45. package/dist/js/uikit-icons.js +1 -1
  46. package/dist/js/uikit-icons.min.js +1 -1
  47. package/dist/js/uikit.js +737 -395
  48. package/dist/js/uikit.min.js +1 -1
  49. package/package.json +1 -1
  50. package/src/js/api/component.js +2 -3
  51. package/src/js/api/observables.js +16 -4
  52. package/src/js/api/options.js +6 -3
  53. package/src/js/api/props.js +1 -3
  54. package/src/js/api/state.js +7 -8
  55. package/src/js/components/index.js +1 -0
  56. package/src/js/components/internal/lightbox-animations.js +7 -26
  57. package/src/js/components/internal/slider-preload.js +1 -0
  58. package/src/js/components/internal/slideshow-animations.js +15 -62
  59. package/src/js/components/lightbox-panel.js +121 -96
  60. package/src/js/components/lightbox.js +5 -8
  61. package/src/js/components/marquee.js +156 -0
  62. package/src/js/components/notification.js +7 -5
  63. package/src/js/core/accordion.js +62 -31
  64. package/src/js/core/alert.js +1 -1
  65. package/src/js/core/drop.js +4 -3
  66. package/src/js/core/dropnav.js +3 -3
  67. package/src/js/core/grid.js +5 -19
  68. package/src/js/core/margin.js +3 -0
  69. package/src/js/core/overflow-auto.js +5 -1
  70. package/src/js/core/sticky.js +1 -1
  71. package/src/js/core/switcher.js +12 -49
  72. package/src/js/core/video.js +236 -21
  73. package/src/js/mixin/connect.js +90 -0
  74. package/src/js/mixin/internal/slideshow-animations.js +5 -13
  75. package/src/js/mixin/internal/slideshow-transitioner.js +2 -2
  76. package/src/js/mixin/parallax.js +1 -4
  77. package/src/js/mixin/position.js +1 -1
  78. package/src/js/mixin/scroll-driven.js +57 -0
  79. package/src/js/mixin/slider-parallax.js +9 -38
  80. package/src/js/mixin/togglable.js +13 -14
  81. package/src/js/util/attr.js +7 -7
  82. package/src/js/util/dom.js +3 -4
  83. package/src/js/util/lang.js +2 -2
  84. package/src/js/util/player.js +4 -2
  85. package/src/js/util/style.js +12 -13
  86. package/src/js/util/viewport.js +22 -25
  87. package/src/less/components/_import.less +8 -3
  88. package/src/less/components/animation.less +1 -1
  89. package/src/less/components/base.less +1 -1
  90. package/src/less/components/button.less +1 -1
  91. package/src/less/components/card.less +8 -8
  92. package/src/less/components/dropcap.less +71 -0
  93. package/src/less/components/floating-shadow.less +66 -0
  94. package/src/less/components/form.less +15 -15
  95. package/src/less/components/grid.less +58 -65
  96. package/src/less/components/lightbox.less +2 -8
  97. package/src/less/components/logo.less +94 -0
  98. package/src/less/components/margin.less +155 -124
  99. package/src/less/components/marquee.less +133 -0
  100. package/src/less/components/modal.less +1 -4
  101. package/src/less/components/nav.less +1 -1
  102. package/src/less/components/navbar.less +1 -1
  103. package/src/less/components/padding.less +9 -9
  104. package/src/less/components/position.less +9 -4
  105. package/src/less/components/search.less +1 -1
  106. package/src/less/components/slideshow.less +1 -4
  107. package/src/less/components/switcher.less +5 -2
  108. package/src/less/components/table.less +4 -4
  109. package/src/less/components/text.less +10 -4
  110. package/src/less/components/utility.less +0 -163
  111. package/src/less/components/visibility.less +4 -4
  112. package/src/less/theme/_import.less +6 -2
  113. package/src/less/theme/alert.less +0 -5
  114. package/src/less/theme/dropcap.less +29 -0
  115. package/src/less/theme/floating-shadow.less +20 -0
  116. package/src/less/theme/logo.less +29 -0
  117. package/src/less/theme/marquee.less +14 -0
  118. package/src/less/theme/thumbnav.less +1 -4
  119. package/src/less/theme/utility.less +0 -32
  120. package/src/scss/components/_import.scss +8 -3
  121. package/src/scss/components/animation.scss +1 -1
  122. package/src/scss/components/base.scss +1 -1
  123. package/src/scss/components/button.scss +1 -1
  124. package/src/scss/components/card.scss +8 -8
  125. package/src/scss/components/dropcap.scss +63 -0
  126. package/src/scss/components/floating-shadow.scss +63 -0
  127. package/src/scss/components/form.scss +14 -14
  128. package/src/scss/components/grid.scss +57 -64
  129. package/src/scss/components/lightbox.scss +2 -8
  130. package/src/scss/components/logo.scss +75 -0
  131. package/src/scss/components/margin.scss +155 -124
  132. package/src/scss/components/marquee.scss +136 -0
  133. package/src/scss/components/modal.scss +1 -4
  134. package/src/scss/components/nav.scss +1 -1
  135. package/src/scss/components/navbar.scss +1 -1
  136. package/src/scss/components/padding.scss +9 -9
  137. package/src/scss/components/position.scss +9 -4
  138. package/src/scss/components/search.scss +1 -1
  139. package/src/scss/components/slideshow.scss +1 -4
  140. package/src/scss/components/switcher.scss +5 -2
  141. package/src/scss/components/table.scss +4 -4
  142. package/src/scss/components/text.scss +10 -4
  143. package/src/scss/components/utility.scss +0 -129
  144. package/src/scss/components/visibility.scss +4 -4
  145. package/src/scss/mixins-theme.scss +44 -43
  146. package/src/scss/mixins.scss +40 -31
  147. package/src/scss/variables-theme.scss +14 -14
  148. package/src/scss/variables.scss +14 -14
  149. package/tests/accordion.html +77 -10
  150. package/tests/alert.html +1 -1
  151. package/tests/align.html +5 -5
  152. package/tests/animation.html +4 -4
  153. package/tests/article.html +7 -7
  154. package/tests/background.html +2 -2
  155. package/tests/badge.html +1 -1
  156. package/tests/base.html +2 -2
  157. package/tests/button.html +1 -1
  158. package/tests/card.html +15 -15
  159. package/tests/close.html +2 -2
  160. package/tests/comment.html +9 -9
  161. package/tests/container.html +2 -2
  162. package/tests/countdown.html +21 -21
  163. package/tests/cover.html +3 -3
  164. package/tests/description-list.html +1 -1
  165. package/tests/divider.html +3 -3
  166. package/tests/dotnav.html +1 -1
  167. package/tests/drop.html +7 -7
  168. package/tests/dropbar.html +5 -5
  169. package/tests/dropcap.html +26 -0
  170. package/tests/dropdown.html +1 -1
  171. package/tests/dropnav.html +18 -18
  172. package/tests/filter.html +3 -3
  173. package/tests/floating-shadow.html +44 -0
  174. package/tests/form.html +14 -14
  175. package/tests/grid.html +41 -47
  176. package/tests/heading.html +2 -2
  177. package/tests/height-viewport.html +4 -4
  178. package/tests/height.html +5 -5
  179. package/tests/icon.html +8 -8
  180. package/tests/image.html +6 -6
  181. package/tests/index.html +13 -13
  182. package/tests/js/index.js +1 -1
  183. package/tests/leader.html +5 -5
  184. package/tests/lightbox.html +6 -6
  185. package/tests/link.html +1 -1
  186. package/tests/list.html +4 -4
  187. package/tests/logo.html +84 -0
  188. package/tests/margin.html +59 -7
  189. package/tests/marker.html +3 -3
  190. package/tests/marquee.html +617 -0
  191. package/tests/modal.html +3 -3
  192. package/tests/nav.html +5 -5
  193. package/tests/navbar.html +27 -27
  194. package/tests/notification.html +8 -2
  195. package/tests/offcanvas.html +12 -12
  196. package/tests/overlay.html +3 -3
  197. package/tests/padding.html +1 -1
  198. package/tests/pagination.html +3 -3
  199. package/tests/parallax.html +1 -1
  200. package/tests/position.html +6 -6
  201. package/tests/scrollspy.html +13 -13
  202. package/tests/search.html +5 -5
  203. package/tests/section.html +17 -17
  204. package/tests/slidenav.html +3 -3
  205. package/tests/slider.html +5 -5
  206. package/tests/slideshow.html +33 -3
  207. package/tests/sortable.html +15 -15
  208. package/tests/sticky-navbar.html +4 -4
  209. package/tests/sticky-parallax.html +3 -3
  210. package/tests/sticky.html +3 -3
  211. package/tests/svg.html +3 -2
  212. package/tests/switcher.html +7 -7
  213. package/tests/tab.html +5 -5
  214. package/tests/text.html +9 -3
  215. package/tests/tile.html +4 -4
  216. package/tests/toggle.html +1 -1
  217. package/tests/tooltip.html +3 -3
  218. package/tests/totop.html +2 -2
  219. package/tests/transition.html +1 -1
  220. package/tests/upload.html +5 -5
  221. package/tests/utility.html +16 -116
  222. package/tests/video.html +224 -24
  223. package/tests/visibility.html +4 -4
  224. package/tests/width.html +12 -12
@@ -0,0 +1,156 @@
1
+ import {
2
+ $,
3
+ children,
4
+ css,
5
+ dimensions,
6
+ getIndex,
7
+ hasClass,
8
+ inBrowser,
9
+ isRtl,
10
+ pointerEnter,
11
+ pointerLeave,
12
+ toggleClass,
13
+ toPx,
14
+ } from 'uikit-util';
15
+ import { intersection, preloadMedia, resize } from '../api/observables';
16
+ import Class from '../mixin/class';
17
+
18
+ const hasAnimationApi = inBrowser && window.Animation;
19
+
20
+ export default {
21
+ mixins: [Class],
22
+
23
+ props: {
24
+ velocity: Number,
25
+ start: Number,
26
+ reverse: Boolean,
27
+ pause: Boolean,
28
+ pauseVelocity: Number,
29
+ fadeSize: null,
30
+ },
31
+
32
+ data: {
33
+ velocity: 25,
34
+ start: 0,
35
+ reverse: false,
36
+ pause: false,
37
+ pauseVelocity: 10,
38
+ selList: '.uk-marquee-items',
39
+ fadeSize: 0,
40
+ },
41
+
42
+ computed: {
43
+ list: ({ selList }, $el) => $(selList, $el),
44
+ items() {
45
+ return children(this.list);
46
+ },
47
+ },
48
+
49
+ watch: {
50
+ items() {
51
+ this.$emit();
52
+ },
53
+ },
54
+
55
+ observe: [
56
+ resize({
57
+ target: ({ $el, items }) => [$el, ...items],
58
+ }),
59
+ intersection({
60
+ handler(entries) {
61
+ let active;
62
+ for (const entry of entries) {
63
+ entry.target.inert = !entry.isIntersecting;
64
+ active ||= entry.isIntersecting && entry.target;
65
+ }
66
+
67
+ if (!active) {
68
+ return;
69
+ }
70
+
71
+ const { items } = this;
72
+ const index = items.indexOf(active);
73
+ if (!~index) {
74
+ return;
75
+ }
76
+
77
+ const direction = this.reverse ? 1 : -1;
78
+ for (let offset = 1; offset < items.length; offset++) {
79
+ const item = items[getIndex(index + direction * offset, items)];
80
+ if (item.inert) {
81
+ preloadMedia(item);
82
+ break;
83
+ }
84
+ }
85
+ },
86
+ target: ({ items }) => items,
87
+ args: { intersecting: false },
88
+ options: ({ $el }) => ({ root: $el }),
89
+ }),
90
+ ],
91
+
92
+ methods: {
93
+ vertical() {
94
+ return hasClass(this.$el, `${this.$options.id}-vertical`);
95
+ },
96
+ },
97
+
98
+ events: {
99
+ name: [pointerEnter, pointerLeave],
100
+ el: ({ $el }) => $el,
101
+ self: true,
102
+ filter: ({ pause }) => hasAnimationApi && pause,
103
+ handler(e) {
104
+ for (const el of this.items) {
105
+ for (const animation of el.getAnimations()) {
106
+ animation.playbackRate =
107
+ e.type === pointerEnter ? this.pauseVelocity / this.velocity : 1;
108
+ }
109
+ }
110
+ },
111
+ },
112
+
113
+ update: {
114
+ write() {
115
+ const prefix = this.$options.id;
116
+ const items = this.items;
117
+ const vertical = this.vertical();
118
+
119
+ css(items, 'offset', 'none');
120
+
121
+ const dir = vertical ? ['top', 'bottom'] : ['left', 'right'];
122
+ if (!vertical && isRtl) {
123
+ dir.reverse();
124
+ }
125
+
126
+ const listStart = dimensions(this.list)[dir[0]];
127
+ const itemEnds = items.map((el) => dimensions(el)[dir[1]]);
128
+ const listEnd = Math[!vertical && isRtl ? 'min' : 'max'](...itemEnds);
129
+
130
+ for (const [index, el] of items.entries()) {
131
+ const elEnd = itemEnds[index];
132
+ const line1 = listEnd - elEnd;
133
+ const line2 = elEnd - listStart;
134
+ const path = vertical
135
+ ? `"M0 0 v${line1}M0 ${-line2} v${line2}"`
136
+ : `"M0 0 h${line1}M${-line2} 0 h${line2}"`;
137
+ css(el, `--${prefix}-path`, path);
138
+ }
139
+
140
+ css(this.$el, {
141
+ [`--${prefix}-duration`]: `${Math.abs(listStart - listEnd) / this.velocity}s`,
142
+ [`--${prefix}-start`]: this.start,
143
+ [`--${prefix}-direction`]: this.reverse ? 'reverse' : 'normal',
144
+ '--uk-overflow-fade-size': this.fadeSize
145
+ ? `${toPx(this.fadeSize, vertical ? 'height' : 'width', this.$el, true)}px`
146
+ : '',
147
+ });
148
+
149
+ toggleClass(this.$el, `${prefix}-fade`, this.fadeSize);
150
+
151
+ css(items, 'offset', '');
152
+ },
153
+
154
+ events: ['resize'],
155
+ },
156
+ };
@@ -25,6 +25,7 @@ export default {
25
25
  message: '',
26
26
  status: '',
27
27
  timeout: 5000,
28
+ duration: 400,
28
29
  group: '',
29
30
  pos: 'top-center',
30
31
  clsContainer: 'uk-notification',
@@ -67,10 +68,11 @@ export default {
67
68
 
68
69
  async connected() {
69
70
  const margin = toFloat(css(this.$el, this.marginProp));
70
- await Transition.start(css(this.$el, this.startProps), {
71
- opacity: 1,
72
- [this.marginProp]: margin,
73
- });
71
+ await Transition.start(
72
+ css(this.$el, this.startProps),
73
+ { opacity: 1, [this.marginProp]: margin },
74
+ this.duration,
75
+ );
74
76
 
75
77
  if (this.timeout) {
76
78
  this.timer = setTimeout(this.close, this.timeout);
@@ -114,7 +116,7 @@ export default {
114
116
  }
115
117
 
116
118
  if (!immediate) {
117
- await Transition.start(this.$el, this.startProps);
119
+ await Transition.start(this.$el, this.startProps, this.duration);
118
120
  }
119
121
 
120
122
  removeFn(this.$el);
@@ -6,6 +6,7 @@ import {
6
6
  css,
7
7
  dimensions,
8
8
  filter,
9
+ findIndex,
9
10
  getIndex,
10
11
  hasClass,
11
12
  includes,
@@ -22,17 +23,16 @@ import {
22
23
  import { generateId } from '../api/instance';
23
24
  import { lazyload } from '../api/observables';
24
25
  import Class from '../mixin/class';
26
+ import Connect from '../mixin/connect';
25
27
  import { maybeDefaultPreventClick } from '../mixin/event';
26
- import Togglable from '../mixin/togglable';
27
28
  import { keyMap } from '../util/keys';
28
29
 
29
30
  const wrappers = new WeakMap();
30
31
 
31
32
  export default {
32
- mixins: [Class, Togglable],
33
+ mixins: [Class, Connect],
33
34
 
34
35
  props: {
35
- animation: Boolean,
36
36
  targets: String,
37
37
  active: null,
38
38
  collapsible: Boolean,
@@ -40,18 +40,25 @@ export default {
40
40
  toggle: String,
41
41
  content: String,
42
42
  offset: Number,
43
+ switcherConnect: String,
43
44
  },
44
45
 
45
46
  data: {
46
47
  targets: '> *',
47
48
  active: false,
48
- animation: true,
49
+ animation: [true],
49
50
  collapsible: true,
50
51
  multiple: false,
51
52
  clsOpen: 'uk-open',
53
+ cls: 'uk-active',
52
54
  toggle: '.uk-accordion-title',
53
55
  content: '.uk-accordion-content',
54
56
  offset: 0,
57
+ switcherConnect: '',
58
+ },
59
+
60
+ beforeConnect() {
61
+ this.connect = this.$props.connect = this.switcherConnect;
55
62
  },
56
63
 
57
64
  computed: {
@@ -83,6 +90,13 @@ export default {
83
90
  }
84
91
  },
85
92
 
93
+ connectChildren() {
94
+ this.showConnects(
95
+ findIndex(this.items, (el) => hasClass(el, this.clsOpen)),
96
+ false,
97
+ );
98
+ },
99
+
86
100
  toggles() {
87
101
  this.$emit();
88
102
  },
@@ -149,52 +163,69 @@ export default {
149
163
  continue;
150
164
  }
151
165
 
152
- toggle.id = generateId(this, toggle);
153
- content.id = generateId(this, content);
154
-
155
166
  const active = includes(activeItems, this.items[index]);
167
+
168
+ attr(content, {
169
+ id: generateId(this, content),
170
+ role: 'region',
171
+ 'aria-labelledby': toggle.id,
172
+ });
173
+ if (isTag(content, 'ul')) {
174
+ attr(children(content), 'role', 'presentation');
175
+ }
176
+
177
+ const controls = [
178
+ content.id,
179
+ ...this.connects.map(({ children }) => children[index]?.id).filter(Boolean),
180
+ ];
181
+
156
182
  attr(toggle, {
157
183
  role: isTag(toggle, 'a') ? 'button' : null,
158
- 'aria-controls': content.id,
184
+ 'aria-controls': controls.join(' '),
159
185
  'aria-expanded': active,
160
186
  'aria-disabled': !this.collapsible && activeItems.length < 2 && active,
161
187
  });
162
-
163
- attr(content, { role: 'region', 'aria-labelledby': toggle.id });
164
- if (isTag(content, 'ul')) {
165
- attr(children(content), 'role', 'presentation');
166
- }
167
188
  }
168
189
  },
169
190
 
170
191
  methods: {
171
- toggle(item, animate) {
172
- item = this.items[getIndex(item, this.items)];
192
+ async toggle(item, animate) {
193
+ animate = animate !== false;
194
+
195
+ const next = getIndex(item, this.items);
196
+
197
+ item = this.items[next];
173
198
  let items = [item];
174
199
  const activeItems = filter(this.items, `.${this.clsOpen}`);
200
+ const isActive = includes(activeItems, item);
175
201
 
176
- if (!this.multiple && !includes(activeItems, items[0])) {
177
- items = items.concat(activeItems);
202
+ if (isActive && !this.collapsible && activeItems.length < 2) {
203
+ return;
178
204
  }
179
205
 
180
- if (!this.collapsible && activeItems.length < 2 && includes(activeItems, item)) {
181
- items = [];
206
+ if (!isActive && !this.multiple) {
207
+ items.push(...activeItems);
182
208
  }
183
209
 
184
- return Promise.all(
185
- items.map((el) =>
186
- this.toggleElement(el, !includes(activeItems, el), (el, show) => {
187
- toggleClass(el, this.clsOpen, show);
210
+ const toggle = (el) =>
211
+ this.toggleElement(el, !includes(activeItems, el), (el, show) => {
212
+ toggleClass(el, this.clsOpen, show);
188
213
 
189
- if (animate === false || !this.animation) {
190
- hide($(this.content, el), !show);
191
- return;
192
- }
214
+ if (!animate || !this.hasAnimation) {
215
+ hide($(this.content, el), !show);
216
+ return;
217
+ }
193
218
 
194
- return transition(el, show, this);
195
- }),
196
- ),
197
- );
219
+ return transition(el, show, this);
220
+ });
221
+
222
+ const hideIndex = () =>
223
+ findIndex(this.items, (i) => i !== item && includes(activeItems, i));
224
+
225
+ return Promise.all([
226
+ ...items.map(toggle),
227
+ this.showConnects(isActive ? hideIndex() : next, animate),
228
+ ]);
198
229
  },
199
230
  },
200
231
  };
@@ -32,7 +32,7 @@ export default {
32
32
 
33
33
  methods: {
34
34
  async close() {
35
- await this.toggleElement(this.$el, false, animate);
35
+ await this.toggleElement(this.$el, false, this.animation ? animate : false);
36
36
  this.$destroy(true);
37
37
  },
38
38
  },
@@ -391,6 +391,7 @@ export default {
391
391
  this.$el.hidden = true;
392
392
 
393
393
  const viewports = this.target.map((target) => getViewport(this.$el, target));
394
+ const boundaryOffsets = this.boundary.map((el) => offset(el));
394
395
  const viewportOffset = this.getViewportOffset(this.$el);
395
396
 
396
397
  const dirs = [
@@ -402,7 +403,7 @@ export default {
402
403
  if (this.axis !== axis && includes([axis, true], this.stretch)) {
403
404
  css(this.$el, {
404
405
  [prop]: Math.min(
405
- offset(this.boundary[i])[prop],
406
+ boundaryOffsets[i][prop],
406
407
  viewports[i][prop] - 2 * viewportOffset,
407
408
  ),
408
409
  [`overflow-${axis}`]: 'auto',
@@ -435,11 +436,11 @@ export default {
435
436
  (targetOffset[start] > elOffset[start]
436
437
  ? targetOffset[this.inset ? end : start] -
437
438
  Math.max(
438
- offset(this.boundary[i])[start],
439
+ boundaryOffsets[i][start],
439
440
  viewports[i][start] + viewportOffset,
440
441
  )
441
442
  : Math.min(
442
- offset(this.boundary[i])[end],
443
+ boundaryOffsets[i][end],
443
444
  viewports[i][end] - viewportOffset,
444
445
  ) - targetOffset[this.inset ? start : end]) - positionOffset,
445
446
  [`overflow-${axis}`]: 'auto',
@@ -277,9 +277,9 @@ export default {
277
277
  const drop = this.getDropdown(target);
278
278
  const adjustHeight = () => {
279
279
  const maxBottom = Math.max(
280
- ...parents(target, `.${this.clsDrop}`)
281
- .concat(target)
282
- .map((el) => offset(el).bottom),
280
+ ...[...parents(target, `.${this.clsDrop}`), target].map(
281
+ (el) => offset(el).bottom,
282
+ ),
283
283
  );
284
284
 
285
285
  offset(this.dropbar, {
@@ -1,14 +1,4 @@
1
- import {
2
- addClass,
3
- css,
4
- hasClass,
5
- isRtl,
6
- scrolledOver,
7
- sumBy,
8
- toFloat,
9
- toggleClass,
10
- toPx,
11
- } from 'uikit-util';
1
+ import { addClass, css, isRtl, scrolledOver, sumBy, toFloat, toggleClass, toPx } from 'uikit-util';
12
2
  import { scroll } from '../api/observables';
13
3
  import Class from '../mixin/class';
14
4
  import Margin from './margin';
@@ -29,7 +19,8 @@ export default {
29
19
  },
30
20
 
31
21
  data: {
32
- margin: 'uk-grid-margin',
22
+ margin: '',
23
+ firstRow: 'uk-first-row',
33
24
  clsStack: 'uk-grid-stack',
34
25
  masonry: false,
35
26
  parallax: 0,
@@ -56,7 +47,7 @@ export default {
56
47
  {
57
48
  read(data) {
58
49
  const { rows } = data;
59
- let { masonry, parallax, parallaxJustify, margin } = this;
50
+ let { masonry, parallax, parallaxJustify } = this;
60
51
 
61
52
  parallax = Math.max(0, toPx(parallax));
62
53
 
@@ -71,7 +62,7 @@ export default {
71
62
  return (data.translates = data.scrollColumns = false);
72
63
  }
73
64
 
74
- let gutter = getGutter(rows, margin);
65
+ let gutter = toFloat(css(this.$el, 'row-gap'));
75
66
 
76
67
  let columns;
77
68
  let translates;
@@ -185,11 +176,6 @@ function applyMasonry(rows, gutter, next) {
185
176
  return [columns, translates];
186
177
  }
187
178
 
188
- function getGutter(rows, cls) {
189
- const node = rows.flat().find((el) => hasClass(el, cls));
190
- return toFloat(node ? css(node, 'marginTop') : css(rows[0][0], 'paddingLeft'));
191
- }
192
-
193
179
  function transpose(rows) {
194
180
  const columns = [];
195
181
  for (const row of rows) {
@@ -4,11 +4,13 @@ import { mutation, resize } from '../api/observables';
4
4
  export default {
5
5
  props: {
6
6
  margin: String,
7
+ firstRow: Boolean,
7
8
  firstColumn: Boolean,
8
9
  },
9
10
 
10
11
  data: {
11
12
  margin: 'uk-margin-small-top',
13
+ firstRow: false,
12
14
  firstColumn: 'uk-first-column',
13
15
  },
14
16
 
@@ -52,6 +54,7 @@ export default {
52
54
  for (const row of rows) {
53
55
  for (const el of row) {
54
56
  toggleClass(el, this.margin, rows[0] !== row);
57
+ toggleClass(el, this.firstRow, rows[0] === row);
55
58
  toggleClass(el, this.firstColumn, row[isRtl ? row.length - 1 : 0] === el);
56
59
  }
57
60
  }
@@ -1,4 +1,4 @@
1
- import { css, dimensions, height, isVisible } from 'uikit-util';
1
+ import { boxModelAdjust, css, dimensions, isVisible } from 'uikit-util';
2
2
  import { resize } from '../api/observables';
3
3
  import Class from '../mixin/class';
4
4
 
@@ -48,3 +48,7 @@ export default {
48
48
  events: ['resize'],
49
49
  },
50
50
  };
51
+
52
+ function height(el) {
53
+ return dimensions(el).height - boxModelAdjust(el, 'height', css(el, 'boxSizing'));
54
+ }
@@ -464,7 +464,7 @@ function parseProp(value, el, propOffset, padding) {
464
464
  return 0;
465
465
  }
466
466
 
467
- if (isNumeric(value) || (isString(value) && value.match(/^-?\d/))) {
467
+ if (isNumeric(value) || (isString(value) && /^-?\d/.test(value))) {
468
468
  return propOffset + toPx(value, 'height', el, true);
469
469
  } else {
470
470
  const refElement = value === true ? getVisibleParent(el) : query(value, el);
@@ -9,27 +9,23 @@ import {
9
9
  getIndex,
10
10
  hasClass,
11
11
  isNumeric,
12
- isTag,
13
12
  matches,
14
13
  queryAll,
15
- toArray,
16
14
  toggleClass,
17
15
  } from 'uikit-util';
18
- import { generateId } from '../api/instance';
19
- import { lazyload, swipe } from '../api/observables';
16
+ import { swipe } from '../api/observables';
17
+ import Connect from '../mixin/connect';
20
18
  import { maybeDefaultPreventClick } from '../mixin/event';
21
- import Togglable from '../mixin/togglable';
22
19
  import { getNavigationIndex, keyMap } from '../util/keys';
23
20
 
24
21
  const selDisabled = '.uk-disabled *, .uk-disabled, [disabled]';
25
22
 
26
23
  export default {
27
- mixins: [Togglable],
24
+ mixins: [Connect],
28
25
 
29
26
  args: 'connect',
30
27
 
31
28
  props: {
32
- connect: String,
33
29
  toggle: String,
34
30
  itemNav: String,
35
31
  active: Number,
@@ -42,7 +38,6 @@ export default {
42
38
  toggle: '> * > :first-child',
43
39
  itemNav: false,
44
40
  active: 0,
45
- cls: 'uk-active',
46
41
  attrItem: 'uk-switcher-item',
47
42
  selVertical: '.uk-nav',
48
43
  followFocus: false,
@@ -50,15 +45,6 @@ export default {
50
45
  },
51
46
 
52
47
  computed: {
53
- connects: {
54
- get: ({ connect }, $el) => queryAll(connect, $el),
55
- observe: ({ connect }) => connect,
56
- },
57
-
58
- connectChildren() {
59
- return this.connects.flatMap((el) => children(el));
60
- },
61
-
62
48
  toggles: ({ toggle }, $el) => $$(toggle, $el),
63
49
 
64
50
  children(_, $el) {
@@ -95,10 +81,7 @@ export default {
95
81
  this.$el.role = 'tablist';
96
82
  },
97
83
 
98
- observe: [
99
- lazyload({ targets: ({ connectChildren }) => connectChildren }),
100
- swipe({ target: ({ connects }) => connects, filter: ({ swiping }) => swiping }),
101
- ],
84
+ observe: swipe({ target: ({ connects }) => connects, filter: ({ swiping }) => swiping }),
102
85
 
103
86
  events: [
104
87
  {
@@ -173,28 +156,17 @@ export default {
173
156
  ],
174
157
 
175
158
  update() {
176
- for (const el of this.connects) {
177
- if (isTag(el, 'ul')) {
178
- el.role = 'presentation';
179
- }
180
- }
181
159
  attr(children(this.$el), 'role', 'presentation');
182
160
 
183
161
  for (const index in this.toggles) {
184
- const toggle = this.toggles[index];
185
- const item = this.connects[0]?.children[index];
186
-
187
- toggle.role = 'tab';
162
+ const controls = this.connects
163
+ .map(({ children }) => children[index]?.id)
164
+ .filter(Boolean);
188
165
 
189
- if (!item) {
190
- continue;
191
- }
192
-
193
- toggle.id = generateId(this, toggle);
194
- item.id = generateId(this, item);
195
-
196
- attr(toggle, 'aria-controls', item.id);
197
- attr(item, { role: 'tabpanel', 'aria-labelledby': toggle.id });
166
+ attr(this.toggles[index], {
167
+ role: 'tab',
168
+ 'aria-controls': controls.join(' '),
169
+ });
198
170
  }
199
171
  attr(this.$el, 'aria-orientation', matches(this.$el, this.selVertical) ? 'vertical' : null);
200
172
  },
@@ -233,16 +205,7 @@ export default {
233
205
  });
234
206
  });
235
207
 
236
- const animate = prev >= 0 && prev !== next;
237
- this.connects.forEach(async ({ children }) => {
238
- const actives = toArray(children).filter(
239
- (child, i) => i !== next && hasClass(child, this.cls),
240
- );
241
-
242
- if (await this.toggleElement(actives, false, animate)) {
243
- await this.toggleElement(children[next], true, animate);
244
- }
245
- });
208
+ return this.showConnects(next, prev >= 0 && prev !== next);
246
209
  },
247
210
  },
248
211
  };