MCPcopy
hub / github.com/tailwindlabs/tailwindcss / #resolveKey

Method #resolveKey

packages/tailwindcss/src/theme.ts:168–191  ·  view source on GitHub ↗
(candidateValue: string | null, themeKeys: ThemeKey[])

Source from the content-addressed store, hash-verified

166 }
167
168 #resolveKey(candidateValue: string | null, themeKeys: ThemeKey[]): string | null {
169 for (let namespace of themeKeys) {
170 let themeKey =
171 candidateValue !== null ? (`${namespace}-${candidateValue}` as ThemeKey) : namespace
172
173 if (!this.values.has(themeKey)) {
174 // If the exact theme key is not found, we might be trying to resolve a key containing a dot
175 // that was registered with an underscore instead:
176 if (candidateValue !== null && candidateValue.includes('.')) {
177 themeKey = `${namespace}-${candidateValue.replaceAll('.', '_')}` as ThemeKey
178
179 if (!this.values.has(themeKey)) continue
180 } else {
181 continue
182 }
183 }
184
185 if (isIgnoredThemeKey(themeKey, namespace)) continue
186
187 return themeKey
188 }
189
190 return null
191 }
192
193 #var(themeKey: string) {
194 let value = this.values.get(themeKey)

Callers 3

resolveMethod · 0.95
resolveValueMethod · 0.95
resolveWithMethod · 0.95

Calls 2

isIgnoredThemeKeyFunction · 0.85
hasMethod · 0.45

Tested by

no test coverage detected