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 66
66
67
67
let current = $derived (workspace .current_compiled );
68
68
69
+ let resultTab: Viewer ;
70
+
69
71
// TODO this effect is a bit of a code smell
70
72
$effect (() => {
71
73
if (current ?.error ) {
189
191
<button class =" active" >Markdown</button >
190
192
{:else }
191
193
<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 >
192
203
<button aria-current ={view === ' js' } onclick ={() => (view = ' js' )}>JS output</button >
193
204
<button aria-current ={view === ' css' } onclick ={() => (view = ' css' )}>CSS output</button >
194
205
<button aria-current ={view === ' ast' } onclick ={() => (view = ' ast' )}>AST output</button >
199
210
<!-- component viewer -->
200
211
<div class ="tab-content" class:visible ={! is_markdown && view === ' result' }>
201
212
<Viewer
213
+ bind:this ={resultTab }
202
214
bind:error ={runtimeError }
203
215
{status }
204
216
{relaxed }
278
290
&[aria-current ='true '] {
279
291
border-bottom : 1px solid var (--sk-fg-accent );
280
292
}
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
+ }
281
305
}
282
306
283
307
.tab-content {
Original file line number Diff line number Diff line change 231
231
}
232
232
});
233
233
234
+ export const reset = () => {
235
+ if (ready ) apply_bundle (bundle );
236
+ };
237
+
234
238
$effect (() => {
235
239
if (injectedCSS && proxy && ready ) {
236
240
proxy .eval (
You can’t perform that action at this time.
0 commit comments