uikit 3.25.28-dev.fcd5185 → 3.25.29-dev.7b0f736

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 (55) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/build/ci-release.js +1 -4
  3. package/dist/css/uikit-core-rtl.css +1 -1
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +1 -1
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +1 -1
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +1 -1
  10. package/dist/css/uikit.min.css +1 -1
  11. package/dist/js/components/countdown.js +1 -1
  12. package/dist/js/components/countdown.min.js +1 -1
  13. package/dist/js/components/filter.js +10 -9
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +12 -11
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +12 -11
  18. package/dist/js/components/lightbox.min.js +1 -1
  19. package/dist/js/components/notification.js +1 -1
  20. package/dist/js/components/notification.min.js +1 -1
  21. package/dist/js/components/parallax.js +10 -9
  22. package/dist/js/components/parallax.min.js +1 -1
  23. package/dist/js/components/slider-parallax.js +1 -1
  24. package/dist/js/components/slider-parallax.min.js +1 -1
  25. package/dist/js/components/slider.js +10 -9
  26. package/dist/js/components/slider.min.js +1 -1
  27. package/dist/js/components/slideshow-parallax.js +1 -1
  28. package/dist/js/components/slideshow-parallax.min.js +1 -1
  29. package/dist/js/components/slideshow.js +10 -9
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +10 -9
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +1 -1
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +35 -48
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +30 -30
  38. package/dist/js/uikit-core.min.js +1 -1
  39. package/dist/js/uikit-icons.js +1 -1
  40. package/dist/js/uikit-icons.min.js +1 -1
  41. package/dist/js/uikit.js +64 -77
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +1 -1
  44. package/src/js/api/component.js +1 -1
  45. package/src/js/api/computed.js +1 -1
  46. package/src/js/api/log.js +1 -1
  47. package/src/js/api/observables.js +5 -4
  48. package/src/js/api/observer.js +3 -4
  49. package/src/js/api/update.js +10 -9
  50. package/src/js/components/upload.js +38 -49
  51. package/src/js/core/drop.js +4 -4
  52. package/src/js/core/form-custom.js +3 -8
  53. package/src/js/core/svg.js +1 -1
  54. package/src/js/core/toggle.js +0 -2
  55. package/src/js/mixin/modal.js +1 -1
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "uikit",
3
3
  "title": "UIkit",
4
4
  "description": "UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.",
5
- "version": "3.25.28-dev.fcd5185",
5
+ "version": "3.25.29-dev.7b0f736",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -21,7 +21,7 @@ export function component(name, options) {
21
21
 
22
22
  App[name] = (element, data) => createComponent(name, element, data);
23
23
 
24
- const opt = options.options ?? { ...options };
24
+ const opt = options.options || { ...options };
25
25
 
26
26
  opt.id = id;
27
27
  opt.name = name;
@@ -74,7 +74,7 @@ export function initComputedUpdates(instance) {
74
74
  }
75
75
 
76
76
  function resetComputed(instance) {
77
- const values = { ...instance._computed };
77
+ const values = instance._computed;
78
78
  instance._computed = {};
79
79
  return values;
80
80
  }
package/src/js/api/log.js CHANGED
@@ -5,6 +5,6 @@ export function log(instance, eventName, eventData) {
5
5
  instance._uid,
6
6
  'font-weight:bold;',
7
7
  eventName,
8
- [...(eventData ?? []), instance, instance.$el],
8
+ [...(eventData || []), instance, instance.$el],
9
9
  );
10
10
  }
