uikit 3.19.4 → 3.19.5-dev.3a146179f

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 (71) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/css/uikit-core-rtl.css +2 -2
  3. package/dist/css/uikit-core-rtl.min.css +1 -1
  4. package/dist/css/uikit-core.css +2 -2
  5. package/dist/css/uikit-core.min.css +1 -1
  6. package/dist/css/uikit-rtl.css +2 -2
  7. package/dist/css/uikit-rtl.min.css +1 -1
  8. package/dist/css/uikit.css +2 -2
  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 +7 -8
  13. package/dist/js/components/filter.min.js +1 -1
  14. package/dist/js/components/lightbox-panel.js +55 -55
  15. package/dist/js/components/lightbox-panel.min.js +1 -1
  16. package/dist/js/components/lightbox.js +55 -55
  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 +69 -48
  21. package/dist/js/components/parallax.min.js +1 -1
  22. package/dist/js/components/slider-parallax.js +70 -49
  23. package/dist/js/components/slider-parallax.min.js +1 -1
  24. package/dist/js/components/slider.js +71 -51
  25. package/dist/js/components/slider.min.js +1 -1
  26. package/dist/js/components/slideshow-parallax.js +70 -49
  27. package/dist/js/components/slideshow-parallax.min.js +1 -1
  28. package/dist/js/components/slideshow.js +70 -49
  29. package/dist/js/components/slideshow.min.js +1 -1
  30. package/dist/js/components/sortable.js +3 -3
  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 +169 -116
  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 +181 -127
  41. package/dist/js/uikit.min.js +1 -1
  42. package/eslint.config.js +8 -5
  43. package/package.json +3 -4
  44. package/src/js/api/boot.js +6 -7
  45. package/src/js/api/component.js +4 -4
  46. package/src/js/api/computed.js +24 -23
  47. package/src/js/api/observer.js +17 -5
  48. package/src/js/components/filter.js +4 -5
  49. package/src/js/components/slider-parallax.js +2 -2
  50. package/src/js/components/slider.js +1 -1
  51. package/src/js/core/drop.js +1 -8
  52. package/src/js/core/height-placeholder.js +5 -2
  53. package/src/js/core/height-viewport.js +1 -1
  54. package/src/js/core/icon.js +2 -3
  55. package/src/js/core/img.js +1 -1
  56. package/src/js/core/inverse.js +22 -5
  57. package/src/js/core/margin.js +1 -1
  58. package/src/js/core/modal.js +5 -6
  59. package/src/js/core/switcher.js +11 -2
  60. package/src/js/core/toggle.js +8 -4
  61. package/src/js/mixin/parallax.js +7 -3
  62. package/src/js/mixin/slider.js +0 -3
  63. package/src/js/mixin/slideshow.js +3 -0
  64. package/src/js/util/filter.js +1 -11
  65. package/src/js/util/lang.js +1 -1
  66. package/src/js/util/selector.js +66 -38
  67. package/src/js/util/svg.js +1 -12
  68. package/src/less/components/utility.less +1 -1
  69. package/src/scss/components/utility.scss +1 -1
  70. package/tests/modal.html +2 -2
  71. package/build/package.json +0 -4
package/eslint.config.js CHANGED
@@ -1,16 +1,19 @@
1
- const eslintJs = require('@eslint/js');
2
- const eslintConfigPrettier = require('eslint-config-prettier');
3
- const globals = require('globals');
1
+ import eslintJs from '@eslint/js';
2
+ import eslintConfigPrettier from 'eslint-config-prettier';
3
+ import globals from 'globals';
4
4
 
