Type bounds

This commit is contained in:
Adria Navarro 2024-12-30 13:44:43 +01:00
parent 56fe3ce6fe
commit 0c937e0827
2 changed files with 18 additions and 7 deletions

View File

@ -1,6 +1,19 @@
import { derived, writable } from "svelte/store"
import { derived, Readable, Writable, writable } from "svelte/store"
export const createStores = () => {
interface BoundsStore {
bounds: Writable<{
left: number
top: number
width: number
height: number
}>
height: Readable<number>
width: Readable<number>
}
export type Store = BoundsStore
export const createStores = (): BoundsStore => {
const bounds = writable({
left: 0,
top: 0,

View File

@ -1,4 +1,4 @@
import { Readable, Writable } from "svelte/store"
import { Writable } from "svelte/store"
import type { APIClient } from "../../../api/types"
import * as Bounds from "./bounds"
@ -97,9 +97,6 @@ export type Store = BaseStore &
// TODO while typing the rest of stores
subscribe: any
dispatch: (event: string, data: any) => any
width: Writable<number>
bounds: Readable<any>
height: Readable<number>
} & Rows.Store &
Reorder.Store &
Resize.Store &
@ -108,7 +105,8 @@ export type Store = BaseStore &
Cache.Store &
Viewport.Store &
Notifications.Store &
Sort.Store
Sort.Store &
Bounds.Store
export const attachStores = (context: Store): Store => {
// Atomic store creation