@zohodesk/components 1.0.0-alpha-224 → 1.0.0-alpha-225

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 (64) hide show
  1. package/README.md +4 -0
  2. package/{es → assets}/Appearance/dark/mode/darkMode.module.css +2 -2
  3. package/assets/Appearance/dark/themes/blue/blueDarkCTATheme.module.css +34 -0
  4. package/assets/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +42 -0
  5. package/{lib → assets}/Appearance/dark/themes/green/greenDarkCTATheme.module.css +10 -10
  6. package/assets/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +42 -0
  7. package/{es → assets}/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css +10 -10
  8. package/assets/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +42 -0
  9. package/{lib → assets}/Appearance/dark/themes/red/redDarkCTATheme.module.css +10 -10
  10. package/assets/Appearance/dark/themes/red/redDarkComponentTheme.module.css +42 -0
  11. package/{es → assets}/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css +10 -10
  12. package/assets/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +42 -0
  13. package/{es → assets}/Appearance/default/mode/defaultMode.module.css +2 -2
  14. package/{es → assets}/Appearance/default/themes/blue/blueDefaultCTATheme.module.css +0 -0
  15. package/{es → assets}/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css +7 -7
  16. package/{es → assets}/Appearance/default/themes/green/greenDefaultCTATheme.module.css +2 -2
  17. package/{lib → assets}/Appearance/default/themes/green/greenDefaultComponentTheme.module.css +4 -4
  18. package/{es → assets}/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +0 -0
  19. package/{lib → assets}/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css +3 -3
  20. package/{es → assets}/Appearance/default/themes/red/redDefaultCTATheme.module.css +7 -7
  21. package/{lib → assets}/Appearance/default/themes/red/redDefaultComponentTheme.module.css +3 -3
  22. package/{es → assets}/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css +0 -0
  23. package/{es → assets}/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css +3 -3
  24. package/es/AppContainer/AppContainer.js +6 -6
  25. package/es/Provider.js +22 -22
  26. package/es/Stencils/Stencils.module.css +4 -14
  27. package/lib/AppContainer/AppContainer.js +6 -6
  28. package/lib/Provider.js +22 -22
  29. package/lib/Stencils/Stencils.module.css +4 -14
  30. package/package.json +7 -7
  31. package/preprocess/componentAppearanceColors.js +24 -22
  32. package/preprocess/componentThemeColors.js +63 -59
  33. package/preprocess/ctaThemeColors.js +48 -42
  34. package/preprocess/json/componentAppearanceVariableJson.js +1341 -1510
  35. package/preprocess/json/componentThemeVariableJson.js +237 -254
  36. package/preprocess/json/ctaThemeVariableJson.js +198 -332
  37. package/es/Appearance/dark/themes/blue/blueDarkCTATheme.module.css +0 -34
  38. package/es/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +0 -42
  39. package/es/Appearance/dark/themes/green/greenDarkCTATheme.module.css +0 -34
  40. package/es/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +0 -42
  41. package/es/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +0 -42
  42. package/es/Appearance/dark/themes/red/redDarkCTATheme.module.css +0 -34
  43. package/es/Appearance/dark/themes/red/redDarkComponentTheme.module.css +0 -42
  44. package/es/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +0 -42
  45. package/es/Appearance/default/themes/green/greenDefaultComponentTheme.module.css +0 -42
  46. package/es/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css +0 -42
  47. package/es/Appearance/default/themes/red/redDefaultComponentTheme.module.css +0 -42
  48. package/lib/Appearance/dark/mode/darkMode.module.css +0 -356
  49. package/lib/Appearance/dark/themes/blue/blueDarkCTATheme.module.css +0 -34
  50. package/lib/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +0 -42
  51. package/lib/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +0 -42
  52. package/lib/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css +0 -34
  53. package/lib/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +0 -42
  54. package/lib/Appearance/dark/themes/red/redDarkComponentTheme.module.css +0 -42
  55. package/lib/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css +0 -34
  56. package/lib/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +0 -42
  57. package/lib/Appearance/default/mode/defaultMode.module.css +0 -356
  58. package/lib/Appearance/default/themes/blue/blueDefaultCTATheme.module.css +0 -34
  59. package/lib/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css +0 -42
  60. package/lib/Appearance/default/themes/green/greenDefaultCTATheme.module.css +0 -34
  61. package/lib/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +0 -34
  62. package/lib/Appearance/default/themes/red/redDefaultCTATheme.module.css +0 -34
  63. package/lib/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css +0 -34
  64. package/lib/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css +0 -42
