timepiece/node_modules/lit-html/directives/live.d.ts

43 lines
1.8 KiB
TypeScript

/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
import { AttributePart } from '../lit-html.js';
import { Directive, DirectiveParameters, PartInfo } from '../directive.js';
declare class LiveDirective extends Directive {
constructor(partInfo: PartInfo);
render(value: unknown): unknown;
update(part: AttributePart, [value]: DirectiveParameters<this>): unknown;
}
/**
* Checks binding values against live DOM values, instead of previously bound
* values, when determining whether to update the value.
*
* This is useful for cases where the DOM value may change from outside of
* lit-html, such as with a binding to an `<input>` element's `value` property,
* a content editable elements text, or to a custom element that changes it's
* own properties or attributes.
*
* In these cases if the DOM value changes, but the value set through lit-html
* bindings hasn't, lit-html won't know to update the DOM value and will leave
* it alone. If this is not what you want--if you want to overwrite the DOM
* value with the bound value no matter what--use the `live()` directive:
*
* ```js
* html`<input .value=${live(x)}>`
* ```
*
* `live()` performs a strict equality check against the live DOM value, and if
* the new value is equal to the live value, does nothing. This means that
* `live()` should not be used when the binding will cause a type conversion. If
* you use `live()` with an attribute binding, make sure that only strings are
* passed in, or the binding will update every render.
*/
export declare const live: (value: unknown) => import("../directive.js").DirectiveResult<typeof LiveDirective>;
/**
* The type of the class that powers this directive. Necessary for naming the
* directive's return type.
*/
export type { LiveDirective };
//# sourceMappingURL=live.d.ts.map