@lvce-editor/rpc-registry 2.36.0 → 2.37.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/dist/index.d.ts +25 -4
- package/dist/index.js +59 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,17 @@ export interface DebugWorkerApi {
|
|
|
19
19
|
readonly "Debug.resume": () => Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
declare const invoke$2: <T extends keyof DebugWorkerApi>(method: T, ...params: Parameters<DebugWorkerApi[T]>) => ReturnType<DebugWorkerApi[T]>, invokeAndTransfer$2: <T extends keyof DebugWorkerApi>(method: T, ...params: Parameters<DebugWorkerApi[T]>) => ReturnType<DebugWorkerApi[T]>, set$2: (rpc: import("@lvce-editor/rpc").Rpc) => void, dispose$2: () => Promise<void>;
|
|
22
|
+
export interface Range {
|
|
23
|
+
readonly rowIndex: number;
|
|
24
|
+
readonly columnIndex: number;
|
|
25
|
+
}
|
|
26
|
+
export interface Change {
|
|
27
|
+
readonly start: Range;
|
|
28
|
+
readonly end: Range;
|
|
29
|
+
readonly inserted: readonly string[];
|
|
30
|
+
readonly deleted: readonly string[];
|
|
31
|
+
readonly origin: string;
|
|
32
|
+
}
|
|
22
33
|
export interface PositionAtCursor {
|
|
23
34
|
readonly x: number;
|
|
24
35
|
readonly y: number;
|
|
@@ -35,6 +46,16 @@ export interface EditorWorkerApi {
|
|
|
35
46
|
readonly "Editor.updateDebugInfo": (key: string) => Promise<void>;
|
|
36
47
|
}
|
|
37
48
|
declare const invoke$3: <T extends keyof EditorWorkerApi>(method: T, ...params: Parameters<EditorWorkerApi[T]>) => ReturnType<EditorWorkerApi[T]>, invokeAndTransfer$3: <T extends keyof EditorWorkerApi>(method: T, ...params: Parameters<EditorWorkerApi[T]>) => ReturnType<EditorWorkerApi[T]>, set$3: (rpc: import("@lvce-editor/rpc").Rpc) => void, dispose$3: () => Promise<void>;
|
|
49
|
+
declare const sendMessagePortToExtensionHostWorker: (port: MessagePort) => Promise<void>;
|
|
50
|
+
declare const activateByEvent: (event: string) => Promise<void>;
|
|
51
|
+
declare const applyEdit: (editorUid: number, changes: readonly Change[]) => Promise<void>;
|
|
52
|
+
declare const closeWidget: (editorUid: number, widgetId: number, widgetName: string, focusId: number) => Promise<void>;
|
|
53
|
+
declare const getWordAt: (uid: number, rowIndex: number, columnIndex: number) => Promise<string>;
|
|
54
|
+
declare const getLines: (editorUid: number) => Promise<readonly string[]>;
|
|
55
|
+
declare const getPositionAtCursor: (parentUid: number) => Promise<PositionAtCursor>;
|
|
56
|
+
declare const getSelections: (editorUid: number) => Promise<readonly number[]>;
|
|
57
|
+
declare const getWordAtOffset2: (editorUid: number) => Promise<string>;
|
|
58
|
+
declare const getWordBefore: (editorUid: number, rowIndex: number, columnIndex: number) => Promise<string>;
|
|
38
59
|
export interface EmbedsProcessApi {
|
|
39
60
|
readonly "ElectronWebContents.dispose": (id: any) => Promise<void>;
|
|
40
61
|
readonly "ElectronWebContentsView.attachEventListeners": (webContentsId: any) => Promise<void>;
|
|
@@ -450,11 +471,11 @@ declare const readFile: (uri: string) => Promise<string>;
|
|
|
450
471
|
declare const setFocus: (key: number) => Promise<void>;
|
|
451
472
|
declare const getFileIcon: (options: any) => Promise<string>;
|
|
452
473
|
declare const getFolderIcon: (options: any) => Promise<string>;
|
|
453
|
-
declare const sendMessagePortToExtensionHostWorker: (port: MessagePort) => Promise<void>;
|
|
474
|
+
declare const sendMessagePortToExtensionHostWorker$1: (port: MessagePort) => Promise<void>;
|
|
454
475
|
declare const sendMessagePortToSearchProcess: (port: MessagePort) => Promise<void>;
|
|
455
476
|
declare const confirm: (message: string) => Promise<boolean>;
|
|
456
477
|
declare const getIcons: (requests: readonly any[]) => Promise<readonly string[]>;
|
|
457
|
-
declare const activateByEvent: (event: string) => Promise<void>;
|
|
478
|
+
declare const activateByEvent$1: (event: string) => Promise<void>;
|
|
458
479
|
declare const sendMessagePortToRendererProcess: (port: MessagePort) => Promise<void>;
|
|
459
480
|
declare const getPreference: (key: string) => Promise<any>;
|
|
460
481
|
declare const DebugWorker = 55;
|
|
@@ -530,7 +551,7 @@ declare namespace DebugWorker$1 {
|
|
|
530
551
|
export { dispose$2 as dispose, invoke$2 as invoke, invokeAndTransfer$2 as invokeAndTransfer, set$2 as set };
|
|
531
552
|
}
|
|
532
553
|
declare namespace EditorWorker$1 {
|
|
533
|
-
export { dispose$3 as dispose, invoke$3 as invoke, invokeAndTransfer$3 as invokeAndTransfer, set$3 as set };
|
|
554
|
+
export { activateByEvent, applyEdit, closeWidget, dispose$3 as dispose, getLines, getPositionAtCursor, getSelections, getWordAt, getWordAtOffset2, getWordBefore, invoke$3 as invoke, invokeAndTransfer$3 as invokeAndTransfer, sendMessagePortToExtensionHostWorker, set$3 as set };
|
|
534
555
|
}
|
|
535
556
|
declare namespace EmbedsProcess$1 {
|
|
536
557
|
export { dispose$4 as dispose, invoke$4 as invoke, invokeAndTransfer$4 as invokeAndTransfer, set$4 as set };
|
|
@@ -560,7 +581,7 @@ declare namespace RendererProcess$1 {
|
|
|
560
581
|
export { dispose$11 as dispose, invoke$11 as invoke, invokeAndTransfer$11 as invokeAndTransfer, readClipBoard, readClipBoardText, set$11 as set, writeClipBoard };
|
|
561
582
|
}
|
|
562
583
|
declare namespace RendererWorker$1 {
|
|
563
|
-
export { activateByEvent, confirm, dispose$12 as dispose, getFileHandles, getFileIcon, getFilePathElectron, getFolderIcon, getIcons, getPreference, invoke$12 as invoke, invokeAndTransfer$12 as invokeAndTransfer, readFile, sendMessagePortToEditorWorker, sendMessagePortToExtensionHostWorker, sendMessagePortToRendererProcess, sendMessagePortToSearchProcess, set$12 as set, setFocus };
|
|
584
|
+
export { activateByEvent$1 as activateByEvent, confirm, dispose$12 as dispose, getFileHandles, getFileIcon, getFilePathElectron, getFolderIcon, getIcons, getPreference, invoke$12 as invoke, invokeAndTransfer$12 as invokeAndTransfer, readFile, sendMessagePortToEditorWorker, sendMessagePortToExtensionHostWorker$1 as sendMessagePortToExtensionHostWorker, sendMessagePortToRendererProcess, sendMessagePortToSearchProcess, set$12 as set, setFocus };
|
|
564
585
|
}
|
|
565
586
|
declare namespace RpcId {
|
|
566
587
|
export { ClipBoardProcess, ClipBoardWorker, ColorPickerWorker, CompletionWorker, DebugWorker, EditorWorker, EmbedsProcess, EmbedsWorker, ErrorWorker, ExtensionHostWorker, FileSystemProcess, FileSystemWorker, MainProcess, MarkdownWorker, RendererProcess, RendererWorker, SearchProcess, SearchProcessElectron, SharedProcess, SourceActionWorker, SourceControlWorker, SyntaxHighlightingWorker };
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ const create = rpcId => {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
const DebugWorker$1 = 55;
|
|
39
|
-
const EditorWorker$
|
|
39
|
+
const EditorWorker$2 = 99;
|
|
40
40
|
const ExtensionHostWorker = 44;
|
|
41
41
|
const MainProcess$1 = -5;
|
|
42
42
|
const RendererWorker$1 = 1;
|
|
@@ -65,7 +65,7 @@ const RpcId = {
|
|
|
65
65
|
ColorPickerWorker,
|
|
66
66
|
CompletionWorker,
|
|
67
67
|
DebugWorker: DebugWorker$1,
|
|
68
|
-
EditorWorker: EditorWorker$
|
|
68
|
+
EditorWorker: EditorWorker$2,
|
|
69
69
|
EmbedsProcess: EmbedsProcess$1,
|
|
70
70
|
EmbedsWorker,
|
|
71
71
|
ErrorWorker: ErrorWorker$1,
|
|
@@ -134,13 +134,67 @@ const {
|
|
|
134
134
|
invokeAndTransfer: invokeAndTransfer$c,
|
|
135
135
|
set: set$c,
|
|
136
136
|
dispose: dispose$c
|
|
137
|
-
} = create(EditorWorker$
|
|
137
|
+
} = create(EditorWorker$2);
|
|
138
|
+
const sendMessagePortToExtensionHostWorker$1 = async port => {
|
|
139
|
+
const command = 'HandleMessagePort.handleMessagePort2';
|
|
140
|
+
await invokeAndTransfer$c(
|
|
141
|
+
// @ts-ignore
|
|
142
|
+
'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, 0 // TODO
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
// TODO add tests for this
|
|
147
|
+
const activateByEvent$1 = async event => {
|
|
148
|
+
// @ts-ignore
|
|
149
|
+
await invoke$d('ActivateByEvent.activateByEvent', event);
|
|
150
|
+
};
|
|
151
|
+
const applyEdit = async (editorUid, changes) => {
|
|
152
|
+
// @ts-ignore
|
|
153
|
+
await EditorWorker.invoke('Editor.applyEdit2', editorUid, changes);
|
|
154
|
+
};
|
|
155
|
+
const closeWidget = async (editorUid, widgetId, widgetName, focusId) => {
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
await invoke$d('Editor.closeWidget2', editorUid, widgetId, widgetName, focusId);
|
|
158
|
+
};
|
|
159
|
+
const getWordAt = async (uid, rowIndex, columnIndex) => {
|
|
160
|
+
// @ts-ignore
|
|
161
|
+
const word = await invoke$d('Editor.getWordAt2', uid, rowIndex, columnIndex);
|
|
162
|
+
return word;
|
|
163
|
+
};
|
|
164
|
+
const getLines = async editorUid => {
|
|
165
|
+
const lines = await invoke$d('Editor.getLines2', editorUid);
|
|
166
|
+
return lines;
|
|
167
|
+
};
|
|
168
|
+
const getPositionAtCursor = async parentUid => {
|
|
169
|
+
const position = await invoke$d('Editor.getPositionAtCursor', parentUid);
|
|
170
|
+
return position;
|
|
171
|
+
};
|
|
172
|
+
const getSelections = async editorUid => {
|
|
173
|
+
const selections = await invoke$d('Editor.getSelections2', editorUid);
|
|
174
|
+
return selections;
|
|
175
|
+
};
|
|
176
|
+
const getWordAtOffset2 = async editorUid => {
|
|
177
|
+
return invoke$d('Editor.getWordAtOffset2', editorUid);
|
|
178
|
+
};
|
|
179
|
+
const getWordBefore = async (editorUid, rowIndex, columnIndex) => {
|
|
180
|
+
return invoke$d('Editor.getWordBefore2', editorUid, rowIndex, columnIndex);
|
|
181
|
+
};
|
|
138
182
|
|
|
139
|
-
const EditorWorker = {
|
|
183
|
+
const EditorWorker$1 = {
|
|
140
184
|
__proto__: null,
|
|
185
|
+
activateByEvent: activateByEvent$1,
|
|
186
|
+
applyEdit,
|
|
187
|
+
closeWidget,
|
|
141
188
|
dispose: dispose$c,
|
|
189
|
+
getLines,
|
|
190
|
+
getPositionAtCursor,
|
|
191
|
+
getSelections,
|
|
192
|
+
getWordAt,
|
|
193
|
+
getWordAtOffset2,
|
|
194
|
+
getWordBefore,
|
|
142
195
|
invoke: invoke$d,
|
|
143
196
|
invokeAndTransfer: invokeAndTransfer$c,
|
|
197
|
+
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1,
|
|
144
198
|
set: set$c
|
|
145
199
|
};
|
|
146
200
|
|
|
@@ -508,4 +562,4 @@ const getIpcType = argv => {
|
|
|
508
562
|
throw new Error(`[file-system-process] unknown ipc type`);
|
|
509
563
|
};
|
|
510
564
|
|
|
511
|
-
export { ClipBoardProcess, ClipBoardWorker, DebugWorker, EditorWorker, EmbedsProcess, ErrorWorker, ExtensionHost, FileSystemProcess, FileSystemWorker, IpcType, MainProcess, MarkdownWorker, RendererProcess, RendererWorker, RpcId, SearchProcess, SharedProcess, SyntaxHighlightingWorker, createLazyRpc, get, getIpcType, remove$1 as remove, set$g as set };
|
|
565
|
+
export { ClipBoardProcess, ClipBoardWorker, DebugWorker, EditorWorker$1 as EditorWorker, EmbedsProcess, ErrorWorker, ExtensionHost, FileSystemProcess, FileSystemWorker, IpcType, MainProcess, MarkdownWorker, RendererProcess, RendererWorker, RpcId, SearchProcess, SharedProcess, SyntaxHighlightingWorker, createLazyRpc, get, getIpcType, remove$1 as remove, set$g as set };
|