@types/novnc__novnc 1.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.
novnc__novnc/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
novnc__novnc/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # Installation
2
+ > `npm install --save @types/novnc__novnc`
3
+
4
+ # Summary
5
+ This package contains type definitions for @novnc/novnc (https://github.com/novnc/noVNC).
6
+
7
+ # Details
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/novnc__novnc.
9
+
10
+ ### Additional Details
11
+ * Last updated: Fri, 17 Jun 2022 03:01:35 GMT
12
+ * Dependencies: none
13
+ * Global values: none
14
+
15
+ # Credits
16
+ These definitions were written by [Jake Jarvis](https://github.com/jakejarvis), and [Maksim Ovcharik](https://github.com/ovcharik).
@@ -0,0 +1,329 @@
1
+ // Type definitions for @novnc/novnc 1.3
2
+ // Project: https://github.com/novnc/noVNC
3
+ // Definitions by: Jake Jarvis <https://github.com/jakejarvis>
4
+ // Maksim Ovcharik <https://github.com/ovcharik>
5
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6
+
7
+ declare module '@novnc/novnc/core/rfb' {
8
+ /**
9
+ * An `object` specifying the credentials to provide to the server when authenticating.
10
+ */
11
+ interface NoVncCredentials {
12
+ /** The user that authenticates */
13
+ username: string;
14
+ /** Password for the user */
15
+ password: string;
16
+ /** Target machine or session */
17
+ target: string;
18
+ }
19
+
20
+ /**
21
+ * An `object` specifying extra details about how the connection should be made.
22
+ */
23
+ interface NoVncOptions {
24
+ /**
25
+ * A `boolean` indicating if the remote server should be shared or if any other connected
26
+ * clients should be disconnected. Enabled by default.
27
+ */
28
+ shared?: boolean;
29
+ /**
30
+ * An `object` specifying the credentials to provide to the server when authenticating.
31
+ */
32
+ credentials?: NoVncCredentials;
33
+ /**
34
+ * A `string` specifying the ID to provide to any VNC repeater encountered.
35
+ */
36
+ repeaterID?: string;
37
+ /**
38
+ * An `Array` of `string`s specifying the sub-protocols to use in the WebSocket connection.
39
+ * Empty by default.
40
+ */
41
+ wsProtocols?: string[];
42
+ }
43
+
44
+ interface NoVncEvents {
45
+ /**
46
+ * The `connect` event is fired after all the handshaking with the server is completed and the
47
+ * connection is fully established. After this event the `NoVncClient` object is ready to
48
+ * receive graphics updates and to send input.
49
+ */
50
+ connect: CustomEvent<Record<string, never>>;
51
+
52
+ /**
53
+ * The `disconnect` event is fired when the connection has been terminated. The `detail`
54
+ * property is an `object` that contains the property `clean`. `clean` is a `boolean` indicating
55
+ * if the termination was clean or not. In the event of an unexpected termination or an error
56
+ * `clean` will be set to false.
57
+ */
58
+ disconnect: CustomEvent<{ clean: boolean }>;
59
+
60
+ /**
61
+ * The `credentialsrequired` event is fired when the server requests more credentials than were
62
+ * specified to {@link NoVncClient}. The `detail` property is an `object` containing the
63
+ * property `types` which is an `Array` of `string` listing the credentials that are required.
64
+ */
65
+ credentialsrequired: CustomEvent<{ types: Array<keyof NoVncCredentials> }>;
66
+
67
+ /**
68
+ * The `securityfailure` event is fired when the handshaking process with the server fails
69
+ * during the security negotiation step. The `detail` property is an `object` containing the
70
+ * following properties:
71
+ *
72
+ * | Property | Type | Description
73
+ * | -------- | ----------- | -----------
74
+ * | `status` | `number` | The failure status code
75
+ * | `reason` | `string` | The **optional** reason for the failure
76
+ *
77
+ * The property `status` corresponds to the
78
+ * [SecurityResult](https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst#securityresult)
79
+ * status code in cases of failure. A status of zero will not be sent in this event since that
80
+ * indicates a successful security handshaking process. The optional property `reason` is
81
+ * provided by the server and thus the language of the string is not known. However most servers
82
+ * will probably send English strings. The server can choose to not send a reason and in these
83
+ * cases the `reason` property will be omitted.
84
+ */
85
+ securityfailure: CustomEvent<{ status: number; reason?: string }>;
86
+
87
+ /**
88
+ * The `clipboard` event is fired when the server has sent clipboard data. The `detail` property
89
+ * is an `object` containing the property `text` which is a `string` with the clipboard data.
90
+ */
91
+ clipboard: CustomEvent<{ text: string }>;
92
+
93
+ /**
94
+ * The `bell` event is fired when the server has requested an audible bell.
95
+ */
96
+ bell: CustomEvent<Record<string, never>>;
97
+
98
+ /**
99
+ * The `desktopname` event is fired when the name of the remote desktop changes. The `detail`
100
+ * property is an `object` with the property `name` which is a `string` specifying the new name.
101
+ */
102
+ desktopname: CustomEvent<{ name: string }>;
103
+
104
+ /**
105
+ * The `capabilities` event is fired whenever an entry is added or removed from `capabilities`.
106
+ * The `detail` property is an `object` with the property `capabilities` containing the new
107
+ * value of `capabilities`.
108
+ */
109
+ capabilities: CustomEvent<{ capabilities: NoVncClient['capabilities'] }>;
110
+ }
111
+
112
+ type NoVncEventType = keyof NoVncEvents;
113
+ type NoVncEvent = NoVncEvents[NoVncEventType];
114
+
115
+ class NoVncEventTarget extends EventTarget {
116
+ protected _listeners: Map<NoVncEventType, (event: Event) => void>;
117
+
118
+ addEventListener<T extends NoVncEventType>(type: T, listener: (event: NoVncEvents[T]) => void): void;
119
+ addEventListener(type: string, listener: (event: CustomEvent) => void): void;
120
+
121
+ removeEventListener<T extends NoVncEventType>(type: T, listener: (event: NoVncEvents[T]) => void): void;
122
+ removeEventListener(type: string, listener: (event: CustomEvent) => void): void;
123
+
124
+ dispatchEvent(event: NoVncEvent | CustomEvent): boolean;
125
+ }
126
+
127
+ /**
128
+ * The `NoVncClient` object represents a single connection to a VNC server. It communicates using
129
+ * a WebSocket that must provide a standard NoVncClient protocol stream.
130
+ */
131
+ export default class NoVncClient extends NoVncEventTarget {
132
+ readonly _target: Element;
133
+ readonly _url: string | null;
134
+
135
+ /**
136
+ * Returns a new `NoVncClient` object and initiates a new connection to a specified VNC server.
137
+ *
138
+ * @param target - A block {@link HTMLElement} that specifies where the `NoVncClient` object
139
+ * should attach itself. The existing contents of the `HTMLElement` will be untouched, but new
140
+ * elements will be added during the lifetime of the `NoVncClient` object.
141
+ * @param url - A `string`, {@link WebSocket}, or {@link RTCDataChannel} specifying the VNC server to connect
142
+ * to. This must be a valid WebSocket URL.
143
+ * @param options - An {@link NoVncOptions} specifying extra details about how the connection
144
+ * should be made.
145
+ */
146
+ constructor(target: Element, url: string | WebSocket | RTCDataChannel, options?: NoVncOptions);
147
+
148
+ /**
149
+ * Is a `boolean` indicating if any events (e.g. key presses or mouse movement) should be
150
+ * prevented from being sent to the server. Disabled by default.
151
+ */
152
+ viewOnly: boolean;
153
+
154
+ /**
155
+ * Is a `boolean` indicating if keyboard focus should automatically be moved to the remote
156
+ * session when a `mousedown` or `touchstart` event is received. Enabled by default.
157
+ */
158
+ focusOnClick: boolean;
159
+
160
+ /**
161
+ * Is a `boolean` indicating if the remote session should be clipped to its container. When
162
+ * disabled scrollbars will be shown to handle the resulting overflow. Disabled by default.
163
+ */
164
+ clipViewport: boolean;
165
+
166
+ /**
167
+ * Is a `boolean` indicating if mouse events should control the relative position of a clipped
168
+ * remote session. Only relevant if `clipViewport` is enabled. Disabled by default.
169
+ */
170
+ dragViewport: boolean;
171
+
172
+ /**
173
+ * Is a `boolean` indicating if the remote session should be scaled locally so it fits its
174
+ * container. When disabled it will be centered if the remote session is smaller than its
175
+ * container, or handled according to `clipViewport` if it is larger. Disabled by default.
176
+ */
177
+ scaleViewport: boolean;
178
+
179
+ /**
180
+ * Is a `boolean` indicating if a request to resize the remote session should be sent whenever
181
+ * the container changes dimensions. Disabled by default.
182
+ */
183
+ resizeSession: boolean;
184
+
185
+ /**
186
+ * Is a `boolean` indicating whether a dot cursor should be shown instead of a zero-sized or
187
+ * fully-transparent cursor if the server sets such invisible cursor. Disabled by default.
188
+ */
189
+ showDotCursor: boolean;
190
+
191
+ /**
192
+ * Is a valid CSS [background](https://developer.mozilla.org/en-US/docs/Web/CSS/background)
193
+ * style value indicating which background style should be applied to the element containing the
194
+ * remote session screen. The default value is `rgb(40, 40, 40)` (solid gray color).
195
+ */
196
+ background: string;
197
+
198
+ /**
199
+ * Is an `int` in range `[0-9]` controlling the desired JPEG quality. Value `0` implies low
200
+ * quality and `9` implies high quality. Default value is `6`.
201
+ */
202
+ qualityLevel: number;
203
+
204
+ /**
205
+ * Is an `int` in range `[0-9]` controlling the desired compression level. Value `0` means no
206
+ * compression. Level 1 uses a minimum of CPU resources and achieves weak compression ratios,
207
+ * while level 9 offers best compression but is slow in terms of CPU consumption on the server
208
+ * side. Use high levels with very slow network connections. Default value is `2`.
209
+ */
210
+ compressionLevel: number;
211
+
212
+ /**
213
+ * Is an `object` indicating which optional extensions are available on the server. Some methods
214
+ * may only be called if the corresponding capability is set. The following capabilities are
215
+ * defined:
216
+ *
217
+ * | name | type | description
218
+ * | -------- | --------- | -----------
219
+ * | `power` | `boolean` | Machine power control is available
220
+ */
221
+ readonly capabilities: {
222
+ /** Machine power control is available */
223
+ power: boolean;
224
+ };
225
+
226
+ /**
227
+ * Disconnect from the server.
228
+ */
229
+ disconnect(): void;
230
+
231
+ /**
232
+ * Send credentials to server. Should be called after the
233
+ * {@link NoVncEventType.credentialsrequired} event has fired.
234
+ *
235
+ * @param credentials An {@link NoVncCredentials} specifying the credentials to provide to the
236
+ * server when authenticating.
237
+ */
238
+ sendCredentials(credentials: NoVncCredentials): void;
239
+
240
+ /**
241
+ * Send a key event to the server.
242
+ *
243
+ * @param keysym A `number` specifying the NoVncClient keysym to send. Can be `0` if a valid
244
+ * **`code`** is specified.
245
+ * @param code A `string` specifying the physical key to send. Valid values are those that can
246
+ * be specified to {@link KeyboardEvent.code}. If the physical key cannot be determined then
247
+ * `null` shall be specified.
248
+ * @param down A `boolean` specifying if a press or a release event should be sent. If omitted
249
+ * then both a press and release event are sent.
250
+ */
251
+ sendKey(keysym: number, code: string | null, down?: boolean): void;
252
+
253
+ /**
254
+ * Send the key sequence *left Control*, *left Alt*, *Delete*. This is a convenience wrapper
255
+ * around {@link sendKey}.
256
+ */
257
+ sendCtrlAltDel(): void;
258
+
259
+ /**
260
+ * Sets the keyboard focus on the remote session. Keyboard events will be sent to the remote
261
+ * server after this point.
262
+ *
263
+ * @param options A {@link FocusOptions} providing options to control how the focus will be
264
+ * performed. Please see {@link HTMLElement.focus} for available options.
265
+ */
266
+ focus(options?: FocusOptions): void;
267
+
268
+ /**
269
+ * Remove keyboard focus on the remote session. Keyboard events will no longer be sent to the
270
+ * remote server after this point.
271
+ */
272
+ blur(): void;
273
+
274
+ /**
275
+ * Request to shut down the remote machine. The capability `power` must be set for this method
276
+ * to have any effect.
277
+ */
278
+ machineShutdown(): void;
279
+
280
+ /**
281
+ * Request a clean reboot of the remote machine. The capability `power` must be set for this
282
+ * method to have any effect.
283
+ */
284
+ machineReboot(): void;
285
+
286
+ /**
287
+ * Request a forced reset of the remote machine. The capability `power` must be set for this
288
+ * method to have any effect.
289
+ */
290
+ machineReset(): void;
291
+
292
+ /**
293
+ * Send clipboard data to the remote server.
294
+ *
295
+ * @param text A `string` specifying the clipboard data to send.
296
+ */
297
+ clipboardPasteFrom(text: string): void;
298
+ }
299
+ }
300
+
301
+ declare module '@novnc/novnc/core/util/browser' {
302
+ let isTouchDevice: boolean;
303
+ let dragThreshold: number;
304
+
305
+ const supportsCursorURIs: boolean;
306
+ const hasScrollbarGutter: boolean;
307
+
308
+ function isMac(): boolean;
309
+ function isWindows(): boolean;
310
+ function isIOS(): boolean;
311
+ function isSafari(): boolean;
312
+ function isFirefox(): boolean;
313
+ }
314
+
315
+ declare module '@novnc/novnc/core/input/util' {
316
+ interface KeyboardEventBase {
317
+ char?: string;
318
+ charCode?: number;
319
+ code: string;
320
+ key: string;
321
+ keyCode?: number;
322
+ location?: number;
323
+ type?: string;
324
+ }
325
+
326
+ function getKeycode(event: KeyboardEventBase): string;
327
+ function getKey(event: KeyboardEventBase): string;
328
+ function getKeysym(event: KeyboardEventBase): number;
329
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@types/novnc__novnc",
3
+ "version": "1.3.0",
4
+ "description": "TypeScript definitions for @novnc/novnc",
5
+ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/novnc__novnc",
6
+ "license": "MIT",
7
+ "contributors": [
8
+ {
9
+ "name": "Jake Jarvis",
10
+ "url": "https://github.com/jakejarvis",
11
+ "githubUsername": "jakejarvis"
12
+ },
13
+ {
14
+ "name": "Maksim Ovcharik",
15
+ "url": "https://github.com/ovcharik",
16
+ "githubUsername": "ovcharik"
17
+ }
18
+ ],
19
+ "main": "",
20
+ "types": "index.d.ts",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
24
+ "directory": "types/novnc__novnc"
25
+ },
26
+ "scripts": {},
27
+ "dependencies": {},
28
+ "typesPublisherContentHash": "8305feac1f6055a5ea730735d69e06e6eba1963b11b0d374f6d54f28e734ca49",
29
+ "typeScriptVersion": "4.0"
30
+ }