Skip to content

lit-ui-router-ssr / client / ServedUiView

Interface: ServedUiView ​

Defined in: packages/lit-ui-router-ssr/src/served-view.ts:140

A <ui-view> that owns its side of a server render.

Extends ​

  • UiView

Properties ​

PropertyTypeDescriptionInherited fromDefined in
deferHydrationbooleanWritten by the server on a prerendered view; while it is present the view renders nothing, and removing it wakes and hydrates the element.-packages/lit-ui-router-ssr/src/served-view.ts:145
namestringthe view name this viewport fills; empty selects the $default viewUiView.namepackages/lit-ui-router/dist/ui-view.d.ts:78
uiRouterUIRouterLit<ui-view> can be used without <ui-router> by providing the uiRouter property directly.UiView.uiRouterpackages/lit-ui-router/dist/ui-view.d.ts:83

Accessors ​

routedElement ​

Get Signature ​

ts
get routedElement(): Element | null;

Defined in: packages/lit-ui-router/dist/ui-view.d.ts:265

The element the routed component rendered: a class component's instance, or the first element a template component rendered. null while the fallback set shows.

The view's children are internal, so read the routed element here rather than through firstElementChild or child selectors. While a class component replaces another, both stand until the incoming element has rendered, and this is the incoming one.

The same element carries the routed attribute, for CSS: ui-view > [routed].

Returns ​

Element | null

Inherited from ​

UiView.routedElement

Methods ​

adoptProvidedRouter() ​

ts
protected adoptProvidedRouter(): void;

Defined in: packages/lit-ui-router/dist/ui-view.d.ts:193

Adopts the router the provider now offers, when this view registered without it or with another.

Runs whenever the router this view holds is one a seek produced, or none: a provider that upgraded late, or a different <ui-router> this view has just been attached under, supersedes it. A router the app assigned is kept.

lit replays a pre-upgrade property inside the element's first update, not at upgrade, so <ui-router> can run connectedCallback with uiRouter still undefined and provide an instance of its own; a <ui-view> connecting in between registers with that one and never sees a transition. Firefox upgrades a detached subtree later than Chrome and WebKit, so declarative shadow DOM parsed off-document reaches this there first.

registerUIView syncs, so the re-registered view picks up the current state without waiting for the next transition.

A subclass that renders against a registration made elsewhere calls it before the update that reads the component.

Returns ​

void

Inherited from ​

UiView.adoptProvidedRouter


captureContent() ​

ts
protected captureContent(): void;

Defined in: packages/lit-ui-router/dist/ui-view.d.ts:215

Takes the authored children ahead of any render as this view's fallback set.

The nodes are moved, never copied, so they keep their identity and any binding an enclosing template holds on them stays live. The first update stands them back up when no component occupies the view.

A view whose first child is a render marker holds a render's output from the first child down, so it captures nothing and the nodes stay where they stand: they are lit's own on a re-attached view, and never ours to move.

Returns ​

void

Inherited from ​

UiView.captureContent


captureContentInPlace() ​

ts
protected captureContentInPlace(): void;

Defined in: packages/lit-ui-router/dist/ui-view.d.ts:228

Takes the authored children standing ahead of any render as this view's fallback set, leaving them where they are.

The nodes are not parked: they already stand in the document, and the update that follows parks them only if a component occupies the view, like any other fallback set. A view whose children are a render's from the first one down captures nothing.

This is the capture for a subclass that fills the element before its first render, where captureContent at connect would be too early.

Returns ​

void

Inherited from ​

UiView.captureContentInPlace


render() ​

ts
render(): typeof noChange | TemplateResult | typeof nothing;

Defined in: packages/lit-ui-router/dist/ui-view.d.ts:311

The routed component's template, or nothing while the fallback set stands in the light DOM on its own.

Returns ​

typeof noChange | TemplateResult | typeof nothing

Inherited from ​

UiView.render


renderLight() ​

ts
renderLight(): typeof noChange;

Defined in: packages/lit-ui-router-ssr/src/served-view.ts:150

Answers the uiViewSlot part with noChange, so the render that reaches it leaves this view's own nodes where they stand.

Returns ​

typeof noChange