import type { Options } from './options'; export type Request = { type: 'image' | 'text'; resolve?: (response: string) => void; reject?: (error: Error) => void; response: Promise; }; export interface InternalContext { /** * FLAG */ __CONTEXT__: true; /** * Logger */ log: { time: (label: string) => void; timeEnd: (label: string) => void; warn: (...args: any[]) => void; }; /** * Node */ node: T; /** * Owner document */ ownerDocument?: Document; /** * Owner window */ ownerWindow?: Window; /** * DPI * * scale === 1 ? null : 96 * scale */ dpi: number | null; /** * The `style` element under the root `svg` element */ svgStyleElement?: HTMLStyleElement; /** * The `defs` element under the root `svg` element */ svgDefsElement?: SVGDefsElement; /** * The `svgStyleElement` class styles * * Map */ svgStyles: Map; /** * The map of default `getComputedStyle` for all tagnames */ defaultComputedStyles: Map>; /** * The IFrame sandbox used to get the `defaultComputedStyles` */ sandbox?: HTMLIFrameElement; /** * Web Workers */ workers: Worker[]; /** * The set of `font-family` values for all cloend elements */ fontFamilies: Set; /** * Map */ fontCssTexts: Map; /** * `headers.accept` to use when `window.fetch` fetches images */ acceptOfImage: string; /** * All requests for `fetch` */ requests: Map; /** * Canvas multiple draw image fix svg+xml image decoding in Safari and Firefox */ drawImageCount: number; /** * Wait for all tasks embedded in */ tasks: Promise[]; /** * Automatically destroy context */ autoDestruct: boolean; /** * Is enable * * @param key */ isEnable: (key: string) => boolean; } export type Context = InternalContext & Required;