uikit 3.16.11 → 3.16.12-dev.eee62e629

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 (57) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/build/release.js +1 -1
  3. package/dist/css/uikit-core-rtl.css +1 -13
  4. package/dist/css/uikit-core-rtl.min.css +1 -1
  5. package/dist/css/uikit-core.css +1 -13
  6. package/dist/css/uikit-core.min.css +1 -1
  7. package/dist/css/uikit-rtl.css +1 -13
  8. package/dist/css/uikit-rtl.min.css +1 -1
  9. package/dist/css/uikit.css +1 -13
  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 +1 -1
  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 +150 -134
  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 +150 -134
  42. package/dist/js/uikit.min.js +1 -1
  43. package/package.json +1 -1
  44. package/src/js/api/props.js +4 -12
  45. package/src/js/api/watch.js +3 -4
  46. package/src/js/core/icon.js +3 -5
  47. package/src/js/core/scroll.js +3 -1
  48. package/src/js/core/svg.js +58 -125
  49. package/src/js/mixin/svg.js +86 -0
  50. package/src/less/components/dropbar.less +1 -1
  51. package/src/less/components/dropdown.less +1 -1
  52. package/src/less/components/lightbox.less +0 -1
  53. package/src/less/components/navbar.less +1 -1
  54. package/src/scss/components/dropbar.scss +1 -1
  55. package/src/scss/components/dropdown.scss +1 -1
  56. package/src/scss/components/lightbox.scss +0 -1
  57. package/src/scss/components/navbar.scss +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.16.11",
5
+ "version": "3.16.12-dev.eee62e629",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -1,14 +1,6 @@
1
1
  import { registerObserver } from './observer';
2
2
  import { coerce, parseOptions } from './options';
3
- import {
4
- camelize,
5
- data as getData,
6
- hasOwn,
7
- hyphenate,
8
- isArray,
9
- isUndefined,
10
- startsWith,
11
- } from 'uikit-util';
3
+ import { camelize, data as getData, hasOwn, hyphenate, isUndefined, startsWith } from 'uikit-util';
12
4
 
