uikit 3.9.1 → 3.9.2-dev.836238c9b

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 (52) hide show
  1. package/build/.eslintrc.json +6 -4
  2. package/build/build.js +22 -28
  3. package/build/icons.js +10 -2
  4. package/build/less.js +2 -2
  5. package/build/prefix.js +1 -1
  6. package/build/publishDev.js +4 -2
  7. package/build/scope.js +1 -1
  8. package/build/scss.js +4 -4
  9. package/build/util.js +74 -29
  10. package/dist/css/uikit-core-rtl.css +1 -1
  11. package/dist/css/uikit-core-rtl.min.css +1 -1
  12. package/dist/css/uikit-core.css +1 -1
  13. package/dist/css/uikit-core.min.css +1 -1
  14. package/dist/css/uikit-rtl.css +1 -1
  15. package/dist/css/uikit-rtl.min.css +1 -1
  16. package/dist/css/uikit.css +1 -1
  17. package/dist/css/uikit.min.css +1 -1
  18. package/dist/js/components/countdown.js +1 -1
  19. package/dist/js/components/countdown.min.js +2 -2
  20. package/dist/js/components/filter.js +1 -1
  21. package/dist/js/components/filter.min.js +2 -2
  22. package/dist/js/components/lightbox-panel.js +1 -1
  23. package/dist/js/components/lightbox-panel.min.js +2 -2
  24. package/dist/js/components/lightbox.js +1 -1
  25. package/dist/js/components/lightbox.min.js +2 -2
  26. package/dist/js/components/notification.js +1 -1
  27. package/dist/js/components/notification.min.js +2 -2
  28. package/dist/js/components/parallax.js +1 -1
  29. package/dist/js/components/parallax.min.js +2 -2
  30. package/dist/js/components/slider-parallax.js +1 -1
  31. package/dist/js/components/slider-parallax.min.js +2 -2
  32. package/dist/js/components/slider.js +1 -1
  33. package/dist/js/components/slider.min.js +2 -2
  34. package/dist/js/components/slideshow-parallax.js +1 -1
  35. package/dist/js/components/slideshow-parallax.min.js +2 -2
  36. package/dist/js/components/slideshow.js +1 -1
  37. package/dist/js/components/slideshow.min.js +2 -2
  38. package/dist/js/components/sortable.js +1 -1
  39. package/dist/js/components/sortable.min.js +2 -2
  40. package/dist/js/components/tooltip.js +1 -1
  41. package/dist/js/components/tooltip.min.js +2 -2
  42. package/dist/js/components/upload.js +1 -1
  43. package/dist/js/components/upload.min.js +2 -2
  44. package/dist/js/uikit-core.js +2 -2
  45. package/dist/js/uikit-core.min.js +2 -2
  46. package/dist/js/uikit-icons.js +1 -1
  47. package/dist/js/uikit-icons.min.js +2 -2
  48. package/dist/js/uikit.js +2 -2
  49. package/dist/js/uikit.min.js +2 -2
  50. package/package.json +7 -10
  51. package/src/js/uikit-core.js +1 -1
  52. package/src/js/uikit.js +1 -1
@@ -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,16 @@
1
- import path from 'path';
2
1
  import camelize from 'camelcase';
2
+ import {basename, resolve} from 'path';
3
3
  import {__dirname, args, compile, glob, icons} from './util.js';
4
4
 
5
+ const bundles = getBundleTasks();
6
+ const components = await getComponentTasks();
7
+
5
8
  if (args.h || args.help) {
6
9
 
7
10
  console.log(`
8
11
  usage:
9
12
 
10
- build.js [componentA, componentB, ...] [-d|debug|nominify|development]
13
+ build.js [componentA, componentB, ...] [-d|debug|nominify|watch]
11
14
 
12
15
  examples:
13
16
 
@@ -17,19 +20,15 @@ if (args.h || args.help) {
17
20
 
18
21
  available components:
19
22
 
20
- bundles: ${Object.keys(steps).join(', ')}
23
+ bundles: ${Object.keys(bundles).join(', ')}
21
24
  components: ${Object.keys(components).join(', ')}
22
25
 
23
26
  `);
24
27
  process.exit(0);
25
28
  }
26
29
 
27
- const minify = !(args.d || args.debug || args.nominify);
28
- const uikit = getUIkitTasks(minify);
29
- const components = await getComponentTasks(minify);
30
-
31
30
  let tasks;
