uikit 3.12.3-dev.cbf065cc2 → 3.13.1-dev.4a671f35d

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 (70) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/dist/css/uikit-core-rtl.css +7 -4
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +7 -4
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +7 -4
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +7 -4
  9. package/dist/css/uikit.min.css +1 -1
  10. package/dist/js/components/countdown.js +2 -2
  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 +5 -7
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +5 -7
  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 +10 -16
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +6 -10
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +5 -7
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +6 -10
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +5 -7
  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 +137 -193
  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 +139 -195
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/components/countdown.js +1 -1
  44. package/src/js/core/accordion.js +6 -3
  45. package/src/js/core/drop.js +10 -23
  46. package/src/js/core/form-custom.js +2 -2
  47. package/src/js/core/grid.js +1 -1
  48. package/src/js/core/height-match.js +11 -21
  49. package/src/js/core/height-viewport.js +3 -5
  50. package/src/js/core/icon.js +9 -16
  51. package/src/js/core/img.js +4 -14
  52. package/src/js/core/index.js +0 -1
  53. package/src/js/core/margin.js +8 -10
  54. package/src/js/core/overflow-auto.js +3 -7
  55. package/src/js/core/responsive.js +7 -0
  56. package/src/js/core/scrollspy.js +4 -0
  57. package/src/js/core/sticky.js +19 -34
  58. package/src/js/core/switcher.js +4 -0
  59. package/src/js/core/toggle.js +12 -7
  60. package/src/js/mixin/media.js +3 -7
  61. package/src/js/mixin/parallax.js +2 -1
  62. package/src/js/mixin/resize.js +5 -7
  63. package/src/js/util/selector.js +24 -23
  64. package/src/less/components/modal.less +6 -3
  65. package/src/scss/components/modal.scss +6 -3
  66. package/tests/grid.html +9 -9
  67. package/tests/slider.html +1 -1
  68. package/tests/slideshow.html +1 -1
  69. package/tests/sticky.html +0 -6
  70. package/src/js/core/gif.js +0 -24
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.12.3-dev.cbf065cc2",
5
+ "version": "3.13.1-dev.4a671f35d",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -17,7 +17,7 @@ export default {
17
17
  },
18
18
 
19
19
  connected() {
20
- this.date = Date.parse(this.date);
20
+ this.date = Date.parse(this.$props.date);
21
21
  this.start();
22
22
  },
23
23
 
@@ -5,6 +5,7 @@ import {
5
5
  $,
6
6
  $$,
7
7
  attr,
8
+ fastdom,
8
9
  filter,
9
10
  getIndex,
10
11
  hasClass,
@@ -135,9 +136,11 @@ export default {
135
136
 
136
137
  if (show) {
137
138
  const toggle = $(this.$props.toggle, el);
138
- if (!isInView(toggle)) {
139
- scrollIntoView(toggle, { offset: this.offset });
140
- }
139
+ fastdom.read(() => {
140
+ if (!isInView(toggle)) {
141
+ scrollIntoView(toggle, { offset: this.offset });
142
+ }
143
+ });
141
144
  }
142
145
  });
143
146
  }
@@ -58,25 +58,12 @@ export default {
58
58
  container: false,
59
59
  },
60
60
 
61
- computed: {
62
- boundary({ boundary }, $el) {
63
- return boundary === true ? window : query(boundary, $el);
64
- },
65
-
66
- clsDrop({ clsDrop }) {
67
- return clsDrop || `uk-${this.$options.name}`;
68
- },
69
-
70
- clsPos() {
71
- return this.clsDrop;
72
- },
73
- },
74
-
75
61
  created() {
76
62
  this.tracker = new MouseTracker();
77
63
  },
78
64
 
