purgetss 6.0.14 → 6.1.0

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.
package/bin/purgetss CHANGED
@@ -64,6 +64,20 @@ program
64
64
  purgetss.buildLegacy();
65
65
  });
66
66
 
67
+ program
68
+ .command('shades')
69
+ .alias('s')
70
+ .argument('[hexcode]', 'The base hexcode value')
71
+ .argument('[name]', 'Name of the color shades')
72
+ .option('-q, --quotes', 'Keep double quotes in config.js')
73
+ .option('-r, --random', 'Generates shades from a random color')
74
+ .option('-l, --log', `Log the generated shades instead of saving them`)
75
+ .description(`Color shades generator from a given hexcolor`)
76
+ .help(`Generates color shades from a given hexcolor to use in your project`)
77
+ .action((args, options, logger) => {
78
+ purgetss.shades(args, options);
79
+ });
80
+
67
81
  program
68
82
  .command('watch')
69
83
  .alias('w')
@@ -2,7 +2,7 @@
2
2
  // Property(ies): layout
3
3
  // Description: Grid Flow - layout
4
4
  // Component(s): Ti.UI.View
5
- '.grid': { layout: 'horizontal' }
6
- '.grid-flow-col': { layout: 'horizontal' }
7
- '.grid-flow-row': { layout: 'vertical' }
5
+ '.grid': { layout: 'horizontal', width: '100%' }
6
+ '.grid-flow-col': { layout: 'horizontal', width: '100%' }
7
+ '.grid-flow-row': { layout: 'vertical', height: '100%' }
8
8
  ```
@@ -0,0 +1,68 @@
1
+ ```scss
2
+ // Property(ies): width and height
3
+ // Component(s): Ti.UI.View, Ti.Blob, Ti.Media.VideoPlayer, MovieSize, Ti.UI.ActivityIndicator, Ti.UI.Android.CardView, Ti.UI.Android.DrawerLayout, Ti.UI.Android.SearchView, Ti.UI.Animation, Ti.UI.Button, Ti.UI.ButtonBar, Ti.UI.DashboardView, Dimension, DimensionWithAbsolutes, Ti.UI.ImageView, Ti.UI.Label, Ti.UI.ListView, Ti.UI.MaskedImage, Ti.UI.NavigationWindow, Ti.UI.OptionBar, Ti.UI.Picker, Ti.UI.PickerRow, Ti.UI.ProgressBar, Ti.UI.ScrollView, Ti.UI.ScrollableView, Ti.UI.SearchBar, Size, Ti.UI.Slider, Ti.UI.Switch, Ti.UI.TabbedBar, Ti.UI.TableView, Ti.UI.TableViewRow, Ti.UI.TextArea, Ti.UI.TextField, Ti.UI.Toolbar, Ti.UI.WebView, Ti.UI.Window, openWindowParams, Ti.UI.iOS.BlurView, Ti.UI.iOS.CoverFlowView, CoverFlowImageType, Ti.UI.iOS.LivePhotoView, Ti.UI.iOS.SplitWindow, Ti.UI.iOS.Stepper, BarItemType, Ti.UI.iPad.Popover
4
+ '.wh-0': { width: 0, height: 0 }
5
+ '.wh-1': { width: 4, height: 4 }
6
+ '.wh-2': { width: 8, height: 8 }
7
+ '.wh-3': { width: 12, height: 12 }
8
+ '.wh-4': { width: 16, height: 16 }
9
+ '.wh-5': { width: 20, height: 20 }
10
+ '.wh-6': { width: 24, height: 24 }
11
+ '.wh-7': { width: 28, height: 28 }
12
+ '.wh-8': { width: 32, height: 32 }
13
+ '.wh-9': { width: 36, height: 36 }
14
+ '.wh-10': { width: 40, height: 40 }
15
+ '.wh-11': { width: 44, height: 44 }
16
+ '.wh-12': { width: 48, height: 48 }
17
+ '.wh-14': { width: 56, height: 56 }
18
+ '.wh-16': { width: 64, height: 64 }
19
+ '.wh-20': { width: 80, height: 80 }
20
+ '.wh-24': { width: 96, height: 96 }
21
+ '.wh-28': { width: 112, height: 112 }
22
+ '.wh-32': { width: 128, height: 128 }
23
+ '.wh-36': { width: 144, height: 144 }
24
+ '.wh-40': { width: 160, height: 160 }
25
+ '.wh-44': { width: 176, height: 176 }
26
+ '.wh-48': { width: 192, height: 192 }
27
+ '.wh-52': { width: 208, height: 208 }
28
+ '.wh-56': { width: 224, height: 224 }
29
+ '.wh-60': { width: 240, height: 240 }
30
+ '.wh-64': { width: 256, height: 256 }
31
+ '.wh-72': { width: 288, height: 288 }
32
+ '.wh-80': { width: 320, height: 320 }
33
+ '.wh-96': { width: 384, height: 384 }
34
+ '.wh-auto': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
35
+ '.wh-px': { width: '1px', height: '1px' }
36
+ '.wh-0.5': { width: 2, height: 2 }
37
+ '.wh-1.5': { width: 6, height: 6 }
38
+ '.wh-2.5': { width: 10, height: 10 }
39
+ '.wh-3.5': { width: 14, height: 14 }
40
+ '.wh-1/2': { width: '50%', height: '50%' }
41
+ '.wh-1/3': { width: '33.333333%', height: '33.333333%' }
42
+ '.wh-2/3': { width: '66.666667%', height: '66.666667%' }
43
+ '.wh-1/4': { width: '25%', height: '25%' }
44
+ '.wh-2/4': { width: '50%', height: '50%' }
45
+ '.wh-3/4': { width: '75%', height: '75%' }
46
+ '.wh-1/5': { width: '20%', height: '20%' }
47
+ '.wh-2/5': { width: '40%', height: '40%' }
48
+ '.wh-3/5': { width: '60%', height: '60%' }
49
+ '.wh-4/5': { width: '80%', height: '80%' }
50
+ '.wh-1/6': { width: '16.666667%', height: '16.666667%' }
51
+ '.wh-2/6': { width: '33.333333%', height: '33.333333%' }
52
+ '.wh-3/6': { width: '50%', height: '50%' }
53
+ '.wh-4/6': { width: '66.666667%', height: '66.666667%' }
54
+ '.wh-5/6': { width: '83.333333%', height: '83.333333%' }
55
+ '.wh-1/12': { width: '8.333333%', height: '8.333333%' }
56
+ '.wh-2/12': { width: '16.666667%', height: '16.666667%' }
57
+ '.wh-3/12': { width: '25%', height: '25%' }
58
+ '.wh-4/12': { width: '33.333333%', height: '33.333333%' }
59
+ '.wh-5/12': { width: '41.666667%', height: '41.666667%' }
60
+ '.wh-6/12': { width: '50%', height: '50%' }
61
+ '.wh-7/12': { width: '58.333333%', height: '58.333333%' }
62
+ '.wh-8/12': { width: '66.666667%', height: '66.666667%' }
63
+ '.wh-9/12': { width: '75%', height: '75%' }
64
+ '.wh-10/12': { width: '83.333333%', height: '83.333333%' }
65
+ '.wh-11/12': { width: '91.666667%', height: '91.666667%' }
66
+ '.wh-full': { width: '100%', height: '100%' }
67
+ '.wh-screen': { width: Ti.UI.FILL, height: Ti.UI.FILL }
68
+ ```
package/dist/tailwind.tss CHANGED
@@ -1,4 +1,4 @@
1
- // Based on Tailwind CSS v3.1.8: A utility-first CSS framework for rapidly building custom designs. ( https://tailwindcss.com )
1
+ // Based on Tailwind CSS v3.2.0: A utility-first CSS framework for rapidly building custom designs. ( https://tailwindcss.com )
2
2
  // Created by Adam Wathan ( https://twitter.com/adamwathan ).
3
3
 
4
4
  // Tailwind-like styles
@@ -1524,9 +1524,9 @@
1524
1524
  // Property(ies): layout
1525
1525
  // Description: Grid Flow - layout
1526
1526
  // Component(s): Ti.UI.View
1527
- '.grid': { layout: 'horizontal' }
1528
- '.grid-flow-col': { layout: 'horizontal' }
1529
- '.grid-flow-row': { layout: 'vertical' }
1527
+ '.grid': { layout: 'horizontal', width: '100%' }
1528
+ '.grid-flow-col': { layout: 'horizontal', width: '100%' }
1529
+ '.grid-flow-row': { layout: 'vertical', height: '100%' }
1530
1530
 
1531
1531
  // Property(ies): width - For Grid Template Columns
1532
1532
  // Component(s): Ti.UI.ActivityIndicator, Ti.UI.Animation, Ti.UI.iPad.Popover, Ti.UI.View, Ti.UI.Window
@@ -2781,6 +2781,73 @@
2781
2781
  '.zoom-out-125': { animationProperties: { close: { scale: 1.25 }, complete: { scale: 1 } } }
2782
2782
  '.zoom-out-150': { animationProperties: { close: { scale: 1.5 }, complete: { scale: 1 } } }
2783
2783
 
2784
+ // Property(ies): width and height
2785
+ // Component(s): Ti.UI.View, Ti.Blob, Ti.Media.VideoPlayer, MovieSize, Ti.UI.ActivityIndicator, Ti.UI.Android.CardView, Ti.UI.Android.DrawerLayout, Ti.UI.Android.SearchView, Ti.UI.Animation, Ti.UI.Button, Ti.UI.ButtonBar, Ti.UI.DashboardView, Dimension, DimensionWithAbsolutes, Ti.UI.ImageView, Ti.UI.Label, Ti.UI.ListView, Ti.UI.MaskedImage, Ti.UI.NavigationWindow, Ti.UI.OptionBar, Ti.UI.Picker, Ti.UI.PickerRow, Ti.UI.ProgressBar, Ti.UI.ScrollView, Ti.UI.ScrollableView, Ti.UI.SearchBar, Size, Ti.UI.Slider, Ti.UI.Switch, Ti.UI.TabbedBar, Ti.UI.TableView, Ti.UI.TableViewRow, Ti.UI.TextArea, Ti.UI.TextField, Ti.UI.Toolbar, Ti.UI.WebView, Ti.UI.Window, openWindowParams, Ti.UI.iOS.BlurView, Ti.UI.iOS.CoverFlowView, CoverFlowImageType, Ti.UI.iOS.LivePhotoView, Ti.UI.iOS.SplitWindow, Ti.UI.iOS.Stepper, BarItemType, Ti.UI.iPad.Popover
2786
+ '.wh-0': { width: 0, height: 0 }
2787
+ '.wh-1': { width: 4, height: 4 }
2788
+ '.wh-2': { width: 8, height: 8 }
2789
+ '.wh-3': { width: 12, height: 12 }
2790
+ '.wh-4': { width: 16, height: 16 }
2791
+ '.wh-5': { width: 20, height: 20 }
2792
+ '.wh-6': { width: 24, height: 24 }
2793
+ '.wh-7': { width: 28, height: 28 }
2794
+ '.wh-8': { width: 32, height: 32 }
2795
+ '.wh-9': { width: 36, height: 36 }
2796
+ '.wh-10': { width: 40, height: 40 }
2797
+ '.wh-11': { width: 44, height: 44 }
2798
+ '.wh-12': { width: 48, height: 48 }
2799
+ '.wh-14': { width: 56, height: 56 }
2800
+ '.wh-16': { width: 64, height: 64 }
2801
+ '.wh-20': { width: 80, height: 80 }
2802
+ '.wh-24': { width: 96, height: 96 }
2803
+ '.wh-28': { width: 112, height: 112 }
2804
+ '.wh-32': { width: 128, height: 128 }
2805
+ '.wh-36': { width: 144, height: 144 }
2806
+ '.wh-40': { width: 160, height: 160 }
2807
+ '.wh-44': { width: 176, height: 176 }
2808
+ '.wh-48': { width: 192, height: 192 }
2809
+ '.wh-52': { width: 208, height: 208 }
2810
+ '.wh-56': { width: 224, height: 224 }
2811
+ '.wh-60': { width: 240, height: 240 }
2812
+ '.wh-64': { width: 256, height: 256 }
2813
+ '.wh-72': { width: 288, height: 288 }
2814
+ '.wh-80': { width: 320, height: 320 }
2815
+ '.wh-96': { width: 384, height: 384 }
2816
+ '.wh-auto': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
2817
+ '.wh-px': { width: '1px', height: '1px' }
2818
+ '.wh-0.5': { width: 2, height: 2 }
2819
+ '.wh-1.5': { width: 6, height: 6 }
2820
+ '.wh-2.5': { width: 10, height: 10 }
2821
+ '.wh-3.5': { width: 14, height: 14 }
2822
+ '.wh-1/2': { width: '50%', height: '50%' }
2823
+ '.wh-1/3': { width: '33.333333%', height: '33.333333%' }
2824
+ '.wh-2/3': { width: '66.666667%', height: '66.666667%' }
2825
+ '.wh-1/4': { width: '25%', height: '25%' }
2826
+ '.wh-2/4': { width: '50%', height: '50%' }
2827
+ '.wh-3/4': { width: '75%', height: '75%' }
2828
+ '.wh-1/5': { width: '20%', height: '20%' }
2829
+ '.wh-2/5': { width: '40%', height: '40%' }
2830
+ '.wh-3/5': { width: '60%', height: '60%' }
2831
+ '.wh-4/5': { width: '80%', height: '80%' }
2832
+ '.wh-1/6': { width: '16.666667%', height: '16.666667%' }
2833
+ '.wh-2/6': { width: '33.333333%', height: '33.333333%' }
2834
+ '.wh-3/6': { width: '50%', height: '50%' }
2835
+ '.wh-4/6': { width: '66.666667%', height: '66.666667%' }
2836
+ '.wh-5/6': { width: '83.333333%', height: '83.333333%' }
2837
+ '.wh-1/12': { width: '8.333333%', height: '8.333333%' }
2838
+ '.wh-2/12': { width: '16.666667%', height: '16.666667%' }
2839
+ '.wh-3/12': { width: '25%', height: '25%' }
2840
+ '.wh-4/12': { width: '33.333333%', height: '33.333333%' }
2841
+ '.wh-5/12': { width: '41.666667%', height: '41.666667%' }
2842
+ '.wh-6/12': { width: '50%', height: '50%' }
2843
+ '.wh-7/12': { width: '58.333333%', height: '58.333333%' }
2844
+ '.wh-8/12': { width: '66.666667%', height: '66.666667%' }
2845
+ '.wh-9/12': { width: '75%', height: '75%' }
2846
+ '.wh-10/12': { width: '83.333333%', height: '83.333333%' }
2847
+ '.wh-11/12': { width: '91.666667%', height: '91.666667%' }
2848
+ '.wh-full': { width: '100%', height: '100%' }
2849
+ '.wh-screen': { width: Ti.UI.FILL, height: Ti.UI.FILL }
2850
+
2784
2851
  // Property(ies): backgroundGradient: colors - From Color
2785
2852
  // Component(s): Ti.UI.ListItem, Ti.UI.View
2786
2853
  '.from-transparent': { backgroundGradient: { colors: [ 'transparent', 'transparent' ] } }
package/index.js CHANGED
@@ -99,7 +99,7 @@ const srcMaterialSymbolsTSSFile = path.resolve(__dirname, './dist/materialsymbol
99
99
  const srcConfigFile = path.resolve(__dirname, './lib/templates/purgetss.config.js');
100
100
 
101
101
  const configFile = (fs.existsSync(projectsConfigJS)) ? require(projectsConfigJS) : require(srcConfigFile);
102
- configFile.corePlugins = configFile.corePlugins ?? {};
102
+ configFile.plugins = configFile.plugins ?? {};
103
103
  configFile.purge = configFile.purge ?? { mode: 'all' };
104
104
  configFile.theme.extend = configFile.theme.extend ?? {};
105
105
  configFile.fonts = configFile.fonts ?? { mode: 'fileName' };
@@ -153,6 +153,7 @@ function purgeClasses(options) {
153
153
  }
154
154
  module.exports.purgeClasses = purgeClasses;
155
155
 
156
+ //! Command: init
156
157
  function init(options) {
157
158
  // config file
158
159
  if (!fs.existsSync(projectsConfigJS)) {
@@ -287,7 +288,6 @@ function cleanClasses(uniqueClasses) {
287
288
  return cleanClassNames;
288
289
  }
289
290
 
290
- //! Command: init
291
291
  function createConfigFile() {
292
292
  if (alloyProject()) {
293
293
  makeSureFolderExists(projectsPurgeTSSFolder);
@@ -360,6 +360,57 @@ function create(args, options) {
360
360
  }
361
361
  exports.create = create;
362
362
 
363
+ //! Command: shades
364
+ function shades(args, options) {
365
+ delete configFile.fonts;
366
+
367
+ let chroma = require('chroma-js');
368
+ let generateColorShades = require('./lib/color-shades/generateColorShades');
369
+ let referenceColorFamilies = require('./lib/color-shades/tailwind').filter((item) => {
370
+ return item.name !== 'warmGray' &&
371
+ item.name !== 'trueGray' &&
372
+ item.name !== 'gray' &&
373
+ item.name !== 'coolGray' &&
374
+ item.name !== 'blueGray'
375
+ });
376
+
377
+ let colorFamily = (options.random || !args.hexcode) ? generateColorShades(chroma.random(), referenceColorFamilies) : generateColorShades(args.hexcode, referenceColorFamilies);
378
+ if (args.name) colorFamily.name = args.name;
379
+ colorFamily.name = colorFamily.name.replace(/'/g, '');
380
+
381
+ let colorObject = createColorObject(colorFamily, colorFamily.hexcode);
382
+
383
+ if (!configFile['theme']['extend']['colors']) configFile['theme']['extend']['colors'] = {};
384
+ configFile['theme']['extend']['colors'][colorObject.name] = colorObject.shades;
385
+
386
+ if (alloyProject() && !options.log) {
387
+ fs.writeFileSync(projectsConfigJS, 'module.exports = ' + cleanDoubleQuotes(configFile, options.quotes), 'utf8', err => { throw err; });
388
+ logger.info(`${chalk.bgHex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} ${chalk.hex(colorFamily.hexcode)(`(${colorFamily.hexcode}) saved in`)}`, chalk.yellow('config.js'));
389
+ } else {
390
+ logger.info(`${chalk.bgHex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} ${chalk.hex(colorFamily.hexcode)(`(${colorFamily.hexcode})`)}\n${cleanDoubleQuotes({ colors: { [colorObject.name]: colorObject.shades } }, options.quotes)}`);
391
+ }
392
+ }
393
+ exports.shades = shades;
394
+
395
+ function cleanDoubleQuotes(configFile, quotes = false) {
396
+ let json = JSON.stringify(configFile, null, 2);
397
+
398
+ if (quotes) return json;
399
+
400
+ json = json.replace(/"([^"]+)":/g, (match, p1) => (p1.match(/[._-]/)) ? `'${p1}':` : `${p1}:`);
401
+
402
+ return json.replaceAll("\"", "'");
403
+ }
404
+
405
+ function createColorObject(family, hexcode) {
406
+ let colors = {};
407
+ let shades = { default: hexcode };
408
+ family.shades.forEach((shade) => shades[shade.number] = shade.hexcode);
409
+ colors.name = family.name.toLowerCase().split(" ").join("-");
410
+ colors.shades = shades;
411
+ return colors;
412
+ }
413
+
363
414
  function createProject(workspace, argsName, projectID, options) {
364
415
  let projectName = `"${argsName}"`;
365
416
  const { exec } = require("child_process");
@@ -367,35 +418,35 @@ function createProject(workspace, argsName, projectID, options) {
367
418
 
368
419
  logger.info('Creating a new Titanium project');
369
420
 
370
- let tiCreateCommand = `ti create -t app -p all -n ${projectName} --no-prompt --id ${projectID}`;
421
+ let tiCreateCommand = `ti create - t app - p all - n ${projectName} --no - prompt--id ${projectID}`;
371
422
  exec(tiCreateCommand, (error) => {
372
423
  if (error) return logger.error(error);
373
424
 
374
- let fonts = (options.vendor) ? `&& purgetss f -m -v=${options.vendor}` : '';
425
+ let fonts = (options.vendor) ? `&& purgetss f - m - v=${options.vendor}` : '';
375
426
 
376
427
  if (options.vendor) {
377
428
  logger.info('Installing requested fonts');
378
429
  }
379
430
 
380
- let cdToProject = `cd ${workspace}/${projectName} && alloy new && purgetss w && purgetss b ${fonts}`;
431
+ let cdToProject = `cd ${workspace} / ${projectName} && alloy new && purgetss w && purgetss b ${fonts}`;
381
432
  exec(cdToProject, (error) => {
382
433
  if (error) return logger.error(error);
383
434
 
384
435
  let theOpenCommand;
385
436
  if (commandExistsSync('code')) {
386
- theOpenCommand = `cd ${workspace}/${projectName} && code .`;
437
+ theOpenCommand = `cd ${workspace} / ${projectName} && code.`;
387
438
  } else if (commandExistsSync('subl')) {
388
- theOpenCommand = `cd ${workspace}/${projectName} && subl .`;
439
+ theOpenCommand = `cd ${workspace} / ${projectName} && subl.`;
389
440
  } else {
390
- theOpenCommand = `cd ${workspace}/${projectName} && open .`;
441
+ theOpenCommand = `cd ${workspace} / ${projectName} && open.`;
391
442
  }
392
443
 
393
444
  if (options.tailwind) {
394
445
  logger.info('Installing Tailwind CSS');
395
446
 
396
- fs.writeFileSync(`${workspace}/${argsName}/package.json`, JSON.stringify({ "name": `${argsName.replace(/ /g, '-').toLowerCase()}`, "private": true }));
447
+ fs.writeFileSync(`${workspace} / ${argsName} / package.json`, JSON.stringify({ "name": `${argsName.replace(/ /g, '-').toLowerCase()}`, "private": true }));
397
448
 
398
- let installTailwind = `cd ${workspace}/${projectName} && npm init -y && npm i tailwindcss -D && npx tailwindcss init`;
449
+ let installTailwind = `cd ${workspace} / ${projectName} && npm init - y && npm i tailwindcss - D && npx tailwindcss init`;
399
450
  exec(installTailwind, (error) => {
400
451
  if (error) return logger.error(error);
401
452
 
@@ -465,7 +516,7 @@ function buildFonts(options) {
465
516
  let fontFamilyName = fontMeta.postScriptName.replace(/\//g, '');
466
517
  //! Maybe this is deprecated
467
518
  if (configFile.fonts.mode.toLowerCase() === 'postscriptname' || configFile.fonts.mode.toLowerCase() === 'postscript' || configFile.fonts.mode.toLowerCase() === 'ps') {
468
- tssClasses += `\n'.${fontFamilyName}': { font: { fontFamily: '${fontFamilyName}' } }\n`;
519
+ tssClasses += `\n'.${fontFamilyName.toLowerCase()}': { font: { fontFamily: '${fontFamilyName}' } }\n`;
469
520
  } else {
470
521
  tssClasses += `\n'.${getFileName(file)}': { font: { fontFamily: '${fontFamilyName}' } }\n`;
471
522
  }
@@ -1528,9 +1579,9 @@ function combineAllValues(base, defaultTheme) {
1528
1579
  delete configFile.theme.fontFamily;
1529
1580
  }
1530
1581
 
1531
- // !Delete corePlugins specified in the config file
1532
- let corePlugins = Array.isArray(configFile.corePlugins) ? configFile.corePlugins : Object.keys(configFile.corePlugins).map(key => key);
1533
- _.each(corePlugins, value => {
1582
+ // !Delete plugins specified in the config file
1583
+ let plugins = Array.isArray(configFile.plugins) ? configFile.plugins : Object.keys(configFile.plugins).map(key => key);
1584
+ _.each(plugins, value => {
1534
1585
  delete allValues[value];
1535
1586
  delete configFile.theme[value];
1536
1587
  });
@@ -0,0 +1,14 @@
1
+ module.exports = [
2
+ "#0fa968",
3
+ "#e63f66",
4
+ "#ea546c",
5
+ "#5a03d5",
6
+ "#6374ae",
7
+ "#bc560a",
8
+ "#438e96",
9
+ "#ba7264",
10
+ "#e91f64",
11
+ "#82bd69",
12
+ "#ea9daa",
13
+ "#c4544a",
14
+ ];
@@ -0,0 +1,29 @@
1
+ let chroma = require('chroma-js');
2
+
3
+ const findClosestColor = (hexcode, referenceColors) => {
4
+
5
+ // Add DELTA key / value to array of objects
6
+ referenceColors.forEach((color) => {
7
+ color.shades = color.shades.map((shade) => ({ ...shade, delta: chroma.deltaE(hexcode, shade.hexcode) }))
8
+ });
9
+
10
+ // Calculate the lowest DELTA per color
11
+ referenceColors.forEach((color) => {
12
+ color.closestShade = color.shades.reduce((previous, current) => previous.delta < current.delta ? previous : current)
13
+ });
14
+
15
+ // Calculate the color family with the lowest DELTA
16
+ let closestColorFamily = referenceColors.reduce((previous, current) => previous.closestShade.delta < current.closestShade.delta ? previous : current)
17
+
18
+ // Add lightness difference key / value to array of objects
19
+ closestColorFamily.shades = closestColorFamily.shades.map((shade) => ({
20
+ ...shade,
21
+ lightnessDiff: Math.abs(chroma(shade.hexcode).get('hsl.l') - chroma(hexcode).get('hsl.l'))
22
+ }))
23
+
24
+ closestColorFamily.closestShadeLightness = closestColorFamily.shades.reduce((previous, current) => previous.lightnessDiff < current.lightnessDiff ? previous : current);
25
+
26
+ return closestColorFamily
27
+ }
28
+
29
+ module.exports = findClosestColor;
@@ -0,0 +1,55 @@
1
+ const ntc = require('ntcjs');
2
+
3
+ let uuidv4 = require('uuid').v4;
4
+ let chroma = require('chroma-js');
5
+ let findClosestColor = require('./findClosestColor');
6
+
7
+ const generateColorShades = (hexcode, referenceColors) => {
8
+ const closestColorFamily = findClosestColor(hexcode, referenceColors)
9
+
10
+ let inputHue = chroma(hexcode).get('hsl.h');
11
+ let matchHue = chroma(closestColorFamily.closestShadeLightness.hexcode).get('hsl.h');
12
+
13
+ let hueDifference = (inputHue - (matchHue || 0));
14
+
15
+ let saturationRatio = chroma(hexcode).get('hsl.s') / chroma(closestColorFamily.closestShadeLightness.hexcode).get('hsl.s');
16
+
17
+ if (hueDifference == 0) {
18
+ hueDifference = matchHue.toString();
19
+ } else if (hueDifference > 0) {
20
+ hueDifference = '+' + hueDifference;
21
+ } else {
22
+ hueDifference = hueDifference.toString();
23
+ }
24
+
25
+ let generatedColorFamily = {}
26
+
27
+ generatedColorFamily.id = uuidv4()
28
+ generatedColorFamily.hexcode = chroma(hexcode).hex()
29
+ generatedColorFamily.name = ntc.name(`${hexcode}`)[1]
30
+
31
+ generatedColorFamily.shades = closestColorFamily.shades.map((color) => {
32
+ let newColor = color.hexcode
33
+ let newSaturation = chroma(newColor).get('hsl.s') * saturationRatio
34
+
35
+ newColor = chroma(newColor).set('hsl.s', newSaturation).hex()
36
+ newColor = chroma(newColor).set('hsl.h', hueDifference).hex()
37
+
38
+ if (closestColorFamily.closestShadeLightness.number == color.number) {
39
+ newColor = chroma(hexcode).hex()
40
+ }
41
+
42
+ return {
43
+ number: color.number,
44
+ hexcode: newColor,
45
+ hue: Math.round(chroma(newColor).get('hsl.h')),
46
+ saturation: Math.round(chroma(newColor).get('hsl.s') * 100),
47
+ lightness: Math.round(chroma(newColor).get('hsl.l') * 100),
48
+ luminance: Math.round(chroma(newColor).luminance() * 100),
49
+ }
50
+ })
51
+
52
+ return generatedColorFamily
53
+ }
54
+
55
+ module.exports = generateColorShades;
@@ -0,0 +1,332 @@
1
+ module.exports = [
2
+ {
3
+ name: 'rose',
4
+ shades: [
5
+ { number: 50, hexcode: '#fff1f2' },
6
+ { number: 100, hexcode: '#ffe4e6' },
7
+ { number: 200, hexcode: '#fecdd3' },
8
+ { number: 300, hexcode: '#fda4af' },
9
+ { number: 400, hexcode: '#fb7185' },
10
+ { number: 500, hexcode: '#f43f5e' },
11
+ { number: 600, hexcode: '#e11d48' },
12
+ { number: 700, hexcode: '#be123c' },
13
+ { number: 800, hexcode: '#9f1239' },
14
+ { number: 900, hexcode: '#881337' },
15
+ ]
16
+ },
17
+ {
18
+ name: 'pink',
19
+ shades: [
20
+ { number: 50, hexcode: '#fdf2f8' },
21
+ { number: 100, hexcode: '#fce7f3' },
22
+ { number: 200, hexcode: '#fbcfe8' },
23
+ { number: 300, hexcode: '#f9a8d4' },
24
+ { number: 400, hexcode: '#f472b6' },
25
+ { number: 500, hexcode: '#ec4899' },
26
+ { number: 600, hexcode: '#db2777' },
27
+ { number: 700, hexcode: '#be185d' },
28
+ { number: 800, hexcode: '#9d174d' },
29
+ { number: 900, hexcode: '#831843' },
30
+ ]
31
+ },
32
+ {
33
+ name: 'fuchsia',
34
+ shades: [
35
+ { number: 50, hexcode: '#fdf4ff' },
36
+ { number: 100, hexcode: '#fae8ff' },
37
+ { number: 200, hexcode: '#f5d0fe' },
38
+ { number: 300, hexcode: '#f0abfc' },
39
+ { number: 400, hexcode: '#e879f9' },
40
+ { number: 500, hexcode: '#d946ef' },
41
+ { number: 600, hexcode: '#c026d3' },
42
+ { number: 700, hexcode: '#a21caf' },
43
+ { number: 800, hexcode: '#86198f' },
44
+ { number: 900, hexcode: '#701a75' },
45
+ ]
46
+ },
47
+ {
48
+ name: 'purple',
49
+ shades: [
50
+ { number: 50, hexcode: '#faf5ff' },
51
+ { number: 100, hexcode: '#f3e8ff' },
52
+ { number: 200, hexcode: '#e9d5ff' },
53
+ { number: 300, hexcode: '#d8b4fe' },
54
+ { number: 400, hexcode: '#c084fc' },
55
+ { number: 500, hexcode: '#a855f7' },
56
+ { number: 600, hexcode: '#9333ea' },
57
+ { number: 700, hexcode: '#7e22ce' },
58
+ { number: 800, hexcode: '#6b21a8' },
59
+ { number: 900, hexcode: '#581c87' },
60
+ ]
61
+ },
62
+ {
63
+ name: 'violet',
64
+ shades: [
65
+ { number: 50, hexcode: '#f5f3ff' },
66
+ { number: 100, hexcode: '#ede9fe' },
67
+ { number: 200, hexcode: '#ddd6fe' },
68
+ { number: 300, hexcode: '#c4b5fd' },
69
+ { number: 400, hexcode: '#a78bfa' },
70
+ { number: 500, hexcode: '#8b5cf6' },
71
+ { number: 600, hexcode: '#7c3aed' },
72
+ { number: 700, hexcode: '#6d28d9' },
73
+ { number: 800, hexcode: '#5b21b6' },
74
+ { number: 900, hexcode: '#4c1d95' },
75
+ ]
76
+ },
77
+ {
78
+ name: 'indigo',
79
+ shades: [
80
+ { number: 50, hexcode: '#eef2ff' },
81
+ { number: 100, hexcode: '#e0e7ff' },
82
+ { number: 200, hexcode: '#c7d2fe' },
83
+ { number: 300, hexcode: '#a5b4fc' },
84
+ { number: 400, hexcode: '#818cf8' },
85
+ { number: 500, hexcode: '#6366f1' },
86
+ { number: 600, hexcode: '#4f46e5' },
87
+ { number: 700, hexcode: '#4338ca' },
88
+ { number: 800, hexcode: '#3730a3' },
89
+ { number: 900, hexcode: '#312e81' },
90
+ ]
91
+ },
92
+ {
93
+ name: 'blue',
94
+ shades: [
95
+ { number: 50, hexcode: '#eff6ff' },
96
+ { number: 100, hexcode: '#dbeafe' },
97
+ { number: 200, hexcode: '#bfdbfe' },
98
+ { number: 300, hexcode: '#93c5fd' },
99
+ { number: 400, hexcode: '#60a5fa' },
100
+ { number: 500, hexcode: '#3b82f6' },
101
+ { number: 600, hexcode: '#2563eb' },
102
+ { number: 700, hexcode: '#1d4ed8' },
103
+ { number: 800, hexcode: '#1e40af' },
104
+ { number: 900, hexcode: '#1e3a8a' },
105
+ ]
106
+ },
107
+ {
108
+ name: 'sky',
109
+ shades: [
110
+ { number: 50, hexcode: '#f0f9ff' },
111
+ { number: 100, hexcode: '#e0f2fe' },
112
+ { number: 200, hexcode: '#bae6fd' },
113
+ { number: 300, hexcode: '#7dd3fc' },
114
+ { number: 400, hexcode: '#38bdf8' },
115
+ { number: 500, hexcode: '#0ea5e9' },
116
+ { number: 600, hexcode: '#0284c7' },
117
+ { number: 700, hexcode: '#0369a1' },
118
+ { number: 800, hexcode: '#075985' },
119
+ { number: 900, hexcode: '#0c4a6e' },
120
+ ]
121
+ },
122
+ {
123
+ name: 'cyan',
124
+ shades: [
125
+ { number: 50, hexcode: '#ecfeff' },
126
+ { number: 100, hexcode: '#cffafe' },
127
+ { number: 200, hexcode: '#a5f3fc' },
128
+ { number: 300, hexcode: '#67e8f9' },
129
+ { number: 400, hexcode: '#22d3ee' },
130
+ { number: 500, hexcode: '#06b6d4' },
131
+ { number: 600, hexcode: '#0891b2' },
132
+ { number: 700, hexcode: '#0e7490' },
133
+ { number: 800, hexcode: '#155e75' },
134
+ { number: 900, hexcode: '#164e63' },
135
+ ]
136
+ },
137
+ {
138
+ name: 'teal',
139
+ shades: [
140
+ { number: 50, hexcode: '#f0fdfa' },
141
+ { number: 100, hexcode: '#ccfbf1' },
142
+ { number: 200, hexcode: '#99f6e4' },
143
+ { number: 300, hexcode: '#5eead4' },
144
+ { number: 400, hexcode: '#2dd4bf' },
145
+ { number: 500, hexcode: '#14b8a6' },
146
+ { number: 600, hexcode: '#0d9488' },
147
+ { number: 700, hexcode: '#0f766e' },
148
+ { number: 800, hexcode: '#115e59' },
149
+ { number: 900, hexcode: '#134e4a' },
150
+ ]
151
+ },
152
+ {
153
+ name: 'emerald',
154
+ shades: [
155
+ { number: 50, hexcode: '#ecfdf5' },
156
+ { number: 100, hexcode: '#d1fae5' },
157
+ { number: 200, hexcode: '#a7f3d0' },
158
+ { number: 300, hexcode: '#6ee7b7' },
159
+ { number: 400, hexcode: '#34d399' },
160
+ { number: 500, hexcode: '#10b981' },
161
+ { number: 600, hexcode: '#059669' },
162
+ { number: 700, hexcode: '#047857' },
163
+ { number: 800, hexcode: '#065f46' },
164
+ { number: 900, hexcode: '#064e3b' },
165
+ ]
166
+ },
167
+ {
168
+ name: 'green',
169
+ shades: [
170
+ { number: 50, hexcode: '#f0fdf4' },
171
+ { number: 100, hexcode: '#dcfce7' },
172
+ { number: 200, hexcode: '#bbf7d0' },
173
+ { number: 300, hexcode: '#86efac' },
174
+ { number: 400, hexcode: '#4ade80' },
175
+ { number: 500, hexcode: '#22c55e' },
176
+ { number: 600, hexcode: '#16a34a' },
177
+ { number: 700, hexcode: '#15803d' },
178
+ { number: 800, hexcode: '#166534' },
179
+ { number: 900, hexcode: '#14532d' },
180
+ ]
181
+ },
182
+ {
183
+ name: 'lime',
184
+ shades: [
185
+ { number: 50, hexcode: '#f7fee7' },
186
+ { number: 100, hexcode: '#ecfccb' },
187
+ { number: 200, hexcode: '#d9f99d' },
188
+ { number: 300, hexcode: '#bef264' },
189
+ { number: 400, hexcode: '#a3e635' },
190
+ { number: 500, hexcode: '#84cc16' },
191
+ { number: 600, hexcode: '#65a30d' },
192
+ { number: 700, hexcode: '#4d7c0f' },
193
+ { number: 800, hexcode: '#3f6212' },
194
+ { number: 900, hexcode: '#365314' },
195
+ ]
196
+ },
197
+ {
198
+ name: 'yellow',
199
+ shades: [
200
+ { number: 50, hexcode: '#fefce8' },
201
+ { number: 100, hexcode: '#fef9c3' },
202
+ { number: 200, hexcode: '#fef08a' },
203
+ { number: 300, hexcode: '#fde047' },
204
+ { number: 400, hexcode: '#facc15' },
205
+ { number: 500, hexcode: '#eab308' },
206
+ { number: 600, hexcode: '#ca8a04' },
207
+ { number: 700, hexcode: '#a16207' },
208
+ { number: 800, hexcode: '#854d0e' },
209
+ { number: 900, hexcode: '#713f12' },
210
+ ]
211
+ },
212
+ {
213
+ name: 'amber',
214
+ shades: [
215
+ { number: 50, hexcode: '#fffbeb' },
216
+ { number: 100, hexcode: '#fef3c7' },
217
+ { number: 200, hexcode: '#fde68a' },
218
+ { number: 300, hexcode: '#fcd34d' },
219
+ { number: 400, hexcode: '#fbbf24' },
220
+ { number: 500, hexcode: '#f59e0b' },
221
+ { number: 600, hexcode: '#d97706' },
222
+ { number: 700, hexcode: '#b45309' },
223
+ { number: 800, hexcode: '#92400e' },
224
+ { number: 900, hexcode: '#78350f' },
225
+ ]
226
+ },
227
+ {
228
+ name: 'orange',
229
+ shades: [
230
+ { number: 50, hexcode: '#fff7ed' },
231
+ { number: 100, hexcode: '#ffedd5' },
232
+ { number: 200, hexcode: '#fed7aa' },
233
+ { number: 300, hexcode: '#fdba74' },
234
+ { number: 400, hexcode: '#fb923c' },
235
+ { number: 500, hexcode: '#f97316' },
236
+ { number: 600, hexcode: '#ea580c' },
237
+ { number: 700, hexcode: '#c2410c' },
238
+ { number: 800, hexcode: '#9a3412' },
239
+ { number: 900, hexcode: '#7c2d12' },
240
+ ]
241
+ },
242
+ {
243
+ name: 'red',
244
+ shades: [
245
+ { number: 50, hexcode: '#fef2f2' },
246
+ { number: 100, hexcode: '#fee2e2' },
247
+ { number: 200, hexcode: '#fecaca' },
248
+ { number: 300, hexcode: '#fca5a5' },
249
+ { number: 400, hexcode: '#f87171' },
250
+ { number: 500, hexcode: '#ef4444' },
251
+ { number: 600, hexcode: '#dc2626' },
252
+ { number: 700, hexcode: '#b91c1c' },
253
+ { number: 800, hexcode: '#991b1b' },
254
+ { number: 900, hexcode: '#7f1d1d' },
255
+ ]
256
+ },
257
+ {
258
+ name: 'warmGray',
259
+ shades: [
260
+ { number: 50, hexcode: '#fafaf9' },
261
+ { number: 100, hexcode: '#f5f5f4' },
262
+ { number: 200, hexcode: '#e7e5e4' },
263
+ { number: 300, hexcode: '#d6d3d1' },
264
+ { number: 400, hexcode: '#a8a29e' },
265
+ { number: 500, hexcode: '#78716c' },
266
+ { number: 600, hexcode: '#57534e' },
267
+ { number: 700, hexcode: '#44403c' },
268
+ { number: 800, hexcode: '#292524' },
269
+ { number: 900, hexcode: '#1c1917' },
270
+ ]
271
+ },
272
+ {
273
+ name: 'trueGray',
274
+ shades: [
275
+ { number: 50, hexcode: '#fafafa' },
276
+ { number: 100, hexcode: '#f5f5f5' },
277
+ { number: 200, hexcode: '#e5e5e5' },
278
+ { number: 300, hexcode: '#d4d4d4' },
279
+ { number: 400, hexcode: '#a3a3a3' },
280
+ { number: 500, hexcode: '#737373' },
281
+ { number: 600, hexcode: '#525252' },
282
+ { number: 700, hexcode: '#404040' },
283
+ { number: 800, hexcode: '#262626' },
284
+ { number: 900, hexcode: '#171717' },
285
+ ]
286
+ },
287
+ {
288
+ name: 'gray',
289
+ shades: [
290
+ { number: 50, hexcode: '#fafafa' },
291
+ { number: 100, hexcode: '#f4f4f5' },
292
+ { number: 200, hexcode: '#e4e4e7' },
293
+ { number: 300, hexcode: '#d4d4d8' },
294
+ { number: 400, hexcode: '#a1a1aa' },
295
+ { number: 500, hexcode: '#71717a' },
296
+ { number: 600, hexcode: '#52525b' },
297
+ { number: 700, hexcode: '#3f3f46' },
298
+ { number: 800, hexcode: '#27272a' },
299
+ { number: 900, hexcode: '#18181b' },
300
+ ]
301
+ },
302
+ {
303
+ name: 'coolGray',
304
+ shades: [
305
+ { number: 50, hexcode: '#f9fafb' },
306
+ { number: 100, hexcode: '#f3f4f6' },
307
+ { number: 200, hexcode: '#e5e7eb' },
308
+ { number: 300, hexcode: '#d1d5db' },
309
+ { number: 400, hexcode: '#9ca3af' },
310
+ { number: 500, hexcode: '#6b7280' },
311
+ { number: 600, hexcode: '#4b5563' },
312
+ { number: 700, hexcode: '#374151' },
313
+ { number: 800, hexcode: '#1f2937' },
314
+ { number: 900, hexcode: '#111827' },
315
+ ]
316
+ },
317
+ {
318
+ name: 'blueGray',
319
+ shades: [
320
+ { number: 50, hexcode: '#f8fafc' },
321
+ { number: 100, hexcode: '#f1f5f9' },
322
+ { number: 200, hexcode: '#e2e8f0' },
323
+ { number: 300, hexcode: '#cbd5e1' },
324
+ { number: 400, hexcode: '#94a3b8' },
325
+ { number: 500, hexcode: '#64748b' },
326
+ { number: 600, hexcode: '#475569' },
327
+ { number: 700, hexcode: '#334155' },
328
+ { number: 800, hexcode: '#1e293b' },
329
+ { number: 900, hexcode: '#0f172a' },
330
+ ]
331
+ },
332
+ ];
package/lib/helpers.js CHANGED
@@ -1953,9 +1953,9 @@ function gridFlow() {
1953
1953
  'grid': '{ layout: {value} }'
1954
1954
  }, {
1955
1955
  'default': {
1956
- 'default': 'horizontal',
1957
- 'flow-col': 'horizontal',
1958
- 'flow-row': 'vertical',
1956
+ 'default': 'horizontal\', width: \'100%',
1957
+ 'flow-col': 'horizontal\', width: \'100%',
1958
+ 'flow-row': 'vertical\', height: \'100%',
1959
1959
  }
1960
1960
  });
1961
1961
  }
@@ -1,2 +1,2 @@
1
- // Based on Tailwind CSS v3.1.8: A utility-first CSS framework for rapidly building custom designs. ( https://tailwindcss.com )
1
+ // Based on Tailwind CSS v3.2.0: A utility-first CSS framework for rapidly building custom designs. ( https://tailwindcss.com )
2
2
  // Created by Adam Wathan ( https://twitter.com/adamwathan ).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purgetss",
3
- "version": "6.0.14",
3
+ "version": "6.1.0",
4
4
  "description": "An extension for Titanium SDK that contains a set of Tailwind-like classes to easily and quickly create beautifully designed mobile apps.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -46,6 +46,7 @@
46
46
  "@fortawesome/fontawesome-free": "^6.2.0",
47
47
  "caporal": "^1.4.0",
48
48
  "chalk": "^4.1.2",
49
+ "chroma-js": "^2.4.2",
49
50
  "command-exists": "^1.2.9",
50
51
  "fontname": "^1.0.0",
51
52
  "framework7-icons": "^5.0.5",
@@ -53,12 +54,14 @@
53
54
  "inquirer": "^8.2.4",
54
55
  "junk": "3.1.0",
55
56
  "lodash": "^4.17.21",
57
+ "ntcjs": "^1.1.2",
56
58
  "path": "^0.12.7",
57
59
  "prompts": "^2.4.2",
58
60
  "read-css": "^0.3.0",
59
- "tailwindcss": "^3.1.8",
60
- "traverse": "^0.6.6",
61
+ "tailwindcss": "^3.2.0",
62
+ "traverse": "^0.6.7",
61
63
  "update-notifier": "^5.1.0",
64
+ "uuid": "^9.0.0",
62
65
  "xml-js": "^1.6.11"
63
66
  }
64
67
  }