Skip to content

pantoken-root / packages/utils/src / danglingReferences

Function: danglingReferences() ​

danglingReferences(css): string[]

Beta

Self-containment check: --instui-* names referenced via var() in a stylesheet that it never defines (as an @property registration or a --x: declaration). Sorted; empty means every reference resolves within the same output. Use for self-contained stylesheets (css, pendo).

Parameters ​

css ​

string

The generated stylesheet.

Returns ​

string[]

The dangling reference names.

Example ​

ts
import { danglingReferences } from "@pantoken/utils";

// Self-contained: the referenced property is also defined here.
danglingReferences("@property --instui-a {} .b { color: var(--instui-a); }"); // → []

// Dangling: `--instui-b` is referenced but never defined.
danglingReferences(
  ":root { --instui-a: red; } .b { color: var(--instui-a); background: var(--instui-b); }",
); // → ["--instui-b"]