uikit 3.11.2-dev.bbaa4362f → 3.11.2-dev.c7ed3c19b

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 (165) 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 +8 -0
  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 +5356 -6709
  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 +8116 -9913
  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 +107 -93
  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 +59 -58
  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 +44 -49
  147. package/src/js/util/player.js +40 -36
  148. package/src/js/util/position.js +54 -46
  149. package/src/js/util/selector.js +34 -49
  150. package/src/js/util/style.js +36 -46
  151. package/src/js/util/viewport.js +75 -64
  152. package/src/less/components/flex.less +0 -9
  153. package/src/less/components/navbar.less +0 -7
  154. package/src/less/components/utility.less +22 -0
  155. package/src/scss/components/flex.scss +0 -9
  156. package/src/scss/components/form.scss +3 -3
  157. package/src/scss/components/icon.scss +2 -2
  158. package/src/scss/components/navbar.scss +0 -7
  159. package/src/scss/components/search.scss +1 -1
  160. package/src/scss/components/utility.scss +22 -0
  161. package/src/scss/variables-theme.scss +6 -6
  162. package/src/scss/variables.scss +6 -6
  163. package/tests/js/index.js +114 -85
  164. package/src/js/mixin/flex-bug.js +0 -56
  165. package/src/js/util/promise.js +0 -191
package/build/scope.js CHANGED
@@ -1,4 +1,4 @@
1
- import {args, glob, minify, read, renderLess, replaceInFile, validClassName} from './util.js';
1
+ import { args, glob, minify, read, renderLess, replaceInFile, validClassName } from './util.js';
2
2
 
