@coderline/alphatab-monaco 1.8.2 → 1.8.3

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/textmate.mjs CHANGED
@@ -1,94 +1,88 @@
1
1
  /*!
2
- * alphaTab Monaco v1.8.2 (, build 31)
3
- *
4
- * Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
5
- *
6
- * This Source Code Form is subject to the terms of the Mozilla Public
7
- * License, v. 2.0. If a copy of the MPL was not distributed with this
8
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
- *
10
- * @preserve
11
- * @license
12
- */
13
-
14
- import * as monaco from 'monaco-editor';
15
- import * as oniguruma from 'vscode-oniguruma';
16
- import { Registry, parseRawGrammar, INITIAL } from 'vscode-textmate';
17
-
2
+ * alphaTab Monaco v1.8.3 (, build 32)
3
+ *
4
+ * Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * @preserve
11
+ * @license
12
+ */
13
+ import * as monaco from "monaco-editor";
14
+ import * as oniguruma from "vscode-oniguruma";
15
+ import { INITIAL, Registry, parseRawGrammar } from "vscode-textmate";
16
+ //#region src/textmate.ts
18
17
  /**
19
- * Adds TextMate grammar support to Monaco via `vscode-oniguruma` and `vscode-textmate`
20
- * @param onigurumaWasm The `onig.wasm` file shipped together with vscode-oniguruma.
21
- */
18
+ * Adds TextMate grammar support to Monaco via `vscode-oniguruma` and `vscode-textmate`
19
+ * @param onigurumaWasm The `onig.wasm` file shipped together with vscode-oniguruma.
20
+ */
22
21
  function addTextMateGrammarSupport(onigurumaWasm) {
23
- const grammars = {};
24
- const registry = new Registry({
25
- onigLib: (async () => {
26
- await oniguruma.loadWASM(onigurumaWasm);
27
- return {
28
- createOnigScanner(patterns) {
29
- return new oniguruma.OnigScanner(patterns);
30
- },
31
- createOnigString(s) {
32
- return new oniguruma.OnigString(s);
33
- }
34
- };
35
- })(),
36
- loadGrammar: async (scopeName) => {
37
- if (scopeName in grammars) {
38
- const grammar = await grammars[scopeName]();
39
- // activate JSON parsing
40
- const filePath = grammar.startsWith('{') ? `${scopeName}.tmLanguage.json` : undefined;
41
- return parseRawGrammar(grammar, filePath);
42
- }
43
- return null;
44
- }
45
- });
46
- return {
47
- registry: registry,
48
- grammars
49
- };
22
+ const grammars = {};
23
+ return {
24
+ registry: new Registry({
25
+ onigLib: (async () => {
26
+ await oniguruma.loadWASM(onigurumaWasm);
27
+ return {
28
+ createOnigScanner(patterns) {
29
+ return new oniguruma.OnigScanner(patterns);
30
+ },
31
+ createOnigString(s) {
32
+ return new oniguruma.OnigString(s);
33
+ }
34
+ };
35
+ })(),
36
+ loadGrammar: async (scopeName) => {
37
+ if (scopeName in grammars) {
38
+ const grammar = await grammars[scopeName]();
39
+ return parseRawGrammar(grammar, grammar.startsWith("{") ? `${scopeName}.tmLanguage.json` : void 0);
40
+ }
41
+ return null;
42
+ }
43
+ }),
44
+ grammars
45
+ };
50
46
  }
