uikit 3.16.10 → 3.16.11-dev.55a0fc5b5

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 (61) hide show
  1. package/CHANGELOG.md +7 -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 +24 -28
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +79 -72
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +90 -84
  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 +79 -72
  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 +79 -72
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +14 -18
  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 +256 -279
  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 +381 -406
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/computed.js +7 -1
  44. package/src/js/api/hooks.js +7 -4
  45. package/src/js/api/observer.js +44 -43
  46. package/src/js/api/options.js +1 -0
  47. package/src/js/api/update.js +15 -36
  48. package/src/js/api/watch.js +33 -20
  49. package/src/js/components/filter.js +23 -29
  50. package/src/js/components/lightbox.js +12 -14
  51. package/src/js/components/sortable.js +13 -19
  52. package/src/js/core/accordion.js +32 -45
  53. package/src/js/core/dropnav.js +37 -43
  54. package/src/js/core/height-match.js +2 -8
  55. package/src/js/core/navbar.js +3 -12
  56. package/src/js/core/scrollspy-nav.js +10 -12
  57. package/src/js/core/scrollspy.js +10 -12
  58. package/src/js/core/switcher.js +30 -37
  59. package/src/js/mixin/slider-nav.js +80 -76
  60. package/src/js/mixin/slider.js +10 -8
  61. package/src/js/util/fastdom.js +2 -2