5
- module.exports = [
5
+ export default [
6
6
  eslintJs.configs.recommended,
7
7
  eslintConfigPrettier,
8
+ {
9
+ ignores: ['*', '!src/', '!src/*', '!src/js', '!build/', 'build/*', '!build/*.js'],
10
+ },
8
11
  {
9
12
  rules: {
10
13
  'no-unused-vars': ['error', { caughtErrors: 'none' }],
11
14
  },
12
15
  languageOptions: {
13
- ecmaVersion: 2022,
16
+ ecmaVersion: 'latest',
14
17
  sourceType: 'module',
15
18
  globals: {
16
19
  ...globals.browser,
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.19.4",
5
+ "version": "3.19.5-dev.3a146179f",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -10,6 +10,7 @@
10
10
  "./src/js/*.js",
11
11
  "./dist/**/*.js"
12
12
  ],
13
+ "type": "module",
13
14
  "repository": {
14
15
  "type": "git",
15
16
  "url": "git+https://github.com/uikit/uikit.git"
@@ -60,8 +61,6 @@
60
61
  "prefix": "node build/prefix",
61
62
  "scope": "node build/scope",
62
63
  "release": "node build/release",
63
- "watch": "chokidar \"**/*.less\" --initial -i \"node_modules\" -c \"node build/less\"",
64
- "eslint": "eslint src/js build/*.js",
65
- "eslint-fix": "eslint --fix src/js build/*.js"
64
+ "watch": "chokidar \"**/*.less\" --initial -i \"node_modules\" -c \"node build/less\""
66
65
  }
67
66
  }
@@ -1,4 +1,4 @@
1
- import { apply, hasAttr, inBrowser, isPlainObject, startsWith, trigger } from 'uikit-util';
1
+ import { apply, hasAttr, inBrowser, startsWith, trigger } from 'uikit-util';
2
2
  import { components, createComponent, getComponent, getComponents } from './component';
3
3
  import { callConnected, callDisconnected } from './hooks';
4
4
 
@@ -53,16 +53,15 @@ function applyAttributeMutation({ target, attributeName }) {
53
53
  if (name) {
54
54
  if (hasAttr(target, attributeName)) {
55
55
  createComponent(name, target);
56
- return;
56
+ } else {
57
+ getComponent(target, name)?.$destroy();
57
58
  }
58
-
59
- getComponent(target, name)?.$destroy();
60
59
  }
61
60
  }
62
61
 
63
62
  function connect(node) {
64
63
  const components = getComponents(node);
65
- for (const name in getComponents(node)) {
64
+ for (const name in components) {
66
65
  callConnected(components[name]);
67
66
  }
68
67
 
@@ -74,7 +73,7 @@ function connect(node) {
74
73
 
75
74
  function disconnect(node) {
76
75
  const components = getComponents(node);
77
- for (const name in getComponents(node)) {
76
+ for (const name in components) {
78
77
  callDisconnected(components[name]);
79
78
  }
80
79
  }
@@ -85,5 +84,5 @@ function getComponentName(attribute) {
85
84
  }
86
85
 
87
86
  const cmp = components[attribute];
88
- return cmp && (isPlainObject(cmp) ? cmp : cmp.options).name;
87
+ return cmp && (cmp.options || cmp).name;
89
88
  }
@@ -1,4 +1,4 @@
1
- import { $$, camelize, hyphenate, isEmpty, isPlainObject } from 'uikit-util';
1
+ import { camelize, findAll, hyphenate, isEmpty, isPlainObject } from 'uikit-util';
2
2
  import App from './app';
3
3
 
4
4
  const PREFIX = 'uk-';
@@ -10,7 +10,7 @@ export function component(name, options) {
10
10
  const id = PREFIX + hyphenate(name);
11
11
 
12
12
  if (!options) {
13
- if (isPlainObject(components[id])) {
13
+ if (!components[id].options) {
14
14
  components[id] = App.extend(components[id]);
15
15
  }
16
16
 
@@ -21,7 +21,7 @@ export function component(name, options) {
21
21
 
22
22
  App[name] = (element, data) => createComponent(name, element, data);
23
23
 
24
- const opt = isPlainObject(options) ? { ...options } : options.options;
24
+ const opt = options.options ?? { ...options };
25
25
 
26
26
  opt.id = id;
27
27
  opt.name = name;
@@ -41,7 +41,7 @@ export function createComponent(name, element, data, ...args) {
41
41
  return Component.options.functional
42
42
  ? new Component({ data: isPlainObject(element) ? element : [element, data, ...args] })
43
43
  : element
44
- ? $$(element).map(init)[0]
44
+ ? findAll(element).map(init)[0]
45
45
  : init();
46
46
 
47
47
  function init(element) {
@@ -1,6 +1,6 @@
1
- import { hasOwn, isUndefined } from 'uikit-util';
2
- import { callUpdate, prependUpdate } from './update';
3
- import { runWatches } from './watch';
1
+ import { hasOwn, isUndefined, observeMutation } from 'uikit-util';
2
+ import { callUpdate, prependUpdate } from './update.js';
3
+ import { runWatches } from './watch.js';
4
4
 
5
5
  export function initComputed(instance) {
6
6
  const { computed } = instance.$options;
@@ -13,7 +13,7 @@ export function initComputed(instance) {
13
13
  }
14
14
  }
15
15
  }
16
-
16
+ const mutationOptions = { subtree: true, childList: true };
17
17
  export function registerComputed(instance, key, cb) {
18
18
  instance._hasComputed = true;
19
19
  Object.defineProperty(instance, key, {
@@ -24,6 +24,15 @@ export function registerComputed(instance, key, cb) {
24
24
 
25
25
  if (!hasOwn(_computed, key)) {
26
26
  _computed[key] = (cb.get || cb).call(instance, $props, $el);
27
+ if (cb.observe && instance._computedObserver) {
28
+ const observeEl = cb.observe.call(instance, _computed[key]);
29
+ if (observeEl && observeEl !== $el) {
30
+ instance._computedObserver.observe(
31
+ findClosestCommonParent(observeEl, $el),
32
+ mutationOptions,
33
+ );
34
+ }
35
+ }
27
36
  }
28
37
 
29
38
  return _computed[key];
@@ -51,12 +60,16 @@ export function initComputedUpdates(instance) {
51
60
  events: ['resize', 'computed'],
52
61
  });
53
62
 
54
- registerComputedObserver();
55
- instances.add(instance);
63
+ instance._computedObserver = observeMutation(
64
+ instance.$el,
65
+ () => callUpdate(instance, 'computed'),
66
+ mutationOptions,
67
+ );
56
68
  }
57
69
 
58
70
  export function disconnectComputedUpdates(instance) {
59
- instances?.delete(instance);
71
+ instance._computedObserver?.disconnect();
72
+ delete instance._computedObserver;
60
73
  resetComputed(instance);
61
74
  }
62
75
 
@@ -66,21 +79,9 @@ function resetComputed(instance) {
66
79
  return values;
67
80
  }
68
81
 
69
- let observer;
70
- let instances;
71
- function registerComputedObserver() {
72
- if (observer) {
73
- return;
82
+ function findClosestCommonParent(el1, el2) {
83
+ while (el1 && !el1.contains(el2)) {
84
+ el1 = el1.parentNode;
74
85
  }
75
-
76
- instances = new Set();
77
- observer = new MutationObserver(() => {
78
- for (const instance of instances) {
79
- callUpdate(instance, 'computed');
80
- }
81
- });
82
- observer.observe(document, {
83
- subtree: true,
84
- childList: true,
85
- });
86
+ return el1;
86
87
  }
@@ -46,21 +46,33 @@ function registerObservable(instance, observable) {
46
46
  const targets = hasOwn(instance, key) ? instance[key] : target;
47
47
  const observer = observe(targets, handler, options, args);
48
48
 
49
- if (isFunction(target) && isArray(instance[key]) && observer.unobserve) {
50
- registerWatch(instance, { handler: updateTargets(observer), immediate: false }, key);
49
+ if (isFunction(target) && isArray(instance[key])) {
50
+ registerWatch(
51
+ instance,
52
+ { handler: updateTargets(observer, options), immediate: false },
53
+ key,
54
+ );
51
55
  }
52
56
 
53
57
  registerObserver(instance, observer);
54
58
  }
55
59
 
56
- function updateTargets(observer) {
60
+ function updateTargets(observer, options) {
57
61
  return (targets, prev) => {
58
62
  for (const target of prev) {
59
- !includes(targets, target) && observer.unobserve(target);
63
+ if (!includes(targets, target)) {
64
+ if (observer.unobserve) {
65
+ observer.unobserve(target);
66
+ } else if (observer.observe) {
67
+ observer.disconnect();
68
+ }
69
+ }
60
70
  }
61
71
 
62
72
  for (const target of targets) {
63
- !includes(prev, target) && observer.observe(target);
73
+ if (!includes(prev, target) || !observer.unobserve) {
74
+ observer.observe(target, options);
75
+ }
64
76
  }
65
77
  };
66
78
  }
@@ -118,10 +118,7 @@ export default {
118
118
 
119
119
  await Promise.all(
120
120
  $$(this.target, this.$el).map((target) => {
121
- const filterFn = () => {
122
- applyState(state, target, getChildren(target));
123
- this.$update(this.$el);
124
- };
121
+ const filterFn = () => applyState(state, target, getChildren(target));
125
122
  return animate ? this.animate(filterFn, target) : filterFn();
126
123
  }),
127
124
  );
@@ -146,7 +143,9 @@ function isEqualState(stateA, stateB) {
146
143
  function applyState(state, target, children) {
147
144
  const selector = getSelector(state);
148
145
 
149
- children.forEach((el) => css(el, 'display', selector && !matches(el, selector) ? 'none' : ''));
146
+ for (const el of children) {
147
+ css(el, 'display', selector && !matches(el, selector) ? 'none' : '');
148
+ }
150
149
 
151
150
  const [sort, order] = state.sort;
152
151
 
@@ -1,11 +1,11 @@
1
- import { closest, css, endsWith, fastdom, noop, Transition } from 'uikit-util';
1
+ import { css, endsWith, fastdom, noop, Transition } from 'uikit-util';
2
2
  import Parallax from '../mixin/parallax';
3
3
 
4
4
  export default {
5
5
  mixins: [Parallax],
6
6
 
7
7
  beforeConnect() {
8
- this.item = closest(this.$el, `.${this.$options.id.replace('parallax', 'items')} > *`);
8
+ this.item = this.$el.closest(`.${this.$options.id.replace('parallax', 'items')} > *`);
9
9
  },
10
10
 
11
11
  disconnected() {
@@ -129,7 +129,7 @@ export default {
129
129
  },
130
130
 
131
131
  observe: resize({
132
- target: ({ slides }) => slides,
132
+ target: ({ slides, $el }) => [$el, ...slides],
133
133
  }),
134
134
 
135
135
  update: {
@@ -27,9 +27,7 @@ import {
27
27
  pointerUp,
28
28
  query,
29
29
  removeClass,
30
- within,
31
30
  } from 'uikit-util';
32
- import { lazyload } from '../api/observables';
33
31
  import Container from '../mixin/container';
34
32
  import Position from '../mixin/position';
35
33
  import Togglable from '../mixin/togglable';
@@ -129,11 +127,6 @@ export default {
129
127
  css(this.$el, this._style);
130
128
  },
131
129
 
132
- observe: lazyload({
133
- target: ({ toggle, $el }) => query(toggle, $el),
134
- targets: ({ $el }) => $el,
135
- }),
136
-
137
130
  events: [
138
131
  {
139
132
  name: 'click',
@@ -519,7 +512,7 @@ function listenForBackgroundClose(drop) {
519
512
  !defaultPrevented &&
520
513
  type === pointerUp &&
521
514
  target === newTarget &&
522
- !(drop.targetEl && within(target, drop.targetEl))
515
+ !drop.targetEl?.contains(target)
523
516
  ) {
524
517
  drop.hide(false);
525
518
  }
@@ -1,4 +1,4 @@
1
- import { css, query } from 'uikit-util';
1
+ import { css, parent, query } from 'uikit-util';
2
2
  import { resize } from '../api/observables';
3
3
 
4
4
  export default {
@@ -13,7 +13,10 @@ export default {
13
13
  },
14
14
 
15
15
  computed: {
16
- target: ({ target }, $el) => query(target, $el),
16
+ target: {
17
+ get: ({ target }, $el) => query(target, $el),
18
+ observe: (target) => parent(target),
19
+ },
17
20
  },
18
21
 
19
22
  observe: resize({ target: ({ target }) => target }),
@@ -68,7 +68,7 @@ export default {
68
68
  offsetPosition(offsetTopEl)[0] - offsetPosition(scrollElement)[0];
69
69
  minHeight += top > 0 && top < viewportHeight / 2 ? ` - ${top}px` : '';
70
70
  } else {
71
- minHeight += ` - ${css(scrollElement, 'paddingTop')}`;
71
+ minHeight += ` - ${boxModelAdjust(scrollElement, 'height', css(scrollElement, 'boxSizing'))}px`;
72
72
  }
73
73
  }
74
74
 
@@ -3,7 +3,6 @@ import {
3
3
  addClass,
4
4
  apply,
5
5
  attr,
6
- closest,
7
6
  css,
8
7
  each,
9
8
  hasAttr,
@@ -126,9 +125,9 @@ export const Search = {
126
125
  hasClass(this.$el, 'uk-search-toggle') || hasClass(this.$el, 'uk-navbar-toggle');
127
126
  this.icon = isToggle
128
127
  ? 'search-toggle-icon'
129
- : hasClass(this.$el, 'uk-search-icon') && closest(this.$el, '.uk-search-large')
128
+ : hasClass(this.$el, 'uk-search-icon') && this.$el.closest('.uk-search-large')
130
129
  ? 'search-large'
131
- : closest(this.$el, '.uk-search-navbar')
130
+ : this.$el.closest('.uk-search-navbar')
132
131
  ? 'search-navbar'
133
132
  : this.$props.icon;
134
133
 
@@ -56,13 +56,13 @@ export default {
56
56
  },
57
57
 
58
58
  observe: intersection({
59
- target: ({ $el, $props }) => [$el, ...queryAll($props.target, $el)],
60
59
  handler(entries, observer) {
61
60
  this.load();
62
61
  observer.disconnect();
63
62
  },
64
63
  options: ({ margin }) => ({ rootMargin: margin }),
65
64
  filter: ({ loading }) => loading === 'lazy',
65
+ target: ({ $el, $props }) => ($props.target ? [$el, ...queryAll($props.target, $el)] : $el),
66
66
  }),
67
67
 
68
68
  methods: {
@@ -1,5 +1,5 @@
1
- import { $$, css, dimensions, matches, observeResize, on, replaceClass } from 'uikit-util';
2
- import { mutation } from '../api/observables';
1
+ import { $$, css, dimensions, matches, observeResize, on, replaceClass, toNodes } from 'uikit-util';
2
+ import { intersection, mutation } from '../api/observables';
3
3
 
4
4
  export default {
5
5
  props: {
@@ -13,10 +13,18 @@ export default {
13
13
  },
14
14
 
15
15
  computed: {
16
- target: ({ target }, $el) => (target ? $$(target, $el) : [$el]),
16
+ target: ({ target }, $el) => (target ? $$(target, $el) : $el),
17
17
  },
18
18
 
19
19
  observe: [
20
+ intersection({
21
+ handler(entries) {
22
+ this.isIntersecting = entries.some(({ isIntersecting }) => isIntersecting);
23
+ this.$emit();
24
+ },
25
+ target: ({ target }) => target,
26
+ args: { intersecting: false },
27
+ }),
20
28
  mutation({
21
29
  target: ({ target }) => target,
22
30
  options: { attributes: true, attributeFilter: ['class'], attributeOldValue: true },
@@ -24,7 +32,10 @@ export default {
24
32
  {
25
33
  target: ({ target }) => target,
26
34
  observe: (target, handler) => {
27
- const observer = observeResize([...target, document.documentElement], handler);
35
+ const observer = observeResize(
36
+ [...toNodes(target), document.documentElement],
37
+ handler,
38
+ );
28
39
  const listener = [
29
40
  on(document, 'scroll itemshown itemhidden', handler, {
30
41
  passive: true,
@@ -41,6 +52,8 @@ export default {
41
52
  ];
42
53
 
43
54
  return {
55
+ observe: observer.observe.bind(observer),
56
+ unobserve: observer.unobserve.bind(observer),
44
57
  disconnect() {
45
58
  observer.disconnect();
46
59
  listener.map((off) => off());
@@ -55,7 +68,11 @@ export default {
55
68
 
56
69
  update: {
57
70
  read() {
58
- for (const target of this.target) {
71
+ if (!this.isIntersecting) {
72
+ return false;
73
+ }
74
+
75
+ for (const target of toNodes(this.target)) {
59
76
  replaceClass(
60
77
  target,
61
78
  'uk-light,uk-dark',
@@ -15,10 +15,10 @@ export default {
15
15
  observe: [
16
16
  mutation({
17
17
  options: {
18
- childList: true,
19
18
  attributes: true,
20
19
  attributeFilter: ['style'],
21
20
  },
21
+ target: ({ $el }) => [$el, ...children($el)],
22
22
  }),
23
23
  resize({
24
24
  target: ({ $el }) => [$el, ...children($el)],
@@ -70,12 +70,11 @@ export default {
70
70
 
71
71
  function install({ modal }) {
72
72
  modal.dialog = function (content, options) {
73
- const dialog = modal(
74
- `<div class="uk-modal">
75
- <div class="uk-modal-dialog">${content}</div>
76
- </div>`,
77
- { stack: true, role: 'alertdialog', ...options },
78
- );
73
+ const dialog = modal($(`<div><div class="uk-modal-dialog">${content}</div></div>`), {
74
+ stack: true,
75
+ role: 'alertdialog',
76
+ ...options,
77
+ });
79
78
 
80
79
  dialog.show();
81
80
 
@@ -10,7 +10,9 @@ import {
10
10
  hasClass,
11
11
  includes,
12
12
  isNode,
13
+ isTag,
13
14
  matches,
15
+ parent,
14
16
  queryAll,
15
17
  toArray,
16
18
  toggleClass,
@@ -49,7 +51,10 @@ export default {
49
51
  },
50
52
 
51
53
  computed: {
52
- connects: ({ connect }, $el) => queryAll(connect, $el),
54
+ connects: {
55
+ get: ({ connect }, $el) => queryAll(connect, $el),
56
+ observe: (connects) => parent(connects[0]),
57
+ },
53
58
 
54
59
  connectChildren() {
55
60
  return this.connects.map((el) => children(el)).flat();
@@ -188,7 +193,11 @@ export default {
188
193
  ],
189
194
 
190
195
  update() {
191
- attr(this.connects, 'role', 'presentation');
196
+ for (const el of this.connects) {
197
+ if (isTag(el, 'ul')) {
198
+ attr(el, 'role', 'presentation');
199
+ }
200
+ }
192
201
  attr(children(this.$el), 'role', 'presentation');
193
202
 
194
203
  for (const index in this.toggles) {
@@ -9,6 +9,7 @@ import {
9
9
  isTouch,
10
10
  matches,
11
11
  once,
12
+ parent,
12
13
  pointerDown,
13
14
  pointerEnter,
14
15
  pointerLeave,
@@ -41,9 +42,12 @@ export default {
41
42
  },
42
43
 
43
44
  computed: {
44
- target({ target }, $el) {
45
- target = queryAll(target || $el.hash, $el);
46
- return target.length ? target : [$el];
45
+ target: {
46
+ get: ({ target }, $el) => {
47
+ target = queryAll(target || $el.hash, $el);
48
+ return target.length ? target : [$el];
49
+ },
50
+ observe: (target) => parent(target[0]),
47
51
  },
48
52
  },
49
53
 
@@ -58,7 +62,7 @@ export default {
58
62
  }
59
63
  },
60
64
 
61
- observe: lazyload({ target: ({ target }) => target }),
65
+ observe: lazyload({ targets: ({ target }) => target }),
62
66
 
63
67
  events: [
64
68
  {
@@ -7,6 +7,7 @@ import {
7
7
  isString,
8
8
  isUndefined,
9
9
  noop,
10
+ once,
10
11
  propName,
11
12
  toFloat,
12
13
  toPx,
@@ -271,6 +272,7 @@ function setBackgroundPosFn(bgProps, positions, props) {
271
272
  };
272
273
  }
273
274
 
275
+ const loading = {};
274
276
  const dimensions = {};
275
277
  function getBackgroundImageDimensions(el) {
276
278
  const src = css(el, 'backgroundImage').replace(/^none|url\(["']?(.+?)["']?\)$/, '$1');
@@ -283,11 +285,13 @@ function getBackgroundImageDimensions(el) {
283
285
  if (src) {
284
286
  image.src = src;
285
287
 
286
- if (!image.naturalWidth) {
287
- image.onload = () => {
288
+ if (!image.naturalWidth && !loading[src]) {
289
+ once(image, 'error load', () => {
288
290
  dimensions[src] = toDimensions(image);
289
291
  trigger(el, createEvent('load', false));
290
- };
292
+ });
293
+ loading[src] = true;
294
+
291
295
  return toDimensions(image);
292
296
  }
293
297
  }
@@ -10,7 +10,6 @@ import {
10
10
  removeClass,
11
11
  trigger,
12
12
  } from 'uikit-util';
13
- import { resize } from '../api/observables';
14
13
  import I18n from './i18n';
15
14
  import SliderAutoplay from './slider-autoplay';
16
15
  import SliderDrag from './slider-drag';
@@ -80,8 +79,6 @@ export default {
80
79
  },
81
80
  },
82
81
 
83
- observe: resize(),
84
-
85
82
  events: {
86
83
  itemshow({ target }) {
87
84
  addClass(target, this.clsEnter, this.clsSlideActive);
@@ -1,4 +1,5 @@
1
1
  import { addClass, removeClass } from 'uikit-util';
2
+ import { resize } from '../api/observables.js';
2
3
  import Animations from './internal/slideshow-animations';
3
4
  import Transitioner from './internal/slideshow-transitioner';
4
5
  import Slider from './slider.js';
@@ -27,6 +28,8 @@ export default {
27
28
  },
28
29
  },
29
30
 
31
+ observe: resize(),
32
+
30
33
  events: {
31
34
  beforeitemshow({ target }) {
32
35
  addClass(target, this.clsActive);
@@ -1,4 +1,4 @@
1
- import { isString, startsWith, toArray, toNode, toNodes } from './lang';
1
+ import { toArray, toNode, toNodes } from './lang';
2
2
 
3
3
  const voidElements = {
4
4
  area: true,
@@ -49,16 +49,6 @@ export function matches(element, selector) {
49
49
  return toNodes(element).some((element) => element.matches(selector));
50
50
  }
51
51
 
52
- export function closest(element, selector) {
53
- return toNode(element)?.closest(startsWith(selector, '>') ? selector.slice(1) : selector);
54
- }
55
-
56
- export function within(element, selector) {
57
- return isString(selector)
58
- ? !!closest(element, selector)
59
- : toNode(selector).contains(toNode(element));
60
- }
61
-
62
52
  export function parents(element, selector) {
63
53
  const elements = [];
64
54
 
@@ -111,7 +111,7 @@ export function toFloat(value) {
111
111
  }
112
112
 
113
113
  export function toNode(element) {
114
- return toNodes(element)[0];
114
+ return element && toNodes(element)[0];
115
115
  }
116
116
 
117
117
  export function toNodes(element) {