@es-joy/jsoe 0.13.8 → 0.15.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 (73) hide show
  1. package/.eslintrc.cjs +7 -0
  2. package/.nyc_output/out.json +20068 -11970
  3. package/CHANGES.md +10 -0
  4. package/README.md +10 -21
  5. package/demo/index.js +79 -2
  6. package/dist/formats/indexedDBKey.d.ts.map +1 -1
  7. package/dist/formats/structuredCloning.d.ts.map +1 -1
  8. package/dist/fundamentalTypes/BooleanObjectType.d.ts.map +1 -1
  9. package/dist/fundamentalTypes/NumberObjectType.d.ts.map +1 -1
  10. package/dist/fundamentalTypes/StringObjectType.d.ts.map +1 -1
  11. package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
  12. package/dist/fundamentalTypes/blobType.d.ts.map +1 -1
  13. package/dist/fundamentalTypes/dateType.d.ts.map +1 -1
  14. package/dist/fundamentalTypes/fileType.d.ts.map +1 -1
  15. package/dist/fundamentalTypes/filelistType.d.ts.map +1 -1
  16. package/dist/fundamentalTypes/mapType.d.ts.map +1 -1
  17. package/dist/fundamentalTypes/noneditableType.d.ts +6 -0
  18. package/dist/fundamentalTypes/noneditableType.d.ts.map +1 -0
  19. package/dist/fundamentalTypes/objectReferenceType.d.ts.map +1 -1
  20. package/dist/fundamentalTypes/objectType.d.ts.map +1 -1
  21. package/dist/fundamentalTypes/setType.d.ts.map +1 -1
  22. package/dist/fundamentalTypes/sparseUndefinedType.d.ts.map +1 -1
  23. package/dist/fundamentalTypes/undefinedType.d.ts.map +1 -1
  24. package/dist/index.js +1980 -237
  25. package/dist/superTypes/SpecialNumberType.d.ts +2 -10
  26. package/dist/superTypes/SpecialNumberType.d.ts.map +1 -1
  27. package/dist/superTypes/SpecialRealNumberType.d.ts +2 -2
  28. package/dist/superTypes/SpecialRealNumberType.d.ts.map +1 -1
  29. package/dist/superTypes/buffersourceType.d.ts +8 -0
  30. package/dist/superTypes/buffersourceType.d.ts.map +1 -0
  31. package/dist/superTypes/dommatrixType.d.ts +6 -0
  32. package/dist/superTypes/dommatrixType.d.ts.map +1 -0
  33. package/dist/superTypes/dompointType.d.ts +6 -0
  34. package/dist/superTypes/dompointType.d.ts.map +1 -0
  35. package/dist/superTypes/domrectType.d.ts +6 -0
  36. package/dist/superTypes/domrectType.d.ts.map +1 -0
  37. package/dist/superTypes/errorsSpecialType.d.ts +2 -2
  38. package/dist/superTypes/errorsSpecialType.d.ts.map +1 -1
  39. package/dist/types.d.ts +29 -17
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/utils/media.d.ts.map +1 -1
  42. package/dist/vendor-imports.d.ts +1 -1
  43. package/package.json +13 -13
  44. package/src/formats/indexedDBKey.js +2 -3
  45. package/src/formats/structuredCloning.js +37 -20
  46. package/src/fundamentalTypes/BooleanObjectType.js +3 -1
  47. package/src/fundamentalTypes/NumberObjectType.js +3 -1
  48. package/src/fundamentalTypes/StringObjectType.js +3 -1
  49. package/src/fundamentalTypes/arrayType.js +4 -2
  50. package/src/fundamentalTypes/blobType.js +17 -13
  51. package/src/fundamentalTypes/dateType.js +6 -2
  52. package/src/fundamentalTypes/fileType.js +14 -12
  53. package/src/fundamentalTypes/filelistType.js +3 -1
  54. package/src/fundamentalTypes/mapType.js +3 -1
  55. package/src/fundamentalTypes/noneditableType.js +87 -0
  56. package/src/fundamentalTypes/objectReferenceType.js +3 -1
  57. package/src/fundamentalTypes/objectType.js +3 -1
  58. package/src/fundamentalTypes/setType.js +3 -1
  59. package/src/fundamentalTypes/sparseUndefinedType.js +3 -1
  60. package/src/fundamentalTypes/undefinedType.js +3 -1
  61. package/src/jsoe.css +64 -0
  62. package/src/subTypes/blobHTMLType.js +1 -1
  63. package/src/superTypes/SpecialNumberType.js +2 -8
  64. package/src/superTypes/SpecialRealNumberType.js +2 -2
  65. package/src/superTypes/buffersourceType.js +1455 -0
  66. package/src/{fundamentalTypes → superTypes}/dommatrixType.js +63 -10
  67. package/src/{fundamentalTypes → superTypes}/dompointType.js +60 -7
  68. package/src/{fundamentalTypes → superTypes}/domrectType.js +59 -7
  69. package/src/superTypes/errorsSpecialType.js +1 -1
  70. package/src/types.js +39 -22
  71. package/src/utils/media.js +3 -2
  72. package/src/vendor-imports.js +2 -1
  73. package/vendor/typeson-registry/dist/index.js +90 -28