79
65
  connected() {
66
+ this.clsPos = this.clsDrop = this.$props.clsDrop || `uk-${this.$options.name}`;
80
67
  addClass(this.$el, this.clsDrop);
81
68
 
82
69
  if (this.toggle && !this.target) {
@@ -365,28 +352,28 @@ export default {
365
352
  },
366
353
 
367
354
  position() {
355
+ const boundary = this.boundary === true ? window : query(this.boundary, this.$el);
368
356
  removeClass(this.$el, `${this.clsDrop}-stack`);
369
357
  toggleClass(this.$el, `${this.clsDrop}-boundary`, this.boundaryAlign);
370
358
 
371
- const boundary = offset(this.boundary);
372
- const alignTo = this.boundaryAlign ? boundary : offset(this.target);
359
+ const boundaryOffset = offset(boundary);
360
+ const alignTo = this.boundaryAlign ? boundaryOffset : offset(this.target);
373
361
 
374
362
  if (this.align === 'justify') {
375
363
  const prop = this.getAxis() === 'y' ? 'width' : 'height';
376
364
  css(this.$el, prop, alignTo[prop]);
377
365
  } else if (
378
- this.boundary &&
366
+ boundary &&
379
367
  this.$el.offsetWidth >
380
- Math.max(boundary.right - alignTo.left, alignTo.right - boundary.left)
368
+ Math.max(
369
+ boundaryOffset.right - alignTo.left,
370
+ alignTo.right - boundaryOffset.left
371
+ )
381
372
  ) {
382
373
  addClass(this.$el, `${this.clsDrop}-stack`);
383
374
  }
384
375
 
385
- this.positionAt(
386
- this.$el,
387
- this.boundaryAlign ? this.boundary : this.target,
388
- this.boundary
389
- );
376
+ this.positionAt(this.$el, this.boundaryAlign ? boundary : this.target, boundary);
390
377
  },
391
378
  },
392
379
  };
@@ -1,5 +1,5 @@
1
1
  import Class from '../mixin/class';
2
- import { $, $$, closest, isInput, matches, parent, query, selInput } from 'uikit-util';
2
+ import { $, $$, closest, isInput, matches, parent, selInput } from 'uikit-util';
3
3
 
4
4
  export default {
5
5
  mixins: [Class],
@@ -27,7 +27,7 @@ export default {
27
27
  return (
28
28
  target &&
29
29
  ((target === true && parent(this.input) === $el && this.input.nextElementSibling) ||
30
- query(target, $el))
30
+ $(target, $el))
31
31
  );
32
32
  },
33
33
  },
