uikit 3.11.2-dev.c2430c233 → 3.11.2-dev.c7ed3c19b

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) 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 +5 -0
  6. package/build/.eslintrc.json +1 -3
  7. package/build/build.js +26 -28
  8. package/build/icons.js +7 -11
  9. package/build/less.js +48 -36
  10. package/build/package.json +2 -2
  11. package/build/prefix.js +21 -18
  12. package/build/publishDev.js +6 -8
  13. package/build/release.js +20 -17
  14. package/build/scope.js +21 -11
  15. package/build/scss.js +72 -39
  16. package/build/util.js +71 -62
  17. package/build/wrapper/icons.js +0 -2
  18. package/dist/css/uikit-core-rtl.css +1 -1
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +1 -1
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +1 -1
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +1 -1
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +88 -133
  27. package/dist/js/components/countdown.min.js +1 -1
  28. package/dist/js/components/filter.js +409 -438
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1116 -1305
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1164 -1383
  33. package/dist/js/components/lightbox.min.js +1 -1
  34. package/dist/js/components/notification.js +94 -114
  35. package/dist/js/components/notification.min.js +1 -1
  36. package/dist/js/components/parallax.js +294 -345
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +292 -344
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +727 -850
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +292 -344
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +615 -799
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +588 -619
  47. package/dist/js/components/sortable.min.js +1 -1
  48. package/dist/js/components/tooltip.js +324 -356
  49. package/dist/js/components/tooltip.min.js +1 -1
  50. package/dist/js/components/upload.js +155 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5356 -6705
  53. package/dist/js/uikit-core.min.js +1 -1
  54. package/dist/js/uikit-icons.js +7 -9
  55. package/dist/js/uikit-icons.min.js +1 -1
  56. package/dist/js/uikit.js +8116 -9909
  57. package/dist/js/uikit.min.js +1 -1
  58. package/jsconfig.json +1 -1
  59. package/package.json +64 -60
  60. package/src/js/api/boot.js +25 -32
  61. package/src/js/api/component.js +23 -27
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +13 -32
  64. package/src/js/api/instance.js +7 -15
  65. package/src/js/api/state.js +65 -82
  66. package/src/js/components/countdown.js +24 -50
  67. package/src/js/components/filter.js +71 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +11 -23
  70. package/src/js/components/internal/slider-transitioner.js +66 -45
  71. package/src/js/components/internal/slideshow-animations.js +42 -61
  72. package/src/js/components/lightbox-panel.js +135 -109
  73. package/src/js/components/lightbox.js +18 -39
  74. package/src/js/components/notification.js +49 -43
  75. package/src/js/components/parallax.js +16 -30
  76. package/src/js/components/slider-parallax.js +13 -23
  77. package/src/js/components/slider.js +75 -64
  78. package/src/js/components/slideshow-parallax.js +1 -1
  79. package/src/js/components/slideshow.js +8 -13
  80. package/src/js/components/sortable.js +125 -106
  81. package/src/js/components/tooltip.js +41 -31
  82. package/src/js/components/upload.js +52 -63
  83. package/src/js/core/accordion.js +53 -48
  84. package/src/js/core/alert.js +10 -17
  85. package/src/js/core/core.js +74 -53
  86. package/src/js/core/cover.js +11 -15
  87. package/src/js/core/drop.js +106 -92
  88. package/src/js/core/form-custom.js +20 -25
  89. package/src/js/core/gif.js +3 -7
  90. package/src/js/core/grid.js +57 -58
  91. package/src/js/core/height-match.js +16 -29
  92. package/src/js/core/height-viewport.js +28 -35
  93. package/src/js/core/icon.js +38 -50
  94. package/src/js/core/img.js +59 -58
  95. package/src/js/core/index.js +39 -39
  96. package/src/js/core/leader.js +9 -18
  97. package/src/js/core/margin.js +21 -37
  98. package/src/js/core/modal.js +50 -36
  99. package/src/js/core/nav.js +2 -4
  100. package/src/js/core/navbar.js +112 -88
  101. package/src/js/core/offcanvas.js +49 -53
  102. package/src/js/core/overflow-auto.js +13 -17
  103. package/src/js/core/responsive.js +14 -12
  104. package/src/js/core/scroll.js +10 -20
  105. package/src/js/core/scrollspy-nav.js +34 -31
  106. package/src/js/core/scrollspy.js +37 -54
  107. package/src/js/core/sticky.js +130 -91
  108. package/src/js/core/svg.js +60 -79
  109. package/src/js/core/switcher.js +47 -46
  110. package/src/js/core/tab.js +7 -10
  111. package/src/js/core/toggle.js +64 -66
  112. package/src/js/core/video.js +11 -22
  113. package/src/js/mixin/animate.js +19 -20
  114. package/src/js/mixin/class.js +2 -4
  115. package/src/js/mixin/container.js +7 -11
  116. package/src/js/mixin/internal/animate-fade.js +73 -30
  117. package/src/js/mixin/internal/animate-slide.js +61 -41
  118. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  119. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  120. package/src/js/mixin/media.js +5 -10
  121. package/src/js/mixin/modal.js +89 -66
  122. package/src/js/mixin/parallax.js +53 -48
  123. package/src/js/mixin/position.js +26 -20
  124. package/src/js/mixin/slider-autoplay.js +12 -21
  125. package/src/js/mixin/slider-drag.js +64 -65
  126. package/src/js/mixin/slider-nav.js +26 -35
  127. package/src/js/mixin/slider-reactive.js +2 -8
  128. package/src/js/mixin/slider.js +51 -50
  129. package/src/js/mixin/slideshow.js +13 -19
  130. package/src/js/mixin/togglable.js +90 -63
  131. package/src/js/uikit-core.js +2 -4
  132. package/src/js/uikit.js +2 -4
  133. package/src/js/util/ajax.js +27 -43
  134. package/src/js/util/animation.js +82 -75
  135. package/src/js/util/attr.js +17 -21
  136. package/src/js/util/class.js +14 -52
  137. package/src/js/util/dimensions.js +56 -43
  138. package/src/js/util/dom.js +40 -73
  139. package/src/js/util/env.js +7 -12
  140. package/src/js/util/event.js +60 -59
  141. package/src/js/util/fastdom.js +1 -6
  142. package/src/js/util/filter.js +17 -34
  143. package/src/js/util/index.js +0 -1
  144. package/src/js/util/lang.js +79 -119
  145. package/src/js/util/mouse.js +19 -17
  146. package/src/js/util/options.js +44 -49
  147. package/src/js/util/player.js +40 -36
  148. package/src/js/util/position.js +54 -46
  149. package/src/js/util/selector.js +34 -49
  150. package/src/js/util/style.js +36 -46
  151. package/src/js/util/viewport.js +75 -64
  152. package/tests/js/index.js +114 -85
  153. package/src/js/mixin/flex-bug.js +0 -56
  154. package/src/js/util/promise.js +0 -191
