@qr-platform/qr-code.js 0.8.17

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 (208) hide show
  1. package/.github/workflows/publish.yml +18 -0
  2. package/CHANGELOG.md +233 -0
  3. package/LICENSE.md +77 -0
  4. package/README.md +188 -0
  5. package/docs/advanced-examples.md +523 -0
  6. package/docs/api-reference-guide.md +254 -0
  7. package/docs/documentation.md +1592 -0
  8. package/docs/examples.md +322 -0
  9. package/docs/license-management.md +501 -0
  10. package/docs/typescript-types-definitions.md +372 -0
  11. package/docs/usage-guide.md +622 -0
  12. package/lib/core/qr-code-js.d.ts +48 -0
  13. package/lib/core/qr-constant.d.ts +9 -0
  14. package/lib/core/qr-options-validation.d.ts +13 -0
  15. package/lib/core/qr-svg.d.ts +76 -0
  16. package/lib/core/qr-templates.d.ts +6 -0
  17. package/lib/figures/corner-dot.d.ts +24 -0
  18. package/lib/figures/corner-square.d.ts +24 -0
  19. package/lib/figures/dot.d.ts +31 -0
  20. package/lib/index.d.ts +52 -0
  21. package/lib/lib/image/GIFImage.d.ts +19 -0
  22. package/lib/lib/io/Base64.d.ts +10 -0
  23. package/lib/lib/io/Base64DecodeInputStream.d.ts +15 -0
  24. package/lib/lib/io/Base64EncodeOutputStream.d.ts +17 -0
  25. package/lib/lib/io/ByteArrayInputStream.d.ts +12 -0
  26. package/lib/lib/io/ByteArrayOutputStream.d.ts +12 -0
  27. package/lib/lib/io/InputStream.d.ts +10 -0
  28. package/lib/lib/io/OutputStream.d.ts +12 -0
  29. package/lib/lib/qr-code.d.ts +5 -0
  30. package/lib/lib/qrcode/BitBuffer.d.ts +11 -0
  31. package/lib/lib/qrcode/ErrorCorrectLevel.d.ts +23 -0
  32. package/lib/lib/qrcode/MaskPattern.d.ts +39 -0
  33. package/lib/lib/qrcode/Mode.d.ts +23 -0
  34. package/lib/lib/qrcode/Polynomial.d.ts +15 -0
  35. package/lib/lib/qrcode/QR8BitByte.d.ts +13 -0
  36. package/lib/lib/qrcode/QRAlphaNum.d.ts +13 -0
  37. package/lib/lib/qrcode/QRCode.d.ts +22 -0
  38. package/lib/lib/qrcode/QRCodeMinimal.d.ts +58 -0
  39. package/lib/lib/qrcode/QRData.d.ts +17 -0
  40. package/lib/lib/qrcode/QRKanji.d.ts +13 -0
  41. package/lib/lib/qrcode/QRMath.d.ts +13 -0
  42. package/lib/lib/qrcode/QRNumber.d.ts +14 -0
  43. package/lib/lib/qrcode/QRUtil.d.ts +25 -0
  44. package/lib/lib/qrcode/RSBlock.d.ts +16 -0
  45. package/lib/lib/text/createStringToBytes.d.ts +9 -0
  46. package/lib/lib/text/stringToBytes_SJIS.d.ts +8 -0
  47. package/lib/lib/text/stringToBytes_UTF8.d.ts +7 -0
  48. package/lib/lib/zbar-wasm/index.d.ts +1 -0
  49. package/lib/lib/zxing-js/src/browser/BrowserCodeReader.d.ts +410 -0
  50. package/lib/lib/zxing-js/src/browser/BrowserQRCodeReader.d.ts +29 -0
  51. package/lib/lib/zxing-js/src/browser/BrowserQRCodeSvgWriter.d.ts +46 -0
  52. package/lib/lib/zxing-js/src/browser/BrowserSvgCodeWriter.d.ts +49 -0
  53. package/lib/lib/zxing-js/src/browser/DecodeContinuouslyCallback.d.ts +6 -0
  54. package/lib/lib/zxing-js/src/browser/HTMLCanvasElementLuminanceSource.d.ts +27 -0
  55. package/lib/lib/zxing-js/src/browser/HTMLVisualMediaElement.d.ts +4 -0
  56. package/lib/lib/zxing-js/src/browser/VideoInputDevice.d.ts +22 -0
  57. package/lib/lib/zxing-js/src/browser.d.ts +3 -0
  58. package/lib/lib/zxing-js/src/core/ArgumentException.d.ts +7 -0
  59. package/lib/lib/zxing-js/src/core/ArithmeticException.d.ts +7 -0
  60. package/lib/lib/zxing-js/src/core/ArrayIndexOutOfBoundsException.d.ts +10 -0
  61. package/lib/lib/zxing-js/src/core/BarcodeFormat.d.ts +42 -0
  62. package/lib/lib/zxing-js/src/core/Binarizer.d.ts +53 -0
  63. package/lib/lib/zxing-js/src/core/BinaryBitmap.d.ts +78 -0
  64. package/lib/lib/zxing-js/src/core/ChecksumException.d.ts +8 -0
  65. package/lib/lib/zxing-js/src/core/DecodeHintType.d.ts +91 -0
  66. package/lib/lib/zxing-js/src/core/Dimension.d.ts +13 -0
  67. package/lib/lib/zxing-js/src/core/EncodeHintType.d.ts +99 -0
  68. package/lib/lib/zxing-js/src/core/Exception.d.ts +17 -0
  69. package/lib/lib/zxing-js/src/core/FormatException.d.ts +8 -0
  70. package/lib/lib/zxing-js/src/core/HighContrastLuminanceSource.d.ts +27 -0
  71. package/lib/lib/zxing-js/src/core/IllegalArgumentException.d.ts +7 -0
  72. package/lib/lib/zxing-js/src/core/IllegalStateException.d.ts +7 -0
  73. package/lib/lib/zxing-js/src/core/IndexOutOfBoundsException.d.ts +7 -0
  74. package/lib/lib/zxing-js/src/core/InvertedLuminanceSource.d.ts +22 -0
  75. package/lib/lib/zxing-js/src/core/LuminanceSource.d.ts +84 -0
  76. package/lib/lib/zxing-js/src/core/NodeLuminanceSource.d.ts +36 -0
  77. package/lib/lib/zxing-js/src/core/NotFoundException.d.ts +8 -0
  78. package/lib/lib/zxing-js/src/core/NullPointerException.d.ts +7 -0
  79. package/lib/lib/zxing-js/src/core/OutOfMemoryError.d.ts +6 -0
  80. package/lib/lib/zxing-js/src/core/PlanarYUVLuminanceSource.d.ts +35 -0
  81. package/lib/lib/zxing-js/src/core/RGBLuminanceSource.d.ts +21 -0
  82. package/lib/lib/zxing-js/src/core/Reader.d.ts +49 -0
  83. package/lib/lib/zxing-js/src/core/ReaderException.d.ts +7 -0
  84. package/lib/lib/zxing-js/src/core/ReedSolomonException.d.ts +7 -0
  85. package/lib/lib/zxing-js/src/core/Result.d.ts +52 -0
  86. package/lib/lib/zxing-js/src/core/ResultMetadataType.d.ts +68 -0
  87. package/lib/lib/zxing-js/src/core/ResultPoint.d.ts +34 -0
  88. package/lib/lib/zxing-js/src/core/ResultPointCallback.d.ts +11 -0
  89. package/lib/lib/zxing-js/src/core/UniversalLuminanceSource.d.ts +46 -0
  90. package/lib/lib/zxing-js/src/core/UnsupportedOperationException.d.ts +7 -0
  91. package/lib/lib/zxing-js/src/core/Writer.d.ts +30 -0
  92. package/lib/lib/zxing-js/src/core/WriterException.d.ts +7 -0
  93. package/lib/lib/zxing-js/src/core/common/BitArray.d.ts +111 -0
  94. package/lib/lib/zxing-js/src/core/common/BitMatrix.d.ts +98 -0
  95. package/lib/lib/zxing-js/src/core/common/BitSource.d.ts +38 -0
  96. package/lib/lib/zxing-js/src/core/common/CharacterSetECI.d.ts +89 -0
  97. package/lib/lib/zxing-js/src/core/common/DecoderResult.d.ts +64 -0
  98. package/lib/lib/zxing-js/src/core/common/DefaultGridSampler.d.ts +10 -0
  99. package/lib/lib/zxing-js/src/core/common/DetectorResult.d.ts +16 -0
  100. package/lib/lib/zxing-js/src/core/common/ECIEncoderSet.d.ts +37 -0
  101. package/lib/lib/zxing-js/src/core/common/ECIInput.d.ts +79 -0
  102. package/lib/lib/zxing-js/src/core/common/GlobalHistogramBinarizer.d.ts +29 -0
  103. package/lib/lib/zxing-js/src/core/common/GridSampler.d.ts +36 -0
  104. package/lib/lib/zxing-js/src/core/common/GridSamplerInstance.d.ts +18 -0
  105. package/lib/lib/zxing-js/src/core/common/HybridBinarizer.d.ts +54 -0
  106. package/lib/lib/zxing-js/src/core/common/MinimalECIInput.d.ts +123 -0
  107. package/lib/lib/zxing-js/src/core/common/PerspectiveTransform.d.ts +26 -0
  108. package/lib/lib/zxing-js/src/core/common/StringUtils.d.ts +48 -0
  109. package/lib/lib/zxing-js/src/core/common/detector/CornerDetector.d.ts +35 -0
  110. package/lib/lib/zxing-js/src/core/common/detector/MathUtils.d.ts +36 -0
  111. package/lib/lib/zxing-js/src/core/common/detector/WhiteRectangleDetector.d.ts +71 -0
  112. package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGF.d.ts +34 -0
  113. package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGFPoly.d.ts +36 -0
  114. package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGF.d.ts +58 -0
  115. package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGFPoly.d.ts +47 -0
  116. package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonDecoder.d.ts +40 -0
  117. package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonEncoder.d.ts +41 -0
  118. package/lib/lib/zxing-js/src/core/qrcode/QRCodeReader.d.ts +35 -0
  119. package/lib/lib/zxing-js/src/core/qrcode/QRCodeWriter.d.ts +13 -0
  120. package/lib/lib/zxing-js/src/core/qrcode/decoder/BitMatrixParser.d.ts +58 -0
  121. package/lib/lib/zxing-js/src/core/qrcode/decoder/DataBlock.d.ts +28 -0
  122. package/lib/lib/zxing-js/src/core/qrcode/decoder/DataMask.d.ts +36 -0
  123. package/lib/lib/zxing-js/src/core/qrcode/decoder/DecodedBitStreamParser.d.ts +30 -0
  124. package/lib/lib/zxing-js/src/core/qrcode/decoder/Decoder.d.ts +44 -0
  125. package/lib/lib/zxing-js/src/core/qrcode/decoder/ECB.d.ts +12 -0
  126. package/lib/lib/zxing-js/src/core/qrcode/decoder/ECBlocks.d.ts +16 -0
  127. package/lib/lib/zxing-js/src/core/qrcode/decoder/ErrorCorrectionLevel.d.ts +38 -0
  128. package/lib/lib/zxing-js/src/core/qrcode/decoder/FormatInformation.d.ts +33 -0
  129. package/lib/lib/zxing-js/src/core/qrcode/decoder/Mode.d.ts +56 -0
  130. package/lib/lib/zxing-js/src/core/qrcode/decoder/QRCodeDecoderMetaData.d.ts +21 -0
  131. package/lib/lib/zxing-js/src/core/qrcode/decoder/Version.d.ts +44 -0
  132. package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPattern.d.ts +21 -0
  133. package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPatternFinder.d.ts +82 -0
  134. package/lib/lib/zxing-js/src/core/qrcode/detector/Detector.d.ts +87 -0
  135. package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPattern.d.ts +26 -0
  136. package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternFinder.d.ts +114 -0
  137. package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternInfo.d.ts +16 -0
  138. package/lib/lib/zxing-js/src/core/qrcode/encoder/BlockPair.d.ts +7 -0
  139. package/lib/lib/zxing-js/src/core/qrcode/encoder/ByteMatrix.d.ts +24 -0
  140. package/lib/lib/zxing-js/src/core/qrcode/encoder/Encoder.d.ts +85 -0
  141. package/lib/lib/zxing-js/src/core/qrcode/encoder/MaskUtil.d.ts +47 -0
  142. package/lib/lib/zxing-js/src/core/qrcode/encoder/MatrixUtil.d.ts +37 -0
  143. package/lib/lib/zxing-js/src/core/qrcode/encoder/QRCode.d.ts +29 -0
  144. package/lib/lib/zxing-js/src/core/util/Arrays.d.ts +45 -0
  145. package/lib/lib/zxing-js/src/core/util/ByteArrayOutputStream.d.ts +174 -0
  146. package/lib/lib/zxing-js/src/core/util/Charset.d.ts +7 -0
  147. package/lib/lib/zxing-js/src/core/util/Collections.d.ts +11 -0
  148. package/lib/lib/zxing-js/src/core/util/Float.d.ts +14 -0
  149. package/lib/lib/zxing-js/src/core/util/Formatter.d.ts +28 -0
  150. package/lib/lib/zxing-js/src/core/util/Integer.d.ts +19 -0
  151. package/lib/lib/zxing-js/src/core/util/Long.d.ts +12 -0
  152. package/lib/lib/zxing-js/src/core/util/OutputStream.d.ts +106 -0
  153. package/lib/lib/zxing-js/src/core/util/StandardCharsets.d.ts +7 -0
  154. package/lib/lib/zxing-js/src/core/util/StringBuilder.d.ts +21 -0
  155. package/lib/lib/zxing-js/src/core/util/StringEncoding.d.ts +51 -0
  156. package/lib/lib/zxing-js/src/core/util/System.d.ts +10 -0
  157. package/lib/lib/zxing-js/src/customTypings.d.ts +16 -0
  158. package/lib/lib/zxing-js/src/index.d.ts +5 -0
  159. package/lib/lib/zxing-js/src/node.d.ts +1 -0
  160. package/lib/license/LicenseManager.d.ts +69 -0
  161. package/lib/license/LicenseManagerNode.d.ts +64 -0
  162. package/lib/node.d.ts +37 -0
  163. package/lib/options-demo.d.ts +239 -0
  164. package/lib/plugins/QRBorderHelpers.d.ts +32 -0
  165. package/lib/plugins/QRBorderPlugin.d.ts +35 -0
  166. package/lib/plugins/QRValidatorZbar.d.ts +38 -0
  167. package/lib/plugins/QRValidatorZbarNode.d.ts +60 -0
  168. package/lib/plugins/QRValidatorZbarNodeSharp.d.ts +83 -0
  169. package/lib/qr-code-js-node.js +1 -0
  170. package/lib/qr-code-js.js +1 -0
  171. package/lib/templates/borders-inner-outter.d.ts +129 -0
  172. package/lib/templates/borders-inner-scale-offset.d.ts +497 -0
  173. package/lib/templates/borders-inner.d.ts +129 -0
  174. package/lib/templates/borders-no-license.d.ts +129 -0
  175. package/lib/templates/borders-outter.d.ts +129 -0
  176. package/lib/templates/borders-text-auto-curved.d.ts +129 -0
  177. package/lib/templates/borders-text-full-curved.d.ts +133 -0
  178. package/lib/templates/borders.d.ts +129 -0
  179. package/lib/templates/scales.d.ts +130 -0
  180. package/lib/templates/scan-validators/index.d.ts +1 -0
  181. package/lib/templates/scan-validators/tests/cases/basic-inverted.d.ts +9 -0
  182. package/lib/templates/scan-validators/tests/cases/basic-no-license.d.ts +3 -0
  183. package/lib/templates/scan-validators/tests/cases/basic.d.ts +3 -0
  184. package/lib/templates/scan-validators/tests/cases/colors-inverted.d.ts +2 -0
  185. package/lib/templates/scan-validators/tests/cases/colors.d.ts +58 -0
  186. package/lib/templates/scan-validators/tests/cases/out-of-borders-inverted.d.ts +9 -0
  187. package/lib/templates/scan-validators/tests/cases/out-of-borders.d.ts +9 -0
  188. package/lib/templates/scan-validators/tests/cases/position-inverted.d.ts +9 -0
  189. package/lib/templates/scan-validators/tests/cases/position.d.ts +3 -0
  190. package/lib/templates/scan-validators/tests/index.d.ts +27 -0
  191. package/lib/tools/browser-image-tools.d.ts +7 -0
  192. package/lib/tools/browser-utils.d.ts +18 -0
  193. package/lib/types/helper.d.ts +23 -0
  194. package/lib/utils/canvas-options.d.ts +7 -0
  195. package/lib/utils/color.d.ts +4 -0
  196. package/lib/utils/gradient.d.ts +26 -0
  197. package/lib/utils/image.d.ts +16 -0
  198. package/lib/utils/merge.d.ts +5 -0
  199. package/lib/utils/options.d.ts +220 -0
  200. package/lib/utils/qrcode.d.ts +8 -0
  201. package/lib/utils/scan-validator-node.d.ts +15 -0
  202. package/lib/utils/scan-validators/abstract-scan-validator.d.ts +43 -0
  203. package/lib/utils/scan-validators/zbar-scan-validator.d.ts +8 -0
  204. package/lib/utils/scan-validators/zxing-canvas-scan-validator.d.ts +10 -0
  205. package/lib/utils/scan-validators/zxing-scan-validator.d.ts +8 -0
  206. package/lib/utils/svg.d.ts +2 -0
  207. package/lib/utils/token-validator.d.ts +19 -0
  208. package/package.json +80 -0
