@ptsecurity/mosaic 13.3.0 → 13.3.1

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 (102) hide show
  1. package/design-tokens/legacy-2017/tokens/components/alert.json5 +83 -0
  2. package/design-tokens/legacy-2017/tokens/components/autocomplete.json5 +11 -0
  3. package/design-tokens/legacy-2017/tokens/components/badge.json5 +174 -0
  4. package/design-tokens/legacy-2017/tokens/components/button-toggle.json5 +10 -0
  5. package/design-tokens/legacy-2017/tokens/components/button.json5 +142 -0
  6. package/design-tokens/legacy-2017/tokens/components/card.json5 +51 -0
  7. package/design-tokens/legacy-2017/tokens/components/checkbox.json5 +39 -0
  8. package/design-tokens/legacy-2017/tokens/components/datepicker.json5 +64 -0
  9. package/design-tokens/legacy-2017/tokens/components/divider.json5 +8 -0
  10. package/design-tokens/legacy-2017/tokens/components/dl.json5 +38 -0
  11. package/design-tokens/legacy-2017/tokens/components/dropdown.json5 +48 -0
  12. package/design-tokens/legacy-2017/tokens/components/form-field.json5 +92 -0
  13. package/design-tokens/legacy-2017/tokens/components/forms.json5 +52 -0
  14. package/design-tokens/legacy-2017/tokens/components/input.json5 +12 -0
  15. package/design-tokens/legacy-2017/tokens/components/link.json5 +50 -0
  16. package/design-tokens/legacy-2017/tokens/components/list.json5 +13 -0
  17. package/design-tokens/legacy-2017/tokens/components/modal.json5 +81 -0
  18. package/design-tokens/legacy-2017/tokens/components/navbar.json5 +70 -0
  19. package/design-tokens/legacy-2017/tokens/components/optgroup.json5 +10 -0
  20. package/design-tokens/legacy-2017/tokens/components/option.json5 +12 -0
  21. package/design-tokens/legacy-2017/tokens/components/popover.json5 +68 -0
  22. package/design-tokens/legacy-2017/tokens/components/popup.json5 +18 -0
  23. package/design-tokens/legacy-2017/tokens/components/progress-bar.json5 +13 -0
  24. package/design-tokens/legacy-2017/tokens/components/progress-spinner.json5 +7 -0
  25. package/design-tokens/legacy-2017/tokens/components/radio.json5 +44 -0
  26. package/design-tokens/legacy-2017/tokens/components/select.json5 +24 -0
  27. package/design-tokens/legacy-2017/tokens/components/sidepanel.json5 +32 -0
  28. package/design-tokens/legacy-2017/tokens/components/table.json5 +15 -0
  29. package/design-tokens/legacy-2017/tokens/components/tabs.json5 +101 -0
  30. package/design-tokens/legacy-2017/tokens/components/tags.json5 +131 -0
  31. package/design-tokens/legacy-2017/tokens/components/textarea.json5 +12 -0
  32. package/design-tokens/legacy-2017/tokens/components/timepicker.json5 +7 -0
  33. package/design-tokens/legacy-2017/tokens/components/toggle.json5 +79 -0
  34. package/design-tokens/legacy-2017/tokens/components/tooltip.json5 +83 -0
  35. package/design-tokens/legacy-2017/tokens/components/tree.json5 +15 -0
  36. package/design-tokens/legacy-2017/tokens/properties/aliases.json5 +3 -0
  37. package/design-tokens/legacy-2017/tokens/properties/colors.json5 +114 -0
  38. package/design-tokens/legacy-2017/tokens/properties/font.json5 +12 -0
  39. package/design-tokens/legacy-2017/tokens/properties/globals.json5 +49 -0
  40. package/design-tokens/legacy-2017/tokens/properties/padding.json5 +3 -0
  41. package/design-tokens/legacy-2017/tokens/properties/palette.json5 +163 -0
  42. package/design-tokens/legacy-2017/tokens/properties/typography.json5 +175 -0
  43. package/design-tokens/pt-2022/tokens/components/alert.json5 +83 -0
  44. package/design-tokens/pt-2022/tokens/components/autocomplete.json5 +11 -0
  45. package/design-tokens/pt-2022/tokens/components/badge.json5 +174 -0
  46. package/design-tokens/pt-2022/tokens/components/button-toggle.json5 +10 -0
  47. package/design-tokens/pt-2022/tokens/components/button.json5 +142 -0
  48. package/design-tokens/pt-2022/tokens/components/card.json5 +51 -0
  49. package/design-tokens/pt-2022/tokens/components/checkbox.json5 +39 -0
  50. package/design-tokens/pt-2022/tokens/components/datepicker.json5 +64 -0
  51. package/design-tokens/pt-2022/tokens/components/divider.json5 +8 -0
  52. package/design-tokens/pt-2022/tokens/components/dl.json5 +38 -0
  53. package/design-tokens/pt-2022/tokens/components/dropdown.json5 +48 -0
  54. package/design-tokens/pt-2022/tokens/components/form-field.json5 +92 -0
  55. package/design-tokens/pt-2022/tokens/components/forms.json5 +52 -0
  56. package/design-tokens/pt-2022/tokens/components/input.json5 +12 -0
  57. package/design-tokens/pt-2022/tokens/components/link.json5 +50 -0
  58. package/design-tokens/pt-2022/tokens/components/list.json5 +13 -0
  59. package/design-tokens/pt-2022/tokens/components/modal.json5 +81 -0
  60. package/design-tokens/pt-2022/tokens/components/navbar.json5 +70 -0
  61. package/design-tokens/pt-2022/tokens/components/optgroup.json5 +10 -0
  62. package/design-tokens/pt-2022/tokens/components/option.json5 +12 -0
  63. package/design-tokens/pt-2022/tokens/components/popover.json5 +68 -0
  64. package/design-tokens/pt-2022/tokens/components/popup.json5 +18 -0
  65. package/design-tokens/pt-2022/tokens/components/progress-bar.json5 +13 -0
  66. package/design-tokens/pt-2022/tokens/components/progress-spinner.json5 +7 -0
  67. package/design-tokens/pt-2022/tokens/components/radio.json5 +44 -0
  68. package/design-tokens/pt-2022/tokens/components/select.json5 +24 -0
  69. package/design-tokens/pt-2022/tokens/components/sidepanel.json5 +32 -0
  70. package/design-tokens/pt-2022/tokens/components/table.json5 +15 -0
  71. package/design-tokens/pt-2022/tokens/components/tabs.json5 +101 -0
  72. package/design-tokens/pt-2022/tokens/components/tags.json5 +131 -0
  73. package/design-tokens/pt-2022/tokens/components/textarea.json5 +12 -0
  74. package/design-tokens/pt-2022/tokens/components/timepicker.json5 +7 -0
  75. package/design-tokens/pt-2022/tokens/components/toggle.json5 +79 -0
  76. package/design-tokens/pt-2022/tokens/components/tooltip.json5 +83 -0
  77. package/design-tokens/pt-2022/tokens/components/tree.json5 +15 -0
  78. package/design-tokens/pt-2022/tokens/properties/aliases.json5 +3 -0
  79. package/design-tokens/pt-2022/tokens/properties/colors.json5 +116 -0
  80. package/design-tokens/pt-2022/tokens/properties/font.json5 +15 -0
  81. package/design-tokens/pt-2022/tokens/properties/globals.json5 +49 -0
  82. package/design-tokens/pt-2022/tokens/properties/padding.json5 +3 -0
  83. package/design-tokens/pt-2022/tokens/properties/palette.json5 +226 -0
  84. package/design-tokens/pt-2022/tokens/properties/typography.json5 +175 -0
  85. package/design-tokens/style-dictionary/build.js +62 -0
  86. package/design-tokens/style-dictionary/configs/css.js +13 -0
  87. package/design-tokens/style-dictionary/configs/index.js +48 -0
  88. package/design-tokens/style-dictionary/configs/js.js +9 -0
  89. package/design-tokens/style-dictionary/configs/scss.js +23 -0
  90. package/design-tokens/style-dictionary/filters/color.js +7 -0
  91. package/design-tokens/style-dictionary/filters/palette.js +7 -0
  92. package/design-tokens/style-dictionary/filters/size.js +7 -0
  93. package/design-tokens/style-dictionary/filters/typography.js +7 -0
  94. package/design-tokens/style-dictionary/formats/palette.js +25 -0
  95. package/design-tokens/style-dictionary/formats/typography.js +52 -0
  96. package/design-tokens/style-dictionary/transformGroups/css.js +13 -0
  97. package/design-tokens/style-dictionary/transformGroups/scss.js +12 -0
  98. package/design-tokens/style-dictionary/transforms/attribute/palette.js +9 -0
  99. package/design-tokens/style-dictionary/transforms/attribute/prefix.js +11 -0
  100. package/design-tokens/style-dictionary/transforms/attribute/size.js +8 -0
  101. package/design-tokens/style-dictionary/transforms/attribute/typography.js +9 -0
  102. package/package.json +4 -4
