cssText property

String get cssText

Compiled global CSS text.

Implementation

String get cssText {
  final activeTheme = theme ?? themeProvider?.initialTheme;
  final chunks = <String>[
    if (activeTheme != null)
      _compileRootMap(':root', activeTheme.cssVariables),
    if (themeProvider != null)
      _compileRootMap(
        ':root[data-theme="light"], [data-theme="light"]',
        themeProvider!.light.cssVariables,
      ),
    if (themeProvider != null)
      _compileRootMap(
        ':root[data-theme="dark"], [data-theme="dark"]',
        themeProvider!.dark.cssVariables,
      ),
    if (root != null) _compileRootRule(':root', root!),
    if (all != null) _compileRootRule('*', all!),
    if (html != null) _compileRootRule('html', html!),
    if (body != null) _compileRootRule('body', body!),
    if (links != null) _compileRootRule('a', links!),
    for (final entry in selectors.entries)
      _compileRootRule(entry.key, entry.value),
    for (final keyframe in keyframes) keyframe.cssText,
  ];

  return chunks.where((chunk) => chunk.trim().isNotEmpty).join('\n');
}