Skip to content

Commit

Permalink
v0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaSh committed Sep 8, 2024
1 parent 55652df commit 334e520
Show file tree
Hide file tree
Showing 4 changed files with 698 additions and 642 deletions.
13 changes: 11 additions & 2 deletions dist/swapy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@ declare type AnimationType = 'dynamic' | 'spring' | 'none';
declare type Config = {
animation: AnimationType;
continuousMode: boolean;
manualSwap: boolean;
};

export declare function createSwapy(root: Element | null, userConfig?: Partial<Config>): SwapyApi;

declare type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? {
[K in Keys]: T[K];
} & Partial<Record<Exclude<keyof T, Keys>, never>> : never;

declare type SwapCallback = (event: SwapEventData) => void;

declare type SwapData = RequireOnlyOne<SwapEventDataData, 'map' | 'array' | 'object'>;

declare type SwapEventArray = Array<{
slot: string;
item: string | null;
slotId: string;
itemId: string | null;
}>;

declare interface SwapEventData {
Expand All @@ -31,6 +38,8 @@ declare type SwapEventObject = Record<string, string | null>;
declare interface SwapyApi {
onSwap(callback: SwapCallback): void;
enable(enabled: boolean): void;
destroy(): void;
setData(swapData: SwapData): void;
}

export { }
Loading

0 comments on commit 334e520

Please sign in to comment.