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

Method add

packages/tailwindcss/src/theme.ts:60–86  ·  packages/tailwindcss/src/theme.ts::Theme.add
(key: string, value: string, options = ThemeOptions.NONE, src?: Declaration['src'])

Source from the content-addressed store, hash-verified

58 }
59
60 add(key: string, value: string, options = ThemeOptions.NONE, src?: Declaration[class="st">'src']): void {
61 if (key.endsWith(class="st">'-*')) {
62 if (value !== class="st">'initial') {
63 throw new Error(`Invalid theme value \`${value}\` for namespace \`${key}\``)
64 }
65 if (key === class="st">'--*') {
66 this.values.clear()
67 } else {
68 this.clearNamespace(
69 key.slice(0, -2),
70 class="cm">// `--${key}-*: initial;` should clear _all_ theme values
71 ThemeOptions.NONE,
72 )
73 }
74 }
75
76 if (options & ThemeOptions.DEFAULT) {
77 let existing = this.values.get(key)
78 if (existing && !(existing.options & ThemeOptions.DEFAULT)) return
79 }
80
81 if (value === class="st">'initial') {
82 this.values.delete(key)
83 } else {
84 this.values.set(key, { value, options, src })
85 }
86 }
87
88 keysInNamespaces(themeKeys: Iterable<ThemeKey>): string[] {
89 let keys: string[] = []

Callers 15

parseCssFunction · 0.95
loadDesignSystemFunction · 0.95
onInvalidCandidateFunction · 0.45
compileAstFunction · 0.45
buildFunction · 0.45
ast.test.tsFile · 0.45
addKeyframesMethod · 0.45
createCssUtilityFunction · 0.45
transformFunction · 0.45
optimizeAstFunction · 0.45
isVariableUsedFunction · 0.45
candidate.tsFile · 0.45

Calls 3

clearNamespaceMethod · 0.95
setMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected