@surrealdb/codemirror 1.0.0-beta.7 → 1.0.0-beta.9
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/dist/index.cjs +14 -9
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +14 -9
- package/package.json +1 -1
- package/src/surrealql.ts +16 -10
package/dist/index.cjs
CHANGED
|
@@ -27,21 +27,26 @@ const surrealqlLanguage = language.LRLanguage.define({
|
|
|
27
27
|
commentTokens: { line: "--" },
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
["
|
|
32
|
-
["
|
|
33
|
-
["combined-results",
|
|
34
|
-
["syntax",
|
|
30
|
+
const scopeMap = new Map([
|
|
31
|
+
["permission", "PermissionInput"],
|
|
32
|
+
["index", "IndexInput"],
|
|
33
|
+
["combined-results", "CombinedResults"],
|
|
34
|
+
["syntax", "Syntax"],
|
|
35
35
|
]);
|
|
36
36
|
/**
|
|
37
37
|
* The CodeMirror extension used to add support for the SurrealQL language
|
|
38
|
+
*
|
|
39
|
+
* @param scope Limit the scope of the highlighting
|
|
38
40
|
*/
|
|
39
|
-
function surrealql(scope
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
function surrealql(scope) {
|
|
42
|
+
if (!scope) {
|
|
43
|
+
return new language.LanguageSupport(surrealqlLanguage);
|
|
44
|
+
}
|
|
45
|
+
const scopeId = scopeMap.get(scope);
|
|
46
|
+
if (!scopeId) {
|
|
42
47
|
throw new Error(`Unknown language scope: ${scope}`);
|
|
43
48
|
}
|
|
44
|
-
return new language.LanguageSupport(
|
|
49
|
+
return new language.LanguageSupport(surrealqlLanguage.configure({ top: scopeId }));
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
exports.surrealql = surrealql;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
2
|
|
|
3
3
|
declare const surrealqlLanguage: LRLanguage;
|
|
4
|
-
type Scope = "
|
|
4
|
+
type Scope = "permission" | "index" | "combined-results" | "syntax";
|
|
5
5
|
/**
|
|
6
6
|
* The CodeMirror extension used to add support for the SurrealQL language
|
|
7
|
+
*
|
|
8
|
+
* @param scope Limit the scope of the highlighting
|
|
7
9
|
*/
|
|
8
10
|
declare function surrealql(scope?: Scope): LanguageSupport;
|
|
9
11
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { LRLanguage, LanguageSupport } from '@codemirror/language';
|
|
2
2
|
|
|
3
3
|
declare const surrealqlLanguage: LRLanguage;
|
|
4
|
-
type Scope = "
|
|
4
|
+
type Scope = "permission" | "index" | "combined-results" | "syntax";
|
|
5
5
|
/**
|
|
6
6
|
* The CodeMirror extension used to add support for the SurrealQL language
|
|
7
|
+
*
|
|
8
|
+
* @param scope Limit the scope of the highlighting
|
|
7
9
|
*/
|
|
8
10
|
declare function surrealql(scope?: Scope): LanguageSupport;
|
|
9
11
|
|
package/dist/index.js
CHANGED
|
@@ -25,21 +25,26 @@ const surrealqlLanguage = /*@__PURE__*/LRLanguage.define({
|
|
|
25
25
|
commentTokens: { line: "--" },
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
|
-
const
|
|
29
|
-
["
|
|
30
|
-
["
|
|
31
|
-
["combined-results",
|
|
32
|
-
["syntax",
|
|
28
|
+
const scopeMap = /*@__PURE__*/new Map([
|
|
29
|
+
["permission", "PermissionInput"],
|
|
30
|
+
["index", "IndexInput"],
|
|
31
|
+
["combined-results", "CombinedResults"],
|
|
32
|
+
["syntax", "Syntax"],
|
|
33
33
|
]);
|
|
34
34
|
/**
|
|
35
35
|
* The CodeMirror extension used to add support for the SurrealQL language
|
|
36
|
+
*
|
|
37
|
+
* @param scope Limit the scope of the highlighting
|
|
36
38
|
*/
|
|
37
|
-
function surrealql(scope
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
function surrealql(scope) {
|
|
40
|
+
if (!scope) {
|
|
41
|
+
return new LanguageSupport(surrealqlLanguage);
|
|
42
|
+
}
|
|
43
|
+
const scopeId = scopeMap.get(scope);
|
|
44
|
+
if (!scopeId) {
|
|
40
45
|
throw new Error(`Unknown language scope: ${scope}`);
|
|
41
46
|
}
|
|
42
|
-
return new LanguageSupport(
|
|
47
|
+
return new LanguageSupport(surrealqlLanguage.configure({ top: scopeId }));
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
export { surrealql, surrealqlLanguage };
|
package/package.json
CHANGED
package/src/surrealql.ts
CHANGED
|
@@ -34,24 +34,30 @@ export const surrealqlLanguage = LRLanguage.define({
|
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
type Scope =
|
|
37
|
+
type Scope ="permission" | "index" | "combined-results" | "syntax";
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
["
|
|
41
|
-
["
|
|
42
|
-
["combined-results",
|
|
43
|
-
["syntax",
|
|
39
|
+
const scopeMap = new Map<Scope, string>([
|
|
40
|
+
["permission", "PermissionInput"],
|
|
41
|
+
["index", "IndexInput"],
|
|
42
|
+
["combined-results", "CombinedResults"],
|
|
43
|
+
["syntax", "Syntax"],
|
|
44
44
|
]);
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* The CodeMirror extension used to add support for the SurrealQL language
|
|
48
|
+
*
|
|
49
|
+
* @param scope Limit the scope of the highlighting
|
|
48
50
|
*/
|
|
49
|
-
export function surrealql(scope
|
|
50
|
-
|
|
51
|
+
export function surrealql(scope?: Scope) {
|
|
52
|
+
if (!scope) {
|
|
53
|
+
return new LanguageSupport(surrealqlLanguage);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const scopeId = scopeMap.get(scope);
|
|
51
57
|
|
|
52
|
-
if (!
|
|
58
|
+
if (!scopeId) {
|
|
53
59
|
throw new Error(`Unknown language scope: ${scope}`);
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
return new LanguageSupport(
|
|
62
|
+
return new LanguageSupport(surrealqlLanguage.configure({ top: scopeId }));
|
|
57
63
|
}
|