uikit 3.11.1 → 3.11.2-dev.03e47c2ff

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/.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 +59 -17
  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 +127 -201
  19. package/dist/css/uikit-core-rtl.min.css +1 -1
  20. package/dist/css/uikit-core.css +127 -201
  21. package/dist/css/uikit-core.min.css +1 -1
  22. package/dist/css/uikit-rtl.css +129 -207
  23. package/dist/css/uikit-rtl.min.css +1 -1
  24. package/dist/css/uikit.css +129 -207
  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 +408 -439
  29. package/dist/js/components/filter.min.js +1 -1
  30. package/dist/js/components/lightbox-panel.js +1098 -1316
  31. package/dist/js/components/lightbox-panel.min.js +1 -1
  32. package/dist/js/components/lightbox.js +1144 -1393
  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 +345 -362
  37. package/dist/js/components/parallax.min.js +1 -1
  38. package/dist/js/components/slider-parallax.js +343 -350
  39. package/dist/js/components/slider-parallax.min.js +1 -1
  40. package/dist/js/components/slider.js +768 -843
  41. package/dist/js/components/slider.min.js +1 -1
  42. package/dist/js/components/slideshow-parallax.js +343 -350
  43. package/dist/js/components/slideshow-parallax.min.js +1 -1
  44. package/dist/js/components/slideshow.js +645 -793
  45. package/dist/js/components/slideshow.min.js +1 -1
  46. package/dist/js/components/sortable.js +587 -621
  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 +5430 -6690
  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 +8143 -9784
  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 +15 -28
  62. package/src/js/api/global.js +6 -12
  63. package/src/js/api/hooks.js +14 -33
  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 +70 -66
  68. package/src/js/components/index.js +13 -13
  69. package/src/js/components/internal/lightbox-animations.js +14 -25
  70. package/src/js/components/internal/slider-preload.js +37 -0
  71. package/src/js/components/internal/slider-transitioner.js +66 -45
  72. package/src/js/components/internal/slideshow-animations.js +46 -64
  73. package/src/js/components/lightbox-panel.js +107 -105
  74. package/src/js/components/lightbox.js +17 -39
  75. package/src/js/components/notification.js +49 -43
  76. package/src/js/components/parallax.js +21 -46
  77. package/src/js/components/slider-parallax.js +13 -23
  78. package/src/js/components/slider.js +95 -64
  79. package/src/js/components/slideshow-parallax.js +1 -1
  80. package/src/js/components/slideshow.js +15 -13
  81. package/src/js/components/sortable.js +126 -108
  82. package/src/js/components/tooltip.js +41 -31
  83. package/src/js/components/upload.js +52 -63
  84. package/src/js/core/accordion.js +53 -48
  85. package/src/js/core/alert.js +9 -17
  86. package/src/js/core/core.js +74 -53
  87. package/src/js/core/cover.js +11 -15
  88. package/src/js/core/drop.js +107 -93
  89. package/src/js/core/form-custom.js +20 -25
  90. package/src/js/core/gif.js +3 -7
  91. package/src/js/core/grid.js +57 -58
  92. package/src/js/core/height-match.js +16 -29
  93. package/src/js/core/height-viewport.js +29 -36
  94. package/src/js/core/icon.js +47 -52
  95. package/src/js/core/img.js +156 -138
  96. package/src/js/core/index.js +39 -39
  97. package/src/js/core/leader.js +9 -18
  98. package/src/js/core/margin.js +21 -37
  99. package/src/js/core/modal.js +49 -36
  100. package/src/js/core/nav.js +2 -4
  101. package/src/js/core/navbar.js +113 -85
  102. package/src/js/core/offcanvas.js +49 -53
  103. package/src/js/core/overflow-auto.js +13 -17
  104. package/src/js/core/responsive.js +14 -12
  105. package/src/js/core/scroll.js +10 -20
  106. package/src/js/core/scrollspy-nav.js +34 -31
  107. package/src/js/core/scrollspy.js +37 -54
  108. package/src/js/core/sticky.js +194 -123
  109. package/src/js/core/svg.js +68 -83
  110. package/src/js/core/switcher.js +47 -46
  111. package/src/js/core/tab.js +7 -10
  112. package/src/js/core/toggle.js +66 -67
  113. package/src/js/core/video.js +11 -22
  114. package/src/js/mixin/animate.js +19 -20
  115. package/src/js/mixin/class.js +2 -4
  116. package/src/js/mixin/container.js +7 -11
  117. package/src/js/mixin/internal/animate-fade.js +73 -30
  118. package/src/js/mixin/internal/animate-slide.js +58 -41
  119. package/src/js/mixin/internal/slideshow-animations.js +7 -14
  120. package/src/js/mixin/internal/slideshow-transitioner.js +10 -17
  121. package/src/js/mixin/media.js +5 -10
  122. package/src/js/mixin/modal.js +89 -66
  123. package/src/js/mixin/parallax.js +175 -121
  124. package/src/js/mixin/position.js +26 -20
  125. package/src/js/mixin/slider-autoplay.js +12 -21
  126. package/src/js/mixin/slider-drag.js +64 -65
  127. package/src/js/mixin/slider-nav.js +26 -35
  128. package/src/js/mixin/slider-reactive.js +2 -8
  129. package/src/js/mixin/slider.js +48 -55
  130. package/src/js/mixin/slideshow.js +13 -19
  131. package/src/js/mixin/togglable.js +89 -63
  132. package/src/js/uikit-core.js +2 -4
  133. package/src/js/uikit.js +2 -4
  134. package/src/js/util/ajax.js +25 -40
  135. package/src/js/util/animation.js +77 -75
  136. package/src/js/util/attr.js +17 -21
  137. package/src/js/util/class.js +14 -52
  138. package/src/js/util/dimensions.js +78 -49
  139. package/src/js/util/dom.js +39 -66
  140. package/src/js/util/env.js +7 -12
  141. package/src/js/util/event.js +60 -59
  142. package/src/js/util/fastdom.js +3 -8
  143. package/src/js/util/filter.js +17 -34
  144. package/src/js/util/index.js +0 -1
  145. package/src/js/util/lang.js +82 -121
  146. package/src/js/util/mouse.js +19 -17
  147. package/src/js/util/options.js +35 -49
  148. package/src/js/util/player.js +41 -36
  149. package/src/js/util/position.js +54 -46
  150. package/src/js/util/selector.js +43 -58
  151. package/src/js/util/style.js +39 -49
  152. package/src/js/util/viewport.js +81 -66
  153. package/src/less/components/base.less +10 -33
  154. package/src/less/components/flex.less +0 -9
  155. package/src/less/components/form-range.less +48 -95
  156. package/src/less/components/form.less +0 -1
  157. package/src/less/components/height.less +3 -0
  158. package/src/less/components/leader.less +0 -1
  159. package/src/less/components/lightbox.less +0 -1
  160. package/src/less/components/modal.less +3 -7
  161. package/src/less/components/navbar.less +0 -7
  162. package/src/less/components/progress.less +14 -36
  163. package/src/less/components/slider.less +0 -3
  164. package/src/less/components/slideshow.less +0 -3
  165. package/src/less/components/text.less +16 -32
  166. package/src/less/components/utility.less +22 -0
  167. package/src/scss/components/base.scss +10 -33
  168. package/src/scss/components/flex.scss +0 -9
  169. package/src/scss/components/form-range.scss +48 -95
  170. package/src/scss/components/form.scss +3 -4
  171. package/src/scss/components/height.scss +3 -0
  172. package/src/scss/components/icon.scss +2 -2
  173. package/src/scss/components/leader.scss +0 -1
  174. package/src/scss/components/lightbox.scss +0 -1
  175. package/src/scss/components/modal.scss +3 -7
  176. package/src/scss/components/navbar.scss +0 -7
  177. package/src/scss/components/progress.scss +14 -36
  178. package/src/scss/components/search.scss +1 -1
  179. package/src/scss/components/slider.scss +0 -3
  180. package/src/scss/components/slideshow.scss +0 -3
  181. package/src/scss/components/text.scss +16 -32
  182. package/src/scss/components/utility.scss +22 -0
  183. package/src/scss/mixins-theme.scss +1 -1
  184. package/src/scss/mixins.scss +1 -1
  185. package/src/scss/variables-theme.scss +9 -9
  186. package/src/scss/variables.scss +9 -9
  187. package/tests/align.html +10 -10
  188. package/tests/animation.html +2 -2
  189. package/tests/article.html +2 -2
  190. package/tests/base.html +3 -3
  191. package/tests/card.html +10 -10
  192. package/tests/column.html +3 -3
  193. package/tests/comment.html +9 -9
  194. package/tests/dotnav.html +3 -3
  195. package/tests/image.html +296 -64
  196. package/tests/images/image-type.avif +0 -0
  197. package/tests/images/image-type.jpeg +0 -0
  198. package/tests/images/image-type.webp +0 -0
  199. package/tests/index.html +8 -8
  200. package/tests/js/index.js +114 -85
  201. package/tests/lightbox.html +10 -10
  202. package/tests/marker.html +2 -2
  203. package/tests/modal.html +8 -9
  204. package/tests/navbar.html +2 -2
  205. package/tests/overlay.html +7 -7
  206. package/tests/parallax.html +14 -5
  207. package/tests/position.html +12 -12
  208. package/tests/slidenav.html +12 -12
  209. package/tests/slider.html +20 -20
  210. package/tests/sortable.html +1 -1
  211. package/tests/sticky-parallax.html +86 -98
  212. package/tests/sticky.html +56 -24
  213. package/tests/svg.html +6 -6
  214. package/tests/table.html +11 -11
  215. package/tests/thumbnav.html +12 -12
  216. package/tests/transition.html +30 -30
  217. package/tests/utility.html +33 -33
  218. package/tests/video.html +1 -1
  219. package/tests/width.html +1 -1
  220. package/src/js/mixin/flex-bug.js +0 -56
  221. package/src/js/util/promise.js +0 -191
  222. package/tests/images/animated.gif +0 -0