32
- const allTasks = {...uikit, ...components};
31
+ const allTasks = {...bundles, ...components};
33
32
  if (args.all || Object.keys(args).length <= 1) {
34
33
  tasks = allTasks;
35
34
  } else if (args.components) {
@@ -37,50 +36,45 @@ if (args.all || Object.keys(args).length <= 1) {
37
36
  } else {
38
37
  tasks = Object.keys(args)
39
38
  .map(step => allTasks[step])
40
- .filter(t => t)
39
+ .filter(t => t);
41
40
  }
42
41
 
43
42
  await Promise.all(Object.values(tasks).map(task => task()));
44
43
 
45
- function getUIkitTasks(minify) {
44
+ function getBundleTasks() {
46
45
  return {
47
46
 
48
- core: () => compile('src/js/uikit-core.js', 'dist/js/uikit-core', {minify}),
47
+ core: () => compile('src/js/uikit-core.js', 'dist/js/uikit-core'),
49
48
 
50
- uikit: () => compile('src/js/uikit.js', 'dist/js/uikit', {minify}),
49
+ uikit: () => compile('src/js/uikit.js', 'dist/js/uikit'),
51
50
 
52
51
  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
- ),
52
+ name: 'icons',
53
+ replaces: {ICONS: await icons('{src/images,custom}/icons/*.svg')}
54
+ }),
58
55
 
59
56
  tests: async () => compile('tests/js/index.js', 'tests/js/test', {
60
- minify,
61
- name: 'test',
62
- replaces: {TESTS: await getTestFiles()}
63
- }
64
- ),
57
+ name: 'test',
58
+ replaces: {TESTS: await getTestFiles()}
59
+ })
65
60
 
66
61
  };
67
62
  }
68
63
 
