Reference

@reckona/mreact-reactive-dom

22 public exports.

Function

FunctionbindEventfunction bindEvent<K>(element: HTMLElement, type: K, handler: (event: HTMLElementEventMap[K]): void, options?: BindEventOptions): DisposeBinds an event handler to an element and returns a disposer.FunctionbindListfunction bindList<T>(parent: ParentNode, marker: ChildNode, items: (): readonly T[], renderItem: (item: T, index: number, items: readonly T[]): RenderValue, options: BindListOptions<T>): DisposeBinds a reactive list of items to DOM nodes before a marker node.FunctionbindPropfunction bindProp(element: Element, name: string, value: (): unknown): DisposeBinds one DOM property or attribute to a reactive value.FunctionbindSelectorClassfunction bindSelectorClass<TValue, TKey>(element: Element, className: string, selector: Selector<TValue, TKey>, key: TKey, options?: BindSelectorClassOptions): DisposeFunctionbindSpreadPropsfunction bindSpreadProps(element: HTMLElement, props: (): Record<string, unknown> | null | undefined): DisposeBinds a reactive object of spread props to an element.FunctionbindStaticKeyedSingleNodeListfunction bindStaticKeyedSingleNodeList<T, TNode>(parent: ParentNode, marker: ChildNode, items: (): readonly T[], renderItem: SingleNodeRenderer<T, TNode>, options: BindStaticKeyedSingleNodeListOptions<T, TNode>): DisposeBinds a static keyed list where each item renders exactly one DOM node.FunctionbindTextfunction bindText(node: Text, value: ReadonlyCell<unknown> | (): unknown, options?: BindTextOptions): DisposeBinds a text node to a reactive value.FunctionbindTextBatchfunction bindTextBatch(nodes: readonly Text[], value: (): unknown, options?: BindTextBatchOptions): DisposeBinds multiple text nodes to the same reactive value.FunctioncreateListfunction createList<T>(items: (): readonly T[], renderItem: (item: T, index: number, items: readonly T[]): RenderValue, options?: { key?: (item: T, index: number, items: readonly T[]): unknown; nestedObjectFallback?: boolean }): ListRenderValue<T>Creates a list render value for dynamic insertion.FunctioncreateRootfunction createRoot(container: ParentNode, render: (): RenderValue): DisposeMounts a reactive render function into a DOM container.FunctioncreateTemplatefunction createTemplate(html: string): (): DocumentFragmentCompiles an HTML string into a reusable document fragment factory.FunctioncreateTemplateElementfunction createTemplateElement<TElement>(html: string): (): TElementCompiles a single-root HTML string into a reusable element factory.FunctioninsertDynamicfunction insertDynamic(parent: ParentNode, marker: ChildNode, value: (): RenderValue): DisposeInserts and updates a dynamic render value before a marker node.FunctionwithEventBindingMetadatafunction withEventBindingMetadata<T>(fn: (): T): TFunctionwithPropBindingMetadatafunction withPropBindingMetadata<T>(fn: (): T): T

Interface

InterfaceBindEventOptionsinterface BindEventOptionsOptions for binding DOM events through the reactive DOM runtime.InterfaceBindSelectorClassOptionsinterface BindSelectorClassOptionsInterfaceBindStaticKeyedSingleNodeListOptionsinterface BindStaticKeyedSingleNodeListOptionsInterfaceListRenderValueinterface ListRenderValueDeclarative list render value consumed by insertDynamic and bindList.

Type Alias

Type AliasDisposetype Dispose = (): voidDisposer function returned by reactive DOM bindings.Type AliasRenderValuetype RenderValue = Node | string | number | boolean | null | undefined | ListRenderValue | readonly RenderValue[]Value that can be normalized into DOM nodes by the reactive DOM runtime.

Variable

VariableLIST_RENDER_VALUEconst LIST_RENDER_VALUE: typeof LIST_RENDER_VALUEMarker symbol used to distinguish list render values from plain objects.