screens-config.ts — tailwindcss Source File
Architecture documentation for screens-config.ts, a typescript file in the tailwindcss codebase. 6 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 4911d260_2582_cf22_b77d_7882022f79a4["screens-config.ts"] b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"] 4911d260_2582_cf22_b77d_7882022f79a4 --> b9cbffa4_c352_cf3c_268f_cbb174fb3a47 2f6881be_62d9_4b96_7331_a962ced095f7["atRule"] 4911d260_2582_cf22_b77d_7882022f79a4 --> 2f6881be_62d9_4b96_7331_a962ced095f7 bdedd2f6_da4b_69dc_e990_0814b59fbe6e["design-system.ts"] 4911d260_2582_cf22_b77d_7882022f79a4 --> bdedd2f6_da4b_69dc_e990_0814b59fbe6e 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62["DesignSystem"] 4911d260_2582_cf22_b77d_7882022f79a4 --> 665aa4ed_d86e_30e5_80d5_cd56b8ca8b62 479eaf18_f640_94ff_bd07_456688f9ac14["types.ts"] 4911d260_2582_cf22_b77d_7882022f79a4 --> 479eaf18_f640_94ff_bd07_456688f9ac14 da7f1255_7a1d_1af3_bf27_bd71a9a7671e["ResolvedConfig"] 4911d260_2582_cf22_b77d_7882022f79a4 --> da7f1255_7a1d_1af3_bf27_bd71a9a7671e 7095171e_98e6_6fd0_2293_1fc8bac82300["migrate-media-screen.ts"] 7095171e_98e6_6fd0_2293_1fc8bac82300 --> 4911d260_2582_cf22_b77d_7882022f79a4 2745c5e0_8ea4_a1c7_4f84_369746e3eb63["apply-compat-hooks.ts"] 2745c5e0_8ea4_a1c7_4f84_369746e3eb63 --> 4911d260_2582_cf22_b77d_7882022f79a4 style 4911d260_2582_cf22_b77d_7882022f79a4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { atRule } from '../ast'
import type { DesignSystem } from '../design-system'
import type { ResolvedConfig } from './config/types'
export function registerScreensConfig(userConfig: ResolvedConfig, designSystem: DesignSystem) {
let screens = userConfig.theme.screens || {}
// We want to insert the breakpoints in the right order as best we can. In the
// core utility, all static breakpoint variants and the `min-*` functional
// variant are registered inside a group. Since all the variants within a
// group share the same order, we can use the always-defined `min-*` variant
// as the order.
let coreOrder = designSystem.variants.get('min')?.order ?? 0
let additionalVariants: ((order: number) => void)[] = []
// Register static breakpoint variants for everything that comes from the user
// theme config.
for (let [name, value] of Object.entries(screens)) {
let coreVariant = designSystem.variants.get(name)
// Ignore it if there's a CSS value that takes precedence over the JS config
// and the static utilities are already registered.
//
// This happens when a `@theme { }` block is used that overwrites all JS
// config options. We rely on the resolution order of the Theme for
// resolving this. If Theme has a different value, we know that this is not
// coming from the JS plugin and thus we don't need to handle it explicitly.
let cssValue = designSystem.theme.resolveValue(name, ['--breakpoint'])
if (coreVariant && cssValue && !designSystem.theme.hasDefault(`--breakpoint-${name}`)) {
continue
}
let deferInsert = true
if (typeof value === 'string') {
deferInsert = false
}
let query = buildMediaQuery(value)
function insert(order: number) {
// `min-*` and `max-*` rules do not need to be reconfigured, as they are
// reading the latest values from the theme.
designSystem.variants.static(
name,
(ruleNode) => {
ruleNode.nodes = [atRule('@media', query, ruleNode.nodes)]
},
{ order },
)
}
if (deferInsert) {
additionalVariants.push(insert)
} else {
insert(coreOrder)
}
}
// ... (64 more lines)
Domain
Subdomains
Functions
Types
Imported By
Source
Frequently Asked Questions
What does screens-config.ts do?
screens-config.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the Oxide domain, PreProcessors subdomain.
What functions are defined in screens-config.ts?
screens-config.ts defines 2 function(s): buildMediaQuery, registerScreensConfig.
What does screens-config.ts depend on?
screens-config.ts imports 6 module(s): DesignSystem, ResolvedConfig, ast.ts, atRule, design-system.ts, types.ts.
What files import screens-config.ts?
screens-config.ts is imported by 2 file(s): apply-compat-hooks.ts, migrate-media-screen.ts.
Where is screens-config.ts in the architecture?
screens-config.ts is located at packages/tailwindcss/src/compat/screens-config.ts (domain: Oxide, 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