@gradio/multimodaltextbox 0.11.11 → 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 +35 -0
- package/Index.svelte +1 -1
- package/MultimodalTextbox.stories.svelte +0 -23
- package/MultimodalTextbox.test.ts +1 -1
- package/MultimodalTextboxExample.stories.svelte +0 -11
- package/dist/Index.svelte +1 -1
- package/dist/shared/MultimodalTextbox.svelte +5 -1
- package/dist/shared/utils.js +13 -1
- package/dist/types.d.ts +1 -1
- package/package.json +9 -9
- package/shared/MultimodalTextbox.svelte +5 -1
- package/shared/utils.ts +15 -1
- package/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @gradio/multimodaltextbox
|
|
2
2
|
|
|
3
|
+
## 0.13.0
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- [#13526](https://github.com/gradio-app/gradio/pull/13526) [`53cb4ca`](https://github.com/gradio-app/gradio/commit/53cb4cae1ec3521e9170d12867253516413ba37a) - Run `pnpm lint` and `pnpm ts:check` on CI. Thanks @abidlabs!
|
|
8
|
+
|
|
9
|
+
### Dependency updates
|
|
10
|
+
|
|
11
|
+
- @gradio/atoms@0.25.0
|
|
12
|
+
- @gradio/statustracker@0.15.0
|
|
13
|
+
- @gradio/utils@0.13.0
|
|
14
|
+
- @gradio/client@2.3.0
|
|
15
|
+
- @gradio/upload@0.18.0
|
|
16
|
+
- @gradio/image@0.27.0
|
|
17
|
+
- @gradio/video@0.21.0
|
|
18
|
+
- @gradio/audio@0.24.0
|
|
19
|
+
|
|
20
|
+
## 0.12.0
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- [#13509](https://github.com/gradio-app/gradio/pull/13509) [`dcd072c`](https://github.com/gradio-app/gradio/commit/dcd072cd57f09ffd2dc5f97ae6afc505894824a6) - Migrate Chatbot, Tabs, TabItem to Svelte 5. Thanks @dawoodkhan82!
|
|
25
|
+
|
|
26
|
+
### Dependency updates
|
|
27
|
+
|
|
28
|
+
- @gradio/client@2.2.2
|
|
29
|
+
- @gradio/audio@0.23.4
|
|
30
|
+
|
|
31
|
+
## 0.11.11
|
|
32
|
+
|
|
33
|
+
### Dependency updates
|
|
34
|
+
|
|
35
|
+
- @gradio/client@2.2.1
|
|
36
|
+
- @gradio/upload@0.17.10
|
|
37
|
+
|
|
3
38
|
## 0.11.11
|
|
4
39
|
|
|
5
40
|
### Dependency updates
|
package/Index.svelte
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
|
|
92
92
|
// Create const references to the callbacks so that afterUpdate in child is not called on every prop change
|
|
93
93
|
// in the DOM. See https://github.com/gradio-app/gradio/issues/11933
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
const upload_fn = (...args: Parameters<typeof gradio.shared.client.upload>) =>
|
|
96
96
|
gradio.shared.client.upload(...args);
|
|
97
97
|
const i18n = (s: string | null | undefined): string => gradio.i18n(s);
|
|
@@ -81,29 +81,6 @@
|
|
|
81
81
|
}}
|
|
82
82
|
{template}
|
|
83
83
|
/>
|
|
84
|
-
<Story
|
|
85
|
-
name="MultimodalTextbox with 5 lines and max 5 lines"
|
|
86
|
-
args={{
|
|
87
|
-
lines: 5,
|
|
88
|
-
max_lines: 5,
|
|
89
|
-
sources: ["upload", "microphone"],
|
|
90
|
-
file_types: [],
|
|
91
|
-
value: { text: "", files: [] }
|
|
92
|
-
}}
|
|
93
|
-
{template}
|
|
94
|
-
/>
|
|
95
|
-
<Story
|
|
96
|
-
name="Right aligned textbox"
|
|
97
|
-
args={{
|
|
98
|
-
text_align: "right",
|
|
99
|
-
sources: ["upload", "microphone"],
|
|
100
|
-
file_types: [],
|
|
101
|
-
lines: 1,
|
|
102
|
-
max_lines: 5,
|
|
103
|
-
value: { text: "", files: [] }
|
|
104
|
-
}}
|
|
105
|
-
{template}
|
|
106
|
-
/>
|
|
107
84
|
<Story
|
|
108
85
|
name="Single file upload"
|
|
109
86
|
args={{
|
|
@@ -3,7 +3,7 @@ import { cleanup, render } from "@self/tootils/render";
|
|
|
3
3
|
import event from "@testing-library/user-event";
|
|
4
4
|
|
|
5
5
|
import MultimodalTextbox from "./Index.svelte";
|
|
6
|
-
import type { LoadingStatus } from "@gradio/statustracker";
|
|
6
|
+
import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
|
|
7
7
|
|
|
8
8
|
const loading_status: LoadingStatus = {
|
|
9
9
|
eta: 0,
|
package/dist/Index.svelte
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
|
|
92
92
|
// Create const references to the callbacks so that afterUpdate in child is not called on every prop change
|
|
93
93
|
// in the DOM. See https://github.com/gradio-app/gradio/issues/11933
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
const upload_fn = (...args: Parameters<typeof gradio.shared.client.upload>) =>
|
|
96
96
|
gradio.shared.client.upload(...args);
|
|
97
97
|
const i18n = (s: string | null | undefined): string => gradio.i18n(s);
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
import type { InputHTMLAttributes } from "./types";
|
|
27
27
|
|
|
28
28
|
let {
|
|
29
|
-
value = $bindable(
|
|
29
|
+
value = $bindable<{ text: string; files: FileData[] }>({
|
|
30
|
+
text: "",
|
|
31
|
+
files: []
|
|
32
|
+
}),
|
|
30
33
|
value_is_output = false,
|
|
31
34
|
lines = 1,
|
|
32
35
|
i18n: _i18n,
|
|
@@ -173,6 +176,7 @@
|
|
|
173
176
|
});
|
|
174
177
|
|
|
175
178
|
$effect(() => {
|
|
179
|
+
value?.text;
|
|
176
180
|
if (el && lines !== max_lines) {
|
|
177
181
|
resize(el, lines, max_lines);
|
|
178
182
|
}
|
package/dist/shared/utils.js
CHANGED
|
@@ -23,11 +23,23 @@ export async function resize(target, lines, max_lines) {
|
|
|
23
23
|
scroll_height = target.scrollHeight;
|
|
24
24
|
}
|
|
25
25
|
target.style.height = `${scroll_height}px`;
|
|
26
|
+
update_scrollbar_visibility(target);
|
|
27
|
+
}
|
|
28
|
+
function update_scrollbar_visibility(textarea) {
|
|
29
|
+
const content_height = textarea.scrollHeight;
|
|
30
|
+
const visible_height = textarea.clientHeight;
|
|
31
|
+
const line_height = parseFloat(window.getComputedStyle(textarea).lineHeight);
|
|
32
|
+
if (content_height > visible_height + line_height) {
|
|
33
|
+
textarea.style.overflowY = "scroll";
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
textarea.style.overflowY = "hidden";
|
|
37
|
+
}
|
|
26
38
|
}
|
|
27
39
|
export function text_area_resize(_el, _value) {
|
|
28
40
|
if (_value.lines === _value.max_lines)
|
|
29
41
|
return;
|
|
30
|
-
_el
|
|
42
|
+
update_scrollbar_visibility(_el);
|
|
31
43
|
function handle_input(event) {
|
|
32
44
|
resize(event.target, _value.lines, _value.max_lines);
|
|
33
45
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FileData } from "@gradio/client";
|
|
2
2
|
import type { SelectData } from "@gradio/utils";
|
|
3
|
-
import type { LoadingStatus } from "@gradio/statustracker";
|
|
3
|
+
import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
|
|
4
4
|
import type { InputHTMLAttributes } from "./shared/types";
|
|
5
5
|
import type { WaveformOptions } from "js/audio/shared/types";
|
|
6
6
|
export interface MultimodalTextboxEvents {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradio/multimodaltextbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Gradio UI packages",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"./package.json": "./package.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@gradio/atoms": "^0.
|
|
25
|
+
"@gradio/atoms": "^0.25.0",
|
|
26
26
|
"@gradio/icons": "^0.15.1",
|
|
27
|
-
"@gradio/statustracker": "^0.
|
|
28
|
-
"@gradio/utils": "^0.
|
|
29
|
-
"@gradio/upload": "^0.
|
|
30
|
-
"@gradio/image": "^0.
|
|
31
|
-
"@gradio/
|
|
32
|
-
"@gradio/
|
|
33
|
-
"@gradio/
|
|
27
|
+
"@gradio/statustracker": "^0.15.0",
|
|
28
|
+
"@gradio/utils": "^0.13.0",
|
|
29
|
+
"@gradio/upload": "^0.18.0",
|
|
30
|
+
"@gradio/image": "^0.27.0",
|
|
31
|
+
"@gradio/video": "^0.21.0",
|
|
32
|
+
"@gradio/audio": "^0.24.0",
|
|
33
|
+
"@gradio/client": "^2.3.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@gradio/preview": "^0.16.2"
|
|
@@ -26,7 +26,10 @@
|
|
|
26
26
|
import type { InputHTMLAttributes } from "./types";
|
|
27
27
|
|
|
28
28
|
let {
|
|
29
|
-
value = $bindable(
|
|
29
|
+
value = $bindable<{ text: string; files: FileData[] }>({
|
|
30
|
+
text: "",
|
|
31
|
+
files: []
|
|
32
|
+
}),
|
|
30
33
|
value_is_output = false,
|
|
31
34
|
lines = 1,
|
|
32
35
|
i18n: _i18n,
|
|
@@ -173,6 +176,7 @@
|
|
|
173
176
|
});
|
|
174
177
|
|
|
175
178
|
$effect(() => {
|
|
179
|
+
value?.text;
|
|
176
180
|
if (el && lines !== max_lines) {
|
|
177
181
|
resize(el, lines, max_lines);
|
|
178
182
|
}
|
package/shared/utils.ts
CHANGED
|
@@ -37,6 +37,20 @@ export async function resize(
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
target.style.height = `${scroll_height}px`;
|
|
40
|
+
update_scrollbar_visibility(target);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function update_scrollbar_visibility(
|
|
44
|
+
textarea: HTMLTextAreaElement | HTMLInputElement
|
|
45
|
+
): void {
|
|
46
|
+
const content_height = textarea.scrollHeight;
|
|
47
|
+
const visible_height = textarea.clientHeight;
|
|
48
|
+
const line_height = parseFloat(window.getComputedStyle(textarea).lineHeight);
|
|
49
|
+
if (content_height > visible_height + line_height) {
|
|
50
|
+
textarea.style.overflowY = "scroll";
|
|
51
|
+
} else {
|
|
52
|
+
textarea.style.overflowY = "hidden";
|
|
53
|
+
}
|
|
40
54
|
}
|
|
41
55
|
|
|
42
56
|
export function text_area_resize(
|
|
@@ -44,7 +58,7 @@ export function text_area_resize(
|
|
|
44
58
|
_value: Value
|
|
45
59
|
): any | undefined {
|
|
46
60
|
if (_value.lines === _value.max_lines) return;
|
|
47
|
-
_el
|
|
61
|
+
update_scrollbar_visibility(_el);
|
|
48
62
|
|
|
49
63
|
function handle_input(event: Event): void {
|
|
50
64
|
resize(event.target as HTMLTextAreaElement, _value.lines, _value.max_lines);
|
package/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FileData } from "@gradio/client";
|
|
2
2
|
import type { SelectData } from "@gradio/utils";
|
|
3
|
-
import type { LoadingStatus } from "@gradio/statustracker";
|
|
3
|
+
import type { ILoadingStatus as LoadingStatus } from "@gradio/statustracker";
|
|
4
4
|
import type { InputHTMLAttributes } from "./shared/types";
|
|
5
5
|
import type { WaveformOptions } from "js/audio/shared/types";
|
|
6
6
|
|