@@ -20,7 +20,7 @@ const defaultOptions: ColorRadixPresetDefaults = {
2020} ;
2121
2222export function pandaPresetColorRadix ( options ?: ColorRadixPresetOptions ) {
23- const mergedOptions = options != undefined ? Object . assign ( { } , defaultOptions , options ) : defaultOptions ;
23+ const mergedOptions = options != null ? Object . assign ( { } , defaultOptions , options ) : defaultOptions ;
2424 const { colors, colorModeConditions, coreColorPrefix, semanticColorMap, semanticColorPrefix } = mergedOptions ;
2525
2626 // If an array of colors is passed, filter the array to valid Radix color names. If the array has no valid color names, return all Radix colors.
@@ -32,13 +32,12 @@ export function pandaPresetColorRadix(options?: ColorRadixPresetOptions) {
3232 let semanticTokens : RecursiveToken < string , any > | undefined = undefined ;
3333 if ( Object . keys ( semanticColorMap ) . length > 0 ) {
3434 // If this semantic color wasn't included in the colors array, add it.
35- Object . values ( semanticColorMap ) . forEach (
36- ( mapDetail ) =>
37- radixAllColorsArray . includes ( mapDetail . color ) &&
38- Array . isArray ( validColors ) &&
39- ! validColors . includes ( mapDetail . color ) &&
40- validColors . push ( mapDetail . color ) ,
41- ) ;
35+ for ( const mapDetail of Object . values ( semanticColorMap ) ) {
36+ radixAllColorsArray . includes ( mapDetail . color ) &&
37+ Array . isArray ( validColors ) &&
38+ ! validColors . includes ( mapDetail . color ) &&
39+ validColors . push ( mapDetail . color ) ;
40+ }
4241 semanticTokens = generateRadixSemanticTokens ( {
4342 coreColorPrefix,
4443 semanticColorPrefix,
@@ -61,7 +60,7 @@ export function pandaPresetColorRadix(options?: ColorRadixPresetOptions) {
6160 } ,
6261 } ;
6362
64- if ( semanticTokens != undefined ) {
63+ if ( semanticTokens !== undefined ) {
6564 // @ts -ignore This is undefined but we can set it.
6665 preset . theme . extend . semanticTokens = { colors : semanticTokens } ;
6766 }
@@ -135,7 +134,9 @@ function generateRadixSemanticTokens({
135134 if ( conditions === undefined || conditions . length <= 0 ) {
136135 return source ;
137136 }
138- conditions . forEach ( ( condition ) => ( newValue [ condition ] = conditionValue ) ) ;
137+ for ( const condition of conditions ) {
138+ newValue [ condition ] = conditionValue ;
139+ }
139140 return newValue ;
140141 }
141142
0 commit comments