@patternfly/design-tokens 1.14.6 → 1.14.7

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 (87) hide show
  1. package/build/css/tokens-charts-dark.scss +2 -2
  2. package/build/css/tokens-charts.scss +2 -2
  3. package/build/css/tokens-dark.scss +52 -4
  4. package/build/css/tokens-default.scss +68 -14
  5. package/build/css/tokens-glass-dark.scss +12 -0
  6. package/build/css/tokens-glass.scss +12 -0
  7. package/build/css/tokens-highcontrast-dark.scss +2 -2
  8. package/build/css/tokens-highcontrast.scss +2 -2
  9. package/build/css/tokens-palette.scss +2 -2
  10. package/build/css/tokens-redhat-dark.scss +14 -0
  11. package/build/css/tokens-redhat-glass-dark.scss +19 -0
  12. package/build/css/tokens-redhat-glass.scss +18 -0
  13. package/build/css/tokens-redhat-highcontrast-dark.scss +47 -0
  14. package/build/css/tokens-redhat-highcontrast.scss +127 -0
  15. package/build/css/tokens-redhat.scss +15 -0
  16. package/build.js +201 -13
  17. package/config.dark.json +1 -1
  18. package/config.default.json +1 -1
  19. package/config.glass.dark.json +23 -0
  20. package/config.glass.json +24 -0
  21. package/config.layers.glass-dark.json +19 -0
  22. package/config.layers.glass.json +19 -0
  23. package/config.layers.highcontrast-dark.json +19 -0
  24. package/config.layers.highcontrast.json +19 -0
  25. package/config.layers.redhat-dark.json +22 -0
  26. package/config.layers.redhat-glass-dark.json +22 -0
  27. package/config.layers.redhat-glass.json +22 -0
  28. package/config.layers.redhat-highcontrast-dark.json +22 -0
  29. package/config.layers.redhat-highcontrast.json +22 -0
  30. package/config.layers.redhat.json +22 -0
  31. package/config.redhat-dark.json +25 -0
  32. package/config.redhat-glass-dark.json +25 -0
  33. package/config.redhat-glass.json +26 -0
  34. package/config.redhat-highcontrast-dark.json +25 -0
  35. package/config.redhat-highcontrast.json +26 -0
  36. package/config.redhat.json +26 -0
  37. package/package.json +2 -2
  38. package/patternfly-docs/content/all-patternfly-tokens.md +24 -1
  39. package/patternfly-docs/content/token-layers-glass-dark.json +38562 -0
  40. package/patternfly-docs/content/token-layers-glass.json +41600 -0
  41. package/patternfly-docs/content/token-layers-highcontrast-dark.json +38385 -0
  42. package/patternfly-docs/content/token-layers-highcontrast.json +53091 -0
  43. package/patternfly-docs/content/token-layers-redhat-dark.json +48501 -0
  44. package/patternfly-docs/content/token-layers-redhat-glass-dark.json +38233 -0
  45. package/patternfly-docs/content/token-layers-redhat-glass.json +41282 -0
  46. package/patternfly-docs/content/token-layers-redhat-highcontrast-dark.json +38223 -0
  47. package/patternfly-docs/content/token-layers-redhat-highcontrast.json +52773 -0
  48. package/patternfly-docs/content/token-layers-redhat.json +65159 -0
  49. package/plugins/export-patternfly-tokens/dist/code.js +26 -10
  50. package/plugins/export-patternfly-tokens/dist/ui.html +65 -21
  51. package/plugins/export-patternfly-tokens/src/code.ts +29 -10
  52. package/plugins/export-patternfly-tokens/src/ui.tsx +65 -20
  53. package/tokens/{dark → default/dark}/base.dark.json +83 -43
  54. package/tokens/{highcontrast-dark → default/dark}/palette.color.json +8 -0
  55. package/tokens/{dark → default/dark}/semantic.dark.json +235 -12
  56. package/tokens/default/{base.dimension.json → glass/base.dimension.json} +12 -12
  57. package/tokens/{highcontrast → default/glass}/base.json +45 -5
  58. package/tokens/{dark → default/glass}/palette.color.json +8 -0
  59. package/tokens/default/glass/semantic.glass.json +1996 -0
  60. package/tokens/{highcontrast-dark → default/glass-dark}/base.dark.json +83 -43
  61. package/tokens/{highcontrast → default/glass-dark}/palette.color.json +8 -0
  62. package/tokens/default/glass-dark/semantic.glass.dark.json +1996 -0
  63. package/tokens/{highcontrast → default/highcontrast}/base.dimension.json +12 -12
  64. package/tokens/default/{base.json → highcontrast/base.json} +45 -5
  65. package/tokens/default/highcontrast/palette.color.json +335 -0
  66. package/tokens/{highcontrast → default/highcontrast}/semantic.dimension.highcontrast.json +92 -56
  67. package/tokens/{highcontrast → default/highcontrast}/semantic.highcontrast.json +246 -23
  68. package/tokens/default/highcontrast-dark/base.dark.json +473 -0
  69. package/tokens/default/{palette.color.json → highcontrast-dark/palette.color.json} +8 -0
  70. package/tokens/{highcontrast-dark → default/highcontrast-dark}/semantic.highcontrast.dark.json +234 -11
  71. package/tokens/default/light/base.dimension.json +387 -0
  72. package/tokens/default/light/base.json +611 -0
  73. package/tokens/default/light/palette.color.json +335 -0
  74. package/tokens/default/{semantic.dimension.json → light/semantic.dimension.json} +95 -59
  75. package/tokens/default/{semantic.json → light/semantic.json} +235 -12
  76. package/tokens/default/{semantic.motion.json → light/semantic.motion.json} +18 -18
  77. package/tokens/redhat/dark/redhat.color.dark.json +62 -0
  78. package/tokens/redhat/glass/redhat.color.glass.json +49 -0
  79. package/tokens/redhat/glass-dark/redhat.color.glass.dark.json +62 -0
  80. package/tokens/redhat/highcontrast/redhat.color.highcontrast.json +49 -0
  81. package/tokens/redhat/highcontrast/redhat.dimension.highcontrast.json +23 -0
  82. package/tokens/redhat/highcontrast-dark/redhat.color.highcontrast.dark.json +49 -0
  83. package/tokens/redhat/light/redhat.color.json +49 -0
  84. package/tokens/redhat/light/redhat.dimension.json +23 -0
  85. /package/tokens/{dark → default/dark}/charts.dark.json +0 -0
  86. /package/tokens/default/{base.motion.json → light/base.motion.json} +0 -0
  87. /package/tokens/default/{charts.json → light/charts.json} +0 -0
