@adecore/editor 0.0.1 → 0.17.0-beta.2
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/LICENSE +110 -0
- package/README.md +57 -0
- package/dist/attribution.d.ts +28 -0
- package/dist/attribution.js +55 -0
- package/dist/code-block.d.ts +2 -0
- package/dist/code-block.js +89 -0
- package/dist/column-selection.d.ts +9 -0
- package/dist/column-selection.js +52 -0
- package/dist/controller.d.ts +64 -0
- package/dist/controller.js +772 -0
- package/dist/editor.css +813 -0
- package/dist/engine.d.ts +2 -0
- package/dist/engine.js +610 -0
- package/dist/fake.d.ts +192 -0
- package/dist/fake.js +663 -0
- package/dist/find.d.ts +30 -0
- package/dist/find.js +108 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/input.d.ts +9 -0
- package/dist/input.js +57 -0
- package/dist/keymap-table.d.ts +102 -0
- package/dist/keymap-table.js +130 -0
- package/dist/keymap.d.ts +36 -0
- package/dist/keymap.js +163 -0
- package/dist/layout.d.ts +167 -0
- package/dist/layout.js +583 -0
- package/dist/lens.d.ts +3 -0
- package/dist/lens.js +29 -0
- package/dist/listeners.d.ts +3 -0
- package/dist/listeners.js +12 -0
- package/dist/metrics.d.ts +8 -0
- package/dist/metrics.js +54 -0
- package/dist/modifier-gesture.d.ts +24 -0
- package/dist/modifier-gesture.js +98 -0
- package/dist/native-input.d.ts +26 -0
- package/dist/native-input.js +147 -0
- package/dist/offsets.d.ts +2 -0
- package/dist/offsets.js +14 -0
- package/dist/outline.d.ts +55 -0
- package/dist/outline.js +181 -0
- package/dist/overview.d.ts +17 -0
- package/dist/overview.js +55 -0
- package/dist/paint.d.ts +86 -0
- package/dist/paint.js +481 -0
- package/dist/php-html.d.ts +9 -0
- package/dist/php-html.js +36 -0
- package/dist/pointer.d.ts +49 -0
- package/dist/pointer.js +243 -0
- package/dist/scroll-animation.d.ts +3 -0
- package/dist/scroll-animation.js +45 -0
- package/dist/scroll.d.ts +28 -0
- package/dist/scroll.js +76 -0
- package/dist/semantic.d.ts +8 -0
- package/dist/semantic.js +47 -0
- package/dist/shiki.d.ts +7 -0
- package/dist/shiki.js +106 -0
- package/dist/smart-keys.d.ts +3 -0
- package/dist/smart-keys.js +14 -0
- package/dist/testing.d.ts +34 -0
- package/dist/testing.js +117 -0
- package/dist/theme-scopes.d.ts +9 -0
- package/dist/theme-scopes.js +61 -0
- package/dist/tokens.d.ts +28 -0
- package/dist/tokens.js +152 -0
- package/dist/tracked-range.d.ts +5 -0
- package/dist/tracked-range.js +20 -0
- package/dist/types.d.ts +344 -0
- package/dist/types.js +1 -0
- package/dist/view.d.ts +383 -0
- package/dist/view.js +2134 -0
- package/package.json +63 -3
- package/src/attribution.ts +85 -0
- package/src/code-block.ts +100 -0
- package/src/column-selection.ts +63 -0
- package/src/controller.ts +838 -0
- package/src/editor.css +813 -0
- package/src/engine.ts +764 -0
- package/src/fake.ts +838 -0
- package/src/find.ts +128 -0
- package/src/index.ts +69 -0
- package/src/input.ts +63 -0
- package/src/keymap-table.ts +163 -0
- package/src/keymap.ts +204 -0
- package/src/layout.ts +754 -0
- package/src/lens.ts +32 -0
- package/src/listeners.ts +15 -0
- package/src/metrics.ts +65 -0
- package/src/modifier-gesture.ts +115 -0
- package/src/native-input.ts +179 -0
- package/src/offsets.ts +16 -0
- package/src/outline.ts +248 -0
- package/src/overview.ts +80 -0
- package/src/paint.ts +608 -0
- package/src/php-html.ts +43 -0
- package/src/pointer.ts +326 -0
- package/src/scroll-animation.ts +48 -0
- package/src/scroll.ts +102 -0
- package/src/semantic.ts +54 -0
- package/src/shiki.ts +118 -0
- package/src/smart-keys.ts +17 -0
- package/src/testing.ts +157 -0
- package/src/theme-scopes.ts +75 -0
- package/src/tokens.ts +175 -0
- package/src/tracked-range.ts +22 -0
- package/src/types.ts +659 -0
- package/src/view.ts +2437 -0
package/dist/fake.d.ts
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { Editor, EditorAttributionHover, EditorAttributionMark, EditorBlock, EditorCodeBlockOptions, EditorLineAction, EditorLineHighlight, EditorChangeMark, EditorCodeVision, EditorClick, EditorClickHandler, EditorContextMenu, EditorContentChange, EditorEngine, EditorFindQuery, EditorFindState, EditorReplaceOptions, EditorGutterAction, EditorGutterMarker, EditorHighlight, EditorHover, EditorIndentation, EditorGhostText, EditorInlayHint, EditorKeyHandler, EditorMarker, EditorOptions, EditorPosition, EditorRemoteCursor, EditorRange, EditorReveal, EditorRect, EditorRunCommand, EditorSelectionRanges, EditorFoldHints, EditorFoldOutline, EditorFolds, EditorSemanticToken, EditorSmartKeys, EditorTextChange, EditorTrackedRange, EditorTheme, EditorWidget } from './types.ts';
|
|
2
|
+
import { type Listener } from './listeners.ts';
|
|
3
|
+
export declare class FakeEditor implements Editor {
|
|
4
|
+
readonly element: HTMLElement;
|
|
5
|
+
readonly language: string | undefined;
|
|
6
|
+
readonly path: string | undefined;
|
|
7
|
+
readonly column: number | null;
|
|
8
|
+
readonly scrollTop: number | null;
|
|
9
|
+
wrap: boolean;
|
|
10
|
+
theme: EditorTheme;
|
|
11
|
+
readOnly: boolean;
|
|
12
|
+
readOnlyReason: string | undefined;
|
|
13
|
+
revealedLine: number | null;
|
|
14
|
+
focused: boolean;
|
|
15
|
+
indentation: EditorIndentation;
|
|
16
|
+
fontRefreshes: number;
|
|
17
|
+
disposed: boolean;
|
|
18
|
+
findQuery: EditorFindQuery | null;
|
|
19
|
+
findState: EditorFindState;
|
|
20
|
+
private text;
|
|
21
|
+
private readonly changes;
|
|
22
|
+
private readonly textChanges;
|
|
23
|
+
private readonly saves;
|
|
24
|
+
private readonly blurs;
|
|
25
|
+
private readonly finds;
|
|
26
|
+
constructor(element: HTMLElement, options: EditorOptions);
|
|
27
|
+
type(text: string): void;
|
|
28
|
+
save(): void;
|
|
29
|
+
blur(): void;
|
|
30
|
+
getText(): string;
|
|
31
|
+
setText(text: string): void;
|
|
32
|
+
private replaceText;
|
|
33
|
+
private readonly tracked;
|
|
34
|
+
private followTracked;
|
|
35
|
+
trackRange(range: EditorRange): EditorTrackedRange;
|
|
36
|
+
onTextChange(listener: (change: EditorTextChange) => void): () => void;
|
|
37
|
+
positionAt(offset: number): EditorPosition;
|
|
38
|
+
textInRange(range: EditorRange): string;
|
|
39
|
+
offsetAt(position: EditorPosition): number;
|
|
40
|
+
onChange(listener: Listener): () => void;
|
|
41
|
+
onSave(listener: Listener): () => void;
|
|
42
|
+
onBlur(listener: Listener): () => void;
|
|
43
|
+
lastReveal: EditorReveal | null;
|
|
44
|
+
revealLine(line: number, reveal?: EditorReveal): void;
|
|
45
|
+
find(query: EditorFindQuery | null): void;
|
|
46
|
+
replacements: string[];
|
|
47
|
+
replaceOptions: EditorReplaceOptions[];
|
|
48
|
+
replacePreview: string | null;
|
|
49
|
+
selectedMatches: number;
|
|
50
|
+
lastFindFromCursor: {
|
|
51
|
+
query: EditorFindQuery;
|
|
52
|
+
direction: 1 | -1;
|
|
53
|
+
} | null;
|
|
54
|
+
replacementsOfAll: string[];
|
|
55
|
+
replace(replacement: string, options?: EditorReplaceOptions): boolean;
|
|
56
|
+
replaceAll(replacement: string, options?: EditorReplaceOptions): number;
|
|
57
|
+
setReplacePreview(replacement: string | null): void;
|
|
58
|
+
selectFindMatches(): number;
|
|
59
|
+
findFromCursor(query: EditorFindQuery, direction: 1 | -1): boolean;
|
|
60
|
+
findStep(direction: 1 | -1): void;
|
|
61
|
+
onFind(listener: (state: EditorFindState) => void): () => void;
|
|
62
|
+
endFind(): void;
|
|
63
|
+
setWrap(wrap: boolean): void;
|
|
64
|
+
blocks: readonly EditorBlock[] | null;
|
|
65
|
+
private readonly scopes;
|
|
66
|
+
changeMarks: readonly EditorChangeMark[];
|
|
67
|
+
setChangeMarks(marks: readonly EditorChangeMark[]): void;
|
|
68
|
+
lineHighlights: readonly EditorLineHighlight[];
|
|
69
|
+
setLineHighlights(highlights: readonly EditorLineHighlight[]): void;
|
|
70
|
+
codeBlocks: {
|
|
71
|
+
container: HTMLElement;
|
|
72
|
+
text: string;
|
|
73
|
+
options: EditorCodeBlockOptions;
|
|
74
|
+
}[];
|
|
75
|
+
renderCode(container: HTMLElement, text: string, options?: EditorCodeBlockOptions): void;
|
|
76
|
+
remoteCursors: readonly EditorRemoteCursor[];
|
|
77
|
+
setRemoteCursors(cursors: readonly EditorRemoteCursor[]): void;
|
|
78
|
+
attributionMarks: readonly EditorAttributionMark[];
|
|
79
|
+
private readonly attributionHovers;
|
|
80
|
+
setAttributionMarks(marks: readonly EditorAttributionMark[]): void;
|
|
81
|
+
onAttributionHover(listener: (hover: EditorAttributionHover | null) => void): () => void;
|
|
82
|
+
hoverAttribution(id: string | null, rect?: EditorRect): void;
|
|
83
|
+
readonly widgetsByOwner: Map<string, readonly EditorWidget[]>;
|
|
84
|
+
get widgets(): readonly EditorWidget[];
|
|
85
|
+
private readonly drawnWidgets;
|
|
86
|
+
setWidgets(widgets: readonly EditorWidget[], owner?: string): void;
|
|
87
|
+
readonly lineActionsByOwner: Map<string, readonly EditorLineAction[]>;
|
|
88
|
+
setLineActions(actions: readonly EditorLineAction[], owner?: string): void;
|
|
89
|
+
codeVision: readonly EditorCodeVision[];
|
|
90
|
+
setCodeVision(rows: readonly EditorCodeVision[]): void;
|
|
91
|
+
gutterAction: EditorGutterAction | null;
|
|
92
|
+
private readonly gutterActionListeners;
|
|
93
|
+
setGutterAction(action: EditorGutterAction | null): void;
|
|
94
|
+
onGutterAction(listener: (line: number) => void): () => void;
|
|
95
|
+
readonly gutterMarkersByOwner: Map<string, readonly EditorGutterMarker[]>;
|
|
96
|
+
private readonly gutterMarkerListeners;
|
|
97
|
+
setGutterMarkers(markers: readonly EditorGutterMarker[], owner?: string): void;
|
|
98
|
+
onGutterMarker(listener: (id: string) => void): () => void;
|
|
99
|
+
pressGutterMarker(id: string): void;
|
|
100
|
+
pressGutterAction(): void;
|
|
101
|
+
setBlocks(blocks: readonly EditorBlock[] | null): void;
|
|
102
|
+
onScope(listener: (scope: readonly EditorBlock[]) => void): () => void;
|
|
103
|
+
enterScope(scope: readonly EditorBlock[]): void;
|
|
104
|
+
smartKeys: Partial<EditorSmartKeys>;
|
|
105
|
+
guides: boolean;
|
|
106
|
+
whitespace: boolean;
|
|
107
|
+
rightMargin: number | null;
|
|
108
|
+
setGuides(guides: boolean): void;
|
|
109
|
+
setWhitespace(whitespace: boolean): void;
|
|
110
|
+
setRightMargin(column: number | null): void;
|
|
111
|
+
foldOutline: EditorFoldOutline;
|
|
112
|
+
foldHints: EditorFoldHints | null;
|
|
113
|
+
setFoldOutline(outline: EditorFoldOutline): void;
|
|
114
|
+
label: string;
|
|
115
|
+
setLabel(label: string): void;
|
|
116
|
+
setFoldHints(hints: EditorFoldHints | null): void;
|
|
117
|
+
setSmartKeys(keys: Partial<EditorSmartKeys>): void;
|
|
118
|
+
setIndentation(indentation: EditorIndentation): void;
|
|
119
|
+
markers: readonly EditorMarker[];
|
|
120
|
+
highlights: readonly EditorHighlight[];
|
|
121
|
+
caret: EditorPosition;
|
|
122
|
+
origin: {
|
|
123
|
+
left: number;
|
|
124
|
+
top: number;
|
|
125
|
+
};
|
|
126
|
+
charSize: {
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
};
|
|
130
|
+
private readonly carets;
|
|
131
|
+
private readonly hovers;
|
|
132
|
+
private readonly views;
|
|
133
|
+
private readonly keys;
|
|
134
|
+
setMarkers(markers: readonly EditorMarker[]): void;
|
|
135
|
+
inlayHints: readonly EditorInlayHint[];
|
|
136
|
+
setInlayHints(hints: readonly EditorInlayHint[]): void;
|
|
137
|
+
ghost: EditorGhostText | null;
|
|
138
|
+
setGhostText(ghost: EditorGhostText | null): void;
|
|
139
|
+
semanticTokens: readonly EditorSemanticToken[] | null;
|
|
140
|
+
setSemanticTokens(tokens: readonly EditorSemanticToken[] | null): void;
|
|
141
|
+
link: EditorRange | null;
|
|
142
|
+
setLink(range: EditorRange | null): void;
|
|
143
|
+
setHighlights(highlights: readonly EditorHighlight[]): void;
|
|
144
|
+
getCaret(): EditorPosition;
|
|
145
|
+
folds: EditorFolds;
|
|
146
|
+
getFolds(): EditorFolds;
|
|
147
|
+
getScrollTop(): number;
|
|
148
|
+
selection: EditorRange | null;
|
|
149
|
+
getSelection(): EditorRange;
|
|
150
|
+
private otherSelections;
|
|
151
|
+
get otherCarets(): EditorPosition[];
|
|
152
|
+
set otherCarets(positions: EditorPosition[]);
|
|
153
|
+
getSelections(): EditorRange[];
|
|
154
|
+
setSelections(ranges: readonly EditorRange[], reveal?: EditorReveal): void;
|
|
155
|
+
getIndentation(): EditorIndentation;
|
|
156
|
+
setCaret(position: EditorPosition, reveal?: EditorReveal): void;
|
|
157
|
+
setSelection(range: EditorRange, reveal?: EditorReveal): void;
|
|
158
|
+
moveCaret(position: EditorPosition): void;
|
|
159
|
+
onCaret(listener: (position: EditorPosition) => void): () => void;
|
|
160
|
+
onHover(listener: (hover: EditorHover | null) => void): () => void;
|
|
161
|
+
hover(position: EditorPosition | null): void;
|
|
162
|
+
rectAt(position: EditorPosition): EditorRect | null;
|
|
163
|
+
onViewChange(listener: Listener): () => void;
|
|
164
|
+
visibleRange: EditorRange | null;
|
|
165
|
+
getVisibleRange(): EditorRange;
|
|
166
|
+
scroll(range?: EditorRange): void;
|
|
167
|
+
selectionRanges: EditorSelectionRanges | null;
|
|
168
|
+
setSelectionRanges(provider: EditorSelectionRanges | null): void;
|
|
169
|
+
onKeyDown(handler: EditorKeyHandler): () => void;
|
|
170
|
+
private readonly clickHandlers;
|
|
171
|
+
private readonly contextListeners;
|
|
172
|
+
onClick(handler: EditorClickHandler): () => void;
|
|
173
|
+
onContextMenu(listener: (menu: EditorContextMenu) => void): () => void;
|
|
174
|
+
click(click: EditorClick): boolean;
|
|
175
|
+
openContextMenu(menu: EditorContextMenu): void;
|
|
176
|
+
press(event: Pick<KeyboardEvent, 'key'> & Partial<KeyboardEvent>): boolean;
|
|
177
|
+
applyEdits(edits: readonly EditorContentChange[]): boolean;
|
|
178
|
+
setTheme(theme: EditorTheme): void;
|
|
179
|
+
refreshFont(): void;
|
|
180
|
+
setReadOnly(readOnly: boolean, reason?: string): void;
|
|
181
|
+
readonly commands: EditorRunCommand[];
|
|
182
|
+
runCommand(command: EditorRunCommand): boolean;
|
|
183
|
+
focus(): void;
|
|
184
|
+
dispose(): void;
|
|
185
|
+
private announceFind;
|
|
186
|
+
private assertLive;
|
|
187
|
+
}
|
|
188
|
+
export declare class FakeEditorEngine implements EditorEngine {
|
|
189
|
+
readonly editors: FakeEditor[];
|
|
190
|
+
mount(element: HTMLElement, options: EditorOptions): FakeEditor;
|
|
191
|
+
get last(): FakeEditor;
|
|
192
|
+
}
|