@@ -1,194 +1,218 @@
1
- import {createEvent, css, Dimensions, escape, getImage, includes, isUndefined, queryAll, startsWith, toFloat, toPx, trigger} from 'uikit-util';
1
+ import {
2
+ append,
3
+ attr,
4
+ children,
5
+ createEvent,
6
+ css,
7
+ data,
8
+ escape,
9
+ fragment,
10
+ hasAttr,
11
+ includes,
12
+ isArray,
13
+ isEmpty,
14
+ isTag,
15
+ parent,
16
+ parseOptions,
17
+ queryAll,
18
+ removeAttr,
19
+ startsWith,
20
+ toFloat,
21
+ toPx,
22
+ trigger,
23
+ } from 'uikit-util';
24
+
25
+ const nativeLazyLoad = 'loading' in HTMLImageElement.prototype;
26
+ const nativeIsIntersecting = 'isIntersecting' in IntersectionObserverEntry.prototype; // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
2
27
 
3
28
  export default {
4
-
5
29
  args: 'dataSrc',
6
30
 
7
31
  props: {
8
32
  dataSrc: String,
9
- dataSrcset: Boolean,
10
- sizes: String,
11
- width: Number,
12
- height: Number,
33
+ sources: String,
13
34
  offsetTop: String,
14
35
  offsetLeft: String,
15
- target: String
36
+ target: String,
37
+ loading: String,
16
38
  },
17
39
 
18
40
  data: {
19
41
  dataSrc: '',
20
- dataSrcset: false,
21
- sizes: false,
22
- width: false,
23
- height: false,
42
+ sources: false,
24
43
  offsetTop: '50vh',
25
44
  offsetLeft: '50vw',
26
- target: false
45
+ target: false,
46
+ loading: 'lazy',
27
47
  },
28
48
 
29
49
  computed: {
30
-
31
- cacheKey({dataSrc}) {
32
- return `${this.$name}.${dataSrc}`;
33
- },
34
-
35
- width({width, dataWidth}) {
36
- return width || dataWidth;
37
- },
38
-
39
- height({height, dataHeight}) {
40
- return height || dataHeight;
41
- },
42
-
43
- sizes({sizes, dataSizes}) {
44
- return sizes || dataSizes;
45
- },
46
-
47
- isImg(_, $el) {
48
- return isImg($el);
49
- },
50
-
51
50
  target: {
52
-
53
- get({target}) {
51
+ get({ target }) {
54
52
  return [this.$el, ...queryAll(target, this.$el)];
55
53
  },
56
54
 
57
55
  watch() {
58
56
  this.observe();
59
- }
60
-
61
- },
62
-
63
- offsetTop({offsetTop}) {
64
- return toPx(offsetTop, 'height');
57
+ },
65
58
  },
66
-
67
- offsetLeft({offsetLeft}) {
68
- return toPx(offsetLeft, 'width');
69
- }
70
-
71
59
  },
72
60
 
73
61
  connected() {
74
-
75
- if (!window.IntersectionObserver) {
76
- setSrcAttrs(this.$el, this.dataSrc, this.dataSrcset, this.sizes);
62
+ if (this.loading !== 'lazy' || !window.IntersectionObserver || !nativeIsIntersecting) {
63
+ this.load();
77
64
  return;
78
65
  }
79
66
 
80
- if (storage[this.cacheKey]) {
81
- setSrcAttrs(this.$el, storage[this.cacheKey], this.dataSrcset, this.sizes);
82
- } else if (this.isImg && this.width && this.height) {
83
- setSrcAttrs(this.$el, getPlaceholderImage(this.width, this.height, this.sizes));
84
- }
67
+ if (nativeLazyLoad && isImg(this.$el)) {
68
+ this.$el.loading = 'lazy';
69
+ setSrcAttrs(this.$el);
85
70
 
86
- this.observer = new IntersectionObserver(this.load, {
87
- rootMargin: `${this.offsetTop}px ${this.offsetLeft}px`
88
- });
89
-
90
- requestAnimationFrame(this.observe);
71
+ if (this.target.length === 1) {
72
+ return;
73
+ }
74
+ }
91
75
 
76
+ ensureSrcAttribute(this.$el);
77
+
78
+ const rootMargin = `${toPx(this.offsetTop, 'height')}px ${toPx(
79
+ this.offsetLeft,
80
+ 'width'
81
+ )}px`;
82
+ this.observer = new IntersectionObserver(
83
+ (entries) => {
84
+ if (entries.some((entry) => entry.isIntersecting)) {
85
+ this.load();
86
+ this.observer.disconnect();
87
+ }
88
+ },
89
+ { rootMargin }
90
+ );
91
+ this.observe();
92
92
  },
93
93
 
94
94
  disconnected() {
95
- this.observer && this.observer.disconnect();
95
+ if (this._data.image) {
96
+ this._data.image.onload = '';
97
+ }
98
+
99
+ this.observer?.disconnect();
96
100
  },
97
101
 
98
102
  update: {
99
-
100
- read({image}) {
101
-
102
- if (!this.observer) {
103
- return false;
104
- }
105
-
106
- if (!image && document.readyState === 'complete') {
107
- this.load(this.observer.takeRecords());
108
- }
109
-
110
- if (this.isImg) {
103
+ write(store) {
104
+ if (!this.observer || isImg(this.$el)) {
111
105
  return false;
112
106
  }
113
107
 
114
- image && image.then(img => img && img.currentSrc !== '' && setSrcAttrs(this.$el, currentSrc(img)));
115
-
116
- },
117
-
118
- write(data) {
119
-
120
- if (this.dataSrcset && window.devicePixelRatio !== 1) {
121
-
108
+ const srcset = data(this.$el, 'data-srcset');
109
+ if (srcset && window.devicePixelRatio !== 1) {
122
110
  const bgSize = css(this.$el, 'backgroundSize');
123
- if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === data.bgSize) {
124
- data.bgSize = getSourceSize(this.dataSrcset, this.sizes);
125
- css(this.$el, 'backgroundSize', `${data.bgSize}px`);
111
+ if (bgSize.match(/^(auto\s?)+$/) || toFloat(bgSize) === store.bgSize) {
112
+ store.bgSize = getSourceSize(srcset, data(this.$el, 'sizes'));
113
+ css(this.$el, 'backgroundSize', `${store.bgSize}px`);
126
114
  }
127
-
128
115
  }
129
-
130
116
  },
131
117
 
132
- events: ['resize']
133
-
118
+ events: ['resize'],
134
119
  },
135
120
 
136
121
  methods: {
137
-
138
- load(entries) {
139
-
140
- // Old chromium based browsers (UC Browser) did not implement `isIntersecting`
141
- if (!entries.some(entry => isUndefined(entry.isIntersecting) || entry.isIntersecting)) {
142
- return;
122
+ load() {
123
+ if (this._data.image) {
124
+ return this._data.image;
143
125
  }
144
126
 
145
- this._data.image = getImage(this.dataSrc, this.dataSrcset, this.sizes).then(img => {
146
-
147
- setSrcAttrs(this.$el, currentSrc(img), img.srcset, img.sizes);
148
- storage[this.cacheKey] = currentSrc(img);
149
- return img;
127
+ const image = isImg(this.$el)
128
+ ? this.$el
129
+ : getImageFromElement(this.$el, this.dataSrc, this.sources);
150
130
 
151
- }, e => trigger(this.$el, new e.constructor(e.type, e)));
152
-
153
- this.observer.disconnect();
131
+ removeAttr(image, 'loading');
132
+ setSrcAttrs(this.$el, image.currentSrc);
133
+ return (this._data.image = image);
154
134
  },
155
135
 
156
136
  observe() {
157
137
  if (this._connected && !this._data.image) {
158
- this.target.forEach(el => this.observer.observe(el));
138
+ for (const el of this.target) {
139
+ this.observer.observe(el);
140
+ }
159
141
  }
160
- }
161
-
162
- }
163
-
142
+ },
143
+ },
164
144
  };
165
145
 
166
- function setSrcAttrs(el, src, srcset, sizes) {
167
-
146
+ function setSrcAttrs(el, src) {
168
147
  if (isImg(el)) {
169
- const set = (prop, val) => val && val !== el[prop] && (el[prop] = val);
170
- set('sizes', sizes);
171
- set('srcset', srcset);
172
- set('src', src);
148
+ const parentNode = parent(el);
149
+ const elements = isPicture(parentNode) ? children(parentNode) : [el];
150
+ elements.forEach((el) => setSourceProps(el, el));
173
151
  } else if (src) {
174
-
175
152
  const change = !includes(el.style.backgroundImage, src);
176
153
  if (change) {
177
154
  css(el, 'backgroundImage', `url(${escape(src)})`);
178
155
  trigger(el, createEvent('load', false));
179
156
  }
180
-
181
157
  }
158
+ }
159
+
160
+ const srcProps = ['data-src', 'data-srcset', 'sizes'];
161
+ function setSourceProps(sourceEl, targetEl) {
162
+ srcProps.forEach((prop) => {
163
+ const value = data(sourceEl, prop);
164
+ if (value) {
165
+ attr(targetEl, prop.replace(/^(data-)+/, ''), value);
166
+ }
167
+ });
168
+ }
182
169
 
170
+ function getImageFromElement(el, src, sources) {
171
+ const img = new Image();
172
+
173
+ wrapInPicture(img, sources);
174
+ setSourceProps(el, img);
175
+ img.onload = () => {
176
+ setSrcAttrs(el, img.currentSrc);
177
+ };
178
+ attr(img, 'src', src);
179
+ return img;
183
180
  }
184
181
 
185
- function getPlaceholderImage(width, height, sizes) {
182
+ function wrapInPicture(img, sources) {
183
+ sources = parseSources(sources);
184
+
185
+ if (sources.length) {
186
+ const picture = fragment('<picture>');
187
+ for (const attrs of sources) {
188
+ const source = fragment('<source>');
189
+ attr(source, attrs);
190
+ append(picture, source);
191
+ }
192
+ append(picture, img);
193
+ }
194
+ }
186
195
 
187
- if (sizes) {
188
- ({width, height} = Dimensions.ratio({width, height}, 'width', toPx(sizesToPixel(sizes))));
196
+ function parseSources(sources) {
197
+ if (!sources) {
198
+ return [];
189
199
  }
190
200
 
191
- return `data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"></svg>`;
201
+ if (startsWith(sources, '[')) {
202
+ try {
203
+ sources = JSON.parse(sources);
204
+ } catch (e) {
205
+ sources = [];
206
+ }
207
+ } else {
208
+ sources = parseOptions(sources);
209
+ }
210
+
211
+ if (!isArray(sources)) {
212
+ sources = [sources];
213
+ }
214
+
215
+ return sources.filter((source) => !isEmpty(source));
192
216
  }
193
217
 
194
218
  const sizesRe = /\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;
@@ -212,11 +236,11 @@ const additionRe = /[+-]?(\d+)/g;
212
236
  function evaluateSize(size) {
213
237
  return startsWith(size, 'calc')
214
238
  ? size
215
- .slice(5, -1)
216
- .replace(sizeRe, size => toPx(size))
217
- .replace(/ /g, '')
218
- .match(additionRe)
219
- .reduce((a, b) => a + +b, 0)
239
+ .slice(5, -1)
240
+ .replace(sizeRe, (size) => toPx(size))
241
+ .replace(/ /g, '')
242
+ .match(additionRe)
243
+ .reduce((a, b) => a + +b, 0)
220
244
  : size;
221
245
  }
222
246
 
@@ -225,25 +249,19 @@ function getSourceSize(srcset, sizes) {
225
249
  const srcSize = toPx(sizesToPixel(sizes));
226
250
  const descriptors = (srcset.match(srcSetRe) || []).map(toFloat).sort((a, b) => a - b);
227
251
 
228
- return descriptors.filter(size => size >= srcSize)[0] || descriptors.pop() || '';
252
+ return descriptors.filter((size) => size >= srcSize)[0] || descriptors.pop() || '';
229
253
  }
230
254
 
231
- function isImg(el) {
232
- return el.tagName === 'IMG';
255
+ function ensureSrcAttribute(el) {
256
+ if (isImg(el) && !hasAttr(el, 'src')) {
257
+ attr(el, 'src', 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
258
+ }
233
259
  }
234
260
 
235
- function currentSrc(el) {
236
- return el.currentSrc || el.src;
261
+ function isPicture(el) {
262
+ return isTag(el, 'picture');
237
263
  }
238
264
 
239
- const key = '__test__';
240
- let storage;
241
-
242
- // workaround for Safari's private browsing mode and accessing sessionStorage in Blink
243
- try {
244
- storage = window.sessionStorage || {};
245
- storage[key] = 1;
246
- delete storage[key];
247
- } catch (e) {
248
- storage = {};
265
+ function isImg(el) {
266
+ return isTag(el, 'img');
249
267
  }
@@ -1,41 +1,41 @@
1
- export {default as Accordion} from './accordion';
2
- export {default as Alert} from './alert';
3
- export {default as Cover} from './cover';
4
- export {default as Drop, default as Dropdown} from './drop';
5
- export {default as FormCustom} from './form-custom';
6
- export {default as Gif} from './gif';
7
- export {default as Grid} from './grid';
8
- export {default as HeightMatch} from './height-match';
9
- export {default as HeightViewport} from './height-viewport';
10
- export {default as Icon} from './icon';
11
- export {default as Img} from './img';
12
- export {default as Leader} from './leader';
13
- export {default as Margin} from './margin';
14
- export {default as Modal} from './modal';
15
- export {default as Nav} from './nav';
16
- export {default as Navbar} from './navbar';
17
- export {default as Offcanvas} from './offcanvas';
18
- export {default as OverflowAuto} from './overflow-auto';
19
- export {default as Responsive} from './responsive';
20
- export {default as Scroll} from './scroll';
21
- export {default as Scrollspy} from './scrollspy';
22
- export {default as ScrollspyNav} from './scrollspy-nav';
23
- export {default as Sticky} from './sticky';
24
- export {default as Svg} from './svg';
25
- export {default as Switcher} from './switcher';
26
- export {default as Tab} from './tab';
27
- export {default as Toggle} from './toggle';
28
- export {default as Video} from './video';
1
+ export { default as Accordion } from './accordion';
2
+ export { default as Alert } from './alert';
3
+ export { default as Cover } from './cover';
4
+ export { default as Drop, default as Dropdown } from './drop';
5
+ export { default as FormCustom } from './form-custom';
6
+ export { default as Gif } from './gif';
7
+ export { default as Grid } from './grid';
8
+ export { default as HeightMatch } from './height-match';
9
+ export { default as HeightViewport } from './height-viewport';
10
+ export { default as Icon } from './icon';
11
+ export { default as Img } from './img';
12
+ export { default as Leader } from './leader';
13
+ export { default as Margin } from './margin';
14
+ export { default as Modal } from './modal';
15
+ export { default as Nav } from './nav';
16
+ export { default as Navbar } from './navbar';
17
+ export { default as Offcanvas } from './offcanvas';
18
+ export { default as OverflowAuto } from './overflow-auto';
19
+ export { default as Responsive } from './responsive';
20
+ export { default as Scroll } from './scroll';
21
+ export { default as Scrollspy } from './scrollspy';
22
+ export { default as ScrollspyNav } from './scrollspy-nav';
23
+ export { default as Sticky } from './sticky';
24
+ export { default as Svg } from './svg';
25
+ export { default as Switcher } from './switcher';
26
+ export { default as Tab } from './tab';
27
+ export { default as Toggle } from './toggle';
28
+ export { default as Video } from './video';
29
29
 
30
30
  // Icon components
31
- export {Close} from './icon';
32
- export {Spinner} from './icon';
33
- export {Slidenav as SlidenavNext} from './icon';
34
- export {Slidenav as SlidenavPrevious} from './icon';
35
- export {Search as SearchIcon} from './icon';
36
- export {IconComponent as Marker} from './icon';
37
- export {IconComponent as NavbarToggleIcon} from './icon';
38
- export {IconComponent as OverlayIcon} from './icon';
39
- export {IconComponent as PaginationNext} from './icon';
40
- export {IconComponent as PaginationPrevious} from './icon';
41
- export {IconComponent as Totop} from './icon';
31
+ export { Close } from './icon';
32
+ export { Spinner } from './icon';
33
+ export { Slidenav as SlidenavNext } from './icon';
34
+ export { Slidenav as SlidenavPrevious } from './icon';
35
+ export { Search as SearchIcon } from './icon';
36
+ export { IconComponent as Marker } from './icon';
37
+ export { IconComponent as NavbarToggleIcon } from './icon';
38
+ export { IconComponent as OverlayIcon } from './icon';
39
+ export { IconComponent as PaginationNext } from './icon';
40
+ export { IconComponent as PaginationPrevious } from './icon';
41
+ export { IconComponent as Totop } from './icon';
@@ -1,28 +1,25 @@
1
1
  import Class from '../mixin/class';
2
2
  import Media from '../mixin/media';
3
- import {attr, getCssVar, toggleClass, unwrap, wrapInner} from 'uikit-util';
3
+ import { attr, getCssVar, toggleClass, unwrap, wrapInner } from 'uikit-util';
4
4
 
5
5
  export default {
6
-
7
6
  mixins: [Class, Media],
8
7
 
9
8
  props: {
10
- fill: String
9
+ fill: String,
11
10
  },
12
11
 
13
12
  data: {
14
13
  fill: '',
15
14
  clsWrapper: 'uk-leader-fill',
16
15
  clsHide: 'uk-leader-hide',
17
- attrFill: 'data-fill'
16
+ attrFill: 'data-fill',
18
17
  },
19
18
 
20
19
  computed: {
21
-
22
- fill({fill}) {
20
+ fill({ fill }) {
23
21
  return fill || getCssVar('leader-fill-content');
24
- }
25
-
22
+ },
26
23
  },
27
24
 
28
25
  connected() {
@@ -34,9 +31,7 @@ export default {
34
31
  },
35
32
 
36
33
  update: {
37
-
38
- read({changed, width}) {
39
-
34
+ read({ changed, width }) {
40
35
  const prev = width;
41
36
 
42
37
  width = Math.floor(this.$el.offsetWidth / 2);
@@ -45,23 +40,19 @@ export default {
45
40
  width,
46
41
  fill: this.fill,
47
42
  changed: changed || prev !== width,
48
- hide: !this.matchMedia
43
+ hide: !this.matchMedia,
49
44
  };
50
45
  },
51
46
 
52
47
  write(data) {
53
-
54
48
  toggleClass(this.wrapper, this.clsHide, data.hide);
55
49
 
56
50
  if (data.changed) {
57
51
  data.changed = false;
58
52
  attr(this.wrapper, this.attrFill, new Array(data.width).join(data.fill));
59
53
  }
60
-
61
54
  },
62
55
 
63
- events: ['resize']
64
-
65
- }
66
-
56
+ events: ['resize'],
57
+ },
67
58
  };
@@ -1,42 +1,37 @@
1
- import {isRtl, isVisible, offsetPosition, toggleClass} from 'uikit-util';
1
+ import { isRtl, isVisible, offsetPosition, toggleClass } from 'uikit-util';
2
2
 
3
3
  export default {
4
-
5
4
  props: {
6
5
  margin: String,
7
- firstColumn: Boolean
6
+ firstColumn: Boolean,
8
7
  },
9
8
 
10
9
  data: {
11
10
  margin: 'uk-margin-small-top',
12
- firstColumn: 'uk-first-column'
11
+ firstColumn: 'uk-first-column',
13
12
  },
14
13
 
15
14
  update: {
16
-
17
15
  read() {
18
-
19
16
  const rows = getRows(this.$el.children);
20
17
 
21
18
  return {
22
19
  rows,
23
- columns: getColumns(rows)
20
+ columns: getColumns(rows),
24
21
  };
25
22
  },
26
23
 
27
- write({columns, rows}) {
28
- for (let i = 0; i < rows.length; i++) {
29
- for (let j = 0; j < rows[i].length; j++) {
30
- toggleClass(rows[i][j], this.margin, i !== 0);
31
- toggleClass(rows[i][j], this.firstColumn, !!~columns[0].indexOf(rows[i][j]));
24
+ write({ columns, rows }) {
25
+ for (const row of rows) {
26
+ for (const column of row) {
27
+ toggleClass(column, this.margin, rows[0] !== row);
28
+ toggleClass(column, this.firstColumn, !!~columns[0].indexOf(column));
32
29
  }
33
30
  }
34
31
  },
35
32
 
36
- events: ['resize']
37
-
38
- }
39
-
33
+ events: ['resize'],
34
+ },
40
35
  };
41
36
 
42
37
  export function getRows(items) {
@@ -44,38 +39,30 @@ export function getRows(items) {
44
39
  }
45
40
 
46
41
  function getColumns(rows) {
47
-
48
42
  const columns = [];
49
43
 
50
- for (let i = 0; i < rows.length; i++) {
51
- const sorted = sortBy(rows[i], 'left', 'right');
44
+ for (const row of rows) {
45
+ const sorted = sortBy(row, 'left', 'right');
52
46
  for (let j = 0; j < sorted.length; j++) {
53
- columns[j] = !columns[j] ? sorted[j] : columns[j].concat(sorted[j]);
47
+ columns[j] = columns[j] ? columns[j].concat(sorted[j]) : sorted[j];
54
48
  }
55
49
  }
56
50
 
57
- return isRtl
58
- ? columns.reverse()
59
- : columns;
51
+ return isRtl ? columns.reverse() : columns;
60
52
  }
61
53
 
62
54
  function sortBy(items, startProp, endProp) {
63
-
64
55
  const sorted = [[]];
65
56
 
66
- for (let i = 0; i < items.length; i++) {
67
-
68
- const el = items[i];
69
-
57
+ for (const el of items) {
70
58
  if (!isVisible(el)) {
71
59
  continue;
72
60
  }
73
61
 
74
62
  let dim = getOffset(el);
75
63
 
76
- for (let j = sorted.length - 1; j >= 0; j--) {
77
-
78
- const current = sorted[j];
64
+ for (let i = sorted.length - 1; i >= 0; i--) {
65
+ const current = sorted[i];
79
66
 
80
67
  if (!current[0]) {
81
68
  current.push(el);
@@ -100,21 +87,18 @@ function sortBy(items, startProp, endProp) {
100
87
  break;
101
88
  }
102
89
 
103
- if (j === 0) {
90
+ if (i === 0) {
104
91
  sorted.unshift([el]);
105
92
  break;
106
93
  }
107
-
108
94
  }
109
-
110
95
  }
111
96
 
112
97
  return sorted;
113
98
  }
114
99
 
115
100
  function getOffset(element, offset = false) {
116
-
117
- let {offsetTop, offsetLeft, offsetHeight, offsetWidth} = element;
101
+ let { offsetTop, offsetLeft, offsetHeight, offsetWidth } = element;
118
102
 
119
103
  if (offset) {
120
104
  [offsetTop, offsetLeft] = offsetPosition(element);
@@ -124,6 +108,6 @@ function getOffset(element, offset = false) {
124
108
  top: offsetTop,
125
109
  left: offsetLeft,
126
110
  bottom: offsetTop + offsetHeight,
127
- right: offsetLeft + offsetWidth
111
+ right: offsetLeft + offsetWidth,
128
112
  };
129
113
  }