@novnc/novnc 1.2.0 → 1.3.0-g0ef7582

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 (75) hide show
  1. package/LICENSE.txt +0 -6
  2. package/README.md +16 -6
  3. package/core/decoders/copyrect.js +5 -0
  4. package/core/decoders/hextile.js +57 -3
  5. package/core/decoders/jpeg.js +141 -0
  6. package/core/decoders/raw.js +12 -2
  7. package/core/decoders/tight.js +24 -8
  8. package/core/decoders/zrle.js +185 -0
  9. package/core/display.js +21 -151
  10. package/core/encodings.js +4 -0
  11. package/core/input/domkeytable.js +25 -21
  12. package/core/input/keyboard.js +22 -127
  13. package/core/input/util.js +18 -35
  14. package/core/input/vkeys.js +0 -1
  15. package/core/input/xtscancodes.js +5 -3
  16. package/core/ra2.js +567 -0
  17. package/core/rfb.js +487 -171
  18. package/core/util/browser.js +0 -17
  19. package/core/util/cursor.js +1 -11
  20. package/core/util/events.js +0 -4
  21. package/core/util/md5.js +79 -0
  22. package/core/websock.js +76 -17
  23. package/docs/API.md +107 -6
  24. package/docs/LIBRARY.md +3 -7
  25. package/lib/base64.js +24 -38
  26. package/lib/decoders/copyrect.js +6 -11
  27. package/lib/decoders/hextile.js +68 -44
  28. package/lib/decoders/jpeg.js +146 -0
  29. package/lib/decoders/raw.js +14 -21
  30. package/lib/decoders/rre.js +3 -17
  31. package/lib/decoders/tight.js +43 -93
  32. package/lib/decoders/tightpng.js +11 -33
  33. package/lib/decoders/zrle.js +185 -0
  34. package/lib/deflator.js +9 -26
  35. package/lib/des.js +22 -38
  36. package/lib/display.js +100 -315
  37. package/lib/encodings.js +7 -8
  38. package/lib/inflator.js +6 -22
  39. package/lib/input/domkeytable.js +240 -208
  40. package/lib/input/fixedkeys.js +10 -5
  41. package/lib/input/gesturehandler.js +84 -154
  42. package/lib/input/keyboard.js +87 -238
  43. package/lib/input/keysym.js +16 -272
  44. package/lib/input/keysymdef.js +7 -9
  45. package/lib/input/util.js +69 -156
  46. package/lib/input/vkeys.js +2 -7
  47. package/lib/input/xtscancodes.js +10 -171
  48. package/lib/ra2.js +1033 -0
  49. package/lib/rfb.js +947 -1149
  50. package/lib/util/browser.js +25 -52
  51. package/lib/util/cursor.js +25 -81
  52. package/lib/util/element.js +3 -5
  53. package/lib/util/events.js +26 -35
  54. package/lib/util/eventtarget.js +4 -16
  55. package/lib/util/int.js +2 -3
  56. package/lib/util/logging.js +3 -21
  57. package/lib/util/md5.js +83 -0
  58. package/lib/util/strings.js +3 -5
  59. package/lib/vendor/pako/lib/utils/common.js +10 -19
  60. package/lib/vendor/pako/lib/zlib/adler32.js +4 -8
  61. package/lib/vendor/pako/lib/zlib/constants.js +4 -7
  62. package/lib/vendor/pako/lib/zlib/crc32.js +6 -13
  63. package/lib/vendor/pako/lib/zlib/deflate.js +304 -708
  64. package/lib/vendor/pako/lib/zlib/gzheader.js +2 -14
  65. package/lib/vendor/pako/lib/zlib/inffast.js +61 -177
  66. package/lib/vendor/pako/lib/zlib/inflate.js +421 -909
  67. package/lib/vendor/pako/lib/zlib/inftrees.js +66 -172
  68. package/lib/vendor/pako/lib/zlib/messages.js +3 -13
  69. package/lib/vendor/pako/lib/zlib/trees.js +250 -592
  70. package/lib/vendor/pako/lib/zlib/zstream.js +3 -19
  71. package/lib/websock.js +119 -111
  72. package/package.json +2 -10
  73. package/core/util/polyfill.js +0 -61
  74. package/lib/util/polyfill.js +0 -72
  75. package/lib/vendor/promise.js +0 -255
