uikit 3.13.7-dev.120e5ee9c → 3.13.8-dev.128538499

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 (74) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/css/uikit-core-rtl.css +34 -5
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +34 -5
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +34 -3
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +34 -3
  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 +1 -1
  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 +13 -10
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +13 -10
  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 +13 -10
  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 +59 -29
  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 +211 -195
  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 +248 -199
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +5 -5
  43. package/src/js/api/hooks.js +1 -1
  44. package/src/js/components/tooltip.js +38 -3
  45. package/src/js/core/accordion.js +1 -1
  46. package/src/js/core/drop.js +10 -6
  47. package/src/js/core/height-match.js +7 -15
  48. package/src/js/core/navbar.js +1 -1
  49. package/src/js/core/scrollspy.js +39 -17
  50. package/src/js/core/sticky.js +2 -2
  51. package/src/js/mixin/media.js +12 -9
  52. package/src/js/mixin/position.js +22 -24
  53. package/src/js/util/position.js +128 -129
  54. package/src/less/components/dropdown.less +11 -1
  55. package/src/less/components/nav.less +22 -0
  56. package/src/less/components/navbar.less +22 -2
  57. package/src/less/theme/dropdown.less +2 -0
  58. package/src/less/theme/nav.less +4 -0
  59. package/src/less/theme/navbar.less +2 -0
  60. package/src/scss/components/dropdown.scss +11 -1
  61. package/src/scss/components/nav.scss +22 -0
  62. package/src/scss/components/navbar.scss +22 -2
  63. package/src/scss/mixins-theme.scss +4 -0
  64. package/src/scss/mixins.scss +4 -0
  65. package/src/scss/theme/dropdown.scss +2 -0
  66. package/src/scss/theme/nav.scss +4 -0
  67. package/src/scss/theme/navbar.scss +2 -0
  68. package/src/scss/variables-theme.scss +5 -1
  69. package/src/scss/variables.scss +5 -1
  70. package/tests/drop.html +0 -6
  71. package/tests/dropdown.html +18 -10
  72. package/tests/nav.html +27 -0
  73. package/tests/navbar.html +18 -4
  74. package/tests/position.html +38 -39
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.13.7-dev.120e5ee9c",
5
+ "version": "3.13.8-dev.128538499",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -41,9 +41,9 @@
41
41
  "@rollup/plugin-replace": "^4.0.0",
42
42
  "archiver": "^5.3.0",
43
43
  "camelcase": "^6.3.0",
44
- "clean-css": "^5.2.4",
44
+ "clean-css": "^5.3.0",
45
45
  "dateformat": "^5.0.3",
46
- "esbuild": "^0.14.28",
46
+ "esbuild": "^0.14.32",
47
47
  "eslint": "^8.12.0",
48
48
  "eslint-config-prettier": "^8.5.0",
49
49
  "fs-extra": "^10.0.1",
@@ -53,9 +53,9 @@
53
53
  "minimist": "^1.2.6",
54
54
  "number-precision": "^1.5.2",
55
55
  "p-limit": "^4.0.0",
56
- "prettier": "^2.6.1",
56
+ "prettier": "^2.6.2",
57
57
  "rollup": "^2.70.1",
58
- "rollup-plugin-esbuild": "^4.8.2",
58
+ "rollup-plugin-esbuild": "^4.9.1",
59
59
  "rollup-plugin-html": "^0.2.1",
60
60
  "rollup-plugin-modify": "^3.0.0",
61
61
  "rtlcss": "^3.5.0",
