Skip to content

Interface: StructureNode ​

Defined in: packages/core/src/model.ts:238

A node in an authored structure tree (@structure), written as nested CSS: a compound selector for the element and its children (the rules nested inside it). Emitters render the tree and, via toMermaid, a diagram.

Properties ​

cardinality? ​

ts
optional cardinality?: 
  | "optional"
  | `max-${number}`
  | `one-or-more-max-${number}`
  | "many"
  | "one-or-more";

Defined in: packages/core/src/model.ts:249

How often the child may appear, from a trailing pseudo on the selector: :optional/:opt (0..1), :many (0..n), :one-or-more/:more (1..n), a bare :max-<n> (0..n, capped), or a chained :one-or-more:max-<n>/:more:max-<n> (1..n, capped). Absent means the child is required (present when the component is used). A pseudo, not a /* … */ comment, because @structure lives inside a doc comment where comments can't nest; an unknown pseudo is valid selector syntax and is stripped from the stored selector.


children ​

ts
children: StructureNode[];

Defined in: packages/core/src/model.ts:266

Child nodes (rules nested one brace level deeper).


colocated? ​

ts
optional colocated?: string;

Defined in: packages/core/src/model.ts:262

The full single-selector argument from a :is(…) compound — means this element itself carries that selector (co-location, not containment). E.g. .pfx-card, button, #id, [attr="val"].


description? ​

ts
optional description?: string;

Defined in: packages/core/src/model.ts:264

Prose from a @wrapper doc tag matching this node's class, when authored (annotates the node).


scope? ​

ts
optional scope?: string;

Defined in: packages/core/src/model.ts:254

When present, this node is a @scope boundary. The value is the @scope prelude, e.g. (.component) from @scope (.component) { … }.


selector ​

ts
selector: string;

Defined in: packages/core/src/model.ts:240

The node's compound selector, e.g. .tabs, .tab.-selected, or .list:has(.tab). Empty string for @scope/@variant-group boundary nodes.


variants? ​

ts
optional variants?: StructureVariant[];

Defined in: packages/core/src/model.ts:260

When present, this node is a nested @variant-group boundary — this position is filled by exactly one of these alternative subtrees (unlike StructureVariant's top-level "the whole tree has this shape instead", this is local to one child position). selector is empty and children unused.

Released under the MIT License