import type{PropertyDeclaration,ReactiveElement}from'lit'; /** Declaration for a property installed by {@linkcode definePersistedProperty}. Everything except * `initial` and `coerce` is forwarded verbatim to Lit's own property registration. */ export interface PersistedPropertyOptions{ /** The value the property reads before anything assigns it. Declared here rather than as a class * field precisely because a class field would run through the setter. */ initial:V; /** `true` for the lower-cased property name, a string for an explicit attribute name, `false` * for a property with no attribute. Required: an attribute is the most common way a consumer * sets one of these properties, so the decision is never left implicit. */ attribute:boolean|string; /** Reflects the property back to its attribute through Lit's own reflection, which suppresses * the attribute-to-property write it would otherwise trigger. */ reflect?:boolean; /** Lit's attribute converter hint (`Boolean`, `Number`, `String`, `Object`, `Array`). */ type?:PropertyDeclaration['type']; /** Replaces the default attribute converter. A property declared with `initial: true` needs * `trueDefaultBooleanConverter` from `./converters.js` here: Lit's presence-based boolean * converter cannot parse `prop="false"`, so a `true`-defaulting boolean is unsettable from * markup without it. */ converter?:PropertyDeclaration['converter']; /** Replaces Lit's `notEqual` dirty check. Applies to the update this module's setter requests, * so returning `false` keeps a write out of the render pass while the getter still reports it. */ hasChanged?:PropertyDeclaration['hasChanged']; /** Normalizes every incoming write (for example `Boolean(next)` for a property a consumer may * set to a truthy non-boolean). Never applied to `initial`, which is already the declared * value. */ coerce?:(next:V)=>V;} /** * Installs a get/set pair for `name` on `target` (a class prototype) plus the private * explicitly-set flag {@linkcode isPersistedPropertyExplicitlySet} reads, and registers the * property with Lit using `noAccessor` so Lit leaves that pair in place. * * The property is not backed by a class field, so nothing assigns it during construction and the * flag reports only genuine writes. Adding a class field of the same name re-introduces exactly * the ambiguity this removes. */ export declare function definePersistedProperty(target:T,name:K,options:PersistedPropertyOptions):void; /** * Whether `name` was ever assigned on `host` -- by a JS write, by an attribute Lit converted, or * by a pre-upgrade own property Lit replayed before the first update. A property still holding the * `initial` value it was declared with reports `false`, which is the one distinction * `changedProperties.has()` cannot make. * * Throws when `name` was never installed on `host` by {@linkcode definePersistedProperty} -- a * typo, or an ordinary `@property` a multi-field restore tried to gate this way. Answering `false` * there would be far worse than throwing: `false` reads as "the consumer has not set it", so the * restore fires unconditionally and overwrites a consumer's explicit binding with stale storage, * which is the exact regression this module exists to prevent. */ export declare function isPersistedPropertyExplicitlySet(host:object,name:PropertyKey):boolean; /** * The persisted value for `storageKey`, or `undefined` when there is nothing to apply. * * Returns `undefined` -- without touching storage at all -- when `wasExplicitlySet` is `true`, so * a consumer-supplied value is never overwritten. Otherwise it reads through * `readPersistedState()`, which already fails silently on unavailable storage, malformed JSON and * a record that fails `isValid`. An unset `storageKey` reads nothing, matching the rule that a * component without persistence configured touches storage neither to read nor to write. */ export declare function restoreFromStorage(storageKey:string|undefined,wasExplicitlySet:boolean,isValid:(parsed:unknown)=>parsed is{value?:V;}):V|undefined;