@sythos/js_barcode_universal 1.5.7 → 1.5.9
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/LICENSE +5 -4
- package/NOTICE.md +2 -2
- package/README.md +50 -37
- package/bundle/sythos-barcode.esm.js +12051 -11484
- package/bundle/sythos-barcode.js +12051 -11484
- package/package.json +52 -45
- package/src/index.d.ts +363 -0
- package/src/index.js +573 -428
- package/src/js/aztec/decoder.js +326 -0
- package/src/js/aztec/detector.js +251 -0
- package/src/js/aztec/encoder.js +276 -0
- package/src/js/aztec/high-level.js +216 -0
- package/src/js/aztec/index.js +34 -0
- package/src/js/aztec/tables.js +196 -0
- package/src/js/aztecrune/decoder.js +146 -0
- package/src/js/aztecrune/detector.js +180 -0
- package/src/js/aztecrune/encoder.js +103 -0
- package/src/js/aztecrune/index.js +34 -0
- package/src/js/aztecrune/tables.js +142 -0
- package/src/js/compactpdf417/decoder.js +123 -0
- package/src/js/compactpdf417/detector.js +138 -0
- package/src/js/compactpdf417/encoder.js +127 -0
- package/src/js/compactpdf417/index.js +5 -0
- package/src/js/compactpdf417/tables.js +164 -0
- package/src/js/core/bit-buffer.js +158 -0
- package/src/js/core/bit-matrix.js +243 -0
- package/src/js/core/errors.js +59 -0
- package/src/js/core/galois-field.js +193 -0
- package/src/js/core/index.js +39 -0
- package/src/js/core/reed-solomon.js +318 -0
- package/src/js/databar/codec.js +166 -0
- package/src/js/databar/decoder.js +224 -0
- package/src/js/databar/encoder.js +88 -0
- package/src/js/databar/gs1.js +176 -0
- package/src/js/databar/index.js +36 -0
- package/src/js/databar/patterns.js +139 -0
- package/src/js/databar/tables.js +123 -0
- package/src/js/datamatrix/decoder.js +296 -0
- package/src/js/datamatrix/detector.js +254 -0
- package/src/js/datamatrix/encoder.js +250 -0
- package/src/js/datamatrix/index.js +34 -0
- package/src/js/datamatrix/tables.js +122 -0
- package/src/js/frameqr/decoder.js +216 -0
- package/src/js/frameqr/detector.js +199 -0
- package/src/js/frameqr/encoder.js +143 -0
- package/src/js/frameqr/index.js +33 -0
- package/src/js/frameqr/tables.js +252 -0
- package/src/js/image/binarizer.js +254 -0
- package/src/js/image/grid-sampler.js +148 -0
- package/src/js/image/index.js +38 -0
- package/src/js/image/luminance.js +185 -0
- package/src/js/image/perspective.js +158 -0
- package/src/js/micropdf417/compaction.js +115 -0
- package/src/js/micropdf417/decoder.js +180 -0
- package/src/js/micropdf417/detector.js +152 -0
- package/src/js/micropdf417/encoder.js +184 -0
- package/src/js/micropdf417/error-correction.js +50 -0
- package/src/js/micropdf417/index.js +35 -0
- package/src/js/micropdf417/tables.js +197 -0
- package/src/js/microqr/decoder.js +240 -0
- package/src/js/microqr/detector.js +339 -0
- package/src/js/microqr/encoder.js +314 -0
- package/src/js/microqr/index.js +34 -0
- package/src/js/microqr/tables.js +324 -0
- package/src/js/oned/addons.js +396 -0
- package/src/js/oned/index.js +75 -0
- package/src/js/oned/patterns.js +365 -0
- package/src/js/oned/reader.js +1383 -0
- package/src/js/oned/writers.js +691 -0
- package/src/js/pdf417/compaction.js +391 -0
- package/src/js/pdf417/decoder.js +110 -0
- package/src/js/pdf417/detector.js +484 -0
- package/src/js/pdf417/encoder.js +102 -0
- package/src/js/pdf417/error-correction.js +44 -0
- package/src/{pdf417 → js/pdf417}/index.js +0 -5
- package/src/js/pdf417/tables.js +315 -0
- package/src/js/qr/decoder.js +539 -0
- package/src/js/qr/detector.js +613 -0
- package/src/js/qr/encoder.js +873 -0
- package/src/js/qr/index.js +42 -0
- package/src/js/qr/tables.js +690 -0
- package/src/js/render/image-data.js +120 -0
- package/src/js/render/index.js +128 -0
- package/src/js/render/options.js +152 -0
- package/src/js/render/png.js +270 -0
- package/src/js/render/svg.js +117 -0
- package/src/js/render/webgl.js +200 -0
- package/src/js/render/webgpu.js +357 -0
- package/src/js/rmqr/decoder.js +209 -0
- package/src/js/rmqr/detector.js +122 -0
- package/src/js/rmqr/encoder.js +321 -0
- package/src/js/rmqr/index.js +33 -0
- package/src/js/rmqr/tables.js +177 -0
- package/src/{aztec/decoder.js → ts/aztec/decoder.ts} +0 -1
- package/{typings → src/ts}/aztec/detector.d.ts +2 -2
- package/src/{aztec/detector.js → ts/aztec/detector.ts} +0 -1
- package/src/{aztec/encoder.js → ts/aztec/encoder.ts} +0 -1
- package/src/{aztec/high-level.js → ts/aztec/high-level.ts} +0 -1
- package/src/{aztec/index.js → ts/aztec/index.ts} +0 -1
- package/src/{aztec/tables.js → ts/aztec/tables.ts} +0 -1
- package/src/{aztecrune/decoder.js → ts/aztecrune/decoder.ts} +0 -1
- package/src/{aztecrune/detector.js → ts/aztecrune/detector.ts} +0 -1
- package/src/{aztecrune/encoder.js → ts/aztecrune/encoder.ts} +0 -1
- package/src/{aztecrune/index.js → ts/aztecrune/index.ts} +0 -1
- package/src/{aztecrune/tables.js → ts/aztecrune/tables.ts} +0 -1
- package/src/{compactpdf417/decoder.js → ts/compactpdf417/decoder.ts} +0 -1
- package/src/{compactpdf417/detector.js → ts/compactpdf417/detector.ts} +0 -1
- package/src/{compactpdf417/encoder.js → ts/compactpdf417/encoder.ts} +0 -1
- package/src/{compactpdf417/index.js → ts/compactpdf417/index.ts} +0 -5
- package/src/{compactpdf417/tables.js → ts/compactpdf417/tables.ts} +0 -1
- package/src/{core/bit-buffer.js → ts/core/bit-buffer.ts} +0 -1
- package/src/{core/bit-matrix.js → ts/core/bit-matrix.ts} +0 -1
- package/src/{core/errors.js → ts/core/errors.ts} +0 -1
- package/src/{core/galois-field.js → ts/core/galois-field.ts} +0 -1
- package/src/{core/index.js → ts/core/index.ts} +0 -1
- package/src/{core/reed-solomon.js → ts/core/reed-solomon.ts} +0 -1
- package/src/{databar/codec.js → ts/databar/codec.ts} +0 -1
- package/src/{databar/decoder.js → ts/databar/decoder.ts} +0 -1
- package/src/{databar/encoder.js → ts/databar/encoder.ts} +0 -1
- package/src/{databar/gs1.js → ts/databar/gs1.ts} +0 -1
- package/src/{databar/index.js → ts/databar/index.ts} +0 -1
- package/src/{databar/patterns.js → ts/databar/patterns.ts} +0 -1
- package/src/{databar/tables.js → ts/databar/tables.ts} +0 -1
- package/src/{datamatrix/decoder.js → ts/datamatrix/decoder.ts} +0 -1
- package/{typings → src/ts}/datamatrix/detector.d.ts +2 -2
- package/src/{datamatrix/detector.js → ts/datamatrix/detector.ts} +0 -1
- package/src/{datamatrix/encoder.js → ts/datamatrix/encoder.ts} +0 -1
- package/src/{datamatrix/index.js → ts/datamatrix/index.ts} +0 -1
- package/src/{datamatrix/tables.js → ts/datamatrix/tables.ts} +0 -1
- package/src/{frameqr/decoder.js → ts/frameqr/decoder.ts} +15 -16
- package/src/{frameqr/detector.js → ts/frameqr/detector.ts} +2 -3
- package/src/{frameqr/encoder.js → ts/frameqr/encoder.ts} +7 -8
- package/src/{frameqr/index.js → ts/frameqr/index.ts} +0 -1
- package/src/{frameqr/tables.js → ts/frameqr/tables.ts} +10 -11
- package/src/{image/binarizer.js → ts/image/binarizer.ts} +0 -1
- package/src/{image/grid-sampler.js → ts/image/grid-sampler.ts} +0 -1
- package/src/{image/index.js → ts/image/index.ts} +0 -1
- package/src/{image/luminance.js → ts/image/luminance.ts} +0 -1
- package/src/{image/perspective.js → ts/image/perspective.ts} +0 -1
- package/{typings → src/ts}/index.d.ts +3 -3
- package/src/ts/index.ts +790 -0
- package/src/{micropdf417/compaction.js → ts/micropdf417/compaction.ts} +0 -1
- package/src/{micropdf417/decoder.js → ts/micropdf417/decoder.ts} +0 -1
- package/src/{micropdf417/detector.js → ts/micropdf417/detector.ts} +0 -1
- package/src/{micropdf417/encoder.js → ts/micropdf417/encoder.ts} +0 -1
- package/src/{micropdf417/error-correction.js → ts/micropdf417/error-correction.ts} +0 -1
- package/src/{micropdf417/index.js → ts/micropdf417/index.ts} +0 -1
- package/src/{micropdf417/tables.js → ts/micropdf417/tables.ts} +0 -1
- package/src/{microqr/decoder.js → ts/microqr/decoder.ts} +0 -1
- package/src/{microqr/detector.js → ts/microqr/detector.ts} +0 -1
- package/src/{microqr/encoder.js → ts/microqr/encoder.ts} +0 -1
- package/src/{microqr/index.js → ts/microqr/index.ts} +0 -1
- package/src/{microqr/tables.js → ts/microqr/tables.ts} +0 -1
- package/src/{oned/addons.js → ts/oned/addons.ts} +0 -1
- package/src/{oned/index.js → ts/oned/index.ts} +0 -1
- package/src/{oned/patterns.js → ts/oned/patterns.ts} +0 -1
- package/src/{oned/reader.js → ts/oned/reader.ts} +0 -1
- package/src/{oned/writers.js → ts/oned/writers.ts} +0 -1
- package/src/{pdf417/compaction.js → ts/pdf417/compaction.ts} +0 -1
- package/src/{pdf417/decoder.js → ts/pdf417/decoder.ts} +0 -1
- package/src/{pdf417/detector.js → ts/pdf417/detector.ts} +0 -1
- package/src/{pdf417/encoder.js → ts/pdf417/encoder.ts} +0 -1
- package/src/{pdf417/error-correction.js → ts/pdf417/error-correction.ts} +0 -1
- package/src/ts/pdf417/index.ts +6 -0
- package/src/{pdf417/tables.js → ts/pdf417/tables.ts} +0 -1
- package/src/{qr/decoder.js → ts/qr/decoder.ts} +0 -1
- package/src/{qr/detector.js → ts/qr/detector.ts} +0 -1
- package/src/{qr/encoder.js → ts/qr/encoder.ts} +0 -1
- package/src/{qr/index.js → ts/qr/index.ts} +0 -1
- package/src/{qr/tables.js → ts/qr/tables.ts} +0 -1
- package/src/{render/image-data.js → ts/render/image-data.ts} +0 -1
- package/src/{render/index.js → ts/render/index.ts} +0 -1
- package/src/{render/options.js → ts/render/options.ts} +0 -1
- package/src/{render/png.js → ts/render/png.ts} +0 -1
- package/src/{render/svg.js → ts/render/svg.ts} +0 -1
- package/src/{render/webgl.js → ts/render/webgl.ts} +0 -1
- package/src/{render/webgpu.js → ts/render/webgpu.ts} +0 -1
- package/src/{rmqr/decoder.js → ts/rmqr/decoder.ts} +0 -1
- package/src/{rmqr/detector.js → ts/rmqr/detector.ts} +0 -1
- package/src/{rmqr/encoder.js → ts/rmqr/encoder.ts} +0 -1
- package/src/{rmqr/index.js → ts/rmqr/index.ts} +0 -1
- package/src/{rmqr/tables.js → ts/rmqr/tables.ts} +0 -1
- /package/{typings → src/ts}/aztec/decoder.d.ts +0 -0
- /package/{typings → src/ts}/aztec/encoder.d.ts +0 -0
- /package/{typings → src/ts}/aztec/high-level.d.ts +0 -0
- /package/{typings → src/ts}/aztec/index.d.ts +0 -0
- /package/{typings → src/ts}/aztec/tables.d.ts +0 -0
- /package/{typings → src/ts}/aztecrune/decoder.d.ts +0 -0
- /package/{typings → src/ts}/aztecrune/detector.d.ts +0 -0
- /package/{typings → src/ts}/aztecrune/encoder.d.ts +0 -0
- /package/{typings → src/ts}/aztecrune/index.d.ts +0 -0
- /package/{typings → src/ts}/aztecrune/tables.d.ts +0 -0
- /package/{typings → src/ts}/bundle/sythos-barcode.d.ts +0 -0
- /package/{typings → src/ts}/bundle/sythos-barcode.esm.d.ts +0 -0
- /package/{typings → src/ts}/compactpdf417/decoder.d.ts +0 -0
- /package/{typings → src/ts}/compactpdf417/detector.d.ts +0 -0
- /package/{typings → src/ts}/compactpdf417/encoder.d.ts +0 -0
- /package/{typings → src/ts}/compactpdf417/index.d.ts +0 -0
- /package/{typings → src/ts}/compactpdf417/tables.d.ts +0 -0
- /package/{typings → src/ts}/core/bit-buffer.d.ts +0 -0
- /package/{typings → src/ts}/core/bit-matrix.d.ts +0 -0
- /package/{typings → src/ts}/core/errors.d.ts +0 -0
- /package/{typings → src/ts}/core/galois-field.d.ts +0 -0
- /package/{typings → src/ts}/core/index.d.ts +0 -0
- /package/{typings → src/ts}/core/reed-solomon.d.ts +0 -0
- /package/{typings → src/ts}/databar/codec.d.ts +0 -0
- /package/{typings → src/ts}/databar/decoder.d.ts +0 -0
- /package/{typings → src/ts}/databar/encoder.d.ts +0 -0
- /package/{typings → src/ts}/databar/gs1.d.ts +0 -0
- /package/{typings → src/ts}/databar/index.d.ts +0 -0
- /package/{typings → src/ts}/databar/patterns.d.ts +0 -0
- /package/{typings → src/ts}/databar/tables.d.ts +0 -0
- /package/{typings → src/ts}/datamatrix/decoder.d.ts +0 -0
- /package/{typings → src/ts}/datamatrix/encoder.d.ts +0 -0
- /package/{typings → src/ts}/datamatrix/index.d.ts +0 -0
- /package/{typings → src/ts}/datamatrix/tables.d.ts +0 -0
- /package/{typings → src/ts}/frameqr/decoder.d.ts +0 -0
- /package/{typings → src/ts}/frameqr/detector.d.ts +0 -0
- /package/{typings → src/ts}/frameqr/encoder.d.ts +0 -0
- /package/{typings → src/ts}/frameqr/index.d.ts +0 -0
- /package/{typings → src/ts}/frameqr/tables.d.ts +0 -0
- /package/{typings → src/ts}/image/binarizer.d.ts +0 -0
- /package/{typings → src/ts}/image/grid-sampler.d.ts +0 -0
- /package/{typings → src/ts}/image/index.d.ts +0 -0
- /package/{typings → src/ts}/image/luminance.d.ts +0 -0
- /package/{typings → src/ts}/image/perspective.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/compaction.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/decoder.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/detector.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/encoder.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/error-correction.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/index.d.ts +0 -0
- /package/{typings → src/ts}/micropdf417/tables.d.ts +0 -0
- /package/{typings → src/ts}/microqr/decoder.d.ts +0 -0
- /package/{typings → src/ts}/microqr/detector.d.ts +0 -0
- /package/{typings → src/ts}/microqr/encoder.d.ts +0 -0
- /package/{typings → src/ts}/microqr/index.d.ts +0 -0
- /package/{typings → src/ts}/microqr/tables.d.ts +0 -0
- /package/{typings → src/ts}/oned/addons.d.ts +0 -0
- /package/{typings → src/ts}/oned/index.d.ts +0 -0
- /package/{typings → src/ts}/oned/patterns.d.ts +0 -0
- /package/{typings → src/ts}/oned/reader.d.ts +0 -0
- /package/{typings → src/ts}/oned/writers.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/compaction.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/decoder.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/detector.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/encoder.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/error-correction.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/index.d.ts +0 -0
- /package/{typings → src/ts}/pdf417/tables.d.ts +0 -0
- /package/{typings → src/ts}/qr/decoder.d.ts +0 -0
- /package/{typings → src/ts}/qr/detector.d.ts +0 -0
- /package/{typings → src/ts}/qr/encoder.d.ts +0 -0
- /package/{typings → src/ts}/qr/index.d.ts +0 -0
- /package/{typings → src/ts}/qr/tables.d.ts +0 -0
- /package/{typings → src/ts}/render/image-data.d.ts +0 -0
- /package/{typings → src/ts}/render/index.d.ts +0 -0
- /package/{typings → src/ts}/render/options.d.ts +0 -0
- /package/{typings → src/ts}/render/png.d.ts +0 -0
- /package/{typings → src/ts}/render/svg.d.ts +0 -0
- /package/{typings → src/ts}/render/webgl.d.ts +0 -0
- /package/{typings → src/ts}/render/webgpu.d.ts +0 -0
- /package/{typings → src/ts}/rmqr/decoder.d.ts +0 -0
- /package/{typings → src/ts}/rmqr/detector.d.ts +0 -0
- /package/{typings → src/ts}/rmqr/encoder.d.ts +0 -0
- /package/{typings → src/ts}/rmqr/index.d.ts +0 -0
- /package/{typings → src/ts}/rmqr/tables.d.ts +0 -0
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2026 Sythos
|
|
7
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
7
|
*
|
|
9
8
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
9
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
*/
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
* Detector for the non-certified
|
|
32
|
+
* Detector for the non-certified Sythos Canvas QR profile.
|
|
34
33
|
*
|
|
35
34
|
* The profile deliberately reuses QR Model 2 geometry. Finder localisation and
|
|
36
35
|
* projective sampling therefore use the QR detector; the additional profile
|
|
@@ -99,7 +98,7 @@ function sameCandidate(left, right) {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
/**
|
|
102
|
-
* Detect
|
|
101
|
+
* Detect Sythos Canvas QR symbols in a binarized raster.
|
|
103
102
|
*
|
|
104
103
|
* @param {import('../core/bit-matrix.js').BitMatrix} binaryImage Set bit = dark.
|
|
105
104
|
* @param {object} [options]
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2026 Sythos
|
|
7
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
7
|
*
|
|
9
8
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
9
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
*/
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
*
|
|
32
|
+
* Sythos Canvas QR profile encoder.
|
|
34
33
|
*
|
|
35
34
|
* This encoder deliberately builds on this project's QR Code implementation
|
|
36
35
|
* and then removes a conservatively bounded set of data modules for artwork.
|
|
@@ -69,7 +68,7 @@ function clearCanvas(matrix, modules) {
|
|
|
69
68
|
|
|
70
69
|
/**
|
|
71
70
|
* Encode a QR Code with a conservative artwork canvas according to the
|
|
72
|
-
* non-certified
|
|
71
|
+
* non-certified Sythos Canvas QR profile.
|
|
73
72
|
*
|
|
74
73
|
* The profile forces QR H error correction and rejects a canvas whenever its
|
|
75
74
|
* known codeword damage exceeds the per-block correction budget. When a
|
|
@@ -85,10 +84,10 @@ function clearCanvas(matrix, modules) {
|
|
|
85
84
|
*/
|
|
86
85
|
export function encodeFrameQR(text, options = {}) {
|
|
87
86
|
if (typeof text !== 'string') {
|
|
88
|
-
throw new EncodeError('
|
|
87
|
+
throw new EncodeError('Sythos Canvas QR: text must be a string');
|
|
89
88
|
}
|
|
90
89
|
if (options.ecc !== undefined && options.ecc !== 'H') {
|
|
91
|
-
throw new EncodeError('
|
|
90
|
+
throw new EncodeError('Sythos Canvas QR: ecc is fixed to H for this profile');
|
|
92
91
|
}
|
|
93
92
|
|
|
94
93
|
const qrOptions = {
|
|
@@ -124,7 +123,7 @@ export function encodeFrameQR(text, options = {}) {
|
|
|
124
123
|
analysis = validateCanvasSpec(versionFor(matrix), canvas);
|
|
125
124
|
} catch (error) {
|
|
126
125
|
if (error instanceof EncodeError) throw error;
|
|
127
|
-
throw new EncodeError(`
|
|
126
|
+
throw new EncodeError(`Sythos Canvas QR: invalid canvas: ${error.message}`);
|
|
128
127
|
}
|
|
129
128
|
if (!analysis.safe) {
|
|
130
129
|
unsafeAnalysis = analysis;
|
|
@@ -137,13 +136,13 @@ export function encodeFrameQR(text, options = {}) {
|
|
|
137
136
|
if (!selected) {
|
|
138
137
|
if (unsafeAnalysis) {
|
|
139
138
|
throw new EncodeError(
|
|
140
|
-
'
|
|
139
|
+
'Sythos Canvas QR: canvas is not safe for the selected QR version; ' +
|
|
141
140
|
`it touches ${unsafeAnalysis.touchedCodewordCount} codewords and has ` +
|
|
142
141
|
`a per-block correction budget of ${unsafeAnalysis.correctionBudgetPerBlock}`
|
|
143
142
|
);
|
|
144
143
|
}
|
|
145
144
|
if (capacityError) throw capacityError;
|
|
146
|
-
throw new EncodeError('
|
|
145
|
+
throw new EncodeError('Sythos Canvas QR: unable to select a QR version');
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
const { matrix, canvas } = selected;
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2026 Sythos
|
|
7
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
7
|
*
|
|
9
8
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
9
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2026 Sythos
|
|
7
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
8
7
|
*
|
|
9
8
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
9
|
* of this software and associated documentation files (the "Software"), to deal
|
|
@@ -30,7 +29,7 @@
|
|
|
30
29
|
*/
|
|
31
30
|
|
|
32
31
|
/**
|
|
33
|
-
* Structural contract for
|
|
32
|
+
* Structural contract for the Sythos Canvas QR profile.
|
|
34
33
|
*
|
|
35
34
|
* DENSO WAVE's public material describes FrameQR(R) as a proprietary symbol
|
|
36
35
|
* with a freely shaped canvas, dedicated generation/reading software and no
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
* symbol at level H and clears a bounded group of data modules. Its worst-case
|
|
43
42
|
* damage is calculated per Reed-Solomon block and must remain within the
|
|
44
43
|
* standard QR correction radius. Function modules are never canvas modules.
|
|
45
|
-
* This provides a deterministic, independently testable
|
|
44
|
+
* This provides a deterministic, independently testable canvas QR profile, but
|
|
46
45
|
* it is explicitly non-certified and not a substitute for proprietary FrameQR
|
|
47
46
|
* generation or validation software.
|
|
48
47
|
*
|
|
@@ -59,7 +58,7 @@ import {
|
|
|
59
58
|
/** Public identity and compatibility boundary of the implementable profile. */
|
|
60
59
|
export const FRAMEQR_PROFILE = Object.freeze({
|
|
61
60
|
id: 'sythos-canvas-qr/1',
|
|
62
|
-
name: '
|
|
61
|
+
name: 'Sythos Canvas QR profile',
|
|
63
62
|
certified: false,
|
|
64
63
|
densoFrameQrCompatible: false,
|
|
65
64
|
baseSymbology: 'QR Code Model 2',
|
|
@@ -78,7 +77,7 @@ function oddAtMost(value, maximum) {
|
|
|
78
77
|
|
|
79
78
|
function assertSymbolSize(symbolSize) {
|
|
80
79
|
if (!Number.isInteger(symbolSize) || symbolSize < 21 || symbolSize > 177 || (symbolSize - 17) % 4 !== 0) {
|
|
81
|
-
throw new RangeError(`
|
|
80
|
+
throw new RangeError(`Frame QR profile: ${symbolSize} is not a QR Model 2 symbol size`);
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
|
|
@@ -96,12 +95,12 @@ function assertSymbolSize(symbolSize) {
|
|
|
96
95
|
export function normalizeCanvasSpec(symbolSize, canvas = {}) {
|
|
97
96
|
assertSymbolSize(symbolSize);
|
|
98
97
|
if (canvas === null || typeof canvas !== 'object' || Array.isArray(canvas)) {
|
|
99
|
-
throw new TypeError('
|
|
98
|
+
throw new TypeError('Frame QR profile: canvas must be an object');
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
const shape = String(canvas.shape ?? 'square').toLowerCase();
|
|
103
102
|
if (!FRAMEQR_CANVAS_SHAPES.includes(shape)) {
|
|
104
|
-
throw new RangeError(`
|
|
103
|
+
throw new RangeError(`Frame QR profile: unsupported canvas shape "${shape}"`);
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
const defaultSize = oddAtMost(Math.max(3, Math.round(symbolSize * 0.17)), symbolSize - 16);
|
|
@@ -112,7 +111,7 @@ export function normalizeCanvasSpec(symbolSize, canvas = {}) {
|
|
|
112
111
|
for (const [name, value] of [['width', requestedWidth], ['height', requestedHeight]]) {
|
|
113
112
|
if (!Number.isFinite(Number(value)) || Number(value) < 1 || Number(value) > maximumDimension) {
|
|
114
113
|
throw new RangeError(
|
|
115
|
-
`
|
|
114
|
+
`Frame QR profile: canvas ${name} must be between 1 and ${maximumDimension} modules`
|
|
116
115
|
);
|
|
117
116
|
}
|
|
118
117
|
}
|
|
@@ -123,10 +122,10 @@ export function normalizeCanvasSpec(symbolSize, canvas = {}) {
|
|
|
123
122
|
const angle = ((Number(canvas.angle ?? 0) % 360) + 360) % 360;
|
|
124
123
|
|
|
125
124
|
if (![0, 90, 180, 270].includes(angle)) {
|
|
126
|
-
throw new RangeError('
|
|
125
|
+
throw new RangeError('Frame QR profile: angle must be 0, 90, 180 or 270 degrees');
|
|
127
126
|
}
|
|
128
127
|
if (centerX < 8 || centerY < 8 || centerX >= symbolSize - 8 || centerY >= symbolSize - 8) {
|
|
129
|
-
throw new RangeError('
|
|
128
|
+
throw new RangeError('Frame QR profile: canvas centre must remain inside the finder-pattern boundary');
|
|
130
129
|
}
|
|
131
130
|
|
|
132
131
|
return { shape, centerX, centerY, width, height, angle };
|
|
@@ -197,7 +196,7 @@ function codewordBlockMap(layout) {
|
|
|
197
196
|
*/
|
|
198
197
|
export function analyzeCanvasDamage(version, canvas = {}) {
|
|
199
198
|
if (!Number.isInteger(version) || version < 1 || version > 40) {
|
|
200
|
-
throw new RangeError(`
|
|
199
|
+
throw new RangeError(`Frame QR profile: version must be an integer 1-40, got ${version}`);
|
|
201
200
|
}
|
|
202
201
|
const symbolSize = versionSize(version);
|
|
203
202
|
const spec = normalizeCanvasSpec(symbolSize, canvas);
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
26
|
* SPDX-License-Identifier: MIT
|
|
28
27
|
*
|
|
29
28
|
* Original work. No code from any other barcode implementation.
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
26
|
* SPDX-License-Identifier: MIT
|
|
28
27
|
*
|
|
29
28
|
* Original work. No code from any other barcode implementation.
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
26
|
* SPDX-License-Identifier: MIT
|
|
28
27
|
*
|
|
29
28
|
* Original work. No code from any other barcode implementation.
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
26
|
* SPDX-License-Identifier: MIT
|
|
28
27
|
*
|
|
29
28
|
* Original work. No code from any other barcode implementation.
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
|
-
* SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
|
|
27
26
|
* SPDX-License-Identifier: MIT
|
|
28
27
|
*
|
|
29
28
|
* Original work. No code from any other barcode implementation.
|
|
@@ -248,7 +248,7 @@ export type DecodeResult = {
|
|
|
248
248
|
/**
|
|
249
249
|
* Camera-profile orientation in degrees.
|
|
250
250
|
*/
|
|
251
|
-
rotation?: 0 | 90 | 180 | 270;
|
|
251
|
+
rotation?: 0 | 45 | 90 | 135 | 180 | 225 | 270 | 315;
|
|
252
252
|
/**
|
|
253
253
|
* Camera-profile validation evidence.
|
|
254
254
|
*/
|
|
@@ -310,7 +310,7 @@ export type DecodeResult = {
|
|
|
310
310
|
* @property {{format:'ean2'|'ean5', text:string, parity:string, checksum?:number}} [addon] Attached EAN/UPC supplement.
|
|
311
311
|
* @property {number} [confidence] Camera-profile confidence from 0 to 1.
|
|
312
312
|
* @property {{x:number,y:number,width:number,height:number}} [bounds] Camera-profile bounds in the scanned orientation.
|
|
313
|
-
* @property {0|90|180|270} [rotation] Camera-profile orientation in degrees.
|
|
313
|
+
* @property {0|45|90|135|180|225|270|315} [rotation] Camera-profile orientation in degrees.
|
|
314
314
|
* @property {{quietZone:boolean,checksum:boolean|null,rows:number|null,consistency:number|null}} [quality] Camera-profile validation evidence.
|
|
315
315
|
* @property {boolean} [gs1] Whether the physical symbol is classified as GS1.
|
|
316
316
|
* @property {string} [symbologyIdentifier] GS1 symbology identifier.
|
|
@@ -360,4 +360,4 @@ export declare function decodeStrict(image: {
|
|
|
360
360
|
height: number;
|
|
361
361
|
}, options?: object): DecodeResult;
|
|
362
362
|
/** Library version, matching package.json. */
|
|
363
|
-
export declare const VERSION = "1.5.
|
|
363
|
+
export declare const VERSION = "1.5.9";
|