typeson-registry 14.4.0 → 14.6.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 (48) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +78 -12
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.min.js +1 -1
  6. package/dist/index.min.js.map +1 -1
  7. package/dist/index.umd.cjs +90 -11
  8. package/dist/index.umd.cjs.map +1 -1
  9. package/dist/index.umd.min.cjs +1 -1
  10. package/dist/index.umd.min.cjs.map +1 -1
  11. package/dist/polyfills/AudioData.d.ts.map +1 -1
  12. package/dist/polyfills/EncodedAudioChunk.d.ts.map +1 -1
  13. package/dist/polyfills/EncodedVideoChunk.d.ts.map +1 -1
  14. package/dist/polyfills/IDBKeyRange.d.ts +30 -0
  15. package/dist/polyfills/IDBKeyRange.d.ts.map +1 -0
  16. package/dist/polyfills/VideoFrame.d.ts.map +1 -1
  17. package/dist/polyfills/index.d.ts +1 -0
  18. package/dist/presets/structured-cloning-for-storage.umd.cjs +1 -1
  19. package/dist/presets/structured-cloning-for-storage.umd.cjs.map +1 -1
  20. package/dist/presets/structured-cloning-throwing.umd.cjs +1 -1
  21. package/dist/presets/structured-cloning-throwing.umd.cjs.map +1 -1
  22. package/dist/presets/structured-cloning.umd.cjs +1 -1
  23. package/dist/presets/structured-cloning.umd.cjs.map +1 -1
  24. package/dist/types/encodedaudiochunk.d.ts.map +1 -1
  25. package/dist/types/encodedaudiochunk.umd.cjs +1 -1
  26. package/dist/types/encodedaudiochunk.umd.cjs.map +1 -1
  27. package/dist/types/encodedvideochunk.d.ts.map +1 -1
  28. package/dist/types/encodedvideochunk.umd.cjs +1 -1
  29. package/dist/types/encodedvideochunk.umd.cjs.map +1 -1
  30. package/dist/types/idbkeyrange.d.ts +6 -0
  31. package/dist/types/idbkeyrange.d.ts.map +1 -0
  32. package/dist/types/idbkeyrange.umd.cjs +2 -0
  33. package/dist/types/idbkeyrange.umd.cjs.map +1 -0
  34. package/dist/types/imagedata.d.ts.map +1 -1
  35. package/dist/types/imagedata.umd.cjs +1 -1
  36. package/dist/types/imagedata.umd.cjs.map +1 -1
  37. package/dist/types/videoframe.d.ts.map +1 -1
  38. package/dist/types/videoframe.umd.cjs +1 -1
  39. package/dist/types/videoframe.umd.cjs.map +1 -1
  40. package/package.json +2 -2
  41. package/polyfills/AudioData.js +6 -1
  42. package/polyfills/EncodedAudioChunk.js +2 -1
  43. package/polyfills/EncodedVideoChunk.js +2 -1
  44. package/polyfills/IDBKeyRange.js +42 -0
  45. package/polyfills/VideoFrame.js +30 -7
  46. package/polyfills/index.cjs +90 -16
  47. package/polyfills/index.cjs.map +1 -1
  48. package/polyfills/index.js +1 -1
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ import error from './types/error.js';
19
19
  import errors from './types/errors.js';
20
20
  import file from './types/file.js';
21
21
  import filelist from './types/filelist.js';
22
+ import idbkeyrange from './types/idbkeyrange.js';
22
23
  import imagebitmap from './types/imagebitmap.js';
23
24
  import imagedata from './types/imagedata.js';
24
25
  import infinity from './types/infinity.js';
@@ -52,5 +53,5 @@ import structuredCloningThrowing from './presets/structured-cloning-throwing.js'
52
53
  import structuredCloning from './presets/structured-cloning.js';
53
54
  import undefPreset from './presets/undef.js';
54
55
  import universal from './presets/universal.js';
