@illgrenoble/webx-client 0.10.0 → 1.1.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 (158) hide show
  1. package/dist/WebXClient.d.ts +156 -16
  2. package/dist/WebXClient.js +170 -16
  3. package/dist/WebXClient.js.map +1 -1
  4. package/dist/display/WebXCursor.d.ts +65 -0
  5. package/dist/display/WebXCursor.js +65 -0
  6. package/dist/display/WebXCursor.js.map +1 -1
  7. package/dist/display/WebXCursorFactory.d.ts +18 -0
  8. package/dist/display/WebXCursorFactory.js +39 -16
  9. package/dist/display/WebXCursorFactory.js.map +1 -1
  10. package/dist/display/WebXDisplay.d.ts +150 -9
  11. package/dist/display/WebXDisplay.js +154 -9
  12. package/dist/display/WebXDisplay.js.map +1 -1
  13. package/dist/display/WebXSubImage.d.ts +42 -11
  14. package/dist/display/WebXSubImage.js +18 -12
  15. package/dist/display/WebXSubImage.js.map +1 -1
  16. package/dist/display/WebXTextureFactory.d.ts +30 -0
  17. package/dist/display/WebXTextureFactory.js +56 -19
  18. package/dist/display/WebXTextureFactory.js.map +1 -1
  19. package/dist/display/WebXWindow.d.ts +152 -0
  20. package/dist/display/WebXWindow.js +152 -0
  21. package/dist/display/WebXWindow.js.map +1 -1
  22. package/dist/display/WebXWindowProperties.d.ts +31 -6
  23. package/dist/display/WebXWindowProperties.js +16 -9
  24. package/dist/display/WebXWindowProperties.js.map +1 -1
  25. package/dist/input/WebXKeyboard.d.ts +40 -5
  26. package/dist/input/WebXKeyboard.js +52 -14
  27. package/dist/input/WebXKeyboard.js.map +1 -1
  28. package/dist/input/WebXMouse.d.ts +9 -0
  29. package/dist/input/WebXMouse.js +9 -4
  30. package/dist/input/WebXMouse.js.map +1 -1
  31. package/dist/input/keyboard/WebXKeyEvent.d.ts +35 -3
  32. package/dist/input/keyboard/WebXKeyEvent.js +115 -3
  33. package/dist/input/keyboard/WebXKeyEvent.js.map +1 -1
  34. package/dist/input/keyboard/WebXKeyPressEvent.d.ts +25 -8
  35. package/dist/input/keyboard/WebXKeyPressEvent.js +29 -11
  36. package/dist/input/keyboard/WebXKeyPressEvent.js.map +1 -1
  37. package/dist/input/keyboard/WebXKeyUpEvent.d.ts +30 -9
  38. package/dist/input/keyboard/WebXKeyUpEvent.js +19 -16
  39. package/dist/input/keyboard/WebXKeyUpEvent.js.map +1 -1
  40. package/dist/input/keyboard/WebXKeyboardModifierState.d.ts +69 -8
  41. package/dist/input/keyboard/WebXKeyboardModifierState.js +69 -8
  42. package/dist/input/keyboard/WebXKeyboardModifierState.js.map +1 -1
  43. package/dist/input/keyboard/WebXKeyboardUtils.d.ts +18 -2
  44. package/dist/input/keyboard/WebXKeyboardUtils.js +18 -2
  45. package/dist/input/keyboard/WebXKeyboardUtils.js.map +1 -1
  46. package/dist/input/keyboard/WebXKeydownEvent.d.ts +26 -9
  47. package/dist/input/keyboard/WebXKeydownEvent.js +17 -22
  48. package/dist/input/keyboard/WebXKeydownEvent.js.map +1 -1
  49. package/dist/input/mouse/WebXMouseState.d.ts +113 -2
  50. package/dist/input/mouse/WebXMouseState.js +104 -2
  51. package/dist/input/mouse/WebXMouseState.js.map +1 -1
  52. package/dist/instruction/WebXConnectInstruction.d.ts +16 -1
  53. package/dist/instruction/WebXConnectInstruction.js +13 -1
  54. package/dist/instruction/WebXConnectInstruction.js.map +1 -1
  55. package/dist/instruction/WebXCursorImageInstruction.d.ts +15 -3
  56. package/dist/instruction/WebXCursorImageInstruction.js +12 -5
  57. package/dist/instruction/WebXCursorImageInstruction.js.map +1 -1
  58. package/dist/instruction/WebXDataAckInstruction.d.ts +22 -5
  59. package/dist/instruction/WebXDataAckInstruction.js +15 -9
  60. package/dist/instruction/WebXDataAckInstruction.js.map +1 -1
  61. package/dist/instruction/WebXImageInstruction.d.ts +14 -3
  62. package/dist/instruction/WebXImageInstruction.js +11 -7
  63. package/dist/instruction/WebXImageInstruction.js.map +1 -1
  64. package/dist/instruction/WebXInstruction.d.ts +26 -10
  65. package/dist/instruction/WebXInstruction.js +19 -25
  66. package/dist/instruction/WebXInstruction.js.map +1 -1
  67. package/dist/instruction/WebXInstructionResponse.d.ts +55 -2
  68. package/dist/instruction/WebXInstructionResponse.js +40 -2
  69. package/dist/instruction/WebXInstructionResponse.js.map +1 -1
  70. package/dist/instruction/WebXInstructionType.d.ts +40 -0
  71. package/dist/instruction/WebXInstructionType.js +40 -0
  72. package/dist/instruction/WebXInstructionType.js.map +1 -1
  73. package/dist/instruction/WebXKeyboardInstruction.d.ts +19 -6
  74. package/dist/instruction/WebXKeyboardInstruction.js +13 -14
  75. package/dist/instruction/WebXKeyboardInstruction.js.map +1 -1
  76. package/dist/instruction/WebXMouseInstruction.d.ts +24 -9
  77. package/dist/instruction/WebXMouseInstruction.js +15 -21
  78. package/dist/instruction/WebXMouseInstruction.js.map +1 -1
  79. package/dist/instruction/WebXPongInstruction.d.ts +15 -3
  80. package/dist/instruction/WebXPongInstruction.js +12 -5
  81. package/dist/instruction/WebXPongInstruction.js.map +1 -1
  82. package/dist/instruction/WebXQualityInstruction.d.ts +16 -4
  83. package/dist/instruction/WebXQualityInstruction.js +13 -8
  84. package/dist/instruction/WebXQualityInstruction.js.map +1 -1
  85. package/dist/instruction/WebXScreenInstruction.d.ts +8 -0
  86. package/dist/instruction/WebXScreenInstruction.js +8 -0
  87. package/dist/instruction/WebXScreenInstruction.js.map +1 -1
  88. package/dist/instruction/WebXWindowsInstruction.d.ts +9 -0
  89. package/dist/instruction/WebXWindowsInstruction.js +9 -0
  90. package/dist/instruction/WebXWindowsInstruction.js.map +1 -1
  91. package/dist/message/WebXCursorImageMessage.d.ts +42 -13
  92. package/dist/message/WebXCursorImageMessage.js +24 -25
  93. package/dist/message/WebXCursorImageMessage.js.map +1 -1
  94. package/dist/message/WebXImageMessage.d.ts +37 -11
  95. package/dist/message/WebXImageMessage.js +22 -21
  96. package/dist/message/WebXImageMessage.js.map +1 -1
  97. package/dist/message/WebXMessage.d.ts +22 -6
  98. package/dist/message/WebXMessage.js +15 -9
  99. package/dist/message/WebXMessage.js.map +1 -1
  100. package/dist/message/WebXMessageType.d.ts +35 -0
  101. package/dist/message/WebXMessageType.js +35 -0
  102. package/dist/message/WebXMessageType.js.map +1 -1
  103. package/dist/message/WebXMouseMessage.d.ts +27 -7
  104. package/dist/message/WebXMouseMessage.js +18 -13
  105. package/dist/message/WebXMouseMessage.js.map +1 -1
  106. package/dist/message/WebXPingMessage.d.ts +9 -0
  107. package/dist/message/WebXPingMessage.js +9 -0
  108. package/dist/message/WebXPingMessage.js.map +1 -1
  109. package/dist/message/WebXQualityMessage.d.ts +36 -11
  110. package/dist/message/WebXQualityMessage.js +21 -21
  111. package/dist/message/WebXQualityMessage.js.map +1 -1
  112. package/dist/message/WebXScreenMessage.d.ts +17 -3
  113. package/dist/message/WebXScreenMessage.js +14 -5
  114. package/dist/message/WebXScreenMessage.js.map +1 -1
  115. package/dist/message/WebXSubImagesMessage.d.ts +27 -7
  116. package/dist/message/WebXSubImagesMessage.js +18 -13
  117. package/dist/message/WebXSubImagesMessage.js.map +1 -1
  118. package/dist/message/WebXWindowsMessage.d.ts +17 -3
  119. package/dist/message/WebXWindowsMessage.js +14 -5
  120. package/dist/message/WebXWindowsMessage.js.map +1 -1
  121. package/dist/tracer/WebXDebugImageMessageHandler.d.ts +30 -0
  122. package/dist/tracer/WebXDebugImageMessageHandler.js +30 -0
  123. package/dist/tracer/WebXDebugImageMessageHandler.js.map +1 -1
  124. package/dist/tracer/WebXHandler.d.ts +11 -0
  125. package/dist/tracer/WebXInstructionHandler.d.ts +17 -0
  126. package/dist/tracer/WebXInstructionHandler.js +6 -0
  127. package/dist/tracer/WebXInstructionHandler.js.map +1 -1
  128. package/dist/tracer/WebXMessageHandler.d.ts +17 -0
  129. package/dist/tracer/WebXMessageHandler.js +6 -0
  130. package/dist/tracer/WebXMessageHandler.js.map +1 -1
  131. package/dist/tracer/WebXStatsHandler.d.ts +16 -0
  132. package/dist/tracer/WebXStatsHandler.js +6 -0
  133. package/dist/tracer/WebXStatsHandler.js.map +1 -1
  134. package/dist/transport/WebXBinarySerializer.d.ts +20 -0
  135. package/dist/transport/WebXBinarySerializer.js +20 -0
  136. package/dist/transport/WebXBinarySerializer.js.map +1 -1
  137. package/dist/transport/WebXInstructionBuffer.d.ts +19 -0
  138. package/dist/transport/WebXInstructionBuffer.js +19 -0
  139. package/dist/transport/WebXInstructionBuffer.js.map +1 -1
  140. package/dist/transport/WebXInstructionEncoder.d.ts +138 -0
  141. package/dist/transport/WebXInstructionEncoder.js +138 -110
  142. package/dist/transport/WebXInstructionEncoder.js.map +1 -1
  143. package/dist/transport/WebXMessageBuffer.d.ts +63 -8
  144. package/dist/transport/WebXMessageBuffer.js +51 -16
  145. package/dist/transport/WebXMessageBuffer.js.map +1 -1
  146. package/dist/transport/WebXMessageDecoder.d.ts +69 -0
  147. package/dist/transport/WebXMessageDecoder.js +96 -18
  148. package/dist/transport/WebXMessageDecoder.js.map +1 -1
  149. package/dist/tunnel/WebXTunnel.d.ts +71 -0
  150. package/dist/tunnel/WebXTunnel.js +51 -4
  151. package/dist/tunnel/WebXTunnel.js.map +1 -1
  152. package/dist/tunnel/WebXWebSocketTunnel.d.ts +26 -0
  153. package/dist/tunnel/WebXWebSocketTunnel.js +26 -0
  154. package/dist/tunnel/WebXWebSocketTunnel.js.map +1 -1
  155. package/dist/utils/ColorGenerator.d.ts +19 -0
  156. package/dist/utils/ColorGenerator.js +19 -0
  157. package/dist/utils/ColorGenerator.js.map +1 -1
  158. package/package.json +1 -1
