Skip to content

Commit f1abb3e

Browse files
committed
Update svelteSortOrder
1 parent 9c26c5f commit f1abb3e

File tree

4 files changed

+59
-60
lines changed

4 files changed

+59
-60
lines changed

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"singleQuote": true,
55
"trailingComma": "none",
66
"proseWrap": "always",
7-
"svelteSortOrder": "options-scripts-styles-markup",
7+
"svelteSortOrder": "options-scripts-markup-styles",
88
"svelteIndentScriptAndStyle": false
99
}

docs/App.svelte

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/*eslint no-useless-escape: "off"*/
33
import { tick } from 'svelte'
44
import { SvelteToast, toast } from '../src'
5-
//import Prism from './Prism.svelte'
65
import DummyComponent from './Dummy.svelte'
76
import camelCase from 'camelcase'
87
import Prism from 'prismjs'
@@ -338,6 +337,36 @@ let formatted
338337
$: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript')
339338
</script>
340339

340+
<div class="container">
341+
<div class="w-full h-64 px-2 mt-4 mb-8">
342+
<pre
343+
class="w-full h-full bg-gray-700 text-gray-200 font-mono shadow rounded-sm overflow-scroll p-4"><code
344+
class="language-javascript">{@html formatted}</code
345+
></pre>
346+
</div>
347+
<div class="flex flex-row flex-wrap items-center justify-center">
348+
{#each buttons as btn}
349+
<button
350+
class:selected={selected === btn.name}
351+
on:click={() => {
352+
handleClick(btn)
353+
}}
354+
data-btn={camelCase(btn.name)}
355+
>
356+
{btn.name}
357+
</button>
358+
{/each}
359+
</div>
360+
</div>
361+
362+
<div class="top">
363+
<SvelteToast options={{ initial: 0, intro: { y: -64 } }} target="new" />
364+
</div>
365+
366+
<div class:colors class:bottom>
367+
<SvelteToast {options} />
368+
</div>
369+
341370
<style>
342371
:global(.custom) {
343372
--toastBackground: #4299e1;
@@ -372,33 +401,3 @@ $: formatted = Prism.highlight(code, Prism.languages.javascript, 'javascript')
372401
}
373402
}
374403
</style>
375-
376-
<div class="container">
377-
<div class="w-full h-64 px-2 mt-4 mb-8">
378-
<pre
379-
class="w-full h-full bg-gray-700 text-gray-200 font-mono shadow rounded-sm overflow-scroll p-4"><code
380-
class="language-javascript">{@html formatted}</code
381-
></pre>
382-
</div>
383-
<div class="flex flex-row flex-wrap items-center justify-center">
384-
{#each buttons as btn}
385-
<button
386-
class:selected={selected === btn.name}
387-
on:click={() => {
388-
handleClick(btn)
389-
}}
390-
data-btn={camelCase(btn.name)}
391-
>
392-
{btn.name}
393-
</button>
394-
{/each}
395-
</div>
396-
</div>
397-
398-
<div class="top">
399-
<SvelteToast options={{ initial: 0, intro: { y: -64 } }} target="new" />
400-
</div>
401-
402-
<div class:colors class:bottom>
403-
<SvelteToast {options} />
404-
</div>

src/SvelteToast.svelte

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ $: items = $toast.filter((i) => i.target === target)
1515
const getCss = (theme) => Object.keys(theme).reduce((a, c) => `${a}${c}:${theme[c]};`, '')
1616
</script>
1717

18+
<ul class="_toastContainer">
19+
{#each items as item (item.id)}
20+
<li
21+
class={item.classes.join(' ')}
22+
in:fly={item.intro}
23+
out:fade
24+
animate:flip={{ duration: 200 }}
25+
style={getCss(item.theme)}
26+
>
27+
<ToastItem {item} />
28+
</li>
29+
{/each}
30+
</ul>
31+
1832
<style>
1933
._toastContainer {
2034
top: var(--toastContainerTop, 1.5rem);
@@ -29,17 +43,3 @@ const getCss = (theme) => Object.keys(theme).reduce((a, c) => `${a}${c}:${theme[
2943
z-index: var(--toastContainerZIndex, 9999);
3044
}
3145
</style>
32-
33-
<ul class="_toastContainer">
34-
{#each items as item (item.id)}
35-
<li
36-
class={item.classes.join(' ')}
37-
in:fly={item.intro}
38-
out:fade
39-
animate:flip={{ duration: 200 }}
40-
style={getCss(item.theme)}
41-
>
42-
<ToastItem {item} />
43-
</li>
44-
{/each}
45-
</ul>

src/ToastItem.svelte

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,20 @@ onDestroy(() => {
6060
})
6161
</script>
6262

63+
<div class="_toastItem" class:pe={item.pausable} on:mouseenter={pause} on:mouseleave={resume}>
64+
<div role="status" class="_toastMsg" class:pe={item.component}>
65+
{#if item.component}
66+
<svelte:component this={item.component.src} {...getProps()} />
67+
{:else}
68+
{@html item.msg}
69+
{/if}
70+
</div>
71+
{#if item.dismissable}
72+
<div class="_toastBtn pe" role="button" tabindex="-1" on:click={close}>✕</div>
73+
{/if}
74+
<progress class="_toastBar" value={$progress} />
75+
</div>
76+
6377
<style>
6478
._toastItem {
6579
width: var(--toastWidth, 16rem);
@@ -129,17 +143,3 @@ onDestroy(() => {
129143
background: var(--toastProgressBackground, var(--toastBarBackground, rgba(33, 150, 243, 0.75)));
130144
}
131145
</style>
132-
133-
<div class="_toastItem" class:pe={item.pausable} on:mouseenter={pause} on:mouseleave={resume}>
134-
<div role="status" class="_toastMsg" class:pe={item.component}>
135-
{#if item.component}
136-
<svelte:component this={item.component.src} {...getProps()} />
137-
{:else}
138-
{@html item.msg}
139-
{/if}
140-
</div>
141-
{#if item.dismissable}
142-
<div class="_toastBtn pe" role="button" tabindex="-1" on:click={close}>✕</div>
143-
{/if}
144-
<progress class="_toastBar" value={$progress} />
145-
</div>

0 commit comments

Comments
 (0)