@@ -1,255 +0,0 @@
1
- /* Copyright (c) 2014 Taylor Hakes
2
- * Copyright (c) 2014 Forbes Lindesay
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- * THE SOFTWARE.
21
- */
22
-
23
- (function (root) {
24
-
25
- // Store setTimeout reference so promise-polyfill will be unaffected by
26
- // other code modifying setTimeout (like sinon.useFakeTimers())
27
- var setTimeoutFunc = setTimeout;
28
-
29
- function noop() {}
30
-
31
- // Polyfill for Function.prototype.bind
32
- function bind(fn, thisArg) {
33
- return function () {
34
- fn.apply(thisArg, arguments);
35
- };
36
- }
37
-
38
- function Promise(fn) {
39
- if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
40
- if (typeof fn !== 'function') throw new TypeError('not a function');
41
- this._state = 0;
42
- this._handled = false;
43
- this._value = undefined;
44
- this._deferreds = [];
45
-
46
- doResolve(fn, this);
47
- }
48
-
49
- function handle(self, deferred) {
50
- while (self._state === 3) {
51
- self = self._value;
52
- }
53
- if (self._state === 0) {
54
- self._deferreds.push(deferred);
55
- return;
56
- }
57
- self._handled = true;
58
- Promise._immediateFn(function () {
59
- var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
60
- if (cb === null) {
61
- (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
62
- return;
63
- }
64
- var ret;
65
- try {
66
- ret = cb(self._value);
67
- } catch (e) {
68
- reject(deferred.promise, e);
69
- return;
70
- }
71
- resolve(deferred.promise, ret);
72
- });
73
- }
74
-
75
- function resolve(self, newValue) {
76
- try {
77
- // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
78
- if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.');
79
- if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {
80
- var then = newValue.then;
81
- if (newValue instanceof Promise) {
82
- self._state = 3;
83
- self._value = newValue;
84
- finale(self);
85
- return;
86
- } else if (typeof then === 'function') {
87
- doResolve(bind(then, newValue), self);
88
- return;
89
- }
90
- }
91
- self._state = 1;
92
- self._value = newValue;
93
- finale(self);
94
- } catch (e) {
95
- reject(self, e);
96
- }
97
- }
98
-
99
- function reject(self, newValue) {
100
- self._state = 2;
101
- self._value = newValue;
102
- finale(self);
103
- }
104
-
105
- function finale(self) {
106
- if (self._state === 2 && self._deferreds.length === 0) {
107
- Promise._immediateFn(function() {
108
- if (!self._handled) {
109
- Promise._unhandledRejectionFn(self._value);
110
- }
111
- });
112
- }
113
-
114
- for (var i = 0, len = self._deferreds.length; i < len; i++) {
115
- handle(self, self._deferreds[i]);
116
- }
117
- self._deferreds = null;
118
- }
119
-
120
- function Handler(onFulfilled, onRejected, promise) {
121
- this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
122
- this.onRejected = typeof onRejected === 'function' ? onRejected : null;
123
- this.promise = promise;
124
- }
125
-
126
- /**
127
- * Take a potentially misbehaving resolver function and make sure
128
- * onFulfilled and onRejected are only called once.
129
- *
130
- * Makes no guarantees about asynchrony.
131
- */
132
- function doResolve(fn, self) {
133
- var done = false;
134
- try {
135
- fn(function (value) {
136
- if (done) return;
137
- done = true;
138
- resolve(self, value);
139
- }, function (reason) {
140
- if (done) return;
141
- done = true;
142
- reject(self, reason);
143
- });
144
- } catch (ex) {
145
- if (done) return;
146
- done = true;
147
- reject(self, ex);
148
- }
149
- }
150
-
151
- Promise.prototype['catch'] = function (onRejected) {
152
- return this.then(null, onRejected);
153
- };
154
-
155
- Promise.prototype.then = function (onFulfilled, onRejected) {
156
- var prom = new (this.constructor)(noop);
157
-
158
- handle(this, new Handler(onFulfilled, onRejected, prom));
159
- return prom;
160
- };
161
-
162
- Promise.all = function (arr) {
163
- var args = Array.prototype.slice.call(arr);
164
-
165
- return new Promise(function (resolve, reject) {
166
- if (args.length === 0) return resolve([]);
167
- var remaining = args.length;
168
-
169
- function res(i, val) {
170
- try {
171
- if (val && (typeof val === 'object' || typeof val === 'function')) {
172
- var then = val.then;
173
- if (typeof then === 'function') {
174
- then.call(val, function (val) {
175
- res(i, val);
176
- }, reject);
177
- return;
178
- }
179
- }
180
- args[i] = val;
181
- if (--remaining === 0) {
182
- resolve(args);
183
- }
184
- } catch (ex) {
185
- reject(ex);
186
- }
187
- }
188
-
189
- for (var i = 0; i < args.length; i++) {
190
- res(i, args[i]);
191
- }
192
- });
193
- };
194
-
195
- Promise.resolve = function (value) {
196
- if (value && typeof value === 'object' && value.constructor === Promise) {
197
- return value;
198
- }
199
-
200
- return new Promise(function (resolve) {
201
- resolve(value);
202
- });
203
- };
204
-
205
- Promise.reject = function (value) {
206
- return new Promise(function (resolve, reject) {
207
- reject(value);
208
- });
209
- };
210
-
211
- Promise.race = function (values) {
212
- return new Promise(function (resolve, reject) {
213
- for (var i = 0, len = values.length; i < len; i++) {
214
- values[i].then(resolve, reject);
215
- }
216
- });
217
- };
218
-
219
- // Use polyfill for setImmediate for performance gains
220
- Promise._immediateFn = (typeof setImmediate === 'function' && function (fn) { setImmediate(fn); }) ||
221
- function (fn) {
222
- setTimeoutFunc(fn, 0);
223
- };
224
-
225
- Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
226
- if (typeof console !== 'undefined' && console) {
227
- console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
228
- }
229
- };
230
-
231
- /**
232
- * Set the immediate function to execute callbacks
233
- * @param fn {function} Function to execute
234
- * @deprecated
235
- */
236
- Promise._setImmediateFn = function _setImmediateFn(fn) {
237
- Promise._immediateFn = fn;
238
- };
239
-
240
- /**
241
- * Change the function to execute on unhandled rejection
242
- * @param {function} fn Function to execute on unhandled rejection
243
- * @deprecated
244
- */
245
- Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {
246
- Promise._unhandledRejectionFn = fn;
247
- };
248
-
249
- if (typeof module !== 'undefined' && module.exports) {
250
- module.exports = Promise;
251
- } else if (!root.Promise) {
252
- root.Promise = Promise;
253
- }
254
-
255
- })(this);