package/es/Provider.js CHANGED
@@ -4,30 +4,30 @@ import { Container } from './Layout';
4
4
  import Switch from './Switch/Switch';
5
5
  /* default mode & theme css */
6
6
 
7
- import './Appearance/default/themes/blue/blueDefaultCTATheme.module.css';
8
- import './Appearance/default/themes/green/greenDefaultCTATheme.module.css';
9
- import './Appearance/default/themes/orange/orangeDefaultCTATheme.module.css';
10
- import './Appearance/default/themes/red/redDefaultCTATheme.module.css';
11
- import './Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css';
12
- import './Appearance/default/themes/blue/blueDefaultComponentTheme.module.css';
13
- import './Appearance/default/themes/green/greenDefaultComponentTheme.module.css';
14
- import './Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css';
15
- import './Appearance/default/themes/red/redDefaultComponentTheme.module.css';
16
- import './Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css';
17
- import './Appearance/default/mode/defaultMode.module.css';
7
+ import '../assets/Appearance/default/themes/blue/blueDefaultCTATheme.module.css';
8
+ import '../assets/Appearance/default/themes/green/greenDefaultCTATheme.module.css';
9
+ import '../assets/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css';
10
+ import '../assets/Appearance/default/themes/red/redDefaultCTATheme.module.css';
11
+ import '../assets/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css';
12
+ import '../assets/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css';
13
+ import '../assets/Appearance/default/themes/green/greenDefaultComponentTheme.module.css';
14
+ import '../assets/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css';
15
+ import '../assets/Appearance/default/themes/red/redDefaultComponentTheme.module.css';
16
+ import '../assets/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css';
17
+ import '../assets/Appearance/default/mode/defaultMode.module.css';
18
18
  /* dark mode & theme css */
19
19
 
20
- import './Appearance/dark/themes/blue/blueDarkCTATheme.module.css';
21
- import './Appearance/dark/themes/green/greenDarkCTATheme.module.css';
22
- import './Appearance/dark/themes/orange/orangeDarkCTATheme.module.css';
23
- import './Appearance/dark/themes/red/redDarkCTATheme.module.css';
24
- import './Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css';
25
- import './Appearance/dark/themes/blue/blueDarkComponentTheme.module.css';
26
- import './Appearance/dark/themes/green/greenDarkComponentTheme.module.css';
27
- import './Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css';
28
- import './Appearance/dark/themes/red/redDarkComponentTheme.module.css';
29
- import './Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css';
30
- import './Appearance/dark/mode/darkMode.module.css';
20
+ import '../assets/Appearance/dark/themes/blue/blueDarkCTATheme.module.css';
21
+ import '../assets/Appearance/dark/themes/green/greenDarkCTATheme.module.css';
22
+ import '../assets/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css';
23
+ import '../assets/Appearance/dark/themes/red/redDarkCTATheme.module.css';
24
+ import '../assets/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css';
25
+ import '../assets/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css';
26
+ import '../assets/Appearance/dark/themes/green/greenDarkComponentTheme.module.css';
27
+ import '../assets/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css';
28
+ import '../assets/Appearance/dark/themes/red/redDarkComponentTheme.module.css';
29
+ import '../assets/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css';
30
+ import '../assets/Appearance/dark/mode/darkMode.module.css';
31
31
  import LibraryContext from './Provider/LibraryContextInit';
32
32
  import { setGlobalIdPrefix } from './Provider/IdProvider';
33
33
  export default class Provider extends React.Component {
@@ -14,28 +14,18 @@
14
14
  background-size: 800px 1px;
15
15
  }
