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. 7 imports, 2 dependents.

File typescript OxideEngine PreProcessors 7 imports 2 dependents 58 functions

Entity Profile

Dependency Diagram

graph LR
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e["default-theme.ts"]
  669e6a28_c71f_3c5e_9c53_915cede7da78["candidate.ts"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> 669e6a28_c71f_3c5e_9c53_915cede7da78
  516809a4_c70e_60c3_bbb2_8de4c4572510["infer-data-type.ts"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> 516809a4_c70e_60c3_bbb2_8de4c4572510
  4e39f1e7_ebcb_7f62_4a59_b645e71d50fd["isPositiveInteger"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> 4e39f1e7_ebcb_7f62_4a59_b645e71d50fd
  ef204000_8998_5a6c_5455_324b37624713["segment.ts"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> ef204000_8998_5a6c_5455_324b37624713
  f712ed47_45d4_4e5a_dd73_fdefa1da71da["segment"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> f712ed47_45d4_4e5a_dd73_fdefa1da71da
  03185e2f_d4d1_f67a_f4bb_9150e033d872["colors.ts"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> 03185e2f_d4d1_f67a_f4bb_9150e033d872
  c1272aed_91bb_73df_0746_d55fa9b302fd["types.ts"]
  1b5321a5_0fcc_2351_1f22_0d4bed4c097e --> c1272aed_91bb_73df_0746_d55fa9b302fd
  834afcdc_4770_404f_cd35_c37419fcda33["create-compat-config.ts"]
  834afcdc_4770_404f_cd35_c37419fcda33 --> 1b5321a5_0fcc_2351_1f22_0d4bed4c097e
  39808083_b3b3_36c5_05f5_c039828c7b9e["plugin-api.test.ts"]
  39808083_b3b3_36c5_05f5_c039828c7b9e --> 1b5321a5_0fcc_2351_1f22_0d4bed4c097e
  style 1b5321a5_0fcc_2351_1f22_0d4bed4c097e 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 OxideEngine domain, PreProcessors 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 7 module(s): candidate.ts, colors.ts, infer-data-type.ts, isPositiveInteger, segment, segment.ts, types.ts.
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: OxideEngine, subdomain: PreProcessors, 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