Vixen
dd8b0a81
csharp
public static class MediaQuery

Evaluates the @media conditions doc 09 lists as supported.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

A condition is and-joined features, each (name), (name: value) or Media Queries 4 § 2.4's range syntax — (width < 24rem), (400px <= width < 600px) — with the min- and max- prefixes that carry nearly all real usage. That is deliberately less than CSS Media Queries 4: no or and no not.

⚠ The range operators are not sugar for the prefixes. max-width: 448px is <= and width < 448px is <, and the two disagree on exactly one width — the threshold. Tailwind v4's @max-* is the exclusive one, so the prefix form alone made every max- breakpoint in this engine off by one pixel in a way that reads as an author mis-picking their breakpoint. See FeatureComparison.

A condition this cannot evaluate makes the whole block fail to load, with a diagnostic. The alternative is choosing a default, and both defaults are wrong in a way nobody will notice: treating it as false silently drops styles, and treating it as true silently applies phone styles on a desktop. The same rule the selector compiler follows, for the same reason.

Methods (1)

  • public static bool TryEvaluate(string? condition, MediaContext context, out bool matches, out string? reason)

    Evaluates a condition.

Used by (6)

  • ContainerQueryVixen.Ui.Styling
  • MediaConditionsVixen.Ui.Styling
  • ReducedMotionTestsVixen.Ui.Styling.Tests
  • StyleSheetLoaderVixen.Ui.Styling
  • StyleSheetLoadingTestsVixen.Ui.Styling.Tests
  • WideGamutTestsVixen.Ui.Styling.Tests