11<script >
22/* eslint no-useless-escape: "off" */
33
4- import { SvelteToast , toast } from ' $lib'
4+ import { SvelteToast , toast } from ' $lib/index.js '
55import { tick } from ' svelte'
66import { browser , dev , version } from ' $app/environment'
77import DummyComponent from ' ./Dummy.svelte'
@@ -295,28 +295,20 @@ toast.pop(0)`,
295295 {
296296 name: ' RUN CALLBACK ON TOAST REMOVAL' ,
297297 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 : () => {
308303 toast .push (' Wait for it...' , {
309304 onpop : (id , details ) => {
310305 toast .push (` <strong><tt>onpop()</tt></strong> callback has been executed.` , {
311306 target: ' new'
312307 })
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)
318309 }
319310 })
311+ }
320312 },
321313 {
322314 name: ' STYLE WITH USER-DEFINED CLASSES' ,
@@ -382,11 +374,11 @@ $: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript')
382374 / >
383375< / svelte: head>
384376
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>
387379 < div class = " mb-6 text-center" >
388380 < 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 "
390382 href= " https://github.com/zerodevx/svelte-toast"
391383 title= " Visit Github repo"
392384 target= " _blank"
@@ -400,15 +392,11 @@ $: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript')
400392 >
401393 gzipped) or as a Svelte component.
402394 < / 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>
408396 < div class = " flex flex-wrap justify-around" >
409397 {#each buttons as btn}
410398 < 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"
412400 class: selected= {selected === btn .name }
413401 on: click= {() => {
414402 clicked (btn)
0 commit comments