/** * In-place custom element class patching. * * Vite HMR re-executes an edited component module, which calls * `customElements.define()` again with a freshly evaluated class. The * platform registry can't re-define a tag, and live instances keep their * original prototype chain, so instead of swapping classes we intercept the * duplicate define and patch the originally-registered class in place: * copy prototype + static descriptors from the new class onto the old one * and nudge live instances to re-render. * * This module is dependency-free and duck-typed against ReactiveElement so * it never imports lit (keeps it version-agnostic and safe for non-Lit * custom elements, which get prototype/static patching only). */ import { type ChildStateMode } from './child-state.js'; export interface PatchOptions { /** * Cycle `disconnectedCallback()`/`connectedCallback()` on live instances * after a hot patch. Defaults to `false`. */ reconnect?: boolean; /** * What to do when a component can't be hot-patched in place (e.g. * standard `accessor` decorators). Defaults to `'reload'`. */ onIncompatible?: 'reload' | 'warn'; /** * What happens to custom elements a hot patch re-creates (an edited * template clones fresh DOM): `'reset'` leaves them at their defaults, * `'transfer'` copies the old element's state onto the new one, `'reuse'` * puts the old element back where the new one carries no bindings (and * transfers otherwise). Defaults to `'transfer'`. */ childState?: ChildStateMode; } /** * Syncs own members `source` → `target`: deletes own keys of `target` that * vanished from `source`, then copies every own descriptor of `source`. * Individual copies are best-effort (non-configurable slots are skipped). */ export declare const syncOwnMembers: (target: object, source: object, skip: ReadonlyArray) => void; /** * Installs the `customElements.define` interceptor. Idempotent (per-page * global guard); no-ops in environments without `customElements` (SSR). */ export declare const install: (options?: PatchOptions) => void; //# sourceMappingURL=patch.d.ts.map