uikit 3.25.27-dev.9e97c1f → 3.25.27

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 (222) hide show
  1. package/CHANGELOG.md +2 -34
  2. package/build/prefix.js +1 -1
  3. package/build/publishDev.js +1 -1
  4. package/build/scope.js +1 -1
  5. package/build/scss.js +1 -1
  6. package/dist/css/uikit-core-rtl.css +1569 -1692
  7. package/dist/css/uikit-core-rtl.min.css +1 -1
  8. package/dist/css/uikit-core.css +1569 -1692
  9. package/dist/css/uikit-core.min.css +1 -1
  10. package/dist/css/uikit-rtl.css +1210 -1326
  11. package/dist/css/uikit-rtl.min.css +1 -1
  12. package/dist/css/uikit.css +1210 -1326
  13. package/dist/css/uikit.min.css +1 -1
  14. package/dist/js/components/countdown.js +1 -1
  15. package/dist/js/components/countdown.min.js +1 -1
  16. package/dist/js/components/filter.js +1 -1
  17. package/dist/js/components/filter.min.js +1 -1
  18. package/dist/js/components/lightbox-panel.js +135 -134
  19. package/dist/js/components/lightbox-panel.min.js +1 -1
  20. package/dist/js/components/lightbox.js +136 -135
  21. package/dist/js/components/lightbox.min.js +1 -1
  22. package/dist/js/components/notification.js +6 -8
  23. package/dist/js/components/notification.min.js +1 -1
  24. package/dist/js/components/parallax.js +12 -8
  25. package/dist/js/components/parallax.min.js +1 -1
  26. package/dist/js/components/slider-parallax.js +12 -8
  27. package/dist/js/components/slider-parallax.min.js +1 -1
  28. package/dist/js/components/slider.js +25 -51
  29. package/dist/js/components/slider.min.js +1 -1
  30. package/dist/js/components/slideshow-parallax.js +12 -8
  31. package/dist/js/components/slideshow-parallax.min.js +1 -1
  32. package/dist/js/components/slideshow.js +102 -81
  33. package/dist/js/components/slideshow.min.js +1 -1
  34. package/dist/js/components/sortable.js +1 -1
  35. package/dist/js/components/sortable.min.js +1 -1
  36. package/dist/js/components/tooltip.js +17 -15
  37. package/dist/js/components/tooltip.min.js +1 -1
  38. package/dist/js/components/upload.js +1 -1
  39. package/dist/js/components/upload.min.js +1 -1
  40. package/dist/js/uikit-core.js +313 -856
  41. package/dist/js/uikit-core.min.js +1 -1
  42. package/dist/js/uikit-icons.js +1 -1
  43. package/dist/js/uikit-icons.min.js +1 -1
  44. package/dist/js/uikit.js +377 -711
  45. package/dist/js/uikit.min.js +1 -1
  46. package/package.json +2 -2
  47. package/src/js/api/component.js +3 -2
  48. package/src/js/api/observables.js +4 -16
  49. package/src/js/api/options.js +3 -6
  50. package/src/js/api/props.js +3 -1
  51. package/src/js/api/state.js +8 -7
  52. package/src/js/components/index.js +0 -1
  53. package/src/js/components/internal/lightbox-animations.js +26 -7
  54. package/src/js/components/internal/slider-preload.js +0 -1
  55. package/src/js/components/internal/slideshow-animations.js +62 -15
  56. package/src/js/components/lightbox-panel.js +96 -121
  57. package/src/js/components/lightbox.js +8 -5
  58. package/src/js/components/notification.js +5 -7
  59. package/src/js/core/accordion.js +31 -62
  60. package/src/js/core/drop.js +3 -4
  61. package/src/js/core/dropnav.js +3 -3
  62. package/src/js/core/grid.js +19 -5
  63. package/src/js/core/margin.js +0 -3
  64. package/src/js/core/scroll.js +11 -0
  65. package/src/js/core/sticky.js +1 -1
  66. package/src/js/core/switcher.js +49 -12
  67. package/src/js/core/video.js +21 -236
  68. package/src/js/mixin/internal/slideshow-animations.js +13 -5
  69. package/src/js/mixin/internal/slideshow-transitioner.js +2 -2
  70. package/src/js/mixin/parallax.js +4 -1
  71. package/src/js/mixin/position.js +1 -1
  72. package/src/js/mixin/slider-parallax.js +38 -9
  73. package/src/js/mixin/togglable.js +14 -13
  74. package/src/js/util/attr.js +7 -7
  75. package/src/js/util/dom.js +4 -3
  76. package/src/js/util/lang.js +2 -2
  77. package/src/js/util/player.js +2 -4
  78. package/src/js/util/style.js +13 -12
  79. package/src/js/util/viewport.js +25 -22
  80. package/src/less/components/_import.less +3 -8
  81. package/src/less/components/animation.less +1 -1
  82. package/src/less/components/base.less +1 -1
  83. package/src/less/components/button.less +1 -1
  84. package/src/less/components/card.less +8 -8
  85. package/src/less/components/form.less +15 -15
  86. package/src/less/components/grid.less +65 -58
  87. package/src/less/components/lightbox.less +8 -2
  88. package/src/less/components/margin.less +124 -155
  89. package/src/less/components/modal.less +4 -1
  90. package/src/less/components/nav.less +1 -1
  91. package/src/less/components/navbar.less +1 -1
  92. package/src/less/components/padding.less +9 -9
  93. package/src/less/components/position.less +4 -9
  94. package/src/less/components/search.less +1 -1
  95. package/src/less/components/slideshow.less +4 -1
  96. package/src/less/components/switcher.less +2 -5
  97. package/src/less/components/table.less +4 -4
  98. package/src/less/components/text.less +4 -10
  99. package/src/less/components/utility.less +163 -0
  100. package/src/less/components/visibility.less +4 -4
  101. package/src/less/theme/_import.less +2 -6
  102. package/src/less/theme/alert.less +5 -0
  103. package/src/less/theme/thumbnav.less +4 -1
  104. package/src/less/theme/utility.less +32 -0
  105. package/src/scss/components/_import.scss +3 -8
  106. package/src/scss/components/animation.scss +1 -1
  107. package/src/scss/components/base.scss +1 -1
  108. package/src/scss/components/button.scss +1 -1
  109. package/src/scss/components/card.scss +8 -8
  110. package/src/scss/components/form.scss +14 -14
  111. package/src/scss/components/grid.scss +64 -57
  112. package/src/scss/components/lightbox.scss +8 -2
  113. package/src/scss/components/margin.scss +124 -155
  114. package/src/scss/components/modal.scss +4 -1
  115. package/src/scss/components/nav.scss +1 -1
  116. package/src/scss/components/navbar.scss +1 -1
  117. package/src/scss/components/padding.scss +9 -9
  118. package/src/scss/components/position.scss +4 -9
  119. package/src/scss/components/search.scss +1 -1
  120. package/src/scss/components/slideshow.scss +4 -1
  121. package/src/scss/components/switcher.scss +2 -5
  122. package/src/scss/components/table.scss +4 -4
  123. package/src/scss/components/text.scss +4 -10
  124. package/src/scss/components/utility.scss +129 -0
  125. package/src/scss/components/visibility.scss +4 -4
  126. package/src/scss/mixins-theme.scss +43 -44
  127. package/src/scss/mixins.scss +31 -40
  128. package/src/scss/variables-theme.scss +14 -14
  129. package/src/scss/variables.scss +14 -14
  130. package/tests/accordion.html +10 -77
  131. package/tests/alert.html +1 -1
  132. package/tests/align.html +5 -5
  133. package/tests/animation.html +4 -4
  134. package/tests/article.html +7 -7
  135. package/tests/background.html +2 -2
  136. package/tests/badge.html +1 -1
  137. package/tests/base.html +2 -2
  138. package/tests/button.html +1 -1
  139. package/tests/card.html +15 -15
  140. package/tests/close.html +2 -2
  141. package/tests/comment.html +9 -9
  142. package/tests/container.html +2 -2
  143. package/tests/countdown.html +21 -21
  144. package/tests/cover.html +3 -3
  145. package/tests/description-list.html +1 -1
  146. package/tests/divider.html +3 -3
  147. package/tests/dotnav.html +1 -1
  148. package/tests/drop.html +7 -7
  149. package/tests/dropbar.html +5 -5
  150. package/tests/dropdown.html +1 -1
  151. package/tests/dropnav.html +18 -18
  152. package/tests/filter.html +3 -3
  153. package/tests/form.html +14 -14
  154. package/tests/grid.html +47 -41
  155. package/tests/heading.html +2 -2
  156. package/tests/height-viewport.html +4 -4
  157. package/tests/height.html +5 -5
  158. package/tests/icon.html +8 -8
  159. package/tests/image.html +6 -6
  160. package/tests/index.html +13 -13
  161. package/tests/js/index.js +1 -1
  162. package/tests/leader.html +5 -5
  163. package/tests/lightbox.html +6 -6
  164. package/tests/link.html +1 -1
  165. package/tests/list.html +4 -4
  166. package/tests/margin.html +7 -59
  167. package/tests/marker.html +3 -3
  168. package/tests/modal.html +3 -3
  169. package/tests/nav.html +5 -5
  170. package/tests/navbar.html +27 -27
  171. package/tests/notification.html +2 -8
  172. package/tests/offcanvas.html +12 -12
  173. package/tests/overlay.html +3 -3
  174. package/tests/padding.html +1 -1
  175. package/tests/pagination.html +3 -3
  176. package/tests/parallax.html +1 -1
  177. package/tests/position.html +6 -6
  178. package/tests/scrollspy.html +13 -13
  179. package/tests/search.html +5 -5
  180. package/tests/section.html +17 -17
  181. package/tests/slidenav.html +3 -3
  182. package/tests/slider.html +5 -5
  183. package/tests/slideshow.html +3 -33
  184. package/tests/sortable.html +15 -15
  185. package/tests/sticky-navbar.html +4 -4
  186. package/tests/sticky-parallax.html +3 -3
  187. package/tests/sticky.html +3 -3
  188. package/tests/svg.html +2 -3
  189. package/tests/switcher.html +7 -7
  190. package/tests/tab.html +5 -5
  191. package/tests/text.html +3 -9
  192. package/tests/tile.html +4 -4
  193. package/tests/toggle.html +1 -1
  194. package/tests/tooltip.html +3 -3
  195. package/tests/totop.html +2 -2
  196. package/tests/transition.html +1 -1
  197. package/tests/upload.html +5 -5
  198. package/tests/utility.html +116 -16
  199. package/tests/video.html +24 -224
  200. package/tests/visibility.html +4 -4
  201. package/tests/width.html +12 -12
  202. package/dist/js/components/marquee.js +0 -215
  203. package/dist/js/components/marquee.min.js +0 -1
  204. package/src/js/components/marquee.js +0 -156
  205. package/src/js/mixin/connect.js +0 -90
  206. package/src/js/mixin/scroll-driven.js +0 -57
  207. package/src/less/components/dropcap.less +0 -71
  208. package/src/less/components/floating-shadow.less +0 -66
  209. package/src/less/components/logo.less +0 -94
  210. package/src/less/components/marquee.less +0 -133
  211. package/src/less/theme/dropcap.less +0 -29
  212. package/src/less/theme/floating-shadow.less +0 -20
  213. package/src/less/theme/logo.less +0 -29
  214. package/src/less/theme/marquee.less +0 -14
  215. package/src/scss/components/dropcap.scss +0 -63
  216. package/src/scss/components/floating-shadow.scss +0 -63
  217. package/src/scss/components/logo.scss +0 -75
  218. package/src/scss/components/marquee.scss +0 -136
  219. package/tests/dropcap.html +0 -26
  220. package/tests/floating-shadow.html +0 -44
  221. package/tests/logo.html +0 -84
  222. package/tests/marquee.html +0 -617
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.25.27-dev.9e97c1f",
5
+ "version": "3.25.27",
6
6
  "main": "dist/js/uikit.js",
