Merge pull request #23257 from Algorithm5838/perf/text-token-css-animation
perf: replace JS transition with CSS animation in TextToken
This commit is contained in:
+13
@@ -243,6 +243,19 @@ select {
|
|||||||
animation: smoothFadeIn 0.2s forwards;
|
animation: smoothFadeIn 0.2s forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@keyframes fade-in-token {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fade-in-token {
|
||||||
|
animation: fade-in-token 100ms ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
.katex-mathml {
|
.katex-mathml {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,17 +19,3 @@
|
|||||||
toast.success($i18n.t('Copied to clipboard'));
|
toast.success($i18n.t('Copied to clipboard'));
|
||||||
}}>{unescapeHtml(token.text)}</code
|
}}>{unescapeHtml(token.text)}</code
|
||||||
>
|
>
|
||||||
|
|
||||||
<style>
|
|
||||||
@keyframes fade-in-token {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.fade-in-token {
|
|
||||||
animation: fade-in-token 100ms ease-out;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|||||||
@@ -1,18 +1,13 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { fade } from 'svelte/transition';
|
|
||||||
|
|
||||||
export let token;
|
export let token;
|
||||||
export let done = true;
|
export let done = true;
|
||||||
|
|
||||||
let texts = [];
|
|
||||||
$: texts = (token?.raw ?? '').split(' ');
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if done}
|
{#if done}
|
||||||
{token?.raw}
|
{token?.raw}
|
||||||
{:else}
|
{:else}
|
||||||
{#each texts as text}
|
{#each (token?.raw ?? '').split(' ') as text}
|
||||||
<span class="" transition:fade={{ duration: 100 }}>
|
<span class="fade-in-token">
|
||||||
{text}{' '}
|
{text}{' '}
|
||||||
</span>
|
</span>
|
||||||
{/each}
|
{/each}
|
||||||
|
|||||||
Reference in New Issue
Block a user