uikit 3.11.2-dev.31cd2ba38 → 3.11.2-dev.3dfa2c50b

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 (168) hide show
  1. package/.eslintrc.json +4 -49
  2. package/.prettierignore +14 -0
  3. package/.prettierrc.json +13 -0
  4. package/.webstorm.js +3 -3
  5. package/CHANGELOG.md +7 -11
  6. package/build/.eslintrc.json +1 -3
  7. package/build/build.js +26 -28
  8. package/build/icons.js +7 -11
  9. package/build/less.js +48 -36
  10. package/build/package.json +2 -2
  11. package/build/prefix.js +21 -18
  12. package/build/publishDev.js +6 -8
  13. package/build/release.js +20 -17
  14. package/build/scope.js +21 -11
  15. package/build/scss.js +72 -39
  16. package/build/util.js +71 -62
  17. package/build/wrapper/icons.js +0 -2
  18. package/dist/css/uikit-core-rtl.css +42 -17
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +42 -17
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +42 -17
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +42 -17
  25. package/dist/css/uikit.min.css +1 -1
  26. package/dist/js/components/countdown.js +88 -133
  27. package/dist/js/components/countdown.min.js +1 -1
  28. package/dist/js/components/filter.js +409 -438
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1116 -1305
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1164 -1383
  33. package/dist/js/components/lightbox.min.js +1 -1
  34. package/dist/js/components/notification.js +94 -114
  35. package/dist/js/components/notification.min.js +1 -1
  36. package/dist/js/components/parallax.js +294 -345
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +292 -344
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +727 -850
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +292 -344
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +615 -799
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +588 -619
  47. package/dist/js/components/sortable.min.js +1 -1
  48. package/dist/js/components/tooltip.js +324 -356
  49. package/dist/js/components/tooltip.min.js +1 -1
  50. package/dist/js/components/upload.js +155 -167
  51. package/dist/js/components/upload.min.js +1 -1
  52. package/dist/js/uikit-core.js +5266 -6572
  53. package/dist/js/uikit-core.min.js +1 -1
  54. package/dist/js/uikit-icons.js +7 -9
  55. package/dist/js/uikit-icons.min.js +1 -1
  56. package/dist/js/uikit.js +8126 -9876
  57. package/dist/js/uikit.min.js +1 -1
  58. package/jsconfig.json +1 -1
  59. package/package.json +64 -60
  60. package/src/js/api/boot.js +25 -32
  61. package/src/js/api/component.js +23 -27
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +13 -32
  64. package/src/js/api/instance.js +7 -15
  65. package/src/js/api/state.js +79 -100
  66. package/src/js/components/countdown.js +24 -50
  67. package/src/js/components/filter.js +71 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +11 -23
  70. package/src/js/components/internal/slider-transitioner.js +66 -45
  71. package/src/js/components/internal/slideshow-animations.js +42 -61
  72. package/src/js/components/lightbox-panel.js +135 -109
  73. package/src/js/components/lightbox.js +18 -39
  74. package/src/js/components/notification.js +49 -43
  75. package/src/js/components/parallax.js +16 -30
  76. package/src/js/components/slider-parallax.js +13 -23
  77. package/src/js/components/slider.js +75 -64
  78. package/src/js/components/slideshow-parallax.js +1 -1
  79. package/src/js/components/slideshow.js +8 -13
  80. package/src/js/components/sortable.js +125 -106
  81. package/src/js/components/tooltip.js +41 -31
  82. package/src/js/components/upload.js +52 -63
  83. package/src/js/core/accordion.js +53 -48
  84. package/src/js/core/alert.js +10 -17
  85. package/src/js/core/core.js +74 -53
  86. package/src/js/core/cover.js +11 -15
  87. package/src/js/core/drop.js +106 -92
  88. package/src/js/core/form-custom.js +20 -25
  89. package/src/js/core/gif.js +3 -7
  90. package/src/js/core/grid.js +57 -58
  91. package/src/js/core/height-match.js +16 -29
  92. package/src/js/core/height-viewport.js +28 -35
  93. package/src/js/core/icon.js +38 -50
  94. package/src/js/core/img.js +130 -105
  95. package/src/js/core/index.js +39 -39
  96. package/src/js/core/leader.js +9 -18
  97. package/src/js/core/margin.js +21 -37
  98. package/src/js/core/modal.js +50 -36
  99. package/src/js/core/nav.js +2 -4
  100. package/src/js/core/navbar.js +112 -88
  101. package/src/js/core/offcanvas.js +49 -53
  102. package/src/js/core/overflow-auto.js +13 -17
  103. package/src/js/core/responsive.js +14 -12
  104. package/src/js/core/scroll.js +10 -20
  105. package/src/js/core/scrollspy-nav.js +34 -31
  106. package/src/js/core/scrollspy.js +37 -54
  107. package/src/js/core/sticky.js +130 -91
  108. package/src/js/core/svg.js +60 -79
  109. package/src/js/core/switcher.js +47 -46
  110. package/src/js/core/tab.js +7 -10
  111. package/src/js/core/toggle.js +64 -66
  112. package/src/js/core/video.js +11 -22
  113. package/src/js/mixin/animate.js +19 -20
  114. package/src/js/mixin/class.js +2 -4
  115. package/src/js/mixin/container.js +7 -11
  116. package/src/js/mixin/internal/animate-fade.js +73 -30
  117. package/src/js/mixin/internal/animate-slide.js +61 -41
  118. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  119. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  120. package/src/js/mixin/media.js +5 -10
  121. package/src/js/mixin/modal.js +89 -66
  122. package/src/js/mixin/parallax.js +53 -48
  123. package/src/js/mixin/position.js +26 -20
  124. package/src/js/mixin/slider-autoplay.js +12 -21
  125. package/src/js/mixin/slider-drag.js +64 -65
  126. package/src/js/mixin/slider-nav.js +26 -35
  127. package/src/js/mixin/slider-reactive.js +2 -8
  128. package/src/js/mixin/slider.js +51 -50
  129. package/src/js/mixin/slideshow.js +13 -19
  130. package/src/js/mixin/togglable.js +90 -63
  131. package/src/js/uikit-core.js +2 -4
  132. package/src/js/uikit.js +2 -4
  133. package/src/js/util/ajax.js +27 -43
  134. package/src/js/util/animation.js +82 -75
  135. package/src/js/util/attr.js +17 -21
  136. package/src/js/util/class.js +14 -52
  137. package/src/js/util/dimensions.js +56 -43
  138. package/src/js/util/dom.js +40 -73
  139. package/src/js/util/env.js +7 -12
  140. package/src/js/util/event.js +60 -59
  141. package/src/js/util/fastdom.js +1 -6
  142. package/src/js/util/filter.js +17 -34
  143. package/src/js/util/index.js +0 -1
  144. package/src/js/util/lang.js +79 -119
  145. package/src/js/util/mouse.js +19 -17
  146. package/src/js/util/options.js +42 -47
  147. package/src/js/util/player.js +40 -36
  148. package/src/js/util/position.js +54 -46
  149. package/src/js/util/promise.js +0 -191
  150. package/src/js/util/selector.js +39 -48
  151. package/src/js/util/style.js +36 -46
  152. package/src/js/util/viewport.js +75 -64
  153. package/src/less/components/flex.less +0 -9
  154. package/src/less/components/navbar.less +0 -7
  155. package/src/less/components/utility.less +22 -0
  156. package/src/scss/components/flex.scss +0 -9
  157. package/src/scss/components/form.scss +3 -3
  158. package/src/scss/components/icon.scss +2 -2
  159. package/src/scss/components/navbar.scss +0 -7
  160. package/src/scss/components/search.scss +1 -1
  161. package/src/scss/components/utility.scss +22 -0
  162. package/src/scss/variables-theme.scss +6 -6
  163. package/src/scss/variables.scss +6 -6
  164. package/tests/image.html +38 -22
  165. package/tests/js/index.js +114 -85
  166. package/src/js/mixin/flex-bug.js +0 -56
  167. package/tests/images/test.avif +0 -0
  168. package/tests/images/test.webp +0 -0
