BlockSuite API Documentation / @blocksuite/block-std / ShadowlessElement
Class: ShadowlessElement
Extends
LitElement
Extended by
Constructors
new ShadowlessElement()
new ShadowlessElement():
ShadowlessElement
Returns
Inherited from
LitElement.constructor
Defined in
node_modules/@lit/reactive-element/development/reactive-element.d.ts:504
Other
virtualKeyboardPolicy
virtualKeyboardPolicy:
string
Inherited from
LitElement.virtualKeyboardPolicy
Defined in
packages/framework/global/dist/types/virtual-keyboard.d.ts:20
connectedCount
static
connectedCount:WeakMap
<Constructor
,WeakMap
<Node
,number
>>
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:9
onDisconnectedMap
static
onDisconnectedMap:WeakMap
<Constructor
,null
| () =>void
>
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:14
lifecycle
connectedCallback()
connectedCallback():
void
Invoked when the component is added to the document's DOM.
In connectedCallback()
you should setup tasks that should only occur when the element is connected to the document. The most common of these is adding event listeners to nodes external to the element, like a keydown event handler added to the window.
connectedCallback() {
super.connectedCallback();
addEventListener('keydown', this._handleKeydown);
}
Typically, anything done in connectedCallback()
should be undone when the element is disconnected, in disconnectedCallback()
.
Returns
void
Overrides
LitElement.connectedCallback
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:53
disconnectedCallback()
disconnectedCallback():
void
Invoked when the component is removed from the document's DOM.
This callback is the main signal to the element that it may no longer be used. disconnectedCallback()
should ensure that nothing is holding a reference to the element (such as event listeners added to nodes external to the element), so that it is free to be garbage collected.
disconnectedCallback() {
super.disconnectedCallback();
window.removeEventListener('keydown', this._handleKeydown);
}
An element may be re-connected after being disconnected.
Returns
void
Overrides
LitElement.disconnectedCallback
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:82
rendering
createRenderRoot()
createRenderRoot():
ShadowlessElement
Returns
Overrides
LitElement.createRenderRoot
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:78
styles
finalizeStyles()
protected
static
finalizeStyles(styles
?):CSSResultOrNative
[]
Takes the styles the user supplied via the static styles
property and returns the array of styles to apply to the element. Override this method to integrate into a style management system.
Styles are deduplicated preserving the last instance in the list. This is a performance optimization to avoid duplicated styles that can occur especially when composing via subclassing. The last item is kept to try to preserve the cascade order with the assumption that it's most important that last added styles override previous styles.
Parameters
styles?
CSSResultGroup
Returns
CSSResultOrNative
[]
Nocollapse
Overrides
LitElement.finalizeStyles
Defined in
packages/framework/block-std/src/view/element/shadowless-element.ts:21