Skip to content

v0.4.4

Latest

Choose a tag to compare

@olibaron olibaron released this 11 Sep 09:35

Fixed

A finished block settles to a plain render once, after the fade it started has run. A streamed block wore the animated shape for its whole life; the closed render then replaced it with markup that carried no animation at all. The words had finished fading and did not move, but the swap itself was visible everywhere else — the code gutter was rebuilt from scratch with every line number restarting its fade, and a table's last row jumped from partial opacity to full in a single frame.

Each block kind now books one settled pass, a second after it closes, which is when its fade has finished and the swap is therefore invisible:

  • MarkdownCode schedules the pass instead of swapping children inside render(), and a flag — not the children — decides whether it has been applied, so a settle that produced nothing to adopt cannot re-arm it; reset() cancels one still booked, and a block that was never streaming books none at all;
  • line numbers are handed the code cache's tally in both phases, since the settled tree holds the same lines, and remember the last tally: a caller that withdraws it can no longer collapse the gutter to the empty-state entry and remount every line;
  • tables and markup take the same pass from the renderer, rebuilt from a cache of its own so a later block cannot race it;
  • a finished block carries no data-animate-word, data-animate-key or data-animate-marker. Its frame is byte-identical to the same document streamed with animation: false, and blocks already settled are never re-passed when new ones stream.

Toolbar tooltip CSS is no longer bundled. tippy.js became an optional peer in 0.4.2 so that a consumer which never renders a toolbar would not pay for it, but the stylesheet still inlined tippy's base CSS: every consumer shipped it, and the build in turn needed the package installed, which nothing did — npm run build could not pass from a clean npm ci.

The main stylesheet now carries only the toolbar skin and imports nothing from node_modules. A host that renders toolbars imports tippy's own sheet beside the one it already imports for KaTeX:

import "@aeven-ai/hypermarkdown/styles.css";
import "tippy.js/dist/tippy.css";

The built dist/hypermarkdown.css drops by the 1.4 kB tippy sheet, from 46 478 to 45 064 bytes, and the build assertion still guards the skin. tippy.js stays a peer and a devDependency, exactly as KaTeX does: tsc resolves its types and the tooltip loader test needs the runtime.

The word and marker fades also drop will-change: opacity, which promoted a compositor layer per word for no measured gain.

Compatibility

No API change. A host that renders block toolbars needs one extra stylesheet import — tippy.js/dist/tippy.css — and without it the toolbars still work, with the tips simply losing their positioning and sizing. Coverage stays at 100%. Patch release.