-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathvite-env.d.ts
62 lines (60 loc) · 2.07 KB
/
vite-env.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/// <reference types="vite/client" />
/// <reference types="unplugin-info/client" />
// Polyfill for `showOpenFilePicker` API
// See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/wicg-file-system-access/index.d.ts
// See also https://caniuse.com/?search=showOpenFilePicker
interface OpenFilePickerOptions {
/**
* A boolean value that defaults to `false`.
* By default the picker should include an option to not apply any file type filters (instigated with the type option below). Setting this option to true means that option is not available.
*/
excludeAcceptAllOption?: boolean | undefined;
/**
* By specifying an ID, the browser can remember different directories for different IDs. If the same ID is used for another picker, the picker opens in the same directory.
*/
id?: string | undefined;
/**
* A boolean value that defaults to `false`.
* When set to true multiple files may be selected.
*/
multiple?: boolean | undefined;
/**
* A FileSystemHandle or a well known directory ("desktop", "documents", "downloads", "music", "pictures", or "videos") to open the dialog in.
*/
startIn?:
| "documents"
| "desktop"
| "downloads"
| "home"
| "pictures"
| "videos"
| "music"
| "custom";
/**
* An Array of allowed file types to pick. Each item is an object with the following options.
*/
types?:
| {
/**
* An optional description of the category of files types allowed. Defaults to an empty string.
*/
description?: string | undefined;
/**
* An Object with the keys set to the MIME type and the values an Array of file extensions (see below for an example).
*/
accept: Record<string, string | string[]>;
}[]
| undefined;
}
export declare global {
interface Window {
/**
* Window API: showOpenFilePicker
*
* [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker)
*/
showOpenFilePicker: (
options?: OpenFilePickerOptions,
) => Promise<FileSystemFileHandle[]>;
}
}