uikit 3.9.1 → 3.9.2-dev.774931570

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 (57) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/.eslintrc.json +6 -4
  3. package/build/build.js +23 -30
  4. package/build/icons.js +28 -2
  5. package/build/less.js +3 -3
  6. package/build/prefix.js +1 -1
  7. package/build/publishDev.js +4 -3
  8. package/build/scope.js +1 -1
  9. package/build/scss.js +4 -4
  10. package/build/util.js +76 -33
  11. package/dist/css/uikit-core-rtl.css +2 -2
  12. package/dist/css/uikit-core-rtl.min.css +1 -1
  13. package/dist/css/uikit-core.css +2 -2
  14. package/dist/css/uikit-core.min.css +1 -1
  15. package/dist/css/uikit-rtl.css +2 -2
  16. package/dist/css/uikit-rtl.min.css +1 -1
  17. package/dist/css/uikit.css +2 -2
  18. package/dist/css/uikit.min.css +1 -1
  19. package/dist/js/components/countdown.js +1 -1
  20. package/dist/js/components/countdown.min.js +2 -2
  21. package/dist/js/components/filter.js +1 -1
  22. package/dist/js/components/filter.min.js +2 -2
  23. package/dist/js/components/lightbox-panel.js +1 -1
  24. package/dist/js/components/lightbox-panel.min.js +2 -2
  25. package/dist/js/components/lightbox.js +1 -1
  26. package/dist/js/components/lightbox.min.js +2 -2
  27. package/dist/js/components/notification.js +1 -1
  28. package/dist/js/components/notification.min.js +2 -2
  29. package/dist/js/components/parallax.js +1 -1
  30. package/dist/js/components/parallax.min.js +2 -2
  31. package/dist/js/components/slider-parallax.js +1 -1
  32. package/dist/js/components/slider-parallax.min.js +2 -2
  33. package/dist/js/components/slider.js +1 -1
  34. package/dist/js/components/slider.min.js +2 -2
  35. package/dist/js/components/slideshow-parallax.js +1 -1
  36. package/dist/js/components/slideshow-parallax.min.js +2 -2
  37. package/dist/js/components/slideshow.js +1 -1
  38. package/dist/js/components/slideshow.min.js +2 -2
  39. package/dist/js/components/sortable.js +1 -1
  40. package/dist/js/components/sortable.min.js +2 -2
  41. package/dist/js/components/tooltip.js +1 -1
  42. package/dist/js/components/tooltip.min.js +2 -2
  43. package/dist/js/components/upload.js +1 -1
  44. package/dist/js/components/upload.min.js +2 -2
  45. package/dist/js/uikit-core.js +10 -8
  46. package/dist/js/uikit-core.min.js +2 -2
  47. package/dist/js/uikit-icons.js +1 -1
  48. package/dist/js/uikit-icons.min.js +2 -2
  49. package/dist/js/uikit.js +10 -8
  50. package/dist/js/uikit.min.js +2 -2
  51. package/package.json +7 -10
  52. package/src/js/uikit-core.js +1 -1
  53. package/src/js/uikit.js +1 -1
  54. package/src/js/util/style.js +9 -7
  55. package/src/less/components/leader.less +1 -1
  56. package/src/scss/components/leader.scss +1 -1
  57. package/tests/js/index.js +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## WIP
4
+
5
+ ### Fixed
6
+
7
+ - Fix build scripts for windows users
8
+ - Fix css in Leader component
9
+
3
10
  ## 3.9.1 (November 10, 2021)
4
11
 
5
12
  ### Changed
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "root": true,
3
3
  "env": {
4
- "es6": true,
5
- "node": true
4
+ "es2021": true,
5
+ "node": true,
6
+ "browser": false,
7
+ "commonjs": false
6
8
  },
7
9
  "extends": [
8
- "../.eslintrc.js"
10
+ "../.eslintrc.json"
9
11
  ],
10
12
  "parserOptions": {
11
- "ecmaVersion": 2020
13
+ "ecmaVersion": 2022
12
14
  }
13
15
  }
package/build/build.js CHANGED
@@ -1,13 +1,15 @@
1
- import path from 'path';
2
1
  import camelize from 'camelcase';
3
- import {__dirname, args, compile, glob, icons} from './util.js';
2
+ import {basename, resolve} from 'path';
3
+ import {args, compile, glob, icons} from './util.js';
4
4
 
