Home / File/ infer-data-type.ts — tailwindcss Source File

infer-data-type.ts — tailwindcss Source File

Architecture documentation for infer-data-type.ts, a typescript file in the tailwindcss codebase. 6 imports, 10 dependents.

File typescript Oxide Extractor 6 imports 10 dependents 22 functions

Entity Profile

Dependency Diagram

graph LR
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00["infer-data-type.ts"]
  ef9d3a04_d826_3821_551b_98ed6c059922["is-color.ts"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00 --> ef9d3a04_d826_3821_551b_98ed6c059922
  8826db72_bcf6_b31f_41ae_4c85f9c3b92f["isColor"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00 --> 8826db72_bcf6_b31f_41ae_4c85f9c3b92f
  27cd040f_e3a9_f8b7_3c7c_0547b201eeb0["math-operators.ts"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00 --> 27cd040f_e3a9_f8b7_3c7c_0547b201eeb0
  501a42e8_6ea6_67f1_2004_de32c1c55eb7["hasMathFn"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00 --> 501a42e8_6ea6_67f1_2004_de32c1c55eb7
  bb9924cc_8308_a1f9_0e30_76de45a64970["segment.ts"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00 --> bb9924cc_8308_a1f9_0e30_76de45a64970
  c58cbb33_f3cc_0b4f_844a_15bf66a1dc61["segment"]
  43fe4735_10e8_ed1d_6f4f_74b2008c1b00 --> c58cbb33_f3cc_0b4f_844a_15bf66a1dc61
  ffe9c87e_35ad_f431_9625_80fc875792a7["migrate-js-config.ts"]
  ffe9c87e_35ad_f431_9625_80fc875792a7 --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  c36efdeb_7fd2_0935_2c28_bf15095a9dd9["migrate-theme-to-var.ts"]
  c36efdeb_7fd2_0935_2c28_bf15095a9dd9 --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0 --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  4b9fb355_7055_4825_6db8_a5dd6f45c06e["default-theme.ts"]
  4b9fb355_7055_4825_6db8_a5dd6f45c06e --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  964be968_c10d_edf8_0061_9ac8db9f9935["legacy-utilities.ts"]
  964be968_c10d_edf8_0061_9ac8db9f9935 --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  da5d1116_ab2a_437a_6b13_c1429fd546fa["plugin-api.ts"]
  da5d1116_ab2a_437a_6b13_c1429fd546fa --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  28f23724_d31a_a8d3_3dd6_07e505ec5b7b["constant-fold-declaration.ts"]
  28f23724_d31a_a8d3_3dd6_07e505ec5b7b --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  ffde8eb7_7def_91ee_918c_be4f250f76a2["utilities.ts"]
  ffde8eb7_7def_91ee_918c_be4f250f76a2 --> 43fe4735_10e8_ed1d_6f4f_74b2008c1b00
  style 43fe4735_10e8_ed1d_6f4f_74b2008c1b00 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { isColor } from './is-color'
import { hasMathFn } from './math-operators'
import { segment } from './segment'

type DataType =
  | 'color'
  | 'length'
  | 'percentage'
  | 'ratio'
  | 'number'
  | 'integer'
  | 'url'
  | 'position'
  | 'bg-size'
  | 'line-width'
  | 'image'
  | 'family-name'
  | 'generic-name'
  | 'absolute-size'
  | 'relative-size'
  | 'angle'
  | 'vector'

const checks: Record<DataType, (value: string) => boolean> = {
  color: isColor,
  length: isLength,
  percentage: isPercentage,
  ratio: isFraction,
  number: isNumber,
  integer: isPositiveInteger,
  url: isUrl,
  position: isBackgroundPosition,
  'bg-size': isBackgroundSize,
  'line-width': isLineWidth,
  image: isImage,
  'family-name': isFamilyName,
  'generic-name': isGenericName,
  'absolute-size': isAbsoluteSize,
  'relative-size': isRelativeSize,
  angle: isAngle,
  vector: isVector,
}

/**
 * Determine the type of `value` using syntax rules from CSS specs.
 */
export function inferDataType(value: string, types: DataType[]): DataType | null {
  if (value.startsWith('var(')) return null

  for (let type of types) {
    if (checks[type]?.(value)) {
      return type
    }
  }

  return null
}

/* -------------------------------------------------------------------------- */

// ... (312 more lines)

Domain

Subdomains

Types

Frequently Asked Questions

What does infer-data-type.ts do?
infer-data-type.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, Extractor subdomain.
What functions are defined in infer-data-type.ts?
infer-data-type.ts defines 22 function(s): inferDataType, isAbsoluteSize, isAngle, isBackgroundPosition, isBackgroundSize, isFamilyName, isFraction, isGenericName, isImage, isLength, and 12 more.
What does infer-data-type.ts depend on?
infer-data-type.ts imports 6 module(s): hasMathFn, is-color.ts, isColor, math-operators.ts, segment, segment.ts.
What files import infer-data-type.ts?
infer-data-type.ts is imported by 10 file(s): canonicalize-candidates.ts, constant-fold-declaration.ts, default-theme.ts, infer-data-type.bench.ts, legacy-utilities.ts, migrate-js-config.ts, migrate-theme-to-var.ts, plugin-api.ts, and 2 more.
Where is infer-data-type.ts in the architecture?
infer-data-type.ts is located at packages/tailwindcss/src/utils/infer-data-type.ts (domain: Oxide, subdomain: Extractor, directory: packages/tailwindcss/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free