69
- async function getComponentTasks(minify) {
64
+ async function getComponentTasks() {
70
65
 
71
66
  const components = await glob('src/js/components/!(index).js');
72
67
 
73
68
  return components.reduce((components, file) => {
74
69
 
75
- const name = path.basename(file, '.js');
70
+ const name = basename(file, '.js');
76
71
 
77
72
  components[name] = () =>
78
- compile(`${__dirname}/wrapper/component.js`, `dist/js/components/${name}`, {
73
+ compile('build/wrapper/component.js', `dist/js/components/${name}`, {
79
74
  name,
80
- minify,
81
75
  external: ['uikit', 'uikit-util'],
82
76
  globals: {uikit: 'UIkit', 'uikit-util': 'UIkit.util'},
83
- aliases: {component: path.resolve(__dirname, '../src/js/components', name)},
77
+ aliases: {component: resolve(__dirname, '../src/js/components', name)},
84
78
  replaces: {NAME: `'${camelize(name)}'`}
85
79
  });
86
80
 
@@ -91,5 +85,5 @@ async function getComponentTasks(minify) {
91
85
 
92
86
  async function getTestFiles() {
93
87
  const files = await glob('tests/!(index).html', {nosort: true});
94
- return JSON.stringify(files.map(file => path.basename(file, '.html')));
88
+ return JSON.stringify(files.map(file => basename(file, '.html')));
95
89
  }
package/build/icons.js CHANGED
@@ -7,6 +7,14 @@ await Promise.all((await glob(path)).map(compileIcons));
7
7
 
8
8
  async function compileIcons(folder) {
9
9
  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}});
10
+ return compile(
11
+ 'build/wrapper/icons.js',
12
+ `dist/js/uikit-icons-${name}`,
13
+ {
14
+ name,
15
+ replaces: {
16
+ ICONS: await icons(`{src/images/icons,${folder}}/*.svg`)
17
+ }
18
+ }
19
+ );
12
20
  }
package/build/less.js CHANGED
@@ -3,7 +3,7 @@ import rtlcss from 'rtlcss';
3
3
  import postcss from 'postcss';
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,6 +1,8 @@
1
- import {inc} from 'semver';
1
+ import semver from 'semver';
2
2
  import {resolve} from 'path';
3
- import {args, getVersion, run} from './util.js';
3
+ import {__dirname, args, getVersion, run} from './util.js';
4
+
5
+ const {inc} = semver;
4
6
 
5
7
  // default exec options
6
8
  const options = {cwd: resolve(`${__dirname}/..`), encoding: 'utf8'};
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,25 +1,25 @@
1
- import fs from 'fs-extra';
2
1
  import less from 'less';
3
- import { URL } from 'url';
2
+ import {URL} from 'url';
3
+ import fs from 'fs-extra';
4
4
  import postcss from 'postcss';
5
5
  import globImport from 'glob';
6
- import {rollup} from 'rollup';
6
+ import {rollup, watch as rollupWatch} from 'rollup';
7
7
  import {optimize} from 'svgo';
8
- import uglify from 'uglify-js';
9
8
  import {promisify} from 'util';
10
9
  import minimist from 'minimist';
11
10
  import CleanCSS from 'clean-css';
12
11
  import html from 'rollup-plugin-html';
13
12
  import buble from '@rollup/plugin-buble';
14
13
  import alias from '@rollup/plugin-alias';
14
+ import modify from 'rollup-plugin-modify';
15
+ import {uglify} from 'rollup-plugin-uglify';
15
16
  import replace from '@rollup/plugin-replace';
16
17
  import {basename, dirname, resolve} from 'path';
17
18
  import {exec as execImport} from 'child_process';
18
19
 
19
20
  export const exec = promisify(execImport);
20
21
  export const glob = promisify(globImport);
21
- export const readJson = fs.readJson;
22
- export const pathExists = fs.pathExists;
22
+ export const {pathExists, readJson} = fs;
23
23
  export const __dirname = new URL('.', import.meta.url).pathname;
24
24
 
25
25
  export const banner = `/*! UIkit ${await getVersion()} | https://www.getuikit.com | (c) 2014 - ${new Date().getFullYear()} YOOtheme | MIT License */\n`;
@@ -94,24 +94,30 @@ export async function renderLess(data, options) {
94
94
  .css;
95
95
  }
96
96
 
97
- export async function compile(file, dest, {external, globals, name, aliases, replaces, minify = true}) {
97
+ export async function compile(file, dest, {external, globals, name, aliases, replaces} = {}) {
98
+
99
+ const minify = !args.nominify;
100
+ const debug = args.d || args.debug;
101
+ const watch = args.w || args.watch;
98
102
 
99
103
  name = (name || '').replace(/[^\w]/g, '_');
100
104
 
101
- const bundle = await rollup({
105
+ const inputOptions = {
102
106
  external,
103
- input: resolve(file),
107
+ input: file,
104
108
  plugins: [
105
109
  replace({
106
110
  preventAssignment: true,
107
- values: Object.assign({
108
- VERSION: `'${await getVersion()}'`
109
- }, replaces)}
110
- ),
111
+ values: {
112
+ VERSION: `'${await getVersion()}'`,
113
+ ...replaces
114
+ }
115
+ }),
111
116
  alias({
112
- entries: Object.assign({
113
- 'uikit-util': './src/js/util/index.js'
114
- }, aliases)
117
+ entries: {
118
+ 'uikit-util': './src/js/util/index.js',
119
+ ...aliases
120
+ }
115
121
  }),
116
122
  html({
117
123
  include: '**/*.svg',
@@ -119,25 +125,63 @@ export async function compile(file, dest, {external, globals, name, aliases, rep
119
125
  collapseWhitespace: true
120
126
  }
121
127
  }),
122
- buble({namedFunctionExpressions: false})
128
+ buble({namedFunctionExpressions: false}),
129
+ modify({
130
+ find: /(>)\\n\s+|\\n\s+(<)/,
131
+ replace: (m, m1, m2) => `${m1 || ''} ${m2 || ''}`
132
+ })
123
133
  ]
124
- });
134
+ };
125
135
 
126
- let {output: [{code, map}]} = await bundle.generate({
136
+ const outputOptions = {
127
137
  globals,
128
138
  banner,
129
139
  format: 'umd',
130
140
  amd: {id: `UIkit${name}`.toLowerCase()},
131
141
  name: `UIkit${ucfirst(name)}`,
132
- sourcemap: !minify ? 'inline' : false
133
- });
142
+ sourcemap: debug ? 'inline' : false
143
+ };
144
+
145
+ const output = [{
146
+ ...outputOptions,
147
+ file: `${dest}.js`
148
+ }];
149
+
150
+ if (minify) {
151
+ output.push({
152
+ ...outputOptions,
153
+ file: `${dest}.min.js`,
154
+ plugins: [minify ? uglify({output: {preamble: banner}}) : undefined]
155
+ });
156
+ }
157
+
158
+ if (!watch) {
159
+ const bundle = await rollup(inputOptions);
160
+
161
+ for (const options of output) {
162
+ await bundle.write(options);
163
+ logFile(options.file);
164
+ }
134
165
 
135
- code = code.replace(/(>)\\n\s+|\\n\s+(<)/g, '$1 $2');
166
+ await bundle.close();
167
+ } else {
168
+ const watcher = rollupWatch({
169
+ ...inputOptions,
170
+ output
171
+ });
136
172
 
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];
173
+ watcher.on('event', ({code, result, output}) => {
174
+ if (result) {
175
+ result.close();
176
+
177
+ }
178
+ if (code === 'BUNDLE_END' && output) {
179
+ output.map(logFile);
180
+ }
181
+ });
182
+
183
+ watcher.close();
184
+ }
141
185
 
142
186
  }
143
187
 
@@ -182,8 +226,9 @@ export async function icons(src) {
182
226
  export async function run(cmd) {
183
227
  const {stdout, stderr} = await exec(cmd);
184
228
 
185
- stdout && console.log(stdout.trim());
186
- stderr && console.log(stderr.trim());
229
+ stderr && console.error(stderr.trim());
230
+
231
+ return stdout;
187
232
  }
188
233
 
189
234
  export function ucfirst(str) {
@@ -191,7 +236,7 @@ export function ucfirst(str) {
191
236
  }
192
237
 
193
238
  export async function getVersion() {
194
- return JSON.parse(await read(resolve(__dirname, '../package.json'))).version;
239
+ return (await readJson(resolve(__dirname, '../package.json'))).version;
195
240
  }
196
241
 
197
242
  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.836238c9b | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */
2
2
  /* ========================================================================
3
3
  Component: Base
4
4
  ========================================================================== */