()
| 148 | const {varName, sourceValue, rule, ignoredImgSelectors, isCancelled} = options; |
| 149 | |
| 150 | const getDeclarations = () => { |
| 151 | const declarations: ModifiedVarDeclaration[] = []; |
| 152 | |
| 153 | const addModifiedValue = ( |
| 154 | typeNum: number, |
| 155 | varNameWrapper: (name: string) => string, |
| 156 | colorModifier: (c: string, t: Theme) => string, |
| 157 | ) => { |
| 158 | if (!this.isVarType(varName, typeNum)) { |
| 159 | return; |
| 160 | } |
| 161 | const property = varNameWrapper(varName); |
| 162 | let modifiedValue: string; |
| 163 | if (isVarDependant(sourceValue)) { |
| 164 | if (isConstructedColorVar(sourceValue)) { |
| 165 | let value = insertVarValues(sourceValue, this.unstableVarValues); |
| 166 | if (!value) { |
| 167 | value = typeNum === VAR_TYPE_BG_COLOR ? '#ffffff' : '#000000'; |
| 168 | } |
| 169 | modifiedValue = colorModifier(value, theme); |
| 170 | } else { |
| 171 | modifiedValue = replaceCSSVariablesNames( |
| 172 | sourceValue, |
| 173 | (v) => varNameWrapper(v), |
| 174 | (fallback) => colorModifier(fallback, theme), |
| 175 | ); |
| 176 | } |
| 177 | } else { |
| 178 | modifiedValue = colorModifier(sourceValue, theme); |
| 179 | } |
| 180 | declarations.push({ |
| 181 | property, |
| 182 | value: modifiedValue, |
| 183 | }); |
| 184 | }; |
| 185 | |
| 186 | addModifiedValue(VAR_TYPE_BG_COLOR, wrapBgColorVariableName, tryModifyBgColor); |
| 187 | addModifiedValue(VAR_TYPE_TEXT_COLOR, wrapTextColorVariableName, tryModifyTextColor); |
| 188 | addModifiedValue(VAR_TYPE_BORDER_COLOR, wrapBorderColorVariableName, tryModifyBorderColor); |
| 189 | if (this.isVarType(varName, VAR_TYPE_BG_IMG)) { |
| 190 | const property = wrapBgImgVariableName(varName); |
| 191 | let modifiedValue: string | Promise<string | null> = sourceValue; |
| 192 | if (isVarDependant(sourceValue)) { |
| 193 | modifiedValue = replaceCSSVariablesNames( |
| 194 | sourceValue, |
| 195 | (v) => wrapBgColorVariableName(v), |
| 196 | (fallback) => tryModifyBgColor(fallback, theme), |
| 197 | ); |
| 198 | } |
| 199 | const pushFilter = rule.selectorText ? |
| 200 | (type: FilterType) => this.setVarFilterType(varName, type) : |
| 201 | null; |
| 202 | const bgModifier = getBgImageModifier( |
| 203 | modifiedValue, |
| 204 | rule, |
| 205 | ignoredImgSelectors, |
| 206 | isCancelled, |
| 207 | pushFilter, |
nothing calls this directly
no test coverage detected