Skip to content

Function: parseStructureVariants()

ts
function parseStructureVariants(
   raw, 
   parse?, 
   ownerRecordName?): StructureVariant[] | undefined;

Defined in: packages/core/src/grammar.ts:1026

Split a @structure body into alternative StructureVariants when it has one or more top-level @variant <name>? { … } blocks — an author saying "pick one of these DOM shapes" (e.g. a <label> wrapping a control vs. a <label for> + a sibling control), as opposed to parseStructure's default of "these roots all coexist". A bare (non-@variant) run of top-level nodes becomes an unnamed variant in place; @variant is only recognized at this top level — a nested occurrence is inert CSS content, same as any other unrecognized at-rule.

Parameters

raw

string

parse?

CssParse

ownerRecordName?

string

Returns

StructureVariant[] | undefined

undefined when the body has no top-level @variant block (the common case).

Released under the MIT License