7
7
  "style": "dist/css/uikit.css",
8
8
  "sideEffects": [
@@ -36,7 +36,7 @@
36
36
  "@eslint/js": "^10.0.1",
37
37
  "@rollup/plugin-alias": "^6.0.0",
38
38
  "archiver": "^8.0.0",
39
- "camelcase": "^9.0.0",
39
+ "camelcase": "^10.0.0",
40
40
  "clean-css": "^5.3.3",
41
41
  "esbuild": "^0.28.0",
42
42
  "eslint": "^10.0.0",
@@ -48,10 +48,11 @@ export function createComponent(name, element, data, ...args) {
48
48
  const instance = getComponent(element, name);
49
49
 
50
50
  if (instance) {
51
- if (!data) {
51
+ if (data) {
52
+ instance.$destroy();
53
+ } else {
52
54
  return instance;
53
55
  }
54
- instance.$destroy();
55
56
  }
56
57
 
57
58
  return new Component({ el: element, data });
@@ -36,9 +36,11 @@ export function mutation(options) {
36
36
  export function lazyload(options = {}) {
37
37
  return intersection({
38
38
  handler: function (entries, observer) {
39
- const { targets = this.$el, preload = 5, media = false } = options;
39
+ const { targets = this.$el, preload = 5 } = options;
40
40
  for (const el of toNodes(isFunction(targets) ? targets(this) : targets)) {
41
- (media ? preloadMedia : loadLazyElements)(el, preload);
41
+ $$('[loading="lazy"]', el)
42
+ .slice(0, preload - 1)
43
+ .forEach((el) => removeAttr(el, 'loading'));
42
44
  }
43
45
 
44
46
  for (const { isIntersecting, target } of entries) {
@@ -49,20 +51,6 @@ export function lazyload(options = {}) {
49
51
  });
50
52
  }
51
53
 
52
- export function preloadMedia(el, preload = 5) {
53
- loadLazyElements(el, preload);
54
-
55
- for (const video of $$('video[preload="none"]', el)) {
56
- video.preload = '';
57
- }
58
- }
59
-
60
- function loadLazyElements(el, preload) {
61
- $$('[loading="lazy"]', el)
62
- .slice(0, preload - 1)
63
- .forEach((el) => removeAttr(el, 'loading'));
64
- }
65
-
66
54
  export function viewport(options) {
67
55
  return observe((target, handler) => observeViewportResize(handler), options, 'resize');
68
56
  }
@@ -153,14 +153,11 @@ export function parseOptions(options, args = []) {
153
153
  export function coerce(type, value) {
154
154
  if (type === Boolean) {
155
155
  return toBoolean(value);
156
- }
157
- if (type === Number) {
156
+ } else if (type === Number) {
158
157
  return toNumber(value);
159
- }
160
- if (type === 'list') {
158
+ } else if (type === 'list') {
161
159
  return toList(value);
162
- }
163
- if (type === Object && isString(value)) {
160
+ } else if (type === Object && isString(value)) {
164
161
  return parseOptions(value);
165
162
  }
166
163
 
@@ -67,7 +67,9 @@ function getProps(opts) {
67
67
 
68
68
  const getAttributes = memoize((id, props) => {
69
69
  const attributes = Object.keys(props);
70
- const filter = [...attributes, id].flatMap((key) => [hyphenate(key), `data-${hyphenate(key)}`]);
70
+ const filter = attributes
71
+ .concat(id)
72
+ .flatMap((key) => [hyphenate(key), `data-${hyphenate(key)}`]);
71
73
  return { attributes, filter };
72
74
  });
73
75
 
@@ -43,13 +43,14 @@ function initMethods(instance) {
43
43
 
44
44
  function normalizeData({ data = {} }, { args = [], props = {} }) {
45
45
  if (isArray(data)) {
46
- data = data
47
- .slice(0, args.length)
48
- .reduce(
49
- (data, value, index) =>
50
- assign(data, isPlainObject(value) ? value : { [args[index]]: value }),
51
- {},
52
- );
46
+ data = data.slice(0, args.length).reduce((data, value, index) => {
47
+ if (isPlainObject(value)) {
48
+ assign(data, value);
49
+ } else {
50
+ data[args[index]] = value;
51
+ }
52
+ return data;
53
+ }, {});
53
54
  }
54
55
 
55
56
  for (const key in data) {
@@ -2,7 +2,6 @@ export { default as Countdown } from './countdown';
2
2
  export { default as Filter } from './filter';
3
3
  export { default as Lightbox } from './lightbox';
4
4
  export { default as LightboxPanel } from './lightbox-panel';
5
- export { default as Marquee } from './marquee';
6
5
  export { default as Notification } from './notification';
7
6
  export { default as Parallax } from './parallax';
8
7
  export { default as Slider } from './slider';
@@ -5,17 +5,36 @@ import { scale3d } from './slideshow-animations';
5
5
  export default {
6
6
  ...Animations,
7
7
  fade: {
8
- percent: (current) => 1 - css(current, 'opacity'),
8
+ show() {
9
+ return [{ opacity: 0 }, { opacity: 1 }];
10
+ },
9
11
 
10
- translate: (percent) => [{ opacity: 1 - percent }, { opacity: percent }],
12
+ percent(current) {
13
+ return 1 - css(current, 'opacity');
14
+ },
15
+
16
+ translate(percent) {
17
+ return [{ opacity: 1 - percent }, { opacity: percent }];
18
+ },
11
19
  },
12
20
 
13
21
  scale: {
14
- percent: (current) => 1 - css(current, 'opacity'),
22
+ show() {
23
+ return [
24
+ { opacity: 0, transform: scale3d(1 - 0.2) },
25
+ { opacity: 1, transform: scale3d(1) },
26
+ ];
27
+ },
28
+
29
+ percent(current) {
30
+ return 1 - css(current, 'opacity');
31
+ },
15
32
 
16
- translate: (percent) => [
17
- { opacity: 1 - percent, transform: scale3d(1 - 0.2 * percent) },
18
- { opacity: percent, transform: scale3d(1 - 0.2 + 0.2 * percent) },
19
- ],
33
+ translate(percent) {
34
+ return [
35
+ { opacity: 1 - percent, transform: scale3d(1 - 0.2 * percent) },
36
+ { opacity: percent, transform: scale3d(1 - 0.2 + 0.2 * percent) },
37
+ ];
38
+ },
20
39
  },
21
40
  };
@@ -4,7 +4,6 @@ export default {
4
4
  observe: lazyload({
5
5
  target: ({ slides }) => slides,
6
6
  targets: (instance) => instance.getAdjacentSlides(),
7
- media: true,
8
7
  }),
9
8
 
10
9
  methods: {
@@ -4,24 +4,55 @@ import Animations, { translate, translated } from '../../mixin/internal/slidesho
4
4
  export default {
5
5
  ...Animations,
6
6
  fade: {
7
- percent: (current) => 1 - css(current, 'opacity'),
8
- translate: (percent) => [{ opacity: 1 - percent, zIndex: 0 }, { zIndex: -1 }],
7
+ show() {
8
+ return [{ opacity: 0, zIndex: 0 }, { zIndex: -1 }];
9
+ },
10
+
11
+ percent(current) {
12
+ return 1 - css(current, 'opacity');
13
+ },
14
+
15
+ translate(percent) {
16
+ return [{ opacity: 1 - percent, zIndex: 0 }, { zIndex: -1 }];
17
+ },
9
18
  },
10
19
 
11
20
  scale: {
12
- percent: (current) => 1 - css(current, 'opacity'),
21
+ show() {
22
+ return [{ opacity: 0, transform: scale3d(1 + 0.5), zIndex: 0 }, { zIndex: -1 }];
23
+ },
24
+
25
+ percent(current) {
26
+ return 1 - css(current, 'opacity');
27
+ },
13
28
 
14
- translate: (percent) => [
15
- { opacity: 1 - percent, transform: scale3d(1 + 0.5 * percent), zIndex: 0 },
16
- { zIndex: -1 },
17
- ],
29
+ translate(percent) {
30
+ return [
31
+ { opacity: 1 - percent, transform: scale3d(1 + 0.5 * percent), zIndex: 0 },
32
+ { zIndex: -1 },
33
+ ];
34
+ },
18
35
  },
19
36
 
20
37
  pull: {
21
- percent: (current, next, dir) => (dir < 0 ? 1 - translated(next) : translated(current)),
38
+ show(dir) {
39
+ return dir < 0
40
+ ? [
41
+ { transform: translate(30), zIndex: -1 },
42
+ { transform: translate(), zIndex: 0 },
43
+ ]
44
+ : [
45
+ { transform: translate(-100), zIndex: 0 },
46
+ { transform: translate(), zIndex: -1 },
47
+ ];
48
+ },
22
49
 
23
- translate: (percent, dir) =>
24
- dir < 0
50
+ percent(current, next, dir) {
51
+ return dir < 0 ? 1 - translated(next) : translated(current);
52
+ },
53
+
54
+ translate(percent, dir) {
55
+ return dir < 0
25
56
  ? [
26
57
  { transform: translate(30 * percent), zIndex: -1 },
27
58
  { transform: translate(-100 * (1 - percent)), zIndex: 0 },
@@ -29,14 +60,29 @@ export default {
29
60
  : [
30
61
  { transform: translate(-percent * 100), zIndex: 0 },
31
62
  { transform: translate(30 * (1 - percent)), zIndex: -1 },
32
- ],
63
+ ];
64
+ },
33
65
  },
34
66
 
35
67
  push: {
36
- percent: (current, next, dir) => (dir > 0 ? 1 - translated(next) : translated(current)),
68
+ show(dir) {
69
+ return dir < 0
70
+ ? [
71
+ { transform: translate(100), zIndex: 0 },
72
+ { transform: translate(), zIndex: -1 },
73
+ ]
74
+ : [
75
+ { transform: translate(-30), zIndex: -1 },
76
+ { transform: translate(), zIndex: 0 },
77
+ ];
78
+ },
79
+
80
+ percent(current, next, dir) {
81
+ return dir > 0 ? 1 - translated(next) : translated(current);
82
+ },
37
83
 
38
- translate: (percent, dir) =>
39
- dir < 0
84
+ translate(percent, dir) {
85
+ return dir < 0
40
86
  ? [
41
87
  { transform: translate(percent * 100), zIndex: 0 },
42
88
  { transform: translate(-30 * (1 - percent)), zIndex: -1 },
@@ -44,7 +90,8 @@ export default {
44
90
  : [
45
91
  { transform: translate(-30 * percent), zIndex: -1 },
46
92
  { transform: translate(100 * (1 - percent)), zIndex: 0 },
47
- ],
93
+ ];
94
+ },
48
95
  },
49
96
  };
50
97
 
@@ -269,23 +269,103 @@ export default {
269
269
  return;
270
270
  }
271
271
 
272
- try {
273
- for (const loader of [
274
- loadImage,
275
- loadVideo,
276
- loadIframe,
277
- loadYouTube,
278
- loadVimeo,
279
- ]) {
280
- const content = await loader({ src, type, attrs, item, cmp: this });
281
-
282
- if (content) {
283
- this.setItem(item, content);
284
- return;
285
- }
272
+ let matches;
273
+ const iframeAttrs = {
274
+ allowfullscreen: '',
275
+ style: 'max-width: 100%; box-sizing: border-box;',
276
+ 'uk-responsive': '',
277
+ 'uk-video': Boolean(this.videoAutoplay),
278
+ };
279
+
280
+ // Image
281
+ if (type === 'image' || isImage(src)) {
282
+ const img = createEl('img');
283
+
284
+ wrapInPicture(img, item.sources);
285
+ attr(img, {
286
+ src,
287
+ ...pick(item, ['alt', 'srcset', 'sizes']),
288
+ ...attrs,
289
+ });
290
+
291
+ on(img, 'load', () => this.setItem(item, parent(img) || img));
292
+ on(img, 'error', () => this.setError(item));
293
+
294
+ // Video
295
+ } else if (type === 'video' || isVideo(src)) {
296
+ const inline = this.videoAutoplay === 'inline';
297
+ const video = createEl('video', {
298
+ src,
299
+ playsinline: '',
300
+ controls: inline ? null : '',
301
+ loop: inline ? '' : null,
302
+ muted: inline ? '' : null,
303
+ poster: this.videoAutoplay ? null : item.poster,
304
+ 'uk-video': Boolean(this.videoAutoplay),
305
+ ...attrs,
306
+ });
307
+
308
+ on(video, 'loadedmetadata', () => this.setItem(item, video));
309
+ on(video, 'error', () => this.setError(item));
310
+
311
+ // Iframe
312
+ } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) {
313
+ this.setItem(
314
+ item,
315
+ createEl('iframe', {
316
+ src,
317
+ allowfullscreen: '',
318
+ class: 'uk-lightbox-iframe',
319
+ ...attrs,
320
+ }),
321
+ );
322
+
323
+ // YouTube
324
+ } else if (
325
+ (matches = src.match(
326
+ /\/\/(?:.*?youtube(-nocookie)?\..*?(?:[?&]v=|\/shorts\/)|youtu\.be\/)([\w-]{11})[&?]?(.*)?/,
327
+ ))
328
+ ) {
329
+ this.setItem(
330
+ item,
331
+ createEl('iframe', {
332
+ src: `https://www.youtube${matches[1] || ''}.com/embed/${matches[2]}${
333
+ matches[3] ? `?${matches[3]}` : ''
334
+ }`,
335
+ width: 1920,
336
+ height: 1080,
337
+ ...iframeAttrs,
338
+ ...attrs,
339
+ }),
340
+ );
341
+
342
+ // Vimeo
343
+ } else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) {
344
+ try {
345
+ const { height, width } = await (
346
+ await fetch(
347
+ `https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(
348
+ src,
349
+ )}`,
350
+ { credentials: 'omit' },
351
+ )
352
+ ).json();
353
+
354
+ this.setItem(
355
+ item,
356
+ createEl('iframe', {
357
+ src: `https://player.vimeo.com/video/${matches[1]}${
358
+ matches[2] ? `?${matches[2]}` : ''
359
+ }`,
360
+ width,
361
+ height,
362
+ ...iframeAttrs,
363
+ ...attrs,
364
+ }),
365
+ );
366
+ } catch {
367
+ this.setError(item);
286
368
  }
287
- } catch {
288
- this.setError(item);
289
369
  }
290
370
  },
291
371
  },
@@ -361,111 +441,6 @@ function createEl(tag, attrs) {
361
441
  return el;
362
442
  }
363
443
 
364
- async function loadImage({ src, type, attrs, item }) {
365
- if (type !== 'image' && !isImage(src)) {
366
- return;
367
- }
368
-
369
- const img = createEl('img');
370
-
371
- wrapInPicture(img, item.sources);
372
- attr(img, {
373
- src,
374
- ...pick(item, ['alt', 'srcset', 'sizes']),
375
- ...attrs,
376
- });
377
-
378
- await img.decode();
379
-
380
- return parent(img) || img;
381
- }
382
-
383
- function loadVideo({ src, type, attrs, item, cmp }) {
384
- if (type !== 'video' && !isVideo(src)) {
385
- return;
386
- }
387
-
388
- const inline = cmp.videoAutoplay === 'inline';
389
- const video = createEl('video', {
390
- src,
391
- playsinline: '',
392
- controls: inline ? null : '',
393
- loop: inline ? '' : null,
394
- muted: inline ? '' : null,
395
- poster: cmp.videoAutoplay ? null : item.poster,
396
- 'uk-video': Boolean(cmp.videoAutoplay),
397
- ...attrs,
398
- });
399
-
400
- return new Promise((resolve, reject) => {
401
- on(video, 'loadedmetadata', () => resolve(video));
402
- on(video, 'error', reject);
403
- });
404
- }
405
-
406
- function loadIframe({ src, type, attrs }) {
407
- if (type !== 'iframe' && !/\.(html|php)($|\?)/i.test(src)) {
408
- return;
409
- }
410
-
411
- return createEl('iframe', {
412
- src,
413
- allowfullscreen: '',
414
- class: 'uk-lightbox-iframe',
415
- ...attrs,
416
- });
417
- }
418
-
419
- function loadYouTube({ src, attrs, cmp }) {
420
- const matches = src.match(
421
- /\/\/(?:.*?youtube(-nocookie)?\..*?(?:[?&]v=|\/shorts\/)|youtu\.be\/)([\w-]{11})[&?]?(.*)?/,
422
- );
423
-
424
- if (!matches) {
425
- return;
426
- }
427
-
428
- return createEl('iframe', {
429
- src: `https://www.youtube${matches[1] || ''}.com/embed/${matches[2]}${matches[3] ? `?${matches[3]}` : ''}`,
430
- width: 1920,
431
- height: 1080,
432
- ...getIframeAttrs(cmp),
433
- ...attrs,
434
- });
435
- }
436
-
437
- async function loadVimeo({ src, attrs, cmp }) {
438
- const matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/);
439
-
440
- if (!matches) {
441
- return;
442
- }
443
-
444
- const { height, width } = await (
445
- await fetch(
446
- `https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURIComponent(src)}`,
447
- { credentials: 'omit' },
448
- )
449
- ).json();
450
-
451
- return createEl('iframe', {
452
- src: `https://player.vimeo.com/video/${matches[1]}${matches[2] ? `?${matches[2]}` : ''}`,
453
- width,
454
- height,
455
- ...getIframeAttrs(cmp),
456
- ...attrs,
457
- });
458
- }
459
-
460
- function getIframeAttrs(cmp) {
461
- return {
462
- allowfullscreen: '',
463
- style: 'max-width: 100%; box-sizing: border-box;',
464
- 'uk-responsive': '',
465
- 'uk-video': Boolean(cmp.videoAutoplay),
466
- };
467
- }
468
-
469
444
  function toThumbnavItem(item, videoAutoplay) {
470
445
  const el =
471
446
  item.poster || (item.thumb && (item.type === 'image' || isImage(item.thumb)))
@@ -98,11 +98,14 @@ function ensureThumb(toggles, items) {
98
98
  continue;
99
99
  }
100
100
 
101
- const parent = [...parents(toggle).reverse(), toggle].find(
102
- (parent) =>
103
- this.$el.contains(parent) &&
104
- (parent === toggle || $$(this.toggle, parent).length === 1),
105
- );
101
+ const parent = parents(toggle)
102
+ .reverse()
103
+ .concat(toggle)
104
+ .find(
105
+ (parent) =>
106
+ this.$el.contains(parent) &&
107
+ (parent === toggle || $$(this.toggle, parent).length === 1),
108
+ );
106
109
 
107
110
  if (!parent) {
108
111
  continue;
@@ -25,7 +25,6 @@ export default {
25
25
  message: '',
26
26
  status: '',
27
27
  timeout: 5000,
28
- duration: 400,
29
28
  group: '',
30
29
  pos: 'top-center',
31
30
  clsContainer: 'uk-notification',
@@ -68,11 +67,10 @@ export default {
68
67
 
69
68
  async connected() {
70
69
  const margin = toFloat(css(this.$el, this.marginProp));
71
- await Transition.start(
72
- css(this.$el, this.startProps),
73
- { opacity: 1, [this.marginProp]: margin },
74
- this.duration,
75
- );
70
+ await Transition.start(css(this.$el, this.startProps), {
71
+ opacity: 1,
72
+ [this.marginProp]: margin,
73
+ });
76
74
 
77
75
  if (this.timeout) {
78
76
  this.timer = setTimeout(this.close, this.timeout);
@@ -116,7 +114,7 @@ export default {
116
114
  }
117
115
 
118
116
  if (!immediate) {
119
- await Transition.start(this.$el, this.startProps, this.duration);
117
+ await Transition.start(this.$el, this.startProps);
120
118
  }
121
119
 
122
120
  removeFn(this.$el);