5
- if (args.h || args.help) {
5
+ const bundles = getBundleTasks();
6
+ const components = await getComponentTasks();
6
7
 
8
+ if (args.h || args.help) {
7
9
  console.log(`
8
10
  usage:
9
11
 
10
- build.js [componentA, componentB, ...] [-d|debug|nominify|development]
12
+ build.js [componentA, componentB, ...] [-d|debug|nominify|watch]
11
13
 
12
14
  examples:
13
15
 
@@ -17,19 +19,15 @@ if (args.h || args.help) {
17
19
 
18
20
  available components:
19
21
 
20
- bundles: ${Object.keys(steps).join(', ')}
22
+ bundles: ${Object.keys(bundles).join(', ')}
21
23
  components: ${Object.keys(components).join(', ')}
22
24
 
23
25
  `);
24
26
  process.exit(0);
25
27
  }
26
28
 
27
- const minify = !(args.d || args.debug || args.nominify);
28
- const uikit = getUIkitTasks(minify);
29
- const components = await getComponentTasks(minify);
30
-
31
29
  let tasks;
32
- const allTasks = {...uikit, ...components};
30
+ const allTasks = {...bundles, ...components};
33
31
  if (args.all || Object.keys(args).length <= 1) {
34
32
  tasks = allTasks;
35
33
  } else if (args.components) {
@@ -37,50 +35,45 @@ if (args.all || Object.keys(args).length <= 1) {
37
35
  } else {
38
36
  tasks = Object.keys(args)
39
37
  .map(step => allTasks[step])
40
- .filter(t => t)
38
+ .filter(t => t);
41
39
  }
42
40
 
43
41
  await Promise.all(Object.values(tasks).map(task => task()));
44
42
 
45
- function getUIkitTasks(minify) {
43
+ function getBundleTasks() {
46
44
  return {
47
45
 
48
- core: () => compile('src/js/uikit-core.js', 'dist/js/uikit-core', {minify}),
46
+ core: () => compile('src/js/uikit-core.js', 'dist/js/uikit-core'),
49
47
 
50
- uikit: () => compile('src/js/uikit.js', 'dist/js/uikit', {minify}),
48
+ uikit: () => compile('src/js/uikit.js', 'dist/js/uikit'),
51
49
 
52
50
  icons: async () => compile('build/wrapper/icons.js', 'dist/js/uikit-icons', {
53
- minify,
54
- name: 'icons',
55
- replaces: {ICONS: await icons('{src/images,custom}/icons/*.svg')}
56
- }
57
- ),
51
+ name: 'icons',
52
+ replaces: {ICONS: await icons('{src/images,custom}/icons/*.svg')}
53
+ }),
58
54
 
59
55
  tests: async () => compile('tests/js/index.js', 'tests/js/test', {
60
- minify,
61
- name: 'test',
62
- replaces: {TESTS: await getTestFiles()}
63
- }
64
- ),
56
+ name: 'test',
57
+ replaces: {TESTS: await getTestFiles()}
58
+ })
65
59
 
66
60
  };
67
61
  }
68
62
 
