uikit 3.17.9-dev.73842811 → 3.17.9-dev.9f100be74

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 (47) hide show
  1. package/CHANGELOG.md +6 -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 +1 -1
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +4 -4
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +4 -4
  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 +4 -4
  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 +4 -4
  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 +40 -32
  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 +15 -24
  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 +37 -52
  41. package/dist/js/uikit.min.js +1 -1
  42. package/package.json +1 -1
  43. package/src/js/api/events.js +1 -6
  44. package/src/js/api/instance.js +4 -4
  45. package/src/js/api/options.js +2 -1
  46. package/src/js/api/props.js +13 -15
  47. package/src/js/components/tooltip.js +29 -33
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.17.9-dev.73842811",
5
+ "version": "3.17.9-dev.9f100be74",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -24,12 +24,7 @@ export function registerEvent(instance, event, key) {
24
24
  : { name: key, handler: event };
25
25
  el = isFunction(el) ? el.call(instance, instance) : el || instance.$el;
26
26
 
27
- if (isArray(el)) {
28
- el.forEach((el) => registerEvent(instance, { ...event, el }, key));
29
- return;
30
- }
31
-
32
- if (!el || (filter && !filter.call(instance))) {
27
+ if (!el || (isArray(el) && !el.length) || (filter && !filter.call(instance))) {
33
28
  return;
34
29
  }
35
30
 
@@ -1,4 +1,4 @@
1
- import { includes, remove, within } from 'uikit-util';
1
+ import { remove, within } from 'uikit-util';
2
2
  import { attachToElement, createComponent, detachFromElement, getComponent } from './component';
3
3
  import { update } from './global';
4
4
  import { callConnected, callDisconnected, callHook } from './hooks';
@@ -60,7 +60,7 @@ export default function (App) {
60
60
  });
61
61
  }
62
62
 