16
16
  [dir=ltr] .stencil {
17
- animation-duration: var(--zd_transition10);
17
+ animation-name: placeHolderShimmer-ltr ;
18
18
  animation-fill-mode: forwards;
19
19
  animation-iteration-count: infinite;
20
- animation-name: placeHolderShimmer-ltr ;
20
+ animation-duration: var(--zd_transition10);
21
21
  animation-timing-function: linear;
22
- -webkit-animation-duration: var(--zd_transition10);
23
- -webkit-animation-fill-mode: forwards;
24
- -webkit-animation-iteration-count: infinite;
25
- -webkit-animation-name: placeHolderShimmer-ltr ;
26
- -webkit-animation-timing-function: linear;
27
22
  }
28
23
  [dir=rtl] .stencil {
29
- animation-duration: var(--zd_transition10);
24
+ animation-name: placeHolderShimmer-rtl ;
30
25
  animation-fill-mode: forwards;
31
26
  animation-iteration-count: infinite;
32
- animation-name: placeHolderShimmer-rtl ;
27
+ animation-duration: var(--zd_transition10);
33
28
  animation-timing-function: linear;
34
- -webkit-animation-duration: var(--zd_transition10);
35
- -webkit-animation-fill-mode: forwards;
36
- -webkit-animation-iteration-count: infinite;
37
- -webkit-animation-name: placeHolderShimmer-rtl ;
38
- -webkit-animation-timing-function: linear;
39
29
  }
