1
1
<script >
2
2
/* eslint no-useless-escape: "off" */
3
3
4
- import { SvelteToast , toast } from ' $lib'
4
+ import { SvelteToast , toast } from ' $lib/index.js '
5
5
import { tick } from ' svelte'
6
6
import { browser , dev , version } from ' $app/environment'
7
7
import DummyComponent from ' ./Dummy.svelte'
@@ -295,28 +295,20 @@ toast.pop(0)`,
295
295
{
296
296
name: ' RUN CALLBACK ON TOAST REMOVAL' ,
297
297
code: ` toast.push('Wait for it...', {
298
- onpop: (id, details) => {
299
- toast.push('onpop() callback has been executed.', { target: 'new' })
300
- if (details.autoClose) {
301
- console.log('closed automatically')
302
- } else {
303
- console.log('closed by user', details.originalEvent)
304
- }
305
- }
306
- })` ,
307
- run : () =>
298
+ onpop: () => {
299
+ toast.push('onpop() callback has been executed.', { target: 'new' })
300
+ }
301
+ })` ,
302
+ run : () => {
308
303
toast .push (' Wait for it...' , {
309
304
onpop : (id , details ) => {
310
305
toast .push (` <strong><tt>onpop()</tt></strong> callback has been executed.` , {
311
306
target: ' new'
312
307
})
313
- if (details .autoClose ) {
314
- console .log (' closed automatically' )
315
- } else {
316
- console .log (' closed by user' , details .originalEvent )
317
- }
308
+ console .log (id, details)
318
309
}
319
310
})
311
+ }
320
312
},
321
313
{
322
314
name: ' STYLE WITH USER-DEFINED CLASSES' ,
@@ -382,11 +374,11 @@ $: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript')
382
374
/ >
383
375
< / svelte: head>
384
376
385
- < div class = " mx-auto mb-8 mt-8 max-w-3xl px-6 " >
386
- < h1 class = " mb-2 text-center text-4xl font-bold " > svelte- toast< / h1>
377
+ < div class = " prose mx-auto mb-12 mt-6 px-4 " >
378
+ < h1 class = " mb-2 text-center text-4xl font-extrabold " > svelte- toast< / h1>
387
379
< div class = " mb-6 text-center" >
388
380
< a
389
- class = " badge px-4 py-3 font-mono text-xs hover:bg-base-300 "
381
+ class = " badge badge-neutral px-4 py-3 text-xs no-underline hover:opacity-80 "
390
382
href= " https://github.com/zerodevx/svelte-toast"
391
383
title= " Visit Github repo"
392
384
target= " _blank"
@@ -400,15 +392,11 @@ $: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript')
400
392
>
401
393
gzipped) or as a Svelte component.
402
394
< / p>
403
- < div class = " mockup-code mb-6" >
404
- < pre class = " h-64 w-full overflow-x-auto text-sm" >< code class = " language-javascript"
405
- > {@html formatted}< / code
406
- >< / pre>
407
- < / div>
395
+ < pre class = " h-80 w-full" >< code> {@html formatted}< / code>< / pre>
408
396
< div class = " flex flex-wrap justify-around" >
409
397
{#each buttons as btn}
410
398
< button
411
- class = " btn btn-primary mb-2 w-40 text-xs"
399
+ class = " btn btn-primary mb-2 h-16 w-36 text-xs"
412
400
class: selected= {selected === btn .name }
413
401
on: click= {() => {
414
402
clicked (btn)
0 commit comments