4
4
*/
5
5
6
6
const prefix = 'db' ;
7
+ const fileHeader = `
8
+ @use "variables" as *;
9
+ // Do not edit directly
10
+ // Generated on
11
+ // ${ new Date ( ) . toString ( ) }
12
+ ` ;
7
13
8
14
const generateInteractiveVariants = ( currentColorObject , cssProp ) => {
9
15
return `
@@ -39,6 +45,7 @@ const generateBGVariants = (
39
45
%${ placeholderName } -ia-states {
40
46
${ generateInteractiveVariants ( currentColorObject , 'background-color' ) }
41
47
}
48
+
42
49
%${ placeholderName } {
43
50
background-color: $${ prefix } -${ currentColorObject . enabled . name } ;
44
51
color: $${ prefix } -${ baseColorObject . enabled . name } ;
@@ -60,7 +67,6 @@ const generateBGVariants = (
60
67
a {
61
68
${ generateInteractiveVariants ( baseColorObject , 'color' ) }
62
69
}
63
-
64
70
` ;
65
71
if ( baseColorObject . weak ) {
66
72
result += `
@@ -74,7 +80,8 @@ const generateBGVariants = (
74
80
` ;
75
81
}
76
82
77
- result += `}` ;
83
+ result += `}
84
+ ` ;
78
85
return result ;
79
86
} ;
80
87
@@ -86,15 +93,25 @@ const generateBGVariants = (
86
93
* @returns scss string
87
94
*/
88
95
exports . generateColorUtilitityPlaceholder = ( colorToken ) => {
89
- let output = '@use "variables" as *;\n' ;
96
+ let output = fileHeader ;
90
97
91
98
for ( const [ , value ] of Object . keys ( colorToken ) . entries ( ) ) {
92
- output += `/**
99
+ output += `
100
+ /**
93
101
* ${ value . toUpperCase ( ) } - Placeholder Utilities
94
102
**/
95
103
` ;
96
104
// Text colors with interactive variant, e.g. primary
97
105
if ( colorToken [ value ] . enabled ) {
106
+ // Only text
107
+ output += `
108
+ %${ prefix } -${ value } -text-ia {
109
+ color: $${ prefix } -${ colorToken [ value ] . enabled . name } ;
110
+ ${ generateInteractiveVariants ( colorToken [ value ] , 'color' ) }
111
+ }
112
+
113
+ ` ;
114
+
98
115
// Text and background colors
99
116
output += generateBGVariants (
100
117
value ,
0 commit comments