typeson-registry 13.3.0 → 14.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 (102) hide show
  1. package/README.md +12 -2
  2. package/dist/index.d.cts +3 -0
  3. package/dist/index.d.cts.map +1 -0
  4. package/dist/index.d.ts +4 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +141 -21
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.min.js +2 -2
  9. package/dist/index.min.js.map +1 -1
  10. package/dist/index.umd.cjs +194 -20
  11. package/dist/index.umd.cjs.map +1 -1
  12. package/dist/index.umd.min.cjs +2 -2
  13. package/dist/index.umd.min.cjs.map +1 -1
  14. package/dist/polyfills/AudioData.d.ts +70 -0
  15. package/dist/polyfills/AudioData.d.ts.map +1 -0
  16. package/dist/polyfills/DOMMatrix.d.ts +43 -0
  17. package/dist/polyfills/DOMMatrix.d.ts.map +1 -0
  18. package/dist/polyfills/DOMMatrixReadOnly.d.ts +43 -0
  19. package/dist/polyfills/DOMMatrixReadOnly.d.ts.map +1 -0
  20. package/dist/polyfills/DOMPoint.d.ts +21 -0
  21. package/dist/polyfills/DOMPoint.d.ts.map +1 -0
  22. package/dist/polyfills/DOMPointReadOnly.d.ts +21 -0
  23. package/dist/polyfills/DOMPointReadOnly.d.ts.map +1 -0
  24. package/dist/polyfills/DOMQuad.d.ts +22 -0
  25. package/dist/polyfills/DOMQuad.d.ts.map +1 -0
  26. package/dist/polyfills/DOMRect.d.ts +25 -0
  27. package/dist/polyfills/DOMRect.d.ts.map +1 -0
  28. package/dist/polyfills/DOMRectReadOnly.d.ts +25 -0
  29. package/dist/polyfills/DOMRectReadOnly.d.ts.map +1 -0
  30. package/dist/polyfills/EncodedAudioChunk.d.ts +40 -0
  31. package/dist/polyfills/EncodedAudioChunk.d.ts.map +1 -0
  32. package/dist/polyfills/EncodedVideoChunk.d.ts +40 -0
  33. package/dist/polyfills/EncodedVideoChunk.d.ts.map +1 -0
  34. package/dist/polyfills/FileList.d.ts +21 -0
  35. package/dist/polyfills/FileList.d.ts.map +1 -0
  36. package/dist/polyfills/QuotaExceededError.d.ts +28 -0
  37. package/dist/polyfills/QuotaExceededError.d.ts.map +1 -0
  38. package/dist/polyfills/URL.d.ts +25 -0
  39. package/dist/polyfills/URL.d.ts.map +1 -0
  40. package/dist/polyfills/VideoFrame.d.ts +142 -0
  41. package/dist/polyfills/VideoFrame.d.ts.map +1 -0
  42. package/dist/polyfills/WebTransportError.d.ts +32 -0
  43. package/dist/polyfills/WebTransportError.d.ts.map +1 -0
  44. package/dist/polyfills/createImageBitmap.d.ts +14 -0
  45. package/dist/polyfills/createImageBitmap.d.ts.map +1 -0
  46. package/dist/polyfills/index.d.cts +3 -0
  47. package/dist/polyfills/index.d.cts.map +1 -0
  48. package/dist/polyfills/index.d.ts +16 -0
  49. package/dist/polyfills/index.d.ts.map +1 -0
  50. package/dist/presets/builtin.umd.cjs +1 -1
  51. package/dist/presets/builtin.umd.cjs.map +1 -1
  52. package/dist/presets/postmessage.d.ts.map +1 -1
  53. package/dist/presets/postmessage.umd.cjs.map +1 -1
  54. package/dist/presets/socketio.umd.cjs +1 -1
  55. package/dist/presets/socketio.umd.cjs.map +1 -1
  56. package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
  57. package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
  58. package/dist/presets/structured-cloning.d.ts.map +1 -1
  59. package/dist/presets/structured-cloning.umd.cjs +1 -1
  60. package/dist/presets/structured-cloning.umd.cjs.map +1 -1
  61. package/dist/presets/universal.umd.cjs +1 -1
  62. package/dist/presets/universal.umd.cjs.map +1 -1
  63. package/dist/types/encodedaudiochunk.d.ts +6 -0
  64. package/dist/types/encodedaudiochunk.d.ts.map +1 -0
  65. package/dist/types/encodedaudiochunk.umd.cjs +2 -0
  66. package/dist/types/encodedaudiochunk.umd.cjs.map +1 -0
  67. package/dist/types/encodedvideochunk.d.ts +6 -0
  68. package/dist/types/encodedvideochunk.d.ts.map +1 -0
  69. package/dist/types/encodedvideochunk.umd.cjs +2 -0
  70. package/dist/types/encodedvideochunk.umd.cjs.map +1 -0
  71. package/dist/types/errors.umd.cjs.map +1 -1
  72. package/dist/types/typed-arrays-socketio.umd.cjs +1 -1
  73. package/dist/types/typed-arrays-socketio.umd.cjs.map +1 -1
  74. package/dist/types/typed-arrays.d.ts +1 -1
  75. package/dist/types/typed-arrays.d.ts.map +1 -1
  76. package/dist/types/typed-arrays.umd.cjs +1 -1
  77. package/dist/types/typed-arrays.umd.cjs.map +1 -1
  78. package/dist/types/videoframe.d.ts +6 -0
  79. package/dist/types/videoframe.d.ts.map +1 -0
  80. package/dist/types/videoframe.umd.cjs +4 -0
  81. package/dist/types/videoframe.umd.cjs.map +1 -0
  82. package/package.json +16 -8
  83. package/polyfills/AudioData.js +173 -0
  84. package/polyfills/DOMMatrix.js +55 -0
  85. package/polyfills/DOMMatrixReadOnly.js +55 -0
  86. package/polyfills/DOMPoint.js +29 -0
  87. package/polyfills/DOMPointReadOnly.js +30 -0
  88. package/polyfills/DOMQuad.js +31 -0
  89. package/polyfills/DOMRect.js +31 -0
  90. package/polyfills/DOMRectReadOnly.js +31 -0
  91. package/polyfills/EncodedAudioChunk.js +74 -0
  92. package/polyfills/EncodedVideoChunk.js +74 -0
  93. package/polyfills/FileList.js +51 -0
  94. package/polyfills/QuotaExceededError.js +53 -0
  95. package/polyfills/VideoFrame.js +350 -0
  96. package/polyfills/WebTransportError.js +44 -0
  97. package/polyfills/createImageBitmap.js +22 -0
  98. package/polyfills/{createObjectURL.cjs → index.cjs} +1474 -4
  99. package/polyfills/index.cjs.map +1 -0
  100. package/polyfills/index.js +15 -0
  101. package/polyfills/createObjectURL.cjs.map +0 -1
  102. /package/polyfills/{createObjectURL.js → URL.js} +0 -0
