@sythos/js_barcode_universal 1.5.5 → 1.5.7

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 (94) hide show
  1. package/README.md +15 -3
  2. package/bundle/sythos-barcode.esm.js +2 -2
  3. package/bundle/sythos-barcode.js +2 -2
  4. package/examples/read.html +5 -3
  5. package/package.json +91 -25
  6. package/src/index.js +1 -1
  7. package/typings/aztec/decoder.d.ts +57 -0
  8. package/typings/aztec/detector.d.ts +62 -0
  9. package/typings/aztec/encoder.d.ts +94 -0
  10. package/typings/aztec/high-level.d.ts +89 -0
  11. package/typings/aztec/index.d.ts +35 -0
  12. package/typings/aztec/tables.d.ts +144 -0
  13. package/typings/aztecrune/decoder.d.ts +56 -0
  14. package/typings/aztecrune/detector.d.ts +53 -0
  15. package/typings/aztecrune/encoder.d.ts +51 -0
  16. package/typings/aztecrune/index.d.ts +35 -0
  17. package/typings/aztecrune/tables.d.ts +75 -0
  18. package/typings/bundle/sythos-barcode.d.ts +31 -0
  19. package/typings/bundle/sythos-barcode.esm.d.ts +31 -0
  20. package/typings/compactpdf417/decoder.d.ts +64 -0
  21. package/typings/compactpdf417/detector.d.ts +48 -0
  22. package/typings/compactpdf417/encoder.d.ts +49 -0
  23. package/typings/compactpdf417/index.d.ts +8 -0
  24. package/typings/compactpdf417/tables.d.ts +84 -0
  25. package/typings/core/bit-buffer.d.ts +78 -0
  26. package/typings/core/bit-matrix.d.ts +129 -0
  27. package/typings/core/errors.d.ts +57 -0
  28. package/typings/core/galois-field.d.ts +141 -0
  29. package/typings/core/index.d.ts +40 -0
  30. package/typings/core/reed-solomon.d.ts +65 -0
  31. package/typings/databar/codec.d.ts +78 -0
  32. package/typings/databar/decoder.d.ts +55 -0
  33. package/typings/databar/encoder.d.ts +34 -0
  34. package/typings/databar/gs1.d.ts +48 -0
  35. package/typings/databar/index.d.ts +37 -0
  36. package/typings/databar/patterns.d.ts +46 -0
  37. package/typings/databar/tables.d.ts +119 -0
  38. package/typings/datamatrix/decoder.d.ts +57 -0
  39. package/typings/datamatrix/detector.d.ts +59 -0
  40. package/typings/datamatrix/encoder.d.ts +36 -0
  41. package/typings/datamatrix/index.d.ts +35 -0
  42. package/typings/datamatrix/tables.d.ts +88 -0
  43. package/typings/frameqr/decoder.d.ts +64 -0
  44. package/typings/frameqr/detector.d.ts +96 -0
  45. package/typings/frameqr/encoder.d.ts +73 -0
  46. package/typings/frameqr/index.d.ts +34 -0
  47. package/typings/frameqr/tables.d.ts +123 -0
  48. package/typings/image/binarizer.d.ts +85 -0
  49. package/typings/image/grid-sampler.d.ts +82 -0
  50. package/typings/image/index.d.ts +39 -0
  51. package/typings/image/luminance.d.ts +112 -0
  52. package/typings/image/perspective.d.ts +111 -0
  53. package/typings/index.d.ts +363 -0
  54. package/typings/micropdf417/compaction.d.ts +38 -0
  55. package/typings/micropdf417/decoder.d.ts +57 -0
  56. package/typings/micropdf417/detector.d.ts +95 -0
  57. package/typings/micropdf417/encoder.d.ts +34 -0
  58. package/typings/micropdf417/error-correction.d.ts +38 -0
  59. package/typings/micropdf417/index.d.ts +36 -0
  60. package/typings/micropdf417/tables.d.ts +73 -0
  61. package/typings/microqr/decoder.d.ts +49 -0
  62. package/typings/microqr/detector.d.ts +96 -0
  63. package/typings/microqr/encoder.d.ts +33 -0
  64. package/typings/microqr/index.d.ts +35 -0
  65. package/typings/microqr/tables.d.ts +107 -0
  66. package/typings/oned/addons.d.ts +181 -0
  67. package/typings/oned/index.d.ts +55 -0
  68. package/typings/oned/patterns.d.ts +259 -0
  69. package/typings/oned/reader.d.ts +129 -0
  70. package/typings/oned/writers.d.ts +218 -0
  71. package/typings/pdf417/compaction.d.ts +59 -0
  72. package/typings/pdf417/decoder.d.ts +48 -0
  73. package/typings/pdf417/detector.d.ts +73 -0
  74. package/typings/pdf417/encoder.d.ts +32 -0
  75. package/typings/pdf417/error-correction.d.ts +34 -0
  76. package/typings/pdf417/index.d.ts +10 -0
  77. package/typings/pdf417/tables.d.ts +53 -0
  78. package/typings/qr/decoder.d.ts +79 -0
  79. package/typings/qr/detector.d.ts +93 -0
  80. package/typings/qr/encoder.d.ts +166 -0
  81. package/typings/qr/index.d.ts +43 -0
  82. package/typings/qr/tables.d.ts +291 -0
  83. package/typings/render/image-data.d.ts +58 -0
  84. package/typings/render/index.d.ts +110 -0
  85. package/typings/render/options.d.ts +98 -0
  86. package/typings/render/png.d.ts +58 -0
  87. package/typings/render/svg.d.ts +46 -0
  88. package/typings/render/webgl.d.ts +45 -0
  89. package/typings/render/webgpu.d.ts +51 -0
  90. package/typings/rmqr/decoder.d.ts +42 -0
  91. package/typings/rmqr/detector.d.ts +81 -0
  92. package/typings/rmqr/encoder.d.ts +45 -0
  93. package/typings/rmqr/index.d.ts +34 -0
  94. package/typings/rmqr/tables.d.ts +89 -0
