@sythos/js_barcode_universal 1.3.1 → 1.4.1

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 (102) hide show
  1. package/AI_USAGE.md +33 -0
  2. package/LICENSE +4 -2
  3. package/NOTICE.md +8 -5
  4. package/README.md +74 -23
  5. package/bundle/sythos-barcode.esm.js +2313 -92
  6. package/bundle/sythos-barcode.js +2229 -88
  7. package/examples/create.html +2 -1
  8. package/examples/read.html +1 -0
  9. package/licenses/README.md +6 -1
  10. package/licenses/aztec-rune.license +76 -0
  11. package/licenses/compact-pdf417.license +76 -0
  12. package/licenses/ean-2.license +74 -0
  13. package/licenses/ean-5.license +74 -0
  14. package/licenses/frameqr.license +6 -6
  15. package/licenses/gs1-databar.license +81 -0
  16. package/package.json +16 -4
  17. package/src/aztec/decoder.js +1 -0
  18. package/src/aztec/detector.js +1 -0
  19. package/src/aztec/encoder.js +1 -0
  20. package/src/aztec/high-level.js +1 -0
  21. package/src/aztec/index.js +1 -0
  22. package/src/aztec/tables.js +1 -0
  23. package/src/aztecrune/decoder.js +156 -0
  24. package/src/aztecrune/detector.js +167 -0
  25. package/src/aztecrune/encoder.js +122 -0
  26. package/src/aztecrune/index.js +50 -0
  27. package/src/aztecrune/tables.js +138 -0
  28. package/src/compactpdf417/decoder.js +129 -0
  29. package/src/compactpdf417/detector.js +140 -0
  30. package/src/compactpdf417/encoder.js +141 -0
  31. package/src/compactpdf417/index.js +22 -0
  32. package/src/compactpdf417/tables.js +174 -0
  33. package/src/core/bit-buffer.js +1 -0
  34. package/src/core/bit-matrix.js +1 -0
  35. package/src/core/errors.js +1 -0
  36. package/src/core/galois-field.js +1 -0
  37. package/src/core/index.js +1 -0
  38. package/src/core/reed-solomon.js +1 -0
  39. package/src/databar/codec.js +182 -0
  40. package/src/databar/decoder.js +115 -0
  41. package/src/databar/encoder.js +97 -0
  42. package/src/databar/gs1.js +178 -0
  43. package/src/databar/index.js +69 -0
  44. package/src/databar/patterns.js +144 -0
  45. package/src/databar/tables.js +125 -0
  46. package/src/datamatrix/decoder.js +1 -0
  47. package/src/datamatrix/detector.js +1 -0
  48. package/src/datamatrix/encoder.js +1 -0
  49. package/src/datamatrix/index.js +1 -0
  50. package/src/datamatrix/tables.js +1 -0
  51. package/src/frameqr/decoder.js +16 -15
  52. package/src/frameqr/detector.js +3 -2
  53. package/src/frameqr/encoder.js +8 -7
  54. package/src/frameqr/index.js +1 -0
  55. package/src/frameqr/tables.js +11 -10
  56. package/src/image/binarizer.js +1 -0
  57. package/src/image/grid-sampler.js +1 -0
  58. package/src/image/index.js +1 -0
  59. package/src/image/luminance.js +1 -0
  60. package/src/image/perspective.js +1 -0
  61. package/src/index.js +72 -8
  62. package/src/micropdf417/compaction.js +1 -0
  63. package/src/micropdf417/decoder.js +1 -0
  64. package/src/micropdf417/detector.js +1 -0
  65. package/src/micropdf417/encoder.js +1 -0
  66. package/src/micropdf417/error-correction.js +1 -0
  67. package/src/micropdf417/index.js +1 -0
  68. package/src/micropdf417/tables.js +1 -0
  69. package/src/microqr/decoder.js +1 -0
  70. package/src/microqr/detector.js +1 -0
  71. package/src/microqr/encoder.js +1 -0
  72. package/src/microqr/index.js +1 -0
  73. package/src/microqr/tables.js +1 -0
  74. package/src/oned/addons.js +421 -0
  75. package/src/oned/index.js +18 -0
  76. package/src/oned/patterns.js +1 -0
  77. package/src/oned/reader.js +1 -0
  78. package/src/oned/writers.js +1 -0
  79. package/src/pdf417/compaction.js +1 -0
  80. package/src/pdf417/decoder.js +1 -0
  81. package/src/pdf417/detector.js +1 -0
  82. package/src/pdf417/encoder.js +1 -0
  83. package/src/pdf417/error-correction.js +1 -0
  84. package/src/pdf417/index.js +5 -0
  85. package/src/pdf417/tables.js +1 -0
  86. package/src/qr/decoder.js +1 -0
  87. package/src/qr/detector.js +1 -0
  88. package/src/qr/encoder.js +1 -0
  89. package/src/qr/index.js +1 -0
  90. package/src/qr/tables.js +1 -0
  91. package/src/render/image-data.js +1 -0
  92. package/src/render/index.js +1 -0
  93. package/src/render/options.js +1 -0
  94. package/src/render/png.js +1 -0
  95. package/src/render/svg.js +1 -0
  96. package/src/render/webgl.js +1 -0
  97. package/src/render/webgpu.js +1 -0
  98. package/src/rmqr/decoder.js +1 -0
  99. package/src/rmqr/detector.js +1 -0
  100. package/src/rmqr/encoder.js +1 -0
  101. package/src/rmqr/index.js +1 -0
  102. package/src/rmqr/tables.js +1 -0
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
package/src/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  * MIT License
5
5
  *
