Autoformat

This commit is contained in:
Jon Staab
2024-08-05 15:28:46 -07:00
parent 856a5cecc4
commit 4172b2d91f
20 changed files with 362 additions and 251 deletions
+18 -13
View File
@@ -1,13 +1,14 @@
import type {ComponentType} from 'svelte'
import {readable, writable} from 'svelte/store'
import type {FlyParams} from 'svelte/transition'
import {fly as baseFly} from 'svelte/transition'
import {randomId} from '@welshman/lib'
import {pushState} from '$app/navigation'
import type {ComponentType} from "svelte"
import {readable, writable} from "svelte/store"
import type {FlyParams} from "svelte/transition"
import {fly as baseFly} from "svelte/transition"
import {randomId} from "@welshman/lib"
import {pushState} from "$app/navigation"
// Animations
export const fly = (node: Element, params?: FlyParams | undefined) => baseFly(node, {y: 20, ...params})
export const fly = (node: Element, params?: FlyParams | undefined) =>
baseFly(node, {y: 20, ...params})
// Toast
@@ -23,7 +24,10 @@ export type ToastOptions = {
export const toast = writable<Toast | null>(null)
export const pushToast = ({message = "", id = Math.random()}: Partial<Toast>, options: ToastOptions) => {
export const pushToast = (
{message = "", id = Math.random()}: Partial<Toast>,
options: ToastOptions,
) => {
toast.set({id, message, options})
setTimeout(() => popToast(id), options.timeout || 5000)
@@ -31,7 +35,7 @@ export const pushToast = ({message = "", id = Math.random()}: Partial<Toast>, op
return id
}
export const popToast = (id: number) => toast.update($t => $t?.id === id ? null : $t)
export const popToast = (id: number) => toast.update($t => ($t?.id === id ? null : $t))
// Modals
@@ -42,7 +46,7 @@ export const pushModal = (component: ComponentType, props: Record<string, any>)
// TODO: fix memory leak here by listening to history somehow
modals.set(id, {component, props})
pushState('', {modal: id})
pushState("", {modal: id})
return id
}
@@ -56,8 +60,9 @@ export const popModal = (id: string) => {
export const spaces = readable([
{
id: 'test',
id: "test",
name: "Test",
picture: "https://images.unsplash.com/photo-1721853046219-209921be684e?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHw0fHx8ZW58MHx8fHx8"
}
picture:
"https://images.unsplash.com/photo-1721853046219-209921be684e?w=800&auto=format&fit=crop&q=60&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHw0fHx8ZW58MHx8fHx8",
},
])