@@ -13,16 +13,34 @@ exports.WebXTunnel = void 0;
13
13
  const instruction_1 = require("../instruction");
14
14
  const message_1 = require("../message");
15
15
  const transport_1 = require("../transport");
16
+ /**
17
+ * Represents a communication tunnel between the WebX client and the WebX Engine.
18
+ *
19
+ * This class handles sending and receiving data, managing the connection state,
20
+ * and processing responses from the WebX Engine.
21
+ */
16
22
  class WebXTunnel {
17
23
  constructor() {
18
24
  this._instructionResponses = new Map();
19
25
  this._serializer = null;
20
26
  }
27
+ /**
28
+ * Sends an instruction to the WebX Engine.
29
+ *
30
+ * @param command The instruction to send.
31
+ */
21
32
  sendInstruction(command) {
22
33
  // console.log(`Sending command: `, command);
23
34
  const message = this._serializer.serializeInstruction(command);
24
35
  this.send(message);
25
36
  }
37
+ /**
38
+ * Sends a request to the WebX Engine and waits for a response.
39
+ *
40
+ * @param command The request to send.
41
+ * @param timeout The timeout in milliseconds to wait for a response.
42
+ * @returns A promise that resolves with the response from the WebX Engine.
43
+ */
26
44
  sendRequest(command, timeout) {
27
45
  // console.log(`Sending request: `, command);
28
46
  command.synchronous = true;
@@ -40,6 +58,11 @@ class WebXTunnel {
40
58
  });
41
59
  });