69
- async function getComponentTasks(minify) {
63
+ async function getComponentTasks() {
70
64
 
71
65
  const components = await glob('src/js/components/!(index).js');
72
66
 
73
67
  return components.reduce((components, file) => {
74
68
 
75
- const name = path.basename(file, '.js');
69
+ const name = basename(file, '.js');
76
70
 
77
71
  components[name] = () =>
78
- compile(`${__dirname}/wrapper/component.js`, `dist/js/components/${name}`, {
72
+ compile('build/wrapper/component.js', `dist/js/components/${name}`, {
79
73
  name,
80
- minify,
81
74
  external: ['uikit', 'uikit-util'],
82
75
  globals: {uikit: 'UIkit', 'uikit-util': 'UIkit.util'},
83
- aliases: {component: path.resolve(__dirname, '../src/js/components', name)},
76
+ aliases: {component: resolve('src/js/components', name)},
84
77
  replaces: {NAME: `'${camelize(name)}'`}
85
78
  });
86
79
 
@@ -91,5 +84,5 @@ async function getComponentTasks(minify) {
91
84
 
92
85
  async function getTestFiles() {
93
86
  const files = await glob('tests/!(index).html', {nosort: true});
94
- return JSON.stringify(files.map(file => path.basename(file, '.html')));
87
+ return JSON.stringify(files.map(file => basename(file, '.html')));
95
88
  }
package/build/icons.js CHANGED
@@ -1,5 +1,23 @@
1
1
  import {args, compile, glob, icons} from './util.js';
2
2
 
3
+ if (args.h || args.help) {
4
+ console.log(`
5
+
6
+ Builds additional custom uikit icons found in './custom/*/icons'
7
+
8
+ usage:
9
+
10
+ icons.js [custom|name]
11
+
12
+ -c|--custom
13
+ Specify custom folder to look for icons (default: './custom/*/icons')
14
+ -n|--name
15
+ Specify name regex to match against folder (default: '([a-z]+)/icons$')
16
+
17
+ `);
18
+ process.exit(0);
19
+ }
20
+
3
21
  const path = args.c || args.custom || 'custom/*/icons';
4
22
  const match = args.n || args.name || '([a-z]+)/icons$';
5
23
 
@@ -7,6 +25,14 @@ await Promise.all((await glob(path)).map(compileIcons));
7
25
 
8
26
  async function compileIcons(folder) {
9
27
  const [, name] = folder.toString().match(new RegExp(match, 'i'));
10
- const ICONS = await icons(`{src/images/icons,${folder}}/*.svg`);
11
- return compile('build/wrapper/icons.js', `dist/js/uikit-icons-${name}`, {name, replaces: {ICONS}});
28
+ return compile(
29
+ 'build/wrapper/icons.js',
30
+ `dist/js/uikit-icons-${name}`,
31
+ {
32
+ name,
33
+ replaces: {
34
+ ICONS: await icons(`{src/images/icons,${folder}}/*.svg`)
35
+ }
36
+ }
37
+ );
12
38
  }
package/build/less.js CHANGED
@@ -1,9 +1,9 @@
1
- import {basename} from 'path';
2
1
  import rtlcss from 'rtlcss';
3
2
  import postcss from 'postcss';
3
+ import {basename} from 'path';
4
4
  import {args, banner, glob, minify, pathExists, read, readJson, renderLess, write} from './util.js';
5
5
 
6
- const rtl = args.rtl;
6
+ const {rtl} = args;
7
7
  const develop = args.develop || args.debug || args.d || args.nominify;
8
8
  const sources = [
9
9
  {src: 'src/less/uikit.less', dist: `dist/css/uikit-core${rtl ? '-rtl' : ''}.css`},
@@ -25,7 +25,7 @@ for (const src of await glob('custom/*.less')) {
25
25
  sources.push({src, dist});
26
26
  }
27
27
 
28
- await Promise.all(sources.map(({src, dist}) => compile(src, dist, develop, rtl)))
28
+ await Promise.all(sources.map(({src, dist}) => compile(src, dist, develop, rtl)));
29
29
 
30
30
  if (!rtl && (Object.keys(themes).length || !await pathExists('themes.json'))) {
31
31
  await write('themes.json', JSON.stringify(themes));
package/build/prefix.js CHANGED
@@ -63,7 +63,7 @@ async function replacePrefix(from, to) {
63
63
 
64
64
  for (const file of await glob('dist/**/*.js')) {
65
65
  await replaceInFile(file, data => data
66
- .replace(new RegExp(`${from}-`, 'g'),`${to}-`)
66
+ .replace(new RegExp(`${from}-`, 'g'), `${to}-`)
67
67
  .replace(new RegExp(`(${from})?UIkit`, 'g'), `${to === 'uk' ? '' : to}UIkit`)
68
68
  );
69
69
  }
@@ -1,9 +1,10 @@
1
- import {inc} from 'semver';
2
- import {resolve} from 'path';
1
+ import semver from 'semver';
3
2
  import {args, getVersion, run} from './util.js';
4
3
 
4
+ const {inc} = semver;
5
+
5
6
  // default exec options
6
- const options = {cwd: resolve(`${__dirname}/..`), encoding: 'utf8'};
7
+ const options = {encoding: 'utf8'};
7
8
  if (args.f || args.force || await isDevCommit()) {
8
9
 
9
10
  // increase version patch number
package/build/scope.js CHANGED
@@ -41,7 +41,7 @@ if (args.cleanup && prevScope) {
41
41
  async function getScope(files) {
42
42
  for (const file of files) {
43
43
  const data = await read(file);
44
- const scope = (data.match(currentScopeRe) || data.match(currentScopeLegacyRe) || [])[1];
44
+ const [, scope] = (data.match(currentScopeRe) || data.match(currentScopeLegacyRe) || []);
45
45
  if (scope) {
46
46
  return scope;
47
47
  }
package/build/scss.js CHANGED
@@ -196,9 +196,9 @@ function getMixinsFromFile(file, data) {
196
196
  match = regex.exec(data);
197
197
 
198
198
  while (match) {
199
- themeMixins[match[1]] = match[0];
199
+ [themeMixins[match[1]]] = match;
200
200
  if (file.indexOf('theme/') < 0) {
201
- coreMixins[match[1]] = match[0];
201
+ [coreMixins[match[1]]] = match;
202
202
  }
203
203
  match = regex.exec(data);
204
204
  }
@@ -208,9 +208,9 @@ function getMixinsFromFile(file, data) {
208
208
  match = regex.exec(data);
209
209
 
210
210
  while (match) {
211
- themeMixins[match[1]] = match[0];
211
+ [themeMixins[match[1]]] = match;
212
212
  if (file.indexOf('theme/') < 0) {
213
- coreMixins[match[1]] = match[0];
213
+ [coreMixins[match[1]]] = match;
214
214
  }
215
215
 
216
216
  match = regex.exec(data);
package/build/util.js CHANGED
@@ -1,26 +1,24 @@
1
- import fs from 'fs-extra';
2
1
  import less from 'less';
3
- import { URL } from 'url';
2
+ import fs from 'fs-extra';
4
3
  import postcss from 'postcss';
5
4
  import globImport from 'glob';
6
- import {rollup} from 'rollup';
7
5
  import {optimize} from 'svgo';
8
- import uglify from 'uglify-js';
9
6
  import {promisify} from 'util';
10
7
  import minimist from 'minimist';
11
8
  import CleanCSS from 'clean-css';
12
9
  import html from 'rollup-plugin-html';
13
10
  import buble from '@rollup/plugin-buble';
14
11
  import alias from '@rollup/plugin-alias';
12
+ import modify from 'rollup-plugin-modify';
13
+ import {uglify} from 'rollup-plugin-uglify';
15
14
  import replace from '@rollup/plugin-replace';
16
- import {basename, dirname, resolve} from 'path';
15
+ import {basename, dirname, join} from 'path';
17
16
  import {exec as execImport} from 'child_process';
17
+ import {rollup, watch as rollupWatch} from 'rollup';
18
18
 
19
19
  export const exec = promisify(execImport);
20
20
  export const glob = promisify(globImport);
21
- export const readJson = fs.readJson;
22
- export const pathExists = fs.pathExists;
23
- export const __dirname = new URL('.', import.meta.url).pathname;
21
+ export const {pathExists, readJson} = fs;
24
22
 
25
23
  export const banner = `/*! UIkit ${await getVersion()} | https://www.getuikit.com | (c) 2014 - ${new Date().getFullYear()} YOOtheme | MIT License */\n`;
26
24
  export const validClassName = /[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/;
@@ -55,7 +53,7 @@ export async function write(dest, data) {
55
53
 
56
54
  export async function logFile(file) {
57
55
  const data = await read(file);
58
- console.log(`${cyan(resolve(file))} ${getSize(data)}`);
56
+ console.log(`${cyan(file)} ${getSize(data)}`);
59
57
  }
60
58
 
61
59
  export async function minify(file) {
@@ -67,7 +65,7 @@ export async function minify(file) {
67
65
  returnPromise: true
68
66
  }).minify([file]);
69
67
 
70
- await write(`${resolve(dirname(file), basename(file, '.css'))}.min.css`, styles);
68
+ await write(`${join(dirname(file), basename(file, '.css'))}.min.css`, styles);
71
69
 
72
70
  return styles;
73
71
 
@@ -94,24 +92,30 @@ export async function renderLess(data, options) {
94
92
  .css;
95
93
  }
96
94
 
97
- export async function compile(file, dest, {external, globals, name, aliases, replaces, minify = true}) {
95
+ export async function compile(file, dest, {external, globals, name, aliases, replaces} = {}) {
96
+
97
+ const minify = !args.nominify;
98
+ const debug = args.d || args.debug;
99
+ const watch = args.w || args.watch;
98
100
 
99
101
  name = (name || '').replace(/[^\w]/g, '_');
100
102
 
101
- const bundle = await rollup({
103
+ const inputOptions = {
102
104
  external,
103
- input: resolve(file),
105
+ input: file,
104
106
  plugins: [
105
107
  replace({
106
108
  preventAssignment: true,
107
- values: Object.assign({
108
- VERSION: `'${await getVersion()}'`
109
- }, replaces)}
110
- ),
109
+ values: {
110
+ VERSION: `'${await getVersion()}'`,
111
+ ...replaces
112
+ }
113
+ }),
111
114
  alias({
112
- entries: Object.assign({
113
- 'uikit-util': './src/js/util/index.js'
114
- }, aliases)
115
+ entries: {
116
+ 'uikit-util': './src/js/util/index.js',
117
+ ...aliases
118
+ }
115
119
  }),
116
120
  html({
117
121
  include: '**/*.svg',
@@ -119,25 +123,63 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
119
123
  collapseWhitespace: true
120
124
  }
121
125
  }),
122
- buble({namedFunctionExpressions: false})
126
+ buble({namedFunctionExpressions: false}),
127
+ modify({
128
+ find: /(>)\\n\s+|\\n\s+(<)/,
129
+ replace: (m, m1, m2) => `${m1 || ''} ${m2 || ''}`
130
+ })
123
131
  ]
124
- });
132
+ };
125
133
 
126
- let {output: [{code, map}]} = await bundle.generate({
134
+ const outputOptions = {
127
135
  globals,
128
136
  banner,
129
137
  format: 'umd',
130
138
  amd: {id: `UIkit${name}`.toLowerCase()},
131
139
  name: `UIkit${ucfirst(name)}`,
132
- sourcemap: !minify ? 'inline' : false
133
- });
140
+ sourcemap: debug ? 'inline' : false
141
+ };
142
+
143
+ const output = [{
144
+ ...outputOptions,
145
+ file: `${dest}.js`
146
+ }];
147
+
148
+ if (minify) {
149
+ output.push({
150
+ ...outputOptions,
151
+ file: `${dest}.min.js`,
152
+ plugins: [minify ? uglify({output: {preamble: banner}}) : undefined]
153
+ });
154
+ }
155
+
156
+ if (!watch) {
157
+ const bundle = await rollup(inputOptions);
158
+
159
+ for (const options of output) {
160
+ await bundle.write(options);
161
+ logFile(options.file);
162
+ }
134
163
 
135
- code = code.replace(/(>)\\n\s+|\\n\s+(<)/g, '$1 $2');
164
+ await bundle.close();
165
+ } else {
166
+ const watcher = rollupWatch({
167
+ ...inputOptions,
168
+ output
169
+ });
136
170
 
137
- return Promise.all([
138
- write(`${dest}.js`, code + (!minify ? '\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,' + Buffer.from(map.toString()).toString('base64') : '')),
139
- minify ? write(`${dest}.min.js`, uglify.minify(code, {output: {preamble: banner}}).code) : null
140
- ])[0];
171
+ watcher.on('event', ({code, result, output}) => {
172
+ if (result) {
173
+ result.close();
174
+
175
+ }
176
+ if (code === 'BUNDLE_END' && output) {
177
+ output.map(logFile);
178
+ }
179
+ });
180
+
181
+ watcher.close();
182
+ }
141
183
 
142
184
  }
143
185
 
@@ -182,8 +224,9 @@ export async function icons(src) {
182
224
  export async function run(cmd) {
183
225
  const {stdout, stderr} = await exec(cmd);
184
226
 
185
- stdout && console.log(stdout.trim());
186
- stderr && console.log(stderr.trim());
227
+ stderr && console.error(stderr.trim());
228
+
229
+ return stdout;
187
230
  }
188
231
 
189
232
  export function ucfirst(str) {
@@ -191,7 +234,7 @@ export function ucfirst(str) {
191
234
  }
192
235
 
193
236
  export async function getVersion() {
194
- return JSON.parse(await read(resolve(__dirname, '../package.json'))).version;
237
+ return (await readJson('package.json')).version;
195
238
  }
196
239
 
197
240
  export async function replaceInFile(file, fn) {
@@ -1,4 +1,4 @@
1
- /*! UIkit 3.9.1 | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */
1
+ /*! UIkit 3.9.2-dev.774931570 | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */
2
2
  /* ========================================================================
3
3
  Component: Base
4
4
  ========================================================================== */
@@ -4068,7 +4068,7 @@ select.uk-form-width-xsmall {
4068
4068
  content: '.';
4069
4069
  }
4070
4070
  :root {
4071
- --uk-leader-fill-content: .;
4071
+ --uk-leader-fill-content: '.';
4072
4072
  }
4073
4073
  /* ========================================================================
4074
4074
  Component: Notification