Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TahaSh committed Sep 21, 2024
1 parent dff36f0 commit 782d79f
Show file tree
Hide file tree
Showing 4 changed files with 556 additions and 497 deletions.
19 changes: 13 additions & 6 deletions dist/swapy.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ declare type Config = {
animation: AnimationType;
continuousMode: boolean;
manualSwap: boolean;
swapMode: SwapMode;
};

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

declare type RequireOnlyOne<T, Keys extends keyof T = keyof T> = Keys extends keyof T ? {
[K in Keys]: T[K];
Expand All @@ -18,7 +19,9 @@ declare type SwapCallback = (event: SwapEventData) => void;

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

declare type SwapEventArray = Array<{
declare type SwapEndCallback = (event: SwapEventData) => void;

export declare type SwapEventArray = Array<{
slotId: string;
itemId: string | null;
}>;
Expand All @@ -33,14 +36,18 @@ declare interface SwapEventDataData {
object: SwapEventObject;
}

declare type SwapEventMap = Map<string, string | null>;
export declare type SwapEventMap = Map<string, string | null>;

export declare type SwapEventObject = Record<string, string | null>;

declare type SwapEventObject = Record<string, string | null>;
declare type SwapMode = 'hover' | 'stop' | 'drop';

export declare type Swapy = SwapyApi;
declare type SwapStartCallback = () => void;

declare interface SwapyApi {
export declare interface Swapy {
onSwap(callback: SwapCallback): void;
onSwapEnd(callback: SwapEndCallback): void;
onSwapStart(callback: SwapStartCallback): void;
enable(enabled: boolean): void;
destroy(): void;
setData(swapData: SwapData): void;
Expand Down
Loading

0 comments on commit 782d79f

Please sign in to comment.