Created
May 13, 2022 14:50
-
-
Save m93a/ff4152a21f55a18561185e8be38f413a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// type definitions for the NPM package svelte-grid | |
declare module "svelte-grid" { | |
import type { SvelteComponentTyped } from "svelte"; | |
export interface Size { | |
w: number; | |
h: number; | |
} | |
export interface Positon { | |
x: number; | |
y: number; | |
} | |
interface ItemLayout extends Size, Positon { | |
fixed?: boolean; | |
resizable?: boolean; | |
draggable?: boolean; | |
customDragger?: boolean; | |
customResizer?: boolean; | |
min?: Size; | |
max?: Size; | |
} | |
export type Item<T> = T & { [width: number]: ItemLayout }; | |
export type FilledItem<T> = T & { [width: number]: Required<ItemLayout> }; | |
export interface Props<T> { | |
fillSpace?: boolean; | |
items: FilledItem<T>[]; | |
rowHeight: number; | |
cols: [number, number][]; | |
gap?: [number, number]; | |
fastStart?: boolean; | |
throttleUpdate?: number; | |
throttleResize?: number; | |
scroller?: undefined; | |
sensor?: number; | |
} | |
export interface Slots<T> { | |
default: { item: ItemLayout, dataItem: Item<T> }; | |
} | |
export default class Grid<T = {}> extends SvelteComponentTyped<Props<T>, {}, Slots<T>> {} | |
} | |
declare module "svelte-grid/build/helper/index.mjs" { | |
import { ItemLayout } from "svelte-grid"; | |
const x: { | |
normalize(items: any[], col: any): unknown[], | |
adjust(items: any[], col: any): unknown[], | |
findSpace(item: any, items: any, cols: any): unknown, | |
item<T>(obj: ItemLayout): Required<ItemLayout>, | |
}; | |
export default x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment