Attribute bindings
AttrPartNodeclass
Represents a dynamic attribute (e.g.
src="${url}").
Attribute syntax
Attributetype-alias
Represents every static or dynamic attribute-like AST node.
AttributeNodeclass
Represents a static attribute (e.g.
class="foo").
Boolean attributes
BooleanNodeclass
Represents a boolean attribute (e.g.
disabled).BooleanPartNodeclass
Represents a dynamic boolean attribute (e.g.
?disabled="${isDisabled}").
Buffered HTML
renderToHtmlStringfunction
Renders a stream of
RenderEvents into a single HTML string.This is a convenience function that collects all events from
renderToHtmland joins them into a single string. It is an Effect that resolves when the stream completes.
Class contributions
ClassNamePartNodeclass
Represents a dynamic class name part (e.g.
class="${classes}").SparseClassNameNodeclass
Represents a sparse class name (e.g.
class="foo ${bar}").
Comment bindings
CommentPartNodeclass
Represents a dynamic comment part.
Comment content
Commenttype-alias
Represents static, dynamic, or sparse comment content.
CommentNodeclass
Represents a static comment.
DOM adoption
attemptHydrationfunction
Locates a compatible SSR template range for an advanced render context.
DOM document selection
CurrentRenderDocumentvariable
A service that provides the
Documentinterface for rendering.Defaults to the global
documentobject. This can be overridden for testing or environments where the global document is not available or desired.
DOM mounting
rendervariable
Mounts any
Renderableto a specific DOM element.This function lifts primitives, arrays, Effects, Streams, and Fx values into a render stream and keeps the target DOM element updated. It handles:
- Mounting the initial content.
- Updating the content as new events are emitted.
- Hydrating the content if hydration context is provided.
DOM output inference
ToRenderedtype-alias
Computes the DOM value represented by a nullable
RenderEvent.
DOM serialization
toHtmlfunction
Converts a
Renderedvalue to an HTML string.
DOM template interpretation
DomRenderTemplatevariable
A Layer that provides the
RenderTemplateservice implemented for DOM rendering.This layer enables templates to be rendered as actual DOM nodes. It handles:
- Parsing templates into DOM fragments.
- Caching parsed templates.
- Hydrating from existing DOM (if applicable).
- Setting up event listeners.
- Managing fine-grained updates to DOM nodes via
Fxstreams.
Dataset contributions
DataPartNodeclass
Represents a data attribute part (e.g.
data-foo="${value}").
Default action control
EventHandler.preventDefaultfunction · Re-export
Modifies an
EventHandlerto callpreventDefault()on the event.
Delegated event sources
EventSourceinterface
An interface for managing event listeners on DOM nodes.
It abstracts the process of adding and removing event listeners, ensuring that they are properly cleaned up when the scope is closed or the element is removed.
makeEventSourcefunction
Creates a new
EventSource.The created
EventSourcecan efficiently manage multiple event listeners, grouping them by event type and handling setup/teardown lifecycles.
Document structure
DocTypeclass
Represents a parsed DOCTYPE declaration.
Dynamic HTML chunks
HtmlPartChunkinterface
A chunk representing a dynamic part (interpolation).
Dynamic child positions
NodePartclass
Represents a dynamic insertion point within the node structure (e.g.
<div>${content}</div>).
Dynamic positions
PartNodetype-alias
Represents a single dynamic interpolation part in the template AST.
Element references
RefPartNodeclass
Represents a reference capture (e.g.
ref="${ref}").
Element structure
ElementNodeclass
Represents an HTML, SVG, MathML, or foreign-content element with children.
ParentNodetype-alias
Represents an AST node that can structurally contain template children.
SelfClosingElementNodeclass
Represents a self-closing HTML element (e.g.
<br />,<img />).
Event handler creation
EventHandler.makefunction · Re-export
Creates a new
EventHandler.
Event handler protocol
EventHandler.EventHandlerTypeIdvariable · Re-export
The global symbol used to identify
EventHandlervalues across module copies.EventHandler.isEventHandlerfunction · Re-export
Checks if a value is an
EventHandler.
Event handlers
EventHandler.EventHandlerinterface · Re-export
Represents a DOM event handler that returns an Effect.
It encapsulates the event handler logic and any options (like
preventDefault,once, etc.) that should be applied when the event is triggered.
Existing range boundaries
fromCommentsvariable
Creates a published advanced Wire from a fragment and exact boundary comments.
Frame scheduling
RequestAnimationFrameRenderQueueclass
A RenderQueue that schedules tasks using
requestAnimationFrame. Good for visual updates that should happen before the next repaint.
HTML chunk assembly
HtmlChunksBuilderclass
Advanced mutable builder used by the published template-to-chunk compiler.
HTML chunk protocol
HtmlChunktype-alias
Represents a piece of a pre-compiled HTML template.
Chunks allow the renderer to stream static parts of the HTML immediately while waiting for dynamic parts to be resolved.
HTML compilation
templateToHtmlChunksfunction
Converts a parsed
Templateinto a sequence ofHtmlChunks. This optimization pre-calculates the static HTML strings to minimize work at render time.
HTML rendering policy
StaticRenderingvariable
A boolean service that indicates whether the current rendering context is static.
If
true, the HTML renderer will optimize for static output, potentially skipping dynamic placeholder generation or other interactive features not needed for static HTML.
HTML transport recognition
isHtmlRenderEventfunction
Checks if a value is an
HtmlRenderEvent.
HTML transport trust
HtmlRenderTransportBrandvariable
The published advanced brand identifying renderer-owned HTML transport.
Handler failure recovery
EventHandler.catchCausevariable · Re-export
Recovers from errors in the
EventHandler.
Handler failures
EventHandler.Errortype-alias · Re-export
Extracts the typed error channel of an
EventHandler.
Handler normalization
EventHandler.fromEffectOrEventHandlerfunction · Re-export
Helper to ensure a value is an
EventHandler.If the input is already an
EventHandler, it is returned as is. If it is anEffect, it is wrapped in anEventHandlerthat ignores the event argument.
Handler requirements
EventHandler.Servicestype-alias · Re-export
Extracts the Effect service requirements of an
EventHandler.
Handler service provision
EventHandler.providevariable · Re-export
Provides services to the
EventHandler.This allows you to inject dependencies into the effect returned by the event handler.
Hydratable HTML rendering
HtmlRenderTemplatevariable
A Layer that provides the
RenderTemplateservice implemented for HTML string generation.Using this layer enables templates to be rendered as HTML strings (e.g., for SSR) rather than DOM nodes. It sets the
RefSubject.CurrentComputedBehaviorto"one", indicating a single-pass render approach typical for HTML generation.
Hydration context
HydrateContexttype-alias
Advanced renderer state describing the current hydration range.
makeHydrateContextvariable
Creates a hydration context starting from a root element.
This context allows the renderer to “attach” to existing DOM nodes (SSR output) instead of creating new ones.
Hydration markers
addTemplateHashfunction
Wraps the HTML chunks with comments containing the template hash. This is crucial for hydration to identify which template rendered a section of HTML.
Idle scheduling
RequestIdleCallbackRenderQueueclass
A RenderQueue that schedules tasks using
requestIdleCallback. Good for low-priority background work.
Immediate scheduling
SyncRenderQueueclass
A RenderQueue that executes tasks synchronously and immediately.
Keyed collection protocol
ManyTypeIdvariable
Identifies a keyed collection descriptor without starting its source.
isManyfunction
Recognizes a descriptor before a target chooses its keyed rendering path. This guard does not subscribe to the collection or validate its current keys; key uniqueness is checked when the target receives an array.
Keyed collection rendering
Manyinterface
A collection source, stable key function, and per-item view supplied to a renderer. Describing the collection acquires nothing; the active target owns subscription and child lifetimes.
The DOM target retains each key’s subject and scope across moves. The HTML target consumes an initial collection for finite response output. Construct descriptors with
manyrather than assembling this protocol by hand.manyfunction
Efficiently renders a reactive list of items by using keys to minimize DOM operations and maintain component state.
manyreturns a renderer descriptor rather than anFx. The active renderer consumes its source directly and can therefore retain keyed entries without flattening each child back through a generic collection stream.
Keyed hydration markers
MANY_HOLEvariable
Produces the legacy closing marker for an already encoded keyed-list hole.
Listener lifetime
EventHandler.oncefunction · Re-export
Modifies an
EventHandlerto run only once.
Mixed scheduling
MixedRenderQueueclass
A composite RenderQueue that directs tasks to different queues based on their priority.
- High priority: Sync
- Medium priority: RAF (or setTimeout fallback)
- Low priority: IdleCallback (or setTimeout fallback)
Native DOM output
DomRenderEventinterface
A RenderEvent containing DOM nodes.
Native DOM recognition
isDomRenderEventfunction
Checks if a value is a
DomRenderEvent.
Native element recognition
isElementfunction
Checks if a rendered node is an
Element.isHtmlElementfunction
Checks if a rendered node is an
HTMLElement.isSvgElementfunction
Checks if a rendered node is an
SVGElement.
Native event bindings
EventPartNodeclass
Represents an event listener part (e.g.
@click="${handler}").
Native event control
EventHandler.handleEventOptionsfunction · Re-export
Applies event options to a native DOM event.
Native event types
EventHandler.EventOftype-alias · Re-export
Extracts the native event type accepted by an
EventHandler.
Native listener policy
EventHandler.EventOptionstype-alias · Re-export
Options for applying native event behavior before an Effect handler runs.
EventHandler.passivefunction · Re-export
Modifies an
EventHandlerto be passive (improves scrolling performance).
Native node recognition
isAttrfunction
Checks if a rendered node is an
Attrnode.isCommentfunction
Checks if a rendered node is a
Commentnode.isDocumentFragmentfunction
Checks if a rendered node is a
DocumentFragment.isNodefunction
Checks if a rendered node is a standard DOM
Node.isTextfunction
Checks if a rendered node is a
Textnode.
Native output shapes
Renderedtype-alias
A union type representing all possible rendered values. Can be a single Node, a DocumentFragment, a Wire, or an array of these.
Rendered.Elementstype-alias
Extract the elements from a Rendered type
Rendered.Valuetype-alias
Single rendered value type.
Rendered.Valuestype-alias
Extract the values from a Rendered type
Output collection recognition
isArrayfunction
Checks if a rendered value is an array of nodes.
Persistent DOM ranges
Wireinterface
Wire is a data type that serves as a persistent, reusable DocumentFragment.
Unlike a standard
DocumentFragment, which empties itself when appended to the DOM, aWireretains references to its child nodes. This allows it to be moved around the DOM or updated without losing track of its content.It is used internally to manage the lifecycle of template instances.
persistentvariable
Creates a Wire from a DocumentFragment.
If the fragment has only one child, that child is returned directly. If it has multiple children, they are wrapped in a
Wirestructure (bounded by comments) to allow them to be treated as a single unit.
Propagation control
EventHandler.stopImmediatePropagationfunction · Re-export
Modifies an
EventHandlerto callstopImmediatePropagation()on the event.EventHandler.stopPropagationfunction · Re-export
Modifies an
EventHandlerto callstopPropagation()on the event.
Property bindings
PropertyPartNodeclass
Represents a property assignment (e.g.
.value="${value}").
Range recognition
isWirefunction
Checks if a rendered node is a
Wire.
Range reconciliation
diffablevariable
Creates the advanced node adapter used by local DOM reconciliation.
Range traversal
getAllSiblingsBetweenfunction
Gets all sibling nodes between exact range boundaries, excluding both markers.
Render priorities
RenderPriorityvariable
Defines priority levels for rendering tasks.
Render scheduling
CurrentRenderPriorityvariable
A service that provides the default priority for rendering tasks.
The default value is
RenderPriority.Raf(10), which typically schedules updates to occur before the next repaint.CurrentRenderQueuevariable
A service that manages the queue of DOM updates.
It ensures that DOM updates are batched and executed efficiently, often coordinating with browser painting cycles (e.g., via
requestAnimationFrame).
Renderable failures
Renderable.Errortype-alias
Extracts the error type from a Renderable type.
Renderable.ErrorFromObjecttype-alias
Traverse all keys in an object and extract the error from each value. If the value is a function, extract the error from the return type of the function.
Renderable inputs
Renderabletype-alias
Represents any value that can be rendered into a template.
This includes:
- Primitives (string, number, boolean, null, undefined)
- Arrays of Renderables
- Effects that produce a Renderable
- Streams (Fx or Stream) that emit Renderables
- Objects (typically for setting properties or attributes)
Renderable.Anytype-alias
A type alias for any Renderable value with any error/context.
Renderable normalization
liftRenderableToFxfunction
Converts any Renderable into an Fx while preserving its nested errors and service requirements.
Renderable output inference
Renderable.Successtype-alias
Recursively computes the terminal value emitted by a Renderable.
Renderable producers
Renderable.Effectstype-alias
The Effect ecosystem producers recognized as reactive Renderables.
Renderable requirements
Renderable.Servicestype-alias
Extracts the required services from a Renderable type.
Renderable.ServicesFromObjecttype-alias
Traverse all keys in an object and extract the services from each value. If the value is a function, extract the services from the return type of the function.
Rendered element traversal
getElementsfunction
Extracts all Elements from a
Renderedvalue.
Renderer output protocol
RenderEventtype-alias
Represents the result of a rendering operation. Can be either a DOM-based event (containing actual Nodes) or an HTML-based event (containing strings).
RenderEventTypeIdvariable
The global discriminant key shared by DOM and HTML render events.
Renderer output recognition
isRenderEventfunction
Checks if a value is a
RenderEvent.
Scheduled render work
RenderQueueclass
An abstract base class for managing the execution of rendering tasks. It allows prioritizing updates and scheduling them using different strategies (e.g.,
requestAnimationFrame,requestIdleCallback,setTimeout, or synchronous execution).
Scheduling protocol
RenderQueueTypeIdvariable
The nominal key implemented by every Typed render queue.
Serialized HTML output
HtmlRenderEventinterface
A RenderEvent containing an HTML string.
Sparse HTML chunks
HtmlSparsePartChunkinterface
A chunk representing a sparse part (mixed static/dynamic text).
Sparse attributes
SparseAttrNodeclass
Represents a sparse attribute (e.g.
class="foo ${bar}").
Sparse comments
SparseCommentNodeclass
Represents a sparse comment.
Sparse expressions
SparsePartNodetype-alias
Represents a “sparse” part, which is a text or attribute value composed of mix of static text and dynamic parts (e.g.
id="prefix-${id}").
Sparse text
SparseTextNodeclass
Represents sparse text content (e.g.
Hello ${name}!).
Spread bindings
PropertiesPartNodeclass
Represents a spread of properties (e.g.
${...props}).
Spread serialization
isSerializableSpreadKeyfunction
Reports whether a dynamic spread key may be serialized into SSR HTML.
Static HTML chunks
HtmlTextChunkinterface
A static text chunk.
Static HTML rendering
StaticHtmlRenderTemplatevariable
A variant of
HtmlRenderTemplatethat enables static rendering optimizations.This layer provides the
RenderTemplateservice for HTML generation but also setsStaticRenderingtotrue, enabling optimizations for static content.
Streaming HTML
renderToHtmlfunction
Renders a stream of
RenderEvents into a stream of HTML strings.This function transforms the output of a template rendering process (which produces
RenderEvents) into a stream of strings suitable for HTML output (e.g., for Server-Side Rendering).
Template authoring
htmlfunction
The main template tag function.
It creates a reactive
Fxstream that renders the template. The actual rendering logic depends on the providedRenderTemplateservice.
Template interpretation
RenderTemplateclass
A service that defines how templates are rendered.
Different implementations can be provided for different environments (e.g.,
DomRenderTemplatefor browsers,HtmlRenderTemplatefor SSR).
Template parsing
parsefunction
Parses a template string array (from a tagged template literal) into a reusable
Templateobject.This parser handles:
- Standard HTML structure (elements, attributes, text, comments).
- Custom part syntax for interpolation (e.g.,
${value}). - Special attributes like
.property,@event,?boolean. - Self-closing tags and text-only elements (script, style).
Each call returns a new
Templateinstance containing the static AST and dynamic part locations. Render targets cache their compiled DOM fragments or HTML chunks independently by template-literal identity.
Template run context
TemplateContexttype-alias
Advanced per-template DOM rendering state used by renderer extensions.
Template structure
Terminal renderable values
Renderable.Primitivetype-alias
The basic primitive types that can be rendered directly.
Text bindings
TextPartNodeclass
Represents a dynamic text part (e.g.
${text}).
Text content
Text contexts
TextOnlyElementclass
Represents an element that contains only text (e.g.
<script>,<style>).
Timer scheduling
SetTimeoutRenderQueueclass
A RenderQueue that schedules tasks using
setTimeout(..., 0).
namespace
EventHandlernamespace · Re-export
Public namespace exposed as EventHandler from @typed/template.