uikit 3.13.1-dev.dedbd3fce → 3.13.2-dev.696f00752

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 (75) hide show
  1. package/.eslintrc.json +9 -0
  2. package/CHANGELOG.md +22 -0
  3. package/dist/css/uikit-core-rtl.css +31 -71
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +31 -71
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +31 -71
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +31 -71
  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 +1 -1
  14. package/dist/js/components/filter.min.js +1 -1
  15. package/dist/js/components/lightbox-panel.js +1 -1
  16. package/dist/js/components/lightbox-panel.min.js +1 -1
  17. package/dist/js/components/lightbox.js +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  30. package/dist/js/components/slideshow.min.js +1 -1
  31. package/dist/js/components/sortable.js +1 -1
  32. package/dist/js/components/sortable.min.js +1 -1
  33. package/dist/js/components/tooltip.js +60 -31
  34. package/dist/js/components/tooltip.min.js +1 -1
  35. package/dist/js/components/upload.js +1 -1
  36. package/dist/js/components/upload.min.js +1 -1
  37. package/dist/js/uikit-core.js +218 -208
  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 +220 -211
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +10 -10
  44. package/src/js/components/tooltip.js +2 -3
  45. package/src/js/core/cover.js +1 -1
  46. package/src/js/core/drop.js +7 -10
  47. package/src/js/core/navbar.js +12 -13
  48. package/src/js/core/responsive.js +1 -1
  49. package/src/js/core/sticky.js +1 -1
  50. package/src/js/core/switcher.js +7 -13
  51. package/src/js/mixin/media.js +4 -4
  52. package/src/js/mixin/position.js +53 -24
  53. package/src/js/util/dimensions.js +2 -2
  54. package/src/js/util/position.js +125 -129
  55. package/src/js/util/style.js +13 -19
  56. package/src/less/components/drop.less +3 -11
  57. package/src/less/components/dropdown.less +3 -11
  58. package/src/less/components/navbar.less +13 -23
  59. package/src/less/components/offcanvas.less +19 -1
  60. package/src/less/components/tooltip.less +2 -11
  61. package/src/less/theme/navbar.less +1 -3
  62. package/src/scss/components/drop.scss +3 -11
  63. package/src/scss/components/dropdown.scss +3 -11
  64. package/src/scss/components/navbar.scss +13 -23
  65. package/src/scss/components/offcanvas.scss +19 -1
  66. package/src/scss/components/tooltip.scss +2 -11
  67. package/src/scss/mixins-theme.scss +1 -2
  68. package/src/scss/mixins.scss +0 -1
  69. package/src/scss/theme/navbar.scss +0 -2
  70. package/src/scss/variables-theme.scss +7 -5
  71. package/src/scss/variables.scss +7 -5
  72. package/tests/drop.html +1 -1
  73. package/tests/navbar.html +2 -8
  74. package/tests/position.html +38 -39
  75. package/tests/search.html +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.13.1-dev.dedbd3fce",
5
+ "version": "3.13.2-dev.696f00752",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -34,27 +34,27 @@
34
34
  },
35
35
  "homepage": "https://getuikit.com",
