uikit 3.15.9-dev.ffad54c1a → 3.15.10-dev.6ba1ea187

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 (47) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/css/uikit-core-rtl.css +1 -1
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +1 -1
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +1 -1
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +1 -1
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +1 -1
  11. package/dist/js/components/countdown.min.js +1 -1
  12. package/dist/js/components/filter.js +44 -52
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +1 -1
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +1 -1
  17. package/dist/js/components/lightbox.min.js +1 -1
  18. package/dist/js/components/notification.js +1 -1
  19. package/dist/js/components/notification.min.js +1 -1
  20. package/dist/js/components/parallax.js +1 -1
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +1 -1
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +1 -1
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +1 -1
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +1 -1
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +44 -52
  31. package/dist/js/components/sortable.min.js +1 -1
  32. package/dist/js/components/tooltip.js +1 -1
  33. package/dist/js/components/tooltip.min.js +1 -1
  34. package/dist/js/components/upload.js +1 -1
  35. package/dist/js/components/upload.min.js +1 -1
  36. package/dist/js/uikit-core.js +4 -4
  37. package/dist/js/uikit-core.min.js +1 -1
  38. package/dist/js/uikit-icons.js +1 -1
  39. package/dist/js/uikit-icons.min.js +1 -1
  40. package/dist/js/uikit.js +47 -55
  41. package/dist/js/uikit.min.js +2 -2
  42. package/package.json +1 -1
  43. package/src/js/api/state.js +2 -2
  44. package/src/js/mixin/animate.js +1 -4
  45. package/src/js/mixin/internal/animate-slide.js +47 -53
  46. package/tests/filter.html +2 -2
  47. package/tests/lightbox.html +2 -2
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.15.9-dev.ffad54c1a",
5
+ "version": "3.15.10-dev.6ba1ea187",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -115,8 +115,8 @@ export default function (UIkit) {
115
115
  }
116
116
  };
117
117
 
118
- UIkit.prototype.registerObserver = function (observer) {
119
- this._observers.push(observer);
118
+ UIkit.prototype.registerObserver = function (...observer) {
119
+ this._observers.push(...observer);
120
120
  };
121
121
 
122
122
  UIkit.prototype._disconnectObservers = function () {
@@ -28,10 +28,7 @@ export default {
28
28
  return Promise.resolve();
29
29
  };
30
30
 
31
- return animationFn(action, target, this.duration).then(
32
- () => this.$update(target, 'resize'),
33
- noop
34
- );
31
+ return animationFn(action, target, this.duration).catch(noop);
35
32
  },
36
33
  },
37
34
  };