@@ -1,7 +1,21 @@
1
- import {$, $$, after, ajax, append, attr, includes, isVisible, isVoidElement, memoize, noop, Promise, remove, removeAttr, startsWith, toFloat} from 'uikit-util';
1
+ import {
2
+ $,
3
+ $$,
4
+ after,
5
+ append,
6
+ attr,
7
+ includes,
8
+ isVisible,
9
+ isVoidElement,
10
+ memoize,
11
+ noop,
12
+ remove,
13
+ removeAttr,
14
+ startsWith,
15
+ toFloat,
16
+ } from 'uikit-util';
2
17
 
3
18
  export default {
4
-
5
19
  args: 'src',
6
20
 
7
21
  props: {
@@ -15,14 +29,14 @@ export default {
15
29
  class: String,
16
30
  strokeAnimation: Boolean,
17
31
  focusable: Boolean, // IE 11
18
- attributes: 'list'
32
+ attributes: 'list',
19
33
  },
20
34
 
21
35
  data: {
22
36
  ratio: 1,
23
37
  include: ['style', 'class', 'focusable'],
24
38
  class: '',
25
- strokeAnimation: false
39
+ strokeAnimation: false,
26
40
  },
27
41
 
28
42
  beforeConnect() {
@@ -30,15 +44,12 @@ export default {
30
44
  },
31
45
 
32
46
  connected() {
33
-
34
47
  if (!this.icon && includes(this.src, '#')) {
35
48
  [this.src, this.icon] = this.src.split('#');
36
49
  }
37
50
 
38
- this.svg = this.getSvg().then(el => {
39
-
51
+ this.svg = this.getSvg().then((el) => {
40
52
  if (this._connected) {
41
-
42
53
  const svg = insertSVG(el, this.$el);
43
54
 
44
55
  if (this.svgEl && svg !== this.svgEl) {
@@ -47,16 +58,13 @@ export default {
47
58
 
48
59
  this.applyAttributes(svg, el);
49
60
  this.$emit();
50
- return this.svgEl = svg;
61
+ return (this.svgEl = svg);
51
62
  }
52
-
53
63
  }, noop);
54
-
55
64
  },
56
65
 
57
66
  disconnected() {
58
-
59
- this.svg.then(svg => {
67
+ this.svg.then((svg) => {
60
68
  if (this._connected) {
61
69
  return;
62
70
  }
@@ -67,15 +75,12 @@ export default {
67
75
 
68
76
  remove(svg);
69
77
  this.svgEl = null;
70
-
71
78
  });
72
79
 
73
80
  this.svg = null;
74
-
75
81
  },
76
82
 
77
83
  update: {
78
-
79
84
  read() {
80
85
  return !!(this.strokeAnimation && this.svgEl && isVisible(this.svgEl));
81
86
  },
@@ -84,22 +89,17 @@ export default {
84
89
  applyAnimation(this.svgEl);
85
90
  },
86
91
 
87
- type: ['resize']
88
-
92
+ type: ['resize'],
89
93
  },
90
94
 
91
95
  methods: {
92
-
93
- getSvg() {
94
- return loadSVG(this.src).then(svg =>
95
- parseSVG(svg, this.icon) || Promise.reject('SVG not found.')
96
- );
96
+ async getSvg() {
97
+ return parseSVG(await loadSVG(this.src), this.icon) || Promise.reject('SVG not found.');
97
98
  },
98
99
 
99
100
  applyAttributes(el, ref) {
100
-
101
101
  for (const prop in this.$options.props) {
102
- if (includes(this.include, prop) && (prop in this)) {
102
+ if (includes(this.include, prop) && prop in this) {
103
103
  attr(el, prop, this[prop]);
104
104
  }
105
105
  }
@@ -114,65 +114,48 @@ export default {
114
114
  }
115
115
 
116
116
  const props = ['width', 'height'];
117
- let dimensions = props.map(prop => this[prop]);
117
+ let dimensions = props.map((prop) => this[prop]);
118
118
 
119
- if (!dimensions.some(val => val)) {
120
- dimensions = props.map(prop => attr(ref, prop));
119
+ if (!dimensions.some((val) => val)) {
120
+ dimensions = props.map((prop) => attr(ref, prop));
121
121
  }
122
122
 
123
123
  const viewBox = attr(ref, 'viewBox');
124
- if (viewBox && !dimensions.some(val => val)) {
124
+ if (viewBox && !dimensions.some((val) => val)) {
125
125
  dimensions = viewBox.split(' ').slice(2);
126
126
  }
127
127
 
128
- dimensions.forEach((val, i) =>
129
- attr(el, props[i], toFloat(val) * this.ratio || null)
130
- );
131
-
132
- }
133
-
134
- }
135
-
128
+ dimensions.forEach((val, i) => attr(el, props[i], toFloat(val) * this.ratio || null));
129
+ },
130
+ },
136
131
  };
137
132
 
138
- const loadSVG = memoize(src =>
139
- new Promise((resolve, reject) => {
140
-
141
- if (!src) {
142
- reject();
143
- return;
144
- }
145
-
133
+ const loadSVG = memoize(async (src) => {
134
+ if (src) {
146
135
  if (startsWith(src, 'data:')) {
147
- resolve(decodeURIComponent(src.split(',')[1]));
136
+ return decodeURIComponent(src.split(',')[1]);
148
137
  } else {
149
-
150
- ajax(src).then(
151
- xhr => resolve(xhr.response),
152
- () => reject('SVG not found.')
153
- );
154
-
138
+ return (await fetch(src)).text();
155
139
  }
156
- })
157
- );
140
+ } else {
141
+ return Promise.reject();
142
+ }
143
+ });
158
144
 
159
145
  function parseSVG(svg, icon) {
160
-
161
146
  if (icon && includes(svg, '<symbol')) {
162
147
  svg = parseSymbols(svg, icon) || svg;
163
148
  }
164
149
 
165
150
  svg = $(svg.substr(svg.indexOf('<svg')));
166
- return svg && svg.hasChildNodes() && svg;
151
+ return svg?.hasChildNodes() && svg;
167
152
  }
168
153
 
169
154
  const symbolRe = /<symbol([^]*?id=(['"])(.+?)\2[^]*?<\/)symbol>/g;
170
155
  const symbols = {};
171
156
 
172
157
  function parseSymbols(svg, icon) {
173
-
174
158
  if (!symbols[svg]) {
175
-
176
159
  symbols[svg] = {};
177
160
 
178
161
  symbolRe.lastIndex = 0;
@@ -181,49 +164,44 @@ function parseSymbols(svg, icon) {
181
164
  while ((match = symbolRe.exec(svg))) {
182
165
  symbols[svg][match[3]] = `<svg xmlns="http://www.w3.org/2000/svg"${match[1]}svg>`;
183
166
  }
184
-
185
167
  }
186
168
 
187
169
  return symbols[svg][icon];
188
170
  }
189
171
 
190
172
  function applyAnimation(el) {
191
-
192
173
  const length = getMaxPathLength(el);
193
174
 
194
175
  if (length) {
195
176
  el.style.setProperty('--uk-animation-stroke', length);
196
177
  }
197
-
198
178
  }
199
179
 
200
180
  export function getMaxPathLength(el) {
201
- return Math.ceil(Math.max(0, ...$$('[stroke]', el).map(stroke => {
202
- try {
203
- return stroke.getTotalLength();
204
- } catch (e) {
205
- return 0;
206
- }
207
- })));
181
+ return Math.ceil(
182
+ Math.max(
183
+ 0,
184
+ ...$$('[stroke]', el).map((stroke) => {
185
+ try {
186
+ return stroke.getTotalLength();
187
+ } catch (e) {
188
+ return 0;
189
+ }
190
+ })
191
+ )
192
+ );
208
193
  }
209
194
 
210
195
  function insertSVG(el, root) {
211
-
212
196
  if (isVoidElement(root) || root.tagName === 'CANVAS') {
213
-
214
197
  root.hidden = true;
215
198
 
216
199
  const next = root.nextElementSibling;
217
- return equals(el, next)
218
- ? next
219
- : after(root, el);
220
-
200
+ return equals(el, next) ? next : after(root, el);
221
201
  }
222
202
 
223
203
  const last = root.lastElementChild;
224
- return equals(el, last)
225
- ? last
226
- : append(root, el);
204
+ return equals(el, last) ? last : append(root, el);
227
205
  }
228
206
 
229
207
  function equals(el, other) {
@@ -231,9 +209,12 @@ function equals(el, other) {
231
209
  }
232
210
 
233
211
  function isSVG(el) {
234
- return el && el.tagName === 'svg';
212
+ return el?.tagName === 'svg';
235
213
  }
236
214
 
237
215
  function innerHTML(el) {
238
- return (el.innerHTML || (new XMLSerializer()).serializeToString(el).replace(/<svg.*?>(.*?)<\/svg>/g, '$1')).replace(/\s/g, '');
216
+ return (
217
+ el.innerHTML ||
218
+ new XMLSerializer().serializeToString(el).replace(/<svg.*?>(.*?)<\/svg>/g, '$1')
219
+ ).replace(/\s/g, '');
239
220
  }
@@ -1,8 +1,22 @@
1
1
  import Togglable from '../mixin/togglable';
2
- import {$$, attr, children, css, data, endsWith, findIndex, getIndex, hasClass, matches, queryAll, toggleClass, toNodes, within} from 'uikit-util';
2
+ import {
3
+ $$,
4
+ attr,
5
+ children,
6
+ css,
7
+ data,
8
+ endsWith,
9
+ findIndex,
10
+ getIndex,
11
+ hasClass,
12
+ matches,
13
+ queryAll,
14
+ toggleClass,
15
+ toNodes,
16
+ within,
17
+ } from 'uikit-util';
3
18
 
4
19
  export default {
5
-
6
20
  mixins: [Togglable],
7
21
 
8
22
  args: 'connect',
@@ -12,7 +26,7 @@ export default {
12
26
  toggle: String,
13
27
  itemNav: String,
14
28
  active: Number,
15
- swiping: Boolean
29
+ swiping: Boolean,
16
30
  },
17
31
 
18
32
  data: {
@@ -22,40 +36,34 @@ export default {
22
36
  active: 0,
23
37
  swiping: true,
24
38
  cls: 'uk-active',
25
- attrItem: 'uk-switcher-item'
39
+ attrItem: 'uk-switcher-item',
26
40
  },
27
41
 
28
42
  computed: {
29
-
30
43
  connects: {
31
-
32
- get({connect}, $el) {
44
+ get({ connect }, $el) {
33
45
  return queryAll(connect, $el);
34
46
  },
35
47
 
36
48
  watch(connects) {
37
-
38
49
  if (this.swiping) {
39
50
  css(connects, 'touch-action', 'pan-y pinch-zoom');
40
51
  }
41
52
 
42
53
  const index = this.index();
43
- this.connects.forEach(el =>
44
- children(el).forEach((child, i) =>
45
- toggleClass(child, this.cls, i === index)
46
- )
54
+ this.connects.forEach((el) =>
55
+ children(el).forEach((child, i) => toggleClass(child, this.cls, i === index))
47
56
  );
48
-
49
57
  },
50
58
 
51
- immediate: true
52
-
59
+ immediate: true,
53
60
  },
54
61
 
55
62
  toggles: {
56
-
57
- get({toggle}, $el) {
58
- return $$(toggle, $el).filter(el => !matches(el, '.uk-disabled *, .uk-disabled, [disabled]'));
63
+ get({ toggle }, $el) {
64
+ return $$(toggle, $el).filter(
65
+ (el) => !matches(el, '.uk-disabled *, .uk-disabled, [disabled]')
66
+ );
59
67
  },
60
68
 
61
69
  watch(toggles) {
@@ -63,20 +71,18 @@ export default {
63
71
  this.show(~active ? active : toggles[this.active] || toggles[0]);
64
72
  },
65
73
 
66
- immediate: true
67
-
74
+ immediate: true,
68
75
  },
69
76
 
70
77
  children() {
71
- return children(this.$el).filter(child => this.toggles.some(toggle => within(toggle, child)));
72
- }
73
-
78
+ return children(this.$el).filter((child) =>
79
+ this.toggles.some((toggle) => within(toggle, child))
80
+ );
81
+ },
74
82
  },
75
83
 
76
84
  events: [
77
-
78
85
  {
79
-
80
86
  name: 'click',
81
87
 
82
88
  delegate() {
@@ -86,8 +92,7 @@ export default {
86
92
  handler(e) {
87
93
  e.preventDefault();
88
94
  this.show(e.current);
89
- }
90
-
95
+ },
91
96
  },
92
97
 
93
98
  {
@@ -104,7 +109,7 @@ export default {
104
109
  handler(e) {
105
110
  e.preventDefault();
106
111
  this.show(data(e.current, this.attrItem));
107
- }
112
+ },
108
113
  },
109
114
 
110
115
  {
@@ -118,21 +123,18 @@ export default {
118
123
  return this.connects;
119
124
  },
120
125
 
121
- handler({type}) {
126
+ handler({ type }) {
122
127
  this.show(endsWith(type, 'Left') ? 'next' : 'previous');
123
- }
124
- }
125
-
128
+ },
129
+ },
126
130
  ],
127
131
 
128
132
  methods: {
129
-
130
133
  index() {
131
- return findIndex(this.children, el => hasClass(el, this.cls));
134
+ return findIndex(this.children, (el) => hasClass(el, this.cls));
132
135
  },
133
136
 
134
137
  show(item) {
135
-
136
138
  const prev = this.index();
137
139
  const next = getIndex(
138
140
  this.children[getIndex(item, this.toggles, prev)],
@@ -148,15 +150,14 @@ export default {
148
150
  attr(this.toggles[i], 'aria-expanded', next === i);
149
151
  });
150
152
 
151
- this.connects.forEach(({children}) =>
152
- this.toggleElement(toNodes(children).filter(child =>
153
- hasClass(child, this.cls)
154
- ), false, prev >= 0).then(() =>
155
- this.toggleElement(children[next], true, prev >= 0)
156
- )
157
- );
158
- }
159
-
160
- }
161
-
153
+ this.connects.forEach(async ({ children }) => {
154
+ await this.toggleElement(
155
+ toNodes(children).filter((child) => hasClass(child, this.cls)),
156
+ false,
157
+ prev >= 0
158
+ );
159
+ await this.toggleElement(children[next], true, prev >= 0);
160
+ });
161
+ },
162
+ },
162
163
  };
@@ -1,33 +1,30 @@
1
1
  import Switcher from './switcher';
2
2
  import Class from '../mixin/class';
3
- import {hasClass} from 'uikit-util';
3
+ import { hasClass } from 'uikit-util';
4
4
 
5
5
  export default {
6
-
7
6
  mixins: [Class],
8
7
 
9
8
  extends: Switcher,
10
9
 
11
10
  props: {
12
- media: Boolean
11
+ media: Boolean,
13
12
  },
14
13
 
15
14
  data: {
16
15
  media: 960,
17
- attrItem: 'uk-tab-item'
16
+ attrItem: 'uk-tab-item',
18
17
  },
19
18
 
20
19
  connected() {
21
-
22
20
  const cls = hasClass(this.$el, 'uk-tab-left')
23
21
  ? 'uk-tab-left'
24
22
  : hasClass(this.$el, 'uk-tab-right')
25
- ? 'uk-tab-right'
26
- : false;
23
+ ? 'uk-tab-right'
24
+ : false;
27
25
 
28
26
  if (cls) {
29
- this.$create('toggle', this.$el, {cls, mode: 'media', media: this.media});
27
+ this.$create('toggle', this.$el, { cls, mode: 'media', media: this.media });
30
28
  }
31
- }
32
-
29
+ },
33
30
  };