63
- const ids = [];
63
+ const ids = Object.create(null);
64
64
  export function generateId(instance, el = instance.$el, postfix = '') {
65
65
  if (el.id) {
66
66
  return el.id;
@@ -68,11 +68,11 @@ export function generateId(instance, el = instance.$el, postfix = '') {
68
68
 
69
69
  let id = `${instance.$options.id}-${instance._uid}${postfix}`;
70
70
 
71
- if (includes(ids, id)) {
71
+ if (ids[id]) {
72
72
  id = generateId(instance, el, `${postfix}-2`);
73
73
  }
74
74
 
75
- ids.push(id);
75
+ ids[id] = true;
76
76
 
77
77
  return id;
78
78
  }
@@ -168,12 +168,13 @@ export function coerce(type, value) {
168
168
  return type ? type(value) : value;
169
169
  }
170
170
 
171
+ const listRe = /,(?![^(]*\))/;
171
172
  function toList(value) {
172
173
  return isArray(value)
173
174
  ? value
174
175
  : isString(value)
175
176
  ? value
176
- .split(/,(?![^(]*\))/)
177
+ .split(listRe)
177
178
  .map((value) => (isNumeric(value) ? toNumber(value) : toBoolean(value.trim())))
178
179
  : [value];
179
180
  }
@@ -1,4 +1,5 @@
1
1
  import {
2
+ assign,
2
3
  camelize,
3
4
  data as getData,
4
5
  hasOwn,
@@ -11,23 +12,24 @@ import { registerObserver } from './observer';
11
12
  import { coerce, parseOptions } from './options';
12
13
 
13
14
  export function initProps(instance) {
14
- const props = getProps(instance.$options);
15
+ const { $options, $props } = instance;
16
+ const props = getProps($options);
15
17
 
16
- for (let key in props) {
17
- if (!isUndefined(props[key])) {
18
- instance.$props[key] = props[key];
19
- }
20
- }
18
+ assign($props, props);
21
19
 
22
- const exclude = [instance.$options.computed, instance.$options.methods];
23
- for (let key in instance.$props) {
24
- if (key in props && notIn(exclude, key)) {
25
- instance[key] = instance.$props[key];
20
+ const { computed, methods } = $options;
21
+ for (let key in $props) {
22
+ if (
23
+ key in props &&
24
+ (!computed || !hasOwn(computed, key)) &&
25
+ (!methods || !hasOwn(methods, key))
26
+ ) {
27
+ instance[key] = $props[key];
26
28
  }
27
29
  }
28
30
  }
29
31
 
30
- export function getProps(opts) {
32
+ function getProps(opts) {
31
33
  const data = {};
32
34
  const { args = [], props = {}, el, id } = opts;
33
35
 
@@ -64,10 +66,6 @@ export function getProps(opts) {
64
66
  return data;
65
67
  }
66
68
 
67
- function notIn(options, key) {
68
- return options.every((arr) => !arr || !hasOwn(arr, key));
69
- }
70
-
71
69
  const getAttributes = memoize((id, props) => {
72
70
  const attributes = Object.keys(props);
73
71
  const filter = attributes
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  append,
3
3
  attr,
4
+ data,
4
5
  flipPosition,
5
6
  hasAttr,
6
7
  includes,
@@ -18,6 +19,7 @@ import {
18
19
  within,
19
20
  } from 'uikit-util';
20
21
  import { generateId } from '../api/instance';
22
+ import { parseOptions } from '../api/options';
21
23
  import Container from '../mixin/container';
22
24
  import Position from '../mixin/position';
23
25
  import Togglable from '../mixin/togglable';
@@ -26,48 +28,42 @@ import { keyMap } from '../util/keys';
26
28
  export default {
27
29
  mixins: [Container, Togglable, Position],
28
30
 
29
- args: 'title',
30
-
31
- props: {
32
- delay: Number,
33
- title: String,
34
- },
35
-
36
31
  data: {
37
32
  pos: 'top',
38
- title: '',
39
- delay: 0,
40
33
  animation: ['uk-animation-scale-up'],
41
34
  duration: 100,
42
35
  cls: 'uk-active',
43
36
  },
44
37
 
45
- beforeConnect() {
46
- this.id = generateId(this, {});
47
- this._hasTitle = hasAttr(this.$el, 'title');
48
- attr(this.$el, {
49
- title: '',
50
- 'aria-describedby': this.id,
51
- });
38
+ connected() {
52
39
  makeFocusable(this.$el);
53
40
  },
54
41
 
55
42
  disconnected() {
56
43
  this.hide();
57
-
58
- if (!attr(this.$el, 'title')) {
59
- attr(this.$el, 'title', this._hasTitle ? this.title : null);
60
- }
61
44
  },
62
45
 
63
46
  methods: {
64
47
  show() {
65
- if (this.isToggled(this.tooltip || null) || !this.title) {
48
+ if (this.isToggled(this.tooltip || null)) {
49
+ return;
50
+ }
51
+
52
+ const { delay = 0, title } = parseProps(this.$options);
53
+
54
+ if (!title) {
66
55
  return;
67
56
  }
68
57
 
58
+ this.title = title;
59
+ this.id ||= generateId(this, {});
60
+ this._hasTitle = hasAttr(this.$el, 'title');
61
+ attr(this.$el, { title: null, 'aria-describedby': this.id });
62
+
63
+ once(this.$el, ['blur', pointerLeave], (e) => !isTouch(e) && this.hide());
64
+
69
65
  clearTimeout(this.showTimer);
70
- this.showTimer = setTimeout(this._show, this.delay);
66
+ this.showTimer = setTimeout(this._show, delay);
71
67
  },
72
68
 
73
69
  async hide() {
@@ -81,6 +77,7 @@ export default {
81
77
  await this.toggleElement(this.tooltip, false, false);
82
78
  }
83
79
 
80
+ attr(this.$el, { title: this._hasTitle ? this.title : null, 'aria-describedby': null });
84
81
  remove(this.tooltip);
85
82
  this.tooltip = null;
86
83
  },
@@ -134,19 +131,10 @@ export default {
134
131
  },
135
132
 
136
133
  events: {
137
- focus: 'show',
138
- blur: 'hide',
139
-
140
- [`${pointerEnter} ${pointerLeave}`](e) {
141
- if (!isTouch(e)) {
142
- this[e.type === pointerEnter ? 'show' : 'hide']();
143
- }
144
- },
145
-
146
134
  // Clicking a button does not give it focus on all browsers and platforms
147
135
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#clicking_and_focus
148
- [pointerDown](e) {
149
- if (isTouch(e)) {
136
+ [`focus ${pointerEnter} ${pointerDown}`](e) {
137
+ if (!isTouch(e)) {
150
138
  this.show();
151
139
  }
152
140
  },
@@ -189,3 +177,11 @@ function getAlignment(el, target, [dir, align]) {
189
177
 
190
178
  return [dir, align];
191
179
  }
180
+
181
+ function parseProps(options) {
182
+ const { el, id } = options;
183
+ return ['delay', 'title'].reduce(
184
+ (obj, key) => ({ [key]: data(el, key), ...obj }),
185
+ parseOptions(data(el, id), ['title']),
186
+ );
187
+ }