55
- export { arraybuffer, audiodata, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, file, filelist, imagebitmap, imagedata, infinity, intlTypes, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, symbol, typedArraysSocketio, typedArrays, undef, userObject, videoframe, webtransporterror, arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined, specialNumbers, structuredCloningForStorage, structuredCloningThrowing, structuredCloning, undefPreset, universal };
56
+ export { arraybuffer, audiodata, bigintObject, bigint, blob, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, file, filelist, idbkeyrange, imagebitmap, imagedata, infinity, intlTypes, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, symbol, typedArraysSocketio, typedArrays, undef, userObject, videoframe, webtransporterror, arrayNonindexKeys, builtin, postmessage, socketio, sparseUndefined, specialNumbers, structuredCloningForStorage, structuredCloningThrowing, structuredCloning, undefPreset, universal };
56
57
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";wBAGwB,wBAAwB;sBAC1B,sBAAsB;yBACnB,0BAA0B;mBAChC,mBAAmB;iBACrB,iBAAiB;sBACZ,sBAAsB;sBACtB,sBAAsB;qBACvB,qBAAqB;iBACzB,iBAAiB;yBACT,yBAAyB;sBAC5B,sBAAsB;qBACvB,qBAAqB;oBACtB,oBAAoB;oBACpB,oBAAoB;8BACV,8BAA8B;8BAC9B,8BAA8B;kBAC1C,kBAAkB;mBACjB,mBAAmB;iBACrB,iBAAiB;qBACb,qBAAqB;wBAClB,wBAAwB;sBAC1B,sBAAsB;qBACvB,qBAAqB;sBACpB,uBAAuB;gBAC7B,gBAAgB;gBAChB,gBAAgB;6BACH,8BAA8B;yBAClC,0BAA0B;6BACtB,8BAA8B;6BAC9B,8BAA8B;oBACvC,oBAAoB;+BACT,+BAA+B;mBAC3C,mBAAmB;0BACZ,0BAA0B;gBACpC,gBAAgB;mBACb,mBAAmB;gCACN,kCAAkC;wBAC1C,yBAAyB;kBAC/B,kBAAkB;uBACb,wBAAwB;uBACxB,uBAAuB;8BAChB,8BAA8B;8BAG9B,kCAAkC;oBAC5C,sBAAsB;wBAClB,0BAA0B;qBAC7B,uBAAuB;4BAChB,+BAA+B;2BAChC,8BAA8B;wCAErD,6CAA6C;sCAE7C,0CAA0C;8BAChB,iCAAiC;wBACvC,oBAAoB;sBACtB,wBAAwB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.js"],"names":[],"mappings":";wBAGwB,wBAAwB;sBAC1B,sBAAsB;yBACnB,0BAA0B;mBAChC,mBAAmB;iBACrB,iBAAiB;sBACZ,sBAAsB;sBACtB,sBAAsB;qBACvB,qBAAqB;iBACzB,iBAAiB;yBACT,yBAAyB;sBAC5B,sBAAsB;qBACvB,qBAAqB;oBACtB,oBAAoB;oBACpB,oBAAoB;8BACV,8BAA8B;8BAC9B,8BAA8B;kBAC1C,kBAAkB;mBACjB,mBAAmB;iBACrB,iBAAiB;qBACb,qBAAqB;wBAClB,wBAAwB;wBACxB,wBAAwB;sBAC1B,sBAAsB;qBACvB,qBAAqB;sBACpB,uBAAuB;gBAC7B,gBAAgB;gBAChB,gBAAgB;6BACH,8BAA8B;yBAClC,0BAA0B;6BACtB,8BAA8B;6BAC9B,8BAA8B;oBACvC,oBAAoB;+BACT,+BAA+B;mBAC3C,mBAAmB;0BACZ,0BAA0B;gBACpC,gBAAgB;mBACb,mBAAmB;gCACN,kCAAkC;wBAC1C,yBAAyB;kBAC/B,kBAAkB;uBACb,wBAAwB;uBACxB,uBAAuB;8BAChB,8BAA8B;8BAG9B,kCAAkC;oBAC5C,sBAAsB;wBAClB,0BAA0B;qBAC7B,uBAAuB;4BAChB,+BAA+B;2BAChC,8BAA8B;wCAErD,6CAA6C;sCAE7C,0CAA0C;8BAChB,iCAAiC;wBACvC,oBAAoB;sBACtB,wBAAwB"}
package/dist/index.js CHANGED
@@ -764,9 +764,16 @@ const encodedaudiochunk = {
764
764
  return {type, timestamp, duration, data};
765
765
  },
766
766
  revive ({type, timestamp, duration, data}) {
767
- return new EncodedAudioChunk({
768
- type, timestamp, duration, data: new Uint8Array(data)
769
- });
767
+ // A browser's `EncodedAudioChunkInit` has no `duration`
768
+ // default and coerces an explicit `null`/`undefined` to `0`,
769
+ // so only pass it through when the source chunk actually
770
+ // had one (otherwise `duration` must round-trip as `null`).
771
+ /** @type {EncodedAudioChunkInit} */
772
+ const init = {type, timestamp, data: new Uint8Array(data)};
773
+ if (duration !== null && duration !== undefined) {
774
+ init.duration = duration;
775
+ }
776
+ return new EncodedAudioChunk(init);
770
777
  }
771
778
  }
772
779
  };
@@ -788,9 +795,16 @@ const encodedvideochunk = {
788
795
  return {type, timestamp, duration, data};
789
796
  },
790
797
  revive ({type, timestamp, duration, data}) {
791
- return new EncodedVideoChunk({
792
- type, timestamp, duration, data: new Uint8Array(data)
793
- });
798
+ // A browser's `EncodedVideoChunkInit` has no `duration`
799
+ // default and coerces an explicit `null`/`undefined` to `0`,
800
+ // so only pass it through when the source chunk actually
801
+ // had one (otherwise `duration` must round-trip as `null`).
802
+ /** @type {EncodedVideoChunkInit} */
803
+ const init = {type, timestamp, data: new Uint8Array(data)};
804
+ if (duration !== null && duration !== undefined) {
805
+ init.duration = duration;
806
+ }
807
+ return new EncodedVideoChunk(init);
794
808
  }
