2020-10-28 20:53:27 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
2020-04-03 21:21:40 +02:00
|
|
|
interface Document {
|
|
|
|
fonts?: {
|
|
|
|
ready?: Promise<void>;
|
2022-11-23 21:15:32 +01:00
|
|
|
check?: (font: string, text?: string) => boolean;
|
|
|
|
load?: (font: string, text?: string) => Promise<FontFace[]>;
|
2020-05-08 10:42:51 +02:00
|
|
|
addEventListener?(
|
|
|
|
type: "loading" | "loadingdone" | "loadingerror",
|
|
|
|
listener: (this: Document, ev: Event) => any,
|
|
|
|
): void;
|
2020-04-03 21:21:40 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2020-01-09 17:37:08 +01:00
|
|
|
interface Window {
|
|
|
|
ClipboardItem: any;
|
2020-10-25 19:39:57 +05:30
|
|
|
__EXCALIDRAW_SHA__: string | undefined;
|
2021-02-21 21:08:30 +05:30
|
|
|
EXCALIDRAW_ASSET_PATH: string | undefined;
|
2022-04-27 10:49:02 +02:00
|
|
|
EXCALIDRAW_EXPORT_SOURCE: string;
|
2022-07-16 11:36:55 +02:00
|
|
|
EXCALIDRAW_THROTTLE_RENDER: boolean | undefined;
|
2020-12-02 23:57:51 +02:00
|
|
|
gtag: Function;
|
2023-03-29 11:13:06 +02:00
|
|
|
_paq: any[];
|
|
|
|
_mtm: any[];
|
2020-01-09 17:37:08 +01:00
|
|
|
}
|
|
|
|
|
2022-11-01 17:29:58 +01:00
|
|
|
interface CanvasRenderingContext2D {
|
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/roundRect
|
|
|
|
roundRect?: (
|
|
|
|
x: number,
|
|
|
|
y: number,
|
|
|
|
width: number,
|
|
|
|
height: number,
|
|
|
|
radii:
|
|
|
|
| number // [all-corners]
|
|
|
|
| [number] // [all-corners]
|
|
|
|
| [number, number] // [top-left-and-bottom-right, top-right-and-bottom-left]
|
|
|
|
| [number, number, number] // [top-left, top-right-and-bottom-left, bottom-right]
|
|
|
|
| [number, number, number, number], // [top-left, top-right, bottom-right, bottom-left]
|
|
|
|
) => void;
|
|
|
|
}
|
|
|
|
|
2020-07-02 16:52:58 +01:00
|
|
|
// https://github.com/facebook/create-react-app/blob/ddcb7d5/packages/react-scripts/lib/react-app.d.ts
|
|
|
|
declare namespace NodeJS {
|
|
|
|
interface ProcessEnv {
|
|
|
|
readonly REACT_APP_BACKEND_V2_GET_URL: string;
|
|
|
|
readonly REACT_APP_BACKEND_V2_POST_URL: string;
|
2022-03-06 22:43:02 +01:00
|
|
|
readonly REACT_APP_PORTAL_URL: string;
|
2020-10-04 11:12:47 -07:00
|
|
|
readonly REACT_APP_FIREBASE_CONFIG: string;
|
2020-07-02 16:52:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-09 17:37:08 +01:00
|
|
|
interface Clipboard extends EventTarget {
|
|
|
|
write(data: any[]): Promise<void>;
|
|
|
|
}
|
2020-03-17 20:55:40 +01:00
|
|
|
|
2020-10-13 14:47:07 +02:00
|
|
|
// PNG encoding/decoding
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
type TEXtChunk = { name: "tEXt"; data: Uint8Array };
|
|
|
|
|
|
|
|
declare module "png-chunk-text" {
|
|
|
|
function encode(
|
|
|
|
name: string,
|
|
|
|
value: string,
|
|
|
|
): { name: "tEXt"; data: Uint8Array };
|
|
|
|
function decode(data: Uint8Array): { keyword: string; text: string };
|
|
|
|
}
|
|
|
|
declare module "png-chunks-encode" {
|
|
|
|
function encode(chunks: TEXtChunk[]): Uint8Array;
|
|
|
|
export = encode;
|
|
|
|
}
|
|
|
|
declare module "png-chunks-extract" {
|
|
|
|
function extract(buffer: Uint8Array): TEXtChunk[];
|
|
|
|
export = extract;
|
|
|
|
}
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2020-10-19 10:53:37 +02:00
|
|
|
interface Blob {
|
2021-01-27 19:47:55 +01:00
|
|
|
handle?: import("browser-fs-acces").FileSystemHandle;
|
2020-10-19 10:53:37 +02:00
|
|
|
name?: string;
|
|
|
|
}
|
2021-03-30 23:51:55 +05:30
|
|
|
|
|
|
|
declare module "*.scss";
|
2021-10-21 22:05:48 +02:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------—
|
|
|
|
// ensure Uint8Array isn't assignable to ArrayBuffer
|
|
|
|
// (due to TS structural typing)
|
|
|
|
// https://github.com/microsoft/TypeScript/issues/31311#issuecomment-490690695
|
|
|
|
interface ArrayBuffer {
|
2021-11-01 15:24:05 +02:00
|
|
|
_brand?: "ArrayBuffer";
|
2021-10-21 22:05:48 +02:00
|
|
|
}
|
|
|
|
interface Uint8Array {
|
2021-11-01 15:24:05 +02:00
|
|
|
_brand?: "Uint8Array";
|
2021-10-21 22:05:48 +02:00
|
|
|
}
|
|
|
|
// --------------------------------------------------------------------------—
|
|
|
|
|
|
|
|
// https://github.com/nodeca/image-blob-reduce/issues/23#issuecomment-783271848
|
|
|
|
declare module "image-blob-reduce" {
|
2021-11-26 11:46:13 +01:00
|
|
|
import { PicaResizeOptions, Pica } from "pica";
|
2021-10-21 22:05:48 +02:00
|
|
|
namespace ImageBlobReduce {
|
|
|
|
interface ImageBlobReduce {
|
|
|
|
toBlob(file: File, options: ImageBlobReduceOptions): Promise<Blob>;
|
2021-11-26 11:46:13 +01:00
|
|
|
_create_blob(
|
|
|
|
this: { pica: Pica },
|
|
|
|
env: {
|
|
|
|
out_canvas: HTMLCanvasElement;
|
|
|
|
out_blob: Blob;
|
|
|
|
},
|
|
|
|
): Promise<any>;
|
2021-10-21 22:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
interface ImageBlobReduceStatic {
|
|
|
|
new (options?: any): ImageBlobReduce;
|
|
|
|
|
|
|
|
(options?: any): ImageBlobReduce;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface ImageBlobReduceOptions extends PicaResizeOptions {
|
|
|
|
max: number;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const reduce: ImageBlobReduce.ImageBlobReduceStatic;
|
|
|
|
export = reduce;
|
|
|
|
}
|