codemirror-lang-liquidsoap 0.2.1 → 0.2.2
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/cli.js
CHANGED
package/dist/index.js
CHANGED
package/examples/index.html
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
<script type="importmap">
|
|
5
5
|
{
|
|
6
6
|
"imports": {
|
|
7
|
-
"codemirror": "https://esm.sh/codemirror@v6.0.1",
|
|
8
|
-
"@codemirror/state": "https://esm.sh/@codemirror/state@6.
|
|
9
|
-
"@uiw/codemirror-theme-github": "https://esm.sh/@uiw/codemirror-theme-github@4.21.20",
|
|
7
|
+
"codemirror": "https://esm.sh/codemirror@v6.0.1?external=@codemirror/state,@codemirror/language,@codemirror/view",
|
|
8
|
+
"@codemirror/state": "https://esm.sh/@codemirror/state@6.2.1",
|
|
10
9
|
"@codemirror/language": "https://esm.sh/@codemirror/language@6.9.1",
|
|
10
|
+
"@codemirror/view": "https://esm.sh/@codemirror/view@6.21.3",
|
|
11
|
+
"@uiw/codemirror-themes-all": "https://esm.sh/@uiw/codemirror-themes-all@4.21.20",
|
|
11
12
|
"@lezer/highlight": "https://esm.sh/@lezer/highlight@1.1.6",
|
|
12
13
|
"@lezer/lr": "https://esm.sh/@lezer/lr@1.3.13",
|
|
13
14
|
"codemirror-lang-liquidsoap": "./dist/index.js"
|
|
@@ -16,25 +17,57 @@
|
|
|
16
17
|
</script>
|
|
17
18
|
<script type="module">
|
|
18
19
|
import { basicSetup, EditorView } from "codemirror";
|
|
19
|
-
import {
|
|
20
|
+
import { Compartment } from "@codemirror/state";
|
|
21
|
+
import * as allThemes from "@uiw/codemirror-themes-all";
|
|
20
22
|
import { liquidsoap } from "codemirror-lang-liquidsoap";
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
const themes = Object.keys(allThemes).reduce(
|
|
25
|
+
(themes, key) => {
|
|
26
|
+
if (/Init/.test(key) || /Settings/.test(key)) return themes;
|
|
27
|
+
|
|
28
|
+
return { ...themes, [key]: allThemes[key] };
|
|
29
|
+
}, {});
|
|
30
|
+
|
|
31
|
+
const defaultTheme = "githubLight";
|
|
32
|
+
|
|
33
|
+
const themeConfig = new Compartment;
|
|
34
|
+
|
|
35
|
+
const select = document.getElementById("themes");
|
|
36
|
+
|
|
37
|
+
Object.keys(themes).forEach((name) => {
|
|
38
|
+
const option = document.createElement("option");
|
|
39
|
+
option.text = name;
|
|
40
|
+
option.value = name;
|
|
41
|
+
select.appendChild(option);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
select.value = defaultTheme;
|
|
45
|
+
|
|
46
|
+
select.onchange = () => editor.dispatch({
|
|
47
|
+
effects: themeConfig.reconfigure([
|
|
48
|
+
liquidsoap(),
|
|
49
|
+
themes[select.value]
|
|
50
|
+
])
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const editor = new EditorView({
|
|
23
54
|
doc: `# ✨ Welcome to liquidsoap's test editor! ✨
|
|
24
55
|
# Write your code here:
|
|
25
56
|
|
|
26
57
|
`,
|
|
27
58
|
extensions: [
|
|
28
59
|
basicSetup,
|
|
29
|
-
|
|
30
|
-
|
|
60
|
+
themeConfig.of([
|
|
61
|
+
liquidsoap(),
|
|
62
|
+
themes[defaultTheme]
|
|
63
|
+
])
|
|
31
64
|
],
|
|
32
65
|
parent: document.getElementById("editor")
|
|
33
66
|
});
|
|
34
|
-
|
|
35
67
|
</script>
|
|
36
68
|
</head>
|
|
37
69
|
<body>
|
|
38
70
|
<div id="editor"></div>
|
|
71
|
+
<select id="themes"></select>
|
|
39
72
|
</body>
|
|
40
73
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codemirror-lang-liquidsoap",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Liquidsoap language support for prosemirror",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"url": "https://github.com/savonet/lezer-liquidsoap.git"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "lezer-generator src/liquidsoap.grammar -o src/parser && rollup -c && chmod +x dist/cli.js",
|
|
44
|
+
"build": "rm -rf dist && lezer-generator src/liquidsoap.grammar -o src/parser && rollup -c && chmod +x dist/cli.js",
|
|
45
45
|
"test": "./tests/run.sh",
|
|
46
46
|
"format": "pnpm prettier -w src/*.ts src/*.js"
|
|
47
47
|
}
|