795
809
  }
796
810
  };
@@ -1037,6 +1051,26 @@ const filelist = {
1037
1051
  }
1038
1052
  };
1039
1053
 
1054
+ /* globals IDBKeyRange -- Polyfill needed */
1055
+
1056
+
1057
+ /**
1058
+ * @type {import('typeson').TypeSpecSet}
1059
+ */
1060
+ const idbkeyrange = {
1061
+ idbkeyrange: {
1062
+ test (x) {
1063
+ return toStringTag(x) === 'IDBKeyRange';
1064
+ },
1065
+ replace ({lower, upper, lowerOpen, upperOpen}) {
1066
+ return {lower, upper, lowerOpen, upperOpen};
1067
+ },
1068
+ revive ({lower, upper, lowerOpen, upperOpen}) {
1069
+ return IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);
1070
+ }
1071
+ }
1072
+ };
1073
+
1040
1074
  /* globals document, OffscreenCanvas, createImageBitmap -- Polyfills */
1041
1075
  // `ImageBitmap` is browser / DOM specific. It also can only work
1042
1076
  // same-domain (or CORS)
@@ -1132,16 +1166,39 @@ const imagedata = {
1132
1166
  imagedata: {
1133
1167
  test (x) { return toStringTag(x) === 'ImageData'; },
1134
1168
  replace (d) {
1169
+ const pixelFormat = toStringTag(d.data) === 'Float16Array'
1170
+ /* c8 ignore next -- Not yet supported in `canvas` */
1171
+ ? 'rgba-float16'
1172
+ : 'rgba-unorm8';
1135
1173
  return {
1136
1174
  // Ensure `length` gets preserved for revival
1137
1175
  array: [...d.data],
1138
1176
  width: d.width,
1139
- height: d.height
1177
+ height: d.height,
1178
+ pixelFormat,
1179
+ colorSpace: d.colorSpace
1140
1180
  };
1141
1181
  },
1142
1182
  revive (o) {
1183
+ const {array, width, height, colorSpace, pixelFormat} = o;
1184
+ /* c8 ignore next 12 -- Not yet supported in `canvas` */
1185
+ if (pixelFormat === 'rgba-float16') {
1186
+ return new ImageData(
1187
+ // @ts-expect-error -- Ok
1188
+ new Float16Array(array),
1189
+ width,
1190
+ height,
1191
+ {
1192
+ colorSpace,
1193
+ pixelFormat
1194
+ }
1195
+ );
1196
+ }
1143
1197
  return new ImageData(
1144
- new Uint8ClampedArray(o.array), o.width, o.height
1198
+ new Uint8ClampedArray(array), width, height, {
1199
+ colorSpace,
1200
+ pixelFormat
1201
+ }
1145
1202
  );
1146
1203
  }
1147
1204
  }
@@ -1760,10 +1817,19 @@ const videoframe = {
1760
1817
  format, codedWidth, codedHeight, timestamp, duration,
1761
1818
  visibleRect, displayWidth, displayHeight, colorSpace, data
1762
1819
  }) {
1763
- return new VideoFrame(new Uint8Array(data), {
1764
- format, codedWidth, codedHeight, timestamp, duration,
1820
+ // A browser's `VideoFrameBufferInit` has no `duration` default
1821
+ // and coerces an explicit `null`/`undefined` to `0`, so only
1822
+ // pass it through when the source frame actually had one
1823
+ // (otherwise `duration` must round-trip as `null`).
1824
+ /** @type {VideoFrameBufferInit} */
1825
+ const init = {
1826
+ format, codedWidth, codedHeight, timestamp,
1765
1827
  visibleRect, displayWidth, displayHeight, colorSpace
1766
- });
1828
+ };
1829
+ if (duration !== null && duration !== undefined) {
1830
+ init.duration = duration;
1831
+ }
1832
+ return new VideoFrame(new Uint8Array(data), init);
1767
1833
  }
1768
1834
  }
1769
1835
  };
@@ -2210,5 +2276,5 @@ const universal = [
2210
2276
  // built-in into ecmasript standard.
2211
2277
  ];
2212
2278
 
2213
- export { c as JSON_TYPES, Typeson, TypesonPromise, Undefined, arrayNonindexKeys, arraybuffer, audiodata, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, hasConstructorOf, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningForStorage, structuredCloningThrowing, symbol, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject, videoframe, webtransporterror };
2279
+ export { c as JSON_TYPES, Typeson, TypesonPromise, Undefined, arrayNonindexKeys, arraybuffer, audiodata, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, encodedaudiochunk, encodedvideochunk, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, hasConstructorOf, idbkeyrange, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, promise, quotaexceedederror, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningForStorage, structuredCloningThrowing, symbol, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject, videoframe, webtransporterror };
2214
2280
  //# sourceMappingURL=index.js.map