@gradio/code 0.4.0 → 0.5.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @gradio/code
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Features
6
+
7
+ - [#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)!
8
+
3
9
  ## 0.4.0
4
10
 
5
11
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradio/code",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Gradio UI packages",
5
5
  "type": "module",
6
6
  "author": "",
@@ -27,11 +27,11 @@
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",
31
+ "@gradio/upload": "^0.7.2",
32
32
  "@gradio/statustracker": "^0.4.5",
33
- "@gradio/upload": "^0.7.1",
34
33
  "@gradio/wasm": "^0.6.0",
34
+ "@gradio/atoms": "^0.5.1",
35
35
  "@gradio/utils": "^0.2.2"
36
36
  },
37
37
  "main_changeset": true,
@@ -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> = {