@gradio/file 0.12.28 → 0.13.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/CHANGELOG.md +40 -0
- package/Index.svelte +1 -1
- package/dist/Example.svelte.d.ts +3 -1
- package/dist/Index.svelte +5 -7
- package/dist/Index.svelte.d.ts +16 -14
- package/dist/shared/File.svelte.d.ts +5 -3
- package/dist/shared/FilePreview.svelte +10 -12
- package/dist/shared/FilePreview.svelte.d.ts +5 -3
- package/dist/shared/FileUpload.svelte +1 -2
- package/dist/shared/FileUpload.svelte.d.ts +11 -9
- package/package.json +7 -8
- package/shared/FilePreview.svelte +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
1
|
# @gradio/file
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#11858](https://github.com/gradio-app/gradio/pull/11858) [`3f8ea13`](https://github.com/gradio-app/gradio/commit/3f8ea13a8ca92abf0ad34392e403a449fda3c6c2) - remove lite. Thanks @pngwn!
|
|
8
|
+
|
|
9
|
+
### Fixes
|
|
10
|
+
|
|
11
|
+
- [#11784](https://github.com/gradio-app/gradio/pull/11784) [`d9dd3f5`](https://github.com/gradio-app/gradio/commit/d9dd3f54b7fb34cf7118e549d39fc63937ca3489) - Add "hidden" option to component's `visible` kwarg to render but visually hide the component. Thanks @pngwn!
|
|
12
|
+
|
|
13
|
+
### Dependency updates
|
|
14
|
+
|
|
15
|
+
- @gradio/statustracker@0.11.1
|
|
16
|
+
- @gradio/atoms@0.18.0
|
|
17
|
+
- @gradio/client@1.19.0
|
|
18
|
+
- @gradio/upload@0.17.0
|
|
19
|
+
|
|
20
|
+
## 0.12.29
|
|
21
|
+
|
|
22
|
+
### Dependency updates
|
|
23
|
+
|
|
24
|
+
- @gradio/client@1.18.0
|
|
25
|
+
- @gradio/icons@0.14.0
|
|
26
|
+
- @gradio/atoms@0.17.0
|
|
27
|
+
- @gradio/statustracker@0.11.0
|
|
28
|
+
- @gradio/upload@0.16.17
|
|
29
|
+
|
|
30
|
+
## 0.12.28
|
|
31
|
+
|
|
32
|
+
### Dependency updates
|
|
33
|
+
|
|
34
|
+
- @gradio/statustracker@0.10.18
|
|
35
|
+
|
|
36
|
+
## 0.12.28
|
|
37
|
+
|
|
38
|
+
### Dependency updates
|
|
39
|
+
|
|
40
|
+
- @gradio/icons@0.13.1
|
|
41
|
+
- @gradio/upload@0.16.16
|
|
42
|
+
|
|
3
43
|
## 0.12.28
|
|
4
44
|
|
|
5
45
|
### Dependency updates
|
package/Index.svelte
CHANGED
package/dist/Example.svelte.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ declare const __propDef: {
|
|
|
4
4
|
props: {
|
|
5
5
|
value: FileData | null;
|
|
6
6
|
type: "gallery" | "table";
|
|
7
|
-
selected?: boolean
|
|
7
|
+
selected?: boolean;
|
|
8
8
|
};
|
|
9
9
|
events: {
|
|
10
10
|
[evt: string]: CustomEvent<any>;
|
|
11
11
|
};
|
|
12
12
|
slots: {};
|
|
13
|
+
exports?: {} | undefined;
|
|
14
|
+
bindings?: string | undefined;
|
|
13
15
|
};
|
|
14
16
|
export type ExampleProps = typeof __propDef.props;
|
|
15
17
|
export type ExampleEvents = typeof __propDef.events;
|
package/dist/Index.svelte
CHANGED
|
@@ -30,14 +30,12 @@ export let file_types = ["file"];
|
|
|
30
30
|
export let input_ready;
|
|
31
31
|
export let allow_reordering = false;
|
|
32
32
|
let uploading = false;
|
|
33
|
-
$:
|
|
34
|
-
input_ready = !uploading;
|
|
33
|
+
$: input_ready = !uploading;
|
|
35
34
|
let old_value = value;
|
|
36
|
-
$:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
35
|
+
$: if (JSON.stringify(old_value) !== JSON.stringify(value)) {
|
|
36
|
+
gradio.dispatch("change");
|
|
37
|
+
old_value = value;
|
|
38
|
+
}
|
|
41
39
|
let dragging = false;
|
|
42
40
|
let pending_upload = false;
|
|
43
41
|
</script>
|
package/dist/Index.svelte.d.ts
CHANGED
|
@@ -8,19 +8,19 @@ import type { FileData } from "@gradio/client";
|
|
|
8
8
|
import type { LoadingStatus } from "@gradio/statustracker";
|
|
9
9
|
declare const __propDef: {
|
|
10
10
|
props: {
|
|
11
|
-
elem_id?: string
|
|
12
|
-
elem_classes?: string[]
|
|
13
|
-
visible?: boolean |
|
|
11
|
+
elem_id?: string;
|
|
12
|
+
elem_classes?: string[];
|
|
13
|
+
visible?: boolean | "hidden";
|
|
14
14
|
value: null | FileData | FileData[];
|
|
15
15
|
interactive: boolean;
|
|
16
16
|
root: string;
|
|
17
17
|
label: string;
|
|
18
18
|
show_label: boolean;
|
|
19
19
|
height?: number | undefined;
|
|
20
|
-
_selectable?: boolean
|
|
20
|
+
_selectable?: boolean;
|
|
21
21
|
loading_status: LoadingStatus;
|
|
22
|
-
container?: boolean
|
|
23
|
-
scale?:
|
|
22
|
+
container?: boolean;
|
|
23
|
+
scale?: number | null;
|
|
24
24
|
min_width?: number | undefined;
|
|
25
25
|
gradio: Gradio<{
|
|
26
26
|
change: never;
|
|
@@ -33,14 +33,16 @@ declare const __propDef: {
|
|
|
33
33
|
download: FileData;
|
|
34
34
|
}>;
|
|
35
35
|
file_count: "single" | "multiple" | "directory";
|
|
36
|
-
file_types?: string[]
|
|
36
|
+
file_types?: string[];
|
|
37
37
|
input_ready: boolean;
|
|
38
|
-
allow_reordering?: boolean
|
|
38
|
+
allow_reordering?: boolean;
|
|
39
39
|
};
|
|
40
40
|
events: {
|
|
41
41
|
[evt: string]: CustomEvent<any>;
|
|
42
42
|
};
|
|
43
43
|
slots: {};
|
|
44
|
+
exports?: {} | undefined;
|
|
45
|
+
bindings?: string | undefined;
|
|
44
46
|
};
|
|
45
47
|
export type IndexProps = typeof __propDef.props;
|
|
46
48
|
export type IndexEvents = typeof __propDef.events;
|
|
@@ -52,12 +54,12 @@ export default class Index extends SvelteComponent<IndexProps, IndexEvents, Inde
|
|
|
52
54
|
get elem_classes(): string[] | undefined;
|
|
53
55
|
/**accessor*/
|
|
54
56
|
set elem_classes(_: string[] | undefined);
|
|
55
|
-
get visible(): boolean | undefined;
|
|
57
|
+
get visible(): boolean | "hidden" | undefined;
|
|
56
58
|
/**accessor*/
|
|
57
|
-
set visible(_: boolean | undefined);
|
|
58
|
-
get value():
|
|
59
|
+
set visible(_: boolean | "hidden" | undefined);
|
|
60
|
+
get value(): any;
|
|
59
61
|
/**accessor*/
|
|
60
|
-
set value(_:
|
|
62
|
+
set value(_: any);
|
|
61
63
|
get interactive(): boolean;
|
|
62
64
|
/**accessor*/
|
|
63
65
|
set interactive(_: boolean);
|
|
@@ -109,9 +111,9 @@ export default class Index extends SvelteComponent<IndexProps, IndexEvents, Inde
|
|
|
109
111
|
delete: FileData;
|
|
110
112
|
download: FileData;
|
|
111
113
|
}>);
|
|
112
|
-
get file_count(): "
|
|
114
|
+
get file_count(): "multiple" | "single" | "directory";
|
|
113
115
|
/**accessor*/
|
|
114
|
-
set file_count(_: "
|
|
116
|
+
set file_count(_: "multiple" | "single" | "directory");
|
|
115
117
|
get file_types(): string[] | undefined;
|
|
116
118
|
/**accessor*/
|
|
117
119
|
set file_types(_: string[] | undefined);
|
|
@@ -3,10 +3,10 @@ import type { FileData } from "@gradio/client";
|
|
|
3
3
|
import type { I18nFormatter } from "@gradio/utils";
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
|
-
value?:
|
|
6
|
+
value?: FileData | FileData[] | null;
|
|
7
7
|
label: string;
|
|
8
|
-
show_label?: boolean
|
|
9
|
-
selectable?: boolean
|
|
8
|
+
show_label?: boolean;
|
|
9
|
+
selectable?: boolean;
|
|
10
10
|
height?: number | undefined;
|
|
11
11
|
i18n: I18nFormatter;
|
|
12
12
|
};
|
|
@@ -17,6 +17,8 @@ declare const __propDef: {
|
|
|
17
17
|
[evt: string]: CustomEvent<any>;
|
|
18
18
|
};
|
|
19
19
|
slots: {};
|
|
20
|
+
exports?: {} | undefined;
|
|
21
|
+
bindings?: string | undefined;
|
|
20
22
|
};
|
|
21
23
|
export type FileProps = typeof __propDef.props;
|
|
22
24
|
export type FileEvents = typeof __propDef.events;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { prettyBytes } from "./utils";
|
|
2
2
|
import { createEventDispatcher } from "svelte";
|
|
3
|
-
import { DownloadLink } from "@gradio/
|
|
3
|
+
import { DownloadLink } from "@gradio/atoms";
|
|
4
4
|
const dispatch = createEventDispatcher();
|
|
5
5
|
export let value;
|
|
6
6
|
export let selectable = false;
|
|
@@ -37,8 +37,7 @@ function handle_drag_end(event) {
|
|
|
37
37
|
}
|
|
38
38
|
function handle_drop(event, index) {
|
|
39
39
|
event.preventDefault();
|
|
40
|
-
if (dragging_index === null || dragging_index === index)
|
|
41
|
-
return;
|
|
40
|
+
if (dragging_index === null || dragging_index === index) return;
|
|
42
41
|
const files = Array.isArray(value) ? [...value] : [value];
|
|
43
42
|
const [removed] = files.splice(dragging_index, 1);
|
|
44
43
|
files.splice(
|
|
@@ -58,15 +57,14 @@ function split_filename(filename) {
|
|
|
58
57
|
}
|
|
59
58
|
return [filename.slice(0, last_dot), filename.slice(last_dot)];
|
|
60
59
|
}
|
|
61
|
-
$:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
60
|
+
$: normalized_files = (Array.isArray(value) ? value : [value]).map((file) => {
|
|
61
|
+
const [filename_stem, filename_ext] = split_filename(file.orig_name ?? "");
|
|
62
|
+
return {
|
|
63
|
+
...file,
|
|
64
|
+
filename_stem,
|
|
65
|
+
filename_ext
|
|
66
|
+
};
|
|
67
|
+
});
|
|
70
68
|
function handle_row_click(event, index) {
|
|
71
69
|
const tr = event.currentTarget;
|
|
72
70
|
const should_select = event.target === tr || // Only select if the click is on the row itself
|
|
@@ -4,21 +4,23 @@ import type { I18nFormatter, SelectData } from "@gradio/utils";
|
|
|
4
4
|
declare const __propDef: {
|
|
5
5
|
props: {
|
|
6
6
|
value: FileData | FileData[];
|
|
7
|
-
selectable?: boolean
|
|
7
|
+
selectable?: boolean;
|
|
8
8
|
height?: number | string | undefined;
|
|
9
9
|
i18n: I18nFormatter;
|
|
10
|
-
allow_reordering?: boolean
|
|
10
|
+
allow_reordering?: boolean;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
13
13
|
dragenter: DragEvent;
|
|
14
14
|
select: CustomEvent<SelectData>;
|
|
15
|
-
change: CustomEvent<
|
|
15
|
+
change: CustomEvent<any>;
|
|
16
16
|
delete: CustomEvent<FileData>;
|
|
17
17
|
download: CustomEvent<FileData>;
|
|
18
18
|
} & {
|
|
19
19
|
[evt: string]: CustomEvent<any>;
|
|
20
20
|
};
|
|
21
21
|
slots: {};
|
|
22
|
+
exports?: {} | undefined;
|
|
23
|
+
bindings?: string | undefined;
|
|
22
24
|
};
|
|
23
25
|
export type FilePreviewProps = typeof __propDef.props;
|
|
24
26
|
export type FilePreviewEvents = typeof __propDef.events;
|
|
@@ -38,8 +38,7 @@ function handle_clear() {
|
|
|
38
38
|
}
|
|
39
39
|
const dispatch = createEventDispatcher();
|
|
40
40
|
let dragging = false;
|
|
41
|
-
$:
|
|
42
|
-
dispatch("drag", dragging);
|
|
41
|
+
$: dispatch("drag", dragging);
|
|
43
42
|
</script>
|
|
44
43
|
|
|
45
44
|
<BlockLabel {show_label} Icon={File} float={!value} label={label || "File"} />
|
|
@@ -5,18 +5,18 @@ declare const __propDef: {
|
|
|
5
5
|
props: {
|
|
6
6
|
value: null | FileData | FileData[];
|
|
7
7
|
label: string;
|
|
8
|
-
show_label?: boolean
|
|
9
|
-
file_count?:
|
|
10
|
-
file_types?:
|
|
11
|
-
selectable?: boolean
|
|
8
|
+
show_label?: boolean;
|
|
9
|
+
file_count?: "single" | "multiple" | "directory";
|
|
10
|
+
file_types?: string[] | null;
|
|
11
|
+
selectable?: boolean;
|
|
12
12
|
root: string;
|
|
13
13
|
height?: number | undefined;
|
|
14
14
|
i18n: I18nFormatter;
|
|
15
|
-
max_file_size?:
|
|
15
|
+
max_file_size?: number | null;
|
|
16
16
|
upload: Client["upload"];
|
|
17
17
|
stream_handler: Client["stream"];
|
|
18
|
-
uploading?: boolean
|
|
19
|
-
allow_reordering?: boolean
|
|
18
|
+
uploading?: boolean;
|
|
19
|
+
allow_reordering?: boolean;
|
|
20
20
|
};
|
|
21
21
|
events: {
|
|
22
22
|
error: CustomEvent<any>;
|
|
@@ -25,14 +25,16 @@ declare const __propDef: {
|
|
|
25
25
|
delete: CustomEvent<FileData>;
|
|
26
26
|
clear: CustomEvent<undefined>;
|
|
27
27
|
drag: CustomEvent<boolean>;
|
|
28
|
-
upload: CustomEvent<
|
|
29
|
-
load: CustomEvent<
|
|
28
|
+
upload: CustomEvent<any>;
|
|
29
|
+
load: CustomEvent<any>;
|
|
30
30
|
} & {
|
|
31
31
|
[evt: string]: CustomEvent<any>;
|
|
32
32
|
};
|
|
33
33
|
slots: {
|
|
34
34
|
default: {};
|
|
35
35
|
};
|
|
36
|
+
exports?: {} | undefined;
|
|
37
|
+
bindings?: string | undefined;
|
|
36
38
|
};
|
|
37
39
|
export type FileUploadProps = typeof __propDef.props;
|
|
38
40
|
export type FileUploadEvents = typeof __propDef.events;
|
package/package.json
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/file",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"private": false,
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@gradio/atoms": "^0.
|
|
11
|
-
"@gradio/icons": "^0.
|
|
12
|
-
"@gradio/
|
|
13
|
-
"@gradio/
|
|
14
|
-
"@gradio/upload": "^0.
|
|
15
|
-
"@gradio/utils": "^0.10.2"
|
|
16
|
-
"@gradio/wasm": "^0.18.1"
|
|
10
|
+
"@gradio/atoms": "^0.18.0",
|
|
11
|
+
"@gradio/icons": "^0.14.0",
|
|
12
|
+
"@gradio/statustracker": "^0.11.1",
|
|
13
|
+
"@gradio/client": "^1.19.0",
|
|
14
|
+
"@gradio/upload": "^0.17.0",
|
|
15
|
+
"@gradio/utils": "^0.10.2"
|
|
17
16
|
},
|
|
18
17
|
"devDependencies": {
|
|
19
18
|
"@gradio/preview": "^0.14.0"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { prettyBytes } from "./utils";
|
|
4
4
|
import { createEventDispatcher } from "svelte";
|
|
5
5
|
import type { I18nFormatter, SelectData } from "@gradio/utils";
|
|
6
|
-
import { DownloadLink } from "@gradio/
|
|
6
|
+
import { DownloadLink } from "@gradio/atoms";
|
|
7
7
|
|
|
8
8
|
const dispatch = createEventDispatcher<{
|
|
9
9
|
select: SelectData;
|