File tree Expand file tree Collapse file tree 4 files changed +36
-0
lines changed
packages/repl/src/lib/Output Expand file tree Collapse file tree 4 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 6666
6767 let current = $derived (workspace .current_compiled );
6868
69+ let resultTab: Viewer ;
70+
6971 // TODO this effect is a bit of a code smell
7072 $effect (() => {
7173 if (current ?.error ) {
189191 <button class =" active" >Markdown</button >
190192 {:else }
191193 <button aria-current ={view === ' result' } onclick ={() => (view = ' result' )}>Result</button >
194+ <button
195+ aria-current ={view === ' result' }
196+ aria-label =" Reset result"
197+ class =" reset-result"
198+ onclick ={() => {
199+ view = ' result' ;
200+ resultTab .reset ();
201+ }}
202+ ></button >
192203 <button aria-current ={view === ' js' } onclick ={() => (view = ' js' )}>JS output</button >
193204 <button aria-current ={view === ' css' } onclick ={() => (view = ' css' )}>CSS output</button >
194205 <button aria-current ={view === ' ast' } onclick ={() => (view = ' ast' )}>AST output</button >
199210<!-- component viewer -->
200211<div class ="tab-content" class:visible ={! is_markdown && view === ' result' }>
201212 <Viewer
213+ bind:this ={resultTab }
202214 bind:error ={runtimeError }
203215 {status }
204216 {relaxed }
278290 &[aria-current ='true '] {
279291 border-bottom : 1px solid var (--sk-fg-accent );
280292 }
293+
294+ &.reset-result {
295+ width : 2em ;
296+ vertical-align : bottom ;
297+ background : url (./reset-light.svg ) 50% 50% no-repeat ;
298+ background-size : 1em ;
299+ margin-left : -1ch ;
300+ cursor : pointer ;
301+ :root.dark & {
302+ background-image: url (./reset-dark.svg );
303+ }
304+ }
281305 }
282306
283307 .tab-content {
Original file line number Diff line number Diff line change 231231 }
232232 });
233233
234+ export const reset = () => {
235+ if (ready ) apply_bundle (bundle );
236+ };
237+
234238 $effect (() => {
235239 if (injectedCSS && proxy && ready ) {
236240 proxy .eval (
You can’t perform that action at this time.
0 commit comments