MCPcopy
hub / github.com/tailwindlabs/tailwindcss / resolveWith

Method resolveWith

packages/tailwindcss/src/theme.ts:245–274  ·  view source on GitHub ↗
(
    candidateValue: string,
    themeKeys: ThemeKey[],
    nestedKeys: `--${string}`[] = [],
  )

Source from the content-addressed store, hash-verified

243 }
244
245 resolveWith(
246 candidateValue: string,
247 themeKeys: ThemeKey[],
248 nestedKeys: `--${string}`[] = [],
249 ): [string, Record<string, string>] | null {
250 let themeKey = this.#resolveKey(candidateValue, themeKeys)
251
252 if (!themeKey) return null
253
254 let extra = {} as Record<string, string>
255 for (let name of nestedKeys) {
256 let nestedKey = `${themeKey}${name}`
257 let nestedValue = this.values.get(nestedKey)!
258 if (!nestedValue) continue
259
260 if (nestedValue.options & ThemeOptions.INLINE) {
261 extra[name] = nestedValue.value
262 } else {
263 extra[name] = this.#var(nestedKey)!
264 }
265 }
266
267 let value = this.values.get(themeKey)!
268
269 if (value.options & ThemeOptions.INLINE) {
270 return [value.value, extra]
271 }
272
273 return [this.#var(themeKey)!, extra]
274 }
275
276 namespace(namespace: string) {
277 let values = new Map<string | null, string>()

Callers 3

createUtilitiesFunction · 0.80
resolveValueFunctionFunction · 0.80

Calls 3

#resolveKeyMethod · 0.95
#varMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected