Home / File/ expand-declaration.test.ts — tailwindcss Source File

expand-declaration.test.ts — tailwindcss Source File

Architecture documentation for expand-declaration.test.ts, a typescript file in the tailwindcss codebase. 12 imports, 0 dependents.

File typescript Oxide Extractor 12 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  989dc85c_fd3b_d37b_10db_e189da171983["expand-declaration.test.ts"]
  b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47
  9b49f3c6_0c8d_5c62_965c_30a1db6499f8["toCss"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 9b49f3c6_0c8d_5c62_965c_30a1db6499f8
  f6c14bbb_2e42_58cc_18f1_c89a243da9c0["canonicalize-candidates.ts"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> f6c14bbb_2e42_58cc_18f1_c89a243da9c0
  50a99d73_62da_41a0_ded6_5eee04decffb["SignatureFeatures"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 50a99d73_62da_41a0_ded6_5eee04decffb
  8be42ab2_7e92_957a_da93_ffe4c7d161fe["css-parser.ts"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 8be42ab2_7e92_957a_da93_ffe4c7d161fe
  9d7d664d_b6fd_88fd_8800_4b530c33a95b["parse"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 9d7d664d_b6fd_88fd_8800_4b530c33a95b
  8e85a534_6601_c513_9452_8a311dc16b8f["expand-declaration.ts"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 8e85a534_6601_c513_9452_8a311dc16b8f
  25758157_37c7_6a41_4b05_7fc8c0e52eed["expandDeclaration"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 25758157_37c7_6a41_4b05_7fc8c0e52eed
  1b8f1c54_b1e9_e18d_0719_b7ad92808185["walk.ts"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 1b8f1c54_b1e9_e18d_0719_b7ad92808185
  4982d9ce_98d4_85d9_44af_7cc47b93c482["walk"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 4982d9ce_98d4_85d9_44af_7cc47b93c482
  47187d1b_a6f7_f734_0752_446b87b5cd9e["WalkAction"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> 47187d1b_a6f7_f734_0752_446b87b5cd9e
  f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3["vitest"]
  989dc85c_fd3b_d37b_10db_e189da171983 --> f1e05e5f_c1b2_a3f5_b2e8_3317b9243ac3
  style 989dc85c_fd3b_d37b_10db_e189da171983 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { describe, expect, test } from 'vitest'
import { toCss } from './ast'
import { SignatureFeatures } from './canonicalize-candidates'
import { parse } from './css-parser'
import { expandDeclaration } from './expand-declaration'
import { walk, WalkAction } from './walk'

const css = String.raw

function expand(input: string, options: SignatureFeatures): string {
  let ast = parse(input)

  walk(ast, (node) => {
    if (node.kind === 'declaration') {
      let result = expandDeclaration(node, options)
      if (result) return WalkAction.ReplaceSkip(result)
    }
  })

  return toCss(ast)
}

describe('expand declarations', () => {
  let options = SignatureFeatures.ExpandProperties

  test('expand to 4 properties', () => {
    let input = css`
      .one {
        inset: 10px;
      }

      .two {
        inset: 10px 20px;
      }

      .three {
        inset: 10px 20px 30px;
      }

      .four {
        inset: 10px 20px 30px 40px;
      }
    `

    expect(expand(input, options)).toMatchInlineSnapshot(`
      ".one {
        top: 10px;
        right: 10px;
        bottom: 10px;
        left: 10px;
      }
      .two {
        top: 10px;
        right: 20px;
        bottom: 10px;
        left: 20px;
      }
      .three {
        top: 10px;
        right: 20px;
// ... (106 more lines)

Domain

Subdomains

Functions

Frequently Asked Questions

What does expand-declaration.test.ts do?
expand-declaration.test.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 expand-declaration.test.ts?
expand-declaration.test.ts defines 1 function(s): expand.
What does expand-declaration.test.ts depend on?
expand-declaration.test.ts imports 12 module(s): SignatureFeatures, WalkAction, ast.ts, canonicalize-candidates.ts, css-parser.ts, expand-declaration.ts, expandDeclaration, parse, and 4 more.
Where is expand-declaration.test.ts in the architecture?
expand-declaration.test.ts is located at packages/tailwindcss/src/expand-declaration.test.ts (domain: Oxide, subdomain: Extractor, directory: packages/tailwindcss/src).

Analyze Your Own Codebase

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

Try Supermodel Free