package/README.md CHANGED
@@ -118,8 +118,8 @@ The `unpkg` and `jsdelivr` fields point at the IIFE bundle, so a CDN needs no in
118
118
 
119
119
  ```html
120
120
  <script src="https://unpkg.com/@sythos/js_barcode_universal"></script>
121
- <script src="https://unpkg.com/@sythos/js_barcode_universal@1.5.5"></script>
122
- <script src="https://cdn.jsdelivr.net/npm/@sythos/js_barcode_universal@1.5.5"></script>
121
+ <script src="https://unpkg.com/@sythos/js_barcode_universal@1.5.7"></script>
122
+ <script src="https://cdn.jsdelivr.net/npm/@sythos/js_barcode_universal@1.5.7"></script>
123
123
  ```
124
124
 
125
125
  Pin the version for anything you ship; the unpinned form resolves to `latest` and will move under
@@ -208,7 +208,8 @@ The profile requires a compatible quiet zone and the same complete 1D symbol on
208
208
  scan samples. It retries only the two quarter-turn orientations needed for 1D symbols when the
209
209
  native orientation has no validated read. Code 11 and MSI require a verified check digit in this
210
210
  profile; other formats retain their own structural and checksum validation. A frame without a
211
- validated barcode still returns `[]`.
211
+ validated barcode still returns `[]`. No partial, structurally inconsistent or low-confidence value is
212
+ emitted to the caller.
212
213
 
213
214
  Camera-profile 1D results add `confidence` (0–1), `bounds`, `rotation`, and
214
215
  `quality: { quietZone, checksum, rows, consistency }`. `bounds` is reported in the raster
@@ -704,6 +705,17 @@ See [`AI_USAGE.md`](./AI_USAGE.md) for additional machine-oriented guidance.
704
705
 
