Module / v1.0.0-beta.13

@typed/template/WebComponent

12 unique exports available through this public import path, including their members and aliases.

import * as WebComponent from "@typed/template/WebComponent";

Web Components

  • CurrentShadowRoot

    variable

    Selects an open shadow root by default. Provide false for light DOM. The selection is captured when the registration layer or server view runs.

  • Definition

    interface

    An inert definition shared by browser registration and server rendering. Schemas supply optionality and defaults. Inputs are parent-owned; local writable state can be created in an Effect returned by render.

  • Element

    interface

    A registered element accepts typed input through its props property. Assign a new object to update; nested mutation is not observed.

  • Fields

    type-alias

    Schema fields for attributes and dot-prefixed DOM properties. Attribute schemas encode strings; property schemas accept decoded values.

  • Input

    type-alias

    Typed initial values; only schema-optional or defaulted inputs may be omitted.

  • Props

    type-alias

    Decoded inputs, with the dot removed from property names.

  • RegistrationError

    class

    A browser registry could not accept a definition.

  • RenderProps

    type-alias

    Each field is a read-only computed value, including optional fields.

  • ShadowRootOptions

    type-alias

    Shadow settings supported by both attachShadow and declarative shadow DOM.

  • make

    function

    Defines a custom element without reading any browser globals. Custom-element names use a conservative ASCII subset of the HTML grammar.

  • register

    function

    Registers in CurrentRenderDocument’s registry and captures the layer’s services. Provides no services; use the custom element through ordinary HTML templates. The layer’s Scope owns every connected instance. Closing it stops rendering and deactivates this class; browsers cannot unregister a custom element. Disconnect interrupts subscriptions/listeners; reconnect waits for cleanup before starting a fresh view. Failures dispatch typed:error with a Cause in CustomEvent.detail. Native template event handlers work without an adapter. Shadow roots retain slotted light children. Light mode owns all host children.

  • server

    function

    Produces a server Renderable with a custom-element host and hydratable content. Shadow mode emits declarative shadow DOM followed by optional slot content. Light mode owns all host children and rejects supplied slot content. Only properties declared in the attribute schema are serialized; match CurrentShadowRoot on the client. Body and slot chunks retain their order, errors, services, and calling Scope. Use Typed’s renderToHtml to stream or renderToHtmlString to collect the result.