Skip to main content

Class: LayoutStateController

Defined in: src/ui/layout/index.ts:164

Keeps a Lit element up to date with the state of the <paint-canvas> layout it's in (see LayoutState), so it can render differently per device or size. state is undefined outside a layout.

Example​

class MyThing extends LitElement {
private layout = new LayoutStateController(this);
override render() {
return this.layout.state?.narrow ? html`…` : html`…`;
}
}

Implements​

  • ReactiveController

Constructors​

Constructor​

new LayoutStateController(host): LayoutStateController

Defined in: src/ui/layout/index.ts:171

Parameters​

host​

ReactiveControllerHost & Element

Returns​

LayoutStateController

Accessors​

state​

Get Signature​

get state(): LayoutState | undefined

Defined in: src/ui/layout/index.ts:177

The layout's state, if the element is in a layout

Returns​

LayoutState | undefined

Methods​

hostConnected()​

hostConnected(): void

Defined in: src/ui/layout/index.ts:181

Called when the host is connected to the component tree. For custom element hosts, this corresponds to the connectedCallback() lifecycle, which is only called when the component is connected to the document.

Returns​

void

Implementation of​

ReactiveController.hostConnected


hostDisconnected()​

hostDisconnected(): void

Defined in: src/ui/layout/index.ts:186

Called when the host is disconnected from the component tree. For custom element hosts, this corresponds to the disconnectedCallback() lifecycle, which is called the host or an ancestor component is disconnected from the document.

Returns​

void

Implementation of​

ReactiveController.hostDisconnected