42
60
  }
61
+ /**
62
+ * Handles incoming messages from the WebX Engine.
63
+ *
64
+ * @param data The received data.
65
+ */
43
66
  onMessage(data) {
44
67
  return __awaiter(this, void 0, void 0, function* () {
45
68
  if (data.byteLength === 0) {
@@ -68,19 +91,35 @@ class WebXTunnel {
68
91
  }
69
92
  });
70
93
  }
71
- // eslint-disable-next-line
94
+ /**
95
+ * Handles a received message from the WebX Engine.
96
+ *
97
+ * @param message The received message.
98
+ */
72
99
  handleMessage(message) {
73
100
  throw new Error('Method not implemented.');
74
101
  }
75
- // eslint-disable-next-line
102
+ /**
103
+ * Handles received bytes from the WebX Engine.
104
+ *
105
+ * @param data The received data.
106
+ */
76
107
  handleReceivedBytes(data) {
77
108
  throw new Error('Method not implemented.');
78
109
  }
79
- // eslint-disable-next-line
110
+ /**
111
+ * Handles sent bytes to the WebX Engine.
112
+ *
113
+ * @param data The sent data.
114
+ */
80
115
  handleSentBytes(data) {
81
116
  throw new Error('Method not implemented');
82
117
  }
83
- // eslint-disable-next-line
118
+ /**
119
+ * Handles the close event of the connection.
120
+ *
121
+ * @param event The close event.
122
+ */
84
123
  handleClose(event) {
85
124
  // Clear all pending instruction responses
86
125
  this._instructionResponses.forEach((response) => {
@@ -88,9 +127,17 @@ class WebXTunnel {
88
127
  });
89
128
  this.onClosed();
90
129
  }
130
+ /**
131
+ * Called when the connection is closed.
132
+ */
91
133
  onClosed() {
92
134
  console.log(`Websocket closed`);
93
135
  }
136
+ /**
137
+ * Handles critical messages such as PING and data acknowledgments.
138
+ *
139
+ * @param buffer The message buffer.
140
+ */
94
141
  _handleCriticalMessages(buffer) {
95
142
  if (buffer.messageTypeId == message_1.WebXMessageType.PING) {
96
143
  // Reply immediately with a pong
@@ -1 +1 @@
1
- {"version":3,"file":"WebXTunnel.js","sourceRoot":"","sources":["../../src/tunnel/WebXTunnel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAAqH;AACrH,wCAAwD;AACxD,4CAAuE;AAEvE,MAAsB,UAAU;IAO9B;QAFQ,0BAAqB,GAA8C,IAAI,GAAG,EAAwC,CAAC;QAGzH,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAUD,eAAe,CAAC,OAAwB;QACtC,6CAA6C;QAC7C,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAED,WAAW,CAAC,OAAwB,EAAE,OAAgB;QACpD,6CAA6C;QAC7C,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;QAC3B,OAAO,GAAG,OAAO,IAAI,KAAK,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,qCAAuB,CAAc,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5E,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;QACrD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,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eAAe,CAAC,IAAI,oCAAsB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;YAC5F,CAAC;QACH,CAAC;IACH,CAAC;;AA9KH,gCAgLC;AA/KyB,oCAAyB,GAAG,KAAK,AAAR,CAAS"}
@@ -1,5 +1,11 @@
1
1
  import { WebXTunnel } from './WebXTunnel';
2
2
  import { WebXBinarySerializer } from '../transport';
3
+ /**
4
+ * Represents a WebSocket-based implementation of the WebX communication tunnel.
5
+ *
6
+ * This class manages the WebSocket connection to the WebX Engine, handles
7
+ * sending and receiving data, and processes events related to the connection.
8
+ */
3
9
  export declare class WebXWebSocketTunnel extends WebXTunnel {
4
10
  private readonly _url;
5
11
  private _socket;
@@ -7,8 +13,28 @@ export declare class WebXWebSocketTunnel extends WebXTunnel {
7
13
  private _socketOpen;
8
14
  constructor(url: string, options?: any);
9
15
  getSocket(): WebSocket;
16
+ /**
17
+ * Sends data to the WebX Engine over the WebSocket connection.
18
+ *
19
+ * @param data The data to send.
20
+ */
10
21
  send(data: ArrayBuffer): void;
22
+ /**
23
+ * Establishes a WebSocket connection to the WebX Engine.
24
+ *
25
+ * @param data The connection options.
26
+ * @param serializer The serializer to use for encoding/decoding messages.
27
+ * @returns A promise that resolves when the connection is successfully established.
28
+ */
11
29
  connect(data: any, serializer: WebXBinarySerializer): Promise<Event>;
30
+ /**
31
+ * Closes the WebSocket connection to the WebX Engine.
32
+ */
12
33
  disconnect(): void;
34
+ /**
35
+ * Checks if the WebSocket connection is currently open.
36
+ *
37
+ * @returns True if the WebSocket is open, false otherwise.
38
+ */
13
39
  isConnected(): boolean;
14
40
  }
@@ -2,6 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebXWebSocketTunnel = void 0;
4
4
  const WebXTunnel_1 = require("./WebXTunnel");
5
+ /**
6
+ * Represents a WebSocket-based implementation of the WebX communication tunnel.
7
+ *
8
+ * This class manages the WebSocket connection to the WebX Engine, handles
9
+ * sending and receiving data, and processes events related to the connection.
10
+ */
5
11
  class WebXWebSocketTunnel extends WebXTunnel_1.WebXTunnel {
6
12
  constructor(url, options = {}) {
7
13
  super();
@@ -12,12 +18,24 @@ class WebXWebSocketTunnel extends WebXTunnel_1.WebXTunnel {
12
18
  getSocket() {
13
19
  return this._socket;
14
20
  }
21
+ /**
22
+ * Sends data to the WebX Engine over the WebSocket connection.
23
+ *
24
+ * @param data The data to send.
25
+ */
15
26
  send(data) {
16
27
  if (this._socket != null) {
17
28
  this._socket.send(data);
18
29
  this.handleSentBytes(data);
19
30
  }
20
31
  }
32
+ /**
33
+ * Establishes a WebSocket connection to the WebX Engine.
34
+ *
35
+ * @param data The connection options.
36
+ * @param serializer The serializer to use for encoding/decoding messages.
37
+ * @returns A promise that resolves when the connection is successfully established.
38
+ */
21
39
  connect(data, serializer) {
22
40
  const options = Object.assign(Object.assign({}, this._connectionOptions), data);
23
41
  const parameters = new URLSearchParams(options);
@@ -35,6 +53,9 @@ class WebXWebSocketTunnel extends WebXTunnel_1.WebXTunnel {
35
53
  this._socket.onmessage = (aMessage) => this.onMessage(aMessage.data);
36
54
  });
37
55
  }
56
+ /**
57
+ * Closes the WebSocket connection to the WebX Engine.
58
+ */
38
59
  disconnect() {
39
60
  if (this._socket) {
40
61
  this._socketOpen = false;
@@ -42,6 +63,11 @@ class WebXWebSocketTunnel extends WebXTunnel_1.WebXTunnel {
42
63
  this._socket = null;
43
64
  }
44
65
  }
66
+ /**
67
+ * Checks if the WebSocket connection is currently open.
68
+ *
69
+ * @returns True if the WebSocket is open, false otherwise.
70
+ */
45
71
  isConnected() {
46
72
  return this._socketOpen;
47
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"WebXWebSocketTunnel.js","sourceRoot":"","sources":["../../src/tunnel/WebXWebSocketTunnel.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAG1C,MAAa,mBAAoB,SAAQ,uBAAU;IAMjD,YAAY,GAAW,EAAE,UAAe,EAA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.
3
+ *
4
+ * This class provides methods to generate random colors or retrieve colors
5
+ * from a predefined palette based on an index.
6
+ */
1
7
  export declare class ColorGenerator {
2
8
  private static _COLOURS;
9
+ /**
10
+ * Generates a random color from the predefined palette.
11
+ *
12
+ * @returns A random color as a hexadecimal string.
13
+ */
3
14
  static randomColour(): string;
15
+ /**
16
+ * Retrieves a color from the predefined palette based on the given index.
17
+ *
18
+ * If the index exceeds the palette size, it wraps around using modulo.
19
+ *
20
+ * @param index The index of the color to retrieve.
21
+ * @returns The color as a hexadecimal string.
22
+ */
4
23
  static indexedColour(index: number): string;
5
24
  }
@@ -1,11 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ColorGenerator = void 0;
4
+ /**
5
+ * Utility class for generating colors.
6
+ *
7
+ * This class provides methods to generate random colors or retrieve colors
8
+ * from a predefined palette based on an index.
9
+ */
4
10
  class ColorGenerator {
11
+ /**
12
+ * Generates a random color from the predefined palette.
13
+ *
14
+ * @returns A random color as a hexadecimal string.
15
+ */
5
16
  static randomColour() {
6
17
  const index = Math.floor(Math.random() * ColorGenerator._COLOURS.length);
7
18
  return ColorGenerator._COLOURS[index];
8
19
  }
20
+ /**
21
+ * Retrieves a color from the predefined palette based on the given index.
22
+ *
23
+ * If the index exceeds the palette size, it wraps around using modulo.
24
+ *
25
+ * @param index The index of the color to retrieve.
26
+ * @returns The color as a hexadecimal string.
27
+ */
9
28
  static indexedColour(index) {
10
29
  index = index % ColorGenerator._COLOURS.length;
11
30
  return ColorGenerator._COLOURS[index];
@@ -1 +1 @@
1
- {"version":3,"file":"ColorGenerator.js","sourceRoot":"","sources":["../../src/utils/ColorGenerator.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAehB,MAAM,CAAC,YAAY;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;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,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,aAAa,CAAC,KAAa;QACvC,KAAK,GAAG,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,MAAM,CAAC;QAC/C,OAAO,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;;AApCH,wCAqCC;AAnCgB,uBAAQ,GAAG;IACxB,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;IACrD,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS;CACtD,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@illgrenoble/webx-client",
3
3
  "description": "Client javascript library to display WebX remote desktop in a browser.",
4
- "version": "0.10.0",
4
+ "version": "1.1.0",
5
5
  "scripts": {
6
6
  "lint": "eslint . --ext .ts",
7
7
  "lint:fix": "eslint . --ext .ts --fix",