6
6
  * Copyright (c) 2026 Sythos
7
+ * SPDX-FileCopyrightText: 2026 Sythos (https://www.sythos.net)
7
8
  *
8
9
  * Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
  * of this software and associated documentation files (the "Software"), to deal
@@ -59,6 +60,9 @@ import * as micropdf417 from './micropdf417/index.js';
59
60
  import * as microqr from './microqr/index.js';
60
61
  import * as rmqr from './rmqr/index.js';
61
62
  import * as frameqr from './frameqr/index.js';
63
+ import * as aztecRune from './aztecrune/index.js';
64
+ import * as compactPdf417 from './compactpdf417/index.js';
65
+ import * as databar from './databar/index.js';
62
66
 
63
67
  export { BitMatrix };
64
68
  export {
@@ -77,7 +81,12 @@ export {
77
81
  encodeDataMatrix, decodeDataMatrix, detectDataMatrix, detectAndDecodeDataMatrix,
78
82
  } from './datamatrix/index.js';
79
83
  export { encodeAztec, decodeAztec, detectAztec, detectAndDecodeAztec } from './aztec/index.js';
84
+ export * from './aztecrune/index.js';
80
85
  export { encodePDF417, decodePDF417, detectPDF417, detectAndDecodePDF417 } from './pdf417/index.js';
86
+ export * from './compactpdf417/index.js';
87
+ // DataBar currently exposes verified GS1 data-layer codecs only; physical
88
+ // symbol rendering and image detection remain deliberately out of scope.
89
+ export * from './databar/index.js';
81
90
  export {
82
91
  encodeMicroPDF417, decodeMicroPDF417, detectMicroPDF417, detectAndDecodeMicroPDF417,
83
92
  } from './micropdf417/index.js';
@@ -127,6 +136,11 @@ const rmqrCanEncode = typeof rmqr.encodeRMQR === 'function';
127
136
  const rmqrCanDecode = typeof rmqr.detectAndDecodeRMQR === 'function';
128
137
  const frameQrCanEncode = typeof frameqr.encodeFrameQR === 'function';
129
138
  const frameQrCanDecode = typeof frameqr.detectAndDecodeFrameQR === 'function';
139
+ const aztecRuneCanEncode = typeof aztecRune.encodeAztecRune === 'function';
140
+ const aztecRuneCanDecode = typeof aztecRune.detectAndDecodeAztecRune === 'function';
141
+ const compactPdf417CanEncode = typeof compactPdf417.encodeCompactPDF417 === 'function';
142
+ const compactPdf417CanDecode = typeof compactPdf417.detectAndDecodeCompactPDF417 === 'function';
143
+ const dataBarCanEncode = typeof databar.encodeDataBar14 === 'function';
130
144
 
131
145
  /**
132
146
  * Every format this build supports.
@@ -168,6 +182,13 @@ export function listFormats() {
168
182
  canRead: aztecCanDecode,
169
183
  kind: /** @type {'2D'} */ ('2D'),
170
184
  });
