@gradio/code 0.2.3 → 0.2.5
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 +13 -0
- package/Index.svelte +11 -1
- package/package.json +2 -2
- package/shared/Code.svelte +17 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# @gradio/code
|
2
2
|
|
3
|
+
## 0.2.5
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- Updated dependencies []:
|
8
|
+
- @gradio/upload@0.4.1
|
9
|
+
|
10
|
+
## 0.2.4
|
11
|
+
|
12
|
+
### Fixes
|
13
|
+
|
14
|
+
- [#6323](https://github.com/gradio-app/gradio/pull/6323) [`55fda81fa`](https://github.com/gradio-app/gradio/commit/55fda81fa5918b48952729232d6e2fc55af9351d) - Textbox and Code Component Blur/Focus Fixes. Thanks [@dawoodkhan82](https://github.com/dawoodkhan82)!
|
15
|
+
|
3
16
|
## 0.2.3
|
4
17
|
|
5
18
|
### Patch Changes
|
package/Index.svelte
CHANGED
@@ -21,6 +21,8 @@
|
|
21
21
|
export let gradio: Gradio<{
|
22
22
|
change: typeof value;
|
23
23
|
input: never;
|
24
|
+
blur: never;
|
25
|
+
focus: never;
|
24
26
|
}>;
|
25
27
|
export let value = "";
|
26
28
|
export let value_is_output = false;
|
@@ -74,6 +76,14 @@
|
|
74
76
|
{:else}
|
75
77
|
<Widget {language} {value} />
|
76
78
|
|
77
|
-
<Code
|
79
|
+
<Code
|
80
|
+
bind:value
|
81
|
+
{language}
|
82
|
+
{lines}
|
83
|
+
{dark_mode}
|
84
|
+
readonly={!interactive}
|
85
|
+
on:blur={() => gradio.dispatch("blur")}
|
86
|
+
on:focus={() => gradio.dispatch("focus")}
|
87
|
+
/>
|
78
88
|
{/if}
|
79
89
|
</Block>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/code",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.5",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
@@ -30,7 +30,7 @@
|
|
30
30
|
"@gradio/atoms": "^0.2.1",
|
31
31
|
"@gradio/icons": "^0.2.0",
|
32
32
|
"@gradio/statustracker": "^0.3.1",
|
33
|
-
"@gradio/upload": "^0.
|
33
|
+
"@gradio/upload": "^0.4.1",
|
34
34
|
"@gradio/utils": "^0.2.0"
|
35
35
|
},
|
36
36
|
"main_changeset": true,
|
package/shared/Code.svelte
CHANGED
@@ -28,7 +28,11 @@
|
|
28
28
|
export let readonly = false;
|
29
29
|
export let placeholder: string | HTMLElement | null | undefined = undefined;
|
30
30
|
|
31
|
-
const dispatch = createEventDispatcher<{
|
31
|
+
const dispatch = createEventDispatcher<{
|
32
|
+
change: string;
|
33
|
+
blur: undefined;
|
34
|
+
focus: undefined;
|
35
|
+
}>();
|
32
36
|
let lang_extension: Extension | undefined;
|
33
37
|
let element: HTMLDivElement;
|
34
38
|
let view: EditorView;
|
@@ -63,10 +67,21 @@
|
|
63
67
|
}
|
64
68
|
|
65
69
|
function createEditorView(): EditorView {
|
66
|
-
|
70
|
+
const editorView = new EditorView({
|
67
71
|
parent: element,
|
68
72
|
state: createEditorState(value)
|
69
73
|
});
|
74
|
+
editorView.dom.addEventListener("focus", handleFocus, true);
|
75
|
+
editorView.dom.addEventListener("blur", handleBlur, true);
|
76
|
+
return editorView;
|
77
|
+
}
|
78
|
+
|
79
|
+
function handleFocus(): void {
|
80
|
+
dispatch("focus");
|
81
|
+
}
|
82
|
+
|
83
|
+
function handleBlur(): void {
|
84
|
+
dispatch("blur");
|
70
85
|
}
|
71
86
|
|
72
87
|
function getGutterLineHeight(_view: EditorView): string | null {
|