@@ -1769,6 +1769,84 @@
1769
1769
  };
1770
1770
  }
1771
1771
 
1772
+ /* globals EncodedAudioChunk -- Polyfills */
1773
+
1774
+ /**
1775
+ * @type {import('typeson').TypeSpecSet}
1776
+ */
1777
+ var encodedaudiochunk = {
1778
+ encodedaudiochunk: {
1779
+ test: function test(x) {
1780
+ return toStringTag(x) === 'EncodedAudioChunk';
1781
+ },
1782
+ replace: function replace(chunk) {
1783
+ var type = chunk.type,
1784
+ timestamp = chunk.timestamp,
1785
+ duration = chunk.duration,
1786
+ byteLength = chunk.byteLength;
1787
+ var data = new ArrayBuffer(byteLength);
1788
+ chunk.copyTo(data);
1789
+ return {
1790
+ type: type,
1791
+ timestamp: timestamp,
1792
+ duration: duration,
1793
+ data: data
1794
+ };
1795
+ },
1796
+ revive: function revive(_ref) {
1797
+ var type = _ref.type,
1798
+ timestamp = _ref.timestamp,
1799
+ duration = _ref.duration,
1800
+ data = _ref.data;
1801
+ return new EncodedAudioChunk({
1802
+ type: type,
1803
+ timestamp: timestamp,
1804
+ duration: duration,
1805
+ data: new Uint8Array(data)
1806
+ });
1807
+ }
1808
+ }
1809
+ };
1810
+
1811
+ /* globals EncodedVideoChunk -- Polyfills */
1812
+
1813
+ /**
1814
+ * @type {import('typeson').TypeSpecSet}
1815
+ */
1816
+ var encodedvideochunk = {
1817
+ encodedvideochunk: {
1818
+ test: function test(x) {
1819
+ return toStringTag(x) === 'EncodedVideoChunk';
1820
+ },
1821
+ replace: function replace(chunk) {
1822
+ var type = chunk.type,
1823
+ timestamp = chunk.timestamp,
1824
+ duration = chunk.duration,
1825
+ byteLength = chunk.byteLength;
1826
+ var data = new ArrayBuffer(byteLength);
1827
+ chunk.copyTo(data);
1828
+ return {
1829
+ type: type,
1830
+ timestamp: timestamp,
1831
+ duration: duration,
1832
+ data: data
1833
+ };
1834
+ },
1835
+ revive: function revive(_ref) {
1836
+ var type = _ref.type,
1837
+ timestamp = _ref.timestamp,
1838
+ duration = _ref.duration,
1839
+ data = _ref.data;
1840
+ return new EncodedVideoChunk({
1841
+ type: type,
1842
+ timestamp: timestamp,
1843
+ duration: duration,
1844
+ data: new Uint8Array(data)
1845
+ });
1846
+ }
1847
+ }
1848
+ };
1849
+
1772
1850
  /**
1773
1851
  * @type {import('typeson').TypeSpecSet}
1774
1852
  */
