@jotx-labs/language 2.2.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/README.md ADDED
@@ -0,0 +1,203 @@
1
+ # @jotx/language
2
+
3
+ Platform-agnostic language support for jotx files (`.jot`, `.meet`).
4
+
5
+ Provides syntax highlighting and diagnostics for **both VS Code and Monaco Editor** (web).
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ ✅ **Syntax Highlighting** (TextMate grammar - works in VS Code & Monaco)
12
+ ✅ **Real-time Diagnostics** (validation with red squiggles)
13
+ ✅ **Platform-agnostic** (core logic works anywhere)
14
+ ✅ **VS Code integration** (ready to use)
15
+ ✅ **Monaco integration** (for web apps)
16
+
17
+ ---
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @jotx/language
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Usage
28
+
29
+ ### For VS Code Extension
30
+
31
+ ```typescript
32
+ import * as vscode from 'vscode'
33
+ import { setupJotxLanguageForVSCode } from '@jotx/language'
34
+
35
+ export function activate(context: vscode.ExtensionContext) {
36
+ // Setup jotx language support (syntax + diagnostics)
37
+ const languageProvider = setupJotxLanguageForVSCode(vscode, context)
38
+
39
+ // Language support is now active!
40
+ // Users will see:
41
+ // - Syntax highlighting
42
+ // - Real-time validation with red squiggles
43
+ // - Error messages on hover
44
+ }
45
+ ```
46
+
47
+ ### For Monaco Editor (Web)
48
+
49
+ ```typescript
50
+ import * as monaco from 'monaco-editor'
51
+ import { setupJotxLanguageForMonaco } from '@jotx/language'
52
+
53
+ // Setup jotx language
54
+ const languageProvider = setupJotxLanguageForMonaco(monaco)
55
+
56
+ // Create editor
57
+ const editor = monaco.editor.create(document.getElementById('editor'), {
58
+ value: 'hdef jot my_doc\n title "Hello"',
59
+ language: 'jotx',
60
+ theme: 'vs-dark'
61
+ })
62
+
63
+ // Validate on change
64
+ editor.onDidChangeModelContent(() => {
65
+ const model = editor.getModel()
66
+ if (model) {
67
+ const text = model.getValue()
68
+ const markers = languageProvider.validate(text)
69
+ monaco.editor.setModelMarkers(model, 'jotx', markers)
70
+ }
71
+ })
72
+ ```
73
+
74
+ ### Platform-agnostic Validation
75
+
76
+ ```typescript
77
+ import { DiagnosticProvider } from '@jotx/language'
78
+
79
+ const provider = new DiagnosticProvider()
80
+
81
+ const text = `
82
+ hdef jot my_doc
83
+ title "Test"
84
+
85
+ def heading1 block_1
86
+ text """Hello World"""
87
+ `
88
+
89
+ const result = provider.validate(text)
90
+
91
+ console.log('Valid:', result.isValid)
92
+ console.log('Errors:', result.diagnostics)
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Architecture
98
+
99
+ ```
100
+ @jotx/language
101
+ ├── Diagnostics (Core) Platform-agnostic validation
102
+ ├── VS Code Integration Diagnostic provider for VS Code
103
+ ├── Monaco Integration Language provider for Monaco
104
+ └── Grammar (TextMate) Syntax highlighting (both)
105
+ ```
106
+
107
+ **Benefits:**
108
+ - ✅ Write validation logic once, use everywhere
109
+ - ✅ Same syntax highlighting in VS Code and web
110
+ - ✅ Easy to add support for other editors (Vim, Emacs, etc.)
111
+
112
+ ---
113
+
114
+ ## API
115
+
116
+ ### DiagnosticProvider (Core)
117
+
118
+ ```typescript
119
+ class DiagnosticProvider {
120
+ validate(text: string): DiagnosticResult
121
+ isValid(text: string): boolean
122
+ getErrors(text: string): JotxDiagnostic[]
123
+ getWarnings(text: string): JotxDiagnostic[]
124
+ }
125
+ ```
126
+
127
+ ### VSCodeLanguageProvider
128
+
129
+ ```typescript
130
+ class VSCodeLanguageProvider {
131
+ register(context: ExtensionContext): void
132
+ validateDocument(document: TextDocument): Diagnostic[]
133
+ clear(): void
134
+ dispose(): void
135
+ }
136
+ ```
137
+
138
+ ### MonacoLanguageProvider
139
+
140
+ ```typescript
141
+ class MonacoLanguageProvider {
142
+ register(): void
143
+ validate(text: string): any[] // Monaco markers
144
+ }
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Supported Block Types
150
+
151
+ Syntax highlighting for all 21 jotx block types:
152
+
153
+ **Document Types:** jot, meeting, tasklist, journal
154
+ **Text Blocks:** heading1-3, paragraph, quote
155
+ **Code/Media:** code, math, image
156
+ **Containers:** callout, toggle
157
+ **Lists:** list, checklist
158
+ **Data:** table, properties
159
+ **Separators:** divider, link, attach
160
+ **Interactive:** mermaid, chart, datetime, linkCard
161
+ **Custom:** custom
162
+
163
+ ---
164
+
165
+ ## Diagnostics
166
+
167
+ Real-time validation catches:
168
+
169
+ ❌ **Errors:**
170
+ - Invalid block types
171
+ - Missing required properties
172
+ - Syntax errors
173
+ - Parse failures
174
+
175
+ ⚠️ **Warnings:**
176
+ - Deprecated syntax
177
+ - Unused properties
178
+
179
+ ℹ️ **Info:**
180
+ - Style suggestions
181
+ - Formatting hints
182
+
183
+ ---
184
+
185
+ ## Development
186
+
187
+ ```bash
188
+ # Build
189
+ npm run build
190
+
191
+ # Test
192
+ npm test
193
+
194
+ # Clean
195
+ npm run clean
196
+ ```
197
+
198
+ ---
199
+
200
+ ## License
201
+
202
+ MIT
203
+
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Platform-agnostic diagnostic provider for jotx
3
+ * Works with VS Code, Monaco, or any other editor
4
+ */
5
+ /**
6
+ * Generic diagnostic format (works for VS Code, Monaco, LSP, etc.)
7
+ */
8
+ export interface JotxDiagnostic {
9
+ message: string;
10
+ severity: 'error' | 'warning' | 'info' | 'hint';
11
+ startLine: number;
12
+ startColumn: number;
13
+ endLine: number;
14
+ endColumn: number;
15
+ code?: string;
16
+ source: 'jotx';
17
+ }
18
+ /**
19
+ * Result of validation
20
+ */
21
+ export interface DiagnosticResult {
22
+ diagnostics: JotxDiagnostic[];
23
+ isValid: boolean;
24
+ }
25
+ /**
26
+ * Platform-agnostic diagnostic provider
27
+ * Wraps @jotx/core validate() and returns generic diagnostics
28
+ */
29
+ export declare class DiagnosticProvider {
30
+ /**
31
+ * Validate jotx text and return diagnostics
32
+ */
33
+ validate(text: string): DiagnosticResult;
34
+ /**
35
+ * Get severity level based on error type
36
+ */
37
+ private getSeverity;
38
+ /**
39
+ * Quick validation - returns true/false only
40
+ */
41
+ isValid(text: string): boolean;
42
+ /**
43
+ * Get only error-level diagnostics
44
+ */
45
+ getErrors(text: string): JotxDiagnostic[];
46
+ /**
47
+ * Get only warning-level diagnostics
48
+ */
49
+ getWarnings(text: string): JotxDiagnostic[];
50
+ }
51
+ /**
52
+ * Singleton instance for convenience
53
+ */
54
+ export declare const diagnosticProvider: DiagnosticProvider;
55
+ //# sourceMappingURL=DiagnosticProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagnosticProvider.d.ts","sourceRoot":"","sources":["../../src/diagnostics/DiagnosticProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAA;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,cAAc,EAAE,CAAA;IAC7B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAE7B;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;IAkDxC;;OAEG;IACH,OAAO,CAAC,WAAW;IA2BnB;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI9B;;OAEG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE;IAIzC;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE;CAG5C;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,oBAA2B,CAAA"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ /**
3
+ * Platform-agnostic diagnostic provider for jotx
4
+ * Works with VS Code, Monaco, or any other editor
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.diagnosticProvider = exports.DiagnosticProvider = void 0;
8
+ const core_1 = require("@jotx/core");
9
+ /**
10
+ * Platform-agnostic diagnostic provider
11
+ * Wraps @jotx/core validate() and returns generic diagnostics
12
+ */
13
+ class DiagnosticProvider {
14
+ /**
15
+ * Validate jotx text and return diagnostics
16
+ */
17
+ validate(text) {
18
+ // Parse the text
19
+ let ast;
20
+ try {
21
+ ast = (0, core_1.parse)(text);
22
+ }
23
+ catch (error) {
24
+ // Parse error - create diagnostic for syntax error
25
+ return {
26
+ diagnostics: [{
27
+ message: `Parse error: ${error instanceof Error ? error.message : String(error)}`,
28
+ severity: 'error',
29
+ startLine: 0,
30
+ startColumn: 0,
31
+ endLine: 0,
32
+ endColumn: 0,
33
+ code: 'parse-error',
34
+ source: 'jotx'
35
+ }],
36
+ isValid: false
37
+ };
38
+ }
39
+ // Validate the AST
40
+ const validation = (0, core_1.validate)(ast.document);
41
+ // Convert validation errors to generic diagnostics
42
+ const diagnostics = validation.map(err => {
43
+ // Extract line/column from error if available
44
+ // Default to line 0 if not specified
45
+ const line = err.line || 0;
46
+ const column = err.column || 0;
47
+ return {
48
+ message: err.message,
49
+ severity: this.getSeverity(err.type),
50
+ startLine: line,
51
+ startColumn: column,
52
+ endLine: line,
53
+ endColumn: column + 1,
54
+ code: err.type,
55
+ source: 'jotx'
56
+ };
57
+ });
58
+ return {
59
+ diagnostics,
60
+ isValid: validation.length === 0
61
+ };
62
+ }
63
+ /**
64
+ * Get severity level based on error type
65
+ */
66
+ getSeverity(errorType) {
67
+ if (!errorType)
68
+ return 'error';
69
+ // Map error types to severity levels
70
+ switch (errorType) {
71
+ case 'validation-error':
72
+ case 'parse-error':
73
+ case 'missing-required-property':
74
+ case 'invalid-block-type':
75
+ return 'error';
76
+ case 'deprecated':
77
+ case 'unused':
78
+ return 'warning';
79
+ case 'style':
80
+ case 'formatting':
81
+ return 'info';
82
+ case 'suggestion':
83
+ return 'hint';
84
+ default:
85
+ return 'error';
86
+ }
87
+ }
88
+ /**
89
+ * Quick validation - returns true/false only
90
+ */
91
+ isValid(text) {
92
+ return this.validate(text).isValid;
93
+ }
94
+ /**
95
+ * Get only error-level diagnostics
96
+ */
97
+ getErrors(text) {
98
+ return this.validate(text).diagnostics.filter(d => d.severity === 'error');
99
+ }
100
+ /**
101
+ * Get only warning-level diagnostics
102
+ */
103
+ getWarnings(text) {
104
+ return this.validate(text).diagnostics.filter(d => d.severity === 'warning');
105
+ }
106
+ }
107
+ exports.DiagnosticProvider = DiagnosticProvider;
108
+ /**
109
+ * Singleton instance for convenience
110
+ */
111
+ exports.diagnosticProvider = new DiagnosticProvider();
112
+ //# sourceMappingURL=DiagnosticProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiagnosticProvider.js","sourceRoot":"","sources":["../../src/diagnostics/DiagnosticProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qCAA4C;AAwB5C;;;GAGG;AACH,MAAa,kBAAkB;IAE7B;;OAEG;IACH,QAAQ,CAAC,IAAY;QACnB,iBAAiB;QACjB,IAAI,GAAG,CAAA;QACP,IAAI,CAAC;YACH,GAAG,GAAG,IAAA,YAAK,EAAC,IAAI,CAAC,CAAA;QACnB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,mDAAmD;YACnD,OAAO;gBACL,WAAW,EAAE,CAAC;wBACZ,OAAO,EAAE,gBAAgB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;wBACjF,QAAQ,EAAE,OAAO;wBACjB,SAAS,E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X,OAAO,SAAS,CAAA;YAElB,KAAK,OAAO,CAAC;YACb,KAAK,YAAY;gBACf,OAAO,MAAM,CAAA;YAEf,KAAK,YAAY;gBACf,OAAO,MAAM,CAAA;YAEf;gBACE,OAAO,OAAO,CAAA;QAClB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAY;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAA;IACpC,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,IAAY;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAA;IAC5E,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,IAAY;QACtB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAA;IAC9E,CAAC;CACF;AAzGD,gDAyGC;AAED;;GAEG;AACU,QAAA,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @jotx/language - Platform-agnostic language support
3
+ *
4
+ * Provides:
5
+ * - Syntax highlighting (TextMate grammar for VS Code & Monaco)
6
+ * - Diagnostics/Linting (works in any editor)
7
+ * - VS Code integration helpers
8
+ * - Monaco integration helpers
9
+ */
10
+ export { DiagnosticProvider, diagnosticProvider, JotxDiagnostic, DiagnosticResult } from './diagnostics/DiagnosticProvider';
11
+ export { VSCodeLanguageProvider, setupJotxLanguage as setupJotxLanguageForVSCode, toVSCodeDiagnostic } from './vscode/VSCodeLanguageProvider';
12
+ export { MonacoLanguageProvider, setupJotxLanguage as setupJotxLanguageForMonaco, toMonacoMarker, MonacoSeverity } from './monaco/MonacoLanguageProvider';
13
+ export declare const GRAMMAR_PATH = "./grammar/jotx.tmLanguage.json";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EACjB,MAAM,kCAAkC,CAAA;AAKzC,OAAO,EACL,sBAAsB,EACtB,iBAAiB,IAAI,0BAA0B,EAC/C,kBAAkB,EACnB,MAAM,iCAAiC,CAAA;AAKxC,OAAO,EACL,sBAAsB,EACtB,iBAAiB,IAAI,0BAA0B,EAC/C,cAAc,EACd,cAAc,EACf,MAAM,iCAAiC,CAAA;AAMxC,eAAO,MAAM,YAAY,mCAAmC,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ /**
3
+ * @jotx/language - Platform-agnostic language support
4
+ *
5
+ * Provides:
6
+ * - Syntax highlighting (TextMate grammar for VS Code & Monaco)
7
+ * - Diagnostics/Linting (works in any editor)
8
+ * - VS Code integration helpers
9
+ * - Monaco integration helpers
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.GRAMMAR_PATH = exports.MonacoSeverity = exports.toMonacoMarker = exports.setupJotxLanguageForMonaco = exports.MonacoLanguageProvider = exports.toVSCodeDiagnostic = exports.setupJotxLanguageForVSCode = exports.VSCodeLanguageProvider = exports.diagnosticProvider = exports.DiagnosticProvider = void 0;
13
+ // ============================================================================
14
+ // Core Diagnostics (Platform-agnostic)
15
+ // ============================================================================
16
+ var DiagnosticProvider_1 = require("./diagnostics/DiagnosticProvider");
17
+ Object.defineProperty(exports, "DiagnosticProvider", { enumerable: true, get: function () { return DiagnosticProvider_1.DiagnosticProvider; } });
18
+ Object.defineProperty(exports, "diagnosticProvider", { enumerable: true, get: function () { return DiagnosticProvider_1.diagnosticProvider; } });
19
+ // ============================================================================
20
+ // VS Code Integration
21
+ // ============================================================================
22
+ var VSCodeLanguageProvider_1 = require("./vscode/VSCodeLanguageProvider");
23
+ Object.defineProperty(exports, "VSCodeLanguageProvider", { enumerable: true, get: function () { return VSCodeLanguageProvider_1.VSCodeLanguageProvider; } });
24
+ Object.defineProperty(exports, "setupJotxLanguageForVSCode", { enumerable: true, get: function () { return VSCodeLanguageProvider_1.setupJotxLanguage; } });
25
+ Object.defineProperty(exports, "toVSCodeDiagnostic", { enumerable: true, get: function () { return VSCodeLanguageProvider_1.toVSCodeDiagnostic; } });
26
+ // ============================================================================
27
+ // Monaco Integration
28
+ // ============================================================================
29
+ var MonacoLanguageProvider_1 = require("./monaco/MonacoLanguageProvider");
30
+ Object.defineProperty(exports, "MonacoLanguageProvider", { enumerable: true, get: function () { return MonacoLanguageProvider_1.MonacoLanguageProvider; } });
31
+ Object.defineProperty(exports, "setupJotxLanguageForMonaco", { enumerable: true, get: function () { return MonacoLanguageProvider_1.setupJotxLanguage; } });
32
+ Object.defineProperty(exports, "toMonacoMarker", { enumerable: true, get: function () { return MonacoLanguageProvider_1.toMonacoMarker; } });
33
+ Object.defineProperty(exports, "MonacoSeverity", { enumerable: true, get: function () { return MonacoLanguageProvider_1.MonacoSeverity; } });
34
+ // ============================================================================
35
+ // Grammar (for manual use if needed)
36
+ // ============================================================================
37
+ // Export path to grammar file for VS Code extension manifest
38
+ exports.GRAMMAR_PATH = './grammar/jotx.tmLanguage.json';
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,+EAA+E;AAC/E,uCAAuC;AACvC,+EAA+E;AAC/E,uEAKyC;AAJvC,wHAAA,kBAAkB,OAAA;AAClB,wHAAA,kBAAkB,OAAA;AAKpB,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAC/E,0EAIwC;AAHtC,gIAAA,sBAAsB,OAAA;AACtB,oIAAA,iBAAiB,OAA8B;AAC/C,4HAAA,kBAAkB,OAAA;AAGpB,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAC/E,0EAKwC;AAJtC,gIAAA,sBAAsB,OAAA;AACtB,oIAAA,iBAAiB,OAA8B;AAC/C,wHAAA,cAAc,OAAA;AACd,wHAAA,cAAc,OAAA;AAGhB,+EAA+E;AAC/E,qCAAqC;AACrC,+EAA+E;AAC/E,6DAA6D;AAChD,QAAA,YAAY,GAAG,gCAAgC,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Monaco Editor integration for jotx
3
+ * Use this in your web app
4
+ */
5
+ import { JotxDiagnostic } from '../diagnostics/DiagnosticProvider';
6
+ /**
7
+ * Monaco marker severity mapping
8
+ */
9
+ export declare const MonacoSeverity: {
10
+ error: number;
11
+ warning: number;
12
+ info: number;
13
+ hint: number;
14
+ };
15
+ /**
16
+ * Convert jotx diagnostic to Monaco marker
17
+ */
18
+ export declare function toMonacoMarker(diagnostic: JotxDiagnostic): any;
19
+ /**
20
+ * Monaco language provider for jotx
21
+ * Register this in your Monaco editor setup
22
+ */
23
+ export declare class MonacoLanguageProvider {
24
+ private diagnosticProvider;
25
+ private monaco;
26
+ constructor(monaco: any);
27
+ /**
28
+ * Register jotx language with Monaco
29
+ */
30
+ register(): void;
31
+ /**
32
+ * Validate text and return Monaco markers
33
+ */
34
+ validate(text: string): any[];
35
+ /**
36
+ * Get Monaco Monarch token provider (syntax highlighting)
37
+ */
38
+ private getTokenProvider;
39
+ }
40
+ /**
41
+ * Setup jotx language in Monaco editor
42
+ * Call this once when initializing Monaco
43
+ *
44
+ * @example
45
+ * import * as monaco from 'monaco-editor'
46
+ * import { setupJotxLanguage } from '@jotx/language'
47
+ *
48
+ * setupJotxLanguage(monaco)
49
+ */
50
+ export declare function setupJotxLanguage(monaco: any): MonacoLanguageProvider;
51
+ //# sourceMappingURL=MonacoLanguageProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonacoLanguageProvider.d.ts","sourceRoot":"","sources":["../../src/monaco/MonacoLanguageProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAEtF;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;CAK1B,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,cAAc,GAAG,GAAG,CAW9D;AAED;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,kBAAkB,CAAoB;IAC9C,OAAO,CAAC,MAAM,CAAK;gBAEP,MAAM,EAAE,GAAG;IAKvB;;OAEG;IACH,QAAQ;IAuCR;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE;IAK7B;;OAEG;IACH,OAAO,CAAC,gBAAgB;CA4EzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,GAAG,sBAAsB,CAIrE"}
@@ -0,0 +1,171 @@
1
+ "use strict";
2
+ /**
3
+ * Monaco Editor integration for jotx
4
+ * Use this in your web app
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.MonacoLanguageProvider = exports.MonacoSeverity = void 0;
8
+ exports.toMonacoMarker = toMonacoMarker;
9
+ exports.setupJotxLanguage = setupJotxLanguage;
10
+ const DiagnosticProvider_1 = require("../diagnostics/DiagnosticProvider");
11
+ /**
12
+ * Monaco marker severity mapping
13
+ */
14
+ exports.MonacoSeverity = {
15
+ error: 8, // monaco.MarkerSeverity.Error
16
+ warning: 4, // monaco.MarkerSeverity.Warning
17
+ info: 2, // monaco.MarkerSeverity.Info
18
+ hint: 1 // monaco.MarkerSeverity.Hint
19
+ };
20
+ /**
21
+ * Convert jotx diagnostic to Monaco marker
22
+ */
23
+ function toMonacoMarker(diagnostic) {
24
+ return {
25
+ severity: exports.MonacoSeverity[diagnostic.severity],
26
+ message: diagnostic.message,
27
+ startLineNumber: diagnostic.startLine + 1, // Monaco uses 1-based
28
+ startColumn: diagnostic.startColumn + 1,
29
+ endLineNumber: diagnostic.endLine + 1,
30
+ endColumn: diagnostic.endColumn + 1,
31
+ code: diagnostic.code,
32
+ source: diagnostic.source
33
+ };
34
+ }
35
+ /**
36
+ * Monaco language provider for jotx
37
+ * Register this in your Monaco editor setup
38
+ */
39
+ class MonacoLanguageProvider {
40
+ constructor(monaco) {
41
+ this.monaco = monaco;
42
+ this.diagnosticProvider = new DiagnosticProvider_1.DiagnosticProvider();
43
+ }
44
+ /**
45
+ * Register jotx language with Monaco
46
+ */
47
+ register() {
48
+ // Register language
49
+ this.monaco.languages.register({
50
+ id: 'jotx',
51
+ extensions: ['.jot', '.meet'],
52
+ aliases: ['jotx', 'JOTX'],
53
+ mimetypes: ['text/x-jotx']
54
+ });
55
+ // Set language configuration
56
+ this.monaco.languages.setLanguageConfiguration('jotx', {
57
+ comments: {
58
+ lineComment: '#'
59
+ },
60
+ brackets: [
61
+ ['"""', '"""']
62
+ ],
63
+ autoClosingPairs: [
64
+ { open: '"', close: '"' },
65
+ { open: '"""', close: '"""' }
66
+ ],
67
+ surroundingPairs: [
68
+ { open: '"', close: '"' }
69
+ ],
70
+ indentationRules: {
71
+ increaseIndentPattern: /^\s*(hdef|def|item|row|cell|section)\s+/,
72
+ decreaseIndentPattern: /^\s*$/
73
+ }
74
+ });
75
+ // Set token provider (syntax highlighting)
76
+ this.monaco.languages.setMonarchTokensProvider('jotx', this.getTokenProvider());
77
+ // Register validation
78
+ this.monaco.languages.registerDocumentFormattingEditProvider('jotx', {
79
+ provideDocumentFormattingEdits: () => [] // TODO: Add formatter
80
+ });
81
+ }
82
+ /**
83
+ * Validate text and return Monaco markers
84
+ */
85
+ validate(text) {
86
+ const result = this.diagnosticProvider.validate(text);
87
+ return result.diagnostics.map(d => toMonacoMarker(d));
88
+ }
89
+ /**
90
+ * Get Monaco Monarch token provider (syntax highlighting)
91
+ */
92
+ getTokenProvider() {
93
+ return {
94
+ defaultToken: '',
95
+ tokenPostfix: '.jotx',
96
+ keywords: [
97
+ 'hdef', 'def', 'item', 'row', 'cell', 'section'
98
+ ],
99
+ blockTypes: [
100
+ 'jot', 'meeting', 'tasklist', 'journal',
101
+ 'heading1', 'heading2', 'heading3', 'paragraph', 'quote',
102
+ 'code', 'codeReference', 'list', 'checklist', 'table', 'image', 'link',
103
+ 'attach', 'callout', 'toggle', 'divider', 'datetime',
104
+ 'math', 'mermaid', 'chart', 'linkCard', 'properties', 'custom'
105
+ ],
106
+ properties: [
107
+ 'title', 'text', 'language', 'type', 'variant', 'href',
108
+ 'src', 'alt', 'width', 'align', 'url', 'description',
109
+ 'image', 'siteName', 'timestamp', 'format', 'timezone',
110
+ 'display', 'columns', 'customType', 'icon', 'created',
111
+ 'modified', 'author', 'tags'
112
+ ],
113
+ enums: [
114
+ 'bulleted', 'numbered', 'info', 'warning', 'success', 'danger',
115
+ 'left', 'center', 'right', 'inline', 'block', 'true', 'false'
116
+ ],
117
+ tokenizer: {
118
+ root: [
119
+ // Comments
120
+ [/#.*$/, 'comment'],
121
+ // hdef and def
122
+ [/^\s*(hdef|def)\s+/, { token: 'keyword', next: '@blockType' }],
123
+ // item, row, cell, section
124
+ [/^\s*(item|row|cell|section)\s+/, { token: 'keyword', next: '@identifier' }],
125
+ // Properties
126
+ [/^\s*[a-zA-Z_][a-zA-Z0-9_]*\s+/, 'variable.parameter'],
127
+ // Strings
128
+ [/"""/, { token: 'string.quote', bracket: '@open', next: '@tripleString' }],
129
+ [/"/, { token: 'string.quote', bracket: '@open', next: '@string' }],
130
+ // Enums
131
+ [/\b(bulleted|numbered|info|warning|success|danger|left|center|right|inline|block|true|false)\b/, 'constant.language']
132
+ ],
133
+ blockType: [
134
+ [/[a-zA-Z_][a-zA-Z0-9_]*/, { token: 'entity.name.type', next: '@identifier' }],
135
+ [/\s+/, '']
136
+ ],
137
+ identifier: [
138
+ [/[a-zA-Z_][a-zA-Z0-9_]*/, { token: 'entity.name.function', next: '@pop' }],
139
+ [/\s+/, '']
140
+ ],
141
+ string: [
142
+ [/[^\\"]+/, 'string'],
143
+ [/\\./, 'string.escape'],
144
+ [/"/, { token: 'string.quote', bracket: '@close', next: '@pop' }]
145
+ ],
146
+ tripleString: [
147
+ [/[^"]+/, 'string'],
148
+ [/"""/, { token: 'string.quote', bracket: '@close', next: '@pop' }],
149
+ [/"/, 'string']
150
+ ]
151
+ }
152
+ };
153
+ }
154
+ }
155
+ exports.MonacoLanguageProvider = MonacoLanguageProvider;
156
+ /**
157
+ * Setup jotx language in Monaco editor
158
+ * Call this once when initializing Monaco
159
+ *
160
+ * @example
161
+ * import * as monaco from 'monaco-editor'
162
+ * import { setupJotxLanguage } from '@jotx/language'
163
+ *
164
+ * setupJotxLanguage(monaco)
165
+ */
166
+ function setupJotxLanguage(monaco) {
167
+ const provider = new MonacoLanguageProvider(monaco);
168
+ provider.register();
169
+ return provider;
170
+ }
171
+ //# sourceMappingURL=MonacoLanguageProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonacoLanguageProvider.js","sourceRoot":"","sources":["../../src/monaco/MonacoLanguageProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiBH,wCAWC;AA4JD,8CAIC;AA1LD,0EAAsF;AAEtF;;GAEG;AACU,QAAA,cAAc,GAAG;IAC5B,KAAK,EAAE,CAAC,EAAK,8BAA8B;IAC3C,OAAO,EAAE,CAAC,EAAG,gCAAgC;IAC7C,IAAI,EAAE,CAAC,EAAM,6BAA6B;IAC1C,IAAI,EAAE,CAAC,CAAM,6BAA6B;CAC3C,CAAA;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,UAA0B;IACvD,OAAO;QACL,QAAQ,EAAE,sBAAc,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC7C,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,eAAe,EAAE,UAAU,CAAC,SAAS,GAAG,CAAC,EAAG,sBAAsB;QAClE,W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AC3E,CAAC,KAAK,EAAE,EAAE,CAAC;iBACZ;gBAED,MAAM,EAAE;oBACN,CAAC,SAAS,EAAE,QAAQ,CAAC;oBACrB,CAAC,KAAK,EAAE,eAAe,CAAC;oBACxB,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iBAClE;gBAED,YAAY,EAAE;oBACZ,CAAC,OAAO,EAAE,QAAQ,CAAC;oBACnB,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oBACnE,CAAC,GAAG,EAAE,QAAQ,CAAC;iBAChB;aACF;SACF,CAAA;IACH,CAAC;CACF;AA1ID,wDA0IC;AAED;;;;;;;;;GASG;AACH,SAAgB,iBAAiB,CAAC,MAAW;IAC3C,MAAM,QAAQ,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAA;IACnD,QAAQ,CAAC,QAAQ,EAAE,CAAA;IACnB,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * VS Code integration for jotx
3
+ * Use this in your VS Code extension
4
+ */
5
+ import { JotxDiagnostic } from '../diagnostics/DiagnosticProvider';
6
+ type Diagnostic = any;
7
+ /**
8
+ * Convert jotx diagnostic to VS Code diagnostic
9
+ */
10
+ export declare function toVSCodeDiagnostic(diagnostic: JotxDiagnostic, vscode: any): Diagnostic;
11
+ /**
12
+ * VS Code language provider for jotx
13
+ * Provides real-time diagnostics (red squiggles)
14
+ */
15
+ export declare class VSCodeLanguageProvider {
16
+ private diagnosticProvider;
17
+ private diagnosticCollection;
18
+ private vscode;
19
+ constructor(vscode: any);
20
+ /**
21
+ * Register diagnostic provider
22
+ * Call this in extension activation
23
+ */
24
+ register(context: any): void;
25
+ /**
26
+ * Update diagnostics for a document
27
+ */
28
+ private updateDiagnostics;
29
+ /**
30
+ * Check if document is a jotx file
31
+ */
32
+ private isJotxDocument;
33
+ /**
34
+ * Manually validate a document (for testing)
35
+ */
36
+ validateDocument(document: any): Diagnostic[];
37
+ /**
38
+ * Clear all diagnostics
39
+ */
40
+ clear(): void;
41
+ /**
42
+ * Dispose the provider
43
+ */
44
+ dispose(): void;
45
+ }
46
+ /**
47
+ * Setup jotx language support in VS Code
48
+ * Call this in your extension's activate() function
49
+ *
50
+ * @example
51
+ * import * as vscode from 'vscode'
52
+ * import { setupJotxLanguage } from '@jotx/language'
53
+ *
54
+ * export function activate(context: vscode.ExtensionContext) {
55
+ * const provider = setupJotxLanguage(vscode, context)
56
+ * // ...
57
+ * }
58
+ */
59
+ export declare function setupJotxLanguage(vscode: any, context: any): VSCodeLanguageProvider;
60
+ export {};
61
+ //# sourceMappingURL=VSCodeLanguageProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VSCodeLanguageProvider.d.ts","sourceRoot":"","sources":["../../src/vscode/VSCodeLanguageProvider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAsB,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGtF,KAAK,UAAU,GAAG,GAAG,CAAA;AAKrB;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,GAAG,GACV,UAAU,CAuBZ;AAED;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,kBAAkB,CAAoB;IAC9C,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,MAAM,CAAK;gBAEP,MAAM,EAAE,GAAG;IAMvB;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,GAAG;IAuCrB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;OAEG;IACH,OAAO,CAAC,cAAc;IAMtB;;OAEG;IACH,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,UAAU,EAAE;IAM7C;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,OAAO;CAGR;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,sBAAsB,CAInF"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ /**
3
+ * VS Code integration for jotx
4
+ * Use this in your VS Code extension
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.VSCodeLanguageProvider = void 0;
8
+ exports.toVSCodeDiagnostic = toVSCodeDiagnostic;
9
+ exports.setupJotxLanguage = setupJotxLanguage;
10
+ const DiagnosticProvider_1 = require("../diagnostics/DiagnosticProvider");
11
+ /**
12
+ * Convert jotx diagnostic to VS Code diagnostic
13
+ */
14
+ function toVSCodeDiagnostic(diagnostic, vscode) {
15
+ const severityMap = {
16
+ 'error': vscode.DiagnosticSeverity.Error,
17
+ 'warning': vscode.DiagnosticSeverity.Warning,
18
+ 'info': vscode.DiagnosticSeverity.Information,
19
+ 'hint': vscode.DiagnosticSeverity.Hint
20
+ };
21
+ const range = new vscode.Range(new vscode.Position(diagnostic.startLine, diagnostic.startColumn), new vscode.Position(diagnostic.endLine, diagnostic.endColumn));
22
+ const vscodeDiagnostic = new vscode.Diagnostic(range, diagnostic.message, severityMap[diagnostic.severity]);
23
+ vscodeDiagnostic.code = diagnostic.code;
24
+ vscodeDiagnostic.source = diagnostic.source;
25
+ return vscodeDiagnostic;
26
+ }
27
+ /**
28
+ * VS Code language provider for jotx
29
+ * Provides real-time diagnostics (red squiggles)
30
+ */
31
+ class VSCodeLanguageProvider {
32
+ constructor(vscode) {
33
+ this.vscode = vscode;
34
+ this.diagnosticProvider = new DiagnosticProvider_1.DiagnosticProvider();
35
+ this.diagnosticCollection = vscode.languages.createDiagnosticCollection('jotx');
36
+ }
37
+ /**
38
+ * Register diagnostic provider
39
+ * Call this in extension activation
40
+ */
41
+ register(context) {
42
+ // Update diagnostics on document change
43
+ context.subscriptions.push(this.vscode.workspace.onDidChangeTextDocument((event) => {
44
+ if (this.isJotxDocument(event.document)) {
45
+ this.updateDiagnostics(event.document);
46
+ }
47
+ }));
48
+ // Update diagnostics on document open
49
+ context.subscriptions.push(this.vscode.workspace.onDidOpenTextDocument((document) => {
50
+ if (this.isJotxDocument(document)) {
51
+ this.updateDiagnostics(document);
52
+ }
53
+ }));
54
+ // Clear diagnostics on document close
55
+ context.subscriptions.push(this.vscode.workspace.onDidCloseTextDocument((document) => {
56
+ if (this.isJotxDocument(document)) {
57
+ this.diagnosticCollection.delete(document.uri);
58
+ }
59
+ }));
60
+ // Register the diagnostic collection
61
+ context.subscriptions.push(this.diagnosticCollection);
62
+ // Validate all open jotx documents
63
+ this.vscode.workspace.textDocuments.forEach((document) => {
64
+ if (this.isJotxDocument(document)) {
65
+ this.updateDiagnostics(document);
66
+ }
67
+ });
68
+ }
69
+ /**
70
+ * Update diagnostics for a document
71
+ */
72
+ updateDiagnostics(document) {
73
+ const text = document.getText();
74
+ const result = this.diagnosticProvider.validate(text);
75
+ const vscodeDiagnostics = result.diagnostics.map(d => toVSCodeDiagnostic(d, this.vscode));
76
+ this.diagnosticCollection.set(document.uri, vscodeDiagnostics);
77
+ }
78
+ /**
79
+ * Check if document is a jotx file
80
+ */
81
+ isJotxDocument(document) {
82
+ return document.languageId === 'jotx-note' ||
83
+ document.fileName.endsWith('.jot') ||
84
+ document.fileName.endsWith('.meet');
85
+ }
86
+ /**
87
+ * Manually validate a document (for testing)
88
+ */
89
+ validateDocument(document) {
90
+ const text = document.getText();
91
+ const result = this.diagnosticProvider.validate(text);
92
+ return result.diagnostics.map(d => toVSCodeDiagnostic(d, this.vscode));
93
+ }
94
+ /**
95
+ * Clear all diagnostics
96
+ */
97
+ clear() {
98
+ this.diagnosticCollection.clear();
99
+ }
100
+ /**
101
+ * Dispose the provider
102
+ */
103
+ dispose() {
104
+ this.diagnosticCollection.dispose();
105
+ }
106
+ }
107
+ exports.VSCodeLanguageProvider = VSCodeLanguageProvider;
108
+ /**
109
+ * Setup jotx language support in VS Code
110
+ * Call this in your extension's activate() function
111
+ *
112
+ * @example
113
+ * import * as vscode from 'vscode'
114
+ * import { setupJotxLanguage } from '@jotx/language'
115
+ *
116
+ * export function activate(context: vscode.ExtensionContext) {
117
+ * const provider = setupJotxLanguage(vscode, context)
118
+ * // ...
119
+ * }
120
+ */
121
+ function setupJotxLanguage(vscode, context) {
122
+ const provider = new VSCodeLanguageProvider(vscode);
123
+ provider.register(context);
124
+ return provider;
125
+ }
126
+ //# sourceMappingURL=VSCodeLanguageProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VSCodeLanguageProvider.js","sourceRoot":"","sources":["../../src/vscode/VSCodeLanguageProvider.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAaH,gDA0BC;AAwHD,8CAIC;AAjKD,0EAAsF;AAQtF;;GAEG;AACH,SAAgB,kBAAkB,CAChC,UAA0B,EAC1B,MAAW;IAEX,MAAM,WAAW,GAAG;QAClB,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC,KAAK;QACxC,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,OAAO;QAC5C,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,WAAW;QAC7C,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAAI;KACvC,CAAA;IAED,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,CAC5B,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC,EACjE,IAAI,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAC9D,CAAA;IAED,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,UAAU,CAC5C,KAAK,EACL,UAAU,CAAC,OAAO,EAClB,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAC,CACjC,CAAA;IAED,gBAAgB,CAAC,IA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,QAAQ,CAAC,IAAI,CAAC,CAAA;QACrD,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACxE,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAA;IACrC,CAAC;CACF;AAnGD,wDAmGC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,iBAAiB,CAAC,MAAW,EAAE,OAAY;IACzD,MAAM,QAAQ,GAAG,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAAA;IACnD,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC1B,OAAO,QAAQ,CAAA;AACjB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@jotx-labs/language",
3
+ "version": "2.2.0",
4
+ "files": [
5
+ "dist"
6
+ ],
7
+ "description": "jotx language support - Syntax highlighting and diagnostics for VS Code and Monaco",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "test": "jest",
13
+ "clean": "rm -rf dist"
14
+ },
15
+ "keywords": [
16
+ "jotx",
17
+ "language",
18
+ "syntax",
19
+ "highlighting",
20
+ "diagnostics",
21
+ "monaco",
22
+ "vscode"
23
+ ],
24
+ "dependencies": {
25
+ "@jotx/core": "file:../core"
26
+ },
27
+ "devDependencies": {
28
+ "@types/node": "^20.0.0",
29
+ "typescript": "^5.0.0"
30
+ }
31
+ }