uikit 3.16.4-dev.8705d5334 → 3.16.4-dev.a8da41c36

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 (52) hide show
  1. package/CHANGELOG.md +2 -1
  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 +3 -6
  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 +26 -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 +1 -1
  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 +44 -61
  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 +71 -66
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/component.js +1 -2
  44. package/src/js/api/hooks.js +2 -6
  45. package/src/js/components/filter.js +2 -6
  46. package/src/js/components/slider.js +33 -0
  47. package/src/js/core/cover.js +16 -28
  48. package/src/js/core/drop.js +2 -1
  49. package/src/js/core/height-match.js +5 -10
  50. package/src/js/core/scrollspy.js +1 -2
  51. package/src/js/util/lang.js +7 -7
  52. package/src/js/util/observer.js +3 -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.16.4-dev.8705d5334",
5
+ "version": "3.16.4-dev.a8da41c36",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -5,8 +5,7 @@ export default function (UIkit) {
5
5
  const { data: DATA, prefix: PREFIX } = UIkit;
6
6
 
7
7
  UIkit.component = function (name, options) {
8
- name = hyphenate(name);
9
- const id = PREFIX + name;
8
+ const id = PREFIX + hyphenate(name);
10
9
 
11
10
  if (!options) {
12
11
  if (isPlainObject(components[id])) {
@@ -106,20 +106,16 @@ export default function (UIkit) {
106
106
  }
107
107
 
108
108
  function runWatches(initial) {
109
- const {
110
- $options: { computed },
111
- } = this;
112
109
  const values = { ...this._computed };
113
110
  this._computed = {};
114
111
 
115
- for (const key in computed) {
116
- const { watch, immediate } = computed[key];
112
+ for (const [key, { watch, immediate }] of Object.entries(this.$options.computed || {})) {
117
113
  if (
118
114
  watch &&
119
115
  ((initial && immediate) ||
120
116
  (hasOwn(values, key) && !isEqual(values[key], this[key])))
121
117
  ) {
122
- watch.call(this, this[key], values[key]);
118
+ watch.call(this, this[key], initial ? undefined : values[key]);
123
119
  }
124
120
  }
125
121
  }
@@ -70,8 +70,8 @@ export default {
70
70
  return $$(`${target} > *`, $el);
71
71
  },
72
72
 
73
- watch(list, old) {
74
- if (old && !isEqualList(list, old)) {
73
+ watch(list, prev) {
74
+ if (prev) {
75
75
  this.updateState();
76
76
  }
77
77
  },
@@ -211,10 +211,6 @@ function matchFilter(
211
211
  : stateSort === sort && stateOrder === order;
212
212
  }
213
213
 
214
- function isEqualList(listA, listB) {
215
- return listA.length === listB.length && listA.every((el) => listB.includes(el));
216
- }
217
-
218
214
  function getSelector({ filter }) {
219
215
  let selector = '';
220
216
  each(filter, (value) => (selector += value || ''));
@@ -15,7 +15,9 @@ import {
15
15
  findIndex,
16
16
  getIndex,
17
17
  includes,
18
+ isVisible,
18
19
  last,
20
+ observeResize,
19
21
  selFocusable,
20
22
  sumBy,
21
23
  toFloat,
@@ -113,6 +115,37 @@ export default {
113
115
  list: this.list,
114
116
  };
115
117
  },
118
+
119
+ children: {
120
+ get() {
121
+ return children(this.list);
122
+ },
123
+
124
+ watch(slides, prev) {
125
+ if (!prev) {
126
+ this.registerObserver(
127
+ (this._resizeObserver = observeResize(slides, () => this.$emit('resize')))
128
+ );
129
+ }
130
+
131
+ if (prev) {
132
+ slides.forEach(
133
+ (slide) => !includes(prev, slide) && this._resizeObserver.observe(slide)
134
+ );
135
+ prev.forEach(
136
+ (slide) => !includes(slides, slide) && this._resizeObserver.unobserve(slide)
137
+ );
138
+
139
+ this.$emit();
140
+ }
141
+ },
142
+
143
+ immediate: true,
144
+ },
145
+
146
+ slides() {
147
+ return this.children.filter(isVisible);
148
+ },
116
149
  },
117
150
 
118
151
  connected() {
@@ -1,8 +1,9 @@
1
1
  import Video from './video';
2
- import { css, Dimensions, observeResize, parent } from 'uikit-util';
2
+ import { css, Dimensions, parent } from 'uikit-util';
3
+ import Resize from '../mixin/resize';
3
4
 
4
5
  export default {
5
- mixins: [Video],
6
+ mixins: [Resize, Video],
6
7
 
7
8
  props: {
8
9
  width: Number,
@@ -19,43 +20,38 @@ export default {
19
20
  },
20
21
  },
21
22
 
22
- connected() {
23
- const parentEl = getPositionedParent(this.$el) || parent(this.$el);
24
- this.registerObserver(
25
- observeResize(parentEl, () => {
26
- this.parentDim = getCoverDimensions(parentEl);
27
- this.$emit('resize');
28
- })
29
- );
23
+ resizeTargets() {
24
+ return [this.$el, getPositionedParent(this.$el) || parent(this.$el)];
30
25
  },
31
26
 
32
27
  update: {
33
28
  read() {
34
29
  const { ratio, cover } = Dimensions;
35
- const { $el, width, height, parentDim } = this;
30
+ const { $el, width, height } = this;
36
31
 
37
32
  let dim = { width, height };
38
33
 
39
- if (!dim.width || !dim.height) {
34
+ if (!width || !height) {
40
35
  const intrinsic = {
41
36
  width: $el.naturalWidth || $el.videoWidth || $el.clientWidth,
42
37
  height: $el.naturalHeight || $el.videoHeight || $el.clientHeight,
43
38
  };
44
39
 
45
- if (dim.width) {
46
- dim = ratio(intrinsic, 'width', dim.width);
40
+ if (width) {
41
+ dim = ratio(intrinsic, 'width', width);
47
42
  } else if (height) {
48
- dim = ratio(intrinsic, 'height', dim.height);
43
+ dim = ratio(intrinsic, 'height', height);
49
44
  } else {
50
45
  dim = intrinsic;
51
46
  }
52
47
  }
53
48
 
54
- if (!parentDim) {
55
- return false;
56
- }
57
-
58
- const coverDim = cover(dim, parentDim);
49
+ const { offsetHeight: coverHeight, offsetWidth: coverWidth } =
50
+ getPositionedParent($el) || parent($el);
51
+ const coverDim = cover(dim, {
52
+ width: coverWidth + (coverWidth % 2 ? 1 : 0),
53
+ height: coverHeight + (coverHeight % 2 ? 1 : 0),
54
+ });
59
55
 
60
56
  if (!coverDim.width || !coverDim.height) {
61
57
  return false;
@@ -72,14 +68,6 @@ export default {
72
68
  },
73
69
  };
74
70
 
75
- function getCoverDimensions(el) {
76
- const { offsetHeight, offsetWidth } = el;
77
- return {
78
- width: offsetWidth + (offsetWidth % 2 ? 1 : 0),
79
- height: offsetHeight + (offsetHeight % 2 ? 1 : 0),
80
- };
81
- }
82
-
83
71
  function getPositionedParent(el) {
84
72
  while ((el = parent(el))) {
85
73
  if (css(el, 'position') !== 'static') {
@@ -20,6 +20,7 @@ import {
20
20
  once,
21
21
  overflowParents,
22
22
  parent,
23
+ pick,
23
24
  pointerCancel,
24
25
  pointerDown,
25
26
  pointerEnter,
@@ -111,7 +112,7 @@ export default {
111
112
  this.targetEl = createToggleComponent(this);
112
113
  }
113
114
 
114
- this._style = (({ width, height }) => ({ width, height }))(this.$el.style);
115
+ this._style = pick(this.$el.style, ['width', 'height']);
115
116
  },
116
117
 
117
118
  disconnected() {
@@ -1,6 +1,6 @@
1
1
  import Resize from '../mixin/resize';
2
2
  import { getRows } from './margin';
3
- import { $$, boxModelAdjust, css, dimensions, isVisible } from 'uikit-util';
3
+ import { $$, boxModelAdjust, css, dimensions, isVisible, pick } from 'uikit-util';
4
4
 
5
5
  export default {
6
6
  mixins: [Resize],
@@ -55,7 +55,6 @@ function match(elements) {
55
55
  return { heights: [''], elements };
56
56
  }
57
57
 
58
- css(elements, 'minHeight', '');
59
58
  let heights = elements.map(getHeight);
60
59
  const max = Math.max(...heights);
61
60
 
@@ -66,17 +65,13 @@ function match(elements) {
66
65
  }
67
66
 
68
67
  function getHeight(element) {
69
- let style = false;
68
+ const style = pick(element.style, ['display', 'minHeight']);
69
+
70
70
  if (!isVisible(element)) {
71
- style = element.style.display;
72
71
  css(element, 'display', 'block', 'important');
73
72
  }
74
-
73
+ css(element, 'minHeight', '');
75
74
  const height = dimensions(element).height - boxModelAdjust(element, 'height', 'content-box');
76
-
77
- if (style !== false) {
78
- css(element, 'display', style);
79
- }
80
-
75
+ css(element, style);
81
76
  return height;
82
77
  }
@@ -4,7 +4,6 @@ import {
4
4
  css,
5
5
  filter,
6
6
  data as getData,
7
- isEqual,
8
7
  observeIntersection,
9
8
  once,
10
9
  removeClass,
@@ -49,7 +48,7 @@ export default {
49
48
  css(filter(elements, `:not(.${this.inViewClass})`), 'opacity', 0);
50
49
  }
51
50
 
52
- if (!isEqual(elements, prev)) {
51
+ if (prev) {
53
52
  this.$reset();
54
53
  }
55
54
  },
@@ -10,15 +10,11 @@ export const hyphenate = memoize((str) => str.replace(hyphenateRe, '-$1').toLowe
10
10
 
11
11
  const camelizeRe = /-(\w)/g;
12
12
 
13
- export const camelize = memoize((str) => str.replace(camelizeRe, toUpper));
14
-
15
- export const ucfirst = memoize((str) =>
16
- str.length ? toUpper(null, str.charAt(0)) + str.slice(1) : ''
13
+ export const camelize = memoize((str) =>
14
+ (str.charAt(0).toLowerCase() + str.slice(1)).replace(camelizeRe, (_, c) => c.toUpperCase())
17
15
  );
18
16
 
19
- function toUpper(_, c) {
20
- return c ? c.toUpperCase() : '';
21
- }
17
+ export const ucfirst = memoize((str) => str.charAt(0).toUpperCase() + str.slice(1));
22
18
 
23
19
  export function startsWith(str, search) {
24
20
  return str?.startsWith?.(search);
@@ -180,6 +176,10 @@ export function uniqueBy(array, prop) {
180
176
  return array.filter(({ [prop]: check }) => (seen.has(check) ? false : seen.add(check)));
181
177
  }
182
178
 
179
+ export function pick(obj, props) {
180
+ return props.reduce((res, prop) => ({ ...res, [prop]: obj[prop] }), {});
181
+ }
182
+
183
183
  export function clamp(number, min = 0, max = 1) {
184
184
  return Math.min(Math.max(toNumber(number) || 0, min), max);
185
185
  }
@@ -1,5 +1,5 @@
1
1
  import { on } from './event';
2
- import { toNodes } from './lang';
2
+ import { noop, toNodes } from './lang';
3
3
  import { inBrowser } from './env';
4
4
 
5
5
  export function observeIntersection(targets, cb, options, intersecting = true) {
@@ -31,6 +31,8 @@ export function observeResize(targets, cb, options = { box: 'border-box' }) {
31
31
  listeners.add(cb);
32
32
 
33
33
  return {
34
+ observe: noop,
35
+ unobserve: noop,
34
36
  disconnect() {
35
37
  listeners.delete(cb);
36
38
  },