js.documents 14.4.46 → 14.4.48

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 (67) hide show
  1. package/dist/convert/composition.cjs +9 -4
  2. package/dist/convert/composition.js +9 -4
  3. package/dist/convert/variant-bridges.cjs +2 -1
  4. package/dist/convert/variant-bridges.js +2 -1
  5. package/dist/csv/records.cjs +2 -1
  6. package/dist/csv/records.js +2 -1
  7. package/dist/edit/geometry.cjs +2 -1
  8. package/dist/edit/geometry.js +2 -1
  9. package/dist/edit/odg/svg-path.cjs +2 -1
  10. package/dist/edit/odg/svg-path.js +2 -1
  11. package/dist/edit/ods/cell.cjs +2 -1
  12. package/dist/edit/ods/cell.js +2 -1
  13. package/dist/edit/pdf/util.cjs +2 -1
  14. package/dist/edit/pdf/util.js +2 -1
  15. package/dist/firebird/data.cjs +2 -1
  16. package/dist/firebird/data.js +2 -1
  17. package/dist/firebird/date.cjs +40 -21
  18. package/dist/firebird/date.js +40 -21
  19. package/dist/firebird/reader.cjs +30 -19
  20. package/dist/firebird/reader.js +30 -19
  21. package/dist/hsqldb/binary-script.cjs +5 -4
  22. package/dist/hsqldb/binary-script.js +5 -4
  23. package/dist/hsqldb/cache.cjs +4 -2
  24. package/dist/hsqldb/cache.js +4 -2
  25. package/dist/hsqldb/rowformat.cjs +93 -57
  26. package/dist/hsqldb/rowformat.js +93 -57
  27. package/dist/hsqldb/script.cjs +2 -1
  28. package/dist/hsqldb/script.js +2 -1
  29. package/dist/latex/lower.cjs +2 -1
  30. package/dist/latex/lower.js +2 -1
  31. package/dist/latex/rational.cjs +6 -3
  32. package/dist/latex/rational.js +6 -3
  33. package/dist/layout/cell-typing.cjs +7 -3
  34. package/dist/layout/cell-typing.js +7 -3
  35. package/dist/layout/reconstruct.cjs +17 -15
  36. package/dist/layout/reconstruct.js +17 -15
  37. package/dist/layout/shared.cjs +2 -1
  38. package/dist/layout/shared.js +2 -1
  39. package/dist/layout/sheets.cjs +2 -1
  40. package/dist/layout/sheets.js +2 -1
  41. package/dist/mathml/layout.cjs +11 -5
  42. package/dist/mathml/layout.js +11 -5
  43. package/dist/mathml/length.cjs +12 -10
  44. package/dist/mathml/length.js +12 -10
  45. package/dist/mathml/operators.cjs +7 -3
  46. package/dist/mathml/operators.js +7 -3
  47. package/dist/mathml/variant.cjs +116 -1142
  48. package/dist/mathml/variant.js +116 -1142
  49. package/dist/model/bytes.cjs +9 -16
  50. package/dist/model/bytes.js +9 -16
  51. package/dist/model/geometry.cjs +2 -1
  52. package/dist/model/geometry.js +2 -1
  53. package/dist/odb/read.cjs +10 -2
  54. package/dist/odb/read.js +10 -2
  55. package/dist/svg/paint.cjs +177 -749
  56. package/dist/svg/paint.js +177 -749
  57. package/dist/svg/path.cjs +11 -6
  58. package/dist/svg/path.js +11 -6
  59. package/dist/svg/read.cjs +7 -3
  60. package/dist/svg/read.js +8 -4
  61. package/dist/svg/transform.cjs +11 -7
  62. package/dist/svg/transform.js +11 -7
  63. package/dist/svg/units.cjs +9 -5
  64. package/dist/svg/units.d.cts +2 -1
  65. package/dist/svg/units.d.ts +2 -1
  66. package/dist/svg/units.js +9 -6
  67. package/package.json +12 -12
@@ -8,19 +8,8 @@ let xls_codec = require("xls-codec");
8
8
  let ppt_codec = require("ppt-codec");
9
9
  let archive_codec = require("archive-codec");
10
10
  //#region src/model/bytes.ts
11
- const ZIP_LOCAL_FILE_HEADER = [
12
- 80,
13
- 75,
14
- 3,
15
- 4
16
- ];
17
- const PDF_HEADER = [
18
- 37,
19
- 80,
20
- 68,
21
- 70,
22
- 45
23
- ];
11
+ const ZIP_LOCAL_FILE_HEADER = Array.from("PK", (char) => char.charCodeAt(0));
12
+ const PDF_HEADER = Array.from("%PDF-", (char) => char.charCodeAt(0));
24
13
  const PDF_HEADER_SEARCH_WINDOW = 1024;
