sliftutils 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +26 -0
- package/package.json +1 -1
- package/storage/FileFolderAPI.d.ts +26 -0
- package/storage/FileFolderAPI.tsx +18 -12
package/index.d.ts
CHANGED
|
@@ -622,6 +622,32 @@ declare module "sliftutils/storage/FileFolderAPI" {
|
|
|
622
622
|
/// <reference types="node" />
|
|
623
623
|
/// <reference types="node" />
|
|
624
624
|
import { IStorageRaw } from "./IStorage";
|
|
625
|
+
declare global {
|
|
626
|
+
interface Window {
|
|
627
|
+
showSaveFilePicker(config?: {
|
|
628
|
+
types: {
|
|
629
|
+
description: string;
|
|
630
|
+
accept: {
|
|
631
|
+
[mimeType: string]: string[];
|
|
632
|
+
};
|
|
633
|
+
}[];
|
|
634
|
+
}): Promise<FileSystemFileHandle>;
|
|
635
|
+
showDirectoryPicker(): Promise<FileSystemDirectoryHandle>;
|
|
636
|
+
showOpenFilePicker(config?: {
|
|
637
|
+
types: {
|
|
638
|
+
description: string;
|
|
639
|
+
accept: {
|
|
640
|
+
[mimeType: string]: string[];
|
|
641
|
+
};
|
|
642
|
+
}[];
|
|
643
|
+
}): Promise<FileSystemFileHandle[]>;
|
|
644
|
+
}
|
|
645
|
+
interface FileSystemDirectoryHandle {
|
|
646
|
+
requestPermission(config?: {
|
|
647
|
+
mode: "read" | "readwrite";
|
|
648
|
+
}): Promise<PermissionState>;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
625
651
|
type FileWrapper = {
|
|
626
652
|
getFile(): Promise<{
|
|
627
653
|
size: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { IStorageRaw } from "./IStorage";
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
showSaveFilePicker(config?: {
|
|
7
|
+
types: {
|
|
8
|
+
description: string;
|
|
9
|
+
accept: {
|
|
10
|
+
[mimeType: string]: string[];
|
|
11
|
+
};
|
|
12
|
+
}[];
|
|
13
|
+
}): Promise<FileSystemFileHandle>;
|
|
14
|
+
showDirectoryPicker(): Promise<FileSystemDirectoryHandle>;
|
|
15
|
+
showOpenFilePicker(config?: {
|
|
16
|
+
types: {
|
|
17
|
+
description: string;
|
|
18
|
+
accept: {
|
|
19
|
+
[mimeType: string]: string[];
|
|
20
|
+
};
|
|
21
|
+
}[];
|
|
22
|
+
}): Promise<FileSystemFileHandle[]>;
|
|
23
|
+
}
|
|
24
|
+
interface FileSystemDirectoryHandle {
|
|
25
|
+
requestPermission(config?: {
|
|
26
|
+
mode: "read" | "readwrite";
|
|
27
|
+
}): Promise<PermissionState>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
4
30
|
type FileWrapper = {
|
|
5
31
|
getFile(): Promise<{
|
|
6
32
|
size: number;
|
|
@@ -10,20 +10,26 @@ import { getFileStorageIndexDB } from "./IndexedDBFileFolderAPI";
|
|
|
10
10
|
import fs from "fs";
|
|
11
11
|
import path from "path";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
declare global {
|
|
14
|
+
interface Window {
|
|
15
|
+
showSaveFilePicker(config?: {
|
|
16
|
+
types: {
|
|
17
|
+
description: string; accept: { [mimeType: string]: string[] }
|
|
18
|
+
}[];
|
|
19
|
+
}): Promise<FileSystemFileHandle>;
|
|
20
|
+
showDirectoryPicker(): Promise<FileSystemDirectoryHandle>;
|
|
21
|
+
showOpenFilePicker(config?: {
|
|
22
|
+
types: {
|
|
23
|
+
description: string; accept: { [mimeType: string]: string[] }
|
|
24
|
+
}[];
|
|
25
|
+
}): Promise<FileSystemFileHandle[]>;
|
|
26
|
+
}
|
|
27
|
+
interface FileSystemDirectoryHandle {
|
|
28
|
+
requestPermission(config?: { mode: "read" | "readwrite" }): Promise<PermissionState>;
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
|
|
32
|
+
|
|
27
33
|
// NOTE: IndexedDB is required for iOS, at least. We MIGHT want to make
|
|
28
34
|
// this a user supported toggle too, so they can choose during runtime if they want it.
|
|
29
35
|
// DO NOT enable this is isNode
|