Skip to content

Variable: CSSDOC_MODIFIER_CHAINED ​

ts
const CSSDOC_MODIFIER_CHAINED: Regex<"-(?<prop>[A-Za-z0-9]+)(?:-(?<value>[\\w-]+(?:-\\*)?))?", {
  flags: "u";
  names: {
     prop: string;
     value?: string;
  };
}>;

Defined in: packages/regex/src/tiers/css-doc-grammar.ts:90

CssDoc Modifier Name - Chained Form from grammar. Alternative form: separate prefixed class on the base (e.g., .base.-name). Grammar rule: ChainedModifierName :: '-' Prop | '-' Prop '-' Value

Prop is an identifier segment containing no hyphens (the first segment). Value is the remainder, which may contain hyphens or be a * family.

Examples: .-active, .-size-lg, .-icon-*

Examples ​

ts
const match = CSSDOC_MODIFIER_CHAINED.exec("-active");
match?.groups?.prop // "active"
match?.groups?.value // undefined
ts
const match = CSSDOC_MODIFIER_CHAINED.exec("-size-lg");
match?.groups?.prop // "size"
match?.groups?.value // "lg"

Released under the MIT License