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
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { p as parser } from './liquidsoap-a9bd57d1.js';
2
+ import { p as parser } from './liquidsoap-1e48705a.js';
3
3
  import parseArgs from 'minimist';
4
4
  import BluebirdPromise from 'bluebird';
5
5
  import { glob } from 'glob';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as parser } from './liquidsoap-a9bd57d1.js';
1
+ import { p as parser } from './liquidsoap-1e48705a.js';
2
2
  import { LRLanguage, LanguageSupport } from '@codemirror/language';
3
3
  import { styleTags, tags } from '@lezer/highlight';
4
4
  import '@lezer/lr';
@@ -34,6 +34,8 @@ const keywords = [
34
34
  "and",
35
35
  "or",
36
36
  "mod",
37
+ "true",
38
+ "false"
37
39
  ];
38
40
 
39
41
  const noUminus = new ContextTracker({
@@ -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.3.1",
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 { githubLight } from "@uiw/codemirror-theme-github";
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
- new EditorView({
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
- liquidsoap(),
30
- githubLight
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.1",
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
  }
package/src/tokens.js CHANGED
@@ -28,6 +28,8 @@ const keywords = [
28
28
  "and",
29
29
  "or",
30
30
  "mod",
31
+ "true",
32
+ "false"
31
33
  ];
32
34
 
33
35
  export const noUminus = new ContextTracker({