3.14.0
This is a significant release, with major refactoring to the terminal renderer.
Notable changes:
- Faster, better terminal renderer (see below)
- New
boldIsBrightoption (see below) - Better CSS isolation from the host page, preventing style collisions/interference (#302)
- Major improvements to the test suite (better coverage, more stable runs)
New terminal renderer
The terminal renderer is now 2x faster, resulting in reduced (typically zero) frame skips, and lower CPU and memory usage. In practice, the playback is smoother (up to 60 FPS, since there's no fixed frame rate) even for the most demanding animations.
There are 4 changes in this new implementation that contribute to better performance:
- background and block symbol (standard ASCII blocks, sextant glyphs, block mosaics) rendering has been moved from DOM text nodes to
<canvas>, - serialization/deserialization overhead for Rust-to-JS data transfer has been minimized by using direct WASM memory access (via DataView and typed arrays),
- the algorithm for grouping text spans based on their attributes (color, italic, bold, etc) has been improved, largely enabled by moving background rendering from the DOM text layer,
- text nodes in DOM are now updated via direct DOM manipulation, while previously it went through Solid.js machinery.
Other than improving performance, moving block symbol rendering to a crisp, pixelated canvas resulted in perfect alignment of block chars with the background. No more visual glitches for ANSI art!
Last but not least, 4 Powerline symbols (2 arrows, 2 triangles) and the smooth mosaic character set are now rendered as SVG instead of relying on fonts, giving them better alignment and making those glyphs look consistent across browsers/platforms.
Check out these cool demos to see the new renderer in action:
https://asciinema.org/a/648882 - Amiga themed Terminal Multiplexer
https://asciinema.org/a/370006 - Impossible Flappy
https://asciinema.org/a/150828 - term81 - voxel
https://asciinema.org/a/150843 - term81 - tunnel
https://asciinema.org/a/141032 - cbeams
https://asciinema.org/a/423181 - Tetris
https://asciinema.org/a/335029 - Gorched
New boldIsBright option
Since the early days, the player assumed the classic (legacy) logic of "when text has the bold attribute it should be rendered in high-intensity/bright variant of its color", e.g., bold + color 2 was rendered as bold + color 10. This logic was often used by terminal emulators in the past, and many of them provided a setting for enabling/disabling this behavior.
With this version, the "bold makes it bright" is disabled by default (boldIsBright: false), but it can be enabled by setting boldIsBright: true when initializing the player. Whether you should use it or not depends on your terminal and its corresponding setting. Many modern terminal emulators don't enable this behavior by default, so when in doubt, just leave it off.