3
3
  if (args.h || args.help) {
4
4
  console.log(`
@@ -33,7 +33,6 @@ if (args.cleanup && prevScope) {
33
33
 
34
34
  await cleanup(files, prevScope);
35
35
  await scope(files, newScope);
36
-
37
36
  } else {
38
37
  await scope(files, getNewScope());
39
38
  }
@@ -41,7 +40,7 @@ if (args.cleanup && prevScope) {
41
40
  async function getScope(files) {
42
41
  for (const file of files) {
43
42
  const data = await read(file);
44
- const [, scope] = (data.match(currentScopeRe) || data.match(currentScopeLegacyRe) || []);
43
+ const [, scope] = data.match(currentScopeRe) || data.match(currentScopeLegacyRe) || [];
45
44
  if (scope) {
46
45
  return scope;
47
46
  }
@@ -50,7 +49,6 @@ async function getScope(files) {
50
49
  }
51
50
 
52
51
  function getNewScope() {
53
-
54
52
  const scopeFromInput = args.scope || args.s || 'uk-scope';
55
53
 
56
54
  if (validClassName.test(scopeFromInput)) {
@@ -62,10 +60,16 @@ function getNewScope() {
62
60
 
63
61
  async function scope(files, scope) {
64
62
  for (const file of files) {
65
- await replaceInFile(file, async data => {
63
+ await replaceInFile(file, async (data) => {
66
64
  const output = await renderLess(`.${scope} {\n${stripComments(data)}\n}`);
67
65
  return `/* scoped: ${scope} */\n${
68
- output.replace(new RegExp(`.${scope}\\s((\\.(uk-(drag|modal-page|offcanvas-page|offcanvas-flip)))|html|:root)`, 'g'), '$1') // unescape
66
+ output.replace(
67
+ new RegExp(
68
+ `.${scope}\\s((\\.(uk-(drag|modal-page|offcanvas-page|offcanvas-flip)))|html|:root)`,
69
+ 'g'
70
+ ),
71
+ '$1'
72
+ ) // unescape
69
73
  }`;
70
74
  });
71
75
  await minify(file);
@@ -73,11 +77,17 @@ async function scope(files, scope) {
73
77
  }
74
78
 
75
79
  async function cleanup(files, scope) {
76
- const string = scope.split(' ').map(scope => `.${scope}`).join(' ');
80
+ const string = scope
81
+ .split(' ')
82
+ .map((scope) => `.${scope}`)
83
+ .join(' ');
77
84
  for (const file of files) {
78
- await replaceInFile(file, data => data
79
- .replace(currentScopeRe, '') // remove scope comment
80
- .replace(new RegExp(` *${string} ({[\\s\\S]*?})?`, 'g'), '') // replace classes
85
+ await replaceInFile(
86
+ file,
87
+ (data) =>
88
+ data
89
+ .replace(currentScopeRe, '') // remove scope comment
90
+ .replace(new RegExp(` *${string} ({[\\s\\S]*?})?`, 'g'), '') // replace classes
81
91
  );
82
92
  }
83
93
  }
@@ -86,6 +96,6 @@ function stripComments(input) {
86
96
  return input
87
97
  .replace(/\/\*(.|\n)*?\*\//gm, '')
88
98
  .split('\n')
89
- .filter(line => line.trim().substr(0, 2) !== '//')
99
+ .filter((line) => line.trim().substr(0, 2) !== '//')
90
100
  .join('\n');
91
101
  }
package/build/scss.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import NP from 'number-precision';
2
- import {glob, read, write} from './util.js';
2
+ import { glob, read, write } from './util.js';
3
3
 
4
4
  NP.enableBoundaryChecking(false);
5
5
 
@@ -74,14 +74,17 @@ const inverseTemplate = ` @include hook-inverse-component-base();
74
74
 
75
75
  /* First Step: Go through all files */
76
76
  for (const file of await glob('src/less/**/*.less')) {
77
-
78
77
  const data = await read(file);
79
78
 
80
79
  /* replace all Less stuff with SCSS */
81
- let scssData = data.replace(/\/less\//g, '/scss/') // change less/ dir to scss/ on imports
80
+ let scssData = data
81
+ .replace(/\/less\//g, '/scss/') // change less/ dir to scss/ on imports
82
82
  .replace(/\.less/g, '.scss') // change .less extensions to .scss on imports
83
83
  .replace(/@/g, '$') // convert variables
84
- .replace(/(:[^'"]*?\([^'"]+?)\s*\/\s*([0-9.-]+)\)/g, (exp, m1, m2) => `${m1} * ${NP.round(1 / parseFloat(m2), 5)})`)
84
+ .replace(
85
+ /(:[^'"]*?\([^'"]+?)\s*\/\s*([0-9.-]+)\)/g,
86
+ (exp, m1, m2) => `${m1} * ${NP.round(1 / parseFloat(m2), 5)})`
87
+ )
85
88
  .replace(/--uk-[^\s]+: (\$[^\s]+);/g, (exp, name) => exp.replace(name, `#{${name}}`))
86
89
  .replace(/\\\$/g, '\\@') // revert classes using the @ symbol
87
90
  .replace(/ e\(/g, ' unquote(') // convert escape function
@@ -89,14 +92,30 @@ for (const file of await glob('src/less/**/*.less')) {
89
92
  .replace(/(\$[\w-]*)\s*:(.*);/g, '$1: $2 !default;') // make variables optional
90
93
  .replace(/@mixin ([\w-]*)\s*\((.*)\)\s*{\s*}/g, '// @mixin $1($2){}') // comment empty mixins
91
94
  .replace(/\.(hook[a-zA-Z\-\d]+)(\(\))?;/g, '@if(mixin-exists($1)) {@include $1();}') // hook calls surrounded by a mixin-exists
92
- .replace(/\$(import|supports|media|font-face|page|-ms-viewport|keyframes|-webkit-keyframes|-moz-document)/g, '@$1') // replace valid '@' statements
95
+ .replace(
96
+ /\$(import|supports|media|font-face|page|-ms-viewport|keyframes|-webkit-keyframes|-moz-document)/g,
97
+ '@$1'
98
+ ) // replace valid '@' statements
93
99
  .replace(/tint\((\$[\w-]+),\s([^)]*)\)/g, 'mix(white, $1, $2)') // replace Less function tint with mix
94
- .replace(/fade\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2) => { return `rgba(${p1}, ${p2 / 100})`;}) // replace Less function fade with rgba
95
- .replace(/fadeout\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2) => { return `fade-out(${p1}, ${p2 / 100})`;}) // replace Less function fadeout with fade-out
100
+ .replace(/fade\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2) => {
101
+ return `rgba(${p1}, ${p2 / 100})`;
102
+ }) // replace Less function fade with rgba
103
+ .replace(/fade(in|out)\((\$[\w-]*), ([0-9]+)%\)/g, (match, p1, p2, p3) => {
104
+ return `fade-${p1}(${p2}, ${p3 / 100})`;
105
+ }) // replace Less function fadeout with fade-out
96
106
  .replace(/\.svg-fill/g, '@include svg-fill') // include svg-fill mixin
97
- .replace(/(.*):extend\((\.[\w-\\@]*) all\) when \((\$[\w-]*) = ([\w]+)\) {}/g, '@if ( $3 == $4 ) { $1 { @extend $2 !optional;} }') // update conditional extend and add !optional to ignore warnings
98
- .replace(/(\.[\w-\\@]+)\s*when\s*\((\$[\w-]*)\s*=\s*(\w+)\)\s*{\s*@if\(mixin-exists\(([\w-]*)\)\) {@include\s([\w-]*)\(\);\s*}\s*}/g, '@if ($2 == $3) { $1 { @if (mixin-exists($4)) {@include $4();}}}') // update conditional hook
99
- .replace(/(\.[\w-\\@]+)\s*when\s*\((\$[\w-]*)\s*=\s*(\w+)\)\s*({\s*.*?\s*})/gs, '@if ($2 == $3) {\n$1 $4\n}') // replace conditionals
107
+ .replace(
108
+ /(.*):extend\((\.[\w-\\@]*) all\) when \((\$[\w-]*) = ([\w]+)\) {}/g,
109
+ '@if ( $3 == $4 ) { $1 { @extend $2 !optional;} }'
110
+ ) // update conditional extend and add !optional to ignore warnings
111
+ .replace(
112
+ /(\.[\w-\\@]+)\s*when\s*\((\$[\w-]*)\s*=\s*(\w+)\)\s*{\s*@if\(mixin-exists\(([\w-]*)\)\) {@include\s([\w-]*)\(\);\s*}\s*}/g,
113
+ '@if ($2 == $3) { $1 { @if (mixin-exists($4)) {@include $4();}}}'
114
+ ) // update conditional hook
115
+ .replace(
116
+ /(\.[\w-\\@]+)\s*when\s*\((\$[\w-]*)\s*=\s*(\w+)\)\s*({\s*.*?\s*})/gs,
117
+ '@if ($2 == $3) {\n$1 $4\n}'
118
+ ) // replace conditionals
100
119
  .replace(/\${/g, '#{$') // string literals: from: /~"(.*)"/g, to: '#{"$1"}'
101
120
  .replace(/[^(](-\$[\w-]*)/g, ' ($1)') // surround negative variables with brackets
102
121
  .replace(/(--[\w-]+:\s*)~'([^']+)'/g, '$1$2') // string literals in custom properties
@@ -124,7 +143,10 @@ for (const file of await glob('src/less/**/*.less')) {
124
143
  /* remove the theme import first place */
125
144
  scssData = scssData.replace(/\/\/\n\/\/ Theme\n\/\/\n\n@import "theme\/_import.scss";/, '');
126
145
  /* add uikit-mixins and uikit-variables include to the uikit.scss file and change order, to load theme files first */
127
- scssData = scssData.replace(/\/\/ Core\n\/\//g, '// Theme\n//\n\n@import "theme/_import.scss";');
146
+ scssData = scssData.replace(
147
+ /\/\/ Core\n\/\//g,
148
+ '// Theme\n//\n\n@import "theme/_import.scss";'
149
+ );
128
150
  }
129
151
 
130
152
  /* mixin.less needs to be fully replaced by the new mixin file*/
@@ -133,27 +155,34 @@ for (const file of await glob('src/less/**/*.less')) {
133
155
  }
134
156
 
135
157
  await write(file.replace(/less/g, 'scss').replace('.theme.', '-theme.'), scssData);
136
-
137
158
  }
138
159
 
139
160
  /* Second Step write all new needed files for SASS */
140
161
 
141
162
  /* write mixins into new file */
142
- const mixins_theme = Object.keys(themeMixins).map(function (key) { return themeMixins[key]; });
163
+ const mixins_theme = Object.keys(themeMixins).map(function (key) {
164
+ return themeMixins[key];
165
+ });
143
166
  await write('src/scss/mixins-theme.scss', mixins_theme.join('\n'));
144
167
 
145
- const mixins_core = Object.keys(coreMixins).map(function (key) { return coreMixins[key]; });
168
+ const mixins_core = Object.keys(coreMixins).map(function (key) {
169
+ return coreMixins[key];
170
+ });
146
171
  await write('src/scss/mixins.scss', mixins_core.join('\n'));
147
172
 
148
173
  /* write core variables */
149
174
  const compactCoreVar = new Set();
150
- Object.keys(coreVar).map(key => getAllDependencies(coreVar, key).forEach(dependency => compactCoreVar.add(dependency)));
175
+ Object.keys(coreVar).map((key) =>
176
+ getAllDependencies(coreVar, key).forEach((dependency) => compactCoreVar.add(dependency))
177
+ );
151
178
 
152
179
  await write('src/scss/variables.scss', Array.from(compactCoreVar).join('\n'));
153
180
 
154
181
  /* write theme variables */
155
182
  const compactThemeVar = new Set();
156
- Object.keys(themeVar).map(key => getAllDependencies(themeVar, key).forEach(dependency => compactThemeVar.add(dependency)));
183
+ Object.keys(themeVar).map((key) =>
184
+ getAllDependencies(themeVar, key).forEach((dependency) => compactThemeVar.add(dependency))
185
+ );
157
186
 
158
187
  await write('src/scss/variables-theme.scss', Array.from(compactThemeVar).join('\n'));
159
188
 
@@ -162,15 +191,14 @@ await write('src/scss/variables-theme.scss', Array.from(compactThemeVar).join('\
162
191
  * @return Set with all the dependencies.
163
192
  */
164
193
  function getAllDependencies(allVariables, currentKey, dependencies = new Set()) {
165
-
166
194
  if (!allVariables[currentKey].dependencies.length) {
167
-
168
195
  dependencies.add(`${currentKey}: ${allVariables[currentKey].value}`);
169
196
  return Array.from(dependencies);
170
197
  } else {
171
-
172
- allVariables[currentKey].dependencies.forEach(dependecy => {
173
- getAllDependencies(allVariables, dependecy, dependencies).forEach(newDependency => dependencies.add(newDependency));
198
+ allVariables[currentKey].dependencies.forEach((dependecy) => {
199
+ getAllDependencies(allVariables, dependecy, dependencies).forEach((newDependency) =>
200
+ dependencies.add(newDependency)
201
+ );
174
202
  });
175
203
 
176
204
  dependencies.add(`${currentKey}: ${allVariables[currentKey].value}`);
@@ -183,14 +211,17 @@ function getAllDependencies(allVariables, currentKey, dependencies = new Set())
183
211
  * @return an updated data where the mixins have been removed.
184
212
  */
185
213
  function getMixinsFromFile(file, data) {
186
-
187
214
  /* Step 1: get all includes and insert them, so that at least empty mixins exist. */
188
215
  let regex = /@include ([a-z0-9-]+)/g;
189
216
  let match = regex.exec(data);
190
217
 
191
218
  while (match) {
192
- if (!(match[1] in themeMixins)) { themeMixins[match[1]] = `@mixin ${match[1]}(){}`; }
193
- if (!(match[1] in coreMixins)) { coreMixins[match[1]] = `@mixin ${match[1]}(){}`; }
219
+ if (!(match[1] in themeMixins)) {
220
+ themeMixins[match[1]] = `@mixin ${match[1]}(){}`;
221
+ }
222
+ if (!(match[1] in coreMixins)) {
223
+ coreMixins[match[1]] = `@mixin ${match[1]}(){}`;
224
+ }
194
225
 
195
226
  match = regex.exec(data);
196
227
  }
@@ -201,7 +232,7 @@ function getMixinsFromFile(file, data) {
201
232
 
202
233
  while (match) {
203
234
  [themeMixins[match[1]]] = match;
204
- if (file.indexOf('theme/') < 0) {
235
+ if (!file.includes('theme/')) {
205
236
  [coreMixins[match[1]]] = match;
206
237
  }
207
238
  match = regex.exec(data);
@@ -213,7 +244,7 @@ function getMixinsFromFile(file, data) {
213
244
 
214
245
  while (match) {
215
246
  [themeMixins[match[1]]] = match;
216
- if (file.indexOf('theme/') < 0) {
247
+ if (!file.includes('theme/')) {
217
248
  [coreMixins[match[1]]] = match;
218
249
  }
219
250
 
@@ -235,15 +266,15 @@ async function getVariablesFromFile(file, data) {
235
266
  let match = regex.exec(data);
236
267
 
237
268
  while (match) {
238
-
239
269
  /* check if variable is a background icon, if so replace it directly by the SVG */
240
- if (match[0].indexOf('../../images/backgrounds') >= 0) {
241
-
242
- const iconregex = /(\$[\w-]+)\s*:\s*"\.\.\/\.\.\/images\/backgrounds\/([\w./-]+)" !default;/g;
270
+ if (match[0].includes('../../images/backgrounds')) {
271
+ const iconregex =
272
+ /(\$[\w-]+)\s*:\s*"\.\.\/\.\.\/images\/backgrounds\/([\w./-]+)" !default;/g;
243
273
  const iconmatch = iconregex.exec(match[0]);
244
274
  let svg = (await read(`src/images/backgrounds/${iconmatch[2]}`)).toString();
245
- svg = `"${svg.replace(/\r?\n|\r/g, '%0A')
246
- .replace(/"/g, '\'')
275
+ svg = `"${svg
276
+ .replace(/\r?\n|\r/g, '%0A')
277
+ .replace(/"/g, "'")
247
278
  .replace(/\s/g, '%20')
248
279
  .replace(/</g, '%3C')
249
280
  .replace(/=/g, '%3D')
@@ -254,11 +285,11 @@ async function getVariablesFromFile(file, data) {
254
285
  .replace(/%3Csvg/, 'data:image/svg+xml;charset=UTF-8,%3Csvg')}"`;
255
286
 
256
287
  /* add SVG to the coreVar and themeVar only if it is a theme file and make it optional */
257
- if (file.indexOf('theme/') < 0) {
258
- coreVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
288
+ if (!file.includes('theme/')) {
289
+ coreVar[iconmatch[1]] = { value: `${svg} !default;`, dependencies: [] };
259
290
  }
260
291
 
261
- themeVar[iconmatch[1]] = {value: `${svg} !default;`, dependencies: []};
292
+ themeVar[iconmatch[1]] = { value: `${svg} !default;`, dependencies: [] };
262
293
 
263
294
  /* add SVG to the variable within the file itself as well */
264
295
  const inlineSVG = `${iconmatch[1]}: ${svg} !default;`;
@@ -266,7 +297,6 @@ async function getVariablesFromFile(file, data) {
266
297
 
267
298
  /* when it is not an SVG add the variable and search for its dependencies */
268
299
  } else {
269
-
270
300
  const variablesRegex = /(\$[\w-]+)/g;
271
301
  let variablesMatch = variablesRegex.exec(match[2]);
272
302
  const dependencies = [];
@@ -277,11 +307,14 @@ async function getVariablesFromFile(file, data) {
277
307
  }
278
308
 
279
309
  /* add variables only to the core Variables if it is not a theme file */
280
- if (file.indexOf('theme/') < 0) {
281
- coreVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
310
+ if (!file.includes('theme/')) {
311
+ coreVar[match[1]] = {
312
+ value: `${match[2]};`,
313
+ dependencies: Array.from(dependencies),
314
+ };
282
315
  }
283
316
 
284
- themeVar[match[1]] = {value: `${match[2]};`, dependencies: Array.from(dependencies)};
317
+ themeVar[match[1]] = { value: `${match[2]};`, dependencies: Array.from(dependencies) };
285
318
  }
286
319
 
287
320
  match = regex.exec(data);
package/build/util.js CHANGED
@@ -2,32 +2,32 @@ import less from 'less';
2
2
  import fs from 'fs-extra';
3
3
  import pLimit from 'p-limit';
4
4
  import globImport from 'glob';
5
- import {optimize} from 'svgo';
6
- import {promisify} from 'util';
5
+ import { optimize } from 'svgo';
6
+ import { promisify } from 'util';
7
7
  import minimist from 'minimist';
8
8
  import CleanCSS from 'clean-css';
9
9
  import html from 'rollup-plugin-html';
10
- import buble from '@rollup/plugin-buble';
11
10
  import alias from '@rollup/plugin-alias';
12
11
  import modify from 'rollup-plugin-modify';
12
+ import { babel } from '@rollup/plugin-babel';
13
13
  import replace from '@rollup/plugin-replace';
14
- import {basename, dirname, join} from 'path';
15
- import {exec as execImport} from 'child_process';
16
- import {rollup, watch as rollupWatch} from 'rollup';
17
- import {minify as rollupMinify} from 'rollup-plugin-esbuild';
14
+ import { basename, dirname, join } from 'path';
15
+ import { exec as execImport } from 'child_process';
16
+ import { rollup, watch as rollupWatch } from 'rollup';
17
+ import { minify as rollupMinify } from 'rollup-plugin-esbuild';
18
18
 
19
19
  const limit = pLimit(Number(process.env.cpus || 2));
20
20
 
21
21
  export const exec = promisify(execImport);
22
22
  export const glob = promisify(globImport);
23
- export const {pathExists, readJson} = fs;
23
+ export const { pathExists, readJson } = fs;
24
24
 
25
25
  export const banner = `/*! UIkit ${await getVersion()} | https://www.getuikit.com | (c) 2014 - ${new Date().getFullYear()} YOOtheme | MIT License */\n`;
26
26
  export const validClassName = /[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/;
27
27
 
28
28
  const argv = minimist(process.argv.slice(2));
29
29
 
30
- argv._.forEach(arg => {
30
+ argv._.forEach((arg) => {
31
31
  const tokens = arg.split('=');
32
32
  argv[tokens[0]] = tokens[1] || true;
33
33
  });
@@ -39,7 +39,6 @@ export function read(file) {
39
39
  }
40
40
 
41
41
  export async function write(dest, data) {
42
-
43
42
  const err = await fs.writeFile(dest, data);
44
43
 
45
44
  if (err) {
@@ -50,7 +49,6 @@ export async function write(dest, data) {
50
49
  await logFile(dest);
51
50
 
52
51
  return dest;
53
-
54
52
  }
55
53
 
56
54
  export async function logFile(file) {
@@ -59,26 +57,25 @@ export async function logFile(file) {
59
57
  }
60
58
 
61
59
  export async function minify(file) {
62
-
63
- const {styles} = await limit(() => new CleanCSS({
64
- advanced: false,
65
- keepSpecialComments: 0,
66
- rebase: false,
67
- returnPromise: true
68
- }).minify([file]));
60
+ const { styles } = await limit(() =>
61
+ new CleanCSS({
62
+ advanced: false,
63
+ keepSpecialComments: 0,
64
+ rebase: false,
65
+ returnPromise: true,
66
+ }).minify([file])
67
+ );
69
68
 
70
69
  await write(`${join(dirname(file), basename(file, '.css'))}.min.css`, styles);
71
70
 
72
71
  return styles;
73
-
74
72
  }
75
73
 
76
74
  export function renderLess(data, options) {
77
75
  return limit(async () => (await less.render(data, options)).css);
78
76
  }
79
77
 
80
- export async function compile(file, dest, {external, globals, name, aliases, replaces} = {}) {
81
-
78
+ export async function compile(file, dest, { external, globals, name, aliases, replaces } = {}) {
82
79
  const minify = !args.nominify;
83
80
  const debug = args.d || args.debug;
84
81
  const watch = args.w || args.watch;
@@ -93,48 +90,65 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
93
90
  preventAssignment: true,
94
91
  values: {
95
92
  VERSION: `'${await getVersion()}'`,
96
- ...replaces
97
- }
93
+ ...replaces,
94
+ },
98
95
  }),
99
96
  alias({
100
97
  entries: {
101
98
  'uikit-util': './src/js/util/index.js',
102
- ...aliases
103
- }
99
+ ...aliases,
100
+ },
104
101
  }),
105
102
  html({
106
103
  include: '**/*.svg',
107
104
  htmlMinifierOptions: {
108
- collapseWhitespace: true
109
- }
105
+ collapseWhitespace: true,
106
+ },
107
+ }),
108
+ babel({
109
+ presets: [
110
+ [
111
+ '@babel/preset-env',
112
+ {
113
+ loose: true,
114
+ targets: {
115
+ safari: '12',
116
+ },
117
+ },
118
+ ],
119
+ ],
120
+ extensions: ['.js'],
121
+ babelHelpers: 'bundled',
122
+ retainLines: true,
110
123
  }),
111
- buble({namedFunctionExpressions: false}),
112
124
  modify({
113
125
  find: /(>)\\n\s+|\\n\s+(<)/,
114
- replace: (m, m1, m2) => `${m1 || ''} ${m2 || ''}`
115
- })
116
- ]
126
+ replace: (m, m1, m2) => `${m1 || ''} ${m2 || ''}`,
127
+ }),
128
+ ],
117
129
  };
118
130
 
119
131
  const outputOptions = {
120
132
  globals,
121
133
  banner,
122
134
  format: 'umd',
123
- amd: {id: `UIkit${name}`.toLowerCase()},
135
+ amd: { id: `UIkit${name}`.toLowerCase() },
124
136
  name: `UIkit${ucfirst(name)}`,
125
- sourcemap: debug ? 'inline' : false
137
+ sourcemap: debug ? 'inline' : false,
126
138
  };
127
139
 
128
- const output = [{
129
- ...outputOptions,
130
- file: `${dest}.js`
131
- }];
140
+ const output = [
141
+ {
142
+ ...outputOptions,
143
+ file: `${dest}.js`,
144
+ },
145
+ ];
132
146
 
133
147
  if (minify) {
134
148
  output.push({
135
149
  ...outputOptions,
136
150
  file: `${dest}.min.js`,
137
- plugins: [minify ? rollupMinify() : undefined]
151
+ plugins: [minify ? rollupMinify() : undefined],
138
152
  });
139
153
  }
140
154
 
@@ -148,18 +162,16 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
148
162
 
149
163
  await bundle.close();
150
164
  } else {
151
-
152
165
  console.log('UIkit is watching the files...');
153
166
 
154
167
  const watcher = rollupWatch({
155
168
  ...inputOptions,
156
- output
169
+ output,
157
170
  });
158
171
 
159
- watcher.on('event', ({code, result, output, error}) => {
172
+ watcher.on('event', ({ code, result, output, error }) => {
160
173
  if (result) {
161
174
  result.close();
162
-
163
175
  }
164
176
  if (code === 'BUNDLE_END' && output) {
165
177
  output.map(logFile);
@@ -171,11 +183,9 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
171
183
 
172
184
  watcher.close();
173
185
  }
174
-
175
186
  }
176
187
 
177
188
  export async function icons(src) {
178
-
179
189
  const options = {
180
190
  plugins: [
181
191
  {
@@ -184,7 +194,7 @@ export async function icons(src) {
184
194
  overrides: {
185
195
  removeViewBox: false,
186
196
  cleanupNumericValues: {
187
- floatPrecision: 3
197
+ floatPrecision: 3,
188
198
  },
189
199
  convertPathData: false,
190
200
  convertShapeToPath: false,
@@ -193,31 +203,30 @@ export async function icons(src) {
193
203
  removeStyleElement: false,
194
204
  removeScriptElement: false,
195
205
  removeUnknownsAndDefaults: false,
196
- removeUselessStrokeAndFill: false
197
- }
198
- }
199
- }
200
- ]
206
+ removeUselessStrokeAndFill: false,
207
+ },
208
+ },
209
+ },
210
+ ],
201
211
  };
202
212
 
203
- const files = await glob(src, {nosort: true});
213
+ const files = await glob(src, { nosort: true });
204
214
  const icons = await Promise.all(
205
- files.map(file =>
206
- limit(async () =>
207
- (await optimize(await read(file), options)).data
208
- )
209
- )
215
+ files.map((file) => limit(async () => (await optimize(await read(file), options)).data))
210
216
  );
211
217
 
212
- return JSON.stringify(files.reduce((result, file, i) => {
213
- result[basename(file, '.svg')] = icons[i];
214
- return result;
215
- }, {}), null, ' ');
216
-
218
+ return JSON.stringify(
219
+ files.reduce((result, file, i) => {
220
+ result[basename(file, '.svg')] = icons[i];
221
+ return result;
222
+ }, {}),
223
+ null,
224
+ ' '
225
+ );
217
226
  }
218
227
 
219
228
  export async function run(cmd, options) {
220
- const {stdout, stderr} = await limit(() => exec(cmd, options));
229
+ const { stdout, stderr } = await limit(() => exec(cmd, options));
221
230
 
222
231
  stdout && console.log(stdout.trim());
223
232
  stderr && console.log(stderr.trim());
@@ -1,11 +1,9 @@
1
1
  function plugin(UIkit) {
2
-
3
2
  if (plugin.installed) {
4
3
  return;
5
4
  }
6
5
 
7
6
  UIkit.icon.add(ICONS);
8
-
9
7
  }
10
8
 
11
9
  if (typeof window !== 'undefined' && window.UIkit) {
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.11.2-dev.bbaa4362f | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
1
+ /*! UIkit 3.11.2-dev.c7ed3c19b | https://www.getuikit.com | (c) 2014 - 2022 YOOtheme | MIT License */
2
2
  /* ========================================================================
3
3
  Component: Base
4
4
  ========================================================================== */
@@ -4899,13 +4899,6 @@ ul.uk-nav-sub {
4899
4899
  .uk-navbar-container:not(.uk-navbar-transparent) {
4900
4900
  background: #f8f8f8;
4901
4901
  }
4902
- /*
4903
- * Remove pseudo elements created by micro clearfix as precaution (if Container component is used)
4904
- */
4905
- .uk-navbar-container > ::before,
4906
- .uk-navbar-container > ::after {
4907
- display: none !important;
4908
- }
4909
4902
  /* Groups
4910
4903
  ========================================================================== */
4911
4904
  /*
@@ -7628,6 +7621,47 @@ iframe[data-uk-cover] {
7628
7621
  [data-uk-responsive] {
7629
7622
  max-width: 100%;
7630
7623
  }
7624
+ /* Object
7625
+ ========================================================================== */
7626
+ .uk-object-fit-none {
7627
+ object-fit: none;
7628
+ }
7629
+ .uk-object-fit-cover {
7630
+ object-fit: cover;
7631
+ }
7632
+ .uk-object-fit-contain {
7633
+ object-fit: contain;
7634
+ }
7635
+ /*
7636
+ * Position
7637
+ */
7638
+ .uk-object-top-right {
7639
+ object-position: 100% 0;
7640
+ }
7641
+ .uk-object-top-center {
7642
+ object-position: 50% 0;
7643
+ }
7644
+ .uk-object-top-left {
7645
+ object-position: 0% 0;
7646
+ }
7647
+ .uk-object-center-right {
7648
+ object-position: 100% 50%;
7649
+ }
7650
+ .uk-object-center-center {
7651
+ object-position: 50% 50%;
7652
+ }
7653
+ .uk-object-center-left {
7654
+ object-position: 0% 50%;
7655
+ }
7656
+ .uk-object-bottom-right {
7657
+ object-position: 100% 100%;
7658
+ }
7659
+ .uk-object-bottom-center {
7660
+ object-position: 50% 100%;
7661
+ }
7662
+ .uk-object-bottom-left {
7663
+ object-position: 0% 100%;
7664
+ }
7631
7665
  /* Border
7632
7666
  ========================================================================== */
7633
7667
  .uk-border-circle {
@@ -7878,15 +7912,6 @@ iframe[data-uk-cover] {
7878
7912
  .uk-flex-inline {
7879
7913
  display: inline-flex;
7880
7914
  }
7881
- /*
7882
- * Remove pseudo elements created by micro clearfix as precaution
7883
- */
7884
- .uk-flex::before,
7885
- .uk-flex::after,
7886
- .uk-flex-inline::before,
7887
- .uk-flex-inline::after {
7888
- display: none;
7889
- }
7890
7915
  /* Alignment
7891
7916
  ========================================================================== */
7892
7917
  /*