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

Method namespace

packages/tailwindcss/src/theme.ts:276–293  ·  view source on GitHub ↗
(namespace: string)

Source from the content-addressed store, hash-verified

274 }
275
276 namespace(namespace: string) {
277 let values = new Map<string | null, string>()
278 let prefix = `${namespace}-`
279
280 for (let [key, value] of this.values) {
281 if (key === namespace) {
282 values.set(null, value.value)
283 } else if (key.startsWith(`${prefix}-`)) {
284 // Preserve `--` prefix for sub-variables
285 // e.g. `--font-size-sm--line-height`
286 values.set(key.slice(namespace.length), value.value)
287 } else if (key.startsWith(prefix)) {
288 values.set(key.slice(prefix.length), value.value)
289 }
290 }
291
292 return values
293 }
294
295 addKeyframes(value: AtRule): void {
296 this.keyframes.add(value)

Callers 5

createUtilitiesFunction · 0.80
createVariantsFunction · 0.80
readFromCssFunction · 0.80

Calls 1

setMethod · 0.80

Tested by

no test coverage detected