@@ -1856,10 +1934,10 @@
1856
1934
 
1857
1935
  /**
1858
1936
  * Comprises all built-in errors.
1859
- * @param {TypeErrorConstructor|RangeErrorConstructor|
1860
- * SyntaxErrorConstructor|ReferenceErrorConstructor|
1861
- * EvalErrorConstructor|URIErrorConstructor|
1862
- * AggregateErrorConstructor|InternalErrorConstructor
1937
+ * @param {TypeErrorConstructor|RangeErrorConstructor
1938
+ * |SyntaxErrorConstructor|ReferenceErrorConstructor
1939
+ * |EvalErrorConstructor|URIErrorConstructor
1940
+ * |AggregateErrorConstructor|InternalErrorConstructor
1863
1941
  * } Ctor
1864
1942
  * @returns {void}
1865
1943
  */
@@ -2527,12 +2605,12 @@
2527
2605
  var typedArraysSocketIO = {};
2528
2606
 
2529
2607
  /**
2530
- * @param {Int8ArrayConstructor|Uint8ArrayConstructor|
2531
- * Uint8ClampedArrayConstructor|Int16ArrayConstructor|
2532
- * Uint16ArrayConstructor|Int32ArrayConstructor|
2533
- * Uint32ArrayConstructor|Float32ArrayConstructor|
2534
- * Float64ArrayConstructor|
2535
- * BigInt64ArrayConstructor|BigUint64ArrayConstructor
2608
+ * @param {Int8ArrayConstructor|Uint8ArrayConstructor
2609
+ * |Uint8ClampedArrayConstructor|Int16ArrayConstructor
2610
+ * |Uint16ArrayConstructor|Int32ArrayConstructor
2611
+ * |Uint32ArrayConstructor|Float32ArrayConstructor
2612
+ * |Float64ArrayConstructor|Float16ArrayConstructor
2613
+ * |BigInt64ArrayConstructor|BigUint64ArrayConstructor
2536
2614
  * } TypedArray
2537
2615
  * @returns {void}
2538
2616
  */
@@ -2566,6 +2644,7 @@
2566
2644
  // If we have Int8Array, we can assume the rest also exists.
2567
2645
 
2568
2646
  [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].concat(_toConsumableArray(typeof BigInt64Array === 'function' ? [BigInt64Array, BigUint64Array]
2647
+ /* c8 ignore next */ : []), _toConsumableArray(typeof Float16Array === 'function' ? [Float16Array]
2569
2648
  /* c8 ignore next */ : [])).forEach(function (TypedArray) {
2570
2649
  return create$1(TypedArray);
2571
2650
  });
