Function: parseStructureVariants()
function parseStructureVariants(
raw,
parse?,
ownerRecordName?
): StructureVariant[] | undefined;Defined in: packages/core/src/grammar.ts:1069
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. This only handles the top level (the whole tree alternates); a @variant nested deeper is a local choice at one child position, handled by buildStructureNodes instead and stored on that node's StructureNode.variants.
Parameters
raw
string
parse?
ownerRecordName?
string
Returns
StructureVariant[] | undefined
undefined when the body has no top-level @variant block (the common case).