@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.
- package/NOTICE.md +1 -1
- package/README.md +55 -35
- package/bundle/sythos-barcode.esm.js +618 -465
- package/bundle/sythos-barcode.js +618 -465
- package/package.json +90 -24
- package/src/index.d.ts +363 -0
- package/src/index.js +286 -133
- package/src/{aztec → js/aztec}/decoder.js +0 -1
- package/src/{aztec → js/aztec}/detector.js +0 -1
- package/src/{aztec → js/aztec}/encoder.js +0 -1
- package/src/{aztec → js/aztec}/high-level.js +0 -1
- package/src/{aztec → js/aztec}/index.js +0 -1
- package/src/{aztec → js/aztec}/tables.js +0 -1
- package/src/{aztecrune → js/aztecrune}/decoder.js +0 -1
- package/src/{aztecrune → js/aztecrune}/detector.js +0 -1
- package/src/{aztecrune → js/aztecrune}/encoder.js +0 -1
- package/src/{aztecrune → js/aztecrune}/index.js +0 -1
- package/src/{aztecrune → js/aztecrune}/tables.js +0 -1
- package/src/{compactpdf417 → js/compactpdf417}/decoder.js +0 -1
- package/src/{compactpdf417 → js/compactpdf417}/detector.js +0 -1
- package/src/{compactpdf417 → js/compactpdf417}/encoder.js +0 -1
- package/src/{compactpdf417 → js/compactpdf417}/index.js +0 -5
- package/src/{compactpdf417 → js/compactpdf417}/tables.js +0 -1
- package/src/{core → js/core}/bit-buffer.js +0 -1
- package/src/{core → js/core}/bit-matrix.js +0 -1
- package/src/{core → js/core}/errors.js +0 -1
- package/src/{core → js/core}/galois-field.js +0 -1
- package/src/{core → js/core}/index.js +0 -1
- package/src/{core → js/core}/reed-solomon.js +0 -1
- package/src/{databar → js/databar}/codec.js +0 -1
- package/src/{databar → js/databar}/decoder.js +0 -1
- package/src/{databar → js/databar}/encoder.js +0 -1
- package/src/{databar → js/databar}/gs1.js +0 -1
- package/src/{databar → js/databar}/index.js +0 -1
- package/src/{databar → js/databar}/patterns.js +0 -1
- package/src/{databar → js/databar}/tables.js +0 -1
- package/src/{datamatrix → js/datamatrix}/decoder.js +0 -1
- package/src/{datamatrix → js/datamatrix}/detector.js +0 -1
- package/src/{datamatrix → js/datamatrix}/encoder.js +0 -1
- package/src/{datamatrix → js/datamatrix}/index.js +0 -1
- package/src/{datamatrix → js/datamatrix}/tables.js +0 -1
- package/src/{frameqr → js/frameqr}/decoder.js +15 -16
- package/src/{frameqr → js/frameqr}/detector.js +2 -3
- package/src/{frameqr → js/frameqr}/encoder.js +7 -8
- package/src/{frameqr → js/frameqr}/index.js +0 -1
- package/src/{frameqr → js/frameqr}/tables.js +10 -11
- package/src/{image → js/image}/binarizer.js +0 -1
- package/src/{image → js/image}/grid-sampler.js +0 -1
- package/src/js/image/index.js +40 -0
- package/src/{image → js/image}/luminance.js +0 -1
- package/src/{image → js/image}/perspective.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/compaction.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/decoder.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/detector.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/encoder.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/error-correction.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/index.js +0 -1
- package/src/{micropdf417 → js/micropdf417}/tables.js +0 -1
- package/src/{microqr → js/microqr}/decoder.js +0 -1
- package/src/{microqr → js/microqr}/detector.js +0 -1
- package/src/{microqr → js/microqr}/encoder.js +0 -1
- package/src/js/microqr/index.js +36 -0
- package/src/{microqr → js/microqr}/tables.js +0 -1
- package/src/{oned → js/oned}/addons.js +0 -1
- package/src/{oned → js/oned}/index.js +0 -1
- package/src/{oned → js/oned}/patterns.js +0 -1
- package/src/{oned → js/oned}/reader.js +0 -1
- package/src/{oned → js/oned}/writers.js +0 -1
- package/src/{pdf417 → js/pdf417}/compaction.js +0 -1
- package/src/{pdf417 → js/pdf417}/decoder.js +0 -1
- package/src/{pdf417 → js/pdf417}/detector.js +0 -1
- package/src/{pdf417 → js/pdf417}/encoder.js +0 -1
- package/src/{pdf417 → js/pdf417}/error-correction.js +0 -1
- package/src/js/pdf417/index.js +6 -0
- package/src/{pdf417 → js/pdf417}/tables.js +0 -1
- package/src/{qr → js/qr}/decoder.js +0 -1
- package/src/{qr → js/qr}/detector.js +0 -1
- package/src/{qr → js/qr}/encoder.js +0 -1
- package/src/js/qr/index.js +44 -0
- package/src/{qr → js/qr}/tables.js +0 -1
- package/src/{render → js/render}/image-data.js +0 -1
- package/src/{render → js/render}/index.js +0 -1
- package/src/{render → js/render}/options.js +0 -1
- package/src/{render → js/render}/png.js +0 -1
- package/src/{render → js/render}/svg.js +0 -1
- package/src/{render → js/render}/webgl.js +0 -1
- package/src/{render → js/render}/webgpu.js +0 -1
- package/src/{rmqr → js/rmqr}/decoder.js +0 -1
- package/src/{rmqr → js/rmqr}/detector.js +0 -1
- package/src/{rmqr → js/rmqr}/encoder.js +0 -1
- package/src/{rmqr → js/rmqr}/index.js +0 -1
- package/src/{rmqr → js/rmqr}/tables.js +0 -1
- package/src/ts/aztec/decoder.d.ts +57 -0
- package/src/ts/aztec/detector.d.ts +62 -0
- package/src/ts/aztec/encoder.d.ts +94 -0
- package/src/ts/aztec/high-level.d.ts +89 -0
- package/src/ts/aztec/index.d.ts +35 -0
- package/src/ts/aztec/tables.d.ts +144 -0
- package/src/ts/aztecrune/decoder.d.ts +56 -0
- package/src/ts/aztecrune/detector.d.ts +53 -0
- package/src/ts/aztecrune/encoder.d.ts +51 -0
- package/src/ts/aztecrune/index.d.ts +35 -0
- package/src/ts/aztecrune/tables.d.ts +75 -0
- package/src/ts/bundle/sythos-barcode.d.ts +31 -0
- package/src/ts/bundle/sythos-barcode.esm.d.ts +31 -0
- package/src/ts/compactpdf417/decoder.d.ts +64 -0
- package/src/ts/compactpdf417/detector.d.ts +48 -0
- package/src/ts/compactpdf417/encoder.d.ts +49 -0
- package/src/ts/compactpdf417/index.d.ts +8 -0
- package/src/ts/compactpdf417/tables.d.ts +84 -0
- package/src/ts/core/bit-buffer.d.ts +78 -0
- package/src/ts/core/bit-matrix.d.ts +129 -0
- package/src/ts/core/errors.d.ts +57 -0
- package/src/ts/core/galois-field.d.ts +141 -0
- package/src/ts/core/index.d.ts +40 -0
- package/src/ts/core/reed-solomon.d.ts +65 -0
- package/src/ts/databar/codec.d.ts +78 -0
- package/src/ts/databar/decoder.d.ts +55 -0
- package/src/ts/databar/encoder.d.ts +34 -0
- package/src/ts/databar/gs1.d.ts +48 -0
- package/src/ts/databar/index.d.ts +37 -0
- package/src/ts/databar/patterns.d.ts +46 -0
- package/src/ts/databar/tables.d.ts +119 -0
- package/src/ts/datamatrix/decoder.d.ts +57 -0
- package/src/ts/datamatrix/detector.d.ts +59 -0
- package/src/ts/datamatrix/encoder.d.ts +36 -0
- package/src/ts/datamatrix/index.d.ts +35 -0
- package/src/ts/datamatrix/tables.d.ts +88 -0
- package/src/ts/frameqr/decoder.d.ts +64 -0
- package/src/ts/frameqr/detector.d.ts +96 -0
- package/src/ts/frameqr/encoder.d.ts +73 -0
- package/src/ts/frameqr/index.d.ts +34 -0
- package/src/ts/frameqr/tables.d.ts +123 -0
- package/src/ts/image/binarizer.d.ts +85 -0
- package/src/ts/image/grid-sampler.d.ts +82 -0
- package/src/{image/index.js → ts/image/index.d.ts} +0 -2
- package/src/ts/image/luminance.d.ts +112 -0
- package/src/ts/image/perspective.d.ts +111 -0
- package/src/ts/index.d.ts +363 -0
- package/src/ts/micropdf417/compaction.d.ts +38 -0
- package/src/ts/micropdf417/decoder.d.ts +57 -0
- package/src/ts/micropdf417/detector.d.ts +95 -0
- package/src/ts/micropdf417/encoder.d.ts +34 -0
- package/src/ts/micropdf417/error-correction.d.ts +38 -0
- package/src/ts/micropdf417/index.d.ts +36 -0
- package/src/ts/micropdf417/tables.d.ts +73 -0
- package/src/ts/microqr/decoder.d.ts +49 -0
- package/src/ts/microqr/detector.d.ts +96 -0
- package/src/ts/microqr/encoder.d.ts +33 -0
- package/src/{microqr/index.js → ts/microqr/index.d.ts} +0 -2
- package/src/ts/microqr/tables.d.ts +107 -0
- package/src/ts/oned/addons.d.ts +181 -0
- package/src/ts/oned/index.d.ts +55 -0
- package/src/ts/oned/patterns.d.ts +259 -0
- package/src/ts/oned/reader.d.ts +129 -0
- package/src/ts/oned/writers.d.ts +218 -0
- package/src/ts/pdf417/compaction.d.ts +59 -0
- package/src/ts/pdf417/decoder.d.ts +48 -0
- package/src/ts/pdf417/detector.d.ts +73 -0
- package/src/ts/pdf417/encoder.d.ts +32 -0
- package/src/ts/pdf417/error-correction.d.ts +34 -0
- package/src/{pdf417/index.js → ts/pdf417/index.d.ts} +0 -1
- package/src/ts/pdf417/tables.d.ts +53 -0
- package/src/ts/qr/decoder.d.ts +79 -0
- package/src/ts/qr/detector.d.ts +93 -0
- package/src/ts/qr/encoder.d.ts +166 -0
- package/src/{qr/index.js → ts/qr/index.d.ts} +0 -2
- package/src/ts/qr/tables.d.ts +291 -0
- package/src/ts/render/image-data.d.ts +58 -0
- package/src/ts/render/index.d.ts +110 -0
- package/src/ts/render/options.d.ts +98 -0
- package/src/ts/render/png.d.ts +58 -0
- package/src/ts/render/svg.d.ts +46 -0
- package/src/ts/render/webgl.d.ts +45 -0
- package/src/ts/render/webgpu.d.ts +51 -0
- package/src/ts/rmqr/decoder.d.ts +42 -0
- package/src/ts/rmqr/detector.d.ts +81 -0
- package/src/ts/rmqr/encoder.d.ts +45 -0
- package/src/ts/rmqr/index.d.ts +34 -0
- package/src/ts/rmqr/tables.d.ts +89 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sythos/js_barcode_universal",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
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,32 +20,97 @@
|
|
|
20
20
|
"publishConfig": {
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
|
+
"types": "./src/index.d.ts",
|
|
23
24
|
"exports": {
|
|
24
|
-
".":
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"./
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"./
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"./
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"./
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"./
|
|
25
|
+
".": {
|
|
26
|
+
"import": "./src/index.js",
|
|
27
|
+
"types": "./src/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./core": {
|
|
30
|
+
"import": "./src/js/core/index.js",
|
|
31
|
+
"types": "./src/ts/core/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./image": {
|
|
34
|
+
"import": "./src/js/image/index.js",
|
|
35
|
+
"types": "./src/ts/image/index.d.ts"
|
|
36
|
+
},
|
|
37
|
+
"./oned": {
|
|
38
|
+
"import": "./src/js/oned/index.js",
|
|
39
|
+
"types": "./src/ts/oned/index.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./qr": {
|
|
42
|
+
"import": "./src/js/qr/index.js",
|
|
43
|
+
"types": "./src/ts/qr/index.d.ts"
|
|
44
|
+
},
|
|
45
|
+
"./datamatrix": {
|
|
46
|
+
"import": "./src/js/datamatrix/index.js",
|
|
47
|
+
"types": "./src/ts/datamatrix/index.d.ts"
|
|
48
|
+
},
|
|
49
|
+
"./databar": {
|
|
50
|
+
"import": "./src/js/databar/index.js",
|
|
51
|
+
"types": "./src/ts/databar/index.d.ts"
|
|
52
|
+
},
|
|
53
|
+
"./aztec": {
|
|
54
|
+
"import": "./src/js/aztec/index.js",
|
|
55
|
+
"types": "./src/ts/aztec/index.d.ts"
|
|
56
|
+
},
|
|
57
|
+
"./aztecrune": {
|
|
58
|
+
"import": "./src/js/aztecrune/index.js",
|
|
59
|
+
"types": "./src/ts/aztecrune/index.d.ts"
|
|
60
|
+
},
|
|
61
|
+
"./pdf417": {
|
|
62
|
+
"import": "./src/js/pdf417/index.js",
|
|
63
|
+
"types": "./src/ts/pdf417/index.d.ts"
|
|
64
|
+
},
|
|
65
|
+
"./compactpdf417": {
|
|
66
|
+
"import": "./src/js/compactpdf417/index.js",
|
|
67
|
+
"types": "./src/ts/compactpdf417/index.d.ts"
|
|
68
|
+
},
|
|
69
|
+
"./micropdf417": {
|
|
70
|
+
"import": "./src/js/micropdf417/index.js",
|
|
71
|
+
"types": "./src/ts/micropdf417/index.d.ts"
|
|
72
|
+
},
|
|
73
|
+
"./microqr": {
|
|
74
|
+
"import": "./src/js/microqr/index.js",
|
|
75
|
+
"types": "./src/ts/microqr/index.d.ts"
|
|
76
|
+
},
|
|
77
|
+
"./rmqr": {
|
|
78
|
+
"import": "./src/js/rmqr/index.js",
|
|
79
|
+
"types": "./src/ts/rmqr/index.d.ts"
|
|
80
|
+
},
|
|
81
|
+
"./frameqr": {
|
|
82
|
+
"import": "./src/js/frameqr/index.js",
|
|
83
|
+
"types": "./src/ts/frameqr/index.d.ts"
|
|
84
|
+
},
|
|
85
|
+
"./render": {
|
|
86
|
+
"import": "./src/js/render/index.js",
|
|
87
|
+
"types": "./src/ts/render/index.d.ts"
|
|
88
|
+
},
|
|
89
|
+
"./render/svg": {
|
|
90
|
+
"import": "./src/js/render/svg.js",
|
|
91
|
+
"types": "./src/ts/render/svg.d.ts"
|
|
92
|
+
},
|
|
93
|
+
"./render/png": {
|
|
94
|
+
"import": "./src/js/render/png.js",
|
|
95
|
+
"types": "./src/ts/render/png.d.ts"
|
|
96
|
+
},
|
|
97
|
+
"./render/image-data": {
|
|
98
|
+
"import": "./src/js/render/image-data.js",
|
|
99
|
+
"types": "./src/ts/render/image-data.d.ts"
|
|
100
|
+
},
|
|
101
|
+
"./bundle": {
|
|
102
|
+
"import": "./bundle/sythos-barcode.esm.js",
|
|
103
|
+
"types": "./src/ts/bundle/sythos-barcode.esm.d.ts"
|
|
104
|
+
},
|
|
105
|
+
"./bundle/iife": {
|
|
106
|
+
"import": "./bundle/sythos-barcode.js",
|
|
107
|
+
"types": "./src/ts/bundle/sythos-barcode.d.ts"
|
|
108
|
+
},
|
|
45
109
|
"./package.json": "./package.json"
|
|
46
110
|
},
|
|
47
111
|
"files": [
|
|
48
112
|
"src",
|
|
113
|
+
"src/ts",
|
|
49
114
|
"bundle",
|
|
50
115
|
"examples",
|
|
51
116
|
"licenses",
|
|
@@ -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
|
-
"
|
|
122
|
-
|
|
186
|
+
"devDependencies": {
|
|
187
|
+
"typescript": "^7.0.2"
|
|
188
|
+
}
|
|
123
189
|
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Sythos Barcode Suite
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) 2026 Sythos
|
|
7
|
+
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
|
+
*
|
|
9
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
* in the Software without restriction, including without limitation the rights
|
|
12
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
* furnished to do so, subject to the following conditions:
|
|
15
|
+
*
|
|
16
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
* copies or substantial portions of the Software.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
* SOFTWARE.
|
|
26
|
+
*
|
|
27
|
+
* SPDX-License-Identifier: MIT
|
|
28
|
+
*
|
|
29
|
+
* Original work. No code from any other barcode implementation.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Sythos Barcode Suite — public API.
|
|
33
|
+
*
|
|
34
|
+
* Two functions carry the whole surface:
|
|
35
|
+
*
|
|
36
|
+
* encode(text, { format }) -> BitMatrix
|
|
37
|
+
* decode(image, { formats }) -> Result[]
|
|
38
|
+
*
|
|
39
|
+
* Everything else is a renderer or a format-specific escape hatch. The core is
|
|
40
|
+
* free of I/O and of any platform assumption: images go in as
|
|
41
|
+
* `{ data, width, height }` with RGBA bytes, which is exactly what `ImageData`
|
|
42
|
+
* is, so a canvas, an `OffscreenCanvas`, sharp, jimp and node-canvas all work
|
|
43
|
+
* without an adapter.
|
|
44
|
+
*
|
|
45
|
+
* @module @sythos/js_barcode_universal
|
|
46
|
+
*/
|
|
47
|
+
import { BitMatrix } from './ts/core/bit-matrix.js';
|
|
48
|
+
export { BitMatrix };
|
|
49
|
+
export { BarcodeError, EncodeError, NotFoundError, FormatError, ChecksumError, } from './ts/core/errors.js';
|
|
50
|
+
export { LuminanceSource } from './ts/image/luminance.js';
|
|
51
|
+
export { binarize, binarizeGlobal, binarizeHybrid } from './ts/image/binarizer.js';
|
|
52
|
+
export * from './ts/oned/index.js';
|
|
53
|
+
export { toSVG, toSVGDataURI } from './ts/render/svg.js';
|
|
54
|
+
export { toImageData, toCanvas } from './ts/render/image-data.js';
|
|
55
|
+
export { toPNG, toPNGDataURI } from './ts/render/png.js';
|
|
56
|
+
export { renderToCanvasAuto, isWebGL2Available } from './ts/render/index.js';
|
|
57
|
+
export { renderToCanvasAutoAsync, isWebGPUAvailable } from './ts/render/index.js';
|
|
58
|
+
export { encodeQR, decodeQR, detectQR, detectAndDecodeQR } from './ts/qr/index.js';
|
|
59
|
+
export { encodeDataMatrix, decodeDataMatrix, detectDataMatrix, detectAndDecodeDataMatrix, } from './ts/datamatrix/index.js';
|
|
60
|
+
export { encodeAztec, decodeAztec, detectAztec, detectAndDecodeAztec } from './ts/aztec/index.js';
|
|
61
|
+
export * from './ts/aztecrune/index.js';
|
|
62
|
+
export { encodePDF417, decodePDF417, detectPDF417, detectAndDecodePDF417 } from './ts/pdf417/index.js';
|
|
63
|
+
export * from './ts/compactpdf417/index.js';
|
|
64
|
+
export * from './ts/databar/index.js';
|
|
65
|
+
export { encodeMicroPDF417, decodeMicroPDF417, detectMicroPDF417, detectAndDecodeMicroPDF417, } from './ts/micropdf417/index.js';
|
|
66
|
+
export { encodeMicroQR, decodeMicroQR, detectMicroQR, detectAndDecodeMicroQR } from './ts/microqr/index.js';
|
|
67
|
+
export { encodeRMQR, decodeRMQR, detectRMQR, detectAndDecodeRMQR } from './ts/rmqr/index.js';
|
|
68
|
+
export { encodeFrameQR, decodeFrameQR, detectFrameQR, detectAndDecodeFrameQR, } from './ts/frameqr/index.js';
|
|
69
|
+
export type FormatInfo = {
|
|
70
|
+
id: string;
|
|
71
|
+
label: string;
|
|
72
|
+
canWrite: boolean;
|
|
73
|
+
canRead: boolean;
|
|
74
|
+
kind: '1D' | '2D';
|
|
75
|
+
role?: 'supplement';
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Every format this build supports.
|
|
79
|
+
*
|
|
80
|
+
* Writing and reading are listed separately on purpose. Writing a symbology is
|
|
81
|
+
* a table lookup; reading one needs a detector that finds it in a photograph,
|
|
82
|
+
* which is far more work. The two lists legitimately differ, and saying so
|
|
83
|
+
* here is better than failing at call time.
|
|
84
|
+
*
|
|
85
|
+
* @returns {FormatInfo[]}
|
|
86
|
+
*/
|
|
87
|
+
export declare function listFormats(): FormatInfo[];
|
|
88
|
+
/**
|
|
89
|
+
* Encode a payload into a barcode matrix.
|
|
90
|
+
*
|
|
91
|
+
* The result is a `BitMatrix` where a set bit is a dark module, with no quiet
|
|
92
|
+
* zone — the renderers add that, because the right margin depends on the
|
|
93
|
+
* output medium. Linear symbols come back one module tall; height is a
|
|
94
|
+
* rendering decision, not an encoding one.
|
|
95
|
+
*
|
|
96
|
+
* @param {string | number} text
|
|
97
|
+
* @param {object} [options]
|
|
98
|
+
* @param {string} [options.format] Format id. Default 'qr'.
|
|
99
|
+
* @param {'L'|'M'|'Q'|'H'} [options.ecc] QR error-correction level.
|
|
100
|
+
* @param {number} [options.version] QR version, 1-40. Auto if omitted.
|
|
101
|
+
* @param {boolean} [options.checkDigit] Append a check digit, where optional.
|
|
102
|
+
* @param {boolean} [options.fullAscii] Code 39 extended encoding.
|
|
103
|
+
* @param {boolean} [options.gs1] Emit a leading FNC1.
|
|
104
|
+
* @param {number} [options.layers] Aztec layer count; automatic if omitted.
|
|
105
|
+
* @param {boolean} [options.compact] Force an Aztec Compact or Full symbol.
|
|
106
|
+
* @param {number} [options.eccPercent] Requested Aztec error-correction percentage.
|
|
107
|
+
* @param {number} [options.eccLevel] PDF417 error-correction level, 0-8.
|
|
108
|
+
* @param {number} [options.columns] PDF417 columns, 1-30.
|
|
109
|
+
* @param {number} [options.rows] PDF417 rows, 3-90.
|
|
110
|
+
* @param {number} [options.rowHeight] PDF417 row height in modules.
|
|
111
|
+
* @param {'auto'|'text'|'byte'|'numeric'} [options.compaction] PDF417 compaction mode.
|
|
112
|
+
* @param {number} [options.eci] MicroPDF417 byte-compaction ECI assignment (3 or 26).
|
|
113
|
+
* @param {number} [options.aspectRatio] Preferred MicroPDF417 symbol aspect ratio.
|
|
114
|
+
* @param {object} [options.canvas] FrameQR Code artwork reservation.
|
|
115
|
+
* @param {'square'|'circle'|'diamond'} [options.canvas.shape] Canvas shape.
|
|
116
|
+
* @param {number} [options.canvas.size] Odd canvas size in QR modules.
|
|
117
|
+
* @param {number} [options.canvas.width] Canvas width in QR modules.
|
|
118
|
+
* @param {number} [options.canvas.height] Canvas height in QR modules.
|
|
119
|
+
* @param {number} [options.canvas.centerX] Canvas centre X in QR modules.
|
|
120
|
+
* @param {number} [options.canvas.centerY] Canvas centre Y in QR modules.
|
|
121
|
+
* @param {0|90|180|270} [options.canvas.angle] Canvas quarter-turn.
|
|
122
|
+
* @returns {BitMatrix}
|
|
123
|
+
*/
|
|
124
|
+
export declare function encode(text: string | number, options?: {
|
|
125
|
+
format?: string;
|
|
126
|
+
ecc?: 'L' | 'M' | 'Q' | 'H';
|
|
127
|
+
version?: number;
|
|
128
|
+
checkDigit?: boolean;
|
|
129
|
+
fullAscii?: boolean;
|
|
130
|
+
gs1?: boolean;
|
|
131
|
+
layers?: number;
|
|
132
|
+
compact?: boolean;
|
|
133
|
+
eccPercent?: number;
|
|
134
|
+
eccLevel?: number;
|
|
135
|
+
columns?: number;
|
|
136
|
+
rows?: number;
|
|
137
|
+
rowHeight?: number;
|
|
138
|
+
compaction?: 'auto' | 'text' | 'byte' | 'numeric';
|
|
139
|
+
eci?: number;
|
|
140
|
+
aspectRatio?: number;
|
|
141
|
+
canvas?: {
|
|
142
|
+
shape?: 'square' | 'circle' | 'diamond';
|
|
143
|
+
size?: number;
|
|
144
|
+
width?: number;
|
|
145
|
+
height?: number;
|
|
146
|
+
centerX?: number;
|
|
147
|
+
centerY?: number;
|
|
148
|
+
angle?: 0 | 90 | 180 | 270;
|
|
149
|
+
};
|
|
150
|
+
}): BitMatrix;
|
|
151
|
+
export type DecodeResult = {
|
|
152
|
+
text: string;
|
|
153
|
+
format: string;
|
|
154
|
+
/**
|
|
155
|
+
* Raw octets exposed by byte-oriented payload modes, before text decoding.
|
|
156
|
+
*/
|
|
157
|
+
bytes?: Uint8Array;
|
|
158
|
+
/**
|
|
159
|
+
* PDF417 compaction segments in source order.
|
|
160
|
+
*/
|
|
161
|
+
segments?: {
|
|
162
|
+
mode: 'text' | 'byte' | 'numeric';
|
|
163
|
+
text: string;
|
|
164
|
+
bytes: Uint8Array;
|
|
165
|
+
eci: number;
|
|
166
|
+
latch: number | null;
|
|
167
|
+
codewordStart: number;
|
|
168
|
+
codewordEnd: number;
|
|
169
|
+
}[];
|
|
170
|
+
/**
|
|
171
|
+
* QR version.
|
|
172
|
+
*/
|
|
173
|
+
version?: number;
|
|
174
|
+
/**
|
|
175
|
+
* QR error-correction level.
|
|
176
|
+
*/
|
|
177
|
+
ecc?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Aztec layer count.
|
|
180
|
+
*/
|
|
181
|
+
layers?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Whether an Aztec symbol is Compact.
|
|
184
|
+
*/
|
|
185
|
+
compact?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Reed–Solomon corrections applied by an Aztec decode.
|
|
188
|
+
*/
|
|
189
|
+
corrections?: number;
|
|
190
|
+
/**
|
|
191
|
+
* PDF417 row count.
|
|
192
|
+
*/
|
|
193
|
+
rows?: number;
|
|
194
|
+
/**
|
|
195
|
+
* PDF417 column count.
|
|
196
|
+
*/
|
|
197
|
+
columns?: number;
|
|
198
|
+
/**
|
|
199
|
+
* PDF417 error-correction level.
|
|
200
|
+
*/
|
|
201
|
+
eccLevel?: number;
|
|
202
|
+
/**
|
|
203
|
+
* PDF417 row height in modules.
|
|
204
|
+
*/
|
|
205
|
+
rowHeight?: number;
|
|
206
|
+
/**
|
|
207
|
+
* MicroPDF417 predefined variant number.
|
|
208
|
+
*/
|
|
209
|
+
variant?: number;
|
|
210
|
+
/**
|
|
211
|
+
* MicroPDF417 fixed error-correction codewords.
|
|
212
|
+
*/
|
|
213
|
+
eccCodewords?: number;
|
|
214
|
+
/**
|
|
215
|
+
* FrameQR Code profile identifier.
|
|
216
|
+
*/
|
|
217
|
+
profile?: string;
|
|
218
|
+
/**
|
|
219
|
+
* Whether the profile is certified by its originator.
|
|
220
|
+
*/
|
|
221
|
+
certified?: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Canvas reservation metadata for the FrameQR Code profile.
|
|
224
|
+
*/
|
|
225
|
+
canvas?: object;
|
|
226
|
+
/**
|
|
227
|
+
* Attached EAN/UPC supplement.
|
|
228
|
+
*/
|
|
229
|
+
addon?: {
|
|
230
|
+
format: 'ean2' | 'ean5';
|
|
231
|
+
text: string;
|
|
232
|
+
parity: string;
|
|
233
|
+
checksum?: number;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Camera-profile confidence from 0 to 1.
|
|
237
|
+
*/
|
|
238
|
+
confidence?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Camera-profile bounds in the scanned orientation.
|
|
241
|
+
*/
|
|
242
|
+
bounds?: {
|
|
243
|
+
x: number;
|
|
244
|
+
y: number;
|
|
245
|
+
width: number;
|
|
246
|
+
height: number;
|
|
247
|
+
};
|
|
248
|
+
/**
|
|
249
|
+
* Camera-profile orientation in degrees.
|
|
250
|
+
*/
|
|
251
|
+
rotation?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
|
|
252
|
+
/**
|
|
253
|
+
* Camera-profile validation evidence.
|
|
254
|
+
*/
|
|
255
|
+
quality?: {
|
|
256
|
+
quietZone: boolean;
|
|
257
|
+
checksum: boolean | null;
|
|
258
|
+
rows: number | null;
|
|
259
|
+
consistency: number | null;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Whether the physical symbol is classified as GS1.
|
|
263
|
+
*/
|
|
264
|
+
gs1?: boolean;
|
|
265
|
+
/**
|
|
266
|
+
* GS1 symbology identifier.
|
|
267
|
+
*/
|
|
268
|
+
symbologyIdentifier?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Parsed GS1 Application Identifier fields.
|
|
271
|
+
*/
|
|
272
|
+
elements?: Array<{
|
|
273
|
+
ai: string;
|
|
274
|
+
value: string;
|
|
275
|
+
fixed?: boolean;
|
|
276
|
+
}>;
|
|
277
|
+
/**
|
|
278
|
+
* Semantic GS1 parsing error after a valid physical read.
|
|
279
|
+
*/
|
|
280
|
+
gs1ParseError?: string;
|
|
281
|
+
/**
|
|
282
|
+
* GS1 DataBar GTIN-14 payload.
|
|
283
|
+
*/
|
|
284
|
+
gtin?: string;
|
|
285
|
+
/**
|
|
286
|
+
* GS1 DataBar linkage flag.
|
|
287
|
+
*/
|
|
288
|
+
linkage?: boolean;
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* @typedef {object} DecodeResult
|
|
292
|
+
* @property {string} text
|
|
293
|
+
* @property {string} format
|
|
294
|
+
* @property {Uint8Array} [bytes] Raw octets exposed by byte-oriented payload modes, before text decoding.
|
|
295
|
+
* @property {{mode: 'text'|'byte'|'numeric', text: string, bytes: Uint8Array, eci: number, latch: number|null, codewordStart: number, codewordEnd: number}[]} [segments] PDF417 compaction segments in source order.
|
|
296
|
+
* @property {number} [version] QR version.
|
|
297
|
+
* @property {string} [ecc] QR error-correction level.
|
|
298
|
+
* @property {number} [layers] Aztec layer count.
|
|
299
|
+
* @property {boolean} [compact] Whether an Aztec symbol is Compact.
|
|
300
|
+
* @property {number} [corrections] Reed–Solomon corrections applied by an Aztec decode.
|
|
301
|
+
* @property {number} [rows] PDF417 row count.
|
|
302
|
+
* @property {number} [columns] PDF417 column count.
|
|
303
|
+
* @property {number} [eccLevel] PDF417 error-correction level.
|
|
304
|
+
* @property {number} [rowHeight] PDF417 row height in modules.
|
|
305
|
+
* @property {number} [variant] MicroPDF417 predefined variant number.
|
|
306
|
+
* @property {number} [eccCodewords] MicroPDF417 fixed error-correction codewords.
|
|
307
|
+
* @property {string} [profile] FrameQR Code profile identifier.
|
|
308
|
+
* @property {boolean} [certified] Whether the profile is certified by its originator.
|
|
309
|
+
* @property {object} [canvas] Canvas reservation metadata for the FrameQR Code profile.
|
|
310
|
+
* @property {{format:'ean2'|'ean5', text:string, parity:string, checksum?:number}} [addon] Attached EAN/UPC supplement.
|
|
311
|
+
* @property {number} [confidence] Camera-profile confidence from 0 to 1.
|
|
312
|
+
* @property {{x:number,y:number,width:number,height:number}} [bounds] Camera-profile bounds in the scanned orientation.
|
|
313
|
+
* @property {0|45|90|135|180|225|270|315} [rotation] Camera-profile orientation in degrees.
|
|
314
|
+
* @property {{quietZone:boolean,checksum:boolean|null,rows:number|null,consistency:number|null}} [quality] Camera-profile validation evidence.
|
|
315
|
+
* @property {boolean} [gs1] Whether the physical symbol is classified as GS1.
|
|
316
|
+
* @property {string} [symbologyIdentifier] GS1 symbology identifier.
|
|
317
|
+
* @property {Array<{ai:string,value:string,fixed?:boolean}>} [elements] Parsed GS1 Application Identifier fields.
|
|
318
|
+
* @property {string} [gs1ParseError] Semantic GS1 parsing error after a valid physical read.
|
|
319
|
+
* @property {string} [gtin] GS1 DataBar GTIN-14 payload.
|
|
320
|
+
* @property {boolean} [linkage] GS1 DataBar linkage flag.
|
|
321
|
+
*/
|
|
322
|
+
/**
|
|
323
|
+
* Find and decode every barcode in an image.
|
|
324
|
+
*
|
|
325
|
+
* Returns an array, empty when nothing is found — an image with no barcode is
|
|
326
|
+
* an ordinary outcome for a camera frame, not an error, and throwing would
|
|
327
|
+
* make the common scanning loop a try/catch.
|
|
328
|
+
*
|
|
329
|
+
* @param {{data: Uint8ClampedArray|Uint8Array|number[], width: number, height: number}} image
|
|
330
|
+
* @param {object} [options]
|
|
331
|
+
* @param {string[]} [options.formats] Restrict to these format ids.
|
|
332
|
+
* @param {boolean} [options.tryHarder] Retry inverted and rotated. Default true.
|
|
333
|
+
* @param {'global'|'hybrid'|'auto'} [options.binarizer]
|
|
334
|
+
* @param {'camera'} [options.profile] Opt-in strict camera profile for validated 1D reads.
|
|
335
|
+
* @param {object} [options.frameqr] FrameQR Code detector options when
|
|
336
|
+
* the profile marker is not preserved through image rendering.
|
|
337
|
+
* @returns {DecodeResult[]}
|
|
338
|
+
*/
|
|
339
|
+
export declare function decode(image: {
|
|
340
|
+
data: Uint8ClampedArray | Uint8Array | number[];
|
|
341
|
+
width: number;
|
|
342
|
+
height: number;
|
|
343
|
+
}, options?: {
|
|
344
|
+
formats?: string[];
|
|
345
|
+
tryHarder?: boolean;
|
|
346
|
+
binarizer?: 'global' | 'hybrid' | 'auto';
|
|
347
|
+
profile?: 'camera';
|
|
348
|
+
frameqr?: object;
|
|
349
|
+
}): DecodeResult[];
|
|
350
|
+
/**
|
|
351
|
+
* Decode, or throw if nothing is found.
|
|
352
|
+
*
|
|
353
|
+
* @param {{data: Uint8ClampedArray|Uint8Array|number[], width: number, height: number}} image
|
|
354
|
+
* @param {object} [options]
|
|
355
|
+
* @returns {DecodeResult}
|
|
356
|
+
*/
|
|
357
|
+
export declare function decodeStrict(image: {
|
|
358
|
+
data: Uint8ClampedArray | Uint8Array | number[];
|
|
359
|
+
width: number;
|
|
360
|
+
height: number;
|
|
361
|
+
}, options?: object): DecodeResult;
|
|
362
|
+
/** Library version, matching package.json. */
|
|
363
|
+
export declare const VERSION = "1.5.8";
|