uikit 3.19.5-dev.8317c4705 → 3.19.5-dev.a8d51a358

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 (53) hide show
  1. package/dist/css/uikit-core-rtl.css +1 -1
  2. package/dist/css/uikit-core-rtl.min.css +1 -1
  3. package/dist/css/uikit-core.css +1 -1
  4. package/dist/css/uikit-core.min.css +1 -1
  5. package/dist/css/uikit-rtl.css +1 -1
  6. package/dist/css/uikit-rtl.min.css +1 -1
  7. package/dist/css/uikit.css +1 -1
  8. package/dist/css/uikit.min.css +1 -1
  9. package/dist/js/components/countdown.js +1 -1
  10. package/dist/js/components/countdown.min.js +1 -1
  11. package/dist/js/components/filter.js +1 -1
  12. package/dist/js/components/filter.min.js +1 -1
  13. package/dist/js/components/lightbox-panel.js +55 -55
  14. package/dist/js/components/lightbox-panel.min.js +1 -1
  15. package/dist/js/components/lightbox.js +55 -55
  16. package/dist/js/components/lightbox.min.js +1 -1
  17. package/dist/js/components/notification.js +1 -1
  18. package/dist/js/components/notification.min.js +1 -1
  19. package/dist/js/components/parallax.js +11 -18
  20. package/dist/js/components/parallax.min.js +1 -1
  21. package/dist/js/components/slider-parallax.js +11 -18
  22. package/dist/js/components/slider-parallax.min.js +1 -1
  23. package/dist/js/components/slider.js +12 -20
  24. package/dist/js/components/slider.min.js +1 -1
  25. package/dist/js/components/slideshow-parallax.js +11 -18
  26. package/dist/js/components/slideshow-parallax.min.js +1 -1
  27. package/dist/js/components/slideshow.js +12 -19
  28. package/dist/js/components/slideshow.min.js +1 -1
  29. package/dist/js/components/sortable.js +1 -1
  30. package/dist/js/components/sortable.min.js +1 -1
  31. package/dist/js/components/tooltip.js +1 -1
  32. package/dist/js/components/tooltip.min.js +1 -1
  33. package/dist/js/components/upload.js +1 -1
  34. package/dist/js/components/upload.min.js +1 -1
  35. package/dist/js/uikit-core.js +61 -40
  36. package/dist/js/uikit-core.min.js +1 -1
  37. package/dist/js/uikit-icons.js +1 -1
  38. package/dist/js/uikit-icons.min.js +1 -1
  39. package/dist/js/uikit.js +63 -42
  40. package/dist/js/uikit.min.js +1 -1
  41. package/package.json +1 -1
  42. package/src/js/api/boot.js +6 -7
  43. package/src/js/api/component.js +4 -4
  44. package/src/js/api/observer.js +17 -5
  45. package/src/js/components/slider.js +1 -1
  46. package/src/js/core/height-viewport.js +1 -1
  47. package/src/js/core/img.js +1 -1
  48. package/src/js/core/inverse.js +22 -5
  49. package/src/js/mixin/slider.js +0 -3
  50. package/src/js/mixin/slideshow.js +3 -0
  51. package/src/js/util/lang.js +1 -1
  52. package/src/js/util/selector.js +5 -5
  53. package/src/js/util/svg.js +1 -12
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.5-dev.8317c4705",
5
+ "version": "3.19.5-dev.a8d51a358",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -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) {
@@ -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
  }
@@ -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: {
@@ -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
 
@@ -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',
@@ -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);
@@ -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) {
@@ -1,5 +1,5 @@
1
1
  import { attr } from './attr';
2
- import { index, matches, parent } from './filter';
2
+ import { index, matches } from './filter';
3
3
  import { isDocument, isString, memoize, toNode, toNodes } from './lang';
4
4
 
5
5
  export function query(selector, context) {
@@ -33,7 +33,7 @@ const parseSelector = memoize((selector) => {
33
33
  let isContextSelector = false;
34
34
 
35
35
  const selectors = [];
36
- for (let sel of selector.match(splitSelectorRe)) {
36
+ for (let sel of selector.match(splitSelectorRe) ?? []) {
37
37
  sel = sel.replace(trailingCommaRe, '').trim();
38
38
  if (sel[0] === '>') {
39
39
  sel = `:scope ${sel}`;
@@ -67,7 +67,7 @@ function _query(selector, context = document, queryFn) {
67
67
 
68
68
  if (sel[0] === '!') {
69
69
  const selectors = sel.substr(1).trim().split(' ');
70
- ctx = parent(context).closest(selectors[0]);
70
+ ctx = context.parentElement.closest(selectors[0]);
71
71
  sel = selectors.slice(1).join(' ').trim();
72
72
  if (!sel.length && isSingle) {
73
73
  return ctx;
@@ -84,9 +84,9 @@ function _query(selector, context = document, queryFn) {
84
84
  }
85
85
  } else if (sel[0] === '~' || (sel[0] === '+' && isSingle)) {
86
86
  return _doQuery(
87
- parent(context),
87
+ ctx.parentElement,
88
88
  queryFn,
89
- `:scope :nth-child(${index(context) + 1}) ${sel}`,
89
+ `:scope :nth-child(${index(ctx) + 1}) ${sel}`,
90
90
  );
91
91
  }
92
92
 
@@ -1,16 +1,5 @@
1
1
  import { $$ } from './dom';
2
2
 
3
3
  export function getMaxPathLength(el) {
4
- return Math.ceil(
5
- Math.max(
6
- 0,
7
- ...$$('[stroke]', el).map((stroke) => {
8
- try {
9
- return stroke.getTotalLength();
10
- } catch (e) {
11
- return 0;
12
- }
13
- }),
14
- ),
15
- );
4
+ return Math.ceil(Math.max(0, ...$$('[stroke]', el).map((stroke) => stroke.getTotalLength?.())));
16
5
  }