@@ -0,0 +1,175 @@
1
+ {
2
+ "typography": {
3
+ "display-1": {
4
+ "font-size": { value: '56px' },
5
+ "line-height": { value: '76px' },
6
+ "letter-spacing": { value: 'normal' },
7
+ "font-weight": { value: 'normal' },
8
+ "font-family": { value: '{font.family.accent}' },
9
+ "text-transform": { value: 'null' },
10
+ "font-feature-settings": { value: 'null' }
11
+ },
12
+ "display-2": {
13
+ "font-size": { value: '45px' },
14
+ "line-height": { value: '56px' },
15
+ "letter-spacing": { value: 'normal' },
16
+ "font-weight": { value: 'normal' },
17
+ "font-family": { value: '{font.family.accent}' },
18
+ "text-transform": { value: 'null' },
19
+ "font-feature-settings": { value: 'null' }
20
+ },
21
+ "display-3": {
22
+ "font-size": { value: '34px' },
23
+ "line-height": { value: '44px' },
24
+ "letter-spacing": { value: 'normal' },
25
+ "font-weight": { value: 'normal' },
26
+ "font-family": { value: '{font.family.accent}' },
27
+ "text-transform": { value: 'null' },
28
+ "font-feature-settings": { value: 'null' }
29
+ },
30
+ "headline": {
31
+ "font-size": { value: '24px' },
32
+ "line-height": { value: '32px' },
33
+ "letter-spacing": { value: 'normal' },
34
+ "font-weight": { value: 'normal' },
35
+ "font-family": { value: '{font.family.accent}' },
36
+ "text-transform": { value: 'null' },
37
+ "font-feature-settings": { value: 'null' }
38
+ },
39
+ "title": {
40
+ "font-size": { value: '20px' },
41
+ "line-height": { value: '28px' },
42
+ "letter-spacing": { value: 'normal' },
43
+ "font-weight": { value: '600' },
44
+ "font-family": { value: '{font.family.accent}' },
45
+ "text-transform": { value: 'null' },
46
+ "font-feature-settings": { value: 'null' }
47
+ },
48
+ "subheading": {
49
+ "font-size": { value: '15px' },
50
+ "line-height": { value: '20px' },
51
+ "letter-spacing": { value: '-0.009em' },
52
+ "font-weight": { value: '600' },
53
+ "font-family": { value: '{font.family.base}' },
54
+ "text-transform": { value: 'null' },
55
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
56
+ },
57
+ "body": {
58
+ "font-size": { value: '15px' },
59
+ "line-height": { value: '20px' },
60
+ "letter-spacing": { value: '-0.009em' },
61
+ "font-weight": { value: 'normal' },
62
+ "font-family": { value: '{font.family.base}' },
63
+ "text-transform": { value: 'null' },
64
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
65
+ },
66
+ "body-tabular": {
67
+ "font-size": { value: '15px' },
68
+ "line-height": { value: '20px' },
69
+ "letter-spacing": { value: '-0.009em' },
70
+ "font-weight": { value: 'normal' },
71
+ "font-family": { value: '{font.family.base}' },
72
+ "text-transform": { value: 'null' },
73
+ "font-feature-settings": { value: '"tnum" on, "ss01" on, "ss04" on' }
74
+ },
75
+ "body-strong": {
76
+ "font-size": { value: '15px' },
77
+ "line-height": { value: '20px' },
78
+ "letter-spacing": { value: '-0.009em' },
79
+ "font-weight": { value: '500' },
80
+ "font-family": { value: '{font.family.base}' },
81
+ "text-transform": { value: 'null' },
82
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
83
+ },
84
+ "body-caps": {
85
+ "font-size": { value: '15px' },
86
+ "line-height": { value: '20px' },
87
+ "letter-spacing": { value: '1.7px' },
88
+ "font-weight": { value: 'normal' },
89
+ "font-family": { value: '{font.family.base}' },
90
+ "text-transform": { value: 'uppercase' },
91
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
92
+ },
93
+ "body-mono": {
94
+ "font-size": { value: '15px' },
95
+ "line-height": { value: '20px' },
96
+ "letter-spacing": { value: 'normal' },
97
+ "font-weight": { value: 'normal' },
98
+ "font-family": { value: '{font.family.monospace}' },
99
+ "text-transform": { value: 'null' },
100
+ "font-feature-settings": { value: 'null' }
101
+ },
102
+ "caption": {
103
+ "font-size": { value: '13px' },
104
+ "line-height": { value: '16px' },
105
+ "letter-spacing": { value: '-0.0025em' },
106
+ "font-weight": { value: 'normal' },
107
+ "font-family": { value: '{font.family.base}' },
108
+ "text-transform": { value: 'null' },
109
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
110
+ },
111
+ "caption-tabular": {
112
+ "font-size": { value: '13px' },
113
+ "line-height": { value: '16px' },
114
+ "letter-spacing": { value: '-0.0025em' },
115
+ "font-weight": { value: 'normal' },
116
+ "font-family": { value: '{font.family.base}' },
117
+ "text-transform": { value: 'null' },
118
+ "font-feature-settings": { value: '"tnum" on, "ss01" on, "ss04" on' }
119
+ },
120
+ "caption-caps": {
121
+ "font-size": { value: '13px' },
122
+ "line-height": { value: '16px' },
123
+ "letter-spacing": { value: '1.5px' },
124
+ "font-weight": { value: 'normal' },
125
+ "font-family": { value: '{font.family.base}' },
126
+ "text-transform": { value: 'uppercase' },
127
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
128
+ },
129
+ "caption-mono": {
130
+ "font-size": { value: '13px' },
131
+ "line-height": { value: '16px' },
132
+ "letter-spacing": { value: 'normal' },
133
+ "font-weight": { value: 'normal' },
134
+ "font-family": { value: '{font.family.monospace}' },
135
+ "text-transform": { value: 'null' },
136
+ "font-feature-settings": { value: 'null' }
137
+ },
138
+ "small-text": {
139
+ "font-size": { value: '13px' },
140
+ "line-height": { value: '16px' },
141
+ "letter-spacing": { value: '-0.0025em' },
142
+ "font-weight": { value: 'normal' },
143
+ "font-family": { value: '{font.family.base}' },
144
+ "text-transform": { value: 'null' },
145
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
146
+ },
147
+ "extra-small-text": {
148
+ "font-size": { value: '11px' },
149
+ "line-height": { value: '16px' },
150
+ "letter-spacing": { value: '0.005em' },
151
+ "font-weight": { value: 'normal' },
152
+ "font-family": { value: '{font.family.base}' },
153
+ "text-transform": { value: 'null' },
154
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
155
+ },
156
+ "extra-small-text-caps": {
157
+ "font-size": { value: '11px' },
158
+ "line-height": { value: '16px' },
159
+ "letter-spacing": { value: '1px' },
160
+ "font-weight": { value: 'normal' },
161
+ "font-family": { value: '{font.family.base}' },
162
+ "text-transform": { value: 'uppercase' },
163
+ "font-feature-settings": { value: '"ss01" on, "ss04" on' }
164
+ },
165
+ "extra-small-text-mono": {
166
+ "font-size": { value: '11px' },
167
+ "line-height": { value: '16px' },
168
+ "letter-spacing": { value: '0px' },
169
+ "font-weight": { value: 'normal' },
170
+ "font-family": { value: '{font.family.monospace}' },
171
+ "text-transform": { value: 'null' },
172
+ "font-feature-settings": { value: 'null' }
173
+ }
174
+ }
175
+ }
@@ -0,0 +1,62 @@
1
+ const StyleDictionary = require('style-dictionary');
2
+ const getPlatformConfig = require('./configs');
3
+
4
+ // ==== Include custom transforms ====
5
+ require('./transforms/attribute/typography')(StyleDictionary);
6
+ require('./transforms/attribute/palette')(StyleDictionary);
7
+ require('./transforms/attribute/prefix')(StyleDictionary);
8
+ require('./transforms/attribute/size')(StyleDictionary);
9
+
10
+ // ==== Include custom filters ====
11
+ require('./filters/palette')(StyleDictionary);
12
+ require('./filters/color')(StyleDictionary);
13
+ require('./filters/size')(StyleDictionary);
14
+ require('./filters/typography')(StyleDictionary);
15
+
16
+ // ==== Include custom transform groups ====
17
+ require('./transformGroups/scss')(StyleDictionary);
18
+ require('./transformGroups/css')(StyleDictionary);
19
+
20
+ // ==== Include custom formats ====
21
+ require('./formats/typography')(StyleDictionary);
22
+ require('./formats/palette')(StyleDictionary);
23
+
24
+ // ==== Run build ====
25
+ console.log('Build started...');
26
+ console.log('==============================================');
27
+
28
+ module.exports = (themeConfig) => {
29
+ StyleDictionary.registerFileHeader({
30
+ name: 'customHeader',
31
+ fileHeader: () => {
32
+ return [`Do not edit directly`];
33
+ }
34
+ });
35
+ console.log('themeConfig: ', themeConfig);
36
+
37
+ if (!themeConfig || themeConfig.length === 0) {
38
+ console.error('Build Failed. Please set ThemeConfig, for example: ', {
39
+ name: 'default-theme',
40
+ buildPath: [
41
+ `packages/mosaic/design-tokens/tokens/properties/**/*.json5`,
42
+ `packages/mosaic/design-tokens/tokens/components/**/*.json5`
43
+ ],
44
+ outputPath: 'packages/mosaic/design-tokens/'
45
+ }
46
+ )
47
+ process.exit(0);
48
+ }
49
+
50
+ themeConfig.map((platform) => {
51
+ // APPLY THE CONFIGURATION
52
+ // Very important: the registration of custom transforms
53
+ // needs to be done _before_ applying the configuration
54
+ const StyleDictionaryExtended = StyleDictionary.extend(getPlatformConfig(platform));
55
+
56
+ // FINALLY, BUILD ALL THE PLATFORMS
57
+ StyleDictionaryExtended.buildAllPlatforms();
58
+ });
59
+
60
+ console.log('\n==============================================');
61
+ console.log('\nBuild completed!');
62
+ }
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ css: {
3
+ transformGroup: 'mc/css',
4
+ files: [
5
+ {
6
+ destination: 'css-tokens.css',
7
+ format: 'css/variables',
8
+ filter: 'size',
9
+ prefix: 'mc'
10
+ }
11
+ ]
12
+ }
13
+ };
@@ -0,0 +1,48 @@
1
+ const merge = require('lodash/merge');
2
+
3
+ const scssConfig = require('./scss');
4
+ const jsConfig = require('./js');
5
+ const cssConfig = require('./css');
6
+
7
+ const filterObj = {
8
+ options: {
9
+ showFileHeader: true,
10
+ fileHeader: 'customHeader'
11
+ }
12
+ };
13
+
14
+ function filterOptions(platforms) {
15
+ const platformObj = {};
16
+
17
+ platforms.map(p => Object.assign(platformObj, p));
18
+
19
+ Object.keys(platformObj).forEach((p) => {
20
+ platformObj[p].files.map(f => merge(f, filterObj));
21
+ });
22
+
23
+ return platformObj;
24
+ }
25
+
26
+ function getSources(theme) {
27
+
28
+ return theme.buildPath;
29
+ }
30
+
31
+ function getConfigs(theme) {
32
+
33
+ scssConfig.scss.buildPath = theme.outputPath;
34
+ jsConfig.js.buildPath = theme.outputPath;
35
+ cssConfig.css.buildPath = theme.outputPath;
36
+
37
+ return filterOptions([scssConfig, jsConfig, cssConfig]);
38
+ }
39
+
40
+ module.exports = (theme) => {
41
+
42
+ return {
43
+ source: [
44
+ ...getSources(theme)
45
+ ],
46
+ platforms: getConfigs(theme)
47
+ };
48
+ };
@@ -0,0 +1,9 @@
1
+ module.exports = {
2
+ js: {
3
+ transformGroup: 'js',
4
+ files: [{
5
+ destination: 'tokens.ts',
6
+ format: 'javascript/es6'
7
+ }]
8
+ }
9
+ };
@@ -0,0 +1,23 @@
1
+ module.exports = {
2
+ scss: {
3
+ transformGroup: 'mc/scss',
4
+ files: [
5
+ {
6
+ destination: '_variables.scss',
7
+ format: 'scss/variables',
8
+ filter: 'color'
9
+ },
10
+ {
11
+ destination: '_palette.scss',
12
+ format: 'mc-scss/palette',
13
+ filter: 'palette'
14
+ },
15
+ {
16
+ destination: '_typography.scss',
17
+ format: 'mc-scss/typography',
18
+ mapName: 'mosaic',
19
+ filter: 'typography'
20
+ }
21
+ ]
22
+ }
23
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerFilter({
4
+ name: 'color',
5
+ matcher: (prop) => !prop.attributes.palette && !prop.attributes.typography
6
+ })
7
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerFilter({
4
+ name: 'palette',
5
+ matcher: (prop) => prop.attributes.palette
6
+ })
7
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerFilter({
4
+ name: 'size',
5
+ matcher: (prop) => prop.attributes.size
6
+ })
7
+ }
@@ -0,0 +1,7 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerFilter({
4
+ name: 'typography',
5
+ matcher: (prop) => prop.attributes.typography
6
+ })
7
+ }
@@ -0,0 +1,25 @@
1
+
2
+ module.exports = (StyleDictionary) => {
3
+ StyleDictionary.registerFormat({
4
+ name: 'mc-scss/palette',
5
+ formatter: function (dictionary) {
6
+ return dictionary.allProperties
7
+ .map((prop) => `\$${prop.name}: ${getMapFromObj(prop.value)};\n`)
8
+ .join('\n');
9
+ }
10
+ })
11
+ };
12
+
13
+ function getMapFromObj(object) {
14
+ const result = Object.keys(object)
15
+ .map((key) => {
16
+ if (key === 'contrast') {
17
+ return `${key}: ${getMapFromObj(object[key])}`
18
+ }
19
+
20
+ return `${key}: ${object[key].value},\n`
21
+ })
22
+ .join('');
23
+
24
+ return `(\n${result}\n)`
25
+ }
@@ -0,0 +1,52 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerFormat({
4
+ name: 'mc-scss/typography',
5
+ formatter: function(dictionary) {
6
+ let string;
7
+
8
+ string = dictionary.allProperties
9
+ .map((prop) => {
10
+ let output = '';
11
+
12
+ const value = prop.attributes.category === 'asset' ? `"${ prop.value }"` : prop.value;
13
+
14
+ output += `$${ prop.name }: ${ value };`
15
+
16
+ if (prop.comment) {
17
+ output += ` // ${ prop.comment }`;
18
+ }
19
+
20
+ output += '\n';
21
+
22
+ return output;
23
+ })
24
+ .join('');
25
+
26
+ string += `\n$${this.mapName || 'tokens' }: ${processJsonNode(dictionary.properties, 0)};\n`;
27
+
28
+ return string;
29
+ }
30
+ })
31
+ };
32
+
33
+
34
+ function processJsonNode(obj, depth) {
35
+ let output = '';
36
+
37
+ if (obj.hasOwnProperty('value')) {
38
+ output += `$${obj.name}`;
39
+ } else {
40
+ output += '(\n'
41
+ output += Object.keys(obj).map((newKey) => {
42
+ const newProp = obj[newKey];
43
+ const indent = ' '.repeat(depth+1);
44
+
45
+ return `${indent}'${newKey}': ${processJsonNode(newProp, depth + 1)}`;
46
+ }).join(',\n');
47
+
48
+ output += '\n' + ' '.repeat(depth) + ')';
49
+ }
50
+
51
+ return output;
52
+ }
@@ -0,0 +1,13 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerTransformGroup({
4
+ name: 'mc/css',
5
+ transforms: [
6
+ 'attribute/cti',
7
+ 'mc-attribute/size',
8
+ 'name/cti/kebab',
9
+ 'color/css',
10
+ 'mc/prefix'
11
+ ]
12
+ });
13
+ };
@@ -0,0 +1,12 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerTransformGroup({
4
+ name: 'mc/scss',
5
+ transforms: [
6
+ 'attribute/cti',
7
+ 'mc-attribute/palette',
8
+ 'mc-attribute/typography',
9
+ 'name/cti/kebab'
10
+ ]
11
+ });
12
+ }
@@ -0,0 +1,9 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerTransform({
4
+ name: 'mc-attribute/palette',
5
+ type: 'attribute',
6
+ matcher: (prop) => prop.name === 'palette',
7
+ transformer: (prop) => ({ palette: true })
8
+ });
9
+ };
@@ -0,0 +1,11 @@
1
+ module.exports = (StyleDictionary) => {
2
+ StyleDictionary.registerTransform({
3
+ name: 'mc/prefix',
4
+ type: 'attribute',
5
+ transformer: (prop, options) => {
6
+ const prefix = options.files[0].prefix ? `${options.files[0].prefix}-` : '';
7
+
8
+ prop.name = `${prefix}${prop.name}`;
9
+ }
10
+ });
11
+ };
@@ -0,0 +1,8 @@
1
+ module.exports = (StyleDictionary) => {
2
+ StyleDictionary.registerTransform({
3
+ name: 'mc-attribute/size',
4
+ type: 'attribute',
5
+ matcher: (prop) => prop.attributes.type === 'size',
6
+ transformer: (prop) => ({size: true})
7
+ });
8
+ }
@@ -0,0 +1,9 @@
1
+ module.exports = (StyleDictionary) => {
2
+
3
+ StyleDictionary.registerTransform({
4
+ name: 'mc-attribute/typography',
5
+ type: 'attribute',
6
+ matcher: (prop) => prop.attributes.category === 'typography',
7
+ transformer: (prop) => ({typography: true})
8
+ });
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptsecurity/mosaic",
3
- "version": "13.3.0",
3
+ "version": "13.3.1",
4
4
  "description": "Mosaic",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,9 +22,9 @@
22
22
  "@angular/core": "^13.1.0",
23
23
  "@angular/common": "^13.1.0",
24
24
  "@angular/forms": "^13.1.0",
25
- "@ptsecurity/cdk": "^13.3.0",
26
- "@ptsecurity/mosaic-moment-adapter": "^13.3.0",
27
- "@ptsecurity/mosaic-luxon-adapter": "^13.3.0",
25
+ "@ptsecurity/cdk": "^13.3.1",
26
+ "@ptsecurity/mosaic-moment-adapter": "^13.3.1",
27
+ "@ptsecurity/mosaic-luxon-adapter": "^13.3.1",
28
28
  "@ptsecurity/mosaic-icons": "^5.0.0"
29
29
  },
30
30
  "dependencies": {