@x-ray/core
Version:
X-Ray Core
84 lines (83 loc) • 1.97 kB
TypeScript
import type { ReactElement } from 'react';
import type { TJsonValue } from 'typeon';
export declare type TResultsType = Uint8Array | string;
export declare type TEncoding = 'image' | 'text';
export declare type TPlugin<T extends TResultsType> = {
name: string;
encoding: TEncoding;
appEntryPointPath: string;
getResults: (files: string[]) => Promise<TTotalResults<T>>;
};
export declare type TExampleOptions = {
backgroundColor?: string;
maxWidth?: number;
overflowTop?: number;
overflowBottom?: number;
overflowLeft?: number;
overflowRight?: number;
hasOwnWidth?: boolean;
};
export declare type TExample = {
id: string;
element: ReactElement;
options?: TExampleOptions;
meta?: (element: ReactElement) => TJsonValue;
};
export declare type TExampleResult<T> = {
type: 'OK';
} | {
type: 'DELETED';
data: T;
width: number;
height: number;
meta?: TJsonValue;
} | {
type: 'NEW';
data: T;
width: number;
height: number;
meta?: TJsonValue;
} | {
type: 'DIFF';
data: T;
width: number;
height: number;
origData: T;
origWidth: number;
origHeight: number;
meta?: TJsonValue;
};
export declare type TExampleResults<T> = Map<string, TExampleResult<T>>;
export declare type TFileResults<T> = {
name: string;
results: TExampleResults<T>;
status: {
ok: number;
new: number;
diff: number;
deleted: number;
};
};
export declare type TTotalResults<T> = Map<string, TFileResults<T>>;
export declare type TItem = {
type: 'DELETED';
width: number;
height: number;
} | {
type: 'NEW';
width: number;
height: number;
} | {
type: 'DIFF';
width: number;
height: number;
origWidth: number;
origHeight: number;
};
export declare type TListItems = {
[id: string]: TItem;
};
export declare type TGetResponseQuery = {
id: string;
type: 'ORIG' | 'NEW';
};