51
47
  /**
52
- * Registers a TextMate grammar in moncao.
53
- * @param grammarSupport The support object in which to register the grammar.
54
- * @param languageId The ID of the language
55
- * @param loadGrammar A promise to load the grammar source code.
56
- * @param loadLanguageConfiguration A promise to load the monaco language configuration.
57
- */
48
+ * Registers a TextMate grammar in moncao.
49
+ * @param grammarSupport The support object in which to register the grammar.
50
+ * @param languageId The ID of the language
51
+ * @param loadGrammar A promise to load the grammar source code.
52
+ * @param loadLanguageConfiguration A promise to load the monaco language configuration.
53
+ */
58
54
  async function registerGrammar(grammarSupport, languageId, loadGrammar, loadLanguageConfiguration) {
59
- const sourceScope = `source.${languageId}`;
60
- grammarSupport.grammars[sourceScope] = loadGrammar;
61
- const grammar = (await grammarSupport.registry.loadGrammar(sourceScope));
62
- monaco.languages.register({
63
- id: languageId
64
- });
65
- monaco.languages.setLanguageConfiguration(languageId, await loadLanguageConfiguration());
66
- monaco.languages.setTokensProvider(languageId, {
67
- getInitialState() {
68
- return INITIAL;
69
- },
70
- tokenize(line, state) {
71
- const tokenizerState = state;
72
- const textMateResult = grammar.tokenizeLine(line, tokenizerState, 500);
73
- if (textMateResult.stoppedEarly) {
74
- return {
75
- endState: state,
76
- tokens: textMateResult.tokens.map(t => ({ ...t, scopes: t.scopes.reverse().join(' ') }))
77
- };
78
- }
79
- let endState;
80
- if (state.equals(textMateResult.ruleStack)) {
81
- endState = tokenizerState;
82
- }
83
- else {
84
- endState = textMateResult.ruleStack;
85
- }
86
- return {
87
- endState,
88
- tokens: textMateResult.tokens.map(t => ({ ...t, scopes: t.scopes.reverse().join(' ') }))
89
- };
90
- }
91
- });
55
+ const sourceScope = `source.${languageId}`;
56
+ grammarSupport.grammars[sourceScope] = loadGrammar;
57
+ const grammar = await grammarSupport.registry.loadGrammar(sourceScope);
58
+ monaco.languages.register({ id: languageId });
59
+ monaco.languages.setLanguageConfiguration(languageId, await loadLanguageConfiguration());
60
+ monaco.languages.setTokensProvider(languageId, {
61
+ getInitialState() {
62
+ return INITIAL;
63
+ },
64
+ tokenize(line, state) {
65
+ const tokenizerState = state;
66
+ const textMateResult = grammar.tokenizeLine(line, tokenizerState, 500);
67
+ if (textMateResult.stoppedEarly) return {
68
+ endState: state,
69
+ tokens: textMateResult.tokens.map((t) => ({
70
+ ...t,
71
+ scopes: t.scopes.reverse().join(" ")
72
+ }))
73
+ };
74
+ let endState;
75
+ if (state.equals(textMateResult.ruleStack)) endState = tokenizerState;
76
+ else endState = textMateResult.ruleStack;
77
+ return {
78
+ endState,
79
+ tokens: textMateResult.tokens.map((t) => ({
80
+ ...t,
81
+ scopes: t.scopes.reverse().join(" ")
82
+ }))
83
+ };
84
+ }
85
+ });
92
86
  }
93
-
87
+ //#endregion
94
88
  export { addTextMateGrammarSupport, registerGrammar };
package/dist/types.mjs CHANGED
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * alphaTab Monaco v1.8.2 (, build 31)
3
- *
4
- * Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
5
- *
6
- * This Source Code Form is subject to the terms of the Mozilla Public
7
- * License, v. 2.0. If a copy of the MPL was not distributed with this
8
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
- *
10
- * @preserve
11
- * @license
12
- */
13
-
2
+ * alphaTab Monaco v1.8.3 (, build 32)
3
+ *
4
+ * Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * @preserve
11
+ * @license
12
+ */
@@ -0,0 +1,17 @@
1
+ /*!
2
+ * alphaTab Monaco v1.8.3 (, build 32)
3
+ *
4
+ * Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
5
+ *
6
+ * This Source Code Form is subject to the terms of the Mozilla Public
7
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
8
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9
+ *
10
+ * @preserve
11
+ * @license
12
+ */
13
+ import { TextDocuments } from "vscode-languageserver";
14
+ import { DocumentDiagnosticReportKind, PositionEncodingKind as PositionEncodingKind$1, TextDocumentSyncKind } from "vscode-languageserver-protocol";
15
+ import { TextDocument } from "vscode-languageserver-textdocument";
16
+ import { CompletionItemKind as CompletionItemKind$1, DiagnosticSeverity, InsertTextFormat as InsertTextFormat$1, ParameterInformation, SignatureInformation, TextEdit, uinteger } from "vscode-languageserver-types";
17
+ export { ParameterInformation as a, TextDocument as c, TextEdit as d, uinteger as f, InsertTextFormat$1 as i, TextDocumentSyncKind as l, DiagnosticSeverity as n, PositionEncodingKind$1 as o, DocumentDiagnosticReportKind as r, SignatureInformation as s, CompletionItemKind$1 as t, TextDocuments as u };