fix: Fix lint errors (#559)
* cleanup: postactions styling * misc: fix first round of errors * pkg: remove vitest * fix: fix lint errors stage 2 * fix: fix lint errors stage 3 * fix: fix lint errors, stage 3 * misc: update eslint rules to warn for writable derived
This commit is contained in:
1 parent
1824245f13
commit
76c581123a
225 files changed
+1553
-2352
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Spinner } from '../index.js'
|
||||
import { backOut, expoOut } from 'svelte/easing'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
import { type Toast, toasts, toastColors } from './toasts.js'
|
||||
import {
|
||||
InformationCircle,
|
||||
@@ -62,7 +62,7 @@
|
||||
<button
|
||||
onclick={() => {
|
||||
toast.action?.()
|
||||
toasts.update((toasts) => toasts.filter((t) => t.id != toast.id))
|
||||
toasts.update(toasts => toasts.filter(t => t.id != toast.id))
|
||||
}}
|
||||
class="rounded-lg w-max transition-colors hover:bg-black/20 dark:hover:bg-white/20 p-2"
|
||||
>
|
||||
@@ -71,7 +71,7 @@
|
||||
{/if}
|
||||
<button
|
||||
onclick={() => {
|
||||
toasts.update((toasts) => toasts.filter((t) => t.id != toast.id))
|
||||
toasts.update(toasts => toasts.filter(t => t.id != toast.id))
|
||||
}}
|
||||
class="rounded-lg w-max transition-colors hover:bg-black/20 dark:hover:bg-white/20 p-2"
|
||||
>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
import Toast from './Toast.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { toasts } from './toasts.js'
|
||||
import { backInOut, backOut, expoOut } from 'svelte/easing'
|
||||
import { expoOut } from 'svelte/easing'
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="fixed right-0 bottom-0 flex flex-col items-end justify-end z-200 p-4
|
||||
group overflow-hidden h-screen min-w-96 pointer-events-none gap-4"
|
||||
>
|
||||
{#each $toasts as toast, index (toast.id)}
|
||||
{#each $toasts as toast (toast.id)}
|
||||
<div
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
class="pointer-events-auto transition-all
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface Toast {
|
||||
content: string
|
||||
type: ToastType
|
||||
loading?: boolean
|
||||
action?: () => any
|
||||
action?: () => void
|
||||
}
|
||||
|
||||
export const toasts = writable<Toast[]>([])
|
||||
@@ -36,11 +36,11 @@ export function toast({
|
||||
type?: ToastType
|
||||
duration?: number
|
||||
loading?: boolean
|
||||
action?: () => any
|
||||
action?: () => void
|
||||
}) {
|
||||
let id = 0
|
||||
|
||||
toasts.update((toasts) => {
|
||||
toasts.update(toasts => {
|
||||
id = Math.floor(Math.random() * 10000)
|
||||
|
||||
return [
|
||||
@@ -57,11 +57,11 @@ export function toast({
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
toasts.update((toasts) => toasts.filter((toast) => toast.id != id))
|
||||
toasts.update(toasts => toasts.filter(toast => toast.id != id))
|
||||
}, duration)
|
||||
|
||||
return id
|
||||
}
|
||||
|
||||
export const removeToast = (id: number) =>
|
||||
toasts.update((toasts) => toasts.filter((toast) => toast.id != id))
|
||||
toasts.update(toasts => toasts.filter(toast => toast.id != id))
|
||||
Reference in new issue
Block a user