@sythos/js_barcode_universal 1.5.6 → 1.5.8

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 (180) hide show
  1. package/NOTICE.md +1 -1
  2. package/README.md +55 -35
  3. package/bundle/sythos-barcode.esm.js +618 -465
  4. package/bundle/sythos-barcode.js +618 -465
  5. package/package.json +90 -24
  6. package/src/index.d.ts +363 -0
  7. package/src/index.js +286 -133
  8. package/src/{aztec → js/aztec}/decoder.js +0 -1
  9. package/src/{aztec → js/aztec}/detector.js +0 -1
  10. package/src/{aztec → js/aztec}/encoder.js +0 -1
  11. package/src/{aztec → js/aztec}/high-level.js +0 -1
  12. package/src/{aztec → js/aztec}/index.js +0 -1
  13. package/src/{aztec → js/aztec}/tables.js +0 -1
  14. package/src/{aztecrune → js/aztecrune}/decoder.js +0 -1
  15. package/src/{aztecrune → js/aztecrune}/detector.js +0 -1
  16. package/src/{aztecrune → js/aztecrune}/encoder.js +0 -1
  17. package/src/{aztecrune → js/aztecrune}/index.js +0 -1
  18. package/src/{aztecrune → js/aztecrune}/tables.js +0 -1
  19. package/src/{compactpdf417 → js/compactpdf417}/decoder.js +0 -1
  20. package/src/{compactpdf417 → js/compactpdf417}/detector.js +0 -1
  21. package/src/{compactpdf417 → js/compactpdf417}/encoder.js +0 -1
  22. package/src/{compactpdf417 → js/compactpdf417}/index.js +0 -5
  23. package/src/{compactpdf417 → js/compactpdf417}/tables.js +0 -1
  24. package/src/{core → js/core}/bit-buffer.js +0 -1
  25. package/src/{core → js/core}/bit-matrix.js +0 -1
  26. package/src/{core → js/core}/errors.js +0 -1
  27. package/src/{core → js/core}/galois-field.js +0 -1
  28. package/src/{core → js/core}/index.js +0 -1
  29. package/src/{core → js/core}/reed-solomon.js +0 -1
  30. package/src/{databar → js/databar}/codec.js +0 -1
  31. package/src/{databar → js/databar}/decoder.js +0 -1
  32. package/src/{databar → js/databar}/encoder.js +0 -1
  33. package/src/{databar → js/databar}/gs1.js +0 -1
  34. package/src/{databar → js/databar}/index.js +0 -1
  35. package/src/{databar → js/databar}/patterns.js +0 -1
  36. package/src/{databar → js/databar}/tables.js +0 -1
  37. package/src/{datamatrix → js/datamatrix}/decoder.js +0 -1
  38. package/src/{datamatrix → js/datamatrix}/detector.js +0 -1
  39. package/src/{datamatrix → js/datamatrix}/encoder.js +0 -1
  40. package/src/{datamatrix → js/datamatrix}/index.js +0 -1
  41. package/src/{datamatrix → js/datamatrix}/tables.js +0 -1
  42. package/src/{frameqr → js/frameqr}/decoder.js +15 -16
  43. package/src/{frameqr → js/frameqr}/detector.js +2 -3
  44. package/src/{frameqr → js/frameqr}/encoder.js +7 -8
  45. package/src/{frameqr → js/frameqr}/index.js +0 -1
  46. package/src/{frameqr → js/frameqr}/tables.js +10 -11
  47. package/src/{image → js/image}/binarizer.js +0 -1
  48. package/src/{image → js/image}/grid-sampler.js +0 -1
  49. package/src/js/image/index.js +40 -0
  50. package/src/{image → js/image}/luminance.js +0 -1
  51. package/src/{image → js/image}/perspective.js +0 -1
  52. package/src/{micropdf417 → js/micropdf417}/compaction.js +0 -1
  53. package/src/{micropdf417 → js/micropdf417}/decoder.js +0 -1
  54. package/src/{micropdf417 → js/micropdf417}/detector.js +0 -1
  55. package/src/{micropdf417 → js/micropdf417}/encoder.js +0 -1
  56. package/src/{micropdf417 → js/micropdf417}/error-correction.js +0 -1
  57. package/src/{micropdf417 → js/micropdf417}/index.js +0 -1
  58. package/src/{micropdf417 → js/micropdf417}/tables.js +0 -1
  59. package/src/{microqr → js/microqr}/decoder.js +0 -1
  60. package/src/{microqr → js/microqr}/detector.js +0 -1
  61. package/src/{microqr → js/microqr}/encoder.js +0 -1
  62. package/src/js/microqr/index.js +36 -0
  63. package/src/{microqr → js/microqr}/tables.js +0 -1
  64. package/src/{oned → js/oned}/addons.js +0 -1
  65. package/src/{oned → js/oned}/index.js +0 -1
  66. package/src/{oned → js/oned}/patterns.js +0 -1
  67. package/src/{oned → js/oned}/reader.js +0 -1
  68. package/src/{oned → js/oned}/writers.js +0 -1
  69. package/src/{pdf417 → js/pdf417}/compaction.js +0 -1
  70. package/src/{pdf417 → js/pdf417}/decoder.js +0 -1
  71. package/src/{pdf417 → js/pdf417}/detector.js +0 -1
  72. package/src/{pdf417 → js/pdf417}/encoder.js +0 -1
  73. package/src/{pdf417 → js/pdf417}/error-correction.js +0 -1
  74. package/src/js/pdf417/index.js +6 -0
  75. package/src/{pdf417 → js/pdf417}/tables.js +0 -1
  76. package/src/{qr → js/qr}/decoder.js +0 -1
  77. package/src/{qr → js/qr}/detector.js +0 -1
  78. package/src/{qr → js/qr}/encoder.js +0 -1
  79. package/src/js/qr/index.js +44 -0
  80. package/src/{qr → js/qr}/tables.js +0 -1
  81. package/src/{render → js/render}/image-data.js +0 -1
  82. package/src/{render → js/render}/index.js +0 -1
  83. package/src/{render → js/render}/options.js +0 -1
  84. package/src/{render → js/render}/png.js +0 -1
  85. package/src/{render → js/render}/svg.js +0 -1
  86. package/src/{render → js/render}/webgl.js +0 -1
  87. package/src/{render → js/render}/webgpu.js +0 -1
  88. package/src/{rmqr → js/rmqr}/decoder.js +0 -1
  89. package/src/{rmqr → js/rmqr}/detector.js +0 -1
  90. package/src/{rmqr → js/rmqr}/encoder.js +0 -1
  91. package/src/{rmqr → js/rmqr}/index.js +0 -1
  92. package/src/{rmqr → js/rmqr}/tables.js +0 -1
  93. package/src/ts/aztec/decoder.d.ts +57 -0
  94. package/src/ts/aztec/detector.d.ts +62 -0
  95. package/src/ts/aztec/encoder.d.ts +94 -0
  96. package/src/ts/aztec/high-level.d.ts +89 -0
  97. package/src/ts/aztec/index.d.ts +35 -0
  98. package/src/ts/aztec/tables.d.ts +144 -0
  99. package/src/ts/aztecrune/decoder.d.ts +56 -0
  100. package/src/ts/aztecrune/detector.d.ts +53 -0
  101. package/src/ts/aztecrune/encoder.d.ts +51 -0
  102. package/src/ts/aztecrune/index.d.ts +35 -0
  103. package/src/ts/aztecrune/tables.d.ts +75 -0
  104. package/src/ts/bundle/sythos-barcode.d.ts +31 -0
  105. package/src/ts/bundle/sythos-barcode.esm.d.ts +31 -0
  106. package/src/ts/compactpdf417/decoder.d.ts +64 -0
  107. package/src/ts/compactpdf417/detector.d.ts +48 -0
  108. package/src/ts/compactpdf417/encoder.d.ts +49 -0
  109. package/src/ts/compactpdf417/index.d.ts +8 -0
  110. package/src/ts/compactpdf417/tables.d.ts +84 -0
  111. package/src/ts/core/bit-buffer.d.ts +78 -0
  112. package/src/ts/core/bit-matrix.d.ts +129 -0
  113. package/src/ts/core/errors.d.ts +57 -0
  114. package/src/ts/core/galois-field.d.ts +141 -0
  115. package/src/ts/core/index.d.ts +40 -0
  116. package/src/ts/core/reed-solomon.d.ts +65 -0
  117. package/src/ts/databar/codec.d.ts +78 -0
  118. package/src/ts/databar/decoder.d.ts +55 -0
  119. package/src/ts/databar/encoder.d.ts +34 -0
  120. package/src/ts/databar/gs1.d.ts +48 -0
  121. package/src/ts/databar/index.d.ts +37 -0
  122. package/src/ts/databar/patterns.d.ts +46 -0
  123. package/src/ts/databar/tables.d.ts +119 -0
  124. package/src/ts/datamatrix/decoder.d.ts +57 -0
  125. package/src/ts/datamatrix/detector.d.ts +59 -0
  126. package/src/ts/datamatrix/encoder.d.ts +36 -0
  127. package/src/ts/datamatrix/index.d.ts +35 -0
  128. package/src/ts/datamatrix/tables.d.ts +88 -0
  129. package/src/ts/frameqr/decoder.d.ts +64 -0
  130. package/src/ts/frameqr/detector.d.ts +96 -0
  131. package/src/ts/frameqr/encoder.d.ts +73 -0
  132. package/src/ts/frameqr/index.d.ts +34 -0
  133. package/src/ts/frameqr/tables.d.ts +123 -0
  134. package/src/ts/image/binarizer.d.ts +85 -0
  135. package/src/ts/image/grid-sampler.d.ts +82 -0
  136. package/src/{image/index.js → ts/image/index.d.ts} +0 -2
  137. package/src/ts/image/luminance.d.ts +112 -0
  138. package/src/ts/image/perspective.d.ts +111 -0
  139. package/src/ts/index.d.ts +363 -0
  140. package/src/ts/micropdf417/compaction.d.ts +38 -0
  141. package/src/ts/micropdf417/decoder.d.ts +57 -0
  142. package/src/ts/micropdf417/detector.d.ts +95 -0
  143. package/src/ts/micropdf417/encoder.d.ts +34 -0
  144. package/src/ts/micropdf417/error-correction.d.ts +38 -0
  145. package/src/ts/micropdf417/index.d.ts +36 -0
  146. package/src/ts/micropdf417/tables.d.ts +73 -0
  147. package/src/ts/microqr/decoder.d.ts +49 -0
  148. package/src/ts/microqr/detector.d.ts +96 -0
  149. package/src/ts/microqr/encoder.d.ts +33 -0
  150. package/src/{microqr/index.js → ts/microqr/index.d.ts} +0 -2
  151. package/src/ts/microqr/tables.d.ts +107 -0
  152. package/src/ts/oned/addons.d.ts +181 -0
  153. package/src/ts/oned/index.d.ts +55 -0
  154. package/src/ts/oned/patterns.d.ts +259 -0
  155. package/src/ts/oned/reader.d.ts +129 -0
  156. package/src/ts/oned/writers.d.ts +218 -0
  157. package/src/ts/pdf417/compaction.d.ts +59 -0
  158. package/src/ts/pdf417/decoder.d.ts +48 -0
  159. package/src/ts/pdf417/detector.d.ts +73 -0
  160. package/src/ts/pdf417/encoder.d.ts +32 -0
  161. package/src/ts/pdf417/error-correction.d.ts +34 -0
  162. package/src/{pdf417/index.js → ts/pdf417/index.d.ts} +0 -1
  163. package/src/ts/pdf417/tables.d.ts +53 -0
  164. package/src/ts/qr/decoder.d.ts +79 -0
  165. package/src/ts/qr/detector.d.ts +93 -0
  166. package/src/ts/qr/encoder.d.ts +166 -0
  167. package/src/{qr/index.js → ts/qr/index.d.ts} +0 -2
  168. package/src/ts/qr/tables.d.ts +291 -0
  169. package/src/ts/render/image-data.d.ts +58 -0
  170. package/src/ts/render/index.d.ts +110 -0
  171. package/src/ts/render/options.d.ts +98 -0
  172. package/src/ts/render/png.d.ts +58 -0
  173. package/src/ts/render/svg.d.ts +46 -0
  174. package/src/ts/render/webgl.d.ts +45 -0
  175. package/src/ts/render/webgpu.d.ts +51 -0
  176. package/src/ts/rmqr/decoder.d.ts +42 -0
  177. package/src/ts/rmqr/detector.d.ts +81 -0
  178. package/src/ts/rmqr/encoder.d.ts +45 -0
  179. package/src/ts/rmqr/index.d.ts +34 -0
  180. package/src/ts/rmqr/tables.d.ts +89 -0
