@webiny/app 6.4.0-beta.0 → 6.4.0-beta.2
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/package.json +10 -12
- package/react-butterfiles/Files.d.ts +0 -69
- package/react-butterfiles/Files.js +0 -158
- package/react-butterfiles/Files.js.map +0 -1
- package/react-butterfiles/file.todo +0 -1
- package/react-butterfiles/index.d.ts +0 -2
- package/react-butterfiles/index.js +0 -5
- package/react-butterfiles/index.js.map +0 -1
- package/react-butterfiles/utils/generateId.d.ts +0 -1
- package/react-butterfiles/utils/generateId.js +0 -4
- package/react-butterfiles/utils/generateId.js.map +0 -1
- package/react-butterfiles/utils/readFileContent.d.ts +0 -1
- package/react-butterfiles/utils/readFileContent.js +0 -11
- package/react-butterfiles/utils/readFileContent.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app",
|
|
3
|
-
"version": "6.4.0-beta.
|
|
3
|
+
"version": "6.4.0-beta.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"@apollo/react-hooks": "3.1.5",
|
|
22
22
|
"@emotion/styled": "11.14.1",
|
|
23
23
|
"@types/react": "18.3.28",
|
|
24
|
-
"@webiny/di": "0.
|
|
25
|
-
"@webiny/feature": "6.4.0-beta.
|
|
26
|
-
"@webiny/i18n": "6.4.0-beta.
|
|
27
|
-
"@webiny/i18n-react": "6.4.0-beta.
|
|
28
|
-
"@webiny/plugins": "6.4.0-beta.
|
|
29
|
-
"@webiny/react-composition": "6.4.0-beta.
|
|
30
|
-
"@webiny/react-properties": "6.4.0-beta.
|
|
24
|
+
"@webiny/di": "1.0.1",
|
|
25
|
+
"@webiny/feature": "6.4.0-beta.2",
|
|
26
|
+
"@webiny/i18n": "6.4.0-beta.2",
|
|
27
|
+
"@webiny/i18n-react": "6.4.0-beta.2",
|
|
28
|
+
"@webiny/plugins": "6.4.0-beta.2",
|
|
29
|
+
"@webiny/react-composition": "6.4.0-beta.2",
|
|
30
|
+
"@webiny/react-properties": "6.4.0-beta.2",
|
|
31
31
|
"apollo-cache": "1.3.5",
|
|
32
32
|
"apollo-cache-inmemory": "1.6.6",
|
|
33
33
|
"apollo-client": "2.6.10",
|
|
@@ -37,12 +37,10 @@
|
|
|
37
37
|
"apollo-link-http-common": "0.2.16",
|
|
38
38
|
"apollo-utilities": "1.3.4",
|
|
39
39
|
"boolean": "3.2.0",
|
|
40
|
-
"bytes": "3.1.2",
|
|
41
40
|
"graphql": "16.14.0",
|
|
42
41
|
"history": "5.3.0",
|
|
43
42
|
"invariant": "2.2.4",
|
|
44
43
|
"lodash": "4.18.1",
|
|
45
|
-
"minimatch": "10.2.5",
|
|
46
44
|
"mobx": "6.15.3",
|
|
47
45
|
"nanoid": "5.1.11",
|
|
48
46
|
"react": "18.3.1",
|
|
@@ -54,7 +52,7 @@
|
|
|
54
52
|
"devDependencies": {
|
|
55
53
|
"@types/lodash": "4.17.24",
|
|
56
54
|
"@types/warning": "3.0.4",
|
|
57
|
-
"@webiny/build-tools": "6.4.0-beta.
|
|
55
|
+
"@webiny/build-tools": "6.4.0-beta.2",
|
|
58
56
|
"rimraf": "6.1.3",
|
|
59
57
|
"type-fest": "5.6.0",
|
|
60
58
|
"typescript": "6.0.3",
|
|
@@ -71,5 +69,5 @@
|
|
|
71
69
|
]
|
|
72
70
|
}
|
|
73
71
|
},
|
|
74
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "872f9f50baa1ff6915a5f338216f84bf0b6dfd24"
|
|
75
73
|
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type SelectedFile = {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
type: string;
|
|
6
|
-
size: number;
|
|
7
|
-
src: {
|
|
8
|
-
file: File;
|
|
9
|
-
base64: string | null;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export type FileError = {
|
|
13
|
-
id: string;
|
|
14
|
-
type: "unsupportedFileType" | "maxSizeExceeded" | "multipleMaxSizeExceeded" | "multipleMaxCountExceeded" | "multipleNotAllowed";
|
|
15
|
-
index?: number;
|
|
16
|
-
file?: SelectedFile | File;
|
|
17
|
-
multipleFileSize?: number;
|
|
18
|
-
multipleMaxSize?: number;
|
|
19
|
-
multipleMaxCount?: number;
|
|
20
|
-
multipleCount?: number;
|
|
21
|
-
};
|
|
22
|
-
export type BrowseFilesParams = {
|
|
23
|
-
onSuccess?: (files: SelectedFile[]) => void;
|
|
24
|
-
onError?: (errors: FileError[], files: SelectedFile[]) => void;
|
|
25
|
-
};
|
|
26
|
-
export type RenderPropParams = {
|
|
27
|
-
browseFiles: (params: BrowseFilesParams) => void;
|
|
28
|
-
getDropZoneProps: (additionalProps: any) => any;
|
|
29
|
-
getLabelProps: (additionalProps: any) => any;
|
|
30
|
-
validateFiles: (files: SelectedFile[] | File[]) => FileError[];
|
|
31
|
-
};
|
|
32
|
-
export type FilesRules = {
|
|
33
|
-
accept: string[];
|
|
34
|
-
multiple: boolean;
|
|
35
|
-
maxSize: string;
|
|
36
|
-
multipleMaxSize: string;
|
|
37
|
-
multipleMaxCount: number | null;
|
|
38
|
-
convertToBase64: boolean;
|
|
39
|
-
onSuccess?: (files: SelectedFile[]) => void;
|
|
40
|
-
onError?: (errors: FileError[], files: SelectedFile[]) => void;
|
|
41
|
-
};
|
|
42
|
-
export type Props = FilesRules & {
|
|
43
|
-
children: (params: RenderPropParams) => React.ReactNode;
|
|
44
|
-
id?: string;
|
|
45
|
-
};
|
|
46
|
-
export declare class Files extends React.Component<Props> {
|
|
47
|
-
static defaultProps: {
|
|
48
|
-
accept: never[];
|
|
49
|
-
multiple: boolean;
|
|
50
|
-
maxSize: string;
|
|
51
|
-
multipleMaxSize: string;
|
|
52
|
-
multipleMaxCount: null;
|
|
53
|
-
convertToBase64: boolean;
|
|
54
|
-
};
|
|
55
|
-
input: HTMLInputElement | null;
|
|
56
|
-
browseFilesPassedParams: BrowseFilesParams | null;
|
|
57
|
-
id: string;
|
|
58
|
-
validateFiles: (files: SelectedFile[] | File[]) => FileError[];
|
|
59
|
-
processSelectedFiles: (eventFiles: Array<File>) => Promise<void>;
|
|
60
|
-
/**
|
|
61
|
-
* Extracted into a separate method just for testing purposes.
|
|
62
|
-
*/
|
|
63
|
-
onDropFilesHandler: ({ e, onSuccess, onError }: any) => Promise<void>;
|
|
64
|
-
/**
|
|
65
|
-
* Extracted into a separate method just for testing purposes.
|
|
66
|
-
*/
|
|
67
|
-
browseFilesHandler: ({ onSuccess, onError }: any) => void;
|
|
68
|
-
render(): React.JSX.Element;
|
|
69
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import react from "react";
|
|
2
|
-
import bytes from "bytes";
|
|
3
|
-
import { minimatch } from "minimatch";
|
|
4
|
-
import { readFileContent } from "./utils/readFileContent.js";
|
|
5
|
-
import { generateId } from "./utils/generateId.js";
|
|
6
|
-
class Files extends react.Component {
|
|
7
|
-
static{
|
|
8
|
-
this.defaultProps = {
|
|
9
|
-
accept: [],
|
|
10
|
-
multiple: false,
|
|
11
|
-
maxSize: "2mb",
|
|
12
|
-
multipleMaxSize: "10mb",
|
|
13
|
-
multipleMaxCount: null,
|
|
14
|
-
convertToBase64: false
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
render() {
|
|
18
|
-
const { multiple, accept, id } = this.props;
|
|
19
|
-
return /*#__PURE__*/ react.createElement(react.Fragment, null, this.props.children({
|
|
20
|
-
getLabelProps: (props)=>({
|
|
21
|
-
...props,
|
|
22
|
-
htmlFor: id || this.id
|
|
23
|
-
}),
|
|
24
|
-
validateFiles: this.validateFiles,
|
|
25
|
-
browseFiles: ({ onSuccess, onError } = {})=>{
|
|
26
|
-
this.browseFilesHandler({
|
|
27
|
-
onSuccess,
|
|
28
|
-
onError
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
getDropZoneProps: ({ onSuccess, onError, onDragOver, onDrop, ...rest } = {})=>({
|
|
32
|
-
...rest,
|
|
33
|
-
onDragOver: (e)=>{
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
"function" == typeof onDragOver && onDragOver();
|
|
36
|
-
},
|
|
37
|
-
onDrop: async (e)=>{
|
|
38
|
-
e.preventDefault();
|
|
39
|
-
"function" == typeof onDrop && onDrop();
|
|
40
|
-
this.onDropFilesHandler({
|
|
41
|
-
e,
|
|
42
|
-
onSuccess,
|
|
43
|
-
onError
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
}), /*#__PURE__*/ react.createElement("input", {
|
|
48
|
-
id: id || this.id,
|
|
49
|
-
ref: (ref)=>{
|
|
50
|
-
if (ref) this.input = ref;
|
|
51
|
-
},
|
|
52
|
-
accept: accept.join(","),
|
|
53
|
-
style: {
|
|
54
|
-
display: "none"
|
|
55
|
-
},
|
|
56
|
-
type: "file",
|
|
57
|
-
multiple: multiple,
|
|
58
|
-
onChange: (e)=>this.processSelectedFiles(e.target.files ?? [])
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
constructor(...args){
|
|
62
|
-
super(...args), this.input = null, this.browseFilesPassedParams = null, this.id = generateId(), this.validateFiles = (files)=>{
|
|
63
|
-
const { multiple, multipleMaxSize, multipleMaxCount, accept, maxSize } = this.props;
|
|
64
|
-
const errors = [];
|
|
65
|
-
let multipleFileSize = 0;
|
|
66
|
-
if (!multiple && files.length > 1) {
|
|
67
|
-
errors.push({
|
|
68
|
-
id: generateId(),
|
|
69
|
-
type: "multipleNotAllowed"
|
|
70
|
-
});
|
|
71
|
-
return errors;
|
|
72
|
-
}
|
|
73
|
-
for(let index = 0; index < files.length; index++){
|
|
74
|
-
const file = files[index];
|
|
75
|
-
if (Array.isArray(accept) && accept.length && !accept.some((type)=>minimatch(file.type, type))) errors.push({
|
|
76
|
-
id: generateId(),
|
|
77
|
-
index,
|
|
78
|
-
file,
|
|
79
|
-
type: "unsupportedFileType"
|
|
80
|
-
});
|
|
81
|
-
else if (maxSize) {
|
|
82
|
-
const sizeAsBytes = bytes(maxSize);
|
|
83
|
-
if (sizeAsBytes && file.size > sizeAsBytes) errors.push({
|
|
84
|
-
id: generateId(),
|
|
85
|
-
index,
|
|
86
|
-
file,
|
|
87
|
-
type: "maxSizeExceeded"
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
if (multiple) multipleFileSize += file.size;
|
|
91
|
-
}
|
|
92
|
-
if (multiple) {
|
|
93
|
-
const maxMultipleMaxSize = bytes(multipleMaxSize);
|
|
94
|
-
if (maxMultipleMaxSize && multipleMaxSize && multipleFileSize > maxMultipleMaxSize) errors.push({
|
|
95
|
-
id: generateId(),
|
|
96
|
-
type: "multipleMaxSizeExceeded",
|
|
97
|
-
multipleFileSize,
|
|
98
|
-
multipleMaxSize: maxMultipleMaxSize
|
|
99
|
-
});
|
|
100
|
-
if (multipleMaxCount && files.length > multipleMaxCount) errors.push({
|
|
101
|
-
id: generateId(),
|
|
102
|
-
type: "multipleMaxCountExceeded",
|
|
103
|
-
multipleCount: files.length,
|
|
104
|
-
multipleMaxCount
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
return errors;
|
|
108
|
-
}, this.processSelectedFiles = async (eventFiles)=>{
|
|
109
|
-
if (0 === eventFiles.length) return;
|
|
110
|
-
const { convertToBase64, onSuccess, onError } = this.props;
|
|
111
|
-
const { browseFilesPassedParams } = this;
|
|
112
|
-
const callbacks = {
|
|
113
|
-
onSuccess,
|
|
114
|
-
onError
|
|
115
|
-
};
|
|
116
|
-
if (browseFilesPassedParams && browseFilesPassedParams.onSuccess) callbacks.onSuccess = browseFilesPassedParams.onSuccess;
|
|
117
|
-
if (browseFilesPassedParams && browseFilesPassedParams.onError) callbacks.onError = browseFilesPassedParams.onError;
|
|
118
|
-
const files = [
|
|
119
|
-
...eventFiles
|
|
120
|
-
].map((file)=>({
|
|
121
|
-
id: generateId(),
|
|
122
|
-
name: file.name,
|
|
123
|
-
type: file.type,
|
|
124
|
-
size: file.size,
|
|
125
|
-
src: {
|
|
126
|
-
file,
|
|
127
|
-
base64: null
|
|
128
|
-
}
|
|
129
|
-
}));
|
|
130
|
-
const errors = this.validateFiles(files);
|
|
131
|
-
if (errors.length) callbacks.onError && callbacks.onError(errors, files);
|
|
132
|
-
else {
|
|
133
|
-
if (convertToBase64) for(let i = 0; i < files.length; i++){
|
|
134
|
-
const file = files[i].src.file;
|
|
135
|
-
files[i].src.base64 = await readFileContent(file);
|
|
136
|
-
}
|
|
137
|
-
callbacks.onSuccess && callbacks.onSuccess(files);
|
|
138
|
-
}
|
|
139
|
-
if (this.input) this.input.value = "";
|
|
140
|
-
this.browseFilesPassedParams = null;
|
|
141
|
-
}, this.onDropFilesHandler = async ({ e, onSuccess, onError })=>{
|
|
142
|
-
this.browseFilesPassedParams = {
|
|
143
|
-
onSuccess,
|
|
144
|
-
onError
|
|
145
|
-
};
|
|
146
|
-
e.dataTransfer && e.dataTransfer.files && await this.processSelectedFiles(e.dataTransfer.files);
|
|
147
|
-
}, this.browseFilesHandler = ({ onSuccess, onError })=>{
|
|
148
|
-
this.browseFilesPassedParams = {
|
|
149
|
-
onSuccess,
|
|
150
|
-
onError
|
|
151
|
-
};
|
|
152
|
-
this.input && this.input.click();
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
export { Files };
|
|
157
|
-
|
|
158
|
-
//# sourceMappingURL=Files.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-butterfiles/Files.js","sources":["../../src/react-butterfiles/Files.tsx"],"sourcesContent":["import React from \"react\";\nimport bytes from \"bytes\";\nimport { minimatch } from \"minimatch\";\nimport { readFileContent } from \"./utils/readFileContent.js\";\nimport { generateId } from \"./utils/generateId.js\";\n\nexport type SelectedFile = {\n id: string;\n name: string;\n type: string;\n size: number;\n src: {\n file: File;\n base64: string | null;\n };\n};\n\nexport type FileError = {\n id: string;\n type:\n | \"unsupportedFileType\"\n | \"maxSizeExceeded\"\n | \"multipleMaxSizeExceeded\"\n | \"multipleMaxCountExceeded\"\n | \"multipleNotAllowed\";\n index?: number;\n file?: SelectedFile | File;\n multipleFileSize?: number;\n multipleMaxSize?: number;\n multipleMaxCount?: number;\n multipleCount?: number;\n};\n\nexport type BrowseFilesParams = {\n onSuccess?: (files: SelectedFile[]) => void;\n onError?: (errors: FileError[], files: SelectedFile[]) => void;\n};\n\nexport type RenderPropParams = {\n browseFiles: (params: BrowseFilesParams) => void;\n getDropZoneProps: (additionalProps: any) => any;\n getLabelProps: (additionalProps: any) => any;\n validateFiles: (files: SelectedFile[] | File[]) => FileError[];\n};\n\nexport type FilesRules = {\n accept: string[];\n multiple: boolean;\n maxSize: string;\n multipleMaxSize: string;\n multipleMaxCount: number | null;\n convertToBase64: boolean;\n onSuccess?: (files: SelectedFile[]) => void;\n onError?: (errors: FileError[], files: SelectedFile[]) => void;\n};\n\nexport type Props = FilesRules & {\n children: (params: RenderPropParams) => React.ReactNode;\n id?: string;\n};\n\nexport class Files extends React.Component<Props> {\n static defaultProps = {\n accept: [],\n multiple: false,\n maxSize: \"2mb\",\n multipleMaxSize: \"10mb\",\n multipleMaxCount: null,\n convertToBase64: false\n };\n\n input: HTMLInputElement | null = null;\n browseFilesPassedParams: BrowseFilesParams | null = null;\n id: string = generateId();\n\n validateFiles = (files: SelectedFile[] | File[]): FileError[] => {\n const { multiple, multipleMaxSize, multipleMaxCount, accept, maxSize } = this.props;\n\n const errors: FileError[] = [];\n let multipleFileSize = 0;\n\n if (!multiple && files.length > 1) {\n errors.push({\n id: generateId(),\n type: \"multipleNotAllowed\"\n });\n\n return errors;\n }\n\n for (let index = 0; index < files.length; index++) {\n const file = files[index];\n\n if (\n Array.isArray(accept) &&\n accept.length &&\n !accept.some(type => minimatch(file.type, type))\n ) {\n errors.push({\n id: generateId(),\n index,\n file,\n type: \"unsupportedFileType\"\n });\n } else if (maxSize) {\n const sizeAsBytes = bytes(maxSize);\n if (sizeAsBytes && file.size > sizeAsBytes) {\n errors.push({\n id: generateId(),\n index,\n file,\n type: \"maxSizeExceeded\"\n });\n }\n }\n\n if (multiple) {\n multipleFileSize += file.size;\n }\n }\n\n if (multiple) {\n const maxMultipleMaxSize = bytes(multipleMaxSize);\n\n if (maxMultipleMaxSize && multipleMaxSize && multipleFileSize > maxMultipleMaxSize) {\n errors.push({\n id: generateId(),\n type: \"multipleMaxSizeExceeded\",\n multipleFileSize,\n multipleMaxSize: maxMultipleMaxSize\n });\n }\n\n if (multipleMaxCount && files.length > multipleMaxCount) {\n errors.push({\n id: generateId(),\n type: \"multipleMaxCountExceeded\",\n multipleCount: files.length,\n multipleMaxCount\n });\n }\n }\n\n return errors;\n };\n\n processSelectedFiles = async (eventFiles: Array<File>) => {\n if (eventFiles.length === 0) {\n return;\n }\n\n const { convertToBase64, onSuccess, onError } = this.props;\n const { browseFilesPassedParams } = this;\n const callbacks = {\n onSuccess,\n onError\n };\n\n if (browseFilesPassedParams && browseFilesPassedParams.onSuccess) {\n callbacks.onSuccess = browseFilesPassedParams.onSuccess;\n }\n\n if (browseFilesPassedParams && browseFilesPassedParams.onError) {\n callbacks.onError = browseFilesPassedParams.onError;\n }\n\n const files: SelectedFile[] = [...eventFiles].map(file => {\n return {\n id: generateId(),\n name: file.name,\n type: file.type,\n size: file.size,\n src: {\n file,\n base64: null\n }\n };\n });\n\n const errors = this.validateFiles(files);\n\n if (errors.length) {\n callbacks.onError && callbacks.onError(errors, files);\n } else {\n if (convertToBase64) {\n for (let i = 0; i < files.length; i++) {\n const file = files[i].src.file;\n files[i].src.base64 = await readFileContent(file);\n }\n }\n\n callbacks.onSuccess && callbacks.onSuccess(files);\n }\n\n // Reset the browseFiles arguments.\n if (this.input) {\n this.input.value = \"\";\n }\n this.browseFilesPassedParams = null;\n };\n\n /**\n * Extracted into a separate method just for testing purposes.\n */\n onDropFilesHandler = async ({ e, onSuccess, onError }: any) => {\n this.browseFilesPassedParams = { onSuccess, onError };\n e.dataTransfer &&\n e.dataTransfer.files &&\n (await this.processSelectedFiles(e.dataTransfer.files));\n };\n\n /**\n * Extracted into a separate method just for testing purposes.\n */\n browseFilesHandler = ({ onSuccess, onError }: any) => {\n this.browseFilesPassedParams = { onSuccess, onError };\n this.input && this.input.click();\n };\n\n override render() {\n const { multiple, accept, id } = this.props;\n return (\n <React.Fragment>\n {this.props.children({\n getLabelProps: (props: any) => {\n return {\n ...props,\n htmlFor: id || this.id\n };\n },\n validateFiles: this.validateFiles,\n browseFiles: ({ onSuccess, onError }: BrowseFilesParams = {}) => {\n this.browseFilesHandler({ onSuccess, onError });\n },\n getDropZoneProps: ({\n onSuccess,\n onError,\n onDragOver,\n onDrop,\n ...rest\n }: any = {}) => {\n return {\n ...rest,\n onDragOver: (e: DragEvent) => {\n e.preventDefault();\n typeof onDragOver === \"function\" && onDragOver();\n },\n onDrop: async (e: DragEvent) => {\n e.preventDefault();\n typeof onDrop === \"function\" && onDrop();\n this.onDropFilesHandler({ e, onSuccess, onError });\n }\n };\n }\n })}\n\n <input\n id={id || this.id}\n ref={ref => {\n if (ref) {\n this.input = ref;\n }\n }}\n accept={accept.join(\",\")}\n style={{ display: \"none\" }}\n type=\"file\"\n multiple={multiple}\n onChange={e =>\n this.processSelectedFiles((e.target.files as any as Array<File>) ?? [])\n }\n />\n </React.Fragment>\n );\n }\n}\n"],"names":["Files","React","multiple","accept","id","props","onSuccess","onError","onDragOver","onDrop","rest","e","ref","generateId","files","multipleMaxSize","multipleMaxCount","maxSize","errors","multipleFileSize","index","file","Array","type","minimatch","sizeAsBytes","bytes","maxMultipleMaxSize","eventFiles","convertToBase64","browseFilesPassedParams","callbacks","i","readFileContent"],"mappings":";;;;;AA6DO,MAAMA,cAAcC,MAAAA,SAAe;;aAC/B,YAAY,GAAG;YAClB,QAAQ,EAAE;YACV,UAAU;YACV,SAAS;YACT,iBAAiB;Y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A,EAAE,YAAY,CAAC,KAAK,IACnB,MAAM,IAAI,CAAC,oBAAoB,CAACA,EAAE,YAAY,CAAC,KAAK;QAC7D,GAIC,KACD,kBAAkB,GAAG,CAAC,EAAEL,SAAS,EAAEC,OAAO,EAAO;YAC7C,IAAI,CAAC,uBAAuB,GAAG;gBAAED;gBAAWC;YAAQ;YACpD,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;QAClC;;AAyDJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
delete this folder?
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-butterfiles/index.js","sources":["../../src/react-butterfiles/index.ts"],"sourcesContent":["import { Files } from \"./Files.js\";\n\nexport default Files;\n"],"names":["Files"],"mappings":";AAEA,0BAAeA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const generateId: () => string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-butterfiles/utils/generateId.js","sources":["../../../src/react-butterfiles/utils/generateId.ts"],"sourcesContent":["export const generateId = () => {\n return \"_\" + Math.random().toString(36).substr(2, 9);\n};\n"],"names":["generateId","Math"],"mappings":"AAAO,MAAMA,aAAa,IACf,MAAMC,KAAK,MAAM,GAAG,QAAQ,CAAC,IAAI,MAAM,CAAC,GAAG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const readFileContent: (file: File) => Promise<string>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const readFileContent = async (file)=>new Promise((resolve, reject)=>{
|
|
2
|
-
const reader = new window.FileReader();
|
|
3
|
-
reader.onload = function(e) {
|
|
4
|
-
if (e.target) resolve(e.target.result);
|
|
5
|
-
else reject("Unable to read file contents!");
|
|
6
|
-
};
|
|
7
|
-
reader.readAsDataURL(file);
|
|
8
|
-
});
|
|
9
|
-
export { readFileContent };
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=readFileContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-butterfiles/utils/readFileContent.js","sources":["../../../src/react-butterfiles/utils/readFileContent.ts"],"sourcesContent":["export const readFileContent = async (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new window.FileReader();\n reader.onload = function (e) {\n if (e.target) {\n resolve(e.target.result as string);\n } else {\n reject(`Unable to read file contents!`);\n }\n };\n\n reader.readAsDataURL(file);\n });\n};\n"],"names":["readFileContent","file","Promise","resolve","reject","reader","window","e"],"mappings":"AAAO,MAAMA,kBAAkB,OAAOC,OAC3B,IAAIC,QAAgB,CAACC,SAASC;QACjC,MAAMC,SAAS,IAAIC,OAAO,UAAU;QACpCD,OAAO,MAAM,GAAG,SAAUE,CAAC;YACvB,IAAIA,EAAE,MAAM,EACRJ,QAAQI,EAAE,MAAM,CAAC,MAAM;iBAEvBH,OAAO;QAEf;QAEAC,OAAO,aAAa,CAACJ;IACzB"}
|