Mapper plugins
Mappers receive reactive HAST content blocks and return another reactive block list. Unlike a one-time tree transform, a mapper can keep updating the output between incoming text chunks. Smooth output is one example.
Declare a mapper
This mapper limits a preview to its first few blocks:
Add mappers to the Core inputs from the quick start. The returned list follows source changes, and its blocks retain their individual content subscriptions. count is a plain constructor option for this mapper.
once builds the state flow once; useMap describes how it changes. A mapper may return a readable closure or a Stative descriptor.
Do not destroy or mutate upstream blocks. If you create derived blocks or subscriptions, register them with Stative's lifecycle so they are released with the mapper.
Configure smooth output
The preset Smooth accepts reactive options. Convert an external state to a readable closure before placing it inside the plugin options:
After passing mappers to Core, call enabled.next(false) to show the remaining content immediately. At the end of the content lifecycle, destroy Core, then active and enabled.
Built-in plugins
Core includes these plugins by default; no registration is needed.
PRESET_MAPPER_PLUGINS, exported from @fluxdown/core-presets/mapper.
Both are disabled by default in Core. To enable them in your renderer, see Enable smooth output.