@@ -95,7 +95,7 @@ export default {
95
95
 
96
96
  {
97
97
  read() {
98
- if (positionedAbsolute(this.$el)) {
98
+ if (this.parallax && positionedAbsolute(this.$el)) {
99
99
  return false;
100
100
  }
101
101
 
@@ -1,13 +1,5 @@
1
1
  import { getRows } from './margin';
2
- import {
3
- $$,
4
- boxModelAdjust,
5
- css,
6
- dimensions,
7
- isVisible,
8
- observeMutation,
9
- toFloat,
10
- } from 'uikit-util';
2
+ import { $$, boxModelAdjust, css, dimensions, isVisible, toFloat } from 'uikit-util';
11
3
 
12
4
  export default {
13
5
  args: 'target',
@@ -24,21 +16,19 @@ export default {
24
16
  },
25
17
 
26
18
  computed: {
27
- elements({ target }, $el) {
28
- return $$(target, $el);
29
- },
30
-
31
- resizeTargets() {
32
- this.$el.children;
19
+ elements: {
20
+ get({ target }, $el) {
21
+ return $$(target, $el);
22
+ },
23
+
24
+ watch() {
25
+ this.$reset();
26
+ },
33
27
  },
34
28
  },
35
29
 
36
- connected() {
37
- this.registerObserver(
38
- observeMutation(this.$el, () => this.$reset(), {
39
- childList: true,
40
- })
41
- );
30
+ resizeTargets() {
31
+ return this.elements;
42
32
  },
43
33
 
44
34
  update: {
@@ -31,11 +31,9 @@ export default {
31
31
  minHeight: 0,
32
32
  },
33
33
 
34
- computed: {
35
- resizeTargets() {
36
- // check for offsetTop change
37
- return [this.$el, document.documentElement];
38
- },
34
+ resizeTargets() {
35
+ // check for offsetTop change
36
+ return [this.$el, document.documentElement];
39
37
  },
40
38
 
41
39
  update: {
@@ -101,36 +101,29 @@ export const Slidenav = {
101
101
 
102
102
  beforeConnect() {
103
103
  addClass(this.$el, 'uk-slidenav');
104
- },
105
-
106
- computed: {
107
- icon({ icon }, $el) {
108
- return hasClass($el, 'uk-slidenav-large') ? `${icon}-large` : icon;
109
- },
104
+ const icon = this.$props.icon;
105
+ this.icon = hasClass(this.$el, 'uk-slidenav-large') ? `${icon}-large` : icon;
110
106
  },
111
107
  };
112
108
 
113
109
  export const Search = {
114
110
  extends: IconComponent,
115
111
 
116
- computed: {
117
- icon({ icon }, $el) {
118
- return hasClass($el, 'uk-search-icon') && parents($el, '.uk-search-large').length
112
+ beforeConnect() {
113
+ this.icon =
114
+ hasClass(this.$el, 'uk-search-icon') && parents(this.$el, '.uk-search-large').length
119
115
  ? 'search-large'
120
- : parents($el, '.uk-search-navbar').length
116
+ : parents(this.$el, '.uk-search-navbar').length
121
117
  ? 'search-navbar'
122
- : icon;
123
- },
118
+ : this.$props.icon;
124
119
  },
125
120
  };
126
121
 
127
122
  export const Close = {
128
123
  extends: IconComponent,
129
124
 
130
- computed: {
131
- icon() {
132
- return `close-${hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'}`;
133
- },
125
+ beforeConnect() {
126
+ this.icon = `close-${hasClass(this.$el, 'uk-close-large') ? 'large' : 'icon'}`;
134
127
  },
135
128
  };
136
129
 
@@ -46,29 +46,19 @@ export default {
46
46
  loading: 'lazy',
47
47
  },
48
48
 
49
- computed: {
50
- target: {
51
- get({ target }) {
52
- return [this.$el, ...queryAll(target, this.$el)];
53
- },
54
-
55
- watch() {
56
- this.$reset();
57
- },
58
- },
59
- },
60
-
61
49
  connected() {
62
50
  if (this.loading !== 'lazy') {
63
51
  this.load();
64
52
  return;
65
53
  }
66
54
 
55
+ const target = [this.$el, ...queryAll(this.$props.target, this.$el)];
56
+
67
57
  if (nativeLazyLoad && isImg(this.$el)) {
68
58
  this.$el.loading = 'lazy';
69
59
  setSrcAttrs(this.$el);
70
60
 
71
- if (this.target.length === 1) {
61
+ if (target.length === 1) {
72
62
  return;
73
63
  }
74
64
  }
@@ -77,7 +67,7 @@ export default {
77
67
 
78
68
  this.registerObserver(
79
69
  observeIntersection(
80
- this.target,
70
+ target,
81
71
  (entries, observer) => {
82
72
  this.load();
83
73
  observer.disconnect();
@@ -3,7 +3,6 @@ export { default as Alert } from './alert';
3
3
  export { default as Cover } from './cover';
4
4
  export { default as Drop, default as Dropdown } from './drop';
5
5
  export { default as FormCustom } from './form-custom';
6
- export { default as Gif } from './gif';
7
6
  export { default as Grid } from './grid';
8
7
  export { default as HeightMatch } from './height-match';
9
8
  export { default as HeightViewport } from './height-viewport';
@@ -1,13 +1,9 @@
1
- import {
2
- isRtl,
3
- isVisible,
4
- observeMutation,
5
- observeResize,
6
- offsetPosition,
7
- toggleClass,
8
- } from 'uikit-util';
1
+ import Resize from '../mixin/resize';
2
+ import { isRtl, isVisible, observeMutation, offsetPosition, toggleClass } from 'uikit-util';
9
3
 
10
4
  export default {
5
+ mixins: [Resize],
6
+
11
7
  props: {
12
8
  margin: String,
13
9
  firstColumn: Boolean,
@@ -18,14 +14,16 @@ export default {
18
14
  firstColumn: 'uk-first-column',
19
15
  },
20
16
 
17
+ resizeTargets() {
18
+ return this.$el.children;
19
+ },
20
+
21
21
  connected() {
22
22
  this.registerObserver(
23
23
  observeMutation(this.$el, () => this.$reset(), {
24
24
  childList: true,
25
25
  })
26
26
  );
27
-
28
- this.registerObserver(observeResize(this.$el.children, () => this.$emit('resize')));
29
27
  },
30
28
 
31
29
  update: {
@@ -25,14 +25,10 @@ export default {
25
25
  content({ selContent }, $el) {
26
26
  return closest($el, selContent);
27
27
  },
28
-
29
- resizeTargets() {
30
- return [this.container, this.content];
31
- },
32
28
  },
33
29
 
34
- connected() {
35
- css(this.$el, 'minHeight', this.minHeight);
30
+ resizeTargets() {
31
+ return [this.container, this.content];
36
32
  },
37
33
 
38
34
  update: {
@@ -50,7 +46,7 @@ export default {
50
46
  },
51
47
 
52
48
  write({ max }) {
53
- css(this.$el, 'maxHeight', max);
49
+ css(this.$el, { minHeight: this.minHeight, maxHeight: max });
54
50
  },
55
51
 
56
52
  events: ['resize'],
@@ -1,8 +1,15 @@
1
+ import Resize from '../mixin/resize';
1
2
  import { addClass, Dimensions, height, isVisible, parent, width } from 'uikit-util';
2
3
 
3
4
  export default {
5
+ mixin: [Resize],
6
+
4
7
  props: ['width', 'height'],
5
8
 
9
+ resizeTargets() {
10
+ return [this.$el, parent(this.$el)];
11
+ },
12
+
6
13
  connected() {
7
14
  addClass(this.$el, 'uk-responsive-width');
8
15
  },
@@ -70,6 +70,10 @@ export default {
70
70
  el[stateKey] = { cls: getData(el, 'uk-scrollspy-class') || this.cls };
71
71
  }
72
72
 
73
+ if (!this.repeat && el[stateKey].show) {
74
+ continue;
75
+ }
76
+
73
77
  el[stateKey].show = isInView(el, this.offsetTop, this.offsetLeft);
74
78
  }
75
79
  },
@@ -14,7 +14,6 @@ import {
14
14
  height as getHeight,
15
15
  offset as getOffset,
16
16
  getScrollingElement,
17
- hasClass,
18
17
  isString,
19
18
  isVisible,
20
19
  noop,
@@ -47,7 +46,6 @@ export default {
47
46
  clsFixed: String,
48
47
  clsBelow: String,
49
48
  selTarget: String,
50
- widthElement: Boolean,
51
49
  showOnUp: Boolean,
52
50
  targetOffset: Number,
53
51
  },
@@ -63,7 +61,6 @@ export default {
63
61
  clsFixed: 'uk-sticky-fixed',
64
62
  clsBelow: 'uk-sticky-below',
65
63
  selTarget: '',
66
- widthElement: false,
67
64
  showOnUp: false,
68
65
  targetOffset: false,
69
66
  },
@@ -72,30 +69,10 @@ export default {
72
69
  selTarget({ selTarget }, $el) {
73
70
  return (selTarget && $(selTarget, $el)) || $el;
74
71
  },
72
+ },
75
73
 
76
- widthElement({ widthElement }, $el) {
77
- return query(widthElement, $el) || this.placeholder;
78
- },
79
-
80
- resizeTargets() {
81
- return document.documentElement;
82
- },
83
-
84
- isActive: {
85
- get() {
86
- return hasClass(this.selTarget, this.clsActive);
87
- },
88
-
89
- set(value) {
90
- if (value && !this.isActive) {
91
- replaceClass(this.selTarget, this.clsInactive, this.clsActive);
92
- trigger(this.$el, 'active');
93
- } else if (!value && !hasClass(this.selTarget, this.clsInactive)) {
94
- replaceClass(this.selTarget, this.clsActive, this.clsInactive);
95
- trigger(this.$el, 'inactive');
96
- }
97
- },
98
- },
74
+ resizeTargets() {
75
+ return document.documentElement;
99
76
  },
100
77
 
101
78
  connected() {
@@ -103,7 +80,7 @@ export default {
103
80
  $('+ .uk-sticky-placeholder', this.$el) ||
104
81
  $('<div class="uk-sticky-placeholder"></div>');
105
82
  this.isFixed = false;
106
- this.isActive = false;
83
+ this.setActive(false);
107
84
  },
108
85
 
109
86
  disconnected() {
@@ -114,7 +91,6 @@ export default {
114
91
 
115
92
  remove(this.placeholder);
116
93
  this.placeholder = null;
117
- this.widthElement = null;
118
94
  },
119
95
 
120
96
  events: [
@@ -209,8 +185,7 @@ export default {
209
185
  topOffset,
210
186
  height,
211
187
  margin,
212
- width: dimensions(isVisible(this.widthElement) ? this.widthElement : this.$el)
213
- .width,
188
+ width: dimensions(referenceElement).width,
214
189
  top: offsetPosition(referenceElement)[0],
215
190
  };
216
191
  },
@@ -224,8 +199,6 @@ export default {
224
199
  after(this.$el, placeholder);
225
200
  placeholder.hidden = true;
226
201
  }
227
-
228
- this.isActive = !!this.isActive; // force self-assign
229
202
  },
230
203
 
231
204
  events: ['resize'],
@@ -342,7 +315,7 @@ export default {
342
315
  },
343
316
 
344
317
  hide() {
345
- this.isActive = false;
318
+ this.setActive(false);
346
319
  removeClass(this.$el, this.clsFixed, this.clsBelow);
347
320
  css(this.$el, { position: '', top: '', width: '' });
348
321
  this.placeholder.hidden = true;
@@ -379,10 +352,22 @@ export default {
379
352
  width,
380
353
  });
381
354
 
382
- this.isActive = active;
355
+ this.setActive(active);
383
356
  toggleClass(this.$el, this.clsBelow, scroll > topOffset + height);
384
357
  addClass(this.$el, this.clsFixed);
385
358
  },
359
+
360
+ setActive(active) {
361
+ const prev = this.active;
362
+ this.active = active;
363
+ if (active) {
364
+ replaceClass(this.selTarget, this.clsInactive, this.clsActive);
365
+ prev !== active && trigger(this.$el, 'active');
366
+ } else {
367
+ replaceClass(this.selTarget, this.clsActive, this.clsInactive);
368
+ prev !== active && trigger(this.$el, 'inactive');
369
+ }
370
+ },
386
371
  },
387
372
  };
388
373
 
@@ -13,6 +13,7 @@ import {
13
13
  hasClass,
14
14
  matches,
15
15
  queryAll,
16
+ ready,
16
17
  toggleClass,
17
18
  toNodes,
18
19
  within,
@@ -87,6 +88,9 @@ export default {
87
88
 
88
89
  connected() {
89
90
  this.lazyload(this.$el, this.connects);
91
+
92
+ // check for connects
93
+ ready(() => this.$emit());
90
94
  },
91
95
 
92
96
  events: [
@@ -16,6 +16,7 @@ import {
16
16
  pointerEnter,
17
17
  pointerLeave,
18
18
  queryAll,
19
+ ready,
19
20
  trigger,
20
21
  within,
21
22
  } from 'uikit-util';
@@ -41,13 +42,6 @@ export default {
41
42
  queued: true,
42
43
  },
43
44
 
44
- connected() {
45
- if (!includes(this.mode, 'media') && !isFocusable(this.$el)) {
46
- attr(this.$el, 'tabindex', '0');
47
- }
48
- this.lazyload(this.$el, this.target);
49
- },
50
-
51
45
  computed: {
52
46
  target: {
53
47
  get({ href, target }, $el) {
@@ -63,6 +57,17 @@ export default {
63
57
  },
64
58
  },
65
59
 
60
+ connected() {
61
+ if (!includes(this.mode, 'media') && !isFocusable(this.$el)) {
62
+ attr(this.$el, 'tabindex', '0');
63
+ }
64
+
65
+ this.lazyload(this.$el, this.target);
66
+
67
+ // check for target
68
+ ready(() => this.$emit());
69
+ },
70
+
66
71
  events: [
67
72
  {
68
73
  name: pointerDown,
@@ -18,17 +18,13 @@ export default {
18
18
  media: false,
19
19
  },
20
20
 
21
- computed: {
22
- matchMedia() {
23
- return this.mediaObj?.matches;
24
- },
25
- },
26
-
27
21
  connected() {
28
22
  const media = toMedia(this.media);
29
23
  this.mediaObj = window.matchMedia(media);
30
- const handler = () =>
24
+ const handler = () => {
25
+ this.matchMedia = this.mediaObj.matches;
31
26
  trigger(this.$el, createEvent('mediachange', false, true, [this.mediaObj]));
27
+ };
32
28
  this.offMediaObj = on(this.mediaObj, 'change', () => {
33
29
  handler();
34
30
  this.$emit('resize');
@@ -1,6 +1,7 @@
1
1
  import Media from '../mixin/media';
2
2
  import { getMaxPathLength } from '../core/svg';
3
3
  import {
4
+ createEvent,
4
5
  css,
5
6
  Dimensions,
6
7
  each,
@@ -255,7 +256,7 @@ function getBackgroundImageDimensions(el) {
255
256
  if (!image.naturalWidth) {
256
257
  image.onload = () => {
257
258
  dimensions[src] = toDimensions(image);
258
- trigger(el, 'load');
259
+ trigger(el, createEvent('load', false));
259
260
  };
260
261
  return toDimensions(image);
261
262
  }
@@ -1,13 +1,11 @@
1
1
  import { observeResize } from 'uikit-util';
2
2
 
3
3
  export default {
4
- computed: {
5
- resizeTargets() {
6
- return this.$el;
7
- },
8
- },
9
-
10
4
  connected() {
11
- this.registerObserver(observeResize(this.resizeTargets, () => this.$emit('resize')));
5
+ this.registerObserver(
6
+ observeResize(this.$options.resizeTargets?.call(this) || this.$el, () =>
7
+ this.$emit('resize')
8
+ )
9
+ );
12
10
  },
13
11
  };