Home / File/ default-theme.ts — tailwindcss Source File

default-theme.ts — tailwindcss Source File

Architecture documentation for default-theme.ts, a typescript file in the tailwindcss codebase. 9 imports, 2 dependents.

File typescript Oxide Scanner 9 imports 2 dependents 58 functions

Entity Profile

Dependency Diagram

graph LR
  4b9fb355_7055_4825_6db8_a5dd6f45c06e["default-theme.ts"]
  ba6fca27_7720_5839_0f92_bc2abb8db636["candidate.ts"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> ba6fca27_7720_5839_0f92_bc2abb8db636
  ce5e54a2_4ad2_a325_9d49_571e0bcde65d["NamedUtilityValue"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> ce5e54a2_4ad2_a325_9d49_571e0bcde65d
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00["infer-data-type.ts"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  2b202e81_c79a_bf7e_74f9_fe9a98bbea87["isPositiveInteger"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> 2b202e81_c79a_bf7e_74f9_fe9a98bbea87
  bb9924cc_8308_a1f9_0e30_76de45a64970["segment.ts"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> bb9924cc_8308_a1f9_0e30_76de45a64970
  c58cbb33_f3cc_0b4f_844a_15bf66a1dc61["segment"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> c58cbb33_f3cc_0b4f_844a_15bf66a1dc61
  0987a5b8_9d8e_e30a_f4a5_c6f777d85ea1["colors.ts"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> 0987a5b8_9d8e_e30a_f4a5_c6f777d85ea1
  479eaf18_f640_94ff_bd07_456688f9ac14["types.ts"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> 479eaf18_f640_94ff_bd07_456688f9ac14
  f049ff67_bd94_009a_5905_62bd3c9f309b["UserConfig"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> f049ff67_bd94_009a_5905_62bd3c9f309b
  a0ec45fb_d162_d87d_7041_fadd217a3619["create-compat-config.ts"]
  a0ec45fb_d162_d87d_7041_fadd217a3619 --> 4b9fb355_7055_4825_6db8_a5dd6f45c06e
  6887ddc2_d1b1_dd38_0f59_c2a51c756bc5["plugin-api.test.ts"]
  6887ddc2_d1b1_dd38_0f59_c2a51c756bc5 --> 4b9fb355_7055_4825_6db8_a5dd6f45c06e
  style 4b9fb355_7055_4825_6db8_a5dd6f45c06e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { NamedUtilityValue } from '../candidate'
import { isPositiveInteger } from '../utils/infer-data-type'
import { segment } from '../utils/segment'
import colors from './colors'
import type { UserConfig } from './config/types'

function bareValues(fn: (value: NamedUtilityValue) => string | undefined) {
  return {
    // Ideally this would be a Symbol but some of the ecosystem assumes object with
    // string / number keys for example by using `Object.entries()` which means that
    // the function that handles the bare value would be lost
    __BARE_VALUE__: fn,
  }
}

let bareIntegers = bareValues((value) => {
  if (isPositiveInteger(value.value)) {
    return value.value
  }
})

let barePercentages = bareValues((value: NamedUtilityValue) => {
  if (isPositiveInteger(value.value)) {
    return `${value.value}%`
  }
})

let barePixels = bareValues((value: NamedUtilityValue) => {
  if (isPositiveInteger(value.value)) {
    return `${value.value}px`
  }
})

let bareMilliseconds = bareValues((value: NamedUtilityValue) => {
  if (isPositiveInteger(value.value)) {
    return `${value.value}ms`
  }
})

let bareDegrees = bareValues((value: NamedUtilityValue) => {
  if (isPositiveInteger(value.value)) {
    return `${value.value}deg`
  }
})

let bareAspectRatio = bareValues((value) => {
  if (value.fraction === null) return
  let [lhs, rhs] = segment(value.fraction, '/')
  if (!isPositiveInteger(lhs) || !isPositiveInteger(rhs)) return
  return value.fraction
})

let bareRepeatValues = bareValues((value) => {
  if (isPositiveInteger(Number(value.value))) {
    return `repeat(${value.value}, minmax(0, 1fr))`
  }
})

export default {
  accentColor: ({ theme }) => theme('colors'),
// ... (1076 more lines)

Domain

Subdomains

Frequently Asked Questions

What does default-theme.ts do?
default-theme.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Scanner subdomain.
What functions are defined in default-theme.ts?
default-theme.ts defines 58 function(s): bareAspectRatio, bareDegrees, bareIntegers, bareMilliseconds, barePercentages, barePixels, bareRepeatValues, bareValues, default.accentColor, default.backdropBlur, and 48 more.
What does default-theme.ts depend on?
default-theme.ts imports 9 module(s): NamedUtilityValue, UserConfig, candidate.ts, colors.ts, infer-data-type.ts, isPositiveInteger, segment, segment.ts, and 1 more.
What files import default-theme.ts?
default-theme.ts is imported by 2 file(s): create-compat-config.ts, plugin-api.test.ts.
Where is default-theme.ts in the architecture?
default-theme.ts is located at packages/tailwindcss/src/compat/default-theme.ts (domain: Oxide, subdomain: Scanner, directory: packages/tailwindcss/src/compat).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free