/** * ReactiveElement prototype instrumentation for the lifecycle timeline layer. * * Wraps the lifecycle methods listed in PHASES on the prototype of the * ReactiveElement class loaded by the app — not by importing lit directly, * to avoid multi-copy issues. The proto is resolved from the already-defined * custom element registry (same mechanism as the HMR patch module). * * Each wrapped method emits a paired start/end TimelineEvent so the panel * can render duration bars. performUpdate brackets the whole update tick and * bumps a per-instance tick counter that becomes the groupId shared by all * phase events within that tick. * * `shouldUpdate` is not bracketed: its return value is the news. A component's * own override returning `false` emits one `update skipped` point event, inside * the `performUpdate` bracket it vetoed. * * `requestUpdate` is wrapped too, to remember why the next tick was scheduled * (see `cause-context.ts`); that cause rides on the tick's `performUpdate:start`. * * A host's `@lit/task` runs are recorded as `task` spans (`task:start` when * `run` is called, `task:end` when it settles), and the update a run asks for * once it settles carries that run as its cause: it is requested from a * promise continuation, where nothing else is running to blame. * * Gated by the recording flag so overhead is near-zero when idle. */ import type { TimelineEvent } from '../../../types/timeline.js'; export type LifecycleEmit = (event: TimelineEvent) => void; type EmitFn = LifecycleEmit; type RecordingFn = () => boolean; type LayerEnabledFn = () => boolean; /** * Called once per completed `performUpdate` that rendered, with the element and * whether that was its first update. Independent of the recording gate: the flash overlay * wants every update while it is on, whether or not the timeline is recording. */ export type UpdateHook = (el: Element, first: boolean) => void; /** Install (or clear, with `null`) the per-update hook. One consumer. */ export declare const setUpdateHook: (hook: UpdateHook | null) => void; /** Who is updating at this moment, for attributing a Lit warning to it. */ export declare const currentlyUpdating: () => { tagName: string; elementId: number; } | null; /** * The groupId of the update tick `el` is inside right now, or undefined when * it is not in `performUpdate` (an event another element dispatched during * this update is not part of this element's tick). */ export declare const updateGroupOf: (el: object) => string | undefined; /** * Install lifecycle instrumentation for *every* Lit element on the page. * * The phases live on the shared ReactiveElement/LitElement base prototypes, so * wrapping them there instruments all components at once — not just the first * one registered (the old behavior, which also silently no-op'd when Vite * served the production Lit build, since that omits the `reactiveElementVersions` * sentinel the resolver gated on). * * A component that overrides `willUpdate`/`updated`/`firstUpdated` *without* * calling `super` shadows the base no-op and won't report that phase — an * accepted limitation; the common case and `super`-calling overrides report. * * Idempotent — wrapping is brand-guarded per prototype+method. */ export declare const installLifecycleLayer: (emit: EmitFn, recording: RecordingFn, enabled: LayerEnabledFn, changedValues?: LayerEnabledFn) => void; export {}; //# sourceMappingURL=lifecycle.d.ts.map