public sealed class ContainerConditionsThe @container groups a stylesheet declared, as a tree of conjunctions.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The same shape as MediaConditions and a harder question. A @media group is answered once per surface, because that is the largest thing its condition can be about. A @container group is answered once per container — the same rule applies inside one panel and not inside its neighbour — so what a verdict is about is not the window but a box, and boxes are a layout result rather than a document property.
⚠ A group carries a name as well as a condition, and the name is not part of the condition. @container card (min-width: 400px) asks the nearest ancestor called card, which may be several boxes above the nearest container of any kind — so the name selects which box the condition is evaluated against, and evaluating it against the wrong one is a query that answers confidently and wrongly. ContainerScopes does that walk; this only records what to walk for.
⚠ Nesting conjoins through the parent link, exactly as @media's does — and the two nest through each other. @media (min-width: 900px) { @container (min-width: 400px) { … } } is two questions of two different subjects, and a rule inside it carries one id from each table. Keeping them in separate tables rather than one is what makes that work without a tagged union: a rule has a Conditions and a Containers, and both have to hold.
⚠ A condition that cannot be read never becomes a group, for the reason MediaConditions gives: TryEvaluate refuses on the text alone and never on the box, so unreadability is decided once, at load, where the diagnostic has somewhere to go.
Fields and properties (3)
public const int UnconditionalThe group a rule outside every @container belongs to, which always holds.
public int CountHow many groups there are, the unconditional one included.
public int RevisionBumped whenever a group is added, so a cached evaluation can tell it is stale.
Methods (6)
public int Register(int within, string? name, string? condition)Registers a container group, or finds the one already registered.
public void Reset()Forgets every group, as a reload does.
public string NameOf(int group)The container name a group asks for, or empty for the nearest container.
public string ConditionOf(int group)The condition text a group was registered with.
public int EnclosingOf(int group)The group a group is nested in, or -1 for Unconditional.
public ContainerVerdicts Evaluate(IReadOnlyList<ContainerScope> chain)Asks every group whether it holds for an element in a given container chain.
Used by (6)
- ContainerScopesVixen.Ui.Styling
- ContainerVerdictsVixen.Ui.Styling
- StyleEngineVixen.Ui.Styling
- StyleRuleSetVixen.Ui.Styling
- StyleSheetLoaderVixen.Ui.Styling
- UiDocumentVixen.Ui