@@ -2577,13 +2656,14 @@
2577
2656
  var typedArrays = {};
2578
2657
 
2579
2658
  /**
2580
- * @typedef {Int8ArrayConstructor|Uint8ArrayConstructor|
2581
- * Uint8ClampedArrayConstructor|
2582
- * Int16ArrayConstructor|Uint16ArrayConstructor|
2583
- * Int32ArrayConstructor|Uint32ArrayConstructor|
2584
- * Float32ArrayConstructor|
2585
- * Float64ArrayConstructor|
2586
- * BigInt64ArrayConstructor|BigUint64ArrayConstructor} TypedArrayConstructor
2659
+ * @typedef {Int8ArrayConstructor|Uint8ArrayConstructor
2660
+ * |Uint8ClampedArrayConstructor
2661
+ * |Int16ArrayConstructor|Uint16ArrayConstructor
2662
+ * |Int32ArrayConstructor|Uint32ArrayConstructor
2663
+ * |Float32ArrayConstructor
2664
+ * |Float64ArrayConstructor
2665
+ * |BigInt64ArrayConstructor|BigUint64ArrayConstructor
2666
+ * |Float16ArrayConstructor} TypedArrayConstructor
2587
2667
  */
2588
2668
 
2589
2669
  /**
@@ -2659,6 +2739,7 @@
2659
2739
  // Those constructors are added in ES6 as a group.
2660
2740
  // If we have Int8Array, we can assume the rest also exists.
2661
2741
  [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array].concat(_toConsumableArray(typeof BigInt64Array === 'function' ? [BigInt64Array, BigUint64Array]
2742
+ /* c8 ignore next */ : []), _toConsumableArray(typeof Float16Array === 'function' ? [Float16Array]
2662
2743
  /* c8 ignore next */ : [])).forEach(function (TypedArray) {
2663
2744
  return create(TypedArray);
2664
2745
  });
@@ -2703,6 +2784,92 @@
2703
2784
  }
2704
2785
  };
2705
2786
 
2787
+ /**
2788
+ * @type {import('typeson').TypeSpecSet}
2789
+ */
2790
+ var videoframe = {
2791
+ videoframe: {
2792
+ test: function test(x) {
2793
+ return toStringTag(x) === 'VideoFrame';
2794
+ },
2795
+ replaceAsync: function replaceAsync(frame) {
2796
+ return new TypesonPromise(/*#__PURE__*/function () {
2797
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve, reject) {
2798
+ var format, codedWidth, codedHeight, timestamp, duration, visibleRect, displayWidth, displayHeight, colorSpace, data, _t;
2799
+ return _regenerator().w(function (_context) {
2800
+ while (1) switch (_context.p = _context.n) {
2801
+ case 0:
2802
+ _context.p = 0;
2803
+ format = frame.format, codedWidth = frame.codedWidth, codedHeight = frame.codedHeight, timestamp = frame.timestamp, duration = frame.duration, visibleRect = frame.visibleRect, displayWidth = frame.displayWidth, displayHeight = frame.displayHeight, colorSpace = frame.colorSpace;
2804
+ data = new ArrayBuffer(frame.allocationSize());
2805
+ _context.n = 1;
2806
+ return frame.copyTo(data);
2807
+ case 1:
2808
+ resolve({
2809
+ format: format,
2810
+ codedWidth: codedWidth,
2811
+ codedHeight: codedHeight,
2812
+ timestamp: timestamp,
2813
+ duration: duration,
2814
+ visibleRect: {
2815
+ x: visibleRect.x,
2816
+ y: visibleRect.y,
2817
+ width: visibleRect.width,
2818
+ height: visibleRect.height
2819
+ },
2820
+ displayWidth: displayWidth,
2821
+ displayHeight: displayHeight,
2822
+ colorSpace: {
2823
+ primaries: colorSpace.primaries,
2824
+ transfer: colorSpace.transfer,
2825
+ matrix: colorSpace.matrix,
2826
+ fullRange: colorSpace.fullRange
2827
+ },
2828
+ data: data
2829
+ });
2830
+ /* c8 ignore next 3 -- How to simulate? */
2831
+ _context.n = 3;
2832
+ break;
2833
+ case 2:
2834
+ _context.p = 2;
2835
+ _t = _context.v;
2836
+ reject(_t);
2837
+ case 3:
2838
+ return _context.a(2);
2839
+ }
2840
+ }, _callee, null, [[0, 2]]);
2841
+ }));
2842
+ return function (_x, _x2) {
2843
+ return _ref.apply(this, arguments);
2844
+ };
2845
+ }());
2846
+ },
2847
+ revive: function revive(_ref2) {
2848
+ var format = _ref2.format,
2849
+ codedWidth = _ref2.codedWidth,
2850
+ codedHeight = _ref2.codedHeight,
2851
+ timestamp = _ref2.timestamp,
2852
+ duration = _ref2.duration,
2853
+ visibleRect = _ref2.visibleRect,
2854
+ displayWidth = _ref2.displayWidth,
2855
+ displayHeight = _ref2.displayHeight,
2856
+ colorSpace = _ref2.colorSpace,
2857
+ data = _ref2.data;
2858
+ return new VideoFrame(new Uint8Array(data), {
2859
+ format: format,
2860
+ codedWidth: codedWidth,
2861
+ codedHeight: codedHeight,
2862
+ timestamp: timestamp,
2863
+ duration: duration,
2864
+ visibleRect: visibleRect,
2865
+ displayWidth: displayWidth,
2866
+ displayHeight: displayHeight,
2867
+ colorSpace: colorSpace
2868
+ });
2869
+ }
2870
+ }
2871
+ };
2872
+
2706
2873
  /* globals WebTransportError -- Newer API */