@@ -7,7 +7,6 @@ import {
7
7
  addClass,
8
8
  after,
9
9
  attr,
10
- children,
11
10
  css,
12
11
  findIndex,
13
12
  getIndex,
@@ -70,21 +69,44 @@ export default {
70
69
  return query(dropbarAnchor, $el) || $el;
71
70
  },
72
71
 
73
- dropbar: {
74
- get({ dropbar }) {
75
- if (!dropbar) {
76
- return null;
72
+ dropbar({ dropbar }) {
73
+ if (!dropbar) {
74
+ return null;
75
+ }
76
+
77
+ dropbar =
78
+ this._dropbar || query(dropbar, this.$el) || $(`+ .${this.clsDropbar}`, this.$el);
79
+
80
+ return dropbar ? dropbar : (this._dropbar = $('<div></div>'));
81
+ },
82
+
83
+ dropContainer(_, $el) {
84
+ return this.container || $el;
85
+ },
86
+
87
+ dropdowns({ clsDrop }, $el) {
88
+ const dropdowns = $$(`.${clsDrop}`, $el);
89
+
90
+ if (this.dropContainer !== $el) {
91
+ for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
92
+ const target = this.getDropdown(el)?.targetEl;
93
+ if (!includes(dropdowns, el) && target && within(target, this.$el)) {
94
+ dropdowns.push(el);
95
+ }
77
96
  }
97
+ }
78
98
 
79
- dropbar =
80
- this._dropbar ||
81
- query(dropbar, this.$el) ||
82
- $(`+ .${this.clsDropbar}`, this.$el);
99
+ return dropdowns;
100
+ },
83
101
 
84
- return dropbar ? dropbar : (this._dropbar = $('<div></div>'));
85
- },
102
+ items({ selNavItem }, $el) {
103
+ return $$(selNavItem, $el);
104
+ },
105
+ },
86
106
 
87
- watch(dropbar) {
107
+ watch: {
108
+ dropbar: {
109
+ handler(dropbar) {
88
110
  addClass(
89
111
  dropbar,
90
112
  'uk-dropbar',
@@ -97,27 +119,8 @@ export default {
97
119
  immediate: true,
98
120
  },
99
121
 
100
- dropContainer(_, $el) {
101
- return this.container || $el;
102
- },
103
-
104
122
  dropdowns: {
105
- get({ clsDrop }, $el) {
106
- const dropdowns = $$(`.${clsDrop}`, $el);
107
-
108
- if (this.dropContainer !== $el) {
109
- for (const el of $$(`.${clsDrop}`, this.dropContainer)) {
110
- const target = this.getDropdown(el)?.targetEl;
111
- if (!includes(dropdowns, el) && target && within(target, this.$el)) {
112
- dropdowns.push(el);
113
- }
114
- }
115
- }
116
-
117
- return dropdowns;
118
- },
119
-
120
- watch(dropdowns) {
123
+ handler(dropdowns) {
121
124
  this.$create(
122
125
  'drop',
123
126
  dropdowns.filter((el) => !this.getDropdown(el)),
@@ -135,13 +138,8 @@ export default {
135
138
  },
136
139
 
137
140
  items: {
138
- get({ selNavItem }, $el) {
139
- return $$(selNavItem, $el);
140
- },
141
-
142
- watch(items) {
143
- attr(children(this.$el), 'role', 'presentation');
144
- attr(items, { tabindex: -1, role: 'menuitem' });
141
+ handler(items) {
142
+ attr(items, 'tabindex', -1);
145
143
  attr(items[0], 'tabindex', 0);
146
144
  },
147
145
 
@@ -149,10 +147,6 @@ export default {
149
147
  },
150
148
  },
151
149
 
152
- connected() {
153
- attr(this.$el, 'role', 'menubar');
154
- },
155
-
156
150
  disconnected() {
157
151
  remove(this._dropbar);
158
152
  delete this._dropbar;
@@ -16,14 +16,8 @@ export default {
16
16
  },
17
17
 
18
18
  computed: {
19
- elements: {
20
- get({ target }, $el) {
21
- return $$(target, $el);
22
- },
23
-
24
- watch() {
25
- this.$reset();
26
- },
19
+ elements({ target }, $el) {
20
+ return $$(target, $el);
27
21
  },
28
22
  },
29
23
 
@@ -1,5 +1,5 @@
1
1
  import Dropnav from './dropnav';
2
- import { $$, attr, css, hasClass } from 'uikit-util';
2
+ import { $$, css, hasClass } from 'uikit-util';
3
3
 
4
4
  export default {
5
5
  extends: Dropnav,
@@ -10,13 +10,9 @@ export default {
10
10
  '.uk-navbar-nav > li > a,a.uk-navbar-item,button.uk-navbar-item,.uk-navbar-item a,.uk-navbar-item button,.uk-navbar-toggle', // Simplify with :where() selector once browser target is Safari 14+
11
11
  },
12
12
 
13
- computed: {
13
+ watch: {
14
14
  items: {
15
- get({ selNavItem }, $el) {
16
- return $$(selNavItem, $el);
17
- },
18
-
19
- watch(items) {
15
+ handler() {
20
16
  const justify = hasClass(this.$el, 'uk-navbar-justify');
21
17
  for (const container of $$(
22
18
  '.uk-navbar-nav, .uk-navbar-left, .uk-navbar-right',
@@ -33,11 +29,6 @@ export default {
33
29
  : ''
34
30
  );
35
31
  }
36
-
37
- attr($$('.uk-navbar-nav', this.$el), 'role', 'group');
38
- attr($$('.uk-navbar-nav > *', this.$el), 'role', 'presentation');
39
- attr(items, { tabindex: -1, role: 'menuitem' });
40
- attr(items[0], 'tabindex', 0);
41
32
  },
42
33
 
43
34
  immediate: true,
@@ -31,18 +31,8 @@ export default {
31
31
  },
32
32
 
33
33
  computed: {
34
- links: {
35
- get(_, $el) {
36
- return $$('a[href*="#"]', $el).filter((el) => el.hash && isSameSiteAnchor(el));
37
- },
38
-
39
- watch(links) {
40
- if (this.scroll) {
41
- this.$create('scroll', links, { offset: this.offset || 0 });
42
- }
43
- },
44
-
45
- immediate: true,
34
+ links(_, $el) {
35
+ return $$('a[href*="#"]', $el).filter((el) => el.hash && isSameSiteAnchor(el));
46
36
  },
47
37
 
48
38
  elements({ closest: selector }) {
@@ -50,6 +40,14 @@ export default {
50
40
  },
51
41
  },
52
42
 
43
+ watch: {
44
+ links(links) {
45
+ if (this.scroll) {
46
+ this.$create('scroll', links, { offset: this.offset || 0 });
47
+ }
48
+ },
49
+ },
50
+
53
51
  observe: scroll(),
54
52
 
55
53
  update: [
@@ -34,19 +34,17 @@ export default {
34
34
  }),
35
35
 
36
36
  computed: {
37
- elements: {
38
- get({ target }, $el) {
39
- return target ? $$(target, $el) : [$el];
40
- },
41
-
42
- watch(elements) {
43
- if (this.hidden) {
44
- // use `opacity:0` instead of `visibility:hidden` to make content focusable with keyboard
45
- css(filter(elements, `:not(.${this.inViewClass})`), 'opacity', 0);
46
- }
47
- },
37
+ elements({ target }, $el) {
38
+ return target ? $$(target, $el) : [$el];
39
+ },
40
+ },
48
41
 
49
- immediate: true,
42
+ watch: {
43
+ elements(elements) {
44
+ if (this.hidden) {
45
+ // use `opacity:0` instead of `visibility:hidden` to make content focusable with keyboard
46
+ css(filter(elements, `:not(.${this.inViewClass})`), 'opacity', 0);
47
+ }
50
48
  },
51
49
  },
52
50
 
@@ -51,56 +51,49 @@ export default {
51
51
  },
52
52
 
53
53
  computed: {
54
- connects: {
55
- get({ connect }, $el) {
56
- return queryAll(connect, $el);
57
- },
54
+ connects({ connect }, $el) {
55
+ return queryAll(connect, $el);
56
+ },
58
57
 
59
- watch(connects) {
60
- if (this.swiping) {
61
- css(connects, 'touchAction', 'pan-y pinch-zoom');
62
- }
63
- this.$emit();
64
- },
58
+ connectChildren() {
59
+ return this.connects.map((el) => children(el)).flat();
60
+ },
65
61
 
66
- document: true,
67
- immediate: true,
62
+ toggles({ toggle }, $el) {
63
+ return $$(toggle, $el);
68
64
  },
69
65
 
70
- connectChildren: {
71
- get() {
72
- return this.connects.map((el) => children(el)).flat();
73
- },
66
+ children() {
67
+ return children(this.$el).filter((child) =>
68
+ this.toggles.some((toggle) => within(toggle, child))
69
+ );
70
+ },
71
+ },
74
72
 
75
- watch() {
76
- const index = this.index();
77
- for (const el of this.connects) {
78
- children(el).forEach((child, i) => toggleClass(child, this.cls, i === index));
73
+ watch: {
74
+ connects: {
75
+ handler(connects) {
76
+ if (this.swiping) {
77
+ css(connects, 'touchAction', 'pan-y pinch-zoom');
79
78
  }
80
79
  this.$emit();
81
80
  },
82
81
 
83
- immediate: true,
82
+ document: true,
84
83
  },
85
84
 
86
- toggles: {
87
- get({ toggle }, $el) {
88
- return $$(toggle, $el);
89
- },
90
-
91
- watch(toggles) {
92
- this.$emit();
93
- const active = this.index();
94
- this.show(~active ? active : toggles[this.active] || toggles[0]);
95
- },
96
-
97
- immediate: true,
85
+ connectChildren() {
86
+ const index = this.index();
87
+ for (const el of this.connects) {
88
+ children(el).forEach((child, i) => toggleClass(child, this.cls, i === index));
89
+ }
90
+ this.$emit();
98
91
  },
99
92
 
100
- children() {
101
- return children(this.$el).filter((child) =>
102
- this.toggles.some((toggle) => within(toggle, child))
103
- );
93
+ toggles(toggles) {
94
+ this.$emit();
95
+ const active = this.index();
96
+ this.show(~active ? active : toggles[this.active] || toggles[0]);
104
97
  },
105
98
  },
106
99
 
@@ -1,11 +1,12 @@
1
1
  import {
2
2
  $,
3
3
  $$,
4
+ append,
4
5
  attr,
5
6
  children,
6
7
  closest,
7
8
  data,
8
- html,
9
+ empty,
9
10
  isNumeric,
10
11
  matches,
11
12
  toFloat,
@@ -30,106 +31,109 @@ export default {
30
31
  },
31
32
 
32
33
  computed: {
33
- nav: {
34
- get({ selNav }, $el) {
35
- return $(selNav, $el);
36
- },
37
-
38
- watch(nav, prev) {
39
- attr(nav, 'role', 'tablist');
40
-
41
- if (prev) {
42
- this.$emit();
43
- }
44
- },
34
+ nav({ selNav }, $el) {
35
+ return $(selNav, $el);
36
+ },
45
37
 
46
- immediate: true,
38
+ navChildren() {
39
+ return children(this.nav);
47
40
  },
48
41
 
49
42
  selNavItem({ attrItem }) {
50
43
  return `[${attrItem}],[data-${attrItem}]`;
51
44
  },
52
45
 
53
- navItems: {
54
- get(_, $el) {
55
- return $$(this.selNavItem, $el);
56
- },
57
-
58
- watch() {
59
- this.$emit();
60
- },
46
+ navItems(_, $el) {
47
+ return $$(this.selNavItem, $el);
61
48
  },
62
49
  },
63
50
 
64
- connected() {
65
- attr(this.$el, {
66
- role: this.role,
67
- ariaRoleDescription: 'carousel',
68
- });
69
- },
51
+ watch: {
52
+ nav(nav, prev) {
53
+ attr(nav, 'role', 'tablist');
70
54
 
71
- update: [
72
- {
73
- write() {
74
- this.slides.forEach((slide, i) =>
75
- attr(slide, {
76
- role: this.nav ? 'tabpanel' : 'group',
77
- 'aria-label': this.t('slideLabel', i + 1, this.length),
78
- 'aria-roledescription': this.nav ? null : 'slide',
79
- })
80
- );
81
-
82
- if (this.nav && this.length !== this.nav.children.length) {
83
- html(
84
- this.nav,
85
- this.slides
86
- .map((_, i) => `<li ${this.attrItem}="${i}"><a href></a></li>`)
87
- .join('')
88
- );
89
- }
55
+ if (prev) {
56
+ this.$emit();
57
+ }
58
+ },
90
59
 
91
- attr(children(this.nav).concat(this.list), 'role', 'presentation');
60
+ list(list) {
61
+ attr(list, 'role', 'presentation');
62
+ },
63
+
64
+ navChildren(children) {
65
+ attr(children, 'role', 'presentation');
66
+ },
92
67
 
93
- for (const el of this.navItems) {
94
- const cmd = data(el, this.attrItem);
95
- const button = $('a,button', el) || el;
68
+ navItems(items) {
69
+ for (const el of items) {
70
+ const cmd = data(el, this.attrItem);
71
+ const button = $('a,button', el) || el;
96
72
 
97
- let ariaLabel;
98
- let ariaControls = null;
99
- if (isNumeric(cmd)) {
100
- const item = toNumber(cmd);
101
- const slide = this.slides[item];
73
+ let ariaLabel;
74
+ let ariaControls = null;
75
+ if (isNumeric(cmd)) {
76
+ const item = toNumber(cmd);
77
+ const slide = this.slides[item];
102
78
 
103
- if (slide) {
104
- if (!slide.id) {
105
- slide.id = generateId(this, slide, `-item-${cmd}`);
106
- }
107
- ariaControls = slide.id;
79
+ if (slide) {
80
+ if (!slide.id) {
81
+ slide.id = generateId(this, slide, `-item-${cmd}`);
108
82
  }
83
+ ariaControls = slide.id;
84
+ }
109
85
 
110
- ariaLabel = this.t('slideX', toFloat(cmd) + 1);
111
-
112
- attr(button, 'role', 'tab');
113
- } else {
114
- if (this.list) {
115
- if (!this.list.id) {
116
- this.list.id = generateId(this, this.list, '-items');
117
- }
86
+ ariaLabel = this.t('slideX', toFloat(cmd) + 1);
118
87
 
119
- ariaControls = this.list.id;
88
+ attr(button, 'role', 'tab');
89
+ } else {
90
+ if (this.list) {
91
+ if (!this.list.id) {
92
+ this.list.id = generateId(this, this.list, '-items');
120
93
  }
121
94
 
122
- ariaLabel = this.t(cmd);
95
+ ariaControls = this.list.id;
123
96
  }
124
97
 
125
- attr(button, {
126
- 'aria-controls': ariaControls,
127
- 'aria-label': attr(button, 'aria-label') || ariaLabel,
128
- });
98
+ ariaLabel = this.t(cmd);
129
99
  }
130
- },
100
+
101
+ attr(button, {
102
+ 'aria-controls': ariaControls,
103
+ 'aria-label': attr(button, 'aria-label') || ariaLabel,
104
+ });
105
+ }
106
+ },
107
+
108
+ slides(slides) {
109
+ slides.forEach((slide, i) =>
110
+ attr(slide, {
111
+ role: this.nav ? 'tabpanel' : 'group',
112
+ 'aria-label': this.t('slideLabel', i + 1, this.length),
113
+ 'aria-roledescription': this.nav ? null : 'slide',
114
+ })
115
+ );
131
116
  },
132
117
 
118
+ length(length) {
119
+ const navLength = this.navChildren.length;
120
+ if (this.nav && length !== navLength) {
121
+ empty(this.nav);
122
+ for (let i = 0; i < length; i++) {
123
+ append(this.nav, `<li ${this.attrItem}="${i}"><a href></a></li>`);
124
+ }
125
+ }
126
+ },
127
+ },
128
+
129
+ connected() {
130
+ attr(this.$el, {
131
+ role: this.role,
132
+ ariaRoleDescription: 'carousel',
133
+ });
134
+ },
135
+
136
+ update: [
133
137
  {
134
138
  write() {
135
139
  this.navItems.concat(this.nav).forEach((el) => el && (el.hidden = !this.maxIndex));
@@ -63,14 +63,8 @@ export default {
63
63
  return this.length - 1;
64
64
  },
65
65
 
66
- slides: {
67
- get() {
68
- return children(this.list);
69
- },
70
-
71
- watch() {
72
- this.$emit();
73
- },
66
+ slides() {
67
+ return children(this.list);
74
68
  },
75
69
 
76
70
  length() {
@@ -78,6 +72,14 @@ export default {
78
72
  },
79
73
  },
80
74
 
75
+ watch: {
76
+ slides(slides, prev) {
77
+ if (prev) {
78
+ this.$emit();
79
+ }
80
+ },
81
+ },
82
+
81
83
  observe: resize(),
82
84
 
83
85
  methods: {
@@ -8,8 +8,8 @@ export const fastdom = {
8
8
  reads: [],
9
9
  writes: [],
10
10
 
11
- read(task, prepend) {
12
- this.reads[prepend ? 'unshift' : 'push'](task);
11
+ read(task) {
12
+ this.reads.push(task);
13
13
  scheduleFlush();
14
14
  return task;
15
15
  },