@@ -19,6 +19,7 @@ export interface Config {
1919 githubToken : string ;
2020 format : StylesheetFormat ;
2121 useCombinatorialParsing : boolean ;
22+ generateSemanticColorUtilities : boolean ;
2223}
2324
2425type ConfigType = Config & {
@@ -28,6 +29,7 @@ type ConfigType = Config & {
2829 setGithubToken : Dispatch < SetStateAction < string > > ;
2930 setFormat : Dispatch < SetStateAction < StylesheetFormat > > ;
3031 setUseCombinatorialParsing : Dispatch < SetStateAction < boolean > > ;
32+ setGenerateSemanticColorUtilities : Dispatch < SetStateAction < boolean > > ;
3133} ;
3234
3335const ConfigContext = createContext < ConfigType | undefined > ( undefined ) ;
@@ -41,6 +43,7 @@ interface ConfigProps {
4143 githubToken ?: string ;
4244 format ?: StylesheetFormat ;
4345 useCombinatorialParsing ?: boolean ;
46+ generateSemanticColorUtilities ?: boolean ;
4447}
4548
4649export const ConfigProvider : FC < ConfigProps > = ( {
@@ -51,6 +54,7 @@ export const ConfigProvider: FC<ConfigProps> = ({
5154 githubToken : pGithubToken = '' ,
5255 format : pFormat = 'scss' ,
5356 useCombinatorialParsing : pUseComb = true ,
57+ generateSemanticColorUtilities : pGenSemColorUtil = false ,
5458} ) => {
5559 // Internal defaults used only when the prop is undefined at mount
5660 const [ repoPath , setRepoPath ] = useState < string > ( pRepoPath ?? '' ) ;
@@ -59,6 +63,9 @@ export const ConfigProvider: FC<ConfigProps> = ({
5963 const [ githubToken , setGithubToken ] = useState < string > ( pGithubToken ?? '' ) ;
6064 const [ format , setFormat ] = useState < StylesheetFormat > ( pFormat ?? 'scss' ) ;
6165 const [ useCombinatorialParsing , setUseCombinatorialParsing ] = useState < boolean > ( pUseComb ?? true ) ;
66+ const [ generateSemanticColorUtilities , setGenerateSemanticColorUtilities ] = useState < boolean > (
67+ pGenSemColorUtil ?? false ,
68+ ) ;
6269
6370 const value = useMemo (
6471 ( ) => ( {
@@ -74,8 +81,20 @@ export const ConfigProvider: FC<ConfigProps> = ({
7481 setFormat,
7582 useCombinatorialParsing,
7683 setUseCombinatorialParsing,
84+ generateSemanticColorUtilities,
85+ setGenerateSemanticColorUtilities,
7786 } ) ,
78- [ repoPath , filePath , branchName , githubToken , format , useCombinatorialParsing ] ,
87+ [
88+ repoPath ,
89+ filePath ,
90+ branchName ,
91+ githubToken ,
92+ format ,
93+ useCombinatorialParsing ,
94+ setUseCombinatorialParsing ,
95+ generateSemanticColorUtilities ,
96+ setGenerateSemanticColorUtilities ,
97+ ] ,
7998 ) ;
8099
81100 // TODO: debounce this
@@ -88,8 +107,17 @@ export const ConfigProvider: FC<ConfigProps> = ({
88107 githubToken,
89108 format,
90109 useCombinatorialParsing,
110+ generateSemanticColorUtilities,
91111 } ) ;
92- } , [ repoPath , filePath , branchName , githubToken , format , useCombinatorialParsing ] ) ;
112+ } , [
113+ repoPath ,
114+ filePath ,
115+ branchName ,
116+ githubToken ,
117+ format ,
118+ useCombinatorialParsing ,
119+ generateSemanticColorUtilities ,
120+ ] ) ;
93121
94122 return < ConfigContext . Provider value = { value } > { children } </ ConfigContext . Provider > ;
95123} ;
0 commit comments