@@ -1,28 +1,23 @@
1
1
  import LightboxPanel from './lightbox-panel';
2
- import {$$, assign, data, findIndex, isElement, on, parseOptions, uniqueBy} from 'uikit-util';
2
+ import { $$, assign, data, findIndex, isElement, on, parseOptions, uniqueBy } from 'uikit-util';
3
3
 
4
4
  export default {
5
-
6
5
  install,
7
6
 
8
- props: {toggle: String},
7
+ props: { toggle: String },
9
8
 
10
- data: {toggle: 'a'},
9
+ data: { toggle: 'a' },
11
10
 
12
11
  computed: {
13
-
14
12
  toggles: {
15
-
16
- get({toggle}, $el) {
13
+ get({ toggle }, $el) {
17
14
  return $$(toggle, $el);
18
15
  },
19
16
 
20
17
  watch() {
21
18
  this.hide();
22
- }
23
-
24
- }
25
-
19
+ },
20
+ },
26
21
  },
27
22
 
28
23
  disconnected() {
@@ -30,9 +25,7 @@ export default {
30
25
  },
31
26
 
32
27
  events: [
33
-
34
28
  {
35
-
36
29
  name: 'click',
37
30
 
38
31
  delegate() {
@@ -42,61 +35,47 @@ export default {
42
35
  handler(e) {
43
36
  e.preventDefault();
44
37
  this.show(e.current);
45
- }
46
-
47
- }
48
-
38
+ },
39
+ },
49
40
  ],
50
41
 
51
42
  methods: {
52
-
53
43
  show(index) {
54
-
55
44
  const items = uniqueBy(this.toggles.map(toItem), 'source');
56
45
 
57
46
  if (isElement(index)) {
58
- const {source} = toItem(index);
59
- index = findIndex(items, ({source: src}) => source === src);
47
+ const { source } = toItem(index);
48
+ index = findIndex(items, ({ source: src }) => source === src);
60
49
  }
61
50
 
62
- this.panel = this.panel || this.$create('lightboxPanel', assign({}, this.$props, {items}));
51
+ this.panel =
52
+ this.panel || this.$create('lightboxPanel', assign({}, this.$props, { items }));
63
53
 
64
- on(this.panel.$el, 'hidden', () => this.panel = false);
54
+ on(this.panel.$el, 'hidden', () => (this.panel = false));
65
55
 
66
56
  return this.panel.show(index);
67
-
68
57
  },
69
58
 
70
59
  hide() {
71
-
72
60
  return this.panel && this.panel.hide();
73
-
74
- }
75
-
76
- }
77
-
61
+ },
62
+ },
78
63
  };