40
30
  @keyframes placeHolderShimmer-ltr {
41
31
  0% {
@@ -17,19 +17,19 @@ var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
17
17
 
18
18
  require("../common/basic.module.css");
19
19
 
20
- require("@zohodesk/variables/lib/colorVariables.module.css");
20
+ require("@zohodesk/variables/assets/colorVariables.module.css");
21
21
 
22
- require("@zohodesk/variables/lib/dotVariables.module.css");
22
+ require("@zohodesk/variables/assets/dotVariables.module.css");
23
23
 
24
- require("@zohodesk/variables/lib/sizeVariables.module.css");
24
+ require("@zohodesk/variables/assets/sizeVariables.module.css");
25
25
 
26
- require("@zohodesk/variables/lib/fontsizeVariables.module.css");
26
+ require("@zohodesk/variables/assets/fontsizeVariables.module.css");
27
27
 
28
28
  require("@zohodesk/variables/lib/fontFamilyVariables.module.css");
29
29
 
30
- require("@zohodesk/variables/lib/transitionVariables.module.css");
30
+ require("@zohodesk/variables/assets/transitionVariables.module.css");
31
31
 
32
- require("@zohodesk/variables/lib/no_transitionVariables.module.css");
32
+ require("@zohodesk/variables/assets/no_transitionVariables.module.css");
33
33
 
34
34
  var _AppContainerModule = _interopRequireDefault(require("./AppContainer.module.css"));
35
35
 
package/lib/Provider.js CHANGED
@@ -15,49 +15,49 @@ var _Layout = require("./Layout");
15
15
 
16
16
  var _Switch = _interopRequireDefault(require("./Switch/Switch"));
17
17
 
18
- require("./Appearance/default/themes/blue/blueDefaultCTATheme.module.css");
18
+ require("../assets/Appearance/default/themes/blue/blueDefaultCTATheme.module.css");
19
19
 
20
- require("./Appearance/default/themes/green/greenDefaultCTATheme.module.css");
20
+ require("../assets/Appearance/default/themes/green/greenDefaultCTATheme.module.css");
21
21
 
22
- require("./Appearance/default/themes/orange/orangeDefaultCTATheme.module.css");
22
+ require("../assets/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css");
23
23
 
24
- require("./Appearance/default/themes/red/redDefaultCTATheme.module.css");
24
+ require("../assets/Appearance/default/themes/red/redDefaultCTATheme.module.css");
25
25
 
26
- require("./Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css");
26
+ require("../assets/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css");
27
27
 
28
- require("./Appearance/default/themes/blue/blueDefaultComponentTheme.module.css");
28
+ require("../assets/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css");
29
29
 
30
- require("./Appearance/default/themes/green/greenDefaultComponentTheme.module.css");
30
+ require("../assets/Appearance/default/themes/green/greenDefaultComponentTheme.module.css");
31
31
 
32
- require("./Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css");
32
+ require("../assets/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css");
33
33
 
34
- require("./Appearance/default/themes/red/redDefaultComponentTheme.module.css");
34
+ require("../assets/Appearance/default/themes/red/redDefaultComponentTheme.module.css");
35
35
 
36
- require("./Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css");
36
+ require("../assets/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css");
37
37
 
38
- require("./Appearance/default/mode/defaultMode.module.css");
38
+ require("../assets/Appearance/default/mode/defaultMode.module.css");
39
39
 
40
- require("./Appearance/dark/themes/blue/blueDarkCTATheme.module.css");
40
+ require("../assets/Appearance/dark/themes/blue/blueDarkCTATheme.module.css");
41
41
 
42
- require("./Appearance/dark/themes/green/greenDarkCTATheme.module.css");
42
+ require("../assets/Appearance/dark/themes/green/greenDarkCTATheme.module.css");
43
43
 
44
- require("./Appearance/dark/themes/orange/orangeDarkCTATheme.module.css");
44
+ require("../assets/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css");
45
45
 
46
- require("./Appearance/dark/themes/red/redDarkCTATheme.module.css");
46
+ require("../assets/Appearance/dark/themes/red/redDarkCTATheme.module.css");
47
47
 
48
- require("./Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css");
48
+ require("../assets/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css");
49
49
 
50
- require("./Appearance/dark/themes/blue/blueDarkComponentTheme.module.css");
50
+ require("../assets/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css");
51
51
 
52
- require("./Appearance/dark/themes/green/greenDarkComponentTheme.module.css");
52
+ require("../assets/Appearance/dark/themes/green/greenDarkComponentTheme.module.css");
53
53
 
54
- require("./Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css");
54
+ require("../assets/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css");
55
55
 
56
- require("./Appearance/dark/themes/red/redDarkComponentTheme.module.css");
56
+ require("../assets/Appearance/dark/themes/red/redDarkComponentTheme.module.css");
57
57
 
58
- require("./Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css");
58
+ require("../assets/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css");
59
59
 
60
- require("./Appearance/dark/mode/darkMode.module.css");
60
+ require("../assets/Appearance/dark/mode/darkMode.module.css");
61
61
 
62
62
  var _LibraryContextInit = _interopRequireDefault(require("./Provider/LibraryContextInit"));
63
63
 
@@ -14,28 +14,18 @@
14
14
  background-size: 800px 1px;
15
15
  }
16
16
  [dir=ltr] .stencil {
17
- animation-duration: var(--zd_transition10);
17
+ animation-name: placeHolderShimmer-ltr ;
18
18
  animation-fill-mode: forwards;
19
19
  animation-iteration-count: infinite;
20
- animation-name: placeHolderShimmer-ltr ;
20
+ animation-duration: var(--zd_transition10);
21
21
  animation-timing-function: linear;
22
- -webkit-animation-duration: var(--zd_transition10);
23
- -webkit-animation-fill-mode: forwards;
24
- -webkit-animation-iteration-count: infinite;
25
- -webkit-animation-name: placeHolderShimmer-ltr ;
26
- -webkit-animation-timing-function: linear;
27
22
  }
28
23
  [dir=rtl] .stencil {
29
- animation-duration: var(--zd_transition10);
24
+ animation-name: placeHolderShimmer-rtl ;
30
25
  animation-fill-mode: forwards;
31
26
  animation-iteration-count: infinite;
32
- animation-name: placeHolderShimmer-rtl ;
27
+ animation-duration: var(--zd_transition10);
33
28
  animation-timing-function: linear;
34
- -webkit-animation-duration: var(--zd_transition10);
35
- -webkit-animation-fill-mode: forwards;
36
- -webkit-animation-iteration-count: infinite;
37
- -webkit-animation-name: placeHolderShimmer-rtl ;
38
- -webkit-animation-timing-function: linear;
39
29
  }
40
30
  @keyframes placeHolderShimmer-ltr {
41
31
  0% {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/components",
3
- "version": "1.0.0-alpha-224",
3
+ "version": "1.0.0-alpha-225",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",
@@ -34,12 +34,12 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@zohodesk/docstool": "1.0.0-alpha-2",
37
- "@zohodesk/variables": "1.0.0-beta.28",
38
- "@zohodesk/icons": "1.0.0-beta.85",
37
+ "@zohodesk/variables": "1.0.0-beta.29",
38
+ "@zohodesk/icons": "1.0.0-beta.92",
39
39
  "@zohodesk/virtualizer": "1.0.3",
40
40
  "velocity-react": "^1.4.1",
41
41
  "react-sortable-hoc": "^0.8.3",
42
- "@zohodesk/svg": "1.0.0-beta.38"
42
+ "@zohodesk/svg": "1.0.0-beta.39"
43
43
  },
44
44
  "dependencies": {
45
45
  "hoist-non-react-statics": "3.0.1",
@@ -48,9 +48,9 @@
48
48
  "selectn": "1.1.2"
49
49
  },
50
50
  "peerDependencies": {
51
- "@zohodesk/icons": "^1.0.0-beta.85",
52
- "@zohodesk/variables": "^1.0.0-beta.28",
53
- "@zohodesk/svg": "^1.0.0-beta.37",
51
+ "@zohodesk/icons": "1.0.0-beta.92",
52
+ "@zohodesk/variables": "1.0.0-beta.29",
53
+ "@zohodesk/svg": "1.0.0-beta.39",
54
54
  "@zohodesk/virtualizer": "^1.0.3",
55
55
  "velocity-react": "^1.4.1",
56
56
  "react-sortable-hoc": "^0.8.3"
@@ -1,11 +1,12 @@
1
1
  var { componentAppearanceVariables } = require('./json/componentAppearanceVariableJson');
2
+ var { ensureDirectoryExistence } = require('../../common/pre_utils');
2
3
  let fs = require('fs');
3
4
  let path = require('path');
4
5
  let baseFolder = 'Appearance';
5
6
  let mode = ['default', 'dark'];
6
7
  let modeFiles = [];
7
8
  mode.forEach(mode => {
8
- let modeFilesString = `../src/${baseFolder}/${mode}/mode/${mode}Mode.module.css`;
9
+ let modeFilesString = `../assets/${baseFolder}/${mode}/mode/${mode}Mode.module.css`;
9
10
  modeFiles.push(path.join(__dirname, modeFilesString));
10
11
  });
11
12
  let files = modeFiles;
@@ -14,33 +15,33 @@ function generate(mode) {
14
15
  let exportVariables = [];
15
16
  let counter = 0;
16
17
  let newLine = '';
17
- componentAppearanceVariables.map(componentVariable => {
18
- let commentName = componentVariable[3];
18
+
19
+ componentAppearanceVariables.forEach((element) => {
20
+ let commentName = element.comment;
19
21
  counting = counter++;
20
22
  if (counting != 0) {
21
23
  newLine = `\n\t`;
22
24
  }
23
- if (mode == 'default') {
24
- let componentDefaultColors = componentVariable[1][1];
25
25
 
26
- colorsResult = [
27
- `\n\t--${componentVariable[0]}: ${componentDefaultColors};`
28
- ];
29
- exportVariables.push(
30
- commentName ? `${newLine}\n\t/* ${commentName} */` : '',
31
- colorsResult
32
- );
33
- } else if (mode == 'dark') {
34
- let componentDarkColors = componentVariable[2][1];
26
+ exportVariables.push(commentName ? `${newLine}\n\t/* ${commentName} */` : '');
35
27
 
36
- colorsResult = [
37
- `\n\t--${componentVariable[0]}: ${componentDarkColors};`
38
- ];
39
- exportVariables.push(
40
- commentName ? `${newLine}\n\t/* ${commentName} */` : '',
41
- colorsResult
42
- );
43
- }
28
+ Object.entries(element.data).map(([key, value]) => {
29
+ if (mode == 'default') {
30
+ let componentDefaultColors = value.light[0];
31
+
32
+ colorsResult = [
33
+ `\n\t--${key}: ${componentDefaultColors};`
34
+ ];
35
+ exportVariables.push(colorsResult);
36
+ } else if (mode == 'dark') {
37
+ let componentDarkColors = value.dark[0];
38
+
39
+ colorsResult = [
40
+ `\n\t--${key}: ${componentDarkColors};`
41
+ ];
42
+ exportVariables.push(colorsResult);
43
+ }
44
+ });
44
45
  });
45
46
  return exportVariables.join('');
46
47
  }
@@ -55,6 +56,7 @@ mode.forEach(mode => {
55
56
  } else if (mode == 'dark') {
56
57
  blueSelector = '';
57
58
  }
59
+ ensureDirectoryExistence(fileString);
58
60
  fs.writeFileSync(
59
61
  fileString,
60
62
  `[data-mode='${getMode}']${blueSelector} {${generate(
@@ -1,13 +1,15 @@
1
1
  var { componentThemeVariables } = require('./json/componentThemeVariableJson');
2
+ var { ensureDirectoryExistence } = require('../../common/pre_utils');
2
3
  let fs = require('fs');
3
4
  let path = require('path');
4
5
  let baseFolder = 'Appearance';
5
6
  let mode = ['default', 'dark'];
6
7
  let themes = ['blue', 'green', 'orange', 'red', 'yellow'];
7
8
  let themeFiles = [];
9
+ let prefix=`\n\t--zdt_`;
8
10
  mode.forEach(mode => {
9
11
  themes.forEach(theme => {
10
- let themeFilesString = `../src/${baseFolder}/${mode}/themes/${theme}/${
12
+ let themeFilesString = `../assets/${baseFolder}/${mode}/themes/${theme}/${
11
13
  theme + capitalizeFirstLetter(mode)
12
14
  }ComponentTheme.module.css`;
13
15
  themeFiles.push(path.join(__dirname, themeFilesString));
@@ -23,70 +25,71 @@ function generate(mode, theme) {
23
25
  let exportVariables = [];
24
26
  let counter = 0;
25
27
  let newLine = '';
26
- componentThemeVariables.map(componentVariable => {
27
- let commentName = componentVariable[3];
28
+
29
+ componentThemeVariables.forEach((element) => {
30
+ let commentName = element.comment;
28
31
  counting = counter++;
29
32
  if (counting != 0) {
30
33
  newLine = `\n\t`;
31
34
  }
32
- if (mode == 'default') {
33
- let componentDefaultColors = componentVariable[1][1];
34
35
 
35
- let colorsResult = '';
36
- if (theme == 'blue') {
37
- colorsResult = [
38
- `\n\t--zdt_${componentVariable[0]}: ${componentDefaultColors[0]};`
39
- ];
40
- } else if (theme == 'green') {
41
- colorsResult = [
42
- `\n\t--zdt_${componentVariable[0]}: ${componentDefaultColors[1]};`
43
- ];
44
- } else if (theme == 'orange') {
45
- colorsResult = [
46
- `\n\t--zdt_${componentVariable[0]}: ${componentDefaultColors[2]};`
47
- ];
48
- } else if (theme == 'red') {
49
- colorsResult = [
50
- `\n\t--zdt_${componentVariable[0]}: ${componentDefaultColors[3]};`
51
- ];
52
- } else if (theme == 'yellow') {
53
- colorsResult = [
54
- `\n\t--zdt_${componentVariable[0]}: ${componentDefaultColors[4]};`
55
- ];
56
- }
57
- exportVariables.push(
58
- commentName ? `${newLine}\n\t/* ${commentName} */` : '',
59
- colorsResult
60
- );
61
- } else if (mode == 'dark') {
62
- let componentDarkColors = componentVariable[2][1];
63
- let colorsResult = '';
64
- if (theme == 'blue') {
65
- colorsResult = [
66
- `\n\t--zdt_${componentVariable[0]}: ${componentDarkColors[0]};`
67
- ];
68
- } else if (theme == 'green') {
69
- colorsResult = [
70
- `\n\t--zdt_${componentVariable[0]}: ${componentDarkColors[1]};`
71
- ];
72
- } else if (theme == 'orange') {
73
- colorsResult = [
74
- `\n\t--zdt_${componentVariable[0]}: ${componentDarkColors[2]};`
75
- ];
76
- } else if (theme == 'red') {
77
- colorsResult = [
78
- `\n\t--zdt_${componentVariable[0]}: ${componentDarkColors[3]};`
79
- ];
80
- } else if (theme == 'yellow') {
81
- colorsResult = [
82
- `\n\t--zdt_${componentVariable[0]}: ${componentDarkColors[4]};`
83
- ];
36
+ exportVariables.push(commentName ? `${newLine}\n\t/* ${commentName} */` : '');
37
+
38
+ Object.entries(element.data).map(([key, value]) => {
39
+ if (mode == 'default') {
40
+ let componentDefaultColors = value.light;
41
+ let colorsResult = '';
42
+
43
+ if (theme == 'blue') {
44
+ colorsResult = [
45
+ `${prefix}${key}: ${componentDefaultColors[0]};`
46
+ ];
47
+ } else if (theme == 'green') {
48
+ colorsResult = [
49
+ `${prefix}${key}: ${componentDefaultColors[1]};`
50
+ ];
51
+ } else if (theme == 'orange') {
52
+ colorsResult = [
53
+ `${prefix}${key}: ${componentDefaultColors[2]};`
54
+ ];
55
+ } else if (theme == 'red') {
56
+ colorsResult = [
57
+ `${prefix}${key}: ${componentDefaultColors[3]};`
58
+ ];
59
+ } else if (theme == 'yellow') {
60
+ colorsResult = [
61
+ `${prefix}${key}: ${componentDefaultColors[4]};`
62
+ ];
63
+ }
64
+ exportVariables.push(colorsResult);
65
+ } else if (mode == 'dark') {
66
+ let componentDarkColors = value.dark;
67
+ let colorsResult = '';
68
+
69
+ if (theme == 'blue') {
70
+ colorsResult = [
71
+ `${prefix}${key}: ${componentDarkColors[0]};`
72
+ ];
73
+ } else if (theme == 'green') {
74
+ colorsResult = [
75
+ `${prefix}${key}: ${componentDarkColors[1]};`
76
+ ];
77
+ } else if (theme == 'orange') {
78
+ colorsResult = [
79
+ `${prefix}${key}: ${componentDarkColors[2]};`
80
+ ];
81
+ } else if (theme == 'red') {
82
+ colorsResult = [
83
+ `${prefix}${key}: ${componentDarkColors[3]};`
84
+ ];
85
+ } else if (theme == 'yellow') {
86
+ colorsResult = [
87
+ `${prefix}${key}: ${componentDarkColors[4]};`
88
+ ];
89
+ }
90
+ exportVariables.push(colorsResult);
84
91
  }
85
- exportVariables.push(
86
- commentName ? `${newLine}\n\t/* ${commentName} */` : '',
87
- colorsResult
88
- );
89
- }
92
+ });
90
93
  });
91
94
  return exportVariables.join('');
92
95
  }
@@ -107,6 +110,7 @@ mode.forEach(mode => {
107
110
  } else {
108
111
  blueSelector = '';
109
112
  }
113
+ ensureDirectoryExistence(fileString);
110
114
  fs.writeFileSync(
111
115
  fileString,
112
116
  `[data-mode='${getMode}'][data-theme='${getTheme}']${blueSelector} {${generate(
@@ -1,13 +1,15 @@
1
1
  var { ctaThemeVariables } = require('./json/ctaThemeVariableJson');
2
+ var { ensureDirectoryExistence } = require('../../common/pre_utils');
2
3
  let fs = require('fs');
3
4
  let path = require('path');
4
5
  let baseFolder = 'Appearance';
5
6
  let mode = ['default', 'dark'];
6
7
  let themes = ['blue', 'green', 'orange', 'red', 'yellow'];
7
8
  let themeFiles = [];
9
+ let prefix=`\n\t--zdt_cta_`;
8
10
  mode.forEach(mode => {
9
11
  themes.forEach(theme => {
10
- let themeFilesString = `../src/${baseFolder}/${mode}/themes/${theme}/${
12
+ let themeFilesString = `../assets/${baseFolder}/${mode}/themes/${theme}/${
11
13
  theme + capitalizeFirstLetter(mode)
12
14
  }CTATheme.module.css`;
13
15
  themeFiles.push(path.join(__dirname, themeFilesString));
@@ -21,48 +23,51 @@ function capitalizeFirstLetter(string) {
21
23
 
22
24
  function generate(mode, theme) {
23
25
  let exportVariables = [];
24
- ctaThemeVariables.map(ctaVariable => {
25
- if (mode == 'default') {
26
- let ctaDefaultColors = ctaVariable[1][1];
27
- let colorsResult = '';
28
- if (theme == 'blue') {
29
- colorsResult = [
30
- `\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDefaultColors[0]}`
31
- ];
32
- } else if (theme == 'green') {
33
- colorsResult = [
34
- `\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDefaultColors[1]}`
35
- ];
36
- } else if (theme == 'orange') {
37
- colorsResult = [
38
- `\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDefaultColors[2]}`
39
- ];
40
- } else if (theme == 'red') {
41
- colorsResult = [
42
- `\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDefaultColors[3]}`
43
- ];
44
- } else if (theme == 'yellow') {
45
- colorsResult = [
46
- `\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDefaultColors[4]}`
47
- ];
48
- }
49
- exportVariables.push(colorsResult);
50
- } else if (mode == 'dark') {
51
- let ctaDarkColors = ctaVariable[2][1];
52
- let colorsResult = '';
53
- if (theme == 'blue') {
54
- colorsResult = [`\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDarkColors[0]}`];
55
- } else if (theme == 'green') {
56
- colorsResult = [`\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDarkColors[1]}`];
57
- } else if (theme == 'orange') {
58
- colorsResult = [`\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDarkColors[2]}`];
59
- } else if (theme == 'red') {
60
- colorsResult = [`\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDarkColors[3]}`];
61
- } else if (theme == 'yellow') {
62
- colorsResult = [`\n\t--zdt_cta_${ctaVariable[0]}: ${ctaDarkColors[4]}`];
26
+
27
+ ctaThemeVariables.forEach((element) => {
28
+ Object.entries(element).map(([key, value]) => {
29
+ if (mode == 'default') {
30
+ let ctaDefaultColors = value.light;
31
+ let colorsResult = '';
32
+ if (theme == 'blue') {
33
+ colorsResult = [
34
+ `${prefix}${key}: ${ctaDefaultColors[0]}`
35
+ ];
36
+ } else if (theme == 'green') {
37
+ colorsResult = [
38
+ `${prefix}${key}: ${ctaDefaultColors[1]}`
39
+ ];
40
+ } else if (theme == 'orange') {
41
+ colorsResult = [
42
+ `${prefix}${key}: ${ctaDefaultColors[2]}`
43
+ ];
44
+ } else if (theme == 'red') {
45
+ colorsResult = [
46
+ `${prefix}${key}: ${ctaDefaultColors[3]}`
47
+ ];
48
+ } else if (theme == 'yellow') {
49
+ colorsResult = [
50
+ `${prefix}${key}: ${ctaDefaultColors[4]}`
51
+ ];
52
+ }
53
+ exportVariables.push(colorsResult);
54
+ } else if (mode == 'dark') {
55
+ let ctaDarkColors = value.dark;
56
+ let colorsResult = '';
57
+ if (theme == 'blue') {
58
+ colorsResult = [`${prefix}${key}: ${ctaDarkColors[0]}`];
59
+ } else if (theme == 'green') {
60
+ colorsResult = [`${prefix}${key}: ${ctaDarkColors[1]}`];
61
+ } else if (theme == 'orange') {
62
+ colorsResult = [`${prefix}${key}: ${ctaDarkColors[2]}`];
63
+ } else if (theme == 'red') {
64
+ colorsResult = [`${prefix}${key}: ${ctaDarkColors[3]}`];
65
+ } else if (theme == 'yellow') {
66
+ colorsResult = [`${prefix}${key}: ${ctaDarkColors[4]}`];
67
+ }
68
+ exportVariables.push(colorsResult);
63
69
  }
64
- exportVariables.push(colorsResult);
65
- }
70
+ });
66
71
  });
67
72
  return exportVariables.join(';');
68
73
  }
@@ -83,6 +88,7 @@ mode.forEach(mode => {
83
88
  } else {
84
89
  blueSelector = '';
85
90
  }
91
+ ensureDirectoryExistence(fileString);
86
92
  fs.writeFileSync(
87
93
  fileString,
88
94
  `[data-mode='${getMode}'][data-theme='${getTheme}']${blueSelector} {${generate(