/** * D103 — the design-token reference: what `token()` has to be at the site that * writes it, and the migration off the `color("var(--x)")` passthrough that * used to be the only spelling a Look value let through unchecked. * * D115 P4 R3b. The compiler cannot see a design system's values, so the * reference itself is the whole of what there is to check; every rule here is * about the written name. */ import { type DiagnosticEdit } from "@velarscript/compiler"; import { type Expression } from "@velarscript/compiler/extension"; import { type LookValueSite } from "../look-sites.ts"; import { type LookAnalysisHost } from "./host.ts"; /** * D103 rules 1 and 5 — what a checked token reference has to be at the site * that writes it. * * The compiler cannot see a design system's values: no token stylesheet is an * input to this compile, and the whole point of the contract is that the * theme swaps values under the same names. So the reference itself is the * only thing there is to check, and it is checked completely — a literal * name, spelled as a CSS custom property identifier, and nothing else in the * call. A computed name would leave a Look value with no checked part at all, * which is the surface D50 rule 92 says is worse than none. */ export declare function checkLookTokenCall(host: LookAnalysisHost, expression: Extract): void; /** * D103 rule 4 — the migration off the one passthrough that used to work. * * The rewrite carries the `token` import when the module does not already * have one, because a fix that leaves a module naming an unimported builder * is not mechanical. A `var(--x, fallback)` reference has no rewrite: rule 5 * closed the contract against per-site fallbacks, so the message says that * rather than offering a migration that would silently drop the fallback. */ export declare function reportLookColorVarReference(host: LookAnalysisHost, expression: Extract, argument: Expression): void; /** The import edit that gives this module a `token` import and takes back what the rewrite retired. */ export declare function lookTokenImportEdit(host: LookAnalysisHost, retiring?: readonly string[]): readonly DiagnosticEdit[]; /** Whether this value is written as a call to the module's `token` builder, alias included. */ export declare function isLookTokenCall(host: LookAnalysisHost, value: Expression): boolean; /** How this module spells a call to the token builder, honouring an aliased import. */ export declare function lookTokenCallText(host: LookAnalysisHost, referenced: string): { readonly call: string; readonly imported: boolean; }; /** * The edits that replace one written Look value with the checked token call, * in the spelling of the site that wrote it. * * A `look:property="text"` directive is analyzed through a synthetic literal * standing for the whole attribute, so the rewrite replaces the attribute: * splicing a call between an attribute's quotes is not JSX, and a fix that * produces a parse error is not a mechanical fix. The `look:property={...}` * spelling carries a real expression whose span is the value alone, and is * rewritten in place like a block entry. */ export declare function lookTokenRewrite(host: LookAnalysisHost, value: Expression, referenced: string, site: LookValueSite): readonly DiagnosticEdit[]; /** * D103 rule 4, free-text half — an advisory rather than a refusal. * * `fontFamily`, `backdropFilter` and the other free-text kinds accept * arbitrary CSS text by construction, and a `var()` inside a larger value is * a legitimate spelling with no single token to rewrite it to: the tail of a * font stack, one layer of a filter list. Refusing there would refuse real * CSS. What is advised is the narrow case where the *whole* value is one * reference, because there `token("--name")` is the checked spelling of the * same thing and the rewrite is unambiguous — which is the bar the `A` * roster is written to. */ export declare function adviseLookTokenSpelling(host: LookAnalysisHost, name: string, value: Expression, site: LookValueSite): void; //# sourceMappingURL=tokens.d.ts.map