@novnc/novnc 1.2.0-test → 1.3.0-g7ad4e60

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 (63) hide show
  1. package/LICENSE.txt +0 -6
  2. package/README.md +4 -4
  3. package/core/decoders/copyrect.js +5 -0
  4. package/core/decoders/hextile.js +57 -3
  5. package/core/decoders/raw.js +12 -2
  6. package/core/decoders/tight.js +24 -8
  7. package/core/display.js +9 -151
  8. package/core/input/domkeytable.js +25 -21
  9. package/core/input/keyboard.js +12 -127
  10. package/core/input/util.js +18 -35
  11. package/core/input/vkeys.js +0 -1
  12. package/core/input/xtscancodes.js +5 -3
  13. package/core/rfb.js +116 -109
  14. package/core/util/browser.js +0 -17
  15. package/core/util/cursor.js +1 -11
  16. package/core/util/events.js +0 -4
  17. package/core/websock.js +76 -17
  18. package/docs/API.md +10 -3
  19. package/docs/LIBRARY.md +3 -7
  20. package/lib/base64.js +4 -4
  21. package/lib/decoders/copyrect.js +7 -2
  22. package/lib/decoders/hextile.js +63 -7
  23. package/lib/decoders/raw.js +13 -4
  24. package/lib/decoders/rre.js +2 -2
  25. package/lib/decoders/tight.js +38 -20
  26. package/lib/decoders/tightpng.js +8 -8
  27. package/lib/deflator.js +4 -4
  28. package/lib/des.js +2 -2
  29. package/lib/display.js +45 -212
  30. package/lib/inflator.js +4 -4
  31. package/lib/input/domkeytable.js +197 -194
  32. package/lib/input/fixedkeys.js +2 -2
  33. package/lib/input/gesturehandler.js +2 -2
  34. package/lib/input/keyboard.js +38 -158
  35. package/lib/input/keysym.js +2 -2
  36. package/lib/input/keysymdef.js +2 -2
  37. package/lib/input/util.js +34 -79
  38. package/lib/input/vkeys.js +2 -4
  39. package/lib/input/xtscancodes.js +11 -5
  40. package/lib/rfb.js +292 -286
  41. package/lib/util/browser.js +8 -26
  42. package/lib/util/cursor.js +4 -16
  43. package/lib/util/events.js +3 -5
  44. package/lib/util/eventtarget.js +3 -3
  45. package/lib/util/int.js +1 -1
  46. package/lib/util/logging.js +2 -2
  47. package/lib/vendor/pako/lib/utils/common.js +2 -2
  48. package/lib/vendor/pako/lib/zlib/adler32.js +1 -1
  49. package/lib/vendor/pako/lib/zlib/constants.js +2 -2
  50. package/lib/vendor/pako/lib/zlib/crc32.js +1 -1
  51. package/lib/vendor/pako/lib/zlib/deflate.js +113 -112
  52. package/lib/vendor/pako/lib/zlib/gzheader.js +1 -1
  53. package/lib/vendor/pako/lib/zlib/inffast.js +5 -5
  54. package/lib/vendor/pako/lib/zlib/inflate.js +50 -48
  55. package/lib/vendor/pako/lib/zlib/inftrees.js +3 -3
  56. package/lib/vendor/pako/lib/zlib/messages.js +2 -2
  57. package/lib/vendor/pako/lib/zlib/trees.js +4 -4
  58. package/lib/vendor/pako/lib/zlib/zstream.js +1 -1
  59. package/lib/websock.js +105 -44
  60. package/package.json +2 -7
  61. package/core/util/polyfill.js +0 -61
  62. package/lib/util/polyfill.js +0 -72
  63. package/lib/vendor/promise.js +0 -255
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports["default"] = void 0;
9
9
 
10
10
  var Log = _interopRequireWildcard(require("../util/logging.js"));
11
11
 
@@ -17,11 +17,11 @@ var _keysym = _interopRequireDefault(require("./keysym.js"));
17
17
 
18
18
  var browser = _interopRequireWildcard(require("../util/browser.js"));
