namespace / @typed/template

WebComponent

Public namespace exposed as WebComponent from @typed/template.

Package version
1.0.0-beta.13
Category
namespace

Import

import { WebComponent } from "@typed/template";

This public exposure is a re-export. Its import path is supported; declaration documentation is shared with the other public exposures below.

Signatures

export * as WebComponent from "./WebComponent.js";

Members

  • WebComponent.CurrentShadowRoot

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

  • WebComponent.Definition

    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.

  • WebComponent.Element

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

  • WebComponent.Fields

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

  • WebComponent.Input

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

  • WebComponent.Props

    Decoded inputs, with the dot removed from property names.

  • WebComponent.RegistrationError

    A browser registry could not accept a definition.

  • WebComponent.RenderProps

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

  • WebComponent.ShadowRootOptions

    Shadow settings supported by both attachShadow and declarative shadow DOM.

  • WebComponent.make

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

  • WebComponent.register

    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.

  • WebComponent.server

    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.

Source