Skip to content

pantoken-root / packages/utils/src / danglingReferences

Hàm: danglingReferences() ​

danglingReferences(css): string[]

Beta

Kiểm tra tính tự chứa: tên --instui-* được tham chiếu qua var() trong một stylesheet mà nó chưa bao giờ định nghĩa (như một đăng ký @property hoặc một khai báo --x:). Đã sắp xếp; rỗng nghĩa là mọi tham chiếu được giải quyết trong cùng một đầu ra. Dùng cho stylesheet tự chứa (css, pendo).

Tham số ​

css ​

string

Stylesheet được tạo.

Trả về ​

string[]

Các tên tham chiếu bị bỏ lửng.

Ví dụ ​

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"]