import type { PropertyDeclaration } from './decorators/property'; import type { TargetDeclaration } from './decorators/target'; declare const entryType: unique symbol; /** * Every registration is made against a class field, and the field name is what it is looked up by. */ export interface RegistryEntry { key: string; } /** * A named collection of Declarations of one kind. The token carries the entry type, so a registry can only ever be * written and read with matching values: passing {@link TARGETS} where {@link PropertyDeclaration} entries are expected * is a type error rather than a silently empty map. */ export interface Registry { readonly name: string; /** * Phantom marker that pins `T` to the token. It is what makes {@link PROPERTIES} and {@link TARGETS} distinct types * rather than structurally identical `{ name: string }`s, and is never present at runtime. */ readonly [entryType]?: T; } /** * Fields declared with `@property()`, read back by `Property` and `observedAttributes`. */ export declare const PROPERTIES: Registry; /** * Fields declared with `@target()` / `@targets()`, read back by `Target`. */ export declare const TARGETS: Registry; /** * The metadata object a legacy decorator records `ctor`'s Declarations on: its own `Symbol.metadata`, created the way * the standard emitters create it, chained to its superclass's. So a class compiled either way reads its superclass's * Declarations through the chain, whichever way the superclass was compiled. */ export declare function classMetadata(ctor: object): object; /** * Makes `metadata` the class `ctor`'s own `Symbol.metadata`, as the standard emitters attach it: writable and * configurable, so an emitter that attaches it again afterwards still can. */ export declare function attachMetadata(ctor: object, metadata: object): void; /** * Records `entry` under `registry` on `metadata`, keyed by its field name. A field has one Declaration, so it replaces * an inherited Declaration of the same field, of any kind. The index is built here, once per field when the class is * defined, so a lookup on an instance hot path (an attribute change, a matched target token) is a single `Map#get`. * * Throws for a field the class has declared already. */ export declare function register(metadata: object, registry: Registry, entry: T): void; /** * The entries recorded under `registry` for the class `ctor` by field name, inherited ones included, or an empty map * when there are none. Reading never allocates on the class or its metadata. * * The miss returns a fresh map rather than a shared empty one: `ReadonlyMap` is erased at runtime, so a single cast * on a shared instance would leak entries into every class that declared nothing. */ export declare function registered(ctor: object, registry: Registry): ReadonlyMap; /** * The entries recorded under `registry` for the class of `instance`: {@link registered} for callers holding an element * rather than a class. * * Safe to call once from a field initializer and keep: an upgraded custom element has its prototype swapped inside * `super()`, before any field initializer runs, so construction already sees the class the element ended up as. The * map handed back is the class's own, so it is a reference to hold rather than a copy to rebuild. */ export declare function registeredFor(instance: object, registry: Registry): ReadonlyMap; export {}; //# sourceMappingURL=registry.d.ts.map