19
19
 
20
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
21
 
22
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
 
24
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
26
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
27
 
@@ -40,17 +40,13 @@ var Keyboard = /*#__PURE__*/function () {
40
40
  this._keyDownList = {}; // List of depressed keys
41
41
  // (even if they are happy)
42
42
 
43
- this._pendingKey = null; // Key waiting for keypress
44
-
45
43
  this._altGrArmed = false; // Windows AltGr detection
46
44
  // keep these here so we can refer to them later
47
45
 
48
46
  this._eventHandlers = {
49
47
  'keyup': this._handleKeyUp.bind(this),
50
48
  'keydown': this._handleKeyDown.bind(this),
51
- 'keypress': this._handleKeyPress.bind(this),
52
- 'blur': this._allKeysUp.bind(this),
53
- 'checkalt': this._checkAlt.bind(this)
49
+ 'blur': this._allKeysUp.bind(this)
54
50
  }; // ===== EVENT HANDLERS =====
55
51
 
56
52
  this.onkeyevent = function () {}; // Handler for key press/release
@@ -83,11 +79,9 @@ var Keyboard = /*#__PURE__*/function () {
83
79
  if (code !== 'Unidentified') {
84
80
  return code;
85
81
  } // Unstable, but we don't have anything else to go on
86
- // (don't use it for 'keypress' events thought since
87
- // WebKit sets it to the same as charCode)
88
82
 
89
83
 
90
- if (e.keyCode && e.type !== 'keypress') {
84
+ if (e.keyCode) {
91
85
  // 229 is used for composition events
92
86
  if (e.keyCode !== 229) {
93
87
  return 'Platform' + e.keyCode;
@@ -103,8 +97,10 @@ var Keyboard = /*#__PURE__*/function () {
103
97
  }
104
98
 
105
99
  var codepoint = parseInt(e.keyIdentifier.substr(2), 16);
106
- var char = String.fromCharCode(codepoint).toUpperCase();
107
- return 'Platform' + char.charCodeAt();
100
+
101
+ var _char = String.fromCharCode(codepoint).toUpperCase();
102
+
103
+ return 'Platform' + _char.charCodeAt();
108
104
  }
109
105
 
110
106
  return 'Unidentified';
@@ -132,9 +128,9 @@ var Keyboard = /*#__PURE__*/function () {
132
128
  // even when AltGr is already down. Some
133
129
  // browsers detect this for us though and set the
134
130
  // key to "AltGraph".
135
- keysym = _keysym.default.XK_ISO_Level3_Shift;
131
+ keysym = _keysym["default"].XK_ISO_Level3_Shift;
136
132
  } else {
137
- this._sendKeyEvent(_keysym.default.XK_Control_L, "ControlLeft", true);
133
+ this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true);
138
134
  }
139
135
  } // We cannot handle keys we cannot track, but we also need
140
136
  // to deal with virtual keyboards which omit key info
@@ -160,20 +156,20 @@ var Keyboard = /*#__PURE__*/function () {
160
156
 
161
157
  if (browser.isMac() || browser.isIOS()) {
162
158
  switch (keysym) {
163
- case _keysym.default.XK_Super_L:
164
- keysym = _keysym.default.XK_Alt_L;
159
+ case _keysym["default"].XK_Super_L:
160
+ keysym = _keysym["default"].XK_Alt_L;
165
161
  break;
166
162
 
167
- case _keysym.default.XK_Super_R:
168
- keysym = _keysym.default.XK_Super_L;
163
+ case _keysym["default"].XK_Super_R:
164
+ keysym = _keysym["default"].XK_Super_L;
169
165
  break;
170
166
 
171
- case _keysym.default.XK_Alt_L:
172
- keysym = _keysym.default.XK_Mode_switch;
167
+ case _keysym["default"].XK_Alt_L:
168
+ keysym = _keysym["default"].XK_Mode_switch;
173
169
  break;
174
170
 
175
- case _keysym.default.XK_Alt_R:
176
- keysym = _keysym.default.XK_ISO_Level3_Shift;
171
+ case _keysym["default"].XK_Alt_R:
172
+ keysym = _keysym["default"].XK_ISO_Level3_Shift;
177
173
  break;
178
174
  }
179
175
  } // Is this key already pressed? If so, then we must use the
@@ -189,28 +185,27 @@ var Keyboard = /*#__PURE__*/function () {
189
185
 
190
186
 
191
187
  if ((browser.isMac() || browser.isIOS()) && code === 'CapsLock') {
192
- this._sendKeyEvent(_keysym.default.XK_Caps_Lock, 'CapsLock', true);
188
+ this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', true);
193
189
 
194
- this._sendKeyEvent(_keysym.default.XK_Caps_Lock, 'CapsLock', false);
190
+ this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', false);
195
191
 
196
192
  (0, _events.stopEvent)(e);
197
193
  return;
198
- } // If this is a legacy browser then we'll need to wait for
199
- // a keypress event as well
200
- // (IE and Edge has a broken KeyboardEvent.key, so we can't
201
- // just check for the presence of that field)
194
+ } // Windows doesn't send proper key releases for a bunch of
195
+ // Japanese IM keys so we have to fake the release right away
196
+
202
197
 
198
+ var jpBadKeys = [_keysym["default"].XK_Zenkaku_Hankaku, _keysym["default"].XK_Eisu_toggle, _keysym["default"].XK_Katakana, _keysym["default"].XK_Hiragana, _keysym["default"].XK_Romaji];
203
199
 
204
- if (!keysym && (!e.key || browser.isIE() || browser.isEdge())) {
205
- this._pendingKey = code; // However we might not get a keypress event if the key
206
- // is non-printable, which needs some special fallback
207
- // handling
200
+ if (browser.isWindows() && jpBadKeys.includes(keysym)) {
201
+ this._sendKeyEvent(keysym, code, true);
208
202
 
209
- setTimeout(this._handleKeyPressTimeout.bind(this), 10, e);
203
+ this._sendKeyEvent(keysym, code, false);
204
+
205
+ (0, _events.stopEvent)(e);
210
206
  return;
211
207
  }
212
208
 
213
- this._pendingKey = null;
214
209
  (0, _events.stopEvent)(e); // Possible start of AltGr sequence? (see above)
215
210
 
216
211
  if (code === "ControlLeft" && browser.isWindows() && !("ControlLeft" in this._keyDownList)) {
@@ -220,69 +215,6 @@ var Keyboard = /*#__PURE__*/function () {
220
215
  return;
221
216
  }
222
217
 
223
- this._sendKeyEvent(keysym, code, true);
224
- } // Legacy event for browsers without code/key
225
-
226
- }, {
227
- key: "_handleKeyPress",
228
- value: function _handleKeyPress(e) {
229
- (0, _events.stopEvent)(e); // Are we expecting a keypress?
230
-
231
- if (this._pendingKey === null) {
232
- return;
233
- }
234
-
235
- var code = this._getKeyCode(e);
236
-
237
- var keysym = KeyboardUtil.getKeysym(e); // The key we were waiting for?
238
-
239
- if (code !== 'Unidentified' && code != this._pendingKey) {
240
- return;
241
- }
242
-
243
- code = this._pendingKey;
244
- this._pendingKey = null;
245
-
246
- if (!keysym) {
247
- Log.Info('keypress with no keysym:', e);
248
- return;
249
- }
250
-
251
- this._sendKeyEvent(keysym, code, true);
252
- }
253
- }, {
254
- key: "_handleKeyPressTimeout",
255
- value: function _handleKeyPressTimeout(e) {
256
- // Did someone manage to sort out the key already?
257
- if (this._pendingKey === null) {
258
- return;
259
- }
260
-
261
- var keysym;
262
- var code = this._pendingKey;
263
- this._pendingKey = null; // We have no way of knowing the proper keysym with the
264
- // information given, but the following are true for most
265
- // layouts
266
-
267
- if (e.keyCode >= 0x30 && e.keyCode <= 0x39) {
268
- // Digit
269
- keysym = e.keyCode;
270
- } else if (e.keyCode >= 0x41 && e.keyCode <= 0x5a) {
271
- // Character (A-Z)
272
- var char = String.fromCharCode(e.keyCode); // A feeble attempt at the correct case
273
-
274
- if (e.shiftKey) {
275
- char = char.toUpperCase();
276
- } else {
277
- char = char.toLowerCase();
278
- }
279
-
280
- keysym = char.charCodeAt();
281
- } else {
282
- // Unknown, give up
283
- keysym = 0;
284
- }
285
-
286
218
  this._sendKeyEvent(keysym, code, true);
287
219
  }
288
220
  }, {
@@ -298,14 +230,14 @@ var Keyboard = /*#__PURE__*/function () {
298
230
  this._altGrArmed = false;
299
231
  clearTimeout(this._altGrTimeout);
300
232
 
301
- this._sendKeyEvent(_keysym.default.XK_Control_L, "ControlLeft", true);
233
+ this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true);
302
234
  } // See comment in _handleKeyDown()
303
235
 
304
236
 
305
237
  if ((browser.isMac() || browser.isIOS()) && code === 'CapsLock') {
306
- this._sendKeyEvent(_keysym.default.XK_Caps_Lock, 'CapsLock', true);
238
+ this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', true);
307
239
 
308
- this._sendKeyEvent(_keysym.default.XK_Caps_Lock, 'CapsLock', false);
240
+ this._sendKeyEvent(_keysym["default"].XK_Caps_Lock, 'CapsLock', false);
309
241
 
310
242
  return;
311
243
  }
@@ -331,7 +263,7 @@ var Keyboard = /*#__PURE__*/function () {
331
263
  this._altGrArmed = false;
332
264
  clearTimeout(this._altGrTimeout);
333
265
 
334
- this._sendKeyEvent(_keysym.default.XK_Control_L, "ControlLeft", true);
266
+ this._sendKeyEvent(_keysym["default"].XK_Control_L, "ControlLeft", true);
335
267
  }
336
268
  }, {
337
269
  key: "_allKeysUp",
@@ -343,33 +275,6 @@ var Keyboard = /*#__PURE__*/function () {
343
275
  }
344
276
 
345
277
  Log.Debug("<< Keyboard.allKeysUp");
346
- } // Alt workaround for Firefox on Windows, see below
347
-
348
- }, {
349
- key: "_checkAlt",
350
- value: function _checkAlt(e) {
351
- if (e.skipCheckAlt) {
352
- return;
353
- }
354
-
355
- if (e.altKey) {
356
- return;
357
- }
358
-
359
- var target = this._target;
360
- var downList = this._keyDownList;
361
- ['AltLeft', 'AltRight'].forEach(function (code) {
362
- if (!(code in downList)) {
363
- return;
364
- }
365
-
366
- var event = new KeyboardEvent('keyup', {
367
- key: downList[code],
368
- code: code
369
- });
370
- event.skipCheckAlt = true;
371
- target.dispatchEvent(event);
372
- });
373
278
  } // ===== PUBLIC METHODS =====
374
279
 
375
280
  }, {
@@ -378,44 +283,19 @@ var Keyboard = /*#__PURE__*/function () {
378
283
  //Log.Debug(">> Keyboard.grab");
379
284
  this._target.addEventListener('keydown', this._eventHandlers.keydown);
380
285
 
381
- this._target.addEventListener('keyup', this._eventHandlers.keyup);
286
+ this._target.addEventListener('keyup', this._eventHandlers.keyup); // Release (key up) if window loses focus
382
287
 
383
- this._target.addEventListener('keypress', this._eventHandlers.keypress); // Release (key up) if window loses focus
384
-
385
-
386
- window.addEventListener('blur', this._eventHandlers.blur); // Firefox on Windows has broken handling of Alt, so we need to
387
- // poll as best we can for releases (still doesn't prevent the
388
- // menu from popping up though as we can't call
389
- // preventDefault())
390
-
391
- if (browser.isWindows() && browser.isFirefox()) {
392
- var handler = this._eventHandlers.checkalt;
393
- ['mousedown', 'mouseup', 'mousemove', 'wheel', 'touchstart', 'touchend', 'touchmove', 'keydown', 'keyup'].forEach(function (type) {
394
- return document.addEventListener(type, handler, {
395
- capture: true,
396
- passive: true
397
- });
398
- });
399
- } //Log.Debug("<< Keyboard.grab");
400
288
 
289
+ window.addEventListener('blur', this._eventHandlers.blur); //Log.Debug("<< Keyboard.grab");
401
290
  }
402
291
  }, {
403
292
  key: "ungrab",
404
293
  value: function ungrab() {
405
294
  //Log.Debug(">> Keyboard.ungrab");
406
- if (browser.isWindows() && browser.isFirefox()) {
407
- var handler = this._eventHandlers.checkalt;
408
- ['mousedown', 'mouseup', 'mousemove', 'wheel', 'touchstart', 'touchend', 'touchmove', 'keydown', 'keyup'].forEach(function (type) {
409
- return document.removeEventListener(type, handler);
410
- });
411
- }
412
-
413
295
  this._target.removeEventListener('keydown', this._eventHandlers.keydown);
414
296
 
415
297
  this._target.removeEventListener('keyup', this._eventHandlers.keyup);
416
298
 
417
- this._target.removeEventListener('keypress', this._eventHandlers.keypress);
418
-
419
299
  window.removeEventListener('blur', this._eventHandlers.blur); // Release (key up) all keys that are in a down state
420
300
 
421
301
  this._allKeysUp(); //Log.Debug(">> Keyboard.ungrab");
@@ -426,4 +306,4 @@ var Keyboard = /*#__PURE__*/function () {
426
306
  return Keyboard;
427
307
  }();
428
308
 
429
- exports.default = Keyboard;
309
+ exports["default"] = Keyboard;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
 
8
8
  /* eslint-disable key-spacing */
9
9
  var _default = {
@@ -1132,4 +1132,4 @@ var _default = {
1132
1132
  XF86XK_LogWindowTree: 0x1008FE24,
1133
1133
  XF86XK_LogGrabInfo: 0x1008FE25
1134
1134
  };
1135
- exports.default = _default;
1135
+ exports["default"] = _default;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
 
8
8
  /*
9
9
  * Mapping from Unicode codepoints to X11/RFB keysyms
@@ -1351,4 +1351,4 @@ var _default = {
1351
1351
  return 0x01000000 | u;
1352
1352
  }
1353
1353
  };
1354
- exports.default = _default;
1354
+ exports["default"] = _default;
package/lib/input/util.js CHANGED
@@ -5,8 +5,8 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getKeycode = getKeycode;
9
8
  exports.getKey = getKey;
9
+ exports.getKeycode = getKeycode;
10
10
  exports.getKeysym = getKeysym;
11
11
 
12
12
  var _keysym = _interopRequireDefault(require("./keysym.js"));
@@ -21,11 +21,11 @@ var _domkeytable = _interopRequireDefault(require("./domkeytable.js"));
21
21
 
22
22
  var browser = _interopRequireWildcard(require("../util/browser.js"));
23
23
 
24
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
24
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
 
26
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
27
 
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
29
 
30
30
  // Get 'KeyboardEvent.code', handling legacy browsers
31
31
  function getKeycode(evt) {
@@ -45,12 +45,11 @@ function getKeycode(evt) {
45
45
 
46
46
  return evt.code;
47
47
  } // The de-facto standard is to use Windows Virtual-Key codes
48
- // in the 'keyCode' field for non-printable characters. However
49
- // Webkit sets it to the same as charCode in 'keypress' events.
48
+ // in the 'keyCode' field for non-printable characters
50
49
 
51
50
 
52
- if (evt.type !== 'keypress' && evt.keyCode in _vkeys.default) {
53
- var code = _vkeys.default[evt.keyCode]; // macOS has messed up this code for some reason
51
+ if (evt.keyCode in _vkeys["default"]) {
52
+ var code = _vkeys["default"][evt.keyCode]; // macOS has messed up this code for some reason
54
53
 
55
54
  if (browser.isMac() && code === 'ContextMenu') {
56
55
  code = 'MetaRight';
@@ -119,56 +118,7 @@ function getKeycode(evt) {
119
118
  function getKey(evt) {
120
119
  // Are we getting a proper key value?
121
120
  if (evt.key !== undefined) {
122
- // IE and Edge use some ancient version of the spec
123
- // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/
124
- switch (evt.key) {
125
- case 'Spacebar':
126
- return ' ';
127
-
128
- case 'Esc':
129
- return 'Escape';
130
-
131
- case 'Scroll':
132
- return 'ScrollLock';
133
-
134
- case 'Win':
135
- return 'Meta';
136
-
137
- case 'Apps':
138
- return 'ContextMenu';
139
-
140
- case 'Up':
141
- return 'ArrowUp';
142
-
143
- case 'Left':
144
- return 'ArrowLeft';
145
-
146
- case 'Right':
147
- return 'ArrowRight';
148
-
149
- case 'Down':
150
- return 'ArrowDown';
151
-
152
- case 'Del':
153
- return 'Delete';
154
-
155
- case 'Divide':
156
- return '/';
157
-
158
- case 'Multiply':
159
- return '*';
160
-
161
- case 'Subtract':
162
- return '-';
163
-
164
- case 'Add':
165
- return '+';
166
-
167
- case 'Decimal':
168
- return evt.char;
169
- } // Mozilla isn't fully in sync with the spec yet
170
-
171
-
121
+ // Mozilla isn't fully in sync with the spec yet
172
122
  switch (evt.key) {
173
123
  case 'OS':
174
124
  return 'Meta';
@@ -201,27 +151,16 @@ function getKey(evt) {
201
151
 
202
152
  if (evt.key === '\x00' && evt.code === 'NumpadDecimal') {
203
153
  return 'Delete';
204
- } // IE and Edge need special handling, but for everyone else we
205
- // can trust the value provided
206
-
207
-
208
- if (!browser.isIE() && !browser.isEdge()) {
209
- return evt.key;
210
- } // IE and Edge have broken handling of AltGraph so we can only
211
- // trust them for non-printable characters (and unfortunately
212
- // they also specify 'Unidentified' for some problem keys)
213
-
214
-
215
- if (evt.key.length !== 1 && evt.key !== 'Unidentified') {
216
- return evt.key;
217
154
  }
155
+
156
+ return evt.key;
218
157
  } // Try to deduce it based on the physical key
219
158
 
220
159
 
221
160
  var code = getKeycode(evt);
222
161
 
223
- if (code in _fixedkeys.default) {
224
- return _fixedkeys.default[code];
162
+ if (code in _fixedkeys["default"]) {
163
+ return _fixedkeys["default"][code];
225
164
  } // If that failed, then see if we have a printable character
226
165
 
227
166
 
@@ -242,7 +181,7 @@ function getKeysym(evt) {
242
181
  } // First look up special keys
243
182
 
244
183
 
245
- if (key in _domkeytable.default) {
184
+ if (key in _domkeytable["default"]) {
246
185
  var location = evt.location; // Safari screws up location for the right cmd key
247
186
 
248
187
  if (key === 'Meta' && location === 0) {
@@ -269,9 +208,9 @@ function getKeysym(evt) {
269
208
  var _code = getKeycode(evt);
270
209
 
271
210
  if (_code === 'AltLeft') {
272
- return _keysym.default.XK_Meta_L;
211
+ return _keysym["default"].XK_Meta_L;
273
212
  } else if (_code === 'AltRight') {
274
- return _keysym.default.XK_Meta_R;
213
+ return _keysym["default"].XK_Meta_R;
275
214
  }
276
215
  } // macOS has Clear instead of NumLock, but the remote system is
277
216
  // probably not macOS, so lying here is probably best...
@@ -281,11 +220,27 @@ function getKeysym(evt) {
281
220
  var _code2 = getKeycode(evt);
282
221
 
283
222
  if (_code2 === 'NumLock') {
284
- return _keysym.default.XK_Num_Lock;
223
+ return _keysym["default"].XK_Num_Lock;
224
+ }
225
+ } // Windows sends alternating symbols for some keys when using a
226
+ // Japanese layout. We have no way of synchronising with the IM
227
+ // running on the remote system, so we send some combined keysym
228
+ // instead and hope for the best.
229
+
230
+
231
+ if (browser.isWindows()) {
232
+ switch (key) {
233
+ case 'Zenkaku':
234
+ case 'Hankaku':
235
+ return _keysym["default"].XK_Zenkaku_Hankaku;
236
+
237
+ case 'Romaji':
238
+ case 'KanaMode':
239
+ return _keysym["default"].XK_Romaji;
285
240
  }
286
241
  }
287
242
 
288
- return _domkeytable.default[key][location];
243
+ return _domkeytable["default"][key][location];
289
244
  } // Now we need to look at the Unicode symbol instead
290
245
  // Special key? (FIXME: Should have been caught earlier)
291
246
 
@@ -297,7 +252,7 @@ function getKeysym(evt) {
297
252
  var codepoint = key.charCodeAt();
298
253
 
299
254
  if (codepoint) {
300
- return _keysymdef.default.lookup(codepoint);
255
+ return _keysymdef["default"].lookup(codepoint);
301
256
  }
302
257
 
303
258
  return null;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
 
8
8
  /*
9
9
  * noVNC: HTML5 VNC client
@@ -19,8 +19,6 @@ var _default = {
19
19
  0x08: 'Backspace',
20
20
  0x09: 'Tab',
21
21
  0x0a: 'NumpadClear',
22
- 0x0c: 'Numpad5',
23
- // IE11 sends evt.keyCode: 12 when numlock is off
24
22
  0x0d: 'Enter',
25
23
  0x10: 'ShiftLeft',
26
24
  0x11: 'ControlLeft',
@@ -124,4 +122,4 @@ var _default = {
124
122
  0xe1: 'AltRight' // Only when it is AltGraph
125
123
 
126
124
  };
127
- exports.default = _default;
125
+ exports["default"] = _default;
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
 
8
8
  /*
9
- * This file is auto-generated from keymaps.csv on 2017-05-31 16:20
10
- * Database checksum sha256(92fd165507f2a3b8c5b3fa56e425d45788dbcb98cf067a307527d91ce22cab94)
9
+ * This file is auto-generated from keymaps.csv
10
+ * Database checksum sha256(76d68c10e97d37fe2ea459e210125ae41796253fb217e900bf2983ade13a7920)
11
11
  * To re-generate, run:
12
- * keymap-gen --lang=js code-map keymaps.csv html atset1
12
+ * keymap-gen code-map --lang=js keymaps.csv html atset1
13
13
  */
14
14
  var _default = {
15
15
  "Again": 0xe005,
@@ -330,6 +330,12 @@ var _default = {
330
330
  "KeyZ": 0x2c,
331
331
 
332
332
  /* html:KeyZ (KeyZ) -> linux:44 (KEY_Z) -> atset1:44 */
333
+ "Lang1": 0x72,
334
+
335
+ /* html:Lang1 (Lang1) -> linux:122 (KEY_HANGEUL) -> atset1:114 */
336
+ "Lang2": 0x71,
337
+
338
+ /* html:Lang2 (Lang2) -> linux:123 (KEY_HANJA) -> atset1:113 */
333
339
  "Lang3": 0x78,
334
340
 
335
341
  /* html:Lang3 (Lang3) -> linux:90 (KEY_KATAKANA) -> atset1:120 */
@@ -502,4 +508,4 @@ var _default = {
502
508
  /* html:WakeUp (WakeUp) -> linux:143 (KEY_WAKEUP) -> atset1:57443 */
503
509
 
504
510
  };
505
- exports.default = _default;
511
+ exports["default"] = _default;