@@ -1,12 +1,11 @@
1
1
  import {
2
+ attr,
2
3
  children,
3
4
  css,
4
5
  fastdom,
5
6
  includes,
6
7
  index,
7
- isEqual,
8
8
  isVisible,
9
- noop,
10
9
  observeMutation,
11
10
  offset,
12
11
  parent,
@@ -21,14 +20,10 @@ export default async function (action, target, duration) {
21
20
 
22
21
  // Get current state
23
22
  const currentProps = nodes.map((el) => getProps(el, true));
24
- const targetProps = css(target, ['height', 'padding']);
23
+ const targetProps = { ...css(target, ['height', 'padding']), display: 'block' };
25
24
 
26
25
  // Cancel previous animations
27
- Transition.cancel(target);
28
- nodes.forEach(Transition.cancel);
29
- reset(target);
30
-
31
- const { promise, observer } = awaitMutation(target);
26
+ await Promise.all(nodes.concat(target).map(Transition.cancel));
32
27
 
33
28
  // Adding, sorting, removing nodes
34
29
  action();
@@ -37,23 +32,23 @@ export default async function (action, target, duration) {
37
32
  nodes = nodes.concat(children(target).filter((el) => !includes(nodes, el)));
38
33
 
39
34
  // Wait for update to propagate
40
- if (isEqual(children(target), nodes)) {
41
- observer.disconnect();
42
- await Promise.resolve();
43
- } else {
44
- await promise;
45
- }
35
+ await awaitMutation();
46
36
 
47
37
  // Force update
48
38
  fastdom.flush();
49
39
 
50
40
  // Get new state
41
+ const targetStyle = attr(target, 'style');
51
42
  const targetPropsTo = css(target, ['height', 'padding']);
52
43
  const [propsTo, propsFrom] = getTransitionProps(target, nodes, currentProps);
44
+ const attrsTo = nodes.map((el) => ({
45
+ class: attr(el, 'class'),
46
+ style: attr(el, 'style'),
47
+ }));
53
48
 
54
49
  // Reset to previous state
55
50
  nodes.forEach((el, i) => propsFrom[i] && css(el, propsFrom[i]));
56
- css(target, { display: 'block', ...targetProps });
51
+ css(target, targetProps);
57
52
 
58
53
  // Start transitions on next frame
59
54
  await awaitFrame();
@@ -62,13 +57,19 @@ export default async function (action, target, duration) {
62
57
  .map((el, i) => parent(el) === target && Transition.start(el, propsTo[i], duration, 'ease'))
63
58
  .concat(Transition.start(target, targetPropsTo, duration, 'ease'));
64
59
 
65
- await Promise.all(transitions).then(() => {
66
- nodes.forEach(
67
- (el, i) =>
68
- parent(el) === target && css(el, 'display', propsTo[i].opacity === 0 ? 'none' : '')
69
- );
70
- reset(target);
71
- }, noop);
60
+ try {
61
+ await Promise.all(transitions);
62
+ nodes.forEach((el, i) => {
63
+ attr(el, attrsTo[i]);
64
+ if (parent(el) === target) {
65
+ css(el, 'display', propsTo[i].opacity === 0 ? 'none' : '');
66
+ }
67
+ });
68
+ attr(target, 'style', targetStyle);
69
+ } catch (e) {
70
+ attr(nodes, 'style', '');
71
+ resetProps(target, targetProps);
72
+ }
72
73
  }
73
74
 
74
75
  function getProps(el, opacity) {
@@ -122,47 +123,40 @@ function getTransitionProps(target, nodes, currentProps) {
122
123
  return [propsTo, propsFrom];
123
124
  }
124
125
 
125
- function reset(el) {
126
- css(el.children, {
127
- height: '',
128
- left: '',
129
- opacity: '',
130
- pointerEvents: '',
131
- position: '',
132
- top: '',
133
- marginTop: '',
134
- marginLeft: '',
135
- transform: '',
136
- width: '',
137
- zIndex: '',
138
- });
139
- css(el, { height: '', display: '', padding: '' });
126
+ function resetProps(el, props) {
127
+ for (const prop in props) {
128
+ css(el, prop, '');
129
+ }
140
130
  }
141
131
 
142
132
  function getPositionWithMargin(el) {
143
133
  const { height, width } = offset(el);
144
- const { top, left } = position(el);
145
- const { marginLeft, marginTop } = css(el, ['marginTop', 'marginLeft']);
146
134
 
147
- return { top, left, height, width, marginLeft, marginTop, transform: '' };
135
+ return {
136
+ height,
137
+ width,
138
+ transform: '',
139
+ ...position(el),
140
+ ...css(el, ['marginTop', 'marginLeft']),
141
+ };
148
142
  }
149
143
 
150
144
  function awaitFrame() {
151
145
  return new Promise((resolve) => requestAnimationFrame(resolve));
152
146
  }
153
147
 
154
- function awaitMutation(target) {
155
- let observer;
156
- const promise = new Promise(
157
- (resolve) =>
158
- (observer = observeMutation(
159
- target,
160
- (records, observer) => {
161
- resolve();
162
- observer.disconnect();
163
- },
164
- { childList: true, attributes: true }
165
- ))
148
+ function awaitMutation() {
149
+ const text = document.createTextNode('');
150
+ const promise = new Promise((resolve) =>
151
+ observeMutation(
152
+ text,
153
+ (_, observer) => {
154
+ resolve();
155
+ observer.disconnect();
156
+ },
157
+ { characterData: true }
158
+ )
166
159
  );
167
- return { promise, observer };
160
+ text.data = 1;
161
+ return promise;
168
162
  }
package/tests/filter.html CHANGED
@@ -26,8 +26,8 @@
26
26
  on(document.body, 'beforeFilter afterFilter', (e, filter, state) =>
27
27
  console.log(e.type, filter, state)
28
28
  );
29
- on('#js-animation-switcher', 'change', () =>
30
- attr($$('.js-filter-animation'), 'animation', this.value)
29
+ on('#js-animation-switcher', 'change', (e) =>
30
+ attr($$('.js-filter-animation'), 'animation', e.target.value)
31
31
  );
32
32
  });
33
33
 
@@ -275,8 +275,8 @@
275
275
 
276
276
  const {$, attr, on } = UIkit.util;
277
277
 
278
- on('#js-animation-switcher', 'change', () =>
279
- attr($('#js-lightbox-animation'), 'animation', this.value)
278
+ on('#js-animation-switcher', 'change', (e) =>
279
+ attr($('#js-lightbox-animation'), 'animation', e.target.value)
280
280
  );
281
281
 
282
282
  on('#js-lightbox', 'click', (e) => {