@asdf-overlay/core 1.2.5 → 2.0.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/addon.win32-arm64-msvc.node +0 -0
- package/addon.win32-ia32-msvc.node +0 -0
- package/addon.win32-x64-msvc.node +0 -0
- package/asdf_overlay-aarch64.dll +0 -0
- package/asdf_overlay-x64.dll +0 -0
- package/asdf_overlay-x86.dll +0 -0
- package/index.d.ts +6 -0
- package/index.js +11 -0
- package/native.d.ts +305 -0
- package/native.js +711 -0
- package/package.json +30 -27
- package/addon-aarch64.node +0 -0
- package/addon-x64.node +0 -0
- package/lib/addon.d.ts +0 -18
- package/lib/addon.js +0 -1
- package/lib/index.d.ts +0 -151
- package/lib/index.js +0 -202
- package/lib/input.d.ts +0 -240
- package/lib/input.js +0 -29
- package/lib/types.d.ts +0 -128
- package/lib/types.js +0 -48
- package/lib/util.d.ts +0 -13
- package/lib/util.js +0 -27
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/asdf_overlay-aarch64.dll
CHANGED
|
Binary file
|
package/asdf_overlay-x64.dll
CHANGED
|
Binary file
|
package/asdf_overlay-x86.dll
CHANGED
|
Binary file
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { EventEmitter } = require('node:events');
|
|
2
|
+
|
|
3
|
+
// @ts-check
|
|
4
|
+
module.exports = require('./native');
|
|
5
|
+
|
|
6
|
+
function defaultDllDir() {
|
|
7
|
+
return __dirname;
|
|
8
|
+
}
|
|
9
|
+
module.exports.defaultDllDir = defaultDllDir;
|
|
10
|
+
|
|
11
|
+
module.exports.Overlay.EventEmitter = EventEmitter;
|
package/native.d.ts
ADDED
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
|
|
3
|
+
export declare type OverlayEventEmitter = EventEmitter<{
|
|
4
|
+
/**
|
|
5
|
+
* A window has been added.
|
|
6
|
+
*/
|
|
7
|
+
window_added: [id: number, width: number, height: number],
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A window has been resized.
|
|
11
|
+
*/
|
|
12
|
+
window_resized: [id: number, width: number, height: number],
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Cursor input from a window.
|
|
16
|
+
*/
|
|
17
|
+
window_cursor_input: [id: number, input: CursorInput],
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Keyboard input from a window.
|
|
21
|
+
*/
|
|
22
|
+
window_keyboard_input: [id: number, input: KeyboardInput],
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Window is destroyed.
|
|
26
|
+
*/
|
|
27
|
+
window_destroyed: [id: number],
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* A surface has been added.
|
|
31
|
+
*/
|
|
32
|
+
surface_added: [id: bigint, width: number, height: number, info: SurfaceInfo],
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A surface has been resized.
|
|
36
|
+
*/
|
|
37
|
+
surface_resized: [id: bigint, width: number, height: number],
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A surface has been destroyed.
|
|
41
|
+
*/
|
|
42
|
+
surface_destroyed: [id: bigint],
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Input blocking is interrupted and turned off.
|
|
46
|
+
*/
|
|
47
|
+
input_blocking_ended: [id: number],
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Tracing span has been entered.
|
|
51
|
+
*/
|
|
52
|
+
tracing_enter: [metadata: TracingMetadata],
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A tracing event has been emitted.
|
|
56
|
+
*/
|
|
57
|
+
tracing_event: [metadata: TracingMetadata, message?: string],
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Tracing span has been exited.
|
|
61
|
+
*/
|
|
62
|
+
tracing_exit: [],
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* An error has occured on ipc connection.
|
|
66
|
+
*/
|
|
67
|
+
error: [err: unknown],
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Ipc disconnected.
|
|
71
|
+
*/
|
|
72
|
+
disconnected: [],
|
|
73
|
+
}>;
|
|
74
|
+
export declare class Overlay {
|
|
75
|
+
/** Attach overlay to target process */
|
|
76
|
+
static attach(this: this, dllDir: string, pid: number, timeout?: number | undefined | null): Promise<Overlay>
|
|
77
|
+
get event(): OverlayEventEmitter
|
|
78
|
+
/** Update overlay surface. */
|
|
79
|
+
updateHandle(id: bigint, update: UpdateSharedHandle): Promise<void>
|
|
80
|
+
/** Update overlay position relative to window */
|
|
81
|
+
setPosition(id: bigint, x: number, y: number): Promise<void>
|
|
82
|
+
/** Set blocking cursor. */
|
|
83
|
+
setBlockingCursor(cursor?: Cursor | undefined | null): Promise<void>
|
|
84
|
+
/** Listen to window input without blocking */
|
|
85
|
+
listenInput(id: number, cursor: boolean, keyboard: boolean): Promise<void>
|
|
86
|
+
/** Block window input and listen them. */
|
|
87
|
+
blockInput(block: boolean): Promise<void>
|
|
88
|
+
/** Detach and destroy overlay */
|
|
89
|
+
detach(): void
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Represent a surface for overlay */
|
|
93
|
+
export declare class OverlaySurface {
|
|
94
|
+
/** Create a new overlay surface. */
|
|
95
|
+
constructor(luid?: GpuLuid | undefined | null)
|
|
96
|
+
/** Clear the surface. */
|
|
97
|
+
clear(): void
|
|
98
|
+
/** Update surface using D3D11 NT shared texture. */
|
|
99
|
+
updateNtShtex(width: number, height: number, handle: Buffer, rect?: CopyRect | undefined | null): UpdateSharedHandle | null
|
|
100
|
+
/** Update surface using D3D11 KMT shared texture. */
|
|
101
|
+
updateKmtShtex(width: number, height: number, handle: Buffer, rect?: CopyRect | undefined | null): UpdateSharedHandle | null
|
|
102
|
+
/** Update surface using bitmap buffer. The size of overlay is `width x (data.byteLength / 4 / width)` */
|
|
103
|
+
updateBitmap(width: number, data: Buffer): UpdateSharedHandle | null
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface CopyRect {
|
|
107
|
+
dstX: number
|
|
108
|
+
dstY: number
|
|
109
|
+
src: Rect
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare enum Cursor {
|
|
113
|
+
Default = 0,
|
|
114
|
+
Help = 1,
|
|
115
|
+
Pointer = 2,
|
|
116
|
+
Progress = 3,
|
|
117
|
+
Wait = 4,
|
|
118
|
+
Cell = 5,
|
|
119
|
+
Crosshair = 6,
|
|
120
|
+
Text = 7,
|
|
121
|
+
VerticalText = 8,
|
|
122
|
+
Alias = 9,
|
|
123
|
+
Copy = 10,
|
|
124
|
+
Move = 11,
|
|
125
|
+
NotAllowed = 12,
|
|
126
|
+
Grab = 13,
|
|
127
|
+
Grabbing = 14,
|
|
128
|
+
ColResize = 15,
|
|
129
|
+
RowResize = 16,
|
|
130
|
+
EastWestResize = 17,
|
|
131
|
+
NorthSouthResize = 18,
|
|
132
|
+
NorthEastSouthWestResize = 19,
|
|
133
|
+
NorthWestSouthEastResize = 20,
|
|
134
|
+
ZoomIn = 21,
|
|
135
|
+
ZoomOut = 22,
|
|
136
|
+
UpArrow = 23,
|
|
137
|
+
Pin = 24,
|
|
138
|
+
Person = 25,
|
|
139
|
+
Pen = 26,
|
|
140
|
+
Cd = 27,
|
|
141
|
+
PanMiddle = 28,
|
|
142
|
+
PanMiddleHorizontal = 29,
|
|
143
|
+
PanMiddleVertical = 30,
|
|
144
|
+
PanEast = 31,
|
|
145
|
+
PanNorth = 32,
|
|
146
|
+
PanNorthEast = 33,
|
|
147
|
+
PanNorthWest = 34,
|
|
148
|
+
PanSouth = 35,
|
|
149
|
+
PanSouthEast = 36,
|
|
150
|
+
PanSouthWest = 37,
|
|
151
|
+
PanWest = 38
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** Cursor buttons. */
|
|
155
|
+
export type CursorAction = 'Left'|
|
|
156
|
+
'Right'|
|
|
157
|
+
'Middle'|
|
|
158
|
+
'Back'|
|
|
159
|
+
'Forward';
|
|
160
|
+
|
|
161
|
+
/** Describe a cursor input. */
|
|
162
|
+
export interface CursorInput {
|
|
163
|
+
/** X position relative to window. */
|
|
164
|
+
x: number
|
|
165
|
+
/** Y position relative to window. */
|
|
166
|
+
y: number
|
|
167
|
+
kind: CursorInputKind
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type CursorInputKind =
|
|
171
|
+
| { type: 'Enter' }
|
|
172
|
+
| { type: 'Leave' }
|
|
173
|
+
| { type: 'Move' }
|
|
174
|
+
| { type: 'Action', action: CursorAction, state: CursorInputState }
|
|
175
|
+
| { type: 'Scroll', axis: ScrollAxis, delta: number }
|
|
176
|
+
|
|
177
|
+
/** Cursor input state. */
|
|
178
|
+
export type CursorInputState =
|
|
179
|
+
| { type: 'Pressed', /** Consecutive click count. */
|
|
180
|
+
clickCount: number }
|
|
181
|
+
| { type: 'Released' }
|
|
182
|
+
|
|
183
|
+
export interface GpuLuid {
|
|
184
|
+
low: number
|
|
185
|
+
high: number
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Describe a IME event. */
|
|
189
|
+
export type Ime =
|
|
190
|
+
| { type: 'Enabled', /** Initial IME language in ETF language tag(BCP 47) format. */
|
|
191
|
+
lang: string, /** Initial IME conversion mode */
|
|
192
|
+
conversion: number }
|
|
193
|
+
| { type: 'Changed', /** Changed IME language in ETF language tag(BCP 47) format. */
|
|
194
|
+
lang: string }
|
|
195
|
+
| { type: 'ConversionChanged', /** Changed IME conversion mode. */
|
|
196
|
+
conversion: number }
|
|
197
|
+
| { type: 'CandidateChanged', list: ImeCandidateList }
|
|
198
|
+
| { type: 'CandidateClosed' }
|
|
199
|
+
| { type: 'Compose', /** Composing text. */
|
|
200
|
+
text: string, /** Current caret index in composing text. */
|
|
201
|
+
caret: number }
|
|
202
|
+
| { type: 'Commit', /** Committed text. */
|
|
203
|
+
text: string }
|
|
204
|
+
| { type: 'Disabled' }
|
|
205
|
+
|
|
206
|
+
/** IME candidate list. */
|
|
207
|
+
export interface ImeCandidateList {
|
|
208
|
+
/** Start index of current page. */
|
|
209
|
+
pageStartIndex: number
|
|
210
|
+
/** Count of candidate item per page. */
|
|
211
|
+
pageSize: number
|
|
212
|
+
/** Currently selected candidate index. */
|
|
213
|
+
selectedIndex: number
|
|
214
|
+
/** Candidate list. */
|
|
215
|
+
candidates: Array<string>
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export declare enum ImeConversion {
|
|
219
|
+
None = 0,
|
|
220
|
+
/** IME converts to native langauge. */
|
|
221
|
+
Native = 1,
|
|
222
|
+
/** IME composes in full-width characters. */
|
|
223
|
+
Fullshape = 2,
|
|
224
|
+
/** Conversion is disabled. */
|
|
225
|
+
NoConversion = 4,
|
|
226
|
+
/** Converting to hanja. */
|
|
227
|
+
HanjaConvert = 8,
|
|
228
|
+
/** Converting to katakana. */
|
|
229
|
+
Katakana = 16
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/** Utility function to create `Key` using key code and optional extended flag. */
|
|
233
|
+
export declare function key(code: number, extended?: boolean | undefined | null): Key
|
|
234
|
+
|
|
235
|
+
/** Describe a virtual key code. */
|
|
236
|
+
export interface Key {
|
|
237
|
+
/** A Windows Virtual-Key code. */
|
|
238
|
+
code: number
|
|
239
|
+
/**
|
|
240
|
+
* Whether if this key is an extended key.
|
|
241
|
+
*
|
|
242
|
+
* This is usually true for right-side modifier keys, numpad keys, and arrow keys.
|
|
243
|
+
*/
|
|
244
|
+
extended: boolean
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export type KeyboardInput =
|
|
248
|
+
| { type: 'Key', key: Key, state: KeyInputState }
|
|
249
|
+
| { type: 'Char', /** Input character (1 character). */
|
|
250
|
+
ch: string }
|
|
251
|
+
| { type: 'Ime', /** An IME event. */
|
|
252
|
+
ime: Ime }
|
|
253
|
+
|
|
254
|
+
/** Key input state. */
|
|
255
|
+
export type KeyInputState = /** The key is pressed down. */
|
|
256
|
+
'Pressed'|
|
|
257
|
+
/** The key is released. */
|
|
258
|
+
'Released';
|
|
259
|
+
|
|
260
|
+
export type LogLevel = 'Trace'|
|
|
261
|
+
'Debug'|
|
|
262
|
+
'Info'|
|
|
263
|
+
'Warn'|
|
|
264
|
+
'Error';
|
|
265
|
+
|
|
266
|
+
export interface Rect {
|
|
267
|
+
x: number
|
|
268
|
+
y: number
|
|
269
|
+
width: number
|
|
270
|
+
height: number
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/** Cursor scroll axis. */
|
|
274
|
+
export type ScrollAxis = 'X'|
|
|
275
|
+
'Y';
|
|
276
|
+
|
|
277
|
+
export interface SurfaceInfo {
|
|
278
|
+
/** Surface type. */
|
|
279
|
+
ty: SurfaceType
|
|
280
|
+
/** GPU LUID of the surface. */
|
|
281
|
+
gpuId: GpuLuid
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
export type SurfaceType =
|
|
285
|
+
| { type: 'Opengl', windowId: number }
|
|
286
|
+
| { type: 'Direct3D9', windowId: number }
|
|
287
|
+
| { type: 'Direct3D11', windowId?: number }
|
|
288
|
+
| { type: 'Direct3D12', windowId?: number }
|
|
289
|
+
| { type: 'Vulkan', windowId: number }
|
|
290
|
+
|
|
291
|
+
export interface TracingMetadata {
|
|
292
|
+
/** Metadata tracing level. */
|
|
293
|
+
level: LogLevel
|
|
294
|
+
/** The time in milliseconds when the tracing event occurred. */
|
|
295
|
+
time: number
|
|
296
|
+
/** The module path of the tracing event, if available. */
|
|
297
|
+
modulePath?: string
|
|
298
|
+
/** The line number of the tracing event, if available. */
|
|
299
|
+
line?: number
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export type UpdateSharedHandle =
|
|
303
|
+
| { type: 'Kmt', field0: number }
|
|
304
|
+
| { type: 'Nt', field0: number }
|
|
305
|
+
| { type: 'None' }
|