/** * Lit dev-mode warnings, captured from the Set Lit records them in. * * Lit's development build reports mistakes through a module-private * `issueWarning(code, message)` that `console.warn`s once and adds the full * text (` See https://lit.dev/msg/ for more information.`) to * `globalThis.litIssuedWarnings`, a Set shared by `@lit/reactive-element` and * `lit-html`. There is nothing to wrap, but the Set can be: this module makes * it if no Lit copy has yet and hooks its `add`, so every later warning * reaches {@link onLitWarning}, and entries recorded before the hook are * replayed. A production build never creates the Set, so nothing is captured. * * The Set also holds bare codes: an app adds one to silence that warning. * Those carry no message and are ignored. * * `warnings-boot.ts` runs this ahead of the app's own modules, so Lit finds * the hooked Set rather than making its own; the timeline runtime, injected * after the app, only finds what was recorded by then. The state lives on a * global so a second copy of this module shares it. */ export interface LitWarning { /** Lit's message code (`change-in-update`), or `''` when Lit gave none. */ code: string; /** The message, without the trailing docs link. */ message: string; /** The custom element tag the message names, when it names one. */ tagName?: string; /** The component class the message names, when it names one. */ className?: string; /** The element that was updating when it was issued, when that was the one. */ elementId?: number; } type Listener = (warning: LitWarning) => void; /** Who is updating right now; set by the lifecycle layer. */ export type UpdatingResolver = () => { tagName: string; elementId: number; } | null; /** * Splits one Set entry into a {@link LitWarning}, or null for a bare code, * an entry that is not text, or a warning that is just dev-mode noise. */ export declare const parseLitWarning: (entry: unknown) => LitWarning | null; /** * Hooks `litIssuedWarnings.add` (making the Set first if Lit has not) and * records what is already in it. Idempotent; never throws into the page. */ export declare const installLitWarningCapture: () => void; /** Everything captured so far, oldest first. */ export declare const litWarnings: () => readonly LitWarning[]; /** Warnings that name `tagName` or the component class `className`. */ export declare const warningsFor: (tagName: string, className?: string) => LitWarning[]; /** Calls `listener` for each warning captured from now on. Returns a detach. */ export declare const onLitWarning: (listener: Listener) => (() => void); /** Tells the capture which element is mid-update, to attribute a warning. */ export declare const setUpdatingResolver: (resolver: UpdatingResolver | null) => void; export {}; //# sourceMappingURL=lit-warnings.d.ts.map