modifiers.ts

Declarative modifier definitions for CSS-literal syntax.

Modifiers enable responsive, state-based, and contextual styling: - Media modifiers: md:, print:, motion-safe: - Ancestor modifiers: dark:, light: - State modifiers: hover:, focus:, disabled: - Pseudo-element modifiers: before:, after:

@see {@link https://github.com/fuzdev/fuz_css} for documentation

Declarations
#

18 declarations

view source

ALL_MODIFIER_NAMES
#

ANCESTOR_MODIFIERS
#

ARBITRARY_MAX_WIDTH_PATTERN
#

ARBITRARY_MIN_WIDTH_PATTERN
#

get_all_modifier_names
#

get_modifier
#

modifiers.ts view source

(segment: string): (ModifierDefinition & { is_arbitrary?: boolean | undefined; }) | null

Gets the modifier definition for a segment. Handles both static modifiers and dynamic patterns (arbitrary breakpoints, parameterized states).

segment

type string

returns

(ModifierDefinition & { is_arbitrary?: boolean | undefined; }) | null

The modifier definition or null if not a known modifier

MEDIA_MODIFIERS
#

ModifierDefinition
#

modifiers.ts view source

ModifierDefinition

Definition for a single modifier.

name

The prefix used in class names (e.g., 'hover', 'md', 'dark')

type string

type

Type determines position in modifier order and CSS output behavior

css

The CSS output - wrapper for media/ancestor, suffix for state/pseudo-element

type string

order

Optional ordering within type (for breakpoints, sorted by this value)

type number

MODIFIERS
#

modifiers.ts view source

ModifierDefinition[]

All modifier definitions in a single declarative structure. Adding a new modifier requires only adding to this array.

ModifierType
#

modifiers.ts view source

ModifierType

Type of modifier determining its position in the class name and CSS output.

Order in class names: [media:][ancestor:][state...:][pseudo-element:]property:value

NTH_CHILD_PATTERN
#

NTH_LAST_CHILD_PATTERN
#

NTH_LAST_OF_TYPE_PATTERN
#

NTH_OF_TYPE_PATTERN
#

parse_arbitrary_breakpoint
#

modifiers.ts view source

(segment: string): string | null

Parses an arbitrary breakpoint modifier.

segment

type string

returns

string | null

The CSS media query or null if not an arbitrary breakpoint

parse_parameterized_state
#

modifiers.ts view source

(segment: string): { name: string; css: string; type: "state"; } | null

Parses a parameterized state modifier (nth-child, nth-last-child, nth-of-type, nth-last-of-type).

segment

type string

returns

{ name: string; css: string; type: "state"; } | null

Object with name (including parameter) and CSS, or null if not parameterized

PSEUDO_ELEMENT_MODIFIERS
#

STATE_MODIFIERS
#

Imported by
#