package mosaic

  1. Overview
  2. Docs
Terminal UI framework for OCaml with The Elm Architecture

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.1.0.tbz
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9

doc/mosaic/Mosaic/Reconciler/index.html

Module Mosaic.ReconcilerSource

The virtual-DOM reconciler used by run.

Note. This module is part of the internal implementation and its interface may change between versions.

Reconciler for diffing and patching Vnode.t trees.

The reconciler bridges the declarative Vnode.t tree produced by a view function and the imperative Renderable.t tree. On each render call it flattens the vnode tree, matches fibers by key (preferred) then by position, reuses or creates Box and Text nodes, destroys unmatched fibers, and commits child placement. Vnode.Embed nodes are attached but bypass the reconciler lifecycle.

Fiber tracking and instance management are internal; this module exposes only the container, render, and unmount operations.

Types

Sourcetype t

The type for a mutable reconciler bound to a container node. Tracks the current fiber tree between render calls.

Constructors

Sourceval create : container:Mosaic_ui.Renderable.t -> t

create ~container is a reconciler that manages children of container. The reconciler starts with an empty fiber tree; existing children of container are not adopted.

Accessors

Sourceval container : t -> Mosaic_ui.Renderable.t

container r is the container node of r.

Reconciliation

Sourceval render : t -> unit Mosaic_ui.Vnode.t -> unit

render r vnode reconciles vnode against the previous fiber tree, applying minimal mutations to the renderable tree rooted at container r. Fibers unmatched in the new tree are destroyed and their renderable nodes removed. Ref callbacks (Vnode.attrs.ref) fire for newly created elements. Requests a render on container r after reconciliation completes.

Sourceval unmount : t -> unit

unmount r destroys all fibers and detaches all embedded nodes, leaving container r empty. Requests a render on container r after cleanup. r may be reused after unmounting.