13
5
  export function initProps(instance) {
14
6
  const props = getProps(instance.$options);
@@ -70,13 +62,13 @@ function notIn(options, key) {
70
62
 
71
63
  export function initPropsObserver(instance) {
72
64
  const { $options, $props } = instance;
73
- const { id, attrs, props, el } = $options;
65
+ const { id, props, el } = $options;
74
66
 
75
- if (!props || attrs === false) {
67
+ if (!props) {
76
68
  return;
77
69
  }
78
70
 
79
- const attributes = isArray(attrs) ? attrs : Object.keys(props);
71
+ const attributes = Object.keys(props);
80
72
  const filter = attributes.map((key) => hyphenate(key)).concat(id);
81
73
 
82
74
  const observer = new MutationObserver((records) => {
@@ -20,11 +20,10 @@ export function registerWatch(instance, watch, name) {
20
20
  export function runWatches(instance, values) {
21
21
  for (const { name, handler, immediate = true } of instance._watches) {
22
22
  if (
23
- instance._initial
24
- ? immediate
25
- : hasOwn(values, name) && !isEqual(values[name], instance[name])
23
+ (instance._initial && immediate) ||
24
+ (hasOwn(values, name) && !isEqual(values[name], instance[name]))
26
25
  ) {
27
- handler.call(instance, instance[name], instance._initial ? undefined : values[name]);
26
+ handler.call(instance, instance[name], values[name]);
28
27
  }
29
28
  }
30
29
  instance._initial = false;
@@ -1,4 +1,4 @@
1
- import SVG from './svg';
1
+ import Svg from '../mixin/svg';
2
2
  import I18n from '../mixin/i18n';
3
3
  import closeIcon from '../../images/components/close-icon.svg';
4
4
  import closeLarge from '../../images/components/close-large.svg';
@@ -64,13 +64,11 @@ const icons = {
64
64
  const Icon = {
65
65
  install,
66
66
 
67
- extends: SVG,
67
+ mixins: [Svg],
68
68
 
69
69
  args: 'icon',
70
70
 
71
- props: ['icon'],
72
-
73
- data: { include: [] },
71
+ props: { icon: String },
74
72
 
75
73
  isIcon: true,
76
74
 
@@ -63,7 +63,9 @@ function clickHandler(e) {
63
63
  for (const instance of instances) {
64
64
  if (within(e.target, instance.$el) && isSameSiteAnchor(instance.$el)) {
65
65
  e.preventDefault();
66
- window.history.pushState({}, '', instance.$el.href);
66
+ if (window.location.href !== instance.$el.href) {
67
+ window.history.pushState({}, '', instance.$el.href);
68
+ }
67
69
  instance.scrollTo(getTargetedElement(instance.$el));
68
70
  }
69
71
  }
@@ -1,102 +1,65 @@
1
- import { registerObserver } from '../api/observer';
1
+ import Svg from '../mixin/svg';
2
+ import Class from '../mixin/class';
2
3
  import { getMaxPathLength } from '../util/svg';
4
+ import { mutation } from '../api/observables';
3
5
  import {
4
6
  $,
5
- after,
6
- append,
7
+ addClass,
7
8
  attr,
9
+ css,
8
10
  includes,
9
11
  isTag,
10
- isVoidElement,
11
12
  memoize,
12
- noop,
13
- observeIntersection,
14
13
  once,
15
- remove,
16
14
  removeAttr,
17
15
  startsWith,
18
- toFloat,
19
16
  } from 'uikit-util';
20
17
 
21
18
  export default {
19
+ mixins: [Class, Svg],
20
+
22
21
  args: 'src',
23
22
 
24
23
  props: {
25
- id: Boolean,
26
- icon: String,
27
24
  src: String,
28
- style: String,
29
- width: Number,
30
- height: Number,
31
- ratio: Number,
32
- class: String,
33
- strokeAnimation: Boolean,
25
+ icon: String,
34
26
  attributes: 'list',
27
+ strokeAnimation: Boolean,
35
28
  },
36
29
 
37
30
  data: {
38
- ratio: 1,
39
- include: ['style', 'class'],
40
- class: '',
41
31
  strokeAnimation: false,
42
32
  },
43
33
 
44
- beforeConnect() {
45
- this.class += ' uk-svg';
46
- },
47
-
48
- connected() {
49
- if (!this.icon && includes(this.src, '#')) {
34
+ observe: [
35
+ mutation({
36
+ async handler() {
37
+ const svg = await this.svg;
38
+ if (svg) {
39
+ applyAttributes.call(this, svg);
40
+ }
41
+ },
42
+ options: {
43
+ attributes: true,
44
+ attributeFilter: ['id', 'class', 'style'],
45
+ },
46
+ }),
47
+ ],
48
+
49
+ async connected() {
50
+ if (includes(this.src, '#')) {
50
51
  [this.src, this.icon] = this.src.split('#');
51
52
  }
52
53
 
53
- this.svg = this.getSvg().then((el) => {
54
- if (this._connected) {
55
- const svg = insertSVG(el, this.$el);
56
-
57
- if (this.svgEl && svg !== this.svgEl) {
58
- remove(this.svgEl);
59
- }
60
-
61
- this.applyAttributes(svg, el);
62
-
63
- return (this.svgEl = svg);
54
+ const svg = await this.svg;
55
+ if (svg) {
56
+ applyAttributes.call(this, svg);
57
+ if (this.strokeAnimation) {
58
+ applyAnimation(svg);
64
59
  }
65
- }, noop);
66
-
67
- if (this.strokeAnimation) {
68
- this.svg.then((el) => {
69
- if (this._connected && el) {
70
- applyAnimation(el);
71
- registerObserver(
72
- this,
73
- observeIntersection(el, (records, observer) => {
74
- applyAnimation(el);
75
- observer.disconnect();
76
- })
77
- );
78
- }
79
- });
80
60
  }
81
61
  },
82
62
 
83
- disconnected() {
84
- this.svg.then((svg) => {
85
- if (this._connected) {
86
- return;
87
- }
88
-
89
- if (isVoidElement(this.$el)) {
90
- this.$el.hidden = false;
91
- }
92
-
93
- remove(svg);
94
- this.svgEl = null;
95
- });
96
-
97
- this.svg = null;
98
- },
99
-
100
63
  methods: {
101
64
  async getSvg() {
102
65
  if (isTag(this.$el, 'img') && !this.$el.complete && this.$el.loading === 'lazy') {
@@ -107,39 +70,28 @@ export default {
107
70
 
108
71
  return parseSVG(await loadSVG(this.src), this.icon) || Promise.reject('SVG not found.');
109
72
  },
73
+ },
74
+ };
110
75
 
111
- applyAttributes(el, ref) {
112
- for (const prop in this.$options.props) {
113
- if (includes(this.include, prop) && prop in this) {
114
- attr(el, prop, this[prop]);
115
- }
116
- }
117
-
118
- for (const attribute in this.attributes) {
119
- const [prop, value] = this.attributes[attribute].split(':', 2);
120
- attr(el, prop, value);
121
- }
122
-
123
- if (!this.id) {
124
- removeAttr(el, 'id');
125
- }
76
+ function applyAttributes(el) {
77
+ const { $el } = this;
126
78
 
127
- const props = ['width', 'height'];
128
- let dimensions = props.map((prop) => this[prop]);
79
+ addClass(el, attr($el, 'class'));
129
80
 
130
- if (!dimensions.some((val) => val)) {
131
- dimensions = props.map((prop) => attr(ref, prop));
132
- }
81
+ for (let i = 0; i < $el.style.length; i++) {
82
+ const prop = $el.style[i];
83
+ css(el, prop, css($el, prop));
84
+ }
133
85
 
134
- const viewBox = attr(ref, 'viewBox');
135
- if (viewBox && !dimensions.some((val) => val)) {
136
- dimensions = viewBox.split(' ').slice(2);
137
- }
86
+ for (const attribute in this.attributes) {
87
+ const [prop, value] = this.attributes[attribute].split(':', 2);
88
+ attr(el, prop, value);
89
+ }
138
90
 
139
- dimensions.forEach((val, i) => attr(el, props[i], toFloat(val) * this.ratio || null));
140
- },
141
- },
142
- };
91
+ if (!this.$el.id) {
92
+ removeAttr(el, 'id');
93
+ }
94
+ }
143
95
 
144
96
  const loadSVG = memoize(async (src) => {
145
97
  if (src) {
@@ -155,7 +107,7 @@ const loadSVG = memoize(async (src) => {
155
107
 
156
108
  function parseSVG(svg, icon) {
157
109
  if (icon && includes(svg, '<symbol')) {
158
- svg = parseSymbols(svg, icon) || svg;
110
+ svg = parseSymbols(svg)[icon] || svg;
159
111
  }
160
112
 
161
113
  svg = $(svg.substr(svg.indexOf('<svg')));
@@ -163,43 +115,24 @@ function parseSVG(svg, icon) {
163
115
  }
164
116
 
165
117
  const symbolRe = /<symbol([^]*?id=(['"])(.+?)\2[^]*?<\/)symbol>/g;
166
- const symbols = {};
167
118
 
168
- function parseSymbols(svg, icon) {
169
- if (!symbols[svg]) {
170
- symbols[svg] = {};
119
+ const parseSymbols = memoize(function (svg) {
120
+ const symbols = {};
171
121
 
172
- symbolRe.lastIndex = 0;
122
+ symbolRe.lastIndex = 0;
173
123
 
174
- let match;
175
- while ((match = symbolRe.exec(svg))) {
176
- symbols[svg][match[3]] = `<svg xmlns="http://www.w3.org/2000/svg"${match[1]}svg>`;
177
- }
124
+ let match;
125
+ while ((match = symbolRe.exec(svg))) {
126
+ symbols[match[3]] = `<svg xmlns="http://www.w3.org/2000/svg"${match[1]}svg>`;
178
127
  }
179
128
 
180
- return symbols[svg][icon];
181
- }
129
+ return symbols;
130
+ });
182
131
 
183
132
  function applyAnimation(el) {
184
133
  const length = getMaxPathLength(el);
185
134
 
186
135
  if (length) {
187
- el.style.setProperty('--uk-animation-stroke', length);
136
+ css(el, '--uk-animation-stroke', length);
188
137
  }
189
138
  }
190
-
191
- function insertSVG(el, root) {
192
- if (isVoidElement(root) || isTag(root, 'canvas')) {
193
- root.hidden = true;
194
-
195
- const next = root.nextElementSibling;
196
- return equals(el, next) ? next : after(root, el);
197
- }
198
-
199
- const last = root.lastElementChild;
200
- return equals(el, last) ? last : append(root, el);
201
- }
202
-
203
- function equals(el, other) {
204
- return isTag(el, 'svg') && isTag(other, 'svg') && el.innerHTML === other.innerHTML;
205
- }
@@ -0,0 +1,86 @@
1
+ import { after, append, attr, isTag, isVoidElement, noop, remove, toFloat } from 'uikit-util';
2
+
3
+ export default {
4
+ args: 'src',
5
+
6
+ props: {
7
+ width: Number,
8
+ height: Number,
9
+ ratio: Number,
10
+ },
11
+
12
+ data: {
13
+ ratio: 1,
14
+ },
15
+
16
+ connected() {
17
+ this.svg = this.getSvg().then((el) => {
18
+ if (!this._connected) {
19
+ return;
20
+ }
21
+
22
+ const svg = insertSVG(el, this.$el);
23
+
24
+ if (this.svgEl && svg !== this.svgEl) {
25
+ remove(this.svgEl);
26
+ }
27
+
28
+ applyWidthAndHeight.call(this, svg, el);
29
+
30
+ return (this.svgEl = svg);
31
+ }, noop);
32
+ },
33
+
34
+ disconnected() {
35
+ this.svg.then((svg) => {
36
+ if (this._connected) {
37
+ return;
38
+ }
39
+
40
+ if (isVoidElement(this.$el)) {
41
+ this.$el.hidden = false;
42
+ }
43
+
44
+ remove(svg);
45
+ this.svgEl = null;
46
+ });
47
+
48
+ this.svg = null;
49
+ },
50
+
51
+ methods: {
52
+ async getSvg() {},
53
+ },
54
+ };
55
+
56
+ function insertSVG(el, root) {
57
+ if (isVoidElement(root) || isTag(root, 'canvas')) {
58
+ root.hidden = true;
59
+
60
+ const next = root.nextElementSibling;
61
+ return equals(el, next) ? next : after(root, el);
62
+ }
63
+
64
+ const last = root.lastElementChild;
65
+ return equals(el, last) ? last : append(root, el);
66
+ }
67
+
68
+ function equals(el, other) {
69
+ return isTag(el, 'svg') && isTag(other, 'svg') && el.innerHTML === other.innerHTML;
70
+ }
71
+
72
+ function applyWidthAndHeight(el, ref) {
73
+ const props = ['width', 'height'];
74
+ let dimensions = props.map((prop) => this[prop]);
75
+
76
+ if (!dimensions.some((val) => val)) {
77
+ dimensions = props.map((prop) => attr(ref, prop));
78
+ }
79
+
80
+ const viewBox = attr(ref, 'viewBox');
81
+ if (viewBox && !dimensions.some((val) => val)) {
82
+ dimensions = viewBox.split(' ').slice(2);
83
+ }
84
+
85
+ dimensions.forEach((val, i) => attr(el, props[i], toFloat(val) * this.ratio || null));
86
+ }
@@ -83,7 +83,7 @@
83
83
  .uk-dropbar:extend(.uk-light all) when (@dropbar-color-mode = light) {}
84
84
  .uk-dropbar:extend(.uk-dark all) when (@dropbar-color-mode = dark) {}
85
85
 
86
- .uk-dropbar :focus-visible {
86
+ .uk-dropbar :focus-visible when (@dropbar-color-mode = dark) {
87
87
  outline-color: @dropbar-focus-outline !important;
88
88
  }
89
89
 
@@ -80,7 +80,7 @@
80
80
  .uk-dropdown:extend(.uk-light all) when (@dropdown-color-mode = light) {}
81
81
  .uk-dropdown:extend(.uk-dark all) when (@dropdown-color-mode = dark) {}
82
82
 
83
- .uk-dropdown :focus-visible {
83
+ .uk-dropdown :focus-visible when (@dropdown-color-mode = dark) {
84
84
  outline-color: @dropdown-focus-outline !important;
85
85
  }
86
86
 
@@ -95,7 +95,6 @@
95
95
  * Focus
96
96
  */
97
97
 
98
- .uk-lightbox :focus { outline-color: @lightbox-focus-outline; }
99
98
  .uk-lightbox :focus-visible { outline-color: @lightbox-focus-outline; }
100
99
 
101
100
 
@@ -402,7 +402,7 @@
402
402
  .uk-navbar-dropdown:extend(.uk-light all) when (@navbar-dropdown-color-mode = light) {}
403
403
  .uk-navbar-dropdown:extend(.uk-dark all) when (@navbar-dropdown-color-mode = dark) {}
404
404
 
405
- .uk-navbar-dropdown :focus-visible {
405
+ .uk-navbar-dropdown :focus-visible when (@navbar-dropdown-color-mode = dark) {
406
406
  outline-color: @navbar-dropdown-focus-outline !important;
407
407
  }
408
408
 
@@ -83,7 +83,7 @@ $dropbar-large-padding-bottom: $dropbar-large-padding-top !def
83
83
  @if ( $dropbar-color-mode == light ) { .uk-dropbar { @extend .uk-light !optional;} }
84
84
  @if ( $dropbar-color-mode == dark ) { .uk-dropbar { @extend .uk-dark !optional;} }
85
85
 
86
- .uk-dropbar :focus-visible {
86
+ .uk-dropbar :focus-visible when ($dropbar-color-mode = dark) {
87
87
  outline-color: $dropbar-focus-outline !important;
88
88
  }
89
89
 
@@ -80,7 +80,7 @@ $dropdown-nav-sublist-item-hover-color: $global-color !default;
80
80
  @if ( $dropdown-color-mode == light ) { .uk-dropdown { @extend .uk-light !optional;} }
81
81
  @if ( $dropdown-color-mode == dark ) { .uk-dropdown { @extend .uk-dark !optional;} }
82
82
 
83
- .uk-dropdown :focus-visible {
83
+ .uk-dropdown :focus-visible when ($dropdown-color-mode = dark) {
84
84
  outline-color: $dropdown-focus-outline !important;
85
85
  }
86
86
 
@@ -95,7 +95,6 @@ $lightbox-button-hover-color: #fff !default;
95
95
  * Focus
96
96
  */
97
97
 
98
- .uk-lightbox :focus { outline-color: $lightbox-focus-outline; }
99
98
  .uk-lightbox :focus-visible { outline-color: $lightbox-focus-outline; }
100
99
 
101
100
 
@@ -402,7 +402,7 @@ $navbar-dropdown-nav-sublist-item-active-color: $global-emphasis-color !default
402
402
  @if ( $navbar-dropdown-color-mode == light ) { .uk-navbar-dropdown { @extend .uk-light !optional;} }
403
403
  @if ( $navbar-dropdown-color-mode == dark ) { .uk-navbar-dropdown { @extend .uk-dark !optional;} }
404
404
 
405
- .uk-navbar-dropdown :focus-visible {
405
+ .uk-navbar-dropdown :focus-visible when ($navbar-dropdown-color-mode = dark) {
406
406
  outline-color: $navbar-dropdown-focus-outline !important;
407
407
  }
408
408