|
4 | 4 | import RcJsInterpreter from "./rc-js-interpreter.svelte"; |
5 | 5 | import { Icon, Sparkles } from "svelte-hero-icons"; |
6 | 6 | import Loader from "$lib/common/spinners/Loader.svelte"; |
| 7 | + import { slide, fade } from "svelte/transition"; |
| 8 | + import { cubicOut } from "svelte/easing"; |
7 | 9 |
|
8 | 10 | /** |
9 | 11 | * @type {{ |
|
55 | 57 | class="thinking-toggle" |
56 | 58 | onclick={() => isThinkingExpanded = !isThinkingExpanded} |
57 | 59 | > |
58 | | - <span class="thinking-sparkle"><Icon src={Sparkles} solid size="16" /></span> |
| 60 | + <span class="thinking-sparkle" class:pulsing={isThinking}><Icon src={Sparkles} solid size="16" /></span> |
59 | 61 | <span class="font-bold">{'Thinking'}</span> |
60 | 62 | {#if isThinking} |
61 | 63 | <Loader disableDefaultStyles size={14} color="#4285f4" containerStyles="display: flex; align-items: center;" /> |
|
66 | 68 | {/if} |
67 | 69 | </button> |
68 | 70 | {#if isThinkingExpanded} |
69 | | - <div class="thinking-content"> |
70 | | - <Markdown containerStyles="color: #444 !important;" text={thinkingText} rawText /> |
| 71 | + <div |
| 72 | + class="thinking-content" |
| 73 | + transition:slide={{ duration: 200, easing: cubicOut }} |
| 74 | + > |
| 75 | + <div in:fade={{ duration: 200, delay: 80 }}> |
| 76 | + <Markdown containerStyles="color: #444 !important;" text={thinkingText} rawText /> |
| 77 | + </div> |
71 | 78 | </div> |
72 | 79 | {/if} |
73 | 80 | </div> |
|
110 | 117 | align-items: center; |
111 | 118 | } |
112 | 119 |
|
| 120 | + .thinking-sparkle.pulsing { |
| 121 | + animation: thinking-sparkle-pulse 1.4s ease-in-out infinite; |
| 122 | + } |
| 123 | +
|
| 124 | + @keyframes thinking-sparkle-pulse { |
| 125 | + 0%, 100% { |
| 126 | + opacity: 1; |
| 127 | + transform: scale(1); |
| 128 | + } |
| 129 | + 50% { |
| 130 | + opacity: 0.55; |
| 131 | + transform: scale(1.15); |
| 132 | + } |
| 133 | + } |
| 134 | +
|
113 | 135 | .thinking-chevron { |
114 | 136 | font-size: 1em; |
115 | | - transition: transform 0.2s ease; |
| 137 | + transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1); |
116 | 138 | display: inline-block; |
117 | 139 | } |
118 | 140 |
|
|
0 commit comments