You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The word-fade engine ships with every app, whether or not it animates #681
index.tsx imports createAnimateTimeline and createRenderAnimatePlugin from lib/animate statically. The word-fade engine is therefore in the main bundle of every app, including apps that never set animated. In an app that imports only Streamdown, the engine is about 2.1 KiB gzip with Rolldown and 2.3 KiB with esbuild.
Proposed Solution
Code highlighting, math, CJK and Mermaid are already opt-in plugins. The animation could follow the same pattern:
Build the engine as its own entry, streamdown/animate, which the main bundle reaches only through import().
animated together with plugins={{ animate }} bundles it and animates from the first render.
animated alone loads it on demand, after the component's first commit on the client.
Text renders without the fade until the engine arrives.
The words already on screen when it arrives stay put, so on a cold start the first words of the first animated message appear without the fade.
Components without animated never request it.
createAnimatePlugin stays importable from streamdown.
Alternatives Considered
Making animated require plugins.animate. That's simpler, but it breaks existing code, so it would wait for a major.
Leaving the engine in the main bundle, as it is today.
Use Case
Chat UIs that render settled answers, or that pace text with their own reveal, never use the word fade but ship it with every page that renders Markdown.
Priority
Nice to have
Contribution
I am willing to help implement this feature
Additional Context
I have an implementation with tests and will open a PR after this issue.
Related: #619 (animation lifetime and history), #625 (smooth streaming), #626 (animation effects) and #678 (animation after isAnimating ends) touch the same engine; #663 adds another entry to the package; #680 defers the Mermaid block the same way.
Activity
perf(animate): load the word fade from its own chunk