@@ -0,0 +1,69 @@
1
+ import { type DecodedLicenseToken } from '../utils/token-validator';
2
+ export declare const STORAGE_KEY = "QRCodeJsLicense";
3
+ export type LicenseReasonCode = // Export the type
4
+ 'DOMAIN_MISMATCH' | 'TOKEN_EXPIRED' | 'TOKEN_INVALID' | 'FETCH_FAILED' | 'KEY_INVALID';
5
+ export interface ValidationResult {
6
+ isValid: boolean;
7
+ token: string | null;
8
+ license: DecodedLicenseToken | null;
9
+ reason?: LicenseReasonCode;
10
+ }
11
+ export declare class LicenseManager {
12
+ private static _instance;
13
+ private static _defaultLicenseApiUrl;
14
+ private static _currentHostname;
15
+ private _hls;
16
+ private _decodedToken;
17
+ private _licenseKey;
18
+ private _isInitialized;
19
+ private _initPromise;
20
+ private _licenseFetcher;
21
+ private constructor();
22
+ /**
23
+ * Gets the singleton instance of LicenseManager.
24
+ */
25
+ static get instance(): LicenseManager;
26
+ /**
27
+ * Sets the default URL used by the built-in license fetcher.
28
+ * Call this *before* activating with a key if you are not providing a custom fetcher.
29
+ * @param url The new default URL for fetching license tokens.
30
+ */
31
+ static setDefaultLicenseApiUrl(url: string): void;
32
+ get hls(): boolean;
33
+ get isInitialized(): boolean;
34
+ getLicenseDetails(): DecodedLicenseToken | null;
35
+ get licenseKey(): string | null;
36
+ /**
37
+ * Configures the function used to fetch a license token from a key.
38
+ * @param fetcher A function that accepts a license key string and returns a Promise<string> (the token).
39
+ */
40
+ configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
41
+ initialize(): Promise<boolean>;
42
+ private _performInitialization;
43
+ /**
44
+ * Resets the initialization state, forcing re-initialization on the next call to initialize().
45
+ */
46
+ resetInitialization(): void;
47
+ /**
48
+ * Resets the current license state (hls, decodedToken, licenseKey).
49
+ */
50
+ resetLicenseState(): void;
51
+ /**
52
+ * Activates the license using a pre-fetched JWT token.
53
+ * Pass `null` to explicitly clear the current license state.
54
+ * @param token The JWT token string, or null to clear the license.
55
+ * @returns {Promise<ValidationResult>} The result of the validation.
56
+ */
57
+ activateWithToken(token: string | null): Promise<ValidationResult>;
58
+ /**
59
+ * Activates the license using a license key, fetching a token if necessary.
60
+ * @param licenseKey The license key string.
61
+ * @returns {Promise<ValidationResult>} The result of the validation.
62
+ */
63
+ activateWithKey(licenseKey: string): Promise<ValidationResult>;
64
+ private _checkDomain;
65
+ private _logValidationWarning;
66
+ private _getStoredLicenseData;
67
+ private _setStoredLicenseData;
68
+ private _validateAndStoreToken;
69
+ }
@@ -0,0 +1,64 @@
1
+ import { type DecodedLicenseToken } from '../utils/token-validator';
2
+ export interface ValidationResult {
3
+ isValid: boolean;
4
+ token: string | null;
5
+ license: DecodedLicenseToken | null;
6
+ }
7
+ export declare class LicenseManagerNode {
8
+ private static _instance;
9
+ private static _defaultLicenseApiUrl;
10
+ private _hls;
11
+ private _decodedToken;
12
+ private _licenseKey;
13
+ private _storedToken;
14
+ private _storedKey;
15
+ private _isInitialized;
16
+ private _initPromise;
17
+ private _licenseFetcher;
18
+ private constructor();
19
+ /**
20
+ * Gets the singleton instance of LicenseManagerNode.
21
+ */
22
+ static get instance(): LicenseManagerNode;
23
+ /**
24
+ * Sets the default absolute URL used by the built-in license fetcher.
25
+ * MUST be called before activating with a key if not providing a custom fetcher.
26
+ * @param url The new default absolute URL for fetching license tokens.
27
+ */
28
+ static setDefaultLicenseApiUrl(url: string): void;
29
+ get hls(): boolean;
30
+ get isInitialized(): boolean;
31
+ getLicenseDetails(): DecodedLicenseToken | null;
32
+ get licenseKey(): string | null;
33
+ /**
34
+ * Configures the function used to fetch a license token from a key.
35
+ * @param fetcher A function that accepts a license key string and returns a Promise<string> (the token).
36
+ */
37
+ configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
38
+ initialize(): Promise<boolean>;
39
+ private _performInitialization;
40
+ /**
41
+ * Resets the initialization state, forcing re-initialization on the next call to initialize().
42
+ */
43
+ resetInitialization(): void;
44
+ /**
45
+ * Resets the current license state (hls, decodedToken, licenseKey).
46
+ */
47
+ resetLicenseState(): void;
48
+ /**
49
+ * Activates the license using a pre-fetched JWT token.
50
+ * Pass `null` to explicitly clear the current license state.
51
+ * @param token The JWT token string, or null to clear the license.
52
+ * @returns {Promise<ValidationResult>} The result of the validation.
53
+ */
54
+ activateWithToken(token: string | null): Promise<ValidationResult>;
55
+ /**
56
+ * Activates the license using a license key, fetching a token if necessary.
57
+ * @param licenseKey The license key string.
58
+ * @returns {Promise<ValidationResult>} The result of the validation.
59
+ */
60
+ activateWithKey(licenseKey: string): Promise<ValidationResult>;
61
+ private _getStoredLicenseData;
62
+ private _setStoredLicenseData;
63
+ private _validateAndStoreToken;
64
+ }
package/lib/node.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { QRCodeJs as _QRCodeJs } from './core/qr-code-js';
2
+ import { type ValidationResult } from './license/LicenseManagerNode';
3
+ import type * as _browserUtils from './tools/browser-utils';
4
+ import { RecursivePartial } from './types/helper';
5
+ import { Options } from './utils/options';
6
+ import { ScanValidatorResponse } from './utils/scan-validators/abstract-scan-validator';
7
+ import { type DecodedLicenseToken } from './utils/token-validator';
8
+ export { ErrorCorrectionLevel, Mode, TypeNumber } from '~/lib/qrcode/QRCodeMinimal';
9
+ export { type ExtensionFunction } from './core/qr-code-js';
10
+ export { FileExtension } from './tools/browser-utils';
11
+ export { type RecursivePartial } from './types/helper';
12
+ export { type CanvasOptions } from './utils/canvas-options';
13
+ export { GradientType, type Gradient } from './utils/gradient';
14
+ export { CornerDotType, CornerSquareType, DotType, ImageMode, ShapeType, type Options } from './utils/options';
15
+ export { ErrorCorrectionPercents } from './utils/qrcode';
16
+ export declare const browserUtils: typeof _browserUtils | undefined;
17
+ export declare class QRCodeJs extends _QRCodeJs {
18
+ static initializeIfNeeded(): Promise<boolean>;
19
+ static get hls(): boolean;
20
+ protected _hls(): boolean;
21
+ static getLicenseDetails(): DecodedLicenseToken | null;
22
+ static configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
23
+ static token(token: string | null): Promise<ValidationResult>;
24
+ static license(licenseKey: string): Promise<ValidationResult>;
25
+ /**
26
+ * Sets the absolute URL used by the built-in license fetcher.
27
+ * MUST be called before using .license('key') if not providing a custom fetcher.
28
+ * @param url The absolute URL for fetching license tokens (e.g., https://api.example.com/get-token).
29
+ */
30
+ static setLicenseUrl(url: string): typeof QRCodeJs;
31
+ constructor(options: RecursivePartial<Options>);
32
+ validateScanning(): Promise<ScanValidatorResponse>;
33
+ }
34
+ export declare class _ extends QRCodeJs {
35
+ protected _hls(): boolean;
36
+ constructor(options: RecursivePartial<Options>);
37
+ }
@@ -0,0 +1,239 @@
1
+ import { ShapeType } from './utils/options';
2
+ export declare const options2: {
3
+ shape: ShapeType;
4
+ verticalOffset: number;
5
+ isResponive: string;
6
+ margin: number;
7
+ scale: number;
8
+ data: string;
9
+ image: string;
10
+ dotsOptions: {
11
+ type: string;
12
+ color: string;
13
+ size: number;
14
+ };
15
+ backgroundOptions: {
16
+ color: string;
17
+ };
18
+ cornersDotOptions: {
19
+ type: string;
20
+ color: string;
21
+ };
22
+ cornersSquareOptions: {
23
+ type: string;
24
+ color: string;
25
+ };
26
+ imageOptions: {
27
+ crossOrigin: string;
28
+ imageSize: number;
29
+ margin: number;
30
+ };
31
+ borderOptions: {
32
+ hasBorder: boolean;
33
+ radius: string;
34
+ thickness: number;
35
+ inner: {
36
+ radius: string;
37
+ scale: number;
38
+ horizontalOffset: number;
39
+ verticalOffset: number;
40
+ };
41
+ color: string;
42
+ decorations: {
43
+ top: {
44
+ disabled: boolean;
45
+ enableText: boolean;
46
+ offset: number;
47
+ curveAdjustment: number;
48
+ curveDisabled: boolean;
49
+ curveRadius: string;
50
+ type: string;
51
+ value: string;
52
+ style: {
53
+ fontFace: string;
54
+ fontSize: number;
55
+ fontColor: string;
56
+ letterSpacing: number;
57
+ fontWeight: string;
58
+ };
59
+ };
60
+ bottom: {
61
+ disabled: boolean;
62
+ enableText: boolean;
63
+ offset: number;
64
+ curveAdjustment: number;
65
+ curveRadius: string;
66
+ curveDisabled: boolean;
67
+ type: string;
68
+ value: string;
69
+ style: {
70
+ fontFace: string;
71
+ fontSize: number;
72
+ fontColor: string;
73
+ letterSpacing: number;
74
+ fontWeight: string;
75
+ };
76
+ };
77
+ left: {
78
+ disabled: boolean;
79
+ enableText: boolean;
80
+ offset: number;
81
+ curveAdjustment: number;
82
+ curveRadius: string;
83
+ curveDisabled: boolean;
84
+ type: string;
85
+ value: string;
86
+ style: {
87
+ fontFace: string;
88
+ fontSize: number;
89
+ fontColor: string;
90
+ letterSpacing: number;
91
+ fontWeight: string;
92
+ };
93
+ };
94
+ right: {
95
+ disabled: boolean;
96
+ enableText: boolean;
97
+ offset: number;
98
+ curveAdjustment: number;
99
+ curveDisabled: boolean;
100
+ curveRadius: string;
101
+ type: string;
102
+ value: string;
103
+ style: {
104
+ fontFace: string;
105
+ fontSize: number;
106
+ fontColor: string;
107
+ letterSpacing: number;
108
+ fontWeight: string;
109
+ };
110
+ };
111
+ };
112
+ borderOuter: {
113
+ color: string;
114
+ thickness: number;
115
+ };
116
+ borderInner: {
117
+ color: string;
118
+ thickness: number;
119
+ };
120
+ };
121
+ };
122
+ export declare const options: {
123
+ name: string;
124
+ description: string;
125
+ data: string;
126
+ image: string;
127
+ margin: number;
128
+ verticalOffset: number;
129
+ scale: number;
130
+ shape: string;
131
+ qrOptions: {};
132
+ imageOptions: {
133
+ imageSize: number;
134
+ margin: number;
135
+ roundedValue: number;
136
+ };
137
+ dotsOptions: {
138
+ type: string;
139
+ color: string;
140
+ };
141
+ cornersSquareOptions: {
142
+ type: string;
143
+ color: string;
144
+ };
145
+ cornersDotOptions: {
146
+ type: string;
147
+ color: string;
148
+ };
149
+ backgroundOptions: {
150
+ color: string;
151
+ gradient: {
152
+ type: string;
153
+ colorStops: {
154
+ offset: number;
155
+ color: string;
156
+ }[];
157
+ };
158
+ };
159
+ borderOptions: {
160
+ hasBorder: boolean;
161
+ radius: string;
162
+ innerRadius: string;
163
+ thickness: number;
164
+ color: string;
165
+ isTopBorderOnly: boolean;
166
+ isBottomBorderOnly: boolean;
167
+ isTopBottomBorderOnly: boolean;
168
+ decorations: {
169
+ top: {
170
+ enableText: boolean;
171
+ verticalOffset: number;
172
+ curveAdjustment: number;
173
+ disableCurve: boolean;
174
+ type: string;
175
+ value: string;
176
+ style: {
177
+ fontFace: string;
178
+ fontSize: number;
179
+ fontColor: string;
180
+ letterSpacing: number;
181
+ fontWeight: string;
182
+ };
183
+ };
184
+ bottom: {
185
+ enableText: boolean;
186
+ verticalOffset: number;
187
+ curveAdjustment: number;
188
+ disableCurve: boolean;
189
+ type: string;
190
+ value: string;
191
+ style: {
192
+ fontFace: string;
193
+ fontSize: number;
194
+ fontColor: string;
195
+ letterSpacing: number;
196
+ fontWeight: string;
197
+ };
198
+ };
199
+ left: {
200
+ enableText: boolean;
201
+ verticalOffset: number;
202
+ curveAdjustment: number;
203
+ disableCurve: boolean;
204
+ type: string;
205
+ value: string;
206
+ style: {
207
+ fontFace: string;
208
+ fontSize: number;
209
+ fontColor: string;
210
+ letterSpacing: number;
211
+ fontWeight: string;
212
+ };
213
+ };
214
+ right: {
215
+ enableText: boolean;
216
+ verticalOffset: number;
217
+ curveAdjustment: number;
218
+ disableCurve: boolean;
219
+ type: string;
220
+ value: string;
221
+ style: {
222
+ fontFace: string;
223
+ fontSize: number;
224
+ fontColor: string;
225
+ letterSpacing: number;
226
+ fontWeight: string;
227
+ };
228
+ };
229
+ };
230
+ borderOuter: {
231
+ color: string;
232
+ thickness: number;
233
+ };
234
+ borderInner: {
235
+ color: string;
236
+ thickness: number;
237
+ };
238
+ };
239
+ };
@@ -0,0 +1,32 @@
1
+ export type Position = 'top' | 'bottom' | 'left' | 'right';
2
+ export type DecorationType = 'text' | 'image';
3
+ export declare const Positions: Record<Position, Position>;
4
+ export interface BorderOffsets {
5
+ left?: number;
6
+ right?: number;
7
+ top?: number;
8
+ bottom?: number;
9
+ }
10
+ export declare function computeBorderOffsets(thickness: number, noBorderThickness: number, enabledBorders: {
11
+ top: boolean;
12
+ right: boolean;
13
+ bottom: boolean;
14
+ left: boolean;
15
+ }): BorderOffsets;
16
+ export declare const buildTransform: (rotate: number, flip: boolean, width: number, height: number) => string;
17
+ export declare function computeTextPathOffset(position: Position, // 'top' | 'bottom' | 'left' | 'right'
18
+ thickness: number, // main border thickness
19
+ noBorderThickness: number, // fallback thickness if side is disabled
20
+ enabledBorders: {
21
+ [key in Position]: boolean;
22
+ }): {
23
+ x: number;
24
+ y: number;
25
+ };
26
+ export declare const calculatePathDimensions: (size: number, thickness: number, outerBorderPadding: number, offset: number, borderOffsets?: BorderOffsets) => {
27
+ startX: number;
28
+ startY: number;
29
+ pathWidth: number;
30
+ };
31
+ export declare const getRoundValue: (round: string | number) => number;
32
+ export declare const addProcentageToRadius: (radius: string | undefined, defaultRadius?: string | number) => string | number;
@@ -0,0 +1,35 @@
1
+ import { Gradient } from '../utils/gradient';
2
+ import { BorderOptions } from '../utils/options.js';
3
+ import { Position } from './QRBorderHelpers.js';
4
+ export interface QRBorderPluginStyleOptions {
5
+ fontFace?: string;
6
+ fontSize?: number;
7
+ fontColor?: string;
8
+ letterSpacing?: number;
9
+ fontWeight?: string;
10
+ }
11
+ interface QRPluginSettings {
12
+ width?: number;
13
+ height?: number;
14
+ document: Document;
15
+ instanceId: number;
16
+ backgroundOptions?: {
17
+ /** Background roundnes, from 0 (square) to 1 (circle) */
18
+ round?: number;
19
+ /** Background color */
20
+ color?: string;
21
+ /** Background Gradient */
22
+ gradient?: Gradient;
23
+ } | false;
24
+ }
25
+ type QRBorderPluginFn = (options: BorderOptions) => (svgElement: SVGElement, settings: QRPluginSettings, svgSize: number, drawBackgroundForBorder: (padding: number, baseRadius: number) => SVGElement | undefined, bordersMain: {
26
+ [key in Position]: number;
27
+ }, bordersOuter: {
28
+ [key in Position]: number;
29
+ }, bordersInner: {
30
+ [key in Position]: number;
31
+ }, noBorderThickness: number, hs: () => boolean) => void;
32
+ export declare const isBorderSideEnabled: (options: BorderOptions, position: Position) => boolean;
33
+ export declare const isBorderSideEnabledBottom: (options: BorderOptions, position: Position, _hls: boolean) => boolean;
34
+ declare const QRBorderPlugin: QRBorderPluginFn;
35
+ export { QRBorderPlugin };
@@ -0,0 +1,38 @@
1
+ export default QRValidatorZbar;
2
+ declare class QRValidatorZbar {
3
+ constructor(options?: {});
4
+ canvas: HTMLCanvasElement;
5
+ context: CanvasRenderingContext2D | null;
6
+ maxRetries: any;
7
+ retryInterval: any;
8
+ /**
9
+ * Validate and decode a QR code from an image
10
+ * @param {HTMLImageElement|File|Blob|String} input - Input image (can be an image element, file, blob or data URL)
11
+ * @returns {Promise<Object>} - Validation results with decoded data if successful
12
+ */
13
+ validate(input: HTMLImageElement | File | Blob | string, width: any, height: any): Promise<Object>;
14
+ /**
15
+ * Load image from various sources
16
+ * @param {HTMLImageElement|File|Blob|String} input - Input image
17
+ * @returns {Promise<HTMLImageElement>} - Loaded image
18
+ */
19
+ loadImage(input: HTMLImageElement | File | Blob | string): Promise<HTMLImageElement>;
20
+ /**
21
+ * Sleep function to wait between retry attempts
22
+ * @param {number} ms - Milliseconds to wait
23
+ * @returns {Promise<void>}
24
+ */
25
+ sleep(ms: number): Promise<void>;
26
+ /**
27
+ * Decode QR code with automatic retry
28
+ * @param {ImageData} imageData - Raw image data
29
+ * @returns {Promise<Object>} - Validation result after retries
30
+ */
31
+ decodeQRWithRetry(imageData: ImageData): Promise<Object>;
32
+ /**
33
+ * Decode QR code from image data using zbar-wasm
34
+ * @param {ImageData} imageData - Raw image data
35
+ * @returns {Promise<Object>} - Validation result
36
+ */
37
+ decodeQR(imageData: ImageData): Promise<Object>;
38
+ }
@@ -0,0 +1,60 @@
1
+ /**
2
+ * QRValidatorZbar Validation Library for Node.js
3
+ *
4
+ * This server-side class uses zbar-wasm to decode QR codes and other barcodes,
5
+ * with Jimp (and Resvg for SVG conversion) for image processing.
6
+ */
7
+ interface QRValidatorOptions {
8
+ /** Maximum number of retry attempts */
9
+ maxRetries?: number;
10
+ /** Time to wait between retries in milliseconds */
11
+ retryInterval?: number;
12
+ /** Enable debug logging */
13
+ debug?: boolean;
14
+ }
15
+ interface QRValidationResult {
16
+ /** Whether the validation was successful */
17
+ isValid: boolean;
18
+ /** Decoded data from the QR code (if successful) */
19
+ data?: string;
20
+ /** Format of the detected barcode */
21
+ format?: string;
22
+ /** Number of retry attempts made */
23
+ attempts?: number;
24
+ /** Whether the successful decode came from an inverted image */
25
+ isInverted?: boolean;
26
+ /** Error message if validation failed */
27
+ error?: string;
28
+ /** Error code if validation failed */
29
+ errorCode?: string;
30
+ }
31
+ declare class QRValidatorZbarNode {
32
+ private maxRetries;
33
+ private retryInterval;
34
+ private debug;
35
+ constructor(options?: QRValidatorOptions);
36
+ private log;
37
+ /**
38
+ * Validate and decode a QR code from an SVG string (or file path)
39
+ */
40
+ validate(input: string, isInverted?: boolean): Promise<QRValidationResult>;
41
+ private sleep;
42
+ /**
43
+ * Process image using Sharp and get raw pixel data
44
+ * @param input Input image
45
+ * @param width Optional width for resizing
46
+ * @param height Optional height for resizing
47
+ * @returns Processed image data compatible with zbar-wasm
48
+ */
49
+ private processImageResvg;
50
+ private validateWithRetry;
51
+ /**
52
+ * Save a debug image using Jimp. The raw image data is used to reconstruct an image.
53
+ */
54
+ private saveDebugImage;
55
+ /**
56
+ * Decode the QR code from image data using zbar-wasm.
57
+ */
58
+ private decodeQR;
59
+ }
60
+ export default QRValidatorZbarNode;
@@ -0,0 +1,83 @@
1
+ interface QRValidatorOptions {
2
+ /** Maximum number of retry attempts */
3
+ maxRetries?: number;
4
+ /** Time to wait between retries in milliseconds */
5
+ retryInterval?: number;
6
+ /** Enable debug logging */
7
+ debug?: boolean;
8
+ }
9
+ interface QRValidationResult {
10
+ /** Whether the validation was successful */
11
+ isValid: boolean;
12
+ /** Decoded data from the QR code (if successful) */
13
+ data?: string;
14
+ /** Format of the detected barcode */
15
+ format?: string;
16
+ /** Number of retry attempts made */
17
+ attempts?: number;
18
+ /** Whether the successful decode came from an inverted image */
19
+ isInverted?: boolean;
20
+ /** Error message if validation failed */
21
+ error?: string;
22
+ /** Error code if validation failed */
23
+ errorCode?: string;
24
+ }
25
+ declare class QRValidatorZbarNode {
26
+ private maxRetries;
27
+ private retryInterval;
28
+ private debug;
29
+ /**
30
+ * Create a new QR code validator instance
31
+ * @param options Configuration options
32
+ */
33
+ constructor(options?: QRValidatorOptions);
34
+ /**
35
+ * Debug logging
36
+ * @param message Message to log
37
+ */
38
+ private log;
39
+ /**
40
+ * Validate and decode a QR code from an SVG string or buffer
41
+ * @param input Input image (can be an SVG string, buffer, or file path)
42
+ * @param width Optional width for resizing
43
+ * @param height Optional height for resizing
44
+ * @returns Validation results with decoded data if successful
45
+ */
46
+ validate(input: string | Buffer, isInverted?: boolean, width?: number | null, height?: number | null): Promise<QRValidationResult>;
47
+ /**
48
+ * Sleep function to wait between retry attempts
49
+ * @param ms Milliseconds to wait
50
+ * @returns Promise that resolves after the specified time
51
+ */
52
+ private sleep;
53
+ /**
54
+ * Process image using Sharp and get raw pixel data
55
+ * @param input Input image
56
+ * @param width Optional width for resizing
57
+ * @param height Optional height for resizing
58
+ * @returns Processed image data compatible with zbar-wasm
59
+ */
60
+ private processImage;
61
+ /**
62
+ * Validate with automatic retry
63
+ * @param input Input image
64
+ * @param getInvertedSvg Function to get inverted SVG for retry
65
+ * @param width Optional width for resizing
66
+ * @param height Optional height for resizing
67
+ * @returns Validation result after retries
68
+ */
69
+ private validateWithRetry;
70
+ /**
71
+ * Save a debug image from raw image data
72
+ * @param imageData Raw image data
73
+ * @param prefix Prefix for the filename
74
+ */
75
+ private saveDebugImage;
76
+ /**
77
+ * Decode QR code from image data using zbar-wasm
78
+ * @param imageData Raw image data in format compatible with zbar-wasm
79
+ * @returns Validation result
80
+ */
81
+ private decodeQR;
82
+ }
83
+ export default QRValidatorZbarNode;