@gradio/code 0.4.0 → 0.5.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 CHANGED
@@ -1,14 +1,30 @@
1
1
  # @gradio/code
2
2
 
3
+ ## 0.5.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`065c5b1`](https://github.com/gradio-app/gradio/commit/065c5b163c4badb9d9cbd06d627fb4ba086003e7)]:
8
+ - @gradio/utils@0.3.0
9
+ - @gradio/atoms@0.5.2
10
+ - @gradio/statustracker@0.4.6
11
+ - @gradio/upload@0.7.3
12
+
13
+ ## 0.5.0
14
+
15
+ ### Features
16
+
17
+ - [#7328](https://github.com/gradio-app/gradio/pull/7328) [`c1a7ea7`](https://github.com/gradio-app/gradio/commit/c1a7ea7c0c294aa970624f02225717c12bcf9b58) - Add SQL Support for gr.Code. Thanks [@aersam](https://github.com/aersam)!
18
+
3
19
  ## 0.4.0
4
20
 
5
21
  ### Features
6
22
 
7
- - [#7240](https://github.com/gradio-app/gradio/pull/7240) [`1893756`](https://github.com/gradio-app/gradio/commit/18937564ab8906710549d5bccc48f7188c836f38) - Small cleanups of `Code` component. Thanks [@abidlabs](https://github.com/abidlabs)!
23
+ - [#7240](https://github.com/gradio-app/gradio/pull/7240) [`1893756`](https://github.com/gradio-app/gradio/commit/18937564ab8906710549d5bccc48f7188c836f38) - Small cleanups of `Code` component. Thanks [@abidlabs](https://github.com/abidlabs)!
8
24
 
9
25
  ### Fixes
10
26
 
11
- - [#7192](https://github.com/gradio-app/gradio/pull/7192) [`8dd6f4b`](https://github.com/gradio-app/gradio/commit/8dd6f4bc1901792f05cd59e86df7b1dbab692739) - Handle the case where examples is `null` for all components. Thanks [@abidlabs](https://github.com/abidlabs)!
27
+ - [#7192](https://github.com/gradio-app/gradio/pull/7192) [`8dd6f4b`](https://github.com/gradio-app/gradio/commit/8dd6f4bc1901792f05cd59e86df7b1dbab692739) - Handle the case where examples is `null` for all components. Thanks [@abidlabs](https://github.com/abidlabs)!
12
28
 
13
29
  ## 0.3.8
14
30
 
@@ -275,4 +291,4 @@ Thanks [@pngwn](https://github.com/pngwn)!
275
291
 
276
292
  - Updated dependencies []:
277
293
  - @gradio/atoms@0.0.2
278
- - @gradio/upload@0.0.2
294
+ - @gradio/upload@0.0.2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/code",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -27,12 +27,12 @@
27
27
  "cm6-theme-basic-dark": "^0.2.0",
28
28
  "cm6-theme-basic-light": "^0.2.0",
29
29
  "codemirror": "^6.0.1",
30
- "@gradio/atoms": "^0.5.1",
31
30
  "@gradio/icons": "^0.3.2",
32
- "@gradio/statustracker": "^0.4.5",
33
- "@gradio/upload": "^0.7.1",
34
- "@gradio/wasm": "^0.6.0",
35
- "@gradio/utils": "^0.2.2"
31
+ "@gradio/atoms": "^0.5.2",
32
+ "@gradio/statustracker": "^0.4.6",
33
+ "@gradio/upload": "^0.7.3",
34
+ "@gradio/utils": "^0.3.0",
35
+ "@gradio/wasm": "^0.6.0"
36
36
  },
37
37
  "main_changeset": true,
38
38
  "main": "./Index.svelte",
@@ -1,5 +1,6 @@
1
1
  import type { Extension } from "@codemirror/state";
2
2
  import { StreamLanguage } from "@codemirror/language";
3
+ import { sql } from "@codemirror/legacy-modes/mode/sql";
3
4
 
4
5
  const possible_langs = [
5
6
  "python",
@@ -12,9 +13,26 @@ const possible_langs = [
12
13
  "yaml",
13
14
  "dockerfile",
14
15
  "shell",
15
- "r"
16
+ "r",
17
+ "sql"
16
18
  ];
17
19
 
20
+ const sql_dialects = [
21
+ "standardSQL",
22
+ "msSQL",
23
+ "mySQL",
24
+ "mariaDB",
25
+ "sqlite",
26
+ "cassandra",
27
+ "plSQL",
28
+ "hive",
29
+ "pgSQL",
30
+ "gql",
31
+ "gpSQL",
32
+ "sparkSQL",
33
+ "esper"
34
+ ] as const;
35
+
18
36
  const lang_map: Record<string, (() => Promise<Extension>) | undefined> = {
19
37
  python: () => import("@codemirror/lang-python").then((m) => m.python()),
20
38
  markdown: async () => {
@@ -48,7 +66,20 @@ const lang_map: Record<string, (() => Promise<Extension>) | undefined> = {
48
66
  r: () =>
49
67
  import("@codemirror/legacy-modes/mode/r").then((m) =>
50
68
  StreamLanguage.define(m.r)
51
- )
69
+ ),
70
+ sql: () =>
71
+ import("@codemirror/legacy-modes/mode/sql").then((m) =>
72
+ StreamLanguage.define(m.standardSQL)
73
+ ),
74
+ ...Object.fromEntries(
75
+ sql_dialects.map((dialect) => [
76
+ "sql-" + dialect,
77
+ () =>
78
+ import("@codemirror/legacy-modes/mode/sql").then((m) =>
79
+ StreamLanguage.define(m[dialect])
80
+ )
81
+ ])
82
+ )
52
83
  } as const;
53
84
 
54
85
  const alias_map: Record<string, string> = {