@gradio/code 0.10.18 → 0.11.1
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 +12 -0
- package/Index.svelte +2 -0
- package/dist/Index.svelte +2 -0
- package/dist/Index.svelte.d.ts +1 -0
- package/dist/shared/Code.svelte +9 -3
- package/dist/shared/Code.svelte.d.ts +1 -0
- package/dist/shared/extensions.js +0 -1
- package/package.json +2 -2
- package/shared/Code.svelte +12 -3
- package/shared/extensions.ts +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @gradio/code
|
2
2
|
|
3
|
+
## 0.11.1
|
4
|
+
|
5
|
+
### Dependency updates
|
6
|
+
|
7
|
+
- @gradio/upload@0.15.3
|
8
|
+
|
9
|
+
## 0.11.0
|
10
|
+
|
11
|
+
### Features
|
12
|
+
|
13
|
+
- [#10643](https://github.com/gradio-app/gradio/pull/10643) [`f0a920c`](https://github.com/gradio-app/gradio/commit/f0a920c4934880645fbad783077ae9c7519856ce) - added a show_line_numbers to toggle line numbers in gr.Code(). Thanks @lalitx17!
|
14
|
+
|
3
15
|
## 0.10.18
|
4
16
|
|
5
17
|
### Dependency updates
|
package/Index.svelte
CHANGED
@@ -39,6 +39,7 @@
|
|
39
39
|
export let scale: number | null = null;
|
40
40
|
export let min_width: number | undefined = undefined;
|
41
41
|
export let wrap_lines = false;
|
42
|
+
export let show_line_numbers = true;
|
42
43
|
|
43
44
|
export let interactive: boolean;
|
44
45
|
|
@@ -91,6 +92,7 @@
|
|
91
92
|
{max_lines}
|
92
93
|
{dark_mode}
|
93
94
|
{wrap_lines}
|
95
|
+
{show_line_numbers}
|
94
96
|
readonly={!interactive}
|
95
97
|
on:blur={() => gradio.dispatch("blur")}
|
96
98
|
on:focus={() => gradio.dispatch("focus")}
|
package/dist/Index.svelte
CHANGED
@@ -26,6 +26,7 @@ export let loading_status;
|
|
26
26
|
export let scale = null;
|
27
27
|
export let min_width = void 0;
|
28
28
|
export let wrap_lines = false;
|
29
|
+
export let show_line_numbers = true;
|
29
30
|
export let interactive;
|
30
31
|
let dark_mode = gradio.theme === "dark";
|
31
32
|
function handle_change() {
|
@@ -76,6 +77,7 @@ $:
|
|
76
77
|
{max_lines}
|
77
78
|
{dark_mode}
|
78
79
|
{wrap_lines}
|
80
|
+
{show_line_numbers}
|
79
81
|
readonly={!interactive}
|
80
82
|
on:blur={() => gradio.dispatch("blur")}
|
81
83
|
on:focus={() => gradio.dispatch("focus")}
|
package/dist/Index.svelte.d.ts
CHANGED
package/dist/shared/Code.svelte
CHANGED
@@ -3,7 +3,8 @@ import {
|
|
3
3
|
EditorView,
|
4
4
|
ViewUpdate,
|
5
5
|
keymap,
|
6
|
-
placeholder as placeholderExt
|
6
|
+
placeholder as placeholderExt,
|
7
|
+
lineNumbers
|
7
8
|
} from "@codemirror/view";
|
8
9
|
import { StateEffect, EditorState } from "@codemirror/state";
|
9
10
|
import { indentWithTab } from "@codemirror/commands";
|
@@ -23,6 +24,7 @@ export let use_tab = true;
|
|
23
24
|
export let readonly = false;
|
24
25
|
export let placeholder = void 0;
|
25
26
|
export let wrap_lines = false;
|
27
|
+
export let show_line_numbers = true;
|
26
28
|
const dispatch = createEventDispatcher();
|
27
29
|
let lang_extension;
|
28
30
|
let element;
|
@@ -114,7 +116,8 @@ function get_extensions() {
|
|
114
116
|
use_tab,
|
115
117
|
placeholder,
|
116
118
|
readonly,
|
117
|
-
lang_extension
|
119
|
+
lang_extension,
|
120
|
+
show_line_numbers
|
118
121
|
),
|
119
122
|
FontTheme,
|
120
123
|
...get_theme(),
|
@@ -159,7 +162,7 @@ function create_editor_state(_value) {
|
|
159
162
|
extensions: get_extensions()
|
160
163
|
});
|
161
164
|
}
|
162
|
-
function get_base_extensions(basic2, use_tab2, placeholder2, readonly2, lang) {
|
165
|
+
function get_base_extensions(basic2, use_tab2, placeholder2, readonly2, lang, show_line_numbers2) {
|
163
166
|
const extensions2 = [
|
164
167
|
EditorView.editable.of(!readonly2),
|
165
168
|
EditorState.readOnly.of(readonly2),
|
@@ -177,6 +180,9 @@ function get_base_extensions(basic2, use_tab2, placeholder2, readonly2, lang) {
|
|
177
180
|
if (lang) {
|
178
181
|
extensions2.push(lang);
|
179
182
|
}
|
183
|
+
if (show_line_numbers2) {
|
184
|
+
extensions2.push(lineNumbers());
|
185
|
+
}
|
180
186
|
extensions2.push(EditorView.updateListener.of(handle_change));
|
181
187
|
if (wrap_lines) {
|
182
188
|
extensions2.push(EditorView.lineWrapping);
|
@@ -6,7 +6,6 @@ import { history, defaultKeymap, historyKeymap } from "@codemirror/commands";
|
|
6
6
|
import { closeBrackets, closeBracketsKeymap, completionKeymap } from "@codemirror/autocomplete";
|
7
7
|
import { lintKeymap } from "@codemirror/lint";
|
8
8
|
export const basicSetup = /*@__PURE__*/ (() => [
|
9
|
-
lineNumbers(),
|
10
9
|
highlightSpecialChars(),
|
11
10
|
history(),
|
12
11
|
foldGutter(),
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gradio/code",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.11.1",
|
4
4
|
"description": "Gradio UI packages",
|
5
5
|
"type": "module",
|
6
6
|
"author": "",
|
@@ -28,8 +28,8 @@
|
|
28
28
|
"cm6-theme-basic-light": "^0.2.0",
|
29
29
|
"codemirror": "^6.0.1",
|
30
30
|
"@gradio/atoms": "^0.13.3",
|
31
|
+
"@gradio/upload": "^0.15.3",
|
31
32
|
"@gradio/statustracker": "^0.10.4",
|
32
|
-
"@gradio/upload": "^0.15.2",
|
33
33
|
"@gradio/icons": "^0.10.0",
|
34
34
|
"@gradio/utils": "^0.10.1",
|
35
35
|
"@gradio/wasm": "^0.17.3"
|
package/shared/Code.svelte
CHANGED
@@ -4,7 +4,8 @@
|
|
4
4
|
EditorView,
|
5
5
|
ViewUpdate,
|
6
6
|
keymap,
|
7
|
-
placeholder as placeholderExt
|
7
|
+
placeholder as placeholderExt,
|
8
|
+
lineNumbers
|
8
9
|
} from "@codemirror/view";
|
9
10
|
import { StateEffect, EditorState, type Extension } from "@codemirror/state";
|
10
11
|
import { indentWithTab } from "@codemirror/commands";
|
@@ -26,6 +27,7 @@
|
|
26
27
|
export let readonly = false;
|
27
28
|
export let placeholder: string | HTMLElement | null | undefined = undefined;
|
28
29
|
export let wrap_lines = false;
|
30
|
+
export let show_line_numbers = true;
|
29
31
|
|
30
32
|
const dispatch = createEventDispatcher<{
|
31
33
|
change: string;
|
@@ -131,7 +133,8 @@
|
|
131
133
|
use_tab,
|
132
134
|
placeholder,
|
133
135
|
readonly,
|
134
|
-
lang_extension
|
136
|
+
lang_extension,
|
137
|
+
show_line_numbers
|
135
138
|
),
|
136
139
|
FontTheme,
|
137
140
|
...get_theme(),
|
@@ -184,7 +187,8 @@
|
|
184
187
|
use_tab: boolean,
|
185
188
|
placeholder: string | HTMLElement | null | undefined,
|
186
189
|
readonly: boolean,
|
187
|
-
lang: Extension | null | undefined
|
190
|
+
lang: Extension | null | undefined,
|
191
|
+
show_line_numbers: boolean
|
188
192
|
): Extension[] {
|
189
193
|
const extensions: Extension[] = [
|
190
194
|
EditorView.editable.of(!readonly),
|
@@ -205,10 +209,15 @@
|
|
205
209
|
extensions.push(lang);
|
206
210
|
}
|
207
211
|
|
212
|
+
if (show_line_numbers) {
|
213
|
+
extensions.push(lineNumbers());
|
214
|
+
}
|
215
|
+
|
208
216
|
extensions.push(EditorView.updateListener.of(handle_change));
|
209
217
|
if (wrap_lines) {
|
210
218
|
extensions.push(EditorView.lineWrapping);
|
211
219
|
}
|
220
|
+
|
212
221
|
return extensions;
|
213
222
|
}
|
214
223
|
|