Misc
value defaultConverterSource
Import
import { defaultConverter } from 'lit';
Type
ComplexAttributeConvertervalue isServerSource
A boolean that will be true in server environments like Node, and false in browser environments. Note that your server environment or toolchain must support the "node" export condition for this to be true.
Import
import { isServer } from 'lit';
Type
falseDetails
This can be used when authoring components to change behavior based on whether or not the component is executing in an SSR context.
namespace LitUnstableSource
Contains types that are part of the unstable debug API.
Import
import { LitUnstable } from 'lit';
Details
Everything in this API is not stable and may change or be removed in the future, even on patch releases.
Methods and properties
DebugLogSource
When Lit is running in dev mode and window.emitLitDebugLogEvents is true, we will emit 'lit-debug' events to window, with live details about the update and render lifecycle. These can be useful for writing debug tooling and visualizations.
Details
Please be aware that running with window.emitLitDebugLogEvents has performance overhead, making certain operations that are normally very cheap (like a no-op render) much slower, because we must copy data and dispatch events.
function notEqualSource
Change function that returns true if value is different from oldValue. This method is used as the default for a property's hasChanged function.
Import
import { notEqual } from 'lit';
Signature
notEqual(value, old): boolean
Parameters
- value
unknown- old
unknown
namespace ReactiveUnstableSource
Contains types that are part of the unstable debug API.
Import
import { ReactiveUnstable } from 'lit';
Details
Everything in this API is not stable and may change or be removed in the future, even on patch releases.
Methods and properties
DebugLogSource
When Lit is running in dev mode and window.emitLitDebugLogEvents is true, we will emit 'lit-debug' events to window, with live details about the update and render lifecycle. These can be useful for writing debug tooling and visualizations.
Details
Please be aware that running with window.emitLitDebugLogEvents has performance overhead, making certain operations that are normally very cheap (like a no-op render) much slower, because we must copy data and dispatch events.
class TemplateInstanceSource
An updateable instance of a Template. Holds references to the Parts used to update the template instance.
Import
import { TemplateInstance } from 'lit';
Methods and properties
new TemplateInstance(template, parent): TemplateInstance
Parameters
- template
Template- parent
ChildPart
parentNode: NodeSource
namespace UnstableSource
Contains types that are part of the unstable debug API.
Import
import { Unstable } from 'lit';
Details
Everything in this API is not stable and may change or be removed in the future, even on patch releases.
Methods and properties
DebugLogSource
When Lit is running in dev mode and window.emitLitDebugLogEvents is true, we will emit 'lit-debug' events to window, with live details about the update and render lifecycle. These can be useful for writing debug tooling and visualizations.
Details
Please be aware that running with window.emitLitDebugLogEvents has performance overhead, making certain operations that are normally very cheap (like a no-op render) much slower, because we must copy data and dispatch events.
type CompiledTemplateSource
Import
import { CompiledTemplate } from 'lit';
type CompiledTemplateResultSource
Import
import { CompiledTemplateResult } from 'lit';
Methods and properties
values: Array<unknown>Source
type DirectiveParentSource
Import
import { DirectiveParent } from 'lit';
type DisconnectableSource
Import
import { Disconnectable } from 'lit';
type HasChangedSource
Import
import { HasChanged } from 'lit';
Signature
HasChanged(value, old): boolean
Parameters
- value
unknown- old
unknown
type HTMLTemplateResultSource
Import
import { HTMLTemplateResult } from 'lit';
Type
TemplateResult<HTML_RESULT>type InitializerSource
Import
import { Initializer } from 'lit';
Type
(element: ReactiveElement) => voidtype PropertyValueMapSource
Do not use, instead prefer PropertyValues.
Import
import { PropertyValueMap } from 'lit';
Methods and properties
delete(k): booleanSource
Parameters
- k
K
get(k): undefined | T[K]Source
Parameters
- k
K
has(k): booleanSource
Parameters
- k
K
set(key, value): PropertyValueMap<T>Source
Parameters
- key
K- value
T[K]
type RootPartSource
A top-level ChildPart returned from render that manages the connected state of AsyncDirectives created throughout the tree below it.
Import
import { RootPart } from 'lit';
Methods and properties
readonly options: undefined | RenderOptionsSource
readonly type: 2Source
endNode: null | NodeSource
The part's trailing marker node, if any. See .parentNode for more information.
parentNode: NodeSource
The parent node into which the part renders its content.
Details
A ChildPart's content consists of a range of adjacent child nodes of .parentNode, possibly bordered by 'marker nodes' (.startNode and .endNode).
- If both
.startNodeand.endNodeare non-null, then the part's content consists of all siblings between.startNodeand.endNode, exclusively. - If
.startNodeis non-null but.endNodeis null, then the part's content consists of all siblings following.startNode, up to and including the last child of.parentNode. If.endNodeis non-null, then.startNodewill always be non-null. - If both
.endNodeand.startNodeare null, then the part's content consists of all child nodes of.parentNode.
startNode: null | NodeSource
The part's leading marker node, if any. See .parentNode for more information.
setConnected(isConnected): voidSource
Sets the connection state for AsyncDirectives contained within this root ChildPart.
Parameters
- isConnected
-
booleanWhether directives within this tree should be connected or not
Details
lit-html does not automatically monitor the connectedness of DOM rendered; as such, it is the responsibility of the caller to render to ensure that part.setConnected(false) is called before the part object is potentially discarded, to ensure that AsyncDirectives have a chance to dispose of any resources being held. If a RootPart that was previously disconnected is subsequently re-connected (and its AsyncDirectives should re-connect), setConnected(true) should be called.
type ValueSanitizerSource
A function which can sanitize values that will be written to a specific kind of DOM sink.
Import
import { ValueSanitizer } from 'lit';
Type
(value: unknown) => unknownDetails
See SanitizerFactory.
type WarningKindSource
A string representing one of the supported dev mode warning categories.
Import
import { WarningKind } from 'lit';
Type
"change-in-update" | "migration"