705
706
  ---
706
707
 
708
+ ## Contributor
709
+
710
+ **Tristan Jacob** ([Tristan-GPT](https://github.com/Tristan-GPT)) — **TypeScript implementation**.
711
+
712
+ Tristan added the machine-readable TypeScript declaration layer across the SDK, covering the
713
+ format-specific APIs, subpath exports and decoder result shapes. It is a welcome bit of type safety
714
+ for a deliberately broad JavaScript API — fewer guesses, better autocomplete, and a
715
+ much friendlier path for TypeScript users.
716
+
717
+ ---
718
+
707
719
  ## Contributing and roadmap
708
720
 
709
721
  [`PLAN.md`](PLAN.md) is the live status document: what is shipped, what is next, and the ground
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Sythos Barcode Suite v1.5.5
2
+ * Sythos Barcode Suite v1.5.7
3
3
  *
4
4
  * MIT License
5
5
  *
@@ -16987,7 +16987,7 @@ function decodeStrict(image, options) {
16987
16987
  }
16988
16988
 
16989
16989
  /** Library version, matching package.json. */
16990
- const VERSION = '1.5.5';
16990
+ const VERSION = '1.5.7';
16991
16991
 
16992
16992
  __exports.listFormats = listFormats;
16993
16993
  __exports.encode = encode;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Sythos Barcode Suite v1.5.5
2
+ * Sythos Barcode Suite v1.5.7
3
3
  *
4
4
  * MIT License
5
5
  *
@@ -16988,7 +16988,7 @@ function decodeStrict(image, options) {
16988
16988
  }
16989
16989
 
16990
16990
  /** Library version, matching package.json. */
16991
- const VERSION = '1.5.5';
16991
+ const VERSION = '1.5.7';
16992
16992
 
16993
16993
  __exports.listFormats = listFormats;
16994
16994
  __exports.encode = encode;
@@ -180,12 +180,14 @@
180
180
  return true;
181
181
  }
182
182
 
183
- function scanCanvas(canvas) {
183
+ function scanCanvas(canvas, profile) {
184
184
  var ctx = canvas.getContext('2d', { willReadFrequently: true });
185
185
  if (!ctx || !canvas.width || !canvas.height) return [];
186
186
  var image = ctx.getImageData(0, 0, canvas.width, canvas.height);
187
187
  try {
188
- return B.decode(image, { tryHarder: true });
188
+ var options = { tryHarder: true };
189
+ if (profile) options.profile = profile;
190
+ return B.decode(image, options);
189
191
  } catch (e) {
190
192
  return [];
191
193
  }
@@ -325,7 +327,7 @@
325
327
  .drawImage(video, 0, 0, work.width, work.height);
326
328
 
327
329
  frames++;
328
- var hits = scanCanvas(work);
330
+ var hits = scanCanvas(work, 'camera');
329
331
  if (hits.length) {
330
332
  show(hits, 'camera');
331
333
  stopCamera();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sythos/js_barcode_universal",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Read and write barcodes in JavaScript with zero runtime dependencies. QR Code, Micro QR, rMQR, FrameQR Code, Aztec Code and Rune, PDF417 variants, GS1 DataBar Omnidirectional/Truncated, EAN supplements and one-dimensional formats.",
5
5
  "author": {
6
6
  "name": "Sythos",
@@ -20,28 +20,92 @@
20
20
  "publishConfig": {
21
21
  "access": "public"
22
22
  },
23
+ "types": "./typings/index.d.ts",
23
24
  "exports": {
24
- ".": "./src/index.js",
25
- "./core": "./src/core/index.js",
26
- "./image": "./src/image/index.js",
27
- "./oned": "./src/oned/index.js",
28
- "./qr": "./src/qr/index.js",
29
- "./datamatrix": "./src/datamatrix/index.js",
30
- "./databar": "./src/databar/index.js",
31
- "./aztec": "./src/aztec/index.js",
32
- "./aztecrune": "./src/aztecrune/index.js",
33
- "./pdf417": "./src/pdf417/index.js",
34
- "./compactpdf417": "./src/compactpdf417/index.js",
35
- "./micropdf417": "./src/micropdf417/index.js",
36
- "./microqr": "./src/microqr/index.js",
37
- "./rmqr": "./src/rmqr/index.js",
38
- "./frameqr": "./src/frameqr/index.js",
39
- "./render": "./src/render/index.js",
40
- "./render/svg": "./src/render/svg.js",
41
- "./render/png": "./src/render/png.js",
42
- "./render/image-data": "./src/render/image-data.js",
43
- "./bundle": "./bundle/sythos-barcode.esm.js",
44
- "./bundle/iife": "./bundle/sythos-barcode.js",
25
+ ".": {
26
+ "import": "./src/index.js",
27
+ "types": "./typings/index.d.ts"
28
+ },
29
+ "./core": {
30
+ "import": "./src/core/index.js",
31
+ "types": "./typings/core/index.d.ts"
32
+ },
33
+ "./image": {
34
+ "import": "./src/image/index.js",
35
+ "types": "./typings/image/index.d.ts"
36
+ },
37
+ "./oned": {
38
+ "import": "./src/oned/index.js",
39
+ "types": "./typings/oned/index.d.ts"
40
+ },
41
+ "./qr": {
42
+ "import": "./src/qr/index.js",
43
+ "types": "./typings/qr/index.d.ts"
44
+ },
45
+ "./datamatrix": {
46
+ "import": "./src/datamatrix/index.js",
47
+ "types": "./typings/datamatrix/index.d.ts"
48
+ },
49
+ "./databar": {
50
+ "import": "./src/databar/index.js",
51
+ "types": "./typings/databar/index.d.ts"
52
+ },
53
+ "./aztec": {
54
+ "import": "./src/aztec/index.js",
55
+ "types": "./typings/aztec/index.d.ts"
56
+ },
57
+ "./aztecrune": {
58
+ "import": "./src/aztecrune/index.js",
59
+ "types": "./typings/aztecrune/index.d.ts"
60
+ },
61
+ "./pdf417": {
62
+ "import": "./src/pdf417/index.js",
63
+ "types": "./typings/pdf417/index.d.ts"
64
+ },
65
+ "./compactpdf417": {
66
+ "import": "./src/compactpdf417/index.js",
67
+ "types": "./typings/compactpdf417/index.d.ts"
68
+ },
69
+ "./micropdf417": {
70
+ "import": "./src/micropdf417/index.js",
71
+ "types": "./typings/micropdf417/index.d.ts"
72
+ },
73
+ "./microqr": {
74
+ "import": "./src/microqr/index.js",
75
+ "types": "./typings/microqr/index.d.ts"
76
+ },
77
+ "./rmqr": {
78
+ "import": "./src/rmqr/index.js",
79
+ "types": "./typings/rmqr/index.d.ts"
80
+ },
81
+ "./frameqr": {
82
+ "import": "./src/frameqr/index.js",
83
+ "types": "./typings/frameqr/index.d.ts"
84
+ },
85
+ "./render": {
86
+ "import": "./src/render/index.js",
87
+ "types": "./typings/render/index.d.ts"
88
+ },
89
+ "./render/svg": {
90
+ "import": "./src/render/svg.js",
91
+ "types": "./typings/render/svg.d.ts"
92
+ },
93
+ "./render/png": {
94
+ "import": "./src/render/png.js",
95
+ "types": "./typings/render/png.d.ts"
96
+ },
97
+ "./render/image-data": {
98
+ "import": "./src/render/image-data.js",
99
+ "types": "./typings/render/image-data.d.ts"
100
+ },
101
+ "./bundle": {
102
+ "import": "./bundle/sythos-barcode.esm.js",
103
+ "types": "./typings/bundle/sythos-barcode.esm.d.ts"
104
+ },
105
+ "./bundle/iife": {
106
+ "import": "./bundle/sythos-barcode.js",
107
+ "types": "./typings/bundle/sythos-barcode.d.ts"
108
+ },
45
109
  "./package.json": "./package.json"
46
110
  },
47
111
  "files": [
@@ -52,7 +116,8 @@
52
116
  "LICENSE",
53
117
  "NOTICE.md",
54
118
  "README.md",
55
- "AI_USAGE.md"
119
+ "AI_USAGE.md",
120
+ "typings"
56
121
  ],
57
122
  "keywords": [
58
123
  "barcode",
@@ -118,6 +183,7 @@
118
183
  "url": "https://github.com/Sythos/JS_Barcode_Universal/issues"
119
184
  },
120
185
  "homepage": "https://github.com/Sythos/JS_Barcode_Universal#readme",
121
- "dependencies": {},
122
- "devDependencies": {}
186
+ "devDependencies": {
187
+ "typescript": "^7.0.2"
188
+ }
123
189
  }
package/src/index.js CHANGED
@@ -634,4 +634,4 @@ export function decodeStrict(image, options) {
634
634
  }
635
635
 
636
636
  /** Library version, matching package.json. */
637
- export const VERSION = '1.5.5';
637
+ export const VERSION = '1.5.7';
@@ -0,0 +1,57 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+ /**
32
+ * Decode an Aztec high-level bit stream to its exact byte payload.
33
+ *
34
+ * Text tables contribute their ISO-8859-1 byte values; Binary Shift appends
35
+ * raw bytes. ECI markers are consumed but intentionally not emitted: callers
36
+ * receive the transported byte payload and may select their own charset.
37
+ *
38
+ * @param {boolean[]} bits
39
+ * @returns {Uint8Array}
40
+ */
41
+ export declare function decodeHighLevelBits(bits: boolean[]): Uint8Array;
42
+ export type DecodeResult = {
43
+ text: string;
44
+ bytes: Uint8Array;
45
+ compact: boolean;
46
+ layers: number;
47
+ corrections: number;
48
+ eccPercent: number;
49
+ };
50
+ /**
51
+ * Decode a square Aztec symbol with one bit per module and no quiet zone.
52
+ * The matrix must already be oriented with the mode message at the top.
53
+ *
54
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
55
+ * @returns {{text: string, bytes: Uint8Array, compact: boolean, layers: number, corrections: number, eccPercent: number}}
56
+ */
57
+ export declare function decodeAztec(matrix: import('../core/bit-matrix.js').BitMatrix): DecodeResult;
@@ -0,0 +1,62 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+ export type Point = {
32
+ x: number;
33
+ y: number;
34
+ };
35
+ export type Detection = {
36
+ corners: Point[];
37
+ dimension: number;
38
+ compact: boolean;
39
+ moduleSize: number;
40
+ matrix: import('../core/bit-matrix.js').BitMatrix;
41
+ };
42
+ /**
43
+ * Find an Aztec symbol in a binarized image.
44
+ *
45
+ * The returned matrix is in the orientation accepted by the Aztec decoder.
46
+ * A valid mode message is required before a geometric candidate is returned,
47
+ * making false positives from decorative concentric squares very unlikely.
48
+ *
49
+ * @param {import('../core/bit-matrix.js').BitMatrix} binaryImage Set bit = dark.
50
+ * @returns {Detection | null}
51
+ */
52
+ export declare function detectAztec(binaryImage: import('../core/bit-matrix.js').BitMatrix): Detection | null;
53
+ /**
54
+ * Detect then decode an Aztec symbol. Detection failure is a normal result for
55
+ * images without an Aztec code, therefore invalid candidates return null.
56
+ *
57
+ * @param {import('../core/bit-matrix.js').BitMatrix} binaryImage
58
+ * @returns {(import('./decoder.js').DecodeResult & {corners: Point[]}) | null}
59
+ */
60
+ export declare function detectAndDecodeAztec(binaryImage: import('../core/bit-matrix.js').BitMatrix): (import('./decoder.js').DecodeResult & {
61
+ corners: Point[];
62
+ }) | null;
@@ -0,0 +1,94 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+ /**
32
+ * Aztec encoder: high-level bits, bit stuffing, Reed-Solomon and matrix layout.
33
+ *
34
+ * `tables.js` is intentionally the source of geometry and field selection.
35
+ * Its `aztecLayer(layers, compact)` entries must expose `totalBits`,
36
+ * `totalCodewords`, `baseMatrixSize` and `symbolSize`; `fieldForLayers()` must
37
+ * return the matching binary field. All Aztec Reed-Solomon generators start
38
+ * at alpha^1, hence the explicit base `1` in both data and mode messages.
39
+ *
40
+ * @module aztec/encoder
41
+ */
42
+ import { BitWriter } from '../core/bit-buffer.js';
43
+ import { BitMatrix } from '../core/bit-matrix.js';
44
+ /**
45
+ * Prevent all-zero and all-one codewords except their final bit. The final
46
+ * bit is intentionally re-consumed after a stuffed word; it is the mechanism
47
+ * that makes the transform injective and reversible.
48
+ *
49
+ * @param {BitWriter} bits @param {number} wordSize @returns {BitWriter}
50
+ */
51
+ export declare function stuffBits(bits: BitWriter, wordSize: number): BitWriter;
52
+ /**
53
+ * Add systematic Aztec Reed-Solomon parity and the leading alignment bits.
54
+ * @param {BitWriter} data @param {number} totalBits @param {number} wordSize
55
+ * @param {import('../core/galois-field.js').GaloisField} field
56
+ * @returns {{bits: BitWriter, dataWords: number, eccWords: number}}
57
+ */
58
+ export declare function addCheckWords(data: BitWriter, totalBits: number, wordSize: number, field: import('../core/galois-field.js').GaloisField): {
59
+ bits: BitWriter;
60
+ dataWords: number;
61
+ eccWords: number;
62
+ };
63
+ /** @param {number} layers @param {number} dataWords @param {boolean} compact @returns {BitWriter} */
64
+ export declare function modeMessage(layers: number, dataWords: number, compact: boolean): BitWriter;
65
+ /**
66
+ * Lay low-level bits in the four-sided, inward Aztec spiral.
67
+ * @param {BitWriter} bits @param {{layers:number,compact:boolean,baseMatrixSize:number,symbolSize:number}} symbol
68
+ * @returns {BitMatrix}
69
+ */
70
+ export declare function buildAztecMatrix(bits: BitWriter, symbol: {
71
+ layers: number;
72
+ compact: boolean;
73
+ baseMatrixSize: number;
74
+ symbolSize: number;
75
+ }): BitMatrix;
76
+ /**
77
+ * Encode a UTF-8 string or bytes into an Aztec Code matrix.
78
+ *
79
+ * @param {string|ArrayBuffer|ArrayBufferView} value
80
+ * @param {{layers?:number,compact?:boolean,eccPercent?:number,charset?:'utf-8'}} [options]
81
+ * @returns {BitMatrix & {format?:string,layers?:number,compact?:boolean,eccPercent?:number,dataCodewords?:number}}
82
+ */
83
+ export declare function encodeAztec(value: string | ArrayBuffer | ArrayBufferView, options?: {
84
+ layers?: number;
85
+ compact?: boolean;
86
+ eccPercent?: number;
87
+ charset?: 'utf-8';
88
+ }): BitMatrix & {
89
+ format?: string;
90
+ layers?: number;
91
+ compact?: boolean;
92
+ eccPercent?: number;
93
+ dataCodewords?: number;
94
+ };
@@ -0,0 +1,89 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+ /**
32
+ * Aztec high-level stream writer.
33
+ *
34
+ * The output is deliberately a `BitWriter`, rather than a byte array: Aztec's
35
+ * text controls and binary-shift lengths are not byte aligned. This module is
36
+ * also the boundary where JavaScript strings become UTF-8. Passing a byte
37
+ * view bypasses that conversion and preserves every octet unchanged.
38
+ *
39
+ * The initial state mandated by the symbology is UPPER. The greedy text pass
40
+ * uses UPPER, LOWER, DIGIT and PUNCT tables, selecting the shortest available
41
+ * latch at each byte. Bytes without a text-table representation are emitted
42
+ * through the standard B/S (binary shift) escape. B/S is available from
43
+ * UPPER and makes this a complete, lossless representation of UTF-8 payloads.
44
+ *
45
+ * @module aztec/high-level
46
+ */
47
+ import { BitWriter } from '../core/bit-buffer.js';
48
+ /** Aztec high-level table identifiers, exposed for decoder/API symmetry. */
49
+ export declare const HIGH_LEVEL_MODE: Readonly<{
50
+ UPPER: 0;
51
+ LOWER: 1;
52
+ DIGIT: 2;
53
+ MIXED: 3;
54
+ PUNCT: 4;
55
+ }>;
56
+ /** Maximum number of bytes represented by one B/S escape. */
57
+ export declare const MAX_BINARY_SHIFT = 2078;
58
+ /**
59
+ * Convert accepted public input to its encoded octets.
60
+ *
61
+ * @param {string|ArrayBuffer|ArrayBufferView} value
62
+ * @param {'utf-8'} [charset]
63
+ * @returns {Uint8Array}
64
+ */
65
+ export declare function aztecBytes(value: string | ArrayBuffer | ArrayBufferView, charset?: 'utf-8'): Uint8Array;
66
+ /**
67
+ * Write an Aztec binary-shift segment while in UPPER mode.
68
+ *
69
+ * B/S is `11111`; its five-bit length directly covers 1..31 bytes. A zero
70
+ * length selects the extended eleven-bit form, whose stored value is n - 31.
71
+ * Splitting at 2078 keeps each control representable and makes arbitrarily
72
+ * long byte input well-defined.
73
+ *
74
+ * @param {BitWriter} writer
75
+ * @param {Uint8Array} bytes
76
+ * @param {number} start
77
+ * @param {number} length
78
+ */
79
+ export declare function writeBinaryShift(writer: BitWriter, bytes: Uint8Array, start: number, length: number): void;
80
+ /**
81
+ * Build a valid Aztec high-level bitstream.
82
+ *
83
+ * @param {string|ArrayBuffer|ArrayBufferView} value
84
+ * @param {{charset?: 'utf-8'}} [options]
85
+ * @returns {BitWriter}
86
+ */
87
+ export declare function encodeHighLevel(value: string | ArrayBuffer | ArrayBufferView, options?: {
88
+ charset?: 'utf-8';
89
+ }): BitWriter;
@@ -0,0 +1,35 @@
1
+ /*!
2
+ * Sythos Barcode Suite
3
+ *
4
+ * MIT License
5
+ *
6
+ * Copyright (c) 2026 Sythos
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the "Software"), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
27
+ * SPDX-License-Identifier: MIT
28
+ *
29
+ * Original work. No code from any other barcode implementation.
30
+ */
31
+ /** Aztec Code entry points. @module aztec */
32
+ export { encodeAztec } from './encoder.js';
33
+ export { decodeAztec } from './decoder.js';
34
+ export { detectAztec, detectAndDecodeAztec } from './detector.js';
35
+ export { AZTEC_COMPACT_LAYERS, AZTEC_FULL_LAYERS, AZTEC_LAYERS, AZTEC_DEFAULT_ECC_PERCENT, AZTEC_RS_GENERATOR_BASE, aztecLayer, aztecSymbolSize, validateAztecTables, } from './tables.js';