lexgui 8.2.5 → 8.3.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.
Files changed (35) hide show
  1. package/build/components/NodeTree.d.ts +51 -51
  2. package/build/components/Tabs.d.ts +1 -0
  3. package/build/core/Namespace.js +1 -1
  4. package/build/core/Namespace.js.map +1 -1
  5. package/build/extensions/AssetView.d.ts +138 -138
  6. package/build/extensions/AssetView.js +1433 -1433
  7. package/build/extensions/CodeEditor.d.ts +466 -363
  8. package/build/extensions/CodeEditor.js +3768 -4638
  9. package/build/extensions/CodeEditor.js.map +1 -1
  10. package/build/extensions/DocMaker.d.ts +28 -28
  11. package/build/extensions/DocMaker.js +363 -363
  12. package/build/extensions/Timeline.d.ts +2 -2
  13. package/build/extensions/Timeline.js +28 -15
  14. package/build/extensions/Timeline.js.map +1 -1
  15. package/build/extensions/VideoEditor.d.ts +1 -1
  16. package/build/extensions/VideoEditor.js +15 -7
  17. package/build/extensions/VideoEditor.js.map +1 -1
  18. package/build/extensions/index.js +1 -1
  19. package/build/lexgui.all.js +6169 -6960
  20. package/build/lexgui.all.js.map +1 -1
  21. package/build/lexgui.all.min.js +1 -1
  22. package/build/lexgui.all.module.js +6169 -6961
  23. package/build/lexgui.all.module.js.map +1 -1
  24. package/build/lexgui.all.module.min.js +1 -1
  25. package/build/lexgui.css +7534 -7459
  26. package/build/lexgui.js +4475 -205
  27. package/build/lexgui.js.map +1 -1
  28. package/build/lexgui.min.css +1 -1
  29. package/build/lexgui.min.js +1 -1
  30. package/build/lexgui.module.js +4475 -205
  31. package/build/lexgui.module.js.map +1 -1
  32. package/build/lexgui.module.min.js +1 -1
  33. package/changelog.md +31 -1
  34. package/examples/code-editor.html +88 -16
  35. package/package.json +1 -1