@@ -105,7 +105,7 @@ export default function (UIkit) {
105
105
  const {
106
106
  $options: { computed },
107
107
  } = this;
108
- const values = { ...this._computed };
108
+ const values = { ...(initial ? {} : this._computed) };
109
109
  this._computed = {};
110
110
 
111
111
  for (const key in computed) {
@@ -6,9 +6,11 @@ import {
6
6
  attr,
7
7
  flipPosition,
8
8
  hasAttr,
9
+ includes,
9
10
  isFocusable,
10
11
  isTouch,
11
12
  matches,
13
+ offset,
12
14
  on,
13
15
  once,
14
16
  pointerDown,
@@ -104,10 +106,12 @@ export default {
104
106
 
105
107
  this.positionAt(this.tooltip, this.$el);
106
108
 
109
+ const [dir, align] = getAlignment(this.tooltip, this.$el, this.pos);
110
+
107
111
  this.origin =
108
- this.getAxis() === 'y'
109
- ? `${flipPosition(this.dir)}-${this.align}`
110
- : `${this.align}-${flipPosition(this.dir)}`;
112
+ this.axis === 'y'
113
+ ? `${flipPosition(dir)}-${align}`
114
+ : `${align}-${flipPosition(dir)}`;
111
115
  });
112
116
 
113
117
  this.toggleElement(this.tooltip, true);
@@ -143,3 +147,34 @@ function makeFocusable(el) {
143
147
  attr(el, 'tabindex', '0');
144
148
  }
145
149
  }
150
+
151
+ function getAlignment(el, target, [dir, align]) {
152
+ const elOffset = offset(el);
153
+ const targetOffset = offset(target);
154
+ const properties = [
155
+ ['left', 'right'],
156
+ ['top', 'bottom'],
157
+ ];
158
+
159
+ for (const props of properties) {
160
+ if (elOffset[props[0]] >= targetOffset[props[1]]) {
161
+ dir = props[1];
162
+ break;
163
+ }
164
+ if (elOffset[props[1]] <= targetOffset[props[0]]) {
165
+ dir = props[0];
166
+ break;
167
+ }
168
+ }
169
+
170
+ const props = includes(properties[0], dir) ? properties[1] : properties[0];
171
+ if (elOffset[props[0]] === targetOffset[props[0]]) {
172
+ align = props[0];
173
+ } else if (elOffset[props[1]] === targetOffset[props[1]]) {
174
+ align = props[1];
175
+ } else {
176
+ align = 'center';
177
+ }
178
+
179
+ return [dir, align];
180
+ }
@@ -48,7 +48,7 @@ export default {
48
48
  computed: {
49
49
  items: {
50
50
  get({ targets }, $el) {
51
- return $$(targets, $el);
51
+ return $$(targets, $el).filter((el) => $(this.content, el));
52
52
  },
53
53
 
54
54
  watch(items, prev) {
@@ -62,8 +62,11 @@ export default {
62
62
  this.tracker = new MouseTracker();
63
63
  },
64
64
 
65
- connected() {
65
+ beforeConnect() {
66
66
  this.clsDrop = this.$props.clsDrop || `uk-${this.$options.name}`;
67
+ },
68
+
69
+ connected() {
67
70
  addClass(this.$el, this.clsDrop);
68
71
 
69
72
  if (this.toggle && !this.target) {
@@ -359,17 +362,18 @@ export default {
359
362
  const boundaryOffset = offset(boundary);
360
363
  const targetOffset = offset(this.target);
361
364
  const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
365
+ const prop = this.axis === 'y' ? 'width' : 'height';
366
+
367
+ css(this.$el, `max-${prop}`, '');
362
368
 
363
369
  if (this.pos[1] === 'justify') {
364
- const prop = this.getAxis() === 'y' ? 'width' : 'height';
365
370
  css(this.$el, prop, alignTo[prop]);
366
- } else if (
367
- this.$el.offsetWidth >
368
- Math.max(boundaryOffset.right - alignTo.left, alignTo.right - boundaryOffset.left)
369
- ) {
371
+ } else if (this.$el.offsetWidth > boundaryOffset.width) {
370
372
  addClass(this.$el, `${this.clsDrop}-stack`);
371
373
  }
372
374
 
375
+ css(this.$el, `max-${prop}`, boundaryOffset[prop]);
376
+
373
377
  this.positionAt(this.$el, this.boundaryAlign ? boundary : this.target, boundary);
374
378
  },
375
379
  },
@@ -1,6 +1,6 @@
1
1
  import Resize from '../mixin/resize';
2
2
  import { getRows } from './margin';
3
- import { $$, boxModelAdjust, css, dimensions, isVisible, toFloat } from 'uikit-util';
3
+ import { $$, boxModelAdjust, css, dimensions, isVisible } from 'uikit-util';
4
4
 
5
5
  export default {
6
6
  mixins: [Resize],
@@ -56,22 +56,14 @@ function match(elements) {
56
56
  return { heights: [''], elements };
57
57
  }
58
58
 
59
+ css(elements, 'minHeight', '');
59
60
  let heights = elements.map(getHeight);
60
- let max = Math.max(...heights);
61
- const hasMinHeight = elements.some((el) => el.style.minHeight);
62
- const hasShrunk = elements.some((el, i) => !el.style.minHeight && heights[i] < max);
63
-
64
- if (hasMinHeight && hasShrunk) {
65
- css(elements, 'minHeight', '');
66
- heights = elements.map(getHeight);
67
- max = Math.max(...heights);
68
- }
69
-
70
- heights = elements.map((el, i) =>
71
- heights[i] === max && toFloat(el.style.minHeight).toFixed(2) !== max.toFixed(2) ? '' : max
72
- );
61
+ const max = Math.max(...heights);
73
62
 
74
- return { heights, elements };
63
+ return {
64
+ heights: elements.map((el, i) => (heights[i].toFixed(2) === max.toFixed(2) ? '' : max)),
65
+ elements,
66
+ };
75
67
  }
76
68
 
77
69
  function getHeight(element) {
@@ -299,7 +299,7 @@ export default {
299
299
  return this.dropbar;
300
300
  },
301
301
 
302
- handler(_, { $el, dir }) {
302
+ handler(_, { $el, pos: [dir] = [] }) {
303
303
  if (!hasClass($el, this.clsDrop)) {
304
304
  return;
305
305
  }
@@ -4,11 +4,12 @@ import {
4
4
  css,
5
5
  filter,
6
6
  data as getData,
7
- isInView,
7
+ observeIntersection,
8
8
  once,
9
9
  removeClass,
10
10
  removeClasses,
11
11
  toggleClass,
12
+ toPx,
12
13
  trigger,
13
14
  } from 'uikit-util';
14
15
 
@@ -45,16 +46,49 @@ export default {
45
46
  return target ? $$(target, $el) : [$el];
46
47
  },
47
48
 
48
- watch(elements) {
49
+ watch(elements, prev) {
49
50
  if (this.hidden) {
50
51
  css(filter(elements, `:not(.${this.inViewClass})`), 'visibility', 'hidden');
51
52
  }
53
+
54
+ if (prev) {
55
+ this.$reset();
56
+ }
52
57
  },
53
58
 
54
59
  immediate: true,
55
60
  },
56
61
  },
57
62
 
63
+ connected() {
64
+ this.registerObserver(
65
+ observeIntersection(
66
+ this.elements,
67
+ (records) => {
68
+ for (const { target: el, isIntersecting } of records) {
69
+ if (!el[stateKey]) {
70
+ el[stateKey] = { cls: getData(el, 'uk-scrollspy-class') || this.cls };
71
+ }
72
+
73
+ if (!this.repeat && el[stateKey].show) {
74
+ continue;
75
+ }
76
+
77
+ el[stateKey].show = isIntersecting;
78
+ }
79
+
80
+ this.$emit();
81
+ },
82
+ {
83
+ rootMargin: `${toPx(this.offsetTop, 'height') - 1}px ${
84
+ toPx(this.offsetLeft, 'width') - 1
85
+ }px`,
86
+ },
87
+ false
88
+ )
89
+ );
90
+ },
91
+
58
92
  disconnected() {
59
93
  for (const el of this.elements) {
60
94
  removeClass(el, this.inViewClass, el[stateKey]?.cls || '');
@@ -64,24 +98,14 @@ export default {
64
98
 
65
99
  update: [
66
100
  {
67
- read() {
101
+ write(data) {
68
102
  for (const el of this.elements) {
69
- if (!el[stateKey]) {
70
- el[stateKey] = { cls: getData(el, 'uk-scrollspy-class') || this.cls };
71
- }
103
+ const state = el[stateKey];
72
104
 
73
- if (!this.repeat && el[stateKey].show) {
105
+ if (!state) {
74
106
  continue;
75
107
  }
76
108
 
77
- el[stateKey].show = isInView(el, this.offsetTop, this.offsetLeft);
78
- }
79
- },
80
-
81
- write(data) {
82
- for (const el of this.elements) {
83
- const state = el[stateKey];
84
-
85
109
  if (state.show && !state.inview && !state.queued) {
86
110
  state.queued = true;
87
111
 
@@ -99,8 +123,6 @@ export default {
99
123
  }
100
124
  }
101
125
  },
102
-
103
- events: ['scroll', 'resize'],
104
126
  },
105
127
  ],
106
128
 
@@ -137,13 +137,13 @@ export default {
137
137
  return false;
138
138
  }
139
139
 
140
- const hide = this.isActive && types.has('resize');
140
+ const hide = this.active && types.has('resize');
141
141
  if (hide) {
142
142
  css(this.selTarget, 'transition', '0s');
143
143
  this.hide();
144
144
  }
145
145
 
146
- if (!this.isActive) {
146
+ if (!this.active) {
147
147
  height = getOffset(this.$el).height;
148
148
  margin = css(this.$el, 'margin');
149
149
  }
@@ -20,16 +20,19 @@ export default {
20
20
 
21
21
  connected() {
22
22
  const media = toMedia(this.media);
23
- this.mediaObj = window.matchMedia(media);
24
- const handler = () => {
25
- this.matchMedia = this.mediaObj.matches;
26
- trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
27
- };
28
- this.offMediaObj = on(this.mediaObj, 'change', () => {
23
+ this.matchMedia = true;
24
+ if (media) {
25
+ this.mediaObj = window.matchMedia(media);
26
+ const handler = () => {
27
+ this.matchMedia = this.mediaObj.matches;
28
+ trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
29
+ };
30
+ this.offMediaObj = on(this.mediaObj, 'change', () => {
31
+ handler();
32
+ this.$emit('resize');
33
+ });
29
34
  handler();
30
- this.$emit('resize');
31
- });
32
- handler();
35
+ }
33
36
  },
34
37
 
35
38
  disconnected() {
@@ -3,6 +3,7 @@ import {
3
3
  flipPosition,
4
4
  getCssVar,
5
5
  offset as getOffset,
6
+ includes,
6
7
  isNumeric,
7
8
  isRtl,
8
9
  positionAt,
@@ -24,45 +25,42 @@ export default {
24
25
 
25
26
  connected() {
26
27
  this.pos = this.$props.pos.split('-').concat('center').slice(0, 2);
27
- this.dir = this.pos[0];
28
- this.align = this.pos[1];
28
+ this.axis = includes(['top', 'bottom'], this.pos[0]) ? 'y' : 'x';
29
29
  },
30
30
 
31
31
  methods: {
32
32
  positionAt(element, target, boundary) {
33
- const axis = this.getAxis();
34
- const dir = this.pos[0];
35
- const align = this.pos[1];
33
+ const [dir, align] = this.pos;
36
34
 
37
35
  let { offset } = this;
38
36
  if (!isNumeric(offset)) {
39
37
  const node = $(offset);
40
38
  offset = node
41
- ? getOffset(node)[axis === 'x' ? 'left' : 'top'] -
42
- getOffset(target)[axis === 'x' ? 'right' : 'bottom']
39
+ ? getOffset(node)[this.axis === 'x' ? 'left' : 'top'] -
40
+ getOffset(target)[this.axis === 'x' ? 'right' : 'bottom']
43
41
  : 0;
44
42
  }
45
43
  offset = toPx(offset) + toPx(getCssVar('position-offset', element));
44
+ offset = [includes(['left', 'top'], dir) ? -offset : +offset, 0];
46
45
 
47
- const { x, y } = positionAt(
48
- element,
49
- target,
50
- axis === 'x' ? `${flipPosition(dir)} ${align}` : `${align} ${flipPosition(dir)}`,
51
- axis === 'x' ? `${dir} ${align}` : `${align} ${dir}`,
52
- axis === 'x'
53
- ? `${dir === 'left' ? -offset : offset}`
54
- : ` ${dir === 'top' ? -offset : offset}`,
55
- null,
56
- this.flip,
57
- boundary
58
- ).target;
46
+ const attach = {
47
+ element: [flipPosition(dir), align],
48
+ target: [dir, align],
49
+ };
59
50
 
60
- this.dir = axis === 'x' ? x : y;
61
- this.align = axis === 'x' ? y : x;
62
- },
51
+ if (this.axis === 'y') {
52
+ for (const prop in attach) {
53
+ attach[prop] = attach[prop].reverse();
54
+ }
55
+ offset = offset.reverse();
56
+ }
63
57
 
64
- getAxis() {
65
- return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
58
+ positionAt(element, target, {
59
+ attach,
60
+ offset,
61
+ boundary,
62
+ flip: this.flip,
63
+ });
66
64
  },
67
65
  },
68
66
  };