185
+ formats.push({
186
+ id: 'aztecrune',
187
+ label: 'Aztec Rune',
188
+ canWrite: aztecRuneCanEncode,
189
+ canRead: aztecRuneCanDecode,
190
+ kind: /** @type {'2D'} */ ('2D'),
191
+ });
171
192
  formats.push({
172
193
  id: 'pdf417',
173
194
  label: 'PDF417',
@@ -175,6 +196,13 @@ export function listFormats() {
175
196
  canRead: pdf417CanDecode,
176
197
  kind: /** @type {'2D'} */ ('2D'),
177
198
  });
199
+ formats.push({
200
+ id: 'compactpdf417',
201
+ label: 'Compact PDF417',
202
+ canWrite: compactPdf417CanEncode,
203
+ canRead: compactPdf417CanDecode,
204
+ kind: /** @type {'2D'} */ ('2D'),
205
+ });
178
206
  formats.push({
179
207
  id: 'micropdf417',
180
208
  label: 'MicroPDF417',
@@ -198,11 +226,18 @@ export function listFormats() {
198
226
  });
199
227
  formats.push({
200
228
  id: 'frameqr',
201
- label: 'Sythos Canvas QR profile',
229
+ label: 'FrameQR Code',
202
230
  canWrite: frameQrCanEncode,
203
231
  canRead: frameQrCanDecode,
204
232
  kind: /** @type {'2D'} */ ('2D'),
205
233
  });
234
+ formats.push({
235
+ id: 'gs1databar14',
236
+ label: 'GS1 DataBar Omnidirectional / Truncated',
237
+ canWrite: dataBarCanEncode,
238
+ canRead: false,
239
+ kind: /** @type {'1D'} */ ('1D'),
240
+ });
206
241
 
207
242
  return formats;
208
243
  }
@@ -233,7 +268,7 @@ export function listFormats() {
233
268
  * @param {'auto'|'text'|'byte'|'numeric'} [options.compaction] PDF417 compaction mode.
234
269
  * @param {number} [options.eci] MicroPDF417 byte-compaction ECI assignment (3 or 26).
235
270
  * @param {number} [options.aspectRatio] Preferred MicroPDF417 symbol aspect ratio.
236
- * @param {object} [options.canvas] Sythos Canvas QR artwork reservation.
271
+ * @param {object} [options.canvas] FrameQR Code artwork reservation.
237
272
  * @param {'square'|'circle'|'diamond'} [options.canvas.shape] Canvas shape.
238
273
  * @param {number} [options.canvas.size] Odd canvas size in QR modules.
239
274
  * @param {number} [options.canvas.width] Canvas width in QR modules.
@@ -256,9 +291,15 @@ export function encode(text, options = {}) {
256
291
  if (format === 'aztec' || format === 'aztec-code') {
257
292
  return aztec.encodeAztec(value, options);
258
293
  }
294
+ if (format === 'aztecrune' || format === 'aztec-rune' || format === 'rune') {
295
+ return aztecRune.encodeAztecRune(value, options);
296
+ }
259
297
  if (format === 'pdf417' || format === 'pdf-417') {
260
298
  return pdf417.encodePDF417(value, options);
261
299
  }
300
+ if (format === 'compactpdf417' || format === 'compact-pdf417' || format === 'compact-pdf-417') {
301
+ return compactPdf417.encodeCompactPDF417(value, options);
302
+ }
262
303
  if (format === 'micropdf417' || format === 'micro-pdf417' || format === 'micro-pdf-417') {
263
304
  return micropdf417.encodeMicroPDF417(value, options);
264
305
  }
@@ -271,10 +312,13 @@ export function encode(text, options = {}) {
271
312
  if (format === 'frameqr' || format === 'frame-qr' || format === 'canvas-qr') {
272
313
  return frameqr.encodeFrameQR(value, options);
273
314
  }
315
+ if (format === 'gs1databar14' || format === 'gs1-databar14' || format === 'databar') {
316
+ return databar.encodeDataBar14(value, options);
317
+ }
274
318
 
275
319
  const entry = ONED_FORMATS[format];
276
320
  if (!entry) {
277
- const known = [...Object.keys(ONED_FORMATS), 'qr', 'datamatrix', 'aztec', 'pdf417', 'micropdf417', 'microqr', 'rmqr', 'frameqr'].join(', ');
321
+ const known = [...Object.keys(ONED_FORMATS), 'qr', 'datamatrix', 'aztec', 'aztecrune', 'pdf417', 'compactpdf417', 'micropdf417', 'microqr', 'rmqr', 'frameqr', 'gs1databar14'].join(', ');
278
322
  throw new EncodeError(`Unknown format "${format}". Known formats: ${known}`);
279
323
  }
280
324
  return entry.encode(value, options);
@@ -297,9 +341,9 @@ export function encode(text, options = {}) {
297
341
  * @property {number} [rowHeight] PDF417 row height in modules.
298
342
  * @property {number} [variant] MicroPDF417 predefined variant number.
299
343
  * @property {number} [eccCodewords] MicroPDF417 fixed error-correction codewords.
300
- * @property {string} [profile] Sythos Canvas QR profile identifier.
344
+ * @property {string} [profile] FrameQR Code profile identifier.
301
345
  * @property {boolean} [certified] Whether the profile is certified by its originator.
302
- * @property {object} [canvas] Canvas reservation metadata for the Sythos profile.
346
+ * @property {object} [canvas] Canvas reservation metadata for the FrameQR Code profile.
303
347
  */
304
348
 
305
349
  /**
@@ -314,7 +358,7 @@ export function encode(text, options = {}) {
314
358
  * @param {string[]} [options.formats] Restrict to these format ids.
315
359
  * @param {boolean} [options.tryHarder] Retry inverted and rotated. Default true.
316
360
  * @param {'global'|'hybrid'|'auto'} [options.binarizer]
317
- * @param {object} [options.frameqr] Sythos Canvas QR detector options when
361
+ * @param {object} [options.frameqr] FrameQR Code detector options when
318
362
  * the profile marker is not preserved through image rendering.
319
363
  * @returns {DecodeResult[]}
320
364
  */
@@ -324,7 +368,9 @@ export function decode(image, options = {}) {
324
368
  const wantQR = !want || want.has('qr') || want.has('qrcode');
325
369
  const wantDataMatrix = !want || want.has('datamatrix') || want.has('data-matrix');
326
370
  const wantAztec = !want || want.has('aztec') || want.has('aztec-code');
371
+ const wantAztecRune = !want || want.has('aztecrune') || want.has('aztec-rune') || want.has('rune');
327
372
  const wantPDF417 = !want || want.has('pdf417') || want.has('pdf-417');
373
+ const wantCompactPDF417 = !want || want.has('compactpdf417') || want.has('compact-pdf417') || want.has('compact-pdf-417');
328
374
  const wantMicroPDF417 = !want || want.has('micropdf417') || want.has('micro-pdf417') || want.has('micro-pdf-417');
329
375
  const wantMicroQR = !want || want.has('microqr') || want.has('micro-qr');
330
376
  const wantRMQR = !want || want.has('rmqr') || want.has('r-mqr') || want.has('rectangular-micro-qr');
@@ -381,6 +427,15 @@ export function decode(image, options = {}) {
381
427
  }
382
428
  }
383
429
 
430
+ if (wantAztecRune && aztecRuneCanDecode) {
431
+ try {
432
+ const found = aztecRune.detectAndDecodeAztecRune(bits);
433
+ if (found) results.push({ ...found, format: 'aztecrune' });
434
+ } catch {
435
+ /* no Aztec Rune in this pass */
436
+ }
437
+ }
438
+
384
439
  if (wantPDF417 && pdf417CanDecode) {
385
440
  try {
386
441
  const found = pdf417.detectAndDecodePDF417(bits);
@@ -390,6 +445,15 @@ export function decode(image, options = {}) {
390
445
  }
391
446
  }
392
447
 
448
+ if (wantCompactPDF417 && compactPdf417CanDecode) {
449
+ try {
450
+ const found = compactPdf417.detectAndDecodeCompactPDF417(bits);
451
+ if (found) results.push({ ...found, format: 'compactpdf417' });
452
+ } catch {
453
+ /* no Compact PDF417 in this pass */
454
+ }
455
+ }
456
+
393
457
  if (wantMicroPDF417 && microPdf417CanDecode) {
394
458
  // MicroPDF417 detection measures runs across the whole raster. Hybrid
395
459
  // thresholding can alter uniform modules near local-window boundaries,
@@ -430,7 +494,7 @@ export function decode(image, options = {}) {
430
494
  results.push({ ...found, format: 'frameqr' });
431
495
  }
432
496
  } catch {
433
- /* no Sythos Canvas QR profile in this pass */
497
+ /* no FrameQR Code in this pass */
434
498
  }
435
499
  }
436
500
 
@@ -468,4 +532,4 @@ export function decodeStrict(image, options) {
468
532
  }
469
533
 
470
534
  /** Library version, matching package.json. */
471
- export const VERSION = '1.3.1';
535
+ export const VERSION = '1.4.1';
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.
@@ -23,6 +23,7 @@
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)
26
27
  * SPDX-License-Identifier: MIT
27
28
  *
28
29
  * Original work. No code from any other barcode implementation.