@@ -0,0 +1,110 @@
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
+ * Output backends.
33
+ *
34
+ * ## On GPU acceleration — read this before assuming what it does
35
+ *
36
+ * The WebGL2 and WebGPU backends accelerate **drawing** a barcode, not
37
+ * **computing** one. That distinction is worth stating plainly, because "GPU
38
+ * barcode generation" naturally sounds like the latter.
39
+ *
40
+ * Encoding is sequential integer work: Reed-Solomon polynomial division, mask
41
+ * penalty scoring, bit placement along a zig-zag path. Each step depends on the
42
+ * one before it, which is precisely the shape a GPU cannot exploit. A complete
43
+ * QR encode takes well under a millisecond on the CPU — less time than it takes
44
+ * to dispatch a compute shader and read the result back. Moving it to the GPU
45
+ * would make it slower, not faster, and no amount of engineering changes that.
46
+ *
47
+ * What the GPU genuinely helps with:
48
+ *
49
+ * - **Drawing** large symbols, or many symbols per frame, straight into a
50
+ * canvas without a CPU-side pixel buffer.
51
+ * - **Reading**, where per-frame greyscale conversion and block statistics
52
+ * over a 1080p or 4K camera image are the real bottleneck and are
53
+ * embarrassingly parallel.
54
+ *
55
+ * So: encoding stays on the CPU because that is the correct engineering answer,
56
+ * not because of a missing feature.
57
+ *
58
+ * @module render
59
+ */
60
+ export { toSVG, toSVGDataURI } from './svg.js';
61
+ export { toImageData, toCanvas } from './image-data.js';
62
+ export { toPNG, toPNGDataURI, deflateStored } from './png.js';
63
+ export { isWebGL2Available, renderToCanvasWebGL } from './webgl.js';
64
+ export { isWebGPUAvailable, renderToCanvasWebGPU } from './webgpu.js';
65
+ export { normalizeOptions, parseColor } from './options.js';
66
+ /**
67
+ * Draw into a canvas using the best backend available.
68
+ *
69
+ * Tries WebGL2, then the 2D context. The 2D path is always available, so this
70
+ * never fails on a browser that can run the library at all — including every
71
+ * version of Safari on iOS.
72
+ *
73
+ * WebGPU is not reachable from here, and cannot be: obtaining an adapter is
74
+ * asynchronous, so a synchronous function can never wait for one. Use
75
+ * `renderToCanvasAutoAsync` to include it. This one stays synchronous because
76
+ * it is the documented signature and callers rely on the returned backend name
77
+ * being available immediately.
78
+ *
79
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
80
+ * @param {HTMLCanvasElement | OffscreenCanvas} canvas
81
+ * @param {import('./options.js').RenderOptions & {backend?: 'auto'|'webgl2'|'2d'}} [options]
82
+ * @returns {{backend: 'webgl2' | '2d' | 'none'}}
83
+ */
84
+ export declare function renderToCanvasAuto(matrix: import('../core/bit-matrix.js').BitMatrix, canvas: HTMLCanvasElement | OffscreenCanvas, options?: import('./options.js').RenderOptions & {
85
+ backend?: 'auto' | 'webgl2' | '2d';
86
+ }): {
87
+ backend: 'webgl2' | '2d' | 'none';
88
+ };
89
+ /**
90
+ * Draw into a canvas using the best backend available, including WebGPU.
91
+ *
92
+ * Tries WebGPU, then WebGL2, then the 2D context, and returns the name of the
93
+ * one that drew.
94
+ *
95
+ * Each backend is *probed* before the canvas is handed to it. That ordering is
96
+ * deliberate: a canvas can only ever have one kind of context, so committing it
97
+ * to WebGPU and failing afterwards would leave it unable to fall back to
98
+ * WebGL2 or 2D. The probes use throwaway objects of their own, so the caller's
99
+ * canvas is only touched by a backend that is already known to work.
100
+ *
101
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
102
+ * @param {HTMLCanvasElement | OffscreenCanvas} canvas
103
+ * @param {import('./options.js').RenderOptions & {backend?: 'auto'|'webgpu'|'webgl2'|'2d'}} [options]
104
+ * @returns {Promise<{backend: 'webgpu' | 'webgl2' | '2d' | 'none'}>}
105
+ */
106
+ export declare function renderToCanvasAutoAsync(matrix: import('../core/bit-matrix.js').BitMatrix, canvas: HTMLCanvasElement | OffscreenCanvas, options?: import('./options.js').RenderOptions & {
107
+ backend?: 'auto' | 'webgpu' | 'webgl2' | '2d';
108
+ }): Promise<{
109
+ backend: 'webgpu' | 'webgl2' | '2d' | 'none';
110
+ }>;
@@ -0,0 +1,98 @@
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
+ * Shared render options, normalised once so every backend agrees.
33
+ *
34
+ * @module render/options
35
+ */
36
+ import { BitMatrix } from '../core/bit-matrix.js';
37
+ export type RenderOptions = {
38
+ /**
39
+ * Pixels per module. Default 8.
40
+ */
41
+ scale?: number;
42
+ /**
43
+ * Quiet-zone modules on every side. Default 4.
44
+ */
45
+ margin?: number;
46
+ /**
47
+ * Colour of set modules. Default '#000000'.
48
+ */
49
+ dark?: string;
50
+ /**
51
+ * Colour of clear modules, or 'none' for transparent.
52
+ */
53
+ light?: string;
54
+ /**
55
+ * For 1D symbols: total bar height in pixels.
56
+ */
57
+ barHeight?: number;
58
+ };
59
+ /**
60
+ * @typedef {object} RenderOptions
61
+ * @property {number} [scale] Pixels per module. Default 8.
62
+ * @property {number} [margin] Quiet-zone modules on every side. Default 4.
63
+ * @property {string} [dark] Colour of set modules. Default '#000000'.
64
+ * @property {string} [light] Colour of clear modules, or 'none' for transparent.
65
+ * @property {number} [barHeight] For 1D symbols: total bar height in pixels.
66
+ */
67
+ /**
68
+ * Expand and pad the matrix, and resolve every dimension.
69
+ *
70
+ * Linear symbols arrive one module tall. They are stretched to `barHeight`
71
+ * *before* the quiet zone is applied, so the margin ends up uniform on all
72
+ * four sides — padding first would leave a quiet zone one module tall against
73
+ * bars a hundred pixels tall, which no scanner would accept.
74
+ *
75
+ * @param {BitMatrix} matrix
76
+ * @param {RenderOptions} options
77
+ */
78
+ export declare function normalizeOptions(matrix: BitMatrix, options?: RenderOptions): {
79
+ scale: number;
80
+ margin: number;
81
+ dark: string;
82
+ light: string;
83
+ is1D: boolean;
84
+ source: BitMatrix;
85
+ rowHeight: number;
86
+ pixelWidth: number;
87
+ pixelHeight: number;
88
+ };
89
+ /**
90
+ * Parse a CSS colour into RGBA bytes.
91
+ *
92
+ * Supports the forms a barcode actually needs: #rgb, #rgba, #rrggbb,
93
+ * #rrggbbaa, rgb(), rgba(), plus 'none' and 'transparent'.
94
+ *
95
+ * @param {string} colour
96
+ * @returns {[number, number, number, number]}
97
+ */
98
+ export declare function parseColor(colour: string): [number, number, number, number];
@@ -0,0 +1,58 @@
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
+ * Wrap data in stored (type 00) deflate blocks with a zlib header.
33
+ *
34
+ * A stored block's length field is sixteen bits, so each block caps at 65535
35
+ * bytes and longer data must be split. BFINAL is set on the last block only —
36
+ * getting that wrong yields a stream that decodes correctly for any small
37
+ * image and truncates on the first large one.
38
+ *
39
+ * @param {Uint8Array} data
40
+ * @returns {Uint8Array}
41
+ */
42
+ export declare function deflateStored(data: Uint8Array): Uint8Array;
43
+ /**
44
+ * Render to a PNG file.
45
+ *
46
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
47
+ * @param {import('./options.js').RenderOptions} [options]
48
+ * @returns {Promise<Uint8Array>}
49
+ */
50
+ export declare function toPNG(matrix: import('../core/bit-matrix.js').BitMatrix, options?: import('./options.js').RenderOptions): Promise<Uint8Array>;
51
+ /**
52
+ * Render to a data URI usable as an `<img>` src or a download href.
53
+ *
54
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
55
+ * @param {import('./options.js').RenderOptions} [options]
56
+ * @returns {Promise<string>}
57
+ */
58
+ export declare function toPNGDataURI(matrix: import('../core/bit-matrix.js').BitMatrix, options?: import('./options.js').RenderOptions): Promise<string>;
@@ -0,0 +1,46 @@
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
+ * Render to an SVG document.
33
+ *
34
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
35
+ * @param {import('./options.js').RenderOptions} [options]
36
+ * @returns {string}
37
+ */
38
+ export declare function toSVG(matrix: import('../core/bit-matrix.js').BitMatrix, options?: import('./options.js').RenderOptions): string;
39
+ /**
40
+ * Render to a data URI usable directly as an `<img>` src.
41
+ *
42
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
43
+ * @param {import('./options.js').RenderOptions} [options]
44
+ * @returns {string}
45
+ */
46
+ export declare function toSVGDataURI(matrix: import('../core/bit-matrix.js').BitMatrix, options?: import('./options.js').RenderOptions): string;
@@ -0,0 +1,45 @@
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
+ * Is WebGL2 usable here?
33
+ *
34
+ * @returns {boolean}
35
+ */
36
+ export declare function isWebGL2Available(): boolean;
37
+ /**
38
+ * Draw a matrix into a canvas with WebGL2.
39
+ *
40
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
41
+ * @param {HTMLCanvasElement | OffscreenCanvas} canvas
42
+ * @param {import('./options.js').RenderOptions} [options]
43
+ * @returns {boolean} True if it drew; false means the caller should fall back.
44
+ */
45
+ export declare function renderToCanvasWebGL(matrix: import('../core/bit-matrix.js').BitMatrix, canvas: HTMLCanvasElement | OffscreenCanvas, options?: import('./options.js').RenderOptions): boolean;
@@ -0,0 +1,51 @@
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
+ * Is WebGPU usable here?
33
+ *
34
+ * Resolves false rather than throwing on every unsupported path, including
35
+ * Node, where there is no `navigator.gpu` at all.
36
+ *
37
+ * @returns {Promise<boolean>}
38
+ */
39
+ export declare function isWebGPUAvailable(): Promise<boolean>;
40
+ /**
41
+ * Draw a matrix into a canvas with WebGPU.
42
+ *
43
+ * @param {import('../core/bit-matrix.js').BitMatrix} matrix
44
+ * @param {HTMLCanvasElement | OffscreenCanvas} canvas
45
+ * @param {import('./options.js').RenderOptions} [options]
46
+ * @returns {Promise<boolean>} True if it drew; false means the caller should
47
+ * fall back. Note that a canvas whose context has already been taken for
48
+ * WebGPU cannot then be handed to WebGL2 or 2D, so callers should probe
49
+ * availability before committing a canvas to this path.
50
+ */
51
+ export declare function renderToCanvasWebGPU(matrix: import('../core/bit-matrix.js').BitMatrix, canvas: HTMLCanvasElement | OffscreenCanvas, options?: import('./options.js').RenderOptions): Promise<boolean>;
@@ -0,0 +1,42 @@
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
+ import { ChecksumError } from '../core/errors.js';
32
+ /** Decode an exact rMQR module matrix (without quiet zone). */
33
+ export declare function decodeRMQR(matrix: any): {
34
+ text: string;
35
+ bytes: Uint8Array<ArrayBuffer>;
36
+ version: number;
37
+ name: `R${number}x${number}`;
38
+ ecc: string;
39
+ mask: number;
40
+ corrections: number;
41
+ };
42
+ export { ChecksumError };
@@ -0,0 +1,81 @@
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
+ import { BitMatrix } from '../core/bit-matrix.js';
32
+ /** Detect an axis-aligned, clean rMQR raster and return the exact module matrix. */
33
+ export declare function detectRMQR(image: any, options?: {}): {
34
+ matrix: BitMatrix;
35
+ result: {
36
+ text: string;
37
+ bytes: Uint8Array<ArrayBuffer>;
38
+ version: number;
39
+ name: `R${number}x${number}`;
40
+ ecc: string;
41
+ mask: number;
42
+ corrections: number;
43
+ };
44
+ rotation: number;
45
+ corners: {
46
+ x: any;
47
+ y: any;
48
+ width: any;
49
+ height: any;
50
+ };
51
+ scale?: undefined;
52
+ } | {
53
+ matrix: BitMatrix;
54
+ result: {
55
+ text: string;
56
+ bytes: Uint8Array<ArrayBuffer>;
57
+ version: number;
58
+ name: `R${number}x${number}`;
59
+ ecc: string;
60
+ mask: number;
61
+ corrections: number;
62
+ };
63
+ rotation: number;
64
+ scale: number;
65
+ corners: {
66
+ x: any;
67
+ y: any;
68
+ width: any;
69
+ height: any;
70
+ };
71
+ };
72
+ /** Detect and decode a raster in one call. */
73
+ export declare function detectAndDecodeRMQR(image: any, options?: {}): {
74
+ text: string;
75
+ bytes: Uint8Array<ArrayBuffer>;
76
+ version: number;
77
+ name: `R${number}x${number}`;
78
+ ecc: string;
79
+ mask: number;
80
+ corrections: number;
81
+ };
@@ -0,0 +1,45 @@
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
+ import { BitMatrix } from '../core/bit-matrix.js';
32
+ export declare const ALPHANUMERIC_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
33
+ declare const MODE: Readonly<{
34
+ TERMINATOR: 0;
35
+ NUMERIC: 1;
36
+ ALPHANUMERIC: 2;
37
+ BYTE: 3;
38
+ KANJI: 4;
39
+ FNC1: 5;
40
+ FNC1_SECOND: 6;
41
+ ECI: 7;
42
+ }>;
43
+ /** Encode text into a rMQR module matrix. */
44
+ export declare function encodeRMQR(text: any, options?: {}): BitMatrix;
45
+ export { MODE };
@@ -0,0 +1,34 @@
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 { encodeRMQR, ALPHANUMERIC_CHARS } from './encoder.js';
32
+ export { decodeRMQR } from './decoder.js';
33
+ export { detectRMQR, detectAndDecodeRMQR } from './detector.js';
34
+ export { RMQR_SIZES, versionInfo, versionForSize, alignmentCoordinates, dataModuleOrder, functionModules, dataBitCapacity, formatBits, maskBit, validateTables, } from './tables.js';