@@ -1,5 +1,3 @@
1
- console.clear();
2
-
3
1
  interface FileData {
4
2
  fileName: string;
5
3
  body: {
@@ -17,7 +15,6 @@ type VariableValueExtended = VariableValue & {
17
15
  /* MAIN function */
18
16
 
19
17
  figma.ui.onmessage = (e) => {
20
- console.log('code received message', e);
21
18
  if (e.type === 'EXPORT') {
22
19
  exportToJSON();
23
20
  }
@@ -45,23 +42,45 @@ function exportToJSON() {
45
42
 
46
43
  /* EXPORT - helper functions */
47
44
 
48
- function processCollection({ name, modes, variableIds }) {
45
+ function processCollection(collection) {
46
+ const { name, modes, variableIds } = collection;
49
47
  const files = [];
48
+
49
+ // Check if this is an extended collection
50
+ const isExtended = (collection as any).parentVariableCollectionId !== undefined;
51
+ const variableOverrides = (collection as any).variableOverrides || {};
52
+
50
53
  modes.forEach((mode) => {
51
54
  let file: FileData = { fileName: `${name}.${mode.name}.tokens.json`, body: {} };
52
55
 
53
- variableIds.forEach((variableId) => {
54
- const { name, resolvedType, valuesByMode, description } = figma.variables.getVariableById(variableId);
56
+ // For extended collections, only process overridden variables
57
+ const varsToProcess = isExtended ? Object.keys(variableOverrides) : variableIds;
58
+
59
+ varsToProcess.forEach((variableId) => {
60
+ const variable = figma.variables.getVariableById(variableId);
61
+ if (!variable) {
62
+ return;
63
+ }
64
+
65
+ const { name: varName, resolvedType, valuesByMode, description } = variable;
55
66
 
56
- if (name.includes('figma-only')) {
67
+ const varExcludePattern = /figma-only/i;
68
+ if (varExcludePattern.test(varName)) {
57
69
  return; // Skip this variable
58
70
  }
59
71
 
60
- const value: VariableValueExtended = valuesByMode[mode.modeId];
72
+ // For extended collections, get the overridden value
73
+ let value: VariableValueExtended;
74
+ if (isExtended) {
75
+ const overrides = variableOverrides[variableId];
76
+ value = overrides ? overrides[mode.modeId] : undefined;
77
+ } else {
78
+ value = valuesByMode[mode.modeId];
79
+ }
61
80
 
62
81
  if (value !== undefined && ['COLOR', 'FLOAT', 'STRING'].includes(resolvedType)) {
63
82
  let obj = file.body;
64
- name.split('/').forEach((groupName) => {
83
+ varName.split('/').forEach((groupName) => {
65
84
  obj[groupName] = obj[groupName] || {};
66
85
  obj = obj[groupName];
67
86
  });
@@ -73,7 +92,6 @@ function processCollection({ name, modes, variableIds }) {
73
92
  if (value.type === 'VARIABLE_ALIAS') {
74
93
  obj.$type = resolvedType === 'COLOR' ? 'color' : 'number';
75
94
  obj.$value = `{${figma.variables.getVariableById(value.id).name.replace(/\//g, '.')}}`;
76
- console.log(value);
77
95
  } else if (resolvedType === 'COLOR') {
78
96
  obj.$type = 'color';
79
97
  obj.$value = rgbToHex(value);
@@ -86,6 +104,7 @@ function processCollection({ name, modes, variableIds }) {
86
104
  }
87
105
  }
88
106
  });
107
+
89
108
  files.push(file);
90
109
  });
91
110
  return files;
@@ -25,82 +25,127 @@ const saveVars = (text, setJsonFiles, setZipFile) => {
25
25
  // Color palette
26
26
  case '/* Color Palette.Mode 1.tokens.json */':
27
27
  saveFileName = 'palette.color.json';
28
- saveFolderNames = ['default', 'dark', 'highcontrast', 'highcontrast-dark'];
28
+ saveFolderNames = ['default/light', 'default/dark', 'default/highcontrast', 'default/highcontrast-dark', 'default/glass', 'default/glass-dark'];
29
29
  break;
30
30
 
31
31
  // Base tokens
32
32
  // Base color
33
33
  case '/* Base Color Tokens - Light.Value.tokens.json */':
34
34
  saveFileName = 'base.json';
35
- saveFolderNames = ['default', 'highcontrast'];
35
+ saveFolderNames = ['default/light', 'default/highcontrast', 'default/glass'];
36
36
  break;
37
37
  // Base color - dark
38
38
  case '/* Base Color Tokens - Dark.Mode 1.tokens.json */':
39
39
  saveFileName = 'base.dark.json';
40
- saveFolderNames = ['dark', 'highcontrast-dark'];
40
+ saveFolderNames = ['default/dark', 'default/highcontrast-dark', 'default/glass-dark'];
41
41
  break;
42
42
  // Base dimension
43
43
  case '/* Base Dimension Tokens.Mode 1.tokens.json */':
44
44
  saveFileName = 'base.dimension.json';
45
- saveFolderNames = ['default', 'highcontrast'];
45
+ saveFolderNames = ['default/light', 'default/highcontrast', 'default/glass']; //why not dark?
46
46
  break;
47
47
  // Base motion
48
48
  case '/* Base Motion Tokens.Mode 1.tokens.json */':
49
49
  saveFileName = 'base.motion.json';
50
- saveFolderNames = ['default'];
50
+ saveFolderNames = ['default/light'];
51
51
  break;
52
52
 
53
53
  // Semantic tokens
54
54
  // Semantic color
55
- case '/* Semantic Color Tokens.Light.tokens.json */':
55
+ case '/* Default Semantic Color Tokens.Light.tokens.json */':
56
56
  saveFileName = 'semantic.json';
57
- saveFolderNames = ['default'];
57
+ saveFolderNames = ['default/light'];
58
58
  break;
59
59
  // Semantic color - dark
60
- case '/* Semantic Color Tokens.Dark.tokens.json */':
60
+ case '/* Default Semantic Color Tokens.Dark.tokens.json */':
61
61
  saveFileName = 'semantic.dark.json';
62
- saveFolderNames = ['dark'];
62
+ saveFolderNames = ['default/dark'];
63
+ break;
64
+ // Semantic color - glass
65
+ case '/* Default Semantic Color Tokens.Light - Glass.tokens.json */':
66
+ saveFileName = 'semantic.glass.json';
67
+ saveFolderNames = ['default/glass'];
68
+ break;
69
+ // Semantic color - dark glass
70
+ case '/* Default Semantic Color Tokens.Dark - Glass.tokens.json */':
71
+ saveFileName = 'semantic.glass.dark.json';
72
+ saveFolderNames = ['default/glass-dark'];
63
73
  break;
64
74
  // Semantic color - high contrast
65
- case '/* Semantic Color Tokens.Light - High Contrast.tokens.json */':
75
+ case '/* Default Semantic Color Tokens.Light - High Contrast (Beta).tokens.json */':
66
76
  saveFileName = 'semantic.highcontrast.json';
67
- saveFolderNames = ['highcontrast'];
77
+ saveFolderNames = ['default/highcontrast'];
68
78
  break;
69
79
  // Semantic color - high contrast - dark
70
- case '/* Semantic Color Tokens.Dark - High Contrast.tokens.json */':
80
+ case '/* Default Semantic Color Tokens.Dark - High Contrast (Beta).tokens.json */':
71
81
  saveFileName = 'semantic.highcontrast.dark.json';
72
- saveFolderNames = ['highcontrast-dark'];
82
+ saveFolderNames = ['default/highcontrast-dark'];
73
83
  break;
74
84
  // Semantic dimension
75
85
  case ('/* Semantic Dimension Tokens.Default.tokens.json */'):
76
86
  saveFileName = 'semantic.dimension.json';
77
- saveFolderNames = ['default'];
87
+ saveFolderNames = ['default/light'];
78
88
  break;
79
89
  // Semantic dimension - high contrast
80
- case '/* Semantic Dimension Tokens.High Contrast.tokens.json */':
90
+ case '/* Semantic Dimension Tokens.High Contrast - Beta.tokens.json */':
81
91
  saveFileName = 'semantic.dimension.highcontrast.json';
82
- saveFolderNames = ['highcontrast'];
92
+ saveFolderNames = ['default/highcontrast'];
83
93
  break;
84
94
  // Semantic motion
85
95
  case '/* Semantic Motion Tokens.Mode 1.tokens.json */':
86
96
  saveFileName = 'semantic.motion.json';
87
- saveFolderNames = ['default'];
97
+ saveFolderNames = ['default/light'];
88
98
  break;
89
99
 
90
100
  // Charts tokens
91
101
  // Charts
92
102
  case '/* Charts.Light.tokens.json */':
93
103
  saveFileName = 'charts.json';
94
- saveFolderNames = ['default'];
104
+ saveFolderNames = ['default/light'];
95
105
  break;
96
106
  // Charts - dark
97
107
  case '/* Charts.Dark.tokens.json */':
98
108
  saveFileName = 'charts.dark.json';
99
- saveFolderNames = ['dark'];
109
+ saveFolderNames = ['default/dark'];
110
+ break;
111
+
112
+ // Red Hat color tokens
113
+ case '/* Red Hat Color Tokens.Light.tokens.json */':
114
+ saveFileName = 'redhat.color.json';
115
+ saveFolderNames = ['redhat/light'];
116
+ break;
117
+ case '/* Red Hat Color Tokens.Dark.tokens.json */':
118
+ saveFileName = 'redhat.color.dark.json';
119
+ saveFolderNames = ['redhat/dark'];
120
+ break;
121
+ case '/* Red Hat Color Tokens.Light - Glass.tokens.json */':
122
+ saveFileName = 'redhat.color.glass.json';
123
+ saveFolderNames = ['redhat/glass'];
124
+ break;
125
+ case '/* Red Hat Color Tokens.Dark - Glass.tokens.json */':
126
+ saveFileName = 'redhat.color.glass.dark.json';
127
+ saveFolderNames = ['redhat/glass-dark'];
128
+ break;
129
+ case '/* Red Hat Color Tokens.Light - High Contrast (Beta).tokens.json */':
130
+ saveFileName = 'redhat.color.highcontrast.json';
131
+ saveFolderNames = ['redhat/highcontrast'];
132
+ break;
133
+ case '/* Red Hat Color Tokens.Dark - High Contrast (Beta).tokens.json */':
134
+ saveFileName = 'redhat.color.highcontrast.dark.json';
135
+ saveFolderNames = ['redhat/highcontrast-dark'];
136
+ break;
137
+ // Red Hat dimension tokens
138
+ case '/* Red Hat Dimension Tokens.Default.tokens.json */':
139
+ saveFileName = 'redhat.dimension.json';
140
+ saveFolderNames = ['redhat/light'];
141
+ break;
142
+ case '/* Red Hat Dimension Tokens.High Contrast - Beta.tokens.json */':
143
+ saveFileName = 'redhat.dimension.highcontrast.json';
144
+ saveFolderNames = ['redhat/highcontrast'];
100
145
  break;
101
146
  default:
102
147
  saveFileName = splitFiles[i].split('\n', 1)[0];
103
- saveFolderNames = ['default'];
148
+ saveFolderNames = ['default/light'];
104
149
  }
105
150
 
106
151
  const fileToExport = splitFiles[i].substring(splitFiles[i].indexOf('\n') + 1);
@@ -32,6 +32,10 @@
32
32
  "type": "color",
33
33
  "value": "rgba(199, 199, 199, 0.1500)"
34
34
  },
35
+ "700": {
36
+ "type": "color",
37
+ "value": "rgba(199, 199, 199, 0.2500)"
38
+ },
35
39
  "highlight": {
36
40
  "100": {
37
41
  "type": "color",
@@ -57,6 +61,42 @@
57
61
  "300": {
58
62
  "type": "color",
59
63
  "value": "{color.blue.10}"
64
+ },
65
+ "accent": {
66
+ "100": {
67
+ "type": "color",
68
+ "value": "{color.red.50}"
69
+ },
70
+ "200": {
71
+ "type": "color",
72
+ "value": "{color.red.40}"
73
+ },
74
+ "300": {
75
+ "type": "color",
76
+ "value": "{color.red.30}"
77
+ },
78
+ "350": {
79
+ "type": "color",
80
+ "value": "{color.red.20}"
81
+ },
82
+ "400": {
83
+ "type": "color",
84
+ "value": "{color.white}"
85
+ }
86
+ },
87
+ "subtle": {
88
+ "100": {
89
+ "type": "color",
90
+ "value": "{color.blue.70}"
91
+ },
92
+ "200": {
93
+ "type": "color",
94
+ "value": "{color.blue.60}"
95
+ },
96
+ "300": {
97
+ "type": "color",
98
+ "value": "{color.blue.30}"
99
+ }
60
100
  }
61
101
  },
62
102
  "disabled": {
@@ -87,48 +127,6 @@
87
127
  "value": "{color.yellow.20}"
88
128
  }
89
129
  },
90
- "severity": {
91
- "undefined": {
92
- "100": {
93
- "type": "color",
94
- "value": "{color.gray.40}"
95
- }
96
- },
97
- "none": {
98
- "100": {
99
- "type": "color",
100
- "value": "{color.blue.30}"
101
- }
102
- },
103
- "minor": {
104
- "100": {
105
- "type": "color",
106
- "value": "{color.gray.30}"
107
- }
108
- },
109
- "moderate": {
110
- "100": {
111
- "type": "color",
112
- "value": "{color.yellow.30}"
113
- }
114
- },
115
- "important": {
116
- "100": {
117
- "type": "color",
118
- "value": "{color.orange.40}"
119
- }
120
- },
121
- "critical": {
122
- "100": {
123
- "type": "color",
124
- "value": "{color.red-orange.50}"
125
- },
126
- "200": {
127
- "type": "color",
128
- "value": "{color.red-orange.40}"
129
- }
130
- }
131
- },
132
130
  "status": {
133
131
  "success": {
134
132
  "100": {
@@ -201,6 +199,48 @@
201
199
  }
202
200
  }
203
201
  },
202
+ "severity": {
203
+ "undefined": {
204
+ "100": {
205
+ "type": "color",
206
+ "value": "{color.gray.40}"
207
+ }
208
+ },
209
+ "none": {
210
+ "100": {
211
+ "type": "color",
212
+ "value": "{color.blue.30}"
213
+ }
214
+ },
215
+ "minor": {
216
+ "100": {
217
+ "type": "color",
218
+ "value": "{color.gray.30}"
219
+ }
220
+ },
221
+ "moderate": {
222
+ "100": {
223
+ "type": "color",
224
+ "value": "{color.yellow.30}"
225
+ }
226
+ },
227
+ "important": {
228
+ "100": {
229
+ "type": "color",
230
+ "value": "{color.orange.40}"
231
+ }
232
+ },
233
+ "critical": {
234
+ "100": {
235
+ "type": "color",
236
+ "value": "{color.red-orange.50}"
237
+ },
238
+ "200": {
239
+ "type": "color",
240
+ "value": "{color.red-orange.40}"
241
+ }
242
+ }
243
+ },
204
244
  "nonstatus": {
205
245
  "red": {
206
246
  "100": {
@@ -338,7 +378,7 @@
338
378
  "color": {
339
379
  "50": {
340
380
  "type": "color",
341
- "value": "{color.gray.60}"
381
+ "value": "{color.gray.70}"
342
382
  },
343
383
  "100": {
344
384
  "type": "color",
@@ -22,6 +22,10 @@
22
22
  "type": "color",
23
23
  "value": "#a3a3a3"
24
24
  },
25
+ "45": {
26
+ "type": "color",
27
+ "value": "#8c8c8c"
28
+ },
25
29
  "50": {
26
30
  "type": "color",
27
31
  "value": "#707070"
@@ -321,6 +325,10 @@
321
325
  "80": {
322
326
  "type": "color",
323
327
  "value": "#3f0000"
328
+ },
329
+ "05": {
330
+ "type": "color",
331
+ "value": "#fef0f0"
324
332
  }
325
333
  }
326
334
  }