@@ -500,14 +500,29 @@ const domexception = {
500
500
  }
501
501
  };
502
502
 
503
- /* globals DOMMatrix */
503
+ /* globals DOMMatrix, DOMMatrixReadOnly */
504
504
 
505
505
  /**
506
506
  * @type {import('typeson').TypeSpecSet}
507
507
  */
508
- const dommatrix = {
509
- dommatrix: {
510
- test (x) { return toStringTag(x) === 'DOMMatrix'; },
508
+ const dommatrix = {};
509
+
510
+ /* c8 ignore next */
511
+ if (typeof DOMMatrix !== 'undefined') {
512
+ create$5(DOMMatrix);
513
+ }
514
+ /* c8 ignore next */
515
+ if (typeof DOMMatrixReadOnly !== 'undefined') {
516
+ create$5(DOMMatrixReadOnly);
517
+ }
518
+
519
+ /**
520
+ * @param {typeof DOMMatrix|typeof DOMMatrixReadOnly} Ctor
521
+ * @returns {void}
522
+ */
523
+ function create$5 (Ctor) {
524
+ dommatrix[Ctor.name.toLowerCase()] = {
525
+ test (x) { return toStringTag(x) === Ctor.name; },
511
526
  replace (dm) {
512
527
  if (dm.is2D) {
513
528
  return {
@@ -540,26 +555,41 @@ const dommatrix = {
540
555
  },
541
556
  revive (o) {
542
557
  if (Object.hasOwn(o, 'a')) {
543
- return new DOMMatrix([o.a, o.b, o.c, o.d, o.e, o.f]);
558
+ return new Ctor([o.a, o.b, o.c, o.d, o.e, o.f]);
544
559
  }
545
- return new DOMMatrix([
560
+ return new Ctor([
546
561
  o.m11, o.m12, o.m13, o.m14,
547
562
  o.m21, o.m22, o.m23, o.m24,
548
563
  o.m31, o.m32, o.m33, o.m34,
549
564
  o.m41, o.m42, o.m43, o.m44
550
565
  ]);
551
566
  }
552
- }
553
- };
567
+ };
568
+ }
554
569
 
555
- /* globals DOMPoint */
570
+ /* globals DOMPoint, DOMPointReadOnly */
556
571
 
557
572
  /**
558
573
  * @type {import('typeson').TypeSpecSet}
559
574
  */
560
- const dompoint = {
561
- dompoint: {
562
- test (x) { return toStringTag(x) === 'DOMPoint'; },
575
+ const dompoint = {};
576
+
577
+ /* c8 ignore next */
578
+ if (typeof DOMPoint !== 'undefined') {
579
+ create$4(DOMPoint);
580
+ }
581
+ /* c8 ignore next */
582
+ if (typeof DOMPointReadOnly !== 'undefined') {
583
+ create$4(DOMPointReadOnly);
584
+ }
585
+
586
+ /**
587
+ * @param {typeof DOMPoint|typeof DOMPointReadOnly} Ctor
588
+ * @returns {void}
589
+ */
590
+ function create$4 (Ctor) {
591
+ dompoint[Ctor.name.toLowerCase()] = {
592
+ test (x) { return toStringTag(x) === Ctor.name; },
563
593
  replace (dp) {
564
594
  return {
565
595
  x: dp.x,
@@ -569,19 +599,56 @@ const dompoint = {
569
599
  };
570
600
  },
571
601
  revive ({x, y, z, w}) {
572
- return new DOMPoint(x, y, z, w);
602
+ return new Ctor(x, y, z, w);
603
+ }
604
+ };
605
+ }
606
+
607
+ /* globals DOMQuad */
608
+
609
+ /**
610
+ * @type {import('typeson').TypeSpecSet}
611
+ */
612
+ const domquad = {
613
+ domquad: {
614
+ test (x) { return toStringTag(x) === 'DOMQuad'; },
615
+ replace (dp) {
616
+ return {
617
+ p1: dp.p1,
618
+ p2: dp.p2,
619
+ p3: dp.p3,
620
+ p4: dp.p4
621
+ };
622
+ },
623
+ revive ({p1, p2, p3, p4}) {
624
+ return new DOMQuad(p1, p2, p3, p4);
573
625
  }
574
626
  }
575
627
  };
576
628
 
577
- /* globals DOMRect */
629
+ /* globals DOMRect, DOMRectReadOnly */
578
630
 
579
631
  /**
580
632
  * @type {import('typeson').TypeSpecSet}
581
633
  */
582
- const domrect = {
583
- domrect: {
584
- test (x) { return toStringTag(x) === 'DOMRect'; },
634
+ const domrect = {};
635
+
636
+ /* c8 ignore next */
637
+ if (typeof DOMRect !== 'undefined') {
638
+ create$3(DOMRect);
639
+ }
640
+ /* c8 ignore next */
641
+ if (typeof DOMRectReadOnly !== 'undefined') {
642
+ create$3(DOMRectReadOnly);
643
+ }
644
+
645
+ /**
646
+ * @param {typeof DOMRect|typeof DOMRectReadOnly} Ctor
647
+ * @returns {void}
648
+ */
649
+ function create$3 (Ctor) {
650
+ domrect[Ctor.name.toLowerCase()] = {
651
+ test (x) { return toStringTag(x) === Ctor.name; },
585
652
  replace (dr) {
586
653
  return {
587
654
  x: dr.x,
@@ -591,10 +658,10 @@ const domrect = {
591
658
  };
592
659
  },
593
660
  revive ({x, y, width, height}) {
594
- return new DOMRect(x, y, width, height);
661
+ return new Ctor(x, y, width, height);
595
662
  }
596
- }
597
- };
663
+ };
664
+ }
598
665
 
599
666
  /**
600
667
  * @type {import('typeson').TypeSpecSet}
@@ -719,12 +786,6 @@ function create$2 (Ctor) {
719
786
  e.lineNumber = obj.lineNumber;
720
787
  e.columnNumber = obj.columnNumber;
721
788
 
722
- /* c8 ignore next 6 */
723
- if (isAggregateError) {
724
- /** @type {AggregateError} */ (
725
- e
726
- ).errors = obj.errors;
727
- }
728
789
  return e;
729
790
  }
730
791
  };
@@ -1604,6 +1665,8 @@ const expObj = [
1604
1665
  /* c8 ignore next */
1605
1666
  typeof DOMPoint !== 'undefined' ? dompoint : [],
1606
1667
  /* c8 ignore next */
1668
+ typeof DOMQuad !== 'undefined' ? domquad : [],
1669
+ /* c8 ignore next */
1607
1670
  typeof DOMMatrix !== 'undefined' ? dommatrix : []
1608
1671
  );
1609
1672
 
@@ -1673,7 +1736,6 @@ const structuredCloningThrowing = expObj.concat({
1673
1736
  typeof val.nodeType === 'number' &&
1674
1737
  typeof val.insertBefore === 'function')
1675
1738
  ) {
1676
- alert(stringTag);
1677
1739
  throw new DOMException(
1678
1740
  'The object cannot be cloned.', 'DataCloneError'
1679
1741
  );
@@ -1700,5 +1762,5 @@ const universal = [
1700
1762
  // built-in into ecmasript standard.
1701
1763
  ];
1702
1764
 
1703
- export { u as JSON_TYPES, c as Typeson, e as TypesonPromise, s as Undefined, arrayNonindexKeys, arraybuffer, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domrect, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, hasConstructorOf, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningThrowing, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject };
1765
+ export { u as JSON_TYPES, c as Typeson, e as TypesonPromise, s as Undefined, arrayNonindexKeys, arraybuffer, bigint, bigintObject, blob, expObj$1 as builtin, cloneable, cryptokey, dataview, date, domexception, dommatrix, dompoint, domquad, domrect, error, errors, escapeKeyPathComponent, file, filelist, getByKeyPath, getJSONType, hasConstructorOf, imagebitmap, imagedata, infinity, intlTypes, isObject, isPlainObject, isThenable, isUserObject, map, nan, negativeInfinity, negativeZero, nonbuiltinIgnore, postmessage, primitiveObjects, regexp, resurrectable, set, setAtKeyPath, socketio, sparseUndefined, specialNumbers, expObj as structuredCloning, structuredCloningThrowing, toStringTag, typedArrays, typedArraysSocketIO as typedArraysSocketio, undef$1 as undef, undef as undefPreset, unescapeKeyPathComponent, universal, userObject };
1704
1766
  //# sourceMappingURL=index.js.map