2707
2874
 
2708
2875
  /**
@@ -2853,8 +3020,9 @@
2853
3020
  DOM types. Therefore, only types that are not included in the structured clone
2854
3021
  algorithm need to be registered, which is:
2855
3022
 
2856
- * Error
2857
- * Specific Errors like SyntaxError, TypeError, etc.
3023
+ * Error (now included in structured cloning)
3024
+ * Specific Errors like SyntaxError, TypeError, etc. (now included in structured
3025
+ * cloning)
2858
3026
  * Any custom type you want to send across window- or worker boundraries
2859
3027
 
2860
3028
  This preset will only include the Error types and you can register your
@@ -2938,7 +3106,10 @@
2938
3106
  typeof DOMPoint !== 'undefined' ? dompoint : [], /* c8 ignore next */
2939
3107
  typeof DOMQuad !== 'undefined' ? domquad : [], /* c8 ignore next */
2940
3108
  typeof DOMMatrix !== 'undefined' ? dommatrix : [], /* c8 ignore next */
2941
- typeof AudioData !== 'undefined' ? audiodata : []);
3109
+ typeof AudioData !== 'undefined' ? audiodata : [], /* c8 ignore next */
3110
+ typeof EncodedAudioChunk !== 'undefined' ? encodedaudiochunk : [], /* c8 ignore next */
3111
+ typeof EncodedVideoChunk !== 'undefined' ? encodedvideochunk : [], /* c8 ignore next */
3112
+ typeof VideoFrame !== 'undefined' ? videoframe : []);
2942
3113
 
2943
3114
  /**
2944
3115
  * @param {BufferSource} buffer
@@ -3067,6 +3238,8 @@
3067
3238
  exports.dompoint = dompoint;
3068
3239
  exports.domquad = domquad;
3069
3240
  exports.domrect = domrect;
3241
+ exports.encodedaudiochunk = encodedaudiochunk;
3242
+ exports.encodedvideochunk = encodedvideochunk;
3070
3243
  exports.error = error;
3071
3244
  exports.errors = errors;
3072
3245
  exports.escapeKeyPathComponent = escapeKeyPathComponent;
@@ -3110,6 +3283,7 @@
3110
3283
  exports.unescapeKeyPathComponent = unescapeKeyPathComponent;
3111
3284
  exports.universal = universal;
3112
3285
  exports.userObject = userObject;
3286
+ exports.videoframe = videoframe;
3113
3287
  exports.webtransporterror = webtransporterror;
3114
3288
 
3115
3289
  }));