@difizen/libro-code-editor 0.0.2-alpha.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,497 @@
1
+ import type { JSONObject } from '@difizen/libro-common';
2
+ import type { Disposable, Event } from '@difizen/mana-app';
3
+ import type { DidChangeConfigurationParams, ServerCapabilities } from 'vscode-languageserver-protocol';
4
+ import type { IModel } from './model.js';
5
+ /**
6
+ * Code editor accessor.
7
+ */
8
+ export interface ILSPEditor {
9
+ /**
10
+ * CodeEditor getter.
11
+ *
12
+ * It will return `null` if the editor is not yet instantiated;
13
+ * e.g. to support windowed notebook.
14
+ */
15
+ getEditor(): IEditor | null;
16
+ /**
17
+ * Promise getter that resolved when the editor is instantiated.
18
+ */
19
+ ready(): Promise<IEditor>;
20
+ /**
21
+ * Reveal the code editor in viewport.
22
+ *
23
+ * ### Notes
24
+ * The promise will resolve when the editor is instantiated and in
25
+ * the viewport.
26
+ */
27
+ reveal(): Promise<IEditor>;
28
+ }
29
+ /**
30
+ * A zero-based position in the editor.
31
+ */
32
+ export interface IPosition extends JSONObject {
33
+ /**
34
+ * The cursor line number.
35
+ */
36
+ readonly line: number;
37
+ /**
38
+ * The cursor column number.
39
+ */
40
+ readonly column: number;
41
+ }
42
+ /**
43
+ * An interface describing editor state coordinates.
44
+ */
45
+ export type ICoordinate = DOMRectReadOnly;
46
+ /**
47
+ * A range.
48
+ */
49
+ export interface IRange {
50
+ /**
51
+ * The position of the first character in the current range.
52
+ *
53
+ * #### Notes
54
+ * If this position is greater than [end] then the range is considered
55
+ * to be backward.
56
+ */
57
+ readonly start: IPosition;
58
+ /**
59
+ * The position of the last character in the current range.
60
+ *
61
+ * #### Notes
62
+ * If this position is less than [start] then the range is considered
63
+ * to be backward.
64
+ */
65
+ readonly end: IPosition;
66
+ }
67
+ /**
68
+ * A selection style.
69
+ */
70
+ export interface IEditorSelectionStyle {
71
+ /**
72
+ * A class name added to a selection.
73
+ */
74
+ className: string;
75
+ /**
76
+ * A display name added to a selection.
77
+ */
78
+ displayName: string;
79
+ /**
80
+ * A color for UI elements.
81
+ */
82
+ color: string;
83
+ }
84
+ /**
85
+ * The default selection style.
86
+ */
87
+ export declare const defaultSelectionStyle: IEditorSelectionStyle;
88
+ /**
89
+ * A text selection.
90
+ */
91
+ export interface ITextSelection extends IRange {
92
+ /**
93
+ * The uuid of the text selection owner.
94
+ */
95
+ readonly uuid: string;
96
+ /**
97
+ * The style of this selection.
98
+ */
99
+ readonly style: IEditorSelectionStyle;
100
+ }
101
+ /**
102
+ * An interface for a text token, such as a word, keyword, or variable.
103
+ */
104
+ export interface IToken {
105
+ /**
106
+ * The value of the token.
107
+ */
108
+ value: string;
109
+ /**
110
+ * The offset of the token in the code editor.
111
+ */
112
+ offset: number;
113
+ /**
114
+ * An optional type for the token.
115
+ */
116
+ type?: string;
117
+ }
118
+ /**
119
+ * A selection owner.
120
+ */
121
+ export interface ISelectionOwner {
122
+ /**
123
+ * The uuid of this selection owner.
124
+ */
125
+ uuid: string;
126
+ /**
127
+ * Returns the primary position of the cursor, never `null`.
128
+ */
129
+ getCursorPosition: () => IPosition;
130
+ /**
131
+ * Set the primary position of the cursor.
132
+ *
133
+ * @param position - The new primary position.
134
+ *
135
+ * #### Notes
136
+ * This will remove any secondary cursors.
137
+ */
138
+ setCursorPosition: (position: IPosition) => void;
139
+ /**
140
+ * Returns the primary selection, never `null`.
141
+ */
142
+ getSelection: () => IRange;
143
+ /**
144
+ * Set the primary selection.
145
+ *
146
+ * @param selection - The desired selection range.
147
+ *
148
+ * #### Notes
149
+ * This will remove any secondary cursors.
150
+ */
151
+ setSelection: (selection: IRange) => void;
152
+ /**
153
+ * Gets the selections for all the cursors, never `null` or empty.
154
+ */
155
+ getSelections: () => IRange[];
156
+ /**
157
+ * Sets the selections for all the cursors.
158
+ *
159
+ * @param selections - The new selections.
160
+ *
161
+ * #### Notes
162
+ * Cursors will be removed or added, as necessary.
163
+ * Passing an empty array resets a cursor position to the start of a
164
+ * document.
165
+ */
166
+ setSelections: (selections: IRange[]) => void;
167
+ }
168
+ /**
169
+ * A keydown handler type.
170
+ *
171
+ * #### Notes
172
+ * Return `true` to prevent the default handling of the event by the
173
+ * editor.
174
+ */
175
+ export type KeydownHandler = (instance: IEditor, event: KeyboardEvent) => boolean;
176
+ /**
177
+ * The location of requested edges.
178
+ */
179
+ export type EdgeLocation = 'top' | 'topLine' | 'bottom';
180
+ /**
181
+ * A widget that provides a code editor.
182
+ */
183
+ export interface IEditor extends ISelectionOwner, Disposable {
184
+ /**
185
+ * A signal emitted when either the top or bottom edge is requested.
186
+ */
187
+ /**
188
+ * The DOM node that hosts the editor.
189
+ */
190
+ readonly host: HTMLElement;
191
+ /**
192
+ * The model used by the editor.
193
+ */
194
+ readonly model: IModel;
195
+ /**
196
+ * Get the number of lines in the editor.
197
+ */
198
+ readonly lineCount: number;
199
+ /**
200
+ * Get a config option for the editor.
201
+ */
202
+ getOption: <K extends keyof IEditorConfig>(option: K) => IEditorConfig[K];
203
+ /**
204
+ * Set a config option for the editor.
205
+ */
206
+ setOption: <K extends keyof IEditorConfig>(option: K, value: IEditorConfig[K]) => void;
207
+ /**
208
+ * Returns the content for the given line number.
209
+ *
210
+ * @param line - The line of interest.
211
+ *
212
+ * @returns The value of the line.
213
+ *
214
+ * #### Notes
215
+ * Lines are 0-based, and accessing a line out of range returns
216
+ * `undefined`.
217
+ */
218
+ getLine: (line: number) => string | undefined;
219
+ /**
220
+ * Find an offset for the given position.
221
+ *
222
+ * @param position - The position of interest.
223
+ *
224
+ * @returns The offset at the position, clamped to the extent of the
225
+ * editor contents.
226
+ */
227
+ getOffsetAt: (position: IPosition) => number;
228
+ /**
229
+ * Undo one edit (if any undo events are stored).
230
+ */
231
+ undo: () => void;
232
+ /**
233
+ * Redo one undone edit.
234
+ */
235
+ redo: () => void;
236
+ /**
237
+ * Brings browser focus to this editor text.
238
+ */
239
+ focus: () => void;
240
+ /**
241
+ * Test whether the editor has keyboard focus.
242
+ */
243
+ hasFocus: () => boolean;
244
+ /**
245
+ * Explicitly blur the editor.
246
+ */
247
+ blur: () => void;
248
+ /**
249
+ * Resize the editor to fit its host node.
250
+ */
251
+ resizeToFit: () => void;
252
+ /**
253
+ * Get the cursor position given window coordinates.
254
+ *
255
+ * @param coordinate - The desired coordinate.
256
+ *
257
+ * @returns The position of the coordinates, or null if not
258
+ * contained in the editor.
259
+ */
260
+ getPositionForCoordinate: (coordinate: ICoordinate) => IPosition | null;
261
+ onModalChange: Event<boolean>;
262
+ }
263
+ /**
264
+ * A factory used to create a code editor.
265
+ */
266
+ export type CodeEditorFactory = (options: IEditorOptions) => IEditor;
267
+ /**
268
+ * The configuration options for an editor.
269
+ */
270
+ export interface IEditorConfig {
271
+ /**
272
+ * Half-period in milliseconds used for cursor blinking.
273
+ * By setting this to zero, blinking can be disabled.
274
+ * A negative value hides the cursor entirely.
275
+ */
276
+ cursorBlinkRate: number;
277
+ /**
278
+ * User preferred font family for text editors.
279
+ */
280
+ fontFamily: string | null;
281
+ /**
282
+ * User preferred size in pixel of the font used in text editors.
283
+ */
284
+ fontSize: number | null;
285
+ /**
286
+ * User preferred text line height, as a multiplier of font size.
287
+ */
288
+ lineHeight: number | null;
289
+ /**
290
+ * Whether line numbers should be displayed.
291
+ */
292
+ lineNumbers: boolean;
293
+ /**
294
+ * Control the line wrapping of the editor. Possible values are:
295
+ * - "off", lines will never wrap.
296
+ * - "on", lines will wrap at the viewport border.
297
+ * - "wordWrapColumn", lines will wrap at `wordWrapColumn`.
298
+ * - "bounded", lines will wrap at minimum between viewport width and wordWrapColumn.
299
+ */
300
+ lineWrap: 'off' | 'on' | 'wordWrapColumn' | 'bounded';
301
+ /**
302
+ * Whether the editor content is read-only.
303
+ */
304
+ readOnly: boolean;
305
+ /**
306
+ * whther the editor view is editable.
307
+ */
308
+ editable: boolean;
309
+ /**
310
+ * The number of spaces a tab is equal to.
311
+ */
312
+ tabSize: number;
313
+ /**
314
+ * Whether to insert spaces when pressing Tab.
315
+ */
316
+ insertSpaces: boolean;
317
+ /**
318
+ * Whether to highlight matching brackets when one of them is selected.
319
+ */
320
+ matchBrackets: boolean;
321
+ /**
322
+ * Whether to automatically close brackets after opening them.
323
+ */
324
+ autoClosingBrackets: boolean;
325
+ /**
326
+ * Whether the editor should handle paste events.
327
+ */
328
+ handlePaste?: boolean;
329
+ /**
330
+ * The column where to break text line.
331
+ */
332
+ wordWrapColumn: number;
333
+ /**
334
+ * Column index at which rulers should be added.
335
+ */
336
+ rulers: number[];
337
+ /**
338
+ * Whether to allow code folding
339
+ */
340
+ codeFolding: boolean;
341
+ /**
342
+ * Whether to highlight trailing whitespace
343
+ */
344
+ showTrailingSpace: boolean;
345
+ foldGutter?: boolean;
346
+ styleActiveLine?: boolean;
347
+ highlightActiveLineGutter?: boolean;
348
+ placeholder?: HTMLElement | string;
349
+ }
350
+ /**
351
+ * The default configuration options for an editor.
352
+ */
353
+ export declare const defaultConfig: IEditorConfig;
354
+ export type TooltipProviderOption = {
355
+ cursorPosition: number;
356
+ };
357
+ export type TooltipProvider = (option: TooltipProviderOption) => Promise<string | null>;
358
+ export type CompletionProviderOption = {
359
+ cursorPosition: number;
360
+ };
361
+ export type CompletionReply = {
362
+ matches: string[];
363
+ cursor_start: number;
364
+ cursor_end: number;
365
+ metadata: JSONObject;
366
+ };
367
+ export type CompletionProvider = (option: CompletionProviderOption) => Promise<CompletionReply>;
368
+ export type LSPProviderResult = {
369
+ virtualDocument: IVirtualDocument;
370
+ lspConnection: ILspConnection;
371
+ editor: ILSPEditor;
372
+ };
373
+ export type LSPProvider = () => Promise<LSPProviderResult>;
374
+ export interface Position {
375
+ /**
376
+ * Line number
377
+ */
378
+ line: number;
379
+ /**
380
+ * Position of character in line
381
+ */
382
+ ch: number;
383
+ }
384
+ /**
385
+ * is_* attributes are there only to enforce strict interface type checking
386
+ */
387
+ export interface ISourcePosition extends Position {
388
+ isSource: true;
389
+ }
390
+ export interface IEditorPosition extends Position {
391
+ isEditor: true;
392
+ }
393
+ export interface IVirtualPosition extends Position {
394
+ isVirtual: true;
395
+ }
396
+ export interface IRootPosition extends ISourcePosition {
397
+ isRoot: true;
398
+ }
399
+ export interface IVirtualDocument {
400
+ uri: string;
401
+ /**
402
+ * Get the corresponding editor of the virtual line.
403
+ */
404
+ getEditorAtVirtualLine: (pos: IVirtualPosition) => ILSPEditor;
405
+ transformEditorToVirtual: (editor: ILSPEditor, position: IEditorPosition) => IVirtualPosition | null;
406
+ ttransformVirtualToEditor: (virtualPosition: IVirtualPosition) => IEditorPosition | null;
407
+ }
408
+ export interface IDocumentInfo {
409
+ /**
410
+ * URI of the virtual document.
411
+ */
412
+ uri: string;
413
+ /**
414
+ * Version of the virtual document.
415
+ */
416
+ version: number;
417
+ /**
418
+ * Text content of the document.
419
+ */
420
+ text: string;
421
+ /**
422
+ * Language id of the document.
423
+ */
424
+ languageId: string;
425
+ }
426
+ export interface ILspConnection {
427
+ /**
428
+ * Is the language server is connected?
429
+ */
430
+ isConnected: boolean;
431
+ /**
432
+ * Is the language server is initialized?
433
+ */
434
+ isInitialized: boolean;
435
+ /**
436
+ * Is the language server is connected and initialized?
437
+ */
438
+ isReady: boolean;
439
+ /**
440
+ * Initialize a connection over a web socket that speaks the LSP protocol
441
+ */
442
+ connect(socket: WebSocket): void;
443
+ /**
444
+ * Close the connection
445
+ */
446
+ close(): void;
447
+ /**
448
+ * The initialize request tells the server which options the client supports
449
+ */
450
+ sendInitialize(): void;
451
+ /**
452
+ * Inform the server that the document was opened
453
+ */
454
+ sendOpen(documentInfo: IDocumentInfo): void;
455
+ /**
456
+ * Sends the full text of the document to the server
457
+ */
458
+ sendChange(documentInfo: IDocumentInfo): void;
459
+ /**
460
+ * Send save notification to the server.
461
+ */
462
+ sendSaved(documentInfo: IDocumentInfo): void;
463
+ /**
464
+ * Send configuration change to the server.
465
+ */
466
+ sendConfigurationChange(settings: DidChangeConfigurationParams): void;
467
+ provides(provider: keyof ServerCapabilities): boolean;
468
+ }
469
+ /**
470
+ * The options used to initialize an editor.
471
+ */
472
+ export interface IEditorOptions {
473
+ /**
474
+ * The host widget used by the editor.
475
+ */
476
+ host: HTMLElement;
477
+ /**
478
+ * The model used by the editor.
479
+ */
480
+ model: IModel;
481
+ /**
482
+ * The desired uuid for the editor.
483
+ */
484
+ uuid?: string | undefined;
485
+ /**
486
+ * The default selection style for the editor.
487
+ */
488
+ selectionStyle?: Partial<IEditorSelectionStyle> | undefined;
489
+ /**
490
+ * The configuration options for the editor.
491
+ */
492
+ config?: Partial<IEditorConfig> | undefined;
493
+ tooltipProvider?: TooltipProvider | undefined;
494
+ completionProvider?: CompletionProvider | undefined;
495
+ lspProvider?: LSPProvider | undefined;
496
+ }
497
+ //# sourceMappingURL=code-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-editor.d.ts","sourceRoot":"","sources":["../src/code-editor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EACV,4BAA4B,EAC5B,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,SAAS,IAAI,OAAO,GAAG,IAAI,CAAC;IAE5B;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1B;;;;;;OAMG;IACH,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,UAAU;IAC3C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AACD;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ACH,IAAI,EAAE,WAAW,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC;IAE5D;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;IAQ5C,eAAe,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,kBAAkB,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACpD,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACvC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Code editor accessor.
3
+ */
4
+
5
+ /**
6
+ * A zero-based position in the editor.
7
+ */
8
+
9
+ /**
10
+ * An interface describing editor state coordinates.
11
+ */
12
+
13
+ /**
14
+ * A range.
15
+ */
16
+
17
+ /**
18
+ * A selection style.
19
+ */
20
+
21
+ /**
22
+ * The default selection style.
23
+ */
24
+ export var defaultSelectionStyle = {
25
+ className: '',
26
+ displayName: '',
27
+ color: 'black'
28
+ };
29
+
30
+ /**
31
+ * A text selection.
32
+ */
33
+
34
+ /**
35
+ * An interface for a text token, such as a word, keyword, or variable.
36
+ */
37
+
38
+ /**
39
+ * A selection owner.
40
+ */
41
+
42
+ /**
43
+ * A keydown handler type.
44
+ *
45
+ * #### Notes
46
+ * Return `true` to prevent the default handling of the event by the
47
+ * editor.
48
+ */
49
+
50
+ /**
51
+ * The location of requested edges.
52
+ */
53
+
54
+ /**
55
+ * A widget that provides a code editor.
56
+ */
57
+
58
+ /**
59
+ * A factory used to create a code editor.
60
+ */
61
+
62
+ /**
63
+ * The configuration options for an editor.
64
+ */
65
+
66
+ /**
67
+ * The default configuration options for an editor.
68
+ */
69
+ export var defaultConfig = {
70
+ // Order matters as gutters will be sorted by the configuration order
71
+ autoClosingBrackets: true,
72
+ cursorBlinkRate: 530,
73
+ fontFamily: null,
74
+ fontSize: null,
75
+ handlePaste: true,
76
+ insertSpaces: true,
77
+ lineHeight: null,
78
+ lineNumbers: true,
79
+ lineWrap: 'on',
80
+ matchBrackets: true,
81
+ readOnly: false,
82
+ editable: true,
83
+ tabSize: 4,
84
+ rulers: [],
85
+ showTrailingSpace: false,
86
+ wordWrapColumn: 80,
87
+ codeFolding: false,
88
+ foldGutter: true,
89
+ styleActiveLine: false,
90
+ highlightActiveLineGutter: false
91
+ };
92
+
93
+ /**
94
+ * is_* attributes are there only to enforce strict interface type checking
95
+ */
96
+
97
+ /**
98
+ * The options used to initialize an editor.
99
+ */