79
64
 
80
65
  function install(UIkit, Lightbox) {
81
-
82
66
  if (!UIkit.lightboxPanel) {
83
67
  UIkit.component('lightboxPanel', LightboxPanel);
84
68
  }
85
69
 
86
- assign(
87
- Lightbox.props,
88
- UIkit.component('lightboxPanel').options.props
89
- );
90
-
70
+ assign(Lightbox.props, UIkit.component('lightboxPanel').options.props);
91
71
  }
92
72
 
93
73
  function toItem(el) {
94
-
95
74
  const item = {};
96
75
 
97
- ['href', 'caption', 'type', 'poster', 'alt', 'attrs'].forEach(attr => {
76
+ for (const attr of ['href', 'caption', 'type', 'poster', 'alt', 'attrs']) {
98
77
  item[attr === 'href' ? 'source' : attr] = data(el, attr);
99
- });
78
+ }
100
79
 
101
80
  item.attrs = parseOptions(item.attrs);
102
81
 
@@ -1,8 +1,21 @@
1
1
  import Container from '../mixin/container';
2
- import {$, append, apply, closest, css, parent, pointerEnter, pointerLeave, remove, startsWith, toFloat, Transition, trigger} from 'uikit-util';
2
+ import {
3
+ $,
4
+ append,
5
+ apply,
6
+ closest,
7
+ css,
8
+ parent,
9
+ pointerEnter,
10
+ pointerLeave,
11
+ remove,
12
+ startsWith,
13
+ toFloat,
14
+ Transition,
15
+ trigger,
16
+ } from 'uikit-util';
3
17
 
4
18
  export default {
5
-
6
19
  mixins: [Container],
7
20
 
8
21
  functional: true,
@@ -17,53 +30,53 @@ export default {
17
30
  pos: 'top-center',
18
31
  clsContainer: 'uk-notification',
19
32
  clsClose: 'uk-notification-close',
20
- clsMsg: 'uk-notification-message'
33
+ clsMsg: 'uk-notification-message',
21
34
  },
22
35
 
23
36
  install,
24
37
 
25
38
  computed: {
26
-
27
- marginProp({pos}) {
39
+ marginProp({ pos }) {
28
40
  return `margin${startsWith(pos, 'top') ? 'Top' : 'Bottom'}`;
29
41
  },
30
42
 
31
43
  startProps() {
32
- return {opacity: 0, [this.marginProp]: -this.$el.offsetHeight};
33
- }
34
-
44
+ return { opacity: 0, [this.marginProp]: -this.$el.offsetHeight };
45
+ },
35
46
  },
36
47
 
37
48
  created() {
38
-
39
- const container = $(`.${this.clsContainer}-${this.pos}`, this.container)
40
- || append(this.container, `<div class="${this.clsContainer} ${this.clsContainer}-${this.pos}" style="display: block"></div>`);
41
-
42
- this.$mount(append(container,
43
- `<div class="${this.clsMsg}${this.status ? ` ${this.clsMsg}-${this.status}` : ''}">
49
+ const container =
50
+ $(`.${this.clsContainer}-${this.pos}`, this.container) ||
51
+ append(
52
+ this.container,
53
+ `<div class="${this.clsContainer} ${this.clsContainer}-${this.pos}" style="display: block"></div>`
54
+ );
55
+
56
+ this.$mount(
57
+ append(
58
+ container,
59
+ `<div class="${this.clsMsg}${this.status ? ` ${this.clsMsg}-${this.status}` : ''}">
44
60
  <a href class="${this.clsClose}" data-uk-close></a>
45
61
  <div>${this.message}</div>
46
62
  </div>`
47
- ));
48
-
63
+ )
64
+ );
49
65
  },
50
66
 
51
- connected() {
52
-
67
+ async connected() {
53
68
  const margin = toFloat(css(this.$el, this.marginProp));
54
- Transition.start(
55
- css(this.$el, this.startProps),
56
- {opacity: 1, [this.marginProp]: margin}
57
- ).then(() => {
58
- if (this.timeout) {
59
- this.timer = setTimeout(this.close, this.timeout);
60
- }
69
+ await Transition.start(css(this.$el, this.startProps), {
70
+ opacity: 1,
71
+ [this.marginProp]: margin,
61
72
  });
62
73
 
74
+ if (this.timeout) {
75
+ this.timer = setTimeout(this.close, this.timeout);
76
+ }
63
77
  },
64
78
 
65
79
  events: {
66
-
67
80
  click(e) {
68
81
  if (closest(e.target, 'a[href="#"],a[href=""]')) {
69
82
  e.preventDefault();
@@ -81,45 +94,38 @@ export default {
81
94
  if (this.timeout) {
82
95
  this.timer = setTimeout(this.close, this.timeout);
83
96
  }
84
- }
85
-
97
+ },
86
98
  },
87
99
 
88
100
  methods: {
89
-
90
- close(immediate) {
91
-
92
- const removeFn = el => {
93
-
101
+ async close(immediate) {
102
+ const removeFn = (el) => {
94
103
  const container = parent(el);
95
104
 
96
105
  trigger(el, 'close', [this]);
97
106
  remove(el);
98
107
 
99
- if (container && !container.hasChildNodes()) {
108
+ if (!container?.hasChildNodes()) {
100
109
  remove(container);
101
110
  }
102
-
103
111
  };
104
112
 
105
113
  if (this.timer) {
106
114
  clearTimeout(this.timer);
107
115
  }
108
116
 
109
- if (immediate) {
110
- removeFn(this.$el);
111
- } else {
112
- Transition.start(this.$el, this.startProps).then(removeFn);
117
+ if (!immediate) {
118
+ await Transition.start(this.$el, this.startProps);
113
119
  }
114
- }
115
-
116
- }
117
120
 
121
+ removeFn(this.$el);
122
+ },
123
+ },
118
124
  };
119
125
 
120
126
  function install(UIkit) {
121
127
  UIkit.notification.closeAll = function (group, immediate) {
122
- apply(document.body, el => {
128
+ apply(document.body, (el) => {
123
129
  const notification = UIkit.getComponent(el, 'notification');
124
130
  if (notification && (!group || group === notification.group)) {
125
131
  notification.close(immediate);
@@ -1,8 +1,7 @@
1
1
  import Parallax from '../mixin/parallax';
2
- import {css, parent, query, scrolledOver, toPx} from 'uikit-util';
2
+ import { css, parent, query, scrolledOver, toPx } from 'uikit-util';
3
3
 
4
4
  export default {
5
-
6
5
  mixins: [Parallax],
7
6
 
8
7
  props: {
@@ -10,7 +9,7 @@ export default {
10
9
  viewport: Number, // Deprecated
11
10
  easing: Number,
12
11
  start: String,
13
- end: String
12
+ end: String,
14
13
  },
15
14
 
16
15
  data: {
@@ -18,34 +17,30 @@ export default {
18
17
  viewport: 1,
19
18
  easing: 1,
20
19
  start: 0,
21
- end: 0
20
+ end: 0,
22
21
  },
23
22
 
24
23
  computed: {
25
-
26
- target({target}, $el) {
27
- return getOffsetElement(target && query(target, $el) || $el);
24
+ target({ target }, $el) {
25
+ return getOffsetElement((target && query(target, $el)) || $el);
28
26
  },
29
27
 
30
- start({start}) {
28
+ start({ start }) {
31
29
  return toPx(start, 'height', this.target, true);
32
30
  },
33
31
 
34
- end({end, viewport}) {
32
+ end({ end, viewport }) {
35
33
  return toPx(
36
- end || (viewport = (1 - viewport) * 100) && `${viewport}vh+${viewport}%`,
34
+ end || ((viewport = (1 - viewport) * 100) && `${viewport}vh+${viewport}%`),
37
35
  'height',
38
36
  this.target,
39
37
  true
40
38
  );
41
- }
42
-
39
+ },
43
40
  },
44
41
 
45
42
  update: {
46
-
47
- read({percent}, types) {
48
-
43
+ read({ percent }, types) {
49
44
  if (!types.has('scroll')) {
50
45
  percent = false;
51
46
  }
@@ -59,37 +54,28 @@ export default {
59
54
 
60
55
  return {
61
56
  percent,
62
- style: prev === percent ? false : this.getCss(percent)
57
+ style: prev === percent ? false : this.getCss(percent),
63
58
  };
64
59
  },
65
60
 
66
- write({style}) {
67
-
61
+ write({ style }) {
68
62
  if (!this.matchMedia) {
69
63
  this.reset();
70
64
  return;
71
65
  }
72
66
 
73
67
  style && css(this.$el, style);
74
-
75
68
  },
76
69
 
77
- events: ['scroll', 'resize']
78
- }
79
-
70
+ events: ['scroll', 'resize'],
71
+ },
80
72
  };
81
73
 
82
74
  function ease(percent, easing) {
83
- return easing >= 0
84
- ? Math.pow(percent, easing + 1)
85
- : 1 - Math.pow(1 - percent, -easing + 1);
75
+ return easing >= 0 ? Math.pow(percent, easing + 1) : 1 - Math.pow(1 - percent, -easing + 1);
86
76
  }
87
77
 
88
78
  // SVG elements do not inherit from HTMLElement
89
79
  function getOffsetElement(el) {
90
- return el
91
- ? 'offsetTop' in el
92
- ? el
93
- : getOffsetElement(parent(el))
94
- : document.documentElement;
80
+ return el ? ('offsetTop' in el ? el : getOffsetElement(parent(el))) : document.documentElement;
95
81
  }
@@ -1,24 +1,20 @@
1
1
  import Parallax from '../mixin/parallax';
2
- import {css, endsWith, fastdom, noop, query, Transition} from 'uikit-util';
2
+ import { css, endsWith, fastdom, noop, query, Transition } from 'uikit-util';
3
3
 
4
4
  export default {
5
-
6
5
  mixins: [Parallax],
7
6
 
8
7
  data: {
9
- selItem: '!li'
8
+ selItem: '!li',
10
9
  },
11
10
 
12
11
  computed: {
13
-
14
- item({selItem}, $el) {
12
+ item({ selItem }, $el) {
15
13
  return query(selItem, $el);
16
- }
17
-
14
+ },
18
15
  },
19
16
 
20
17
  events: [
21
-
22
18
  {
23
19
  name: 'itemin itemout',
24
20
 
@@ -28,18 +24,16 @@ export default {
28
24
  return this.item;
29
25
  },
30
26
 
31
- handler({type, detail: {percent, duration, timing, dir}}) {
32
-
27
+ handler({ type, detail: { percent, duration, timing, dir } }) {
33
28
  fastdom.read(() => {
34
29
  const propsFrom = this.getCss(getCurrentPercent(type, dir, percent));
35
- const propsTo = this.getCss(isIn(type) ? .5 : dir > 0 ? 1 : 0);
30
+ const propsTo = this.getCss(isIn(type) ? 0.5 : dir > 0 ? 1 : 0);
36
31
  fastdom.write(() => {
37
32
  css(this.$el, propsFrom);
38
33
  Transition.start(this.$el, propsTo, duration, timing).catch(noop);
39
34
  });
40
35
  });
41
-
42
- }
36
+ },
43
37
  },
44
38
 
45
39
  {
@@ -53,8 +47,7 @@ export default {
53
47
 
54
48
  handler() {
55
49
  Transition.cancel(this.$el);
56
- }
57
-
50
+ },
58
51
  },
59
52
 
60
53
  {
@@ -66,16 +59,14 @@ export default {
66
59
  return this.item;
67
60
  },
68
61
 
69
- handler({type, detail: {percent, dir}}) {
62
+ handler({ type, detail: { percent, dir } }) {
70
63
  fastdom.read(() => {
71
64
  const props = this.getCss(getCurrentPercent(type, dir, percent));
72
65
  fastdom.write(() => css(this.$el, props));
73
66
  });
74
- }
75
- }
76
-
77
- ]
78
-
67
+ },
68
+ },
69
+ ],
79
70
  };
80
71
 
81
72
  function isIn(type) {
@@ -83,8 +74,7 @@ function isIn(type) {
83
74
  }
84
75
 
85
76
  function getCurrentPercent(type, dir, percent) {
86
-
87
77
  percent /= 2;
88
78
 
89
- return isIn(type) ^ dir < 0 ? percent : 1 - percent;
79
+ return isIn(type) ^ (dir < 0) ? percent : 1 - percent;
90
80
  }