container.ts — tailwindcss Source File
Architecture documentation for container.ts, a typescript file in the tailwindcss codebase. 10 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 7a8b38fe_f674_f253_e4c8_9043c8b072e0["container.ts"] b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47 2f6881be_62d9_4b96_7331_a962ced095f7["atRule"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> 2f6881be_62d9_4b96_7331_a962ced095f7 dbd80fa4_4b36_fb8e_fb6e_f2aec789aa6b["cloneAstNode"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> dbd80fa4_4b36_fb8e_fb6e_f2aec789aa6b 1369a6dc_e395_347d_5d24_b88e22c5446d["decl"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> 1369a6dc_e395_347d_5d24_b88e22c5446d bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62["DesignSystem"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62 c05975bc_af4f_b1a7_fc10_2de6cfa57ccd["compare-breakpoints.ts"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> c05975bc_af4f_b1a7_fc10_2de6cfa57ccd 57d66c17_eb5b_fe95_af7d_9e6608d52384["compareBreakpoints"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> 57d66c17_eb5b_fe95_af7d_9e6608d52384 479eaf18_f640_94ff_bd07_456688f9ac14["types.ts"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> 479eaf18_f640_94ff_bd07_456688f9ac14 da7f1255_7a1d_1af3_bf27_bd71a9a7671e["ResolvedConfig"] 7a8b38fe_f674_f253_e4c8_9043c8b072e0 --> da7f1255_7a1d_1af3_bf27_bd71a9a7671e ffe9c87e_35ad_f431_9625_80fc875792a7["migrate-js-config.ts"] ffe9c87e_35ad_f431_9625_80fc875792a7 --> 7a8b38fe_f674_f253_e4c8_9043c8b072e0 2745c5e0_8ea4_a1c7_4f84_369746e3eb63["apply-compat-hooks.ts"] 2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 7a8b38fe_f674_f253_e4c8_9043c8b072e0 style 7a8b38fe_f674_f253_e4c8_9043c8b072e0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { atRule, cloneAstNode, decl, type AstNode, type AtRule } from '../ast'
import type { DesignSystem } from '../design-system'
import { compareBreakpoints } from '../utils/compare-breakpoints'
import type { ResolvedConfig } from './config/types'
export function registerContainerCompat(userConfig: ResolvedConfig, designSystem: DesignSystem) {
let container = userConfig.theme.container || {}
if (typeof container !== 'object' || container === null) {
return
}
let rules = buildCustomContainerUtilityRules(container, designSystem)
if (rules.length === 0) {
return
}
designSystem.utilities.static('container', () => rules.map(cloneAstNode))
}
export function buildCustomContainerUtilityRules(
{
center,
padding,
screens,
}: {
center?: boolean
padding?: string | {}
screens?: {}
},
designSystem: DesignSystem,
): AstNode[] {
let rules = []
let breakpointOverwrites: null | Map<string, AtRule> = null
if (center) {
rules.push(decl('margin-inline', 'auto'))
}
if (
typeof padding === 'string' ||
(typeof padding === 'object' && padding !== null && 'DEFAULT' in padding)
) {
rules.push(
decl('padding-inline', typeof padding === 'string' ? padding : (padding.DEFAULT as string)),
)
}
if (typeof screens === 'object' && screens !== null) {
breakpointOverwrites = new Map()
// When setting the `screens` in v3, you were overwriting the default
// screens config. To do this in v4, you have to manually unset all core
// screens.
let breakpoints = Array.from(designSystem.theme.namespace('--breakpoint').entries())
breakpoints.sort((a, z) => compareBreakpoints(a[1], z[1], 'asc'))
if (breakpoints.length > 0) {
let [key] = breakpoints[0]
// ... (61 more lines)
Domain
Subdomains
Dependencies
Imported By
Source
Frequently Asked Questions
What does container.ts do?
container.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 container.ts?
container.ts defines 2 function(s): buildCustomContainerUtilityRules, registerContainerCompat.
What does container.ts depend on?
container.ts imports 10 module(s): DesignSystem, ResolvedConfig, ast.ts, atRule, cloneAstNode, compare-breakpoints.ts, compareBreakpoints, decl, and 2 more.
What files import container.ts?
container.ts is imported by 2 file(s): apply-compat-hooks.ts, migrate-js-config.ts.
Where is container.ts in the architecture?
container.ts is located at packages/tailwindcss/src/compat/container.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