25
14
  function startsWithBytes(bytes, signature) {
26
15
  if (bytes.length < signature.length) return false;
@@ -51,19 +40,23 @@ const MIMETYPE_FILENAME_OFFSET = 30;
51
40
  const MIMETYPE_CONTENT_OFFSET = 38;
52
41
  const COMPRESSION_METHOD_OFFSET = 8;
53
42
  const COMPRESSED_SIZE_OFFSET = 18;
43
+ const BYTE_1_SHIFT = 8;
44
+ const BYTE_2_SHIFT = 16;
45
+ const BYTE_3_SHIFT = 24;
54
46
  function readUint16LE(bytes, offset) {
55
47
  const b0 = bytes[offset];
56
48
  const b1 = bytes[offset + 1];
57
49
  if (b0 === void 0 || b1 === void 0) return;
58
- return b0 | b1 << 8;
50
+ return b0 | b1 << BYTE_1_SHIFT;
59
51
  }
60
52
  function readUint32LE(bytes, offset) {
53
+ const BYTE_3_POSITION = 3;
61
54
  const b0 = bytes[offset];
62
55
  const b1 = bytes[offset + 1];
63
56
  const b2 = bytes[offset + 2];
64
- const b3 = bytes[offset + 3];
57
+ const b3 = bytes[offset + BYTE_3_POSITION];
65
58
  if (b0 === void 0 || b1 === void 0 || b2 === void 0 || b3 === void 0) return;
66
- return (b0 | b1 << 8 | b2 << 16 | b3 << 24) >>> 0;
59
+ return (b0 | b1 << BYTE_1_SHIFT | b2 << BYTE_2_SHIFT | b3 << BYTE_3_SHIFT) >>> 0;
67
60
  }
68
61
  function readAsciiSlice(bytes, offset, length) {
69
62
  if (bytes.length < offset + length) return;
@@ -7,19 +7,8 @@ import { isXlsFile } from "xls-codec";
7
7
  import { CURRENT_USER_STREAM, POWERPOINT_DOCUMENT_STREAM } from "ppt-codec";
8
8
  import { isCompoundFile, readCompoundFile } from "archive-codec";
9
9
  //#region src/model/bytes.ts
10
- const ZIP_LOCAL_FILE_HEADER = [
11
- 80,
12
- 75,
13
- 3,
14
- 4
15
- ];
16
- const PDF_HEADER = [
17
- 37,
18
- 80,
19
- 68,
20
- 70,
21
- 45
22
- ];
10
+ const ZIP_LOCAL_FILE_HEADER = Array.from("PK", (char) => char.charCodeAt(0));
11
+ const PDF_HEADER = Array.from("%PDF-", (char) => char.charCodeAt(0));
23
12
  const PDF_HEADER_SEARCH_WINDOW = 1024;
24
13
  function startsWithBytes(bytes, signature) {
25
14
  if (bytes.length < signature.length) return false;
@@ -50,19 +39,23 @@ const MIMETYPE_FILENAME_OFFSET = 30;
50
39
  const MIMETYPE_CONTENT_OFFSET = 38;
51
40
  const COMPRESSION_METHOD_OFFSET = 8;
52
41
  const COMPRESSED_SIZE_OFFSET = 18;
42
+ const BYTE_1_SHIFT = 8;
43
+ const BYTE_2_SHIFT = 16;
44
+ const BYTE_3_SHIFT = 24;
53
45
  function readUint16LE(bytes, offset) {
54
46
  const b0 = bytes[offset];
55
47
  const b1 = bytes[offset + 1];
56
48
  if (b0 === void 0 || b1 === void 0) return;
57
- return b0 | b1 << 8;
49
+ return b0 | b1 << BYTE_1_SHIFT;
58
50
  }
59
51
  function readUint32LE(bytes, offset) {
52
+ const BYTE_3_POSITION = 3;
60
53
  const b0 = bytes[offset];
61
54
  const b1 = bytes[offset + 1];
62
55
  const b2 = bytes[offset + 2];
63
- const b3 = bytes[offset + 3];
56
+ const b3 = bytes[offset + BYTE_3_POSITION];
64
57
  if (b0 === void 0 || b1 === void 0 || b2 === void 0 || b3 === void 0) return;
65
- return (b0 | b1 << 8 | b2 << 16 | b3 << 24) >>> 0;
58
+ return (b0 | b1 << BYTE_1_SHIFT | b2 << BYTE_2_SHIFT | b3 << BYTE_3_SHIFT) >>> 0;
66
59
  }
67
60
  function readAsciiSlice(bytes, offset, length) {
68
61
  if (bytes.length < offset + length) return;
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  //#region src/model/geometry.ts
3
+ const PI_RADIANS_IN_DEGREES = 180;
3
4
  function flipY(box, containerHeightPt) {
4
5
  return {
5
6
  xPt: box.xPt,
@@ -9,7 +10,7 @@ function flipY(box, containerHeightPt) {
9
10
  };
10
11
  }
11
12
  function rotatePointAboutCenter(point, center, degrees) {
12
- const radians = degrees * Math.PI / 180;
13
+ const radians = degrees * Math.PI / PI_RADIANS_IN_DEGREES;
13
14
  const cos = Math.cos(radians);
14
15
  const sin = Math.sin(radians);
15
16
  const dx = point.x - center.x;
@@ -1,4 +1,5 @@
1
1
  //#region src/model/geometry.ts
2
+ const PI_RADIANS_IN_DEGREES = 180;
2
3
  function flipY(box, containerHeightPt) {
3
4
  return {
4
5
  xPt: box.xPt,
@@ -8,7 +9,7 @@ function flipY(box, containerHeightPt) {
8
9
  };
9
10
  }
10
11
  function rotatePointAboutCenter(point, center, degrees) {
11
- const radians = degrees * Math.PI / 180;
12
+ const radians = degrees * Math.PI / PI_RADIANS_IN_DEGREES;
12
13
  const cos = Math.cos(radians);
13
14
  const sin = Math.sin(radians);
14
15
  const dx = point.x - center.x;
package/dist/odb/read.cjs CHANGED
@@ -5,6 +5,14 @@ const require_hsqldb_cache = require("../hsqldb/cache.cjs");
5
5
  const require_firebird_backup = require("../firebird/backup.cjs");
6
6
  let odf_js = require("odf.js");
7
7
  //#region src/odb/read.ts
8
+ const CMF_METHOD_MASK = 15;
9
+ const DEFLATE_METHOD = 8;
10
+ const USHORT_RADIX = 256;
11
+ const FLATE_CHECK_MODULUS = 31;
12
+ const PRINTABLE_ASCII_FLOOR = 32;
13
+ const CHARACTER_TAB = 9;
14
+ const LINE_FEED = 10;
15
+ const CARRIAGE_RETURN = 13;
8
16
  var OdbNoEmbeddedDataSourceError = class extends Error {
9
17
  url;
10
18
  constructor(url) {
@@ -33,11 +41,11 @@ function isZlibHeader(bytes) {
33
41
  const cmf = bytes[0];
34
42
  const flg = bytes[1];
35
43
  if (cmf === void 0 || flg === void 0) return false;
36
- return (cmf & 15) === 8 && (cmf * 256 + flg) % 31 === 0;
44
+ return (cmf & CMF_METHOD_MASK) === DEFLATE_METHOD && (cmf * USHORT_RADIX + flg) % FLATE_CHECK_MODULUS === 0;
37
45
  }
38
46
  function classifyScriptBytes(bytes) {
39
47
  if (isZlibHeader(bytes)) return "compressed";
40
- for (const byte of bytes) if (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13) return "binary";
48
+ for (const byte of bytes) if (byte < PRINTABLE_ASCII_FLOOR && byte !== CHARACTER_TAB && byte !== LINE_FEED && byte !== CARRIAGE_RETURN) return "binary";
41
49
  try {
42
50
  new TextDecoder("utf-8", { fatal: true }).decode(bytes);
43
51
  } catch {
package/dist/odb/read.js CHANGED
@@ -4,6 +4,14 @@ import { decodeHsqldbCachedTables } from "../hsqldb/cache.js";
4
4
  import { readFirebirdBackup } from "../firebird/backup.js";
5
5
  import { base64ToBytes, readManifest, readOdbInventory } from "odf.js";
6
6
  //#region src/odb/read.ts
7
+ const CMF_METHOD_MASK = 15;
8
+ const DEFLATE_METHOD = 8;
9
+ const USHORT_RADIX = 256;
10
+ const FLATE_CHECK_MODULUS = 31;
11
+ const PRINTABLE_ASCII_FLOOR = 32;
12
+ const CHARACTER_TAB = 9;
13
+ const LINE_FEED = 10;
14
+ const CARRIAGE_RETURN = 13;
7
15
  var OdbNoEmbeddedDataSourceError = class extends Error {
8
16
  url;
9
17
  constructor(url) {
@@ -32,11 +40,11 @@ function isZlibHeader(bytes) {
32
40
  const cmf = bytes[0];
33
41
  const flg = bytes[1];
34
42
  if (cmf === void 0 || flg === void 0) return false;
35
- return (cmf & 15) === 8 && (cmf * 256 + flg) % 31 === 0;
43
+ return (cmf & CMF_METHOD_MASK) === DEFLATE_METHOD && (cmf * USHORT_RADIX + flg) % FLATE_CHECK_MODULUS === 0;
36
44
  }
37
45
  function classifyScriptBytes(bytes) {
38
46
  if (isZlibHeader(bytes)) return "compressed";
39
- for (const byte of bytes) if (byte < 32 && byte !== 9 && byte !== 10 && byte !== 13) return "binary";
47
+ for (const byte of bytes) if (byte < PRINTABLE_ASCII_FLOOR && byte !== CHARACTER_TAB && byte !== LINE_FEED && byte !== CARRIAGE_RETURN) return "binary";
40
48
  try {
41
49
  new TextDecoder("utf-8", { fatal: true }).decode(bytes);
42
50
  } catch {