creevey
Version:
Cross-browser screenshot testing tool for Storybook with fancy UI Runner
46 lines (45 loc) • 1.9 kB
TypeScript
import { MakeDecoratorResult } from '@storybook/addons';
import { StorybookGlobals } from '../../types';
declare global {
interface Window {
__CREEVEY_SELECT_STORY__: (storyId: string, kind: string, name: string, shouldWaitForReady: boolean, callback: (error?: string) => void) => void;
__CREEVEY_UPDATE_GLOBALS__: (globals: StorybookGlobals) => void;
__CREEVEY_INSERT_IGNORE_STYLES__: (ignoreElements: string[]) => HTMLStyleElement;
__CREEVEY_REMOVE_IGNORE_STYLES__: (ignoreStyles: HTMLStyleElement) => void;
__CREEVEY_SET_READY_FOR_CAPTURE__?: () => void;
}
interface Document {
fonts: FontFaceSet;
}
type CSSOMString = string;
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error';
type FontFaceSetStatus = 'loading' | 'loaded';
class FontFace extends FontFaceDescriptors {
constructor(family: string, source: string | ArrayBuffer, descriptors?: FontFaceDescriptors);
readonly status: FontFaceLoadStatus;
readonly loaded: Promise<FontFace>;
variationSettings: CSSOMString;
display: CSSOMString;
load(): Promise<FontFace>;
}
class FontFaceDescriptors {
family: CSSOMString;
style: CSSOMString;
weight: CSSOMString;
stretch: CSSOMString;
unicodeRange: CSSOMString;
variant: CSSOMString;
featureSettings: CSSOMString;
}
interface FontFaceSet extends Iterable<FontFace>, EventTarget {
readonly status: FontFaceSetStatus;
readonly ready: Promise<FontFaceSet>;
readonly size: number;
add(font: FontFace): void;
check(font: string, text?: string): boolean;
load(font: string, text?: string): Promise<FontFace[]>;
delete(font: FontFace): void;
clear(): void;
}
}
export declare function withCreevey(): MakeDecoratorResult;