@@ -1,363 +1,466 @@
1
- declare const vec2: any;
2
- declare const Area: any;
3
- declare const Panel: any;
4
- declare const Tree: any;
5
- declare const Tabs: any;
6
- type Token = {
7
- text: string;
8
- pos: number;
9
- };
10
- declare class Cursor {
11
- root: any;
12
- name: string;
13
- editor: CodeEditor;
14
- isMain: boolean;
15
- selection: CodeSelection | null;
16
- private _line;
17
- private _position;
18
- get line(): number;
19
- set line(v: number);
20
- get position(): number;
21
- set position(v: number);
22
- left: number;
23
- top: number;
24
- constructor(name: string, position: number | undefined, line: number | undefined, isMain: boolean | undefined, editor: CodeEditor);
25
- set(position?: number, line?: number, updateEditor?: boolean): void;
26
- print(): void;
27
- destroy(): void;
28
- isLast(): boolean;
29
- }
30
- declare class CodeSelection {
31
- fromX: number;
32
- toX: number;
33
- fromY: number;
34
- toY: number;
35
- chars: number;
36
- editor: CodeEditor;
37
- cursor: Cursor;
38
- className: string;
39
- constructor(editor: CodeEditor, cursor: Cursor, className?: string);
40
- sameLine(): boolean;
41
- samePosition(): boolean;
42
- isEmpty(): boolean;
43
- invertIfNecessary(): void;
44
- selectInline(cursor: Cursor, x: number, y: number, width: number, isSearchResult?: boolean): void;
45
- save(): {
46
- fromX: number;
47
- fromY: number;
48
- toX: number;
49
- toY: number;
50
- };
51
- load(data: any): void;
52
- getText(): any;
53
- }
54
- declare class ScrollBar {
55
- static SCROLLBAR_VERTICAL: number;
56
- static SCROLLBAR_HORIZONTAL: number;
57
- static SCROLLBAR_VERTICAL_WIDTH: number;
58
- static SCROLLBAR_HORIZONTAL_HEIGHT: number;
59
- editor: CodeEditor;
60
- type: number;
61
- root: any;
62
- thumb: any;
63
- lastPosition: typeof vec2;
64
- constructor(editor: CodeEditor, type: number);
65
- }
66
- /**
67
- * @class CodeEditor
68
- */
69
- export declare class CodeEditor {
70
- static __instances: CodeEditor[];
71
- static CURSOR_LEFT: number;
72
- static CURSOR_TOP: number;
73
- static CURSOR_LEFT_TOP: number;
74
- static SELECTION_X: number;
75
- static SELECTION_Y: number;
76
- static SELECTION_X_Y: number;
77
- static KEEP_VISIBLE_LINES: number;
78
- static UPDATE_VISIBLE_LINES: number;
79
- static WORD_TYPE_METHOD: number;
80
- static WORD_TYPE_CLASS: number;
81
- static CODE_MIN_FONT_SIZE: number;
82
- static CODE_MAX_FONT_SIZE: number;
83
- static LINE_GUTTER_WIDTH: number;
84
- static RESIZE_SCROLLBAR_H: number;
85
- static RESIZE_SCROLLBAR_V: number;
86
- static RESIZE_SCROLLBAR_H_V: number;
87
- static languages: Record<string, any>;
88
- static keywords: any;
89
- static utils: any;
90
- static types: any;
91
- static builtIn: any;
92
- static statements: any;
93
- static declarationKeywords: any;
94
- static symbols: any;
95
- static nativeTypes: any;
96
- static debugScopes: boolean;
97
- static debugSymbols: boolean;
98
- static debugProcessedLines: boolean;
99
- static _staticReady: boolean;
100
- root: any;
101
- baseArea: typeof Area;
102
- area: typeof Area;
103
- codeArea: typeof Area;
104
- explorerArea: any;
105
- code: any;
106
- gutter: HTMLElement;
107
- xPadding: string;
108
- hScrollbar: ScrollBar;
109
- vScrollbar: ScrollBar;
110
- codeScroller: any;
111
- codeSizer: any;
112
- explorer: typeof Tree;
113
- tabs: typeof Tabs;
114
- cursorsDOM: any;
115
- cursors: Cursor[];
116
- mustProcessLines: boolean;
117
- blinker: any;
118
- statusPanel: typeof Panel;
119
- leftStatusPanel: typeof Panel;
120
- rightStatusPanel: typeof Panel;
121
- lineScrollMargin: typeof vec2;
122
- autocomplete: HTMLElement;
123
- searchbox: HTMLElement;
124
- searchlinebox: HTMLElement;
125
- openedTabs: Record<string, any>;
126
- loadedTabs: Record<string, any>;
127
- actions: Record<string, any>;
128
- state: Record<string, any>;
129
- pairKeys: Record<string, string>;
130
- stringKeys: Record<string, string>;
131
- visibleLinesViewport: typeof vec2;
132
- searchResultSelections: any;
133
- firstLineInViewport: number;
134
- selections: Record<string, any>;
135
- specialKeys: string[];
136
- canOpenContextMenu: boolean;
137
- wasKeyPaired: boolean | undefined;
138
- mustProcessNextLine: ((s: string[]) => boolean) | undefined;
139
- mustProcessPreviousLine: ((s: string[]) => boolean) | undefined;
140
- cursorBlinkRate: number;
141
- tabSpaces: number;
142
- maxUndoSteps: number;
143
- lineHeight: number;
144
- charWidth: number;
145
- fontSize: number;
146
- defaultSingleLineCommentToken: string;
147
- defaultBlockCommentTokens: string[];
148
- isAutoCompleteActive: boolean;
149
- isSearchboxActive: boolean;
150
- isSearchlineboxActive: boolean;
151
- skipInfo: boolean;
152
- disableEdition: boolean;
153
- skipTabs: boolean;
154
- useFileExplorer: boolean;
155
- useAutoComplete: boolean;
156
- allowClosingTabs: boolean;
157
- allowLoadingFiles: boolean;
158
- highlight: string;
159
- explorerName: string;
160
- newTabOptions: any;
161
- customSuggestions: any[];
162
- onContextMenu: any;
163
- onCreateFile: any;
164
- onCreateStatusPanel: any;
165
- onCtrlSpace: any;
166
- onNewTab: any;
167
- onSave: any;
168
- onSelectTab: any;
169
- onReady: any;
170
- onRun: any;
171
- addExplorerItem: any;
172
- _blockCommentCache: any[];
173
- _buildingBlockComment: any;
174
- _buildingString: any;
175
- _currentOcurrences: any;
176
- _currentLineNumber: number | undefined;
177
- _currentLineString: string | undefined;
178
- _currentTokenPositions: any;
179
- _discardScroll: boolean;
180
- _displayObserver: any;
181
- _fullVerticalOffset: number;
182
- _isReady: boolean;
183
- _lastTime: any;
184
- _lastProcessedLine: number;
185
- _lastResult: any;
186
- _lastSelectionKeyDir: any;
187
- _lastProcessedCursorIndex: any;
188
- _lastMaxLineLength: number | undefined;
189
- _lastMouseDown: number;
190
- _lastTextFound: string;
191
- _lastBaseareaWidth: number | undefined;
192
- _markdownHeader: any;
193
- _mouseDown: boolean | undefined;
194
- _nextCursorPositionOffset: number | undefined;
195
- _pendingString: string | undefined;
196
- _preparedAt: number | undefined;
197
- _scopeStack: any;
198
- _scopesUpdated: boolean | undefined;
199
- _skipTabs: number | undefined;
200
- _stringEnded: boolean;
201
- _stringInterpolation: boolean | undefined;
202
- _stringInterpolationOpened: boolean | undefined;
203
- _tabStorage: Record<string, any>;
204
- _tripleClickSelection: any;
205
- _verticalBottomOffset: number;
206
- _verticalTopOffset: number;
207
- constructor(area: typeof Area, options?: any);
208
- _init(area: typeof Area, options?: any): Promise<void>;
209
- _setupDisplayObserver(): void;
210
- _setupEditorWhenVisible(): Promise<void>;
211
- clear(): void;
212
- static getInstances(): CodeEditor[];
213
- onKeyPressed(e: KeyboardEvent): void;
214
- getText(min?: boolean): any;
215
- setText(text?: string, langString?: string, detectLanguage?: boolean): void;
216
- appendText(text: string, cursor: Cursor): void;
217
- setCustomSuggestions(suggestions: string[]): void;
218
- loadFile(file: File, options?: any): Promise<void>;
219
- _addUndoStep(cursor: Cursor, force?: boolean, deleteRedo?: boolean): void;
220
- _doUndo(cursor: Cursor): void;
221
- _addRedoStep(cursor: Cursor): void;
222
- _doRedo(cursor: Cursor): void;
223
- _changeLanguage(langString: string, langExtension?: string, override?: boolean): void;
224
- _changeLanguageFromExtension(ext: string): void;
225
- _createStatusPanel(options?: any): any;
226
- _getFileIcon(name: string | null, extension?: string, langString?: string): any;
227
- _onNewTab(e: any): void;
228
- _onCreateNewFile(): void;
229
- _onSelectTab(isNewTabButton: boolean, event: any, name: string): void;
230
- _onContextMenuTab(isNewTabButton: boolean | undefined, event: any, name: string): void;
231
- addTab(name: string, selected: boolean, title?: string, options?: any): string;
232
- loadCode(name: string): void;
233
- loadTab(name: string): void;
234
- closeTab(name: string, eraseAll?: boolean): void;
235
- getSelectedTabName(): any;
236
- loadTabFromFile(): void;
237
- processFocus(active?: boolean): void;
238
- processMouse(e: MouseEvent): void;
239
- _onMouseUp(e: MouseEvent): void;
240
- processClick(e: MouseEvent): void;
241
- updateSelections(e: any, keepRange?: boolean, flags?: number): void;
242
- processSelections(e: any, keepRange?: boolean, flags?: number): void;
243
- _processSelection(cursor: Cursor, e?: any, keepRange?: boolean, flags?: number): void;
244
- processKey(e: KeyboardEvent): Promise<void>;
245
- processKeyAtTargetCursor(e: KeyboardEvent, key: string, targetIdx: number): Promise<void>;
246
- _processGlobalKeys(e: KeyboardEvent, key: string): boolean;
247
- _processKeyAtCursor(e: KeyboardEvent, key: string, cursor: Cursor): Promise<any>;
248
- _pasteContent(cursor: Cursor): Promise<void>;
249
- _copyContent(cursor: Cursor): Promise<void>;
250
- _cutContent(cursor: Cursor): Promise<void>;
251
- _duplicateLine(lidx: number, cursor: Cursor): void;
252
- _commentLines(cursor: Cursor, useCommentBlock?: boolean): void;
253
- _commentLine(cursor: Cursor, line: number, minNonspaceIdx?: number, updateCursor?: boolean): void;
254
- _uncommentLines(cursor: Cursor): void;
255
- _uncommentLine(cursor: Cursor, line: number): void;
256
- action(key: string, deleteSelection?: boolean, fn?: (l: number, cursor: Cursor, e: any) => void, eventSkipDeleteFn?: any): void;
257
- _actionMustDelete(cursor: Cursor, action: any, e: any): any;
258
- scanWordSuggestions(): void;
259
- toLocalLine(line: number): number;
260
- getMaxLineLength(): number;
261
- _processLinesIfNecessary(): void;
262
- processLines(mode?: number): void;
263
- processLine(lineNumber: number, force?: boolean, skipPropagation?: boolean): string | undefined;
264
- _getLineSignatureFromTokens(tokens: string[]): string;
265
- _updateBlockComments(section: any, lineNumber: number, tokens: string[]): void;
266
- _processExtraLineIfNecessary(lineNumber: number, tokens: string[], oldSymbols: any[], skipPropagation?: boolean): void;
267
- _updateLine(force: boolean | undefined, lineNumber: number, html: string, skipPropagation?: boolean, symbols?: any[], tokens?: any[]): string | undefined;
268
- /**
269
- * Parses a single line of code and extract declared symbols
270
- */
271
- _parseLineForSymbols(lineNumber: number, lineString: string, tokens: string[], pushedScope?: boolean): any[];
272
- /**
273
- * Updates the symbol table for a single line
274
- * - Removes old symbols from that line
275
- * - Inserts the new symbols
276
- */
277
- _updateLineSymbols(lineNumber: number, newSymbols: any[]): any;
278
- _lineHasComment(lineString: string): number | undefined;
279
- _getTokensFromLine(lineString: string, skipNonWords?: boolean): string[];
280
- _mergeNumericTokens(tokens: Token[]): Token[];
281
- _processTokens(tokens: string[], offset?: number): string[];
282
- _mustHightlightWord(token: string, wordCategory: any, lang?: any): boolean;
283
- _getTokenHighlighting(ctx: any, highlight: string): any;
284
- _evaluateToken(ctxData: any): any;
285
- _appendStringToken(token: string): boolean;
286
- _getCurrentString(): string | undefined;
287
- _enclosedByTokens(token: string, tokenIndex: number, tagStart: string, tagEnd: string): number[] | undefined;
288
- _inBlockCommentSection(lineNumber: number, tokenPosition?: number, tokenLength?: number): any;
289
- _isKeyword(ctxData: any): boolean;
290
- _isNumber(token: string): boolean;
291
- _encloseSelectedWordWithKey(key: string, lidx: number, cursor: Cursor): boolean;
292
- _detectLanguage(text: string): string | undefined;
293
- lineUp(cursor: Cursor, resetLeft?: boolean): boolean;
294
- lineDown(cursor: Cursor, resetLeft?: boolean): boolean;
295
- swapLines(lidx: number, offset: number, cursor: Cursor): void;
296
- restartBlink(): void;
297
- startSelection(cursor: Cursor): void;
298
- deleteSelection(cursor: Cursor): void;
299
- endSelection(cursor?: Cursor): void;
300
- selectAll(): void;
301
- cursorToRight(text: string, cursor: Cursor): void;
302
- cursorToLeft(text: string, cursor: Cursor): void;
303
- cursorToTop(cursor: Cursor, resetLeft?: boolean): void;
304
- cursorToBottom(cursor: Cursor, resetLeft?: boolean): void;
305
- cursorToString(cursor: Cursor, text: string, reverse?: boolean): void;
306
- cursorToPosition(cursor: Cursor, position: number, updateScroll?: boolean): void;
307
- cursorToLine(cursor: Cursor, line: number, resetLeft?: boolean): void;
308
- saveCursor(cursor: Cursor, state?: any): any;
309
- saveCursors(): any[];
310
- getCurrentCursor(removeOthers?: boolean): Cursor;
311
- relocateCursors(): void;
312
- mergeCursors(line: number): void;
313
- restoreCursor(cursor: Cursor, state: any): void;
314
- removeCursor(cursor: Cursor | undefined): void;
315
- resetCursorPos(flag: number, cursor?: Cursor, resetScroll?: boolean): void;
316
- _addCursor(line?: number, position?: number, force?: boolean, isMain?: boolean): Cursor | null;
317
- _removeSecondaryCursors(): void;
318
- _getLastCursor(): Cursor | undefined;
319
- _isLastCursor(cursor: Cursor): boolean;
320
- _logCursors(): void;
321
- _addSpaceTabs(cursor: Cursor, n: number): void;
322
- _addSpaces(cursor: Cursor, n: number): void;
323
- _removeSpaces(cursor: Cursor): void;
324
- updateScrollLeft(cursor: Cursor): true | undefined;
325
- getScrollLeft(): any;
326
- getScrollTop(): any;
327
- setScrollLeft(value: number): void;
328
- setScrollTop(value: number): void;
329
- resize(flag?: number, pMaxLength?: number, onResize?: any): void;
330
- resizeIfNecessary(cursor: Cursor, force?: boolean): void;
331
- resizeScrollBars(flag?: number): void;
332
- setScrollBarValue(type?: string, value?: number): void;
333
- updateHorizontalScrollFromScrollBar(value: number): void;
334
- updateVerticalScrollFromScrollBar(value: number): void;
335
- getCharAtPos(cursor: Cursor, offset?: number): any;
336
- getWordAtPos(cursor: Cursor, offset?: number): any[];
337
- _measureChar(char?: string, useFloating?: boolean, getBB?: boolean): number | number[];
338
- measureString(str: string): number;
339
- runScript(code: string): void;
340
- toJSONFormat(text: string): string | undefined;
341
- showAutoCompleteBox(key: string, cursor: Cursor): void;
342
- hideAutoCompleteBox(): boolean | undefined;
343
- autoCompleteWord(suggestion?: string): void;
344
- _getSelectedAutoComplete(): any[];
345
- _moveArrowSelectedAutoComplete(dir: string): void;
346
- showSearchBox(clear?: boolean): void;
347
- hideSearchBox(): boolean;
348
- search(text?: string | null, reverse?: boolean, callback?: any, skipAlert?: boolean, forceFocus?: boolean): void;
349
- showSearchLineBox(): void;
350
- hideSearchLineBox(): void;
351
- goToLine(line: any): void;
352
- selectNextOcurrence(cursor: Cursor): void;
353
- _updateDataInfoPanel(signal: string, value: any): void;
354
- _setActiveLine(n?: number): void;
355
- _hideActiveLine(): void;
356
- _setFontSize(size: number): void;
357
- _applyFontSizeOffset(offset?: number): void;
358
- _increaseFontSize(): void;
359
- _decreaseFontSize(): void;
360
- _clearTmpVariables(): void;
361
- _requestFileAsync(url: string, dataType?: string, nocache?: boolean): Promise<unknown>;
362
- }
363
- export {};
1
+ interface Token {
2
+ type: string;
3
+ value: string;
4
+ }
5
+ interface TokenRule {
6
+ match: RegExp;
7
+ type: string;
8
+ next?: string;
9
+ pop?: boolean | number;
10
+ }
11
+ interface LanguageDef {
12
+ name: string;
13
+ extensions: string[];
14
+ states: Record<string, TokenRule[]>;
15
+ lineComment?: string;
16
+ icon?: string | Record<string, string>;
17
+ reservedWords: string[];
18
+ }
19
+ interface TokenizerState {
20
+ stack: string[];
21
+ }
22
+ interface TokenizeResult {
23
+ tokens: Token[];
24
+ state: TokenizerState;
25
+ }
26
+ export declare class Tokenizer {
27
+ private static languages;
28
+ private static extensionMap;
29
+ static registerLanguage(def: LanguageDef): void;
30
+ static getLanguage(name: string): LanguageDef | undefined;
31
+ static getLanguageByExtension(ext: string): LanguageDef | undefined;
32
+ static getRegisteredLanguages(): string[];
33
+ static initialState(): TokenizerState;
34
+ /**
35
+ * Tokenize a single line given a language and the state from the previous line.
36
+ * Returns the tokens and the updated state for the next line.
37
+ */
38
+ static tokenizeLine(line: string, language: LanguageDef, state: TokenizerState): TokenizeResult;
39
+ /**
40
+ * Merge consecutive tokens with the same type into one.
41
+ */
42
+ private static _mergeTokens;
43
+ }
44
+ declare class CodeDocument {
45
+ private onChange;
46
+ private _lines;
47
+ get lineCount(): number;
48
+ constructor(onChange?: (doc: CodeDocument) => void);
49
+ getLine(n: number): string;
50
+ getText(separator?: string): string;
51
+ setText(text: string): void;
52
+ getCharAt(line: number, col: number): string | undefined;
53
+ /**
54
+ * Get the word at a given position. Returns [word, startCol, endCol].
55
+ */
56
+ getWordAt(line: number, col: number): [string, number, number];
57
+ /**
58
+ * Get the indentation level (number of leading spaces) of a line.
59
+ */
60
+ getIndent(line: number): number;
61
+ /**
62
+ * Find the next occurrence of 'text' starting after (line, col). Returns null if no match.
63
+ */
64
+ findNext(text: string, startLine: number, startCol: number): {
65
+ line: number;
66
+ col: number;
67
+ } | null;
68
+ /**
69
+ * Insert text at a position (handles newlines in the inserted text).
70
+ */
71
+ insert(line: number, col: number, text: string): EditOperation;
72
+ /**
73
+ * Delete `length` characters forward from a position (handles crossing line boundaries).
74
+ */
75
+ delete(line: number, col: number, length: number): EditOperation;
76
+ /**
77
+ * Insert a new line after 'afterLine'. If afterLine is -1, inserts at the beginning.
78
+ */
79
+ insertLine(afterLine: number, text?: string): EditOperation;
80
+ /**
81
+ * Remove an entire line and its trailing newline.
82
+ */
83
+ removeLine(line: number): EditOperation;
84
+ replaceLine(line: number, newText: string): EditOperation;
85
+ /**
86
+ * Apply an edit operation (used by undo/redo).
87
+ */
88
+ applyInverse(op: EditOperation): EditOperation;
89
+ }
90
+ interface EditOperation {
91
+ type: 'insert' | 'delete' | 'replaceLine';
92
+ line: number;
93
+ col: number;
94
+ text: string;
95
+ oldText?: string;
96
+ }
97
+ declare class UndoManager {
98
+ private _undoStack;
99
+ private _redoStack;
100
+ private _pendingOps;
101
+ private _pendingCursorsBefore;
102
+ private _pendingCursorsAfter;
103
+ private _lastPushTime;
104
+ private _groupThresholdMs;
105
+ private _maxSteps;
106
+ constructor(groupThresholdMs?: number, maxSteps?: number);
107
+ /**
108
+ * Record an edit operation. Consecutive operations within the time threshold
109
+ * are grouped into a single undo step.
110
+ */
111
+ record(op: EditOperation, cursors: CursorPosition[]): void;
112
+ /**
113
+ * Force-flush pending operations into a final undo step.
114
+ */
115
+ flush(cursorsAfter?: CursorPosition[]): void;
116
+ /**
117
+ * Undo the last step. Stores the operations to apply inversely, and returns the cursor state to restore.
118
+ */
119
+ undo(doc: CodeDocument, currentCursors?: CursorPosition[]): {
120
+ cursors: CursorPosition[];
121
+ } | null;
122
+ /**
123
+ * Redo the last undone step. Returns the cursor state to restore.
124
+ */
125
+ redo(doc: CodeDocument): {
126
+ cursors: CursorPosition[];
127
+ } | null;
128
+ canUndo(): boolean;
129
+ canRedo(): boolean;
130
+ clear(): void;
131
+ private _flush;
132
+ }
133
+ interface CursorPosition {
134
+ line: number;
135
+ col: number;
136
+ }
137
+ interface Selection {
138
+ anchor: CursorPosition;
139
+ head: CursorPosition;
140
+ }
141
+ declare class CursorSet {
142
+ cursors: Selection[];
143
+ constructor();
144
+ getPrimary(): Selection;
145
+ /**
146
+ * Set a single cursor position. Clears all secondary cursors and selections.
147
+ */
148
+ set(line: number, col: number): void;
149
+ moveLeft(doc: CodeDocument, selecting?: boolean): void;
150
+ moveRight(doc: CodeDocument, selecting?: boolean): void;
151
+ moveUp(doc: CodeDocument, selecting?: boolean): void;
152
+ moveDown(doc: CodeDocument, selecting?: boolean): void;
153
+ moveToLineStart(doc: CodeDocument, selecting?: boolean, noIndent?: boolean): void;
154
+ moveToLineEnd(doc: CodeDocument, selecting?: boolean): void;
155
+ moveWordLeft(doc: CodeDocument, selecting?: boolean): void;
156
+ moveWordRight(doc: CodeDocument, selecting?: boolean): void;
157
+ selectAll(doc: CodeDocument): void;
158
+ addCursor(line: number, col: number): void;
159
+ removeSecondaryCursors(): void;
160
+ /**
161
+ * Returns cursor indices sorted by head position, bottom-to-top (last in doc first)
162
+ * to ensure earlier cursors' positions stay valid.
163
+ */
164
+ sortedIndicesBottomUp(): number[];
165
+ /**
166
+ * After editing at (line, col), shift all other cursors on the same line
167
+ * that are at or after `afterCol` by `colDelta`. Also handles line shifts
168
+ * for multi-line inserts/deletes via `lineDelta`.
169
+ */
170
+ adjustOthers(skipIdx: number, line: number, afterCol: number, colDelta: number, lineDelta?: number): void;
171
+ hasSelection(index?: number): boolean;
172
+ getSelectedText(doc: CodeDocument, index?: number): string;
173
+ getCursorPositions(): CursorPosition[];
174
+ private _moveHead;
175
+ private _moveVertical;
176
+ /**
177
+ * Merge overlapping cursors/selections. Keeps the first one when duplicates exist.
178
+ */
179
+ private _merge;
180
+ }
181
+ interface Symbol {
182
+ name: string;
183
+ kind: string;
184
+ scope: string;
185
+ line: number;
186
+ col?: number;
187
+ }
188
+ interface ScopeInfo {
189
+ name: string;
190
+ type: string;
191
+ line: number;
192
+ }
193
+ /**
194
+ * Manages code symbols for autocomplete, navigation, and outlining.
195
+ * Incrementally updates as lines change.
196
+ */
197
+ declare class SymbolTable {
198
+ private _symbols;
199
+ private _lineSymbols;
200
+ private _scopeStack;
201
+ private _lineScopes;
202
+ get currentScope(): string;
203
+ get currentScopeType(): string;
204
+ getScopeAtLine(line: number): ScopeInfo[];
205
+ getSymbols(name: string): Symbol[];
206
+ getAllSymbolNames(): string[];
207
+ getAllSymbols(): Symbol[];
208
+ getLineSymbols(line: number): Symbol[];
209
+ /** Update scope stack for a line (call before parsing symbols) */
210
+ updateScopeForLine(line: number, lineText: string): void;
211
+ /** Name the most recent anonymous scope (called when detecting class/function) */
212
+ nameCurrentScope(name: string, type: string): void;
213
+ /** Remove symbols from a line (before reparsing) */
214
+ removeLineSymbols(line: number): void;
215
+ addSymbol(symbol: Symbol): void;
216
+ /** Reset scope stack (e.g. when document structure changes significantly) */
217
+ resetScopes(): void;
218
+ clear(): void;
219
+ }
220
+ declare const Area: any;
221
+ declare const Panel: any;
222
+ declare const Tabs: any;
223
+ declare const NodeTree: any;
224
+ interface CodeTab {
225
+ name: string;
226
+ dom: HTMLElement;
227
+ doc: CodeDocument;
228
+ cursorSet: CursorSet;
229
+ undoManager: UndoManager;
230
+ language: string;
231
+ title?: string;
232
+ path?: string;
233
+ }
234
+ declare class ScrollBar {
235
+ static SIZE: number;
236
+ root: HTMLElement;
237
+ thumb: HTMLElement;
238
+ private _vertical;
239
+ private _thumbPos;
240
+ private _thumbRatio;
241
+ private _lastMouse;
242
+ private _onDrag;
243
+ get visible(): boolean;
244
+ get isVertical(): boolean;
245
+ constructor(vertical: boolean, onDrag: (delta: number) => void);
246
+ setThumbRatio(ratio: number): void;
247
+ syncToScroll(scrollPos: number, scrollMax: number): void;
248
+ applyDragDelta(delta: number, scrollMax: number): number;
249
+ private _applyPosition;
250
+ private _onMouseDown;
251
+ }
252
+ /**
253
+ * @class CodeEditor
254
+ * The main editor class. Wires Document, Tokenizer, CursorSet, UndoManager
255
+ * together with the DOM.
256
+ */
257
+ export declare class CodeEditor {
258
+ static __instances: CodeEditor[];
259
+ language: LanguageDef;
260
+ symbolTable: SymbolTable;
261
+ area: typeof Area;
262
+ baseArea: typeof Area;
263
+ codeArea: typeof Area;
264
+ explorerArea: typeof Area;
265
+ tabs: typeof Tabs;
266
+ root: HTMLElement;
267
+ codeScroller: HTMLElement;
268
+ codeSizer: HTMLElement;
269
+ cursorsLayer: HTMLElement;
270
+ selectionsLayer: HTMLElement;
271
+ lineGutter: HTMLElement;
272
+ vScrollbar: ScrollBar;
273
+ hScrollbar: ScrollBar;
274
+ searchBox: HTMLElement | null;
275
+ searchLineBox: HTMLElement | null;
276
+ autocomplete: HTMLElement | null;
277
+ currentTab: CodeTab | null;
278
+ statusPanel: typeof Panel;
279
+ leftStatusPanel: typeof Panel;
280
+ rightStatusPanel: typeof Panel;
281
+ explorer: typeof NodeTree | null;
282
+ charWidth: number;
283
+ lineHeight: number;
284
+ fontSize: number;
285
+ xPadding: number;
286
+ private _cachedTabsHeight;
287
+ private _cachedStatusPanelHeight;
288
+ skipInfo: boolean;
289
+ disableEdition: boolean;
290
+ skipTabs: boolean;
291
+ useFileExplorer: boolean;
292
+ useAutoComplete: boolean;
293
+ allowAddScripts: boolean;
294
+ allowClosingTabs: boolean;
295
+ allowLoadingFiles: boolean;
296
+ tabSize: number;
297
+ highlight: string;
298
+ newTabOptions: any[] | null;
299
+ customSuggestions: any[];
300
+ explorerName: string;
301
+ onSave: (text: string, editor: CodeEditor) => void;
302
+ onRun: (text: string, editor: CodeEditor) => void;
303
+ onCtrlSpace: (text: string, editor: CodeEditor) => void;
304
+ onCreateStatusPanel: (panel: typeof Panel, editor: CodeEditor) => void;
305
+ onContextMenu: any;
306
+ onNewTab: (event: MouseEvent) => void;
307
+ onSelectTab: (name: string, editor: CodeEditor) => void;
308
+ onReady: ((editor: CodeEditor) => void) | undefined;
309
+ onCreateFile: ((editor: CodeEditor) => void) | undefined;
310
+ onCodeChange: ((doc: CodeDocument) => void) | undefined;
311
+ private _inputArea;
312
+ private _lineStates;
313
+ private _lineElements;
314
+ private _openedTabs;
315
+ private _loadedTabs;
316
+ private _storedTabs;
317
+ private _focused;
318
+ private _composing;
319
+ private _keyChain;
320
+ private _wasPaired;
321
+ private _lastAction;
322
+ private _blinkerInterval;
323
+ private _cursorVisible;
324
+ private _cursorBlinkRate;
325
+ private _clickCount;
326
+ private _lastClickTime;
327
+ private _lastClickLine;
328
+ private _isSearchBoxActive;
329
+ private _isSearchLineBoxActive;
330
+ private _searchMatchCase;
331
+ private _lastTextFound;
332
+ private _lastSearchPos;
333
+ private _discardScroll;
334
+ private _isReady;
335
+ private _lastMaxLineLength;
336
+ private _lastLineCount;
337
+ private _isAutoCompleteActive;
338
+ private _selectedAutocompleteIndex;
339
+ private _displayObservers;
340
+ private static readonly CODE_MIN_FONT_SIZE;
341
+ private static readonly CODE_MAX_FONT_SIZE;
342
+ private static readonly PAIR_KEYS;
343
+ get doc(): CodeDocument;
344
+ get undoManager(): UndoManager;
345
+ get cursorSet(): CursorSet;
346
+ get codeContainer(): HTMLElement;
347
+ static getInstances(): CodeEditor[];
348
+ constructor(area: typeof Area, options?: Record<string, any>);
349
+ private _init;
350
+ clear(): void;
351
+ addExplorerItem(item: any): void;
352
+ setText(text: string): void;
353
+ appendText(text: string): void;
354
+ getText(): string;
355
+ setLanguage(name: string, extension?: string): void;
356
+ focus(): void;
357
+ addTab(name: string, options?: Record<string, any>): CodeTab;
358
+ loadTab(name: string): void;
359
+ closeTab(name: string): void;
360
+ setCustomSuggestions(suggestions: string[]): void;
361
+ loadFile(file: File | string, options?: Record<string, any>): void;
362
+ loadFiles(files: string[], onComplete?: (editor: CodeEditor, results: any[], total: number) => void, async?: boolean): Promise<void>;
363
+ _setupEditorWhenVisible(): Promise<void>;
364
+ private _onSelectTab;
365
+ private _onNewTab;
366
+ private _onCreateNewFile;
367
+ private _onContextMenuTab;
368
+ private _measureChar;
369
+ private _createStatusPanel;
370
+ private _updateDataInfoPanel;
371
+ /**
372
+ * Tokenize a line and return its innerHTML with syntax highlighting spans.
373
+ */
374
+ private _tokenizeLine;
375
+ /**
376
+ * Update symbol table for a line.
377
+ */
378
+ private _updateSymbolsForLine;
379
+ /**
380
+ * Render all lines from scratch.
381
+ */
382
+ private _renderAllLines;
383
+ /**
384
+ * Gets the html for the line gutter.
385
+ */
386
+ private _getGutterHtml;
387
+ /**
388
+ * Create and append a <pre> element for a line.
389
+ */
390
+ private _appendLineElement;
391
+ /**
392
+ * Re-render a single line's content (after editing).
393
+ */
394
+ private _updateLine;
395
+ /**
396
+ * Rebuild line elements after structural changes (insert/delete lines).
397
+ */
398
+ private _rebuildLines;
399
+ private _statesEqual;
400
+ private _updateActiveLine;
401
+ private _renderCursors;
402
+ private _renderSelections;
403
+ private _setFocused;
404
+ private _startBlinker;
405
+ private _stopBlinker;
406
+ private _resetBlinker;
407
+ private _setCursorVisibility;
408
+ private _onKeyDown;
409
+ private _flushIfActionChanged;
410
+ private _flushAction;
411
+ private _doInsertChar;
412
+ private _getAffectedLines;
413
+ private _commentLines;
414
+ private _uncommentLines;
415
+ private _doFindNextOcurrence;
416
+ private _doOpenSearch;
417
+ private _doOpenLineSearch;
418
+ /**
419
+ * Returns true if visibility changed.
420
+ */
421
+ private _doHideSearch;
422
+ private _doSearch;
423
+ private _doGotoLine;
424
+ private _encloseSelection;
425
+ private _doBackspace;
426
+ private _doDelete;
427
+ private _doEnter;
428
+ private _doTab;
429
+ private _deleteSelectionIfAny;
430
+ private _doCopy;
431
+ private _doCut;
432
+ private _swapLine;
433
+ private _duplicateLine;
434
+ private _doPaste;
435
+ private _doUndo;
436
+ private _doRedo;
437
+ private _onMouseDown;
438
+ private _onContextMenu;
439
+ /**
440
+ * Get word at cursor position for autocomplete.
441
+ */
442
+ private _getWordAtCursor;
443
+ /**
444
+ * Open autocomplete box with suggestions from symbols and custom suggestions.
445
+ */
446
+ private _doOpenAutocomplete;
447
+ private _doHideAutocomplete;
448
+ /**
449
+ * Insert the selected autocomplete word at cursor.
450
+ */
451
+ private _doAutocompleteWord;
452
+ private _getSelectedAutoCompleteWord;
453
+ private _afterCursorMove;
454
+ private _scrollCursorIntoView;
455
+ private _resetGutter;
456
+ getMaxLineLength(): number;
457
+ resize(force?: boolean): void;
458
+ private _resizeScrollBars;
459
+ private _syncScrollBars;
460
+ private _doLoadFromFile;
461
+ private _setFontSize;
462
+ private _applyFontSizeOffset;
463
+ private _increaseFontSize;
464
+ private _decreaseFontSize;
465
+ }
466
+ export {};