36
36
  "devDependencies": {
37
- "@babel/core": "^7.16.0",
37
+ "@babel/core": "^7.17.8",
38
38
  "@babel/preset-env": "^7.16.4",
39
39
  "@rollup/plugin-alias": "^3.1.9",
40
- "@rollup/plugin-babel": "^5.3.0",
40
+ "@rollup/plugin-babel": "^5.3.1",
41
41
  "@rollup/plugin-replace": "^3.0.1",
42
42
  "archiver": "^5.3.0",
43
43
  "camelcase": "^6.3.0",
44
44
  "clean-css": "^5.2.4",
45
45
  "dateformat": "^5.0.3",
46
- "esbuild": "^0.14.23",
47
- "eslint": "^8.9.0",
48
- "eslint-config-prettier": "^8.3.0",
49
- "fs-extra": "^10.0.0",
46
+ "esbuild": "^0.14.27",
47
+ "eslint": "^8.11.0",
48
+ "eslint-config-prettier": "^8.5.0",
49
+ "fs-extra": "^10.0.1",
50
50
  "glob": "^7.2.0",
51
- "inquirer": "^8.2.0",
51
+ "inquirer": "^8.2.1",
52
52
  "less": "^4.1.2",
53
53
  "minimist": "^1.2.5",
54
54
  "number-precision": "^1.5.2",
55
55
  "p-limit": "^4.0.0",
56
- "prettier": "^2.5.1",
57
- "rollup": "^2.68.0",
56
+ "prettier": "^2.6.0",
57
+ "rollup": "^2.70.1",
58
58
  "rollup-plugin-esbuild": "^4.8.2",
59
59
  "rollup-plugin-html": "^0.2.1",
60
60
  "rollup-plugin-modify": "^3.0.0",
@@ -35,7 +35,6 @@ export default {
35
35
  animation: ['uk-animation-scale-up'],
36
36
  duration: 100,
37
37
  cls: 'uk-active',
38
- clsPos: 'uk-tooltip',
39
38
  },
40
39
 
41
40
  beforeConnect() {
@@ -91,8 +90,8 @@ export default {
91
90
  _show() {
92
91
  this.tooltip = append(
93
92
  this.container,
94
- `<div class="${this.clsPos}">
95
- <div class="${this.clsPos}-inner">${this.title}</div>
93
+ `<div class="uk-${this.$options.name}">
94
+ <div class="uk-${this.$options.name}-inner">${this.title}</div>
96
95
  </div>`
97
96
  );
98
97
 
@@ -15,7 +15,7 @@ export default {
15
15
  },
16
16
 
17
17
  events: {
18
- load() {
18
+ 'load loadedmetadata'() {
19
19
  this.$emit('resize');
20
20
  },
21
21
  },
@@ -63,7 +63,7 @@ export default {
63
63
  },
64
64
 
65
65
  connected() {
66
- this.clsPos = this.clsDrop = this.$props.clsDrop || `uk-${this.$options.name}`;
66
+ this.clsDrop = this.$props.clsDrop || `uk-${this.$options.name}`;
67
67
  addClass(this.$el, this.clsDrop);
68
68
 
69
69
  if (this.toggle && !this.target) {
@@ -129,7 +129,7 @@ export default {
129
129
  if (this.isToggled()) {
130
130
  this.hide(false);
131
131
  } else {
132
- this.show(toggle.$el, false);
132
+ this.show(toggle?.$el, false);
133
133
  }
134
134
  },
135
135
  },
@@ -141,7 +141,7 @@ export default {
141
141
 
142
142
  handler(e, toggle) {
143
143
  e.preventDefault();
144
- this.show(toggle.$el);
144
+ this.show(toggle?.$el);
145
145
  },
146
146
  },
147
147
 
@@ -352,23 +352,20 @@ export default {
352
352
  },
353
353
 
354
354
  position() {
355
- const boundary = this.boundary === true ? window : query(this.boundary, this.$el);
355
+ const boundary = query(this.boundary, this.$el) || window;
356
356
  removeClass(this.$el, `${this.clsDrop}-stack`);
357
357
  toggleClass(this.$el, `${this.clsDrop}-boundary`, this.boundaryAlign);
358
358
 
359
359
  const boundaryOffset = offset(boundary);
360
- const alignTo = this.boundaryAlign ? boundaryOffset : offset(this.target);
360
+ const targetOffset = offset(this.target);
361
+ const alignTo = this.boundaryAlign ? boundaryOffset : targetOffset;
361
362
 
362
363
  if (this.align === 'justify') {
363
364
  const prop = this.getAxis() === 'y' ? 'width' : 'height';
364
365
  css(this.$el, prop, alignTo[prop]);
365
366
  } else if (
366
- boundary &&
367
367
  this.$el.offsetWidth >
368
- Math.max(
369
- boundaryOffset.right - alignTo.left,
370
- alignTo.right - boundaryOffset.left
371
- )
368
+ Math.max(boundaryOffset.right - alignTo.left, alignTo.right - boundaryOffset.left)
372
369
  ) {
373
370
  addClass(this.$el, `${this.clsDrop}-stack`);
374
371
  }
@@ -16,6 +16,7 @@ import {
16
16
  isVisible,
17
17
  matches,
18
18
  noop,
19
+ offset,
19
20
  once,
20
21
  parent,
21
22
  query,
@@ -42,7 +43,6 @@ export default {
42
43
  delayShow: Number,
43
44
  delayHide: Number,
44
45
  dropbar: Boolean,
45
- dropbarMode: String,
46
46
  dropbarAnchor: Boolean,
47
47
  duration: Number,
48
48
  },
@@ -59,7 +59,6 @@ export default {
59
59
  flip: 'x',
60
60
  boundary: true,
61
61
  dropbar: false,
62
- dropbarMode: 'slide',
63
62
  dropbarAnchor: false,
64
63
  duration: 200,
65
64
  forceHeight: true,
@@ -68,8 +67,8 @@ export default {
68
67
  },
69
68
 
70
69
  computed: {
71
- boundary({ boundary, boundaryAlign }, $el) {
72
- return boundary === true || boundaryAlign ? $el : boundary;
70
+ boundary({ boundary }, $el) {
71
+ return boundary === true ? $el : boundary;
73
72
  },
74
73
 
75
74
  dropbarAnchor({ dropbarAnchor }, $el) {
@@ -276,10 +275,16 @@ export default {
276
275
  return this.dropbar;
277
276
  },
278
277
 
279
- handler() {
278
+ handler(_, { $el }) {
279
+ if (!hasClass($el, this.clsDrop)) {
280
+ return;
281
+ }
282
+
280
283
  if (!parent(this.dropbar)) {
281
284
  after(this.dropbarAnchor || this.$el, this.dropbar);
282
285
  }
286
+
287
+ addClass($el, `${this.clsDrop}-dropbar`);
283
288
  },
284
289
  },
285
290
 
@@ -299,16 +304,10 @@ export default {
299
304
  return;
300
305
  }
301
306
 
302
- if (this.dropbarMode === 'slide') {
303
- addClass(this.dropbar, 'uk-navbar-dropbar-slide');
304
- }
305
-
306
- this.clsDrop && addClass($el, `${this.clsDrop}-dropbar`);
307
-
308
307
  if (dir === 'bottom') {
309
308
  this.transitionTo(
310
- $el.offsetHeight +
311
- toFloat(css($el, 'marginTop')) +
309
+ offset($el).bottom -
310
+ offset(this.dropbar).top +
312
311
  toFloat(css($el, 'marginBottom')),
313
312
  $el
314
313
  );
@@ -2,7 +2,7 @@ import Resize from '../mixin/resize';
2
2
  import { addClass, Dimensions, height, isVisible, parent, width } from 'uikit-util';
3
3
 
4
4
  export default {
5
- mixin: [Resize],
5
+ mixins: [Resize],
6
6
 
7
7
  props: ['width', 'height'],
8
8
 
@@ -14,6 +14,7 @@ import {
14
14
  height as getHeight,
15
15
  offset as getOffset,
16
16
  getScrollingElement,
17
+ intersectRect,
17
18
  isString,
18
19
  isVisible,
19
20
  noop,
@@ -29,7 +30,6 @@ import {
29
30
  toPx,
30
31
  trigger,
31
32
  within,
32
- intersectRect,
33
33
  } from 'uikit-util';
34
34
 
35
35
  export default {
@@ -148,27 +148,21 @@ export default {
148
148
 
149
149
  show(item) {
150
150
  const prev = this.index();
151
- const next = getIndex(
152
- this.children[getIndex(item, this.toggles, prev)],
153
- children(this.$el)
154
- );
155
-
156
- if (prev === next) {
157
- return;
158
- }
159
-
151
+ const next = getIndex(item, this.toggles, prev);
152
+ const active = getIndex(this.children[next], children(this.$el));
160
153
  children(this.$el).forEach((child, i) => {
161
- toggleClass(child, this.cls, next === i);
162
- attr(this.toggles[i], 'aria-expanded', next === i);
154
+ toggleClass(child, this.cls, active === i);
155
+ attr(this.toggles[i], 'aria-expanded', active === i);
163
156
  });
164
157
 
158
+ const animate = prev >= 0 && prev !== next;
165
159
  this.connects.forEach(async ({ children }) => {
166
160
  await this.toggleElement(
167
161
  toNodes(children).filter((child) => hasClass(child, this.cls)),
168
162
  false,
169
- prev >= 0
163
+ animate
170
164
  );
171
- await this.toggleElement(children[next], true, prev >= 0);
165
+ await this.toggleElement(children[active], true, animate);
172
166
  });
173
167
  },
174
168
  },
@@ -1,12 +1,12 @@
1
1
  import {
2
+ createEvent,
2
3
  getCssVar,
4
+ isNumeric,
3
5
  isString,
4
6
  on,
5
- trigger,
6
- toFloat,
7
7
  startsWith,
8
- isNumeric,
9
- createEvent,
8
+ toFloat,
9
+ trigger,
10
10
  } from 'uikit-util';
11
11
 
12
12
  export default {
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  $,
3
3
  flipPosition,
4
+ getCssVar,
4
5
  offset as getOffset,
6
+ includes,
5
7
  isNumeric,
6
8
  isRtl,
7
9
  positionAt,
8
- removeClasses,
9
- toggleClass,
10
+ toPx,
10
11
  } from 'uikit-util';
11
12
 
12
13
  export default {
@@ -14,14 +15,12 @@ export default {
14
15
  pos: String,
15
16
  offset: null,
16
17
  flip: Boolean,
17
- clsPos: String,
18
18
  },
19
19
 
20
20
  data: {
21
21
  pos: `bottom-${isRtl ? 'right' : 'left'}`,
22
22
  flip: true,
23
23
  offset: false,
24
- clsPos: '',
25
24
  },
26
25
 
27
26
  connected() {
@@ -32,13 +31,11 @@ export default {
32
31
 
33
32
  methods: {
34
33
  positionAt(element, target, boundary) {
35
- removeClasses(element, `${this.clsPos}-(top|bottom|left|right)(-[a-z]+)?`);
36
-
37
- let { offset } = this;
38
34
  const axis = this.getAxis();
39
35
  const dir = this.pos[0];
40
36
  const align = this.pos[1];
41
37
 
38
+ let { offset } = this;
42
39
  if (!isNumeric(offset)) {
43
40
  const node = $(offset);
44
41
  offset = node
@@ -46,28 +43,60 @@ export default {
46
43
  getOffset(target)[axis === 'x' ? 'right' : 'bottom']
47
44
  : 0;
48
45
  }
46
+ offset += toPx(getCssVar('position-margin-offset', element));
49
47
 
50
- const { x, y } = positionAt(
51
- element,
52
- target,
53
- axis === 'x' ? `${flipPosition(dir)} ${align}` : `${align} ${flipPosition(dir)}`,
54
- axis === 'x' ? `${dir} ${align}` : `${align} ${dir}`,
55
- axis === 'x'
56
- ? `${dir === 'left' ? -offset : offset}`
57
- : ` ${dir === 'top' ? -offset : offset}`,
58
- null,
59
- this.flip,
60
- boundary
61
- ).target;
62
-
63
- this.dir = axis === 'x' ? x : y;
64
- this.align = axis === 'x' ? y : x;
48
+ positionAt(element, target, {
49
+ boundary,
50
+ flip: this.flip,
51
+ attach: {
52
+ element: axis === 'x' ? [flipPosition(dir), align] : [align, flipPosition(dir)],
53
+ target: axis === 'x' ? [dir, align] : [align, dir],
54
+ },
55
+ offset:
56
+ axis === 'x'
57
+ ? [dir === 'left' ? -offset : +offset, 0]
58
+ : [0, dir === 'top' ? -offset : +offset],
59
+ });
65
60
 
66
- toggleClass(element, `${this.clsPos}-${this.dir}-${this.align}`, this.offset === false);
61
+ [this.dir, this.align] = getAlignment(element, target);
62
+ console.log(this.dir, this.align);
67
63
  },
68
64
 
69
65
  getAxis() {
70
- return this.dir === 'top' || this.dir === 'bottom' ? 'y' : 'x';
66
+ return includes(['top', 'bottom'], this.dir) ? 'y' : 'x';
71
67
  },
72
68
  },
73
69
  };
70
+
71
+ function getAlignment(el, target) {
72
+ const elOffset = getOffset(el);
73
+ const targetOffset = getOffset(target);
74
+ const properties = [
75
+ ['left', 'right'],
76
+ ['top', 'bottom'],
77
+ ];
78
+
79
+ let dir;
80
+ for (const props of properties) {
81
+ if (elOffset[props[0]] > targetOffset[props[1]]) {
82
+ dir = props[1];
83
+ break;
84
+ }
85
+ if (elOffset[props[1]] < targetOffset[props[0]]) {
86
+ dir = props[0];
87
+ break;
88
+ }
89
+ }
90
+
91
+ let align;
92
+ const props = includes(properties[0], dir) ? properties[1] : properties[0];
93
+ if (elOffset[props[0]] === targetOffset[props[0]]) {
94
+ align = props[0];
95
+ } else if (elOffset[props[1]] === targetOffset[props[1]]) {
96
+ align = props[1];
97
+ } else {
98
+ align = 'center';
99
+ }
100
+
101
+ return [dir, align];
102
+ }
@@ -41,8 +41,8 @@ export function offset(element, coordinates) {
41
41
  const offsetBy = { height: scrollY, width: scrollX };
42
42
 
43
43
  for (const dir in dirs) {
44
- for (const i in dirs[dir]) {
45
- currentOffset[dirs[dir][i]] += offsetBy[dir];
44
+ for (const prop of dirs[dir]) {
45
+ currentOffset[prop] += offsetBy[dir];
46
46
  }
47
47
  }
48
48
  }