@@ -83,13 +83,14 @@ export function swipe(options) {
83
83
  const pos = getEventPos(e);
84
84
  const target = 'tagName' in e.target ? e.target : parent(e.target);
85
85
  once(document, `${pointerUp} ${pointerCancel} scroll`, (e) => {
86
+ if (e.type !== pointerUp || !target) {
87
+ return;
88
+ }
89
+
86
90
  const { x, y } = getEventPos(e);
87
91
 
88
92
  // swipe
89
- if (
90
- (e.type !== 'scroll' && target && x && Math.abs(pos.x - x) > 100) ||
91
- (y && Math.abs(pos.y - y) > 100)
92
- ) {
93
+ if ((x && Math.abs(pos.x - x) > 100) || (y && Math.abs(pos.y - y) > 100)) {
93
94
  setTimeout(() => {
94
95
  trigger(target, 'swipe');
95
96
  trigger(target, `swipe${swipeDirection(pos.x, pos.y, x, y)}`);
@@ -3,19 +3,18 @@ import { registerComputed } from './computed';
3
3
  import { registerWatch } from './watch';
4
4
 
5
5
  export function initObservers(instance) {
6
- for (const observer of instance.$options.observe || []) {
7
- registerObservable(instance, observer);
6
+ for (const [index, observer] of (instance.$options.observe || []).entries()) {
7
+ registerObservable(instance, observer, `_observe${index}`);
8
8
  }
9
9
  }
10
10
 
11
- function registerObservable(instance, observable) {
11
+ function registerObservable(instance, observable, key) {
12
12
  let { observe, target = instance.$el, handler, options, filter, args } = observable;
13
13
 
14
14
  if (filter && !filter.call(instance, instance)) {
15
15
  return;
16
16
  }
17
17
 
18
- const key = `_observe${instance._disconnect.length}`;
19
18
  if (isFunction(target) && !hasOwn(instance, key)) {
20
19
  registerComputed(instance, key, () => {
21
20
  const targets = target.call(instance, instance);
@@ -20,24 +20,25 @@ export function callUpdate(instance, e = 'update') {
20
20
  return;
21
21
  }
22
22
 
23
- if (!instance._updateCount) {
24
- instance._updateCount = 0;
25
- requestAnimationFrame(() => (instance._updateCount = 0));
26
- }
27
-
28
23
  if (!instance._queued) {
29
24
  instance._queued = new Set();
30
25
  fastdom.read(() => {
31
26
  if (instance._connected) {
32
- runUpdates(instance, instance._queued);
27
+ if (!instance._updateCount) {
28
+ instance._updateCount = 0;
29
+ requestAnimationFrame(() => (instance._updateCount = 0));
30
+ }
31
+
32
+ if (instance._updateCount < 10) {
33
+ instance._updateCount++;
34
+ runUpdates(instance, instance._queued);
35
+ }
33
36
  }
34
37
  instance._queued = null;
35
38
  });
36
39
  }
37
40
 
38
- if (instance._updateCount++ < 20) {
39
- instance._queued.add(e.type || e);
40
- }
41
+ instance._queued.add(e.type || e);
41
42
  }
42
43
 
43
44
  function runUpdates(instance, types) {
@@ -95,48 +95,49 @@ export default {
95
95
 
96
96
  methods: {
97
97
  async upload(files) {
98
- files = toArray(files);
98
+ try {
99
+ files = toArray(files);
99
100
 
100
- if (!files.length) {
101
- return;
102
- }
103
-
104
- if (!this.multiple) {
105
- files = files.slice(0, 1);
106
- }
107
-
108
- trigger(this.$el, 'upload', [files]);
109
-
110
- for (const file of files) {
111
- if (this.maxSize && this.maxSize * 1000 < file.size) {
112
- this.fail(this.t('invalidSize', this.maxSize));
101
+ if (!files.length) {
113
102
  return;
114
103
  }
115
104
 
116
- if (this.allow && !match(this.allow, file.name)) {
117
- this.fail(this.t('invalidName', this.allow));
118
- return;
105
+ if (!this.multiple) {
106
+ files = files.slice(0, 1);
119
107
  }
120
108
 
121
- if (this.mime && !match(this.mime, file.type)) {
122
- this.fail(this.t('invalidMime', this.mime));
123
- return;
109
+ trigger(this.$el, 'upload', [files]);
110
+
111
+ for (const file of files) {
112
+ if (this.maxSize && this.maxSize * 1000 < file.size) {
113
+ this.fail(this.t('invalidSize', this.maxSize));
114
+ return;
115
+ }
116
+
117
+ if (this.allow && !match(this.allow, file.name)) {
118
+ this.fail(this.t('invalidName', this.allow));
119
+ return;
120
+ }
121
+
122
+ if (this.mime && !match(this.mime, file.type)) {
123
+ this.fail(this.t('invalidMime', this.mime));
124
+ return;
125
+ }
124
126
  }
125
- }
126
127
 
127
- this.beforeAll(this, files);
128
+ await this.beforeAll(this, files);
128
129
 
129
- const chunks = chunk(files, this.concurrent);
130
- const upload = async (files) => {
131
- const data = new FormData();
130
+ const size = this.concurrent;
132
131
 
133
- files.forEach((file) => data.append(this.name, file));
132
+ for (let i = 0; i < files.length; i += size) {
133
+ const data = new FormData();
134
134
 
135
- for (const key in this.params) {
136
- data.append(key, this.params[key]);
137
- }
135
+ files.slice(i, i + size).forEach((file) => data.append(this.name, file));
136
+
137
+ for (const key in this.params) {
138
+ data.append(key, this.params[key]);
139
+ }
138
140
 
139
- try {
140
141
  const xhr = await ajax(this.url, {
141
142
  data,
142
143
  method: this.method,
@@ -154,19 +155,15 @@ export default {
154
155
 
155
156
  this.complete(xhr);
156
157
 
157
- if (chunks.length) {
158
- await upload(chunks.shift());
159
- } else {
158
+ if (i + size >= files.length) {
160
159
  this.completeAll(xhr);
161
160
  }
162
- } catch (e) {
163
- if (e.name !== 'AbortError') {
164
- this.error(e);
165
- }
166
161
  }
167
- };
168
-
169
- await upload(chunks.shift());
162
+ } catch (e) {
163
+ if (e?.name !== 'AbortError') {
164
+ this.error(e);
165
+ }
166
+ }
170
167
  },
171
168
  },
172
169
  };
@@ -174,20 +171,12 @@ export default {
174
171
  function match(pattern, path) {
175
172
  const expression = pattern.replace(
176
173
  /\*\*|[.*+?^${}()|[\]\\]/g,
177
- (s) => ({ '**': '.*', '*': '[^/]+', '?': '[^/]', '|': '|' })[s] ?? `\\${s}`,
174
+ (s) => ({ '**': '.*', '*': '[^/]+', '?': '[^/]', '|': '|' })[s] || `\\${s}`,
178
175
  );
179
176
 
180
177
  return new RegExp(`^(?:${expression})$`, 'i').test(path);
181
178
  }
182
179
 
183
- function chunk(files, size) {
184
- const chunks = [];
185
- for (let i = 0; i < files.length; i += size) {
186
- chunks.push(files.slice(i, i + size));
187
- }
188
- return chunks;
189
- }
190
-
191
180
  function stop(e) {
192
181
  e.preventDefault();
193
182
  e.stopPropagation();
@@ -114,11 +114,11 @@ export default {
114
114
  this._style = pick(this.$el.style, ['width', 'height']);
115
115
  },
116
116
 
117
+ beforeDisconnect() {
118
+ this.hide(false, false);
119
+ },
120
+
117
121
  disconnected() {
118
- if (this.isActive()) {
119
- this.hide(false);
120
- active = null;
121
- }
122
122
  css(this.$el, this._style);
123
123
  },
124
124
 
@@ -1,4 +1,4 @@
1
- import { $, $$, isInput, matches, parent, selInput } from 'uikit-util';
1
+ import { $, isInput, parent, selInput } from 'uikit-util';
2
2
  import Class from '../mixin/class';
3
3
 
4
4
  export default {
@@ -37,15 +37,10 @@ export default {
37
37
  return;
38
38
  }
39
39
 
40
- let option;
41
40
  const prop = isInput(target) ? 'value' : 'textContent';
42
41
  const prev = target[prop];
43
- const value = input.files?.[0]
44
- ? input.files[0].name
45
- : matches(input, 'select') &&
46
- (option = $$('option', input).find((el) => el.selected))
47
- ? option.textContent
48
- : input.value;
42
+ const value =
43
+ input.files?.[0]?.name ?? input.selectedOptions?.[0]?.label ?? input.value;
49
44
 
50
45
  if (prev !== value) {
51
46
  target[prop] = value;
@@ -84,7 +84,7 @@ function applyAttributes(el) {
84
84
  const loadSVG = memoize(async (src) => {
85
85
  if (src) {
86
86
  const response = await fetch(src);
87
- if (response.headers.get('Content-Type') === 'image/svg+xml') {
87
+ if (/^image\/svg\+xml\s*(;|$)/i.test(response.headers.get('Content-Type'))) {
88
88
  return response.text();
89
89
  }
90
90
  }
@@ -177,8 +177,6 @@ export default {
177
177
 
178
178
  filter: ({ mode }) => includes(mode, 'media'),
179
179
 
180
- el: ({ target }) => target,
181
-
182
180
  handler(e, mediaObj) {
183
181
  if (mediaObj.matches ^ this.isToggled(this.target)) {
184
182
  this.toggle();
@@ -239,7 +239,7 @@ function animate(el, show, { transitionElement, _toggle }) {
239
239
  _toggle(el, show);
240
240
 
241
241
  Promise.all(
242
- (transitionElement?.getAnimations?.() ?? []).map(({ finished }) => finished),
242
+ (transitionElement?.getAnimations?.() || []).map(({ finished }) => finished),
243
243
  ).then(resolve, reject);
244
244
  }),
245
245
  ).then(() => {