algraf-editor 0.67.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.
@@ -0,0 +1,135 @@
1
+ import React from 'react';
2
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
3
+
4
+ declare function registerAlgrafEditorProviders(languageId: string, getRuntime: (model: monaco.editor.ITextModel) => AlgrafRuntime | null, getFiles: (model: monaco.editor.ITextModel) => Record<string, string>): monaco.IDisposable;
5
+
6
+ declare const ALGRAF_LANGUAGE_ID = "algraf";
7
+ declare const ALGRAF_SCOPE_NAME = "source.algraf";
8
+ declare const ALGRAF_THEME_NAME = "algraf-playground";
9
+ declare const ALGRAF_MARKER_OWNER = "algraf-wasm";
10
+ declare const ALGRAF_DEFAULT_MODEL_URI = "inmemory://algraf/demo.ag";
11
+ interface AlgrafDiagnostic {
12
+ code: string;
13
+ severity: "error" | "warning" | "information" | "hint";
14
+ message: string;
15
+ span: {
16
+ start: number;
17
+ end: number;
18
+ };
19
+ related?: Array<{
20
+ span: {
21
+ start: number;
22
+ end: number;
23
+ };
24
+ message: string;
25
+ }>;
26
+ help?: string;
27
+ }
28
+ interface LspPosition {
29
+ line: number;
30
+ character: number;
31
+ }
32
+ interface LspRange {
33
+ start: LspPosition;
34
+ end: LspPosition;
35
+ }
36
+ interface LspDiagnostic {
37
+ range: LspRange;
38
+ severity?: number;
39
+ code?: string | number;
40
+ source?: string;
41
+ message: string;
42
+ relatedInformation?: Array<{
43
+ location: {
44
+ uri: string;
45
+ range: LspRange;
46
+ };
47
+ message: string;
48
+ }>;
49
+ }
50
+ type AlgrafEditorFeatureRequest = {
51
+ kind: "diagnostics";
52
+ } | {
53
+ kind: "hover";
54
+ position: LspPosition;
55
+ } | {
56
+ kind: "completion";
57
+ position: LspPosition;
58
+ } | {
59
+ kind: "signatureHelp";
60
+ position: LspPosition;
61
+ } | {
62
+ kind: "formatting";
63
+ } | {
64
+ kind: "rangeFormatting";
65
+ range: LspRange;
66
+ } | {
67
+ kind: "semanticTokens";
68
+ } | {
69
+ kind: "codeActions";
70
+ range: LspRange;
71
+ diagnostics: LspDiagnostic[];
72
+ } | {
73
+ kind: "definition";
74
+ position: LspPosition;
75
+ } | {
76
+ kind: "references";
77
+ position: LspPosition;
78
+ includeDeclaration: boolean;
79
+ } | {
80
+ kind: "documentHighlights";
81
+ position: LspPosition;
82
+ } | {
83
+ kind: "prepareRename";
84
+ position: LspPosition;
85
+ } | {
86
+ kind: "rename";
87
+ position: LspPosition;
88
+ newName: string;
89
+ } | {
90
+ kind: "documentSymbols";
91
+ };
92
+ interface AlgrafEditorServiceResult<T = unknown> {
93
+ diagnostics: LspDiagnostic[];
94
+ result: T;
95
+ error: string | null;
96
+ }
97
+ interface AlgrafRuntime {
98
+ editorService<T = unknown>(source: string, files: Record<string, string>, request: AlgrafEditorFeatureRequest, uri?: string): AlgrafEditorServiceResult<T>;
99
+ }
100
+ interface AlgrafEditorProps {
101
+ value: string;
102
+ files: Record<string, string>;
103
+ diagnostics: AlgrafDiagnostic[];
104
+ runtime: AlgrafRuntime | null;
105
+ onChange: (value: string) => void;
106
+ modelUri?: string;
107
+ languageId?: string;
108
+ themeName?: string;
109
+ theme?: monaco.editor.IStandaloneThemeData;
110
+ className?: string;
111
+ editorClassName?: string;
112
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
113
+ setupOptions?: SetupAlgrafMonacoOptions;
114
+ }
115
+ interface SetupAlgrafMonacoOptions {
116
+ languageId?: string;
117
+ aliases?: string[];
118
+ extensions?: string[];
119
+ scopeName?: string;
120
+ themeName?: string;
121
+ theme?: monaco.editor.IStandaloneThemeData;
122
+ grammar?: unknown;
123
+ languageConfiguration?: monaco.languages.LanguageConfiguration;
124
+ onigasmWasmUrl?: string;
125
+ configureWorker?: boolean;
126
+ }
127
+ declare function AlgrafEditor({ value, files, diagnostics, runtime, onChange, modelUri, languageId, themeName, theme, className, editorClassName, options, setupOptions, }: AlgrafEditorProps): React.ReactElement;
128
+ declare function setupAlgrafMonaco(options?: SetupAlgrafMonacoOptions): Promise<void>;
129
+ declare function registerAlgrafLanguage(options?: SetupAlgrafMonacoOptions): void;
130
+ declare function defineAlgrafTheme(themeName?: string, theme?: monaco.editor.IStandaloneThemeData): void;
131
+ declare function defaultAlgrafTheme(): monaco.editor.IStandaloneThemeData;
132
+ declare function setAlgrafMarkers(model: monaco.editor.ITextModel, diagnostics: AlgrafDiagnostic[]): void;
133
+ declare function diagnosticToAlgrafMarker(model: monaco.editor.ITextModel, diagnostic: AlgrafDiagnostic): monaco.editor.IMarkerData;
134
+
135
+ export { ALGRAF_DEFAULT_MODEL_URI, ALGRAF_LANGUAGE_ID, ALGRAF_MARKER_OWNER, ALGRAF_SCOPE_NAME, ALGRAF_THEME_NAME, type AlgrafDiagnostic, AlgrafEditor, type AlgrafEditorFeatureRequest, type AlgrafEditorProps, type AlgrafEditorServiceResult, type AlgrafRuntime, type LspDiagnostic, type LspPosition, type LspRange, type SetupAlgrafMonacoOptions, defaultAlgrafTheme, defineAlgrafTheme, diagnosticToAlgrafMarker, registerAlgrafEditorProviders, registerAlgrafLanguage, setAlgrafMarkers, setupAlgrafMonaco };
@@ -0,0 +1,135 @@
1
+ import React from 'react';
2
+ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
3
+
4
+ declare function registerAlgrafEditorProviders(languageId: string, getRuntime: (model: monaco.editor.ITextModel) => AlgrafRuntime | null, getFiles: (model: monaco.editor.ITextModel) => Record<string, string>): monaco.IDisposable;
5
+
6
+ declare const ALGRAF_LANGUAGE_ID = "algraf";
7
+ declare const ALGRAF_SCOPE_NAME = "source.algraf";
8
+ declare const ALGRAF_THEME_NAME = "algraf-playground";
9
+ declare const ALGRAF_MARKER_OWNER = "algraf-wasm";
10
+ declare const ALGRAF_DEFAULT_MODEL_URI = "inmemory://algraf/demo.ag";
11
+ interface AlgrafDiagnostic {
12
+ code: string;
13
+ severity: "error" | "warning" | "information" | "hint";
14
+ message: string;
15
+ span: {
16
+ start: number;
17
+ end: number;
18
+ };
19
+ related?: Array<{
20
+ span: {
21
+ start: number;
22
+ end: number;
23
+ };
24
+ message: string;
25
+ }>;
26
+ help?: string;
27
+ }
28
+ interface LspPosition {
29
+ line: number;
30
+ character: number;
31
+ }
32
+ interface LspRange {
33
+ start: LspPosition;
34
+ end: LspPosition;
35
+ }
36
+ interface LspDiagnostic {
37
+ range: LspRange;
38
+ severity?: number;
39
+ code?: string | number;
40
+ source?: string;
41
+ message: string;
42
+ relatedInformation?: Array<{
43
+ location: {
44
+ uri: string;
45
+ range: LspRange;
46
+ };
47
+ message: string;
48
+ }>;
49
+ }
50
+ type AlgrafEditorFeatureRequest = {
51
+ kind: "diagnostics";
52
+ } | {
53
+ kind: "hover";
54
+ position: LspPosition;
55
+ } | {
56
+ kind: "completion";
57
+ position: LspPosition;
58
+ } | {
59
+ kind: "signatureHelp";
60
+ position: LspPosition;
61
+ } | {
62
+ kind: "formatting";
63
+ } | {
64
+ kind: "rangeFormatting";
65
+ range: LspRange;
66
+ } | {
67
+ kind: "semanticTokens";
68
+ } | {
69
+ kind: "codeActions";
70
+ range: LspRange;
71
+ diagnostics: LspDiagnostic[];
72
+ } | {
73
+ kind: "definition";
74
+ position: LspPosition;
75
+ } | {
76
+ kind: "references";
77
+ position: LspPosition;
78
+ includeDeclaration: boolean;
79
+ } | {
80
+ kind: "documentHighlights";
81
+ position: LspPosition;
82
+ } | {
83
+ kind: "prepareRename";
84
+ position: LspPosition;
85
+ } | {
86
+ kind: "rename";
87
+ position: LspPosition;
88
+ newName: string;
89
+ } | {
90
+ kind: "documentSymbols";
91
+ };
92
+ interface AlgrafEditorServiceResult<T = unknown> {
93
+ diagnostics: LspDiagnostic[];
94
+ result: T;
95
+ error: string | null;
96
+ }
97
+ interface AlgrafRuntime {
98
+ editorService<T = unknown>(source: string, files: Record<string, string>, request: AlgrafEditorFeatureRequest, uri?: string): AlgrafEditorServiceResult<T>;
99
+ }
100
+ interface AlgrafEditorProps {
101
+ value: string;
102
+ files: Record<string, string>;
103
+ diagnostics: AlgrafDiagnostic[];
104
+ runtime: AlgrafRuntime | null;
105
+ onChange: (value: string) => void;
106
+ modelUri?: string;
107
+ languageId?: string;
108
+ themeName?: string;
109
+ theme?: monaco.editor.IStandaloneThemeData;
110
+ className?: string;
111
+ editorClassName?: string;
112
+ options?: monaco.editor.IStandaloneEditorConstructionOptions;
113
+ setupOptions?: SetupAlgrafMonacoOptions;
114
+ }
115
+ interface SetupAlgrafMonacoOptions {
116
+ languageId?: string;
117
+ aliases?: string[];
118
+ extensions?: string[];
119
+ scopeName?: string;
120
+ themeName?: string;
121
+ theme?: monaco.editor.IStandaloneThemeData;
122
+ grammar?: unknown;
123
+ languageConfiguration?: monaco.languages.LanguageConfiguration;
124
+ onigasmWasmUrl?: string;
125
+ configureWorker?: boolean;
126
+ }
127
+ declare function AlgrafEditor({ value, files, diagnostics, runtime, onChange, modelUri, languageId, themeName, theme, className, editorClassName, options, setupOptions, }: AlgrafEditorProps): React.ReactElement;
128
+ declare function setupAlgrafMonaco(options?: SetupAlgrafMonacoOptions): Promise<void>;
129
+ declare function registerAlgrafLanguage(options?: SetupAlgrafMonacoOptions): void;
130
+ declare function defineAlgrafTheme(themeName?: string, theme?: monaco.editor.IStandaloneThemeData): void;
131
+ declare function defaultAlgrafTheme(): monaco.editor.IStandaloneThemeData;
132
+ declare function setAlgrafMarkers(model: monaco.editor.ITextModel, diagnostics: AlgrafDiagnostic[]): void;
133
+ declare function diagnosticToAlgrafMarker(model: monaco.editor.ITextModel, diagnostic: AlgrafDiagnostic): monaco.editor.IMarkerData;
134
+
135
+ export { ALGRAF_DEFAULT_MODEL_URI, ALGRAF_LANGUAGE_ID, ALGRAF_MARKER_OWNER, ALGRAF_SCOPE_NAME, ALGRAF_THEME_NAME, type AlgrafDiagnostic, AlgrafEditor, type AlgrafEditorFeatureRequest, type AlgrafEditorProps, type AlgrafEditorServiceResult, type AlgrafRuntime, type LspDiagnostic, type LspPosition, type LspRange, type SetupAlgrafMonacoOptions, defaultAlgrafTheme, defineAlgrafTheme, diagnosticToAlgrafMarker, registerAlgrafEditorProviders, registerAlgrafLanguage, setAlgrafMarkers, setupAlgrafMonaco };