@qr-platform/qr-code.js 0.8.24 → 0.9.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.
- package/CHANGELOG.md +6 -0
- package/docs/advanced-examples.md +84 -0
- package/docs/api-reference-guide.md +38 -0
- package/docs/documentation.md +182 -0
- package/docs/examples.md +145 -27
- package/docs/template-update-plan.md +53 -0
- package/docs/usage-guide.md +47 -0
- package/lib/chunks/scan-validator-node-BGUxkBJt.js +1 -0
- package/lib/chunks/scan-validator-zxing-node-CV9K2v4n.js +1 -0
- package/lib/core/qr-code-js.d.ts +10 -1
- package/lib/core/qr-styles.d.ts +4 -0
- package/lib/index.d.ts +34 -7
- package/lib/index.js +1 -1
- package/lib/node/core/qr-code-js.d.ts +61 -0
- package/lib/node/core/qr-constant.d.ts +9 -0
- package/lib/node/core/qr-options-validation.d.ts +13 -0
- package/lib/node/core/qr-styles.d.ts +4 -0
- package/lib/node/core/qr-svg.d.ts +76 -0
- package/lib/node/core/qr-templates.d.ts +10 -0
- package/lib/node/figures/corner-dot.d.ts +24 -0
- package/lib/node/figures/corner-square.d.ts +24 -0
- package/lib/node/figures/dot.d.ts +31 -0
- package/lib/node/index.d.ts +101 -0
- package/lib/node/lib/image/GIFImage.d.ts +19 -0
- package/lib/node/lib/io/Base64.d.ts +10 -0
- package/lib/node/lib/io/Base64DecodeInputStream.d.ts +15 -0
- package/lib/node/lib/io/Base64EncodeOutputStream.d.ts +17 -0
- package/lib/node/lib/io/ByteArrayInputStream.d.ts +12 -0
- package/lib/node/lib/io/ByteArrayOutputStream.d.ts +12 -0
- package/lib/node/lib/io/InputStream.d.ts +10 -0
- package/lib/node/lib/io/OutputStream.d.ts +12 -0
- package/lib/node/lib/qr-code.d.ts +5 -0
- package/lib/node/lib/qrcode/BitBuffer.d.ts +11 -0
- package/lib/node/lib/qrcode/ErrorCorrectLevel.d.ts +23 -0
- package/lib/node/lib/qrcode/MaskPattern.d.ts +39 -0
- package/lib/node/lib/qrcode/Mode.d.ts +23 -0
- package/lib/node/lib/qrcode/Polynomial.d.ts +15 -0
- package/lib/node/lib/qrcode/QR8BitByte.d.ts +13 -0
- package/lib/node/lib/qrcode/QRAlphaNum.d.ts +13 -0
- package/lib/node/lib/qrcode/QRCode.d.ts +22 -0
- package/lib/node/lib/qrcode/QRCodeMinimal.d.ts +58 -0
- package/lib/node/lib/qrcode/QRData.d.ts +17 -0
- package/lib/node/lib/qrcode/QRKanji.d.ts +13 -0
- package/lib/node/lib/qrcode/QRMath.d.ts +13 -0
- package/lib/node/lib/qrcode/QRNumber.d.ts +14 -0
- package/lib/node/lib/qrcode/QRUtil.d.ts +25 -0
- package/lib/node/lib/qrcode/RSBlock.d.ts +16 -0
- package/lib/node/lib/text/createStringToBytes.d.ts +9 -0
- package/lib/node/lib/text/stringToBytes_SJIS.d.ts +8 -0
- package/lib/node/lib/text/stringToBytes_UTF8.d.ts +7 -0
- package/lib/node/lib/zbar-wasm/index.d.ts +1 -0
- package/lib/node/lib/zxing-js/src/browser/BrowserCodeReader.d.ts +150 -0
- package/lib/node/lib/zxing-js/src/browser/BrowserQRCodeReader.d.ts +29 -0
- package/lib/node/lib/zxing-js/src/browser/HTMLCanvasElementLuminanceSource.d.ts +27 -0
- package/lib/node/lib/zxing-js/src/browser/HTMLVisualMediaElement.d.ts +4 -0
- package/lib/node/lib/zxing-js/src/browser.d.ts +3 -0
- package/lib/node/lib/zxing-js/src/core/ArgumentException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/ArithmeticException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/ArrayIndexOutOfBoundsException.d.ts +10 -0
- package/lib/node/lib/zxing-js/src/core/BarcodeFormat.d.ts +42 -0
- package/lib/node/lib/zxing-js/src/core/Binarizer.d.ts +53 -0
- package/lib/node/lib/zxing-js/src/core/BinaryBitmap.d.ts +78 -0
- package/lib/node/lib/zxing-js/src/core/ChecksumException.d.ts +8 -0
- package/lib/node/lib/zxing-js/src/core/DecodeHintType.d.ts +91 -0
- package/lib/node/lib/zxing-js/src/core/Exception.d.ts +17 -0
- package/lib/node/lib/zxing-js/src/core/FormatException.d.ts +8 -0
- package/lib/node/lib/zxing-js/src/core/HighContrastLuminanceSource.d.ts +27 -0
- package/lib/node/lib/zxing-js/src/core/IllegalArgumentException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/IllegalStateException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/IndexOutOfBoundsException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/InvertedLuminanceSource.d.ts +22 -0
- package/lib/node/lib/zxing-js/src/core/LuminanceSource.d.ts +84 -0
- package/lib/node/lib/zxing-js/src/core/NodeLuminanceSource.d.ts +33 -0
- package/lib/node/lib/zxing-js/src/core/NotFoundException.d.ts +8 -0
- package/lib/node/lib/zxing-js/src/core/NullPointerException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/OutOfMemoryError.d.ts +6 -0
- package/lib/node/lib/zxing-js/src/core/Reader.d.ts +49 -0
- package/lib/node/lib/zxing-js/src/core/ReaderException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/ReedSolomonException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/Result.d.ts +52 -0
- package/lib/node/lib/zxing-js/src/core/ResultMetadataType.d.ts +68 -0
- package/lib/node/lib/zxing-js/src/core/ResultPoint.d.ts +34 -0
- package/lib/node/lib/zxing-js/src/core/ResultPointCallback.d.ts +11 -0
- package/lib/node/lib/zxing-js/src/core/UniversalLuminanceSource.d.ts +46 -0
- package/lib/node/lib/zxing-js/src/core/UnsupportedOperationException.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/common/BitArray.d.ts +111 -0
- package/lib/node/lib/zxing-js/src/core/common/BitMatrix.d.ts +98 -0
- package/lib/node/lib/zxing-js/src/core/common/BitSource.d.ts +38 -0
- package/lib/node/lib/zxing-js/src/core/common/CharacterSetECI.d.ts +89 -0
- package/lib/node/lib/zxing-js/src/core/common/DecoderResult.d.ts +64 -0
- package/lib/node/lib/zxing-js/src/core/common/DefaultGridSampler.d.ts +10 -0
- package/lib/node/lib/zxing-js/src/core/common/DetectorResult.d.ts +16 -0
- package/lib/node/lib/zxing-js/src/core/common/GlobalHistogramBinarizer.d.ts +29 -0
- package/lib/node/lib/zxing-js/src/core/common/GridSampler.d.ts +36 -0
- package/lib/node/lib/zxing-js/src/core/common/GridSamplerInstance.d.ts +18 -0
- package/lib/node/lib/zxing-js/src/core/common/HybridBinarizer.d.ts +54 -0
- package/lib/node/lib/zxing-js/src/core/common/PerspectiveTransform.d.ts +26 -0
- package/lib/node/lib/zxing-js/src/core/common/StringUtils.d.ts +48 -0
- package/lib/node/lib/zxing-js/src/core/common/detector/MathUtils.d.ts +36 -0
- package/lib/node/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGF.d.ts +34 -0
- package/lib/node/lib/zxing-js/src/core/common/reedsolomon/GenericGF.d.ts +58 -0
- package/lib/node/lib/zxing-js/src/core/common/reedsolomon/GenericGFPoly.d.ts +47 -0
- package/lib/node/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonDecoder.d.ts +40 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/QRCodeReader.d.ts +35 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/BitMatrixParser.d.ts +58 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/DataBlock.d.ts +28 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/DataMask.d.ts +36 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/DecodedBitStreamParser.d.ts +30 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/Decoder.d.ts +44 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/ECB.d.ts +12 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/ECBlocks.d.ts +16 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/ErrorCorrectionLevel.d.ts +38 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/FormatInformation.d.ts +33 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/Mode.d.ts +56 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/QRCodeDecoderMetaData.d.ts +21 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/decoder/Version.d.ts +44 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/detector/AlignmentPattern.d.ts +21 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/detector/AlignmentPatternFinder.d.ts +82 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/detector/Detector.d.ts +87 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/detector/FinderPattern.d.ts +26 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/detector/FinderPatternFinder.d.ts +114 -0
- package/lib/node/lib/zxing-js/src/core/qrcode/detector/FinderPatternInfo.d.ts +16 -0
- package/lib/node/lib/zxing-js/src/core/util/Arrays.d.ts +45 -0
- package/lib/node/lib/zxing-js/src/core/util/Charset.d.ts +7 -0
- package/lib/node/lib/zxing-js/src/core/util/Float.d.ts +14 -0
- package/lib/node/lib/zxing-js/src/core/util/Integer.d.ts +19 -0
- package/lib/node/lib/zxing-js/src/core/util/StringBuilder.d.ts +21 -0
- package/lib/node/lib/zxing-js/src/core/util/StringEncoding.d.ts +51 -0
- package/lib/node/lib/zxing-js/src/core/util/System.d.ts +10 -0
- package/lib/node/lib/zxing-js/src/customTypings.d.ts +16 -0
- package/lib/node/lib/zxing-js/src/index.d.ts +5 -0
- package/lib/node/lib/zxing-js/src/node.d.ts +1 -0
- package/lib/node/license/LicenseManager.d.ts +69 -0
- package/lib/node/license/LicenseManagerNode.d.ts +64 -0
- package/lib/node/node.d.ts +88 -0
- package/lib/node/options-demo.d.ts +239 -0
- package/lib/node/plugins/QRBorderHelpers.d.ts +32 -0
- package/lib/node/plugins/QRBorderPlugin.d.ts +35 -0
- package/lib/node/plugins/QRValidatorZbar.d.ts +38 -0
- package/lib/node/plugins/QRValidatorZbarNode.d.ts +60 -0
- package/lib/node/plugins/QRValidatorZbarNodeSharp.d.ts +83 -0
- package/lib/node/templates/borders-inner-outter.d.ts +129 -0
- package/lib/node/templates/borders-inner-scale-offset.d.ts +497 -0
- package/lib/node/templates/borders-inner.d.ts +129 -0
- package/lib/node/templates/borders-no-license.d.ts +129 -0
- package/lib/node/templates/borders-outter.d.ts +129 -0
- package/lib/node/templates/borders-text-auto-curved.d.ts +129 -0
- package/lib/node/templates/borders-text-full-curved.d.ts +133 -0
- package/lib/node/templates/borders.d.ts +129 -0
- package/lib/node/templates/scales.d.ts +130 -0
- package/lib/node/templates/scan-validators/index.d.ts +1 -0
- package/lib/node/templates/scan-validators/tests/cases/basic-inverted.d.ts +9 -0
- package/lib/node/templates/scan-validators/tests/cases/basic-no-license.d.ts +3 -0
- package/lib/node/templates/scan-validators/tests/cases/basic.d.ts +3 -0
- package/lib/node/templates/scan-validators/tests/cases/colors-inverted.d.ts +2 -0
- package/lib/node/templates/scan-validators/tests/cases/colors.d.ts +58 -0
- package/lib/node/templates/scan-validators/tests/cases/out-of-borders-inverted.d.ts +9 -0
- package/lib/node/templates/scan-validators/tests/cases/out-of-borders.d.ts +9 -0
- package/lib/node/templates/scan-validators/tests/cases/position-inverted.d.ts +9 -0
- package/lib/node/templates/scan-validators/tests/cases/position.d.ts +3 -0
- package/lib/node/templates/scan-validators/tests/index.d.ts +27 -0
- package/lib/node/tools/browser-image-tools.d.ts +7 -0
- package/lib/node/tools/browser-utils.d.ts +18 -0
- package/lib/node/types/helper.d.ts +23 -0
- package/lib/node/types/style-options.d.ts +37 -0
- package/lib/node/utils/canvas-options.d.ts +7 -0
- package/lib/node/utils/color.d.ts +4 -0
- package/lib/node/utils/gradient.d.ts +26 -0
- package/lib/node/utils/image.d.ts +16 -0
- package/lib/node/utils/merge.d.ts +5 -0
- package/lib/node/utils/options.d.ts +220 -0
- package/lib/node/utils/qrcode.d.ts +8 -0
- package/lib/node/utils/scan-validator-node.d.ts +15 -0
- package/lib/node/utils/scan-validator-zxing-node.d.ts +18 -0
- package/lib/node/utils/scan-validators/abstract-scan-validator.d.ts +43 -0
- package/lib/node/utils/scan-validators/zbar-scan-validator.d.ts +8 -0
- package/lib/node/utils/scan-validators/zxing-canvas-scan-validator.d.ts +10 -0
- package/lib/node/utils/scan-validators/zxing-scan-validator.d.ts +8 -0
- package/lib/node/utils/style-mapper.d.ts +13 -0
- package/lib/node/utils/svg.d.ts +2 -0
- package/lib/node/utils/token-validator.d.ts +19 -0
- package/lib/node.d.ts +38 -10
- package/lib/node.js +1 -1
- package/lib/types/style-options.d.ts +37 -0
- package/lib/utils/style-mapper.d.ts +13 -0
- package/package.json +1 -1
@@ -0,0 +1,220 @@
|
|
1
|
+
import { Position } from '~/plugins/QRBorderHelpers';
|
2
|
+
import { ErrorCorrectionLevel, Mode, TypeNumber } from '~/lib/qrcode/QRCodeMinimal';
|
3
|
+
import { QRBorderPluginStyleOptions } from '../plugins/QRBorderPlugin';
|
4
|
+
import { browserImageTools } from '../tools/browser-image-tools';
|
5
|
+
import { Gradient } from './gradient';
|
6
|
+
export interface DecorationOption {
|
7
|
+
disabled?: boolean;
|
8
|
+
offset?: number;
|
9
|
+
curveAdjustment?: number;
|
10
|
+
curveDisabled?: boolean;
|
11
|
+
curveRadius?: string;
|
12
|
+
enableText?: boolean;
|
13
|
+
type: 'text' | 'image';
|
14
|
+
value: string;
|
15
|
+
style?: QRBorderPluginStyleOptions;
|
16
|
+
}
|
17
|
+
export interface BorderOptions {
|
18
|
+
hasBorder: boolean;
|
19
|
+
radius?: string;
|
20
|
+
inner?: {
|
21
|
+
radius?: string;
|
22
|
+
scale?: number;
|
23
|
+
horizontalOffset?: number;
|
24
|
+
verticalOffset?: number;
|
25
|
+
};
|
26
|
+
innerScale?: number;
|
27
|
+
innerHorizontalOffset?: number;
|
28
|
+
innerVerticalOffset?: number;
|
29
|
+
thickness: number;
|
30
|
+
noBorderThickness?: number;
|
31
|
+
color: string;
|
32
|
+
background?: string;
|
33
|
+
decorations?: {
|
34
|
+
[key in Position]?: DecorationOption;
|
35
|
+
};
|
36
|
+
borderOuter?: {
|
37
|
+
color: string;
|
38
|
+
thickness: number;
|
39
|
+
};
|
40
|
+
borderInner?: {
|
41
|
+
color: string;
|
42
|
+
thickness: number;
|
43
|
+
};
|
44
|
+
}
|
45
|
+
export declare enum DotType {
|
46
|
+
dot = "dot",
|
47
|
+
randomDot = "random-dot",
|
48
|
+
rounded = "rounded",
|
49
|
+
extraRounded = "extra-rounded",
|
50
|
+
verticalLine = "vertical-line",
|
51
|
+
horizontalLine = "horizontal-line",
|
52
|
+
classy = "classy",
|
53
|
+
classyRounded = "classy-rounded",
|
54
|
+
square = "square",
|
55
|
+
smallSquare = "small-square",
|
56
|
+
tinySquare = "tiny-square",
|
57
|
+
star = "star",
|
58
|
+
plus = "plus",
|
59
|
+
diamond = "diamond"
|
60
|
+
}
|
61
|
+
export declare enum CornerDotType {
|
62
|
+
dot = "dot",
|
63
|
+
square = "square",
|
64
|
+
heart = "heart",
|
65
|
+
rounded = "rounded",
|
66
|
+
classy = "classy",
|
67
|
+
outpoint = "outpoint",
|
68
|
+
inpoint = "inpoint"
|
69
|
+
}
|
70
|
+
export declare enum CornerSquareType {
|
71
|
+
dot = "dot",
|
72
|
+
square = "square",
|
73
|
+
rounded = "rounded",
|
74
|
+
classy = "classy",
|
75
|
+
outpoint = "outpoint",
|
76
|
+
inpoint = "inpoint"
|
77
|
+
}
|
78
|
+
export declare enum ShapeType {
|
79
|
+
square = "square",
|
80
|
+
circle = "circle"
|
81
|
+
}
|
82
|
+
export declare enum ImageMode {
|
83
|
+
/**
|
84
|
+
* Place image in the center of the code
|
85
|
+
*/
|
86
|
+
center = "center",
|
87
|
+
/**
|
88
|
+
* Place image over the center of the code
|
89
|
+
*/
|
90
|
+
overlay = "overlay",
|
91
|
+
/**
|
92
|
+
* Use image as background, draw dots over it
|
93
|
+
*/
|
94
|
+
background = "background"
|
95
|
+
}
|
96
|
+
export interface Options {
|
97
|
+
/** Use a custom DOM domplementation */
|
98
|
+
document: Document;
|
99
|
+
instanceId: number;
|
100
|
+
/** Use a custom image fetching & serializaton implementation */
|
101
|
+
imageTools?: typeof browserImageTools;
|
102
|
+
/** @ignore */
|
103
|
+
width?: number;
|
104
|
+
/** @ignore */
|
105
|
+
height?: number;
|
106
|
+
isResponsive?: boolean;
|
107
|
+
margin?: number;
|
108
|
+
verticalOffset?: number;
|
109
|
+
horizontalOffset?: number;
|
110
|
+
/** The data will be encoded in the QR code */
|
111
|
+
data: string;
|
112
|
+
/** The image will be copied to the center of the QR code */
|
113
|
+
image?: string | Buffer | Blob;
|
114
|
+
/**
|
115
|
+
* QR code shape
|
116
|
+
*
|
117
|
+
* @default ShapeType.square
|
118
|
+
*/
|
119
|
+
shape: ShapeType;
|
120
|
+
/** Options will be passed to `~` lib */
|
121
|
+
scale?: number;
|
122
|
+
offset?: number;
|
123
|
+
qrOptions: {
|
124
|
+
typeNumber: TypeNumber;
|
125
|
+
mode?: Mode;
|
126
|
+
/** @default ErrorCorrectionLevel.Q */
|
127
|
+
errorCorrectionLevel: ErrorCorrectionLevel;
|
128
|
+
};
|
129
|
+
imageOptions: {
|
130
|
+
/**
|
131
|
+
* Image mode
|
132
|
+
*
|
133
|
+
* @default ImageMode.center
|
134
|
+
*/
|
135
|
+
mode?: ImageMode;
|
136
|
+
/**
|
137
|
+
* Fill blank areas of the code with selected color
|
138
|
+
*/
|
139
|
+
fill?: {
|
140
|
+
/**
|
141
|
+
* Color of QR dots
|
142
|
+
*
|
143
|
+
* @default "rgba(255,255,255,0.75)"
|
144
|
+
*/
|
145
|
+
color: string;
|
146
|
+
/** Gradient of Corners Dot */
|
147
|
+
gradient?: Gradient;
|
148
|
+
};
|
149
|
+
/**
|
150
|
+
* Coefficient of the image size
|
151
|
+
*
|
152
|
+
* @default 0.4
|
153
|
+
*/
|
154
|
+
imageSize: number;
|
155
|
+
/**
|
156
|
+
* Margin of the image (in blocks)
|
157
|
+
*
|
158
|
+
* @default 0
|
159
|
+
*/
|
160
|
+
margin: number;
|
161
|
+
/**
|
162
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLImageElement/crossOrigin)
|
163
|
+
*/
|
164
|
+
crossOrigin?: string;
|
165
|
+
};
|
166
|
+
dotsOptions: {
|
167
|
+
/**
|
168
|
+
* QR dot size (in pixels)
|
169
|
+
*
|
170
|
+
* @default 10
|
171
|
+
*/
|
172
|
+
size: number;
|
173
|
+
/**
|
174
|
+
* Color of QR dots
|
175
|
+
*
|
176
|
+
* @default "#000"
|
177
|
+
*/
|
178
|
+
color: string;
|
179
|
+
/** Gradient of QR dots */
|
180
|
+
gradient?: Gradient;
|
181
|
+
/**
|
182
|
+
* Style of QR dots
|
183
|
+
*
|
184
|
+
* @default DotType.square
|
185
|
+
*/
|
186
|
+
type: DotType;
|
187
|
+
};
|
188
|
+
/** Corners Square options, omitted values match dots */
|
189
|
+
cornersSquareOptions?: {
|
190
|
+
/** Color of Corners Square */
|
191
|
+
color?: string;
|
192
|
+
/** Gradient of Corners Square */
|
193
|
+
gradient?: Gradient;
|
194
|
+
/** Style of Corners Square */
|
195
|
+
type?: CornerSquareType;
|
196
|
+
};
|
197
|
+
/** Corners Dot options, omitted values match squares */
|
198
|
+
cornersDotOptions?: {
|
199
|
+
/** Color of Corners Dot */
|
200
|
+
color?: string;
|
201
|
+
/** Gradient of Corners Dot */
|
202
|
+
gradient?: Gradient;
|
203
|
+
/** Style of Corners Dot */
|
204
|
+
type?: CornerDotType;
|
205
|
+
};
|
206
|
+
/** QR background styling options, false to disable background */
|
207
|
+
backgroundOptions?: {
|
208
|
+
/** Background roundnes, from 0 (square) to 1 (circle) */
|
209
|
+
round?: number;
|
210
|
+
/** Background color */
|
211
|
+
color?: string;
|
212
|
+
/** Background Gradient */
|
213
|
+
gradient?: Gradient;
|
214
|
+
} | false;
|
215
|
+
stringToBytesFuncs?: {
|
216
|
+
[encoding: string]: (s: string) => number[];
|
217
|
+
};
|
218
|
+
borderOptions?: BorderOptions;
|
219
|
+
}
|
220
|
+
export declare function sanitizeOptions(options: Options): Options;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { ScanValidatorResponse } from './scan-validators/abstract-scan-validator';
|
2
|
+
/**
|
3
|
+
* QR Code validator for Node.js environment
|
4
|
+
*/
|
5
|
+
export declare const qrValidator: {
|
6
|
+
/**
|
7
|
+
* Validate QR code using zbar with SVG as input
|
8
|
+
* @param svgSource SVG string containing QR code
|
9
|
+
* @param width Width to use for validation
|
10
|
+
* @param height Height to use for validation
|
11
|
+
* @param debug Enable detailed debugging
|
12
|
+
* @returns Validation result
|
13
|
+
*/
|
14
|
+
validateZbar: (svgSource: string | undefined, debug?: boolean) => Promise<ScanValidatorResponse>;
|
15
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { BinaryBitmap } from '~/lib/zxing-js/src';
|
2
|
+
import { NodeLuminanceSource } from '~/lib/zxing-js/src/node';
|
3
|
+
import { ScanValidatorResponse } from './scan-validators/abstract-scan-validator';
|
4
|
+
export interface PreprocessingOptions {
|
5
|
+
lower?: number;
|
6
|
+
upper?: number;
|
7
|
+
gamma?: number;
|
8
|
+
threshold?: number;
|
9
|
+
}
|
10
|
+
/**
|
11
|
+
* Main QR Validator: attempts to decode the QR code from an SVG string.
|
12
|
+
* It tries the normal decode first, then with inverted luminance.
|
13
|
+
* (Alternative preprocessing attempt removed as it was identical to the first).
|
14
|
+
*/
|
15
|
+
export declare const qrValidatorZxing: {
|
16
|
+
validateZxing: (svgString: string | undefined) => Promise<ScanValidatorResponse>;
|
17
|
+
};
|
18
|
+
export type { NodeLuminanceSource, BinaryBitmap, ScanValidatorResponse };
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { BrowserQRCodeReader } from '~/lib/zxing-js/src';
|
2
|
+
import QRCodeReader from '~/lib/zxing-js/src/core/qrcode/QRCodeReader';
|
3
|
+
import QRValidatorZbar from '../../plugins/QRValidatorZbar';
|
4
|
+
export interface ScanValidatorResponse {
|
5
|
+
/**
|
6
|
+
* Whether QR code was successfully validated
|
7
|
+
*/
|
8
|
+
isValid: boolean;
|
9
|
+
/**
|
10
|
+
* Decoded data from the QR code
|
11
|
+
*/
|
12
|
+
decodedText?: string | null;
|
13
|
+
/**
|
14
|
+
* Whether the successful decode was from an inverted image
|
15
|
+
*/
|
16
|
+
isInverted?: boolean;
|
17
|
+
/**
|
18
|
+
* Additional message about the validation result
|
19
|
+
*/
|
20
|
+
message?: string;
|
21
|
+
/**
|
22
|
+
* Number of attempts made during validation
|
23
|
+
*/
|
24
|
+
attempts?: number;
|
25
|
+
/**
|
26
|
+
* Error code if validation failed
|
27
|
+
*/
|
28
|
+
errorCode?: string;
|
29
|
+
}
|
30
|
+
declare class AbstractScanValidator {
|
31
|
+
debug: boolean;
|
32
|
+
validatorName: string;
|
33
|
+
log(message: any): void;
|
34
|
+
}
|
35
|
+
export default AbstractScanValidator;
|
36
|
+
export interface ScanValidator {
|
37
|
+
validator: QRValidatorZbar | QRCodeReader | BrowserQRCodeReader;
|
38
|
+
validate(...args: any): Promise<ScanValidatorResponse>;
|
39
|
+
}
|
40
|
+
export interface DecodeAttempt {
|
41
|
+
name: string;
|
42
|
+
execute(): Promise<ScanValidatorResponse>;
|
43
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import QRValidatorZbar from '../../plugins/QRValidatorZbar';
|
2
|
+
import AbstractScanValidator, { ScanValidator, ScanValidatorResponse } from './abstract-scan-validator';
|
3
|
+
declare class ZBarScanValidator extends AbstractScanValidator implements ScanValidator {
|
4
|
+
validator: QRValidatorZbar;
|
5
|
+
constructor(debug?: boolean);
|
6
|
+
validate(svgSource: string | undefined, getSvgInverted: () => Promise<string | undefined>, width: number, height: number, debug?: boolean): Promise<ScanValidatorResponse>;
|
7
|
+
}
|
8
|
+
export default ZBarScanValidator;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { LuminanceSource } from '~/lib/zxing-js/src';
|
2
|
+
import QRCodeReader from '~/lib/zxing-js/src/core/qrcode/QRCodeReader';
|
3
|
+
import AbstractScanValidator, { ScanValidator, ScanValidatorResponse } from './abstract-scan-validator';
|
4
|
+
declare class ZXingCanvasScanValidator extends AbstractScanValidator implements ScanValidator {
|
5
|
+
validator: QRCodeReader;
|
6
|
+
constructor(debug?: boolean);
|
7
|
+
displayLuminanceSource(source: LuminanceSource, label: string): void;
|
8
|
+
validate(canvas: HTMLCanvasElement, debug?: boolean): Promise<ScanValidatorResponse>;
|
9
|
+
}
|
10
|
+
export default ZXingCanvasScanValidator;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { BrowserQRCodeReader } from '~/lib/zxing-js/src';
|
2
|
+
import AbstractScanValidator, { ScanValidator, ScanValidatorResponse } from './abstract-scan-validator';
|
3
|
+
declare class ZXingScanValidator extends AbstractScanValidator implements ScanValidator {
|
4
|
+
validator: BrowserQRCodeReader;
|
5
|
+
constructor(debug?: boolean);
|
6
|
+
validate(svgSource: string | undefined, getSvgInverted: () => Promise<string | undefined>, debug?: boolean): Promise<ScanValidatorResponse>;
|
7
|
+
}
|
8
|
+
export default ZXingScanValidator;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { RecursivePartial } from '../types/helper';
|
2
|
+
import { StyleOptions } from '../types/style-options';
|
3
|
+
import { Options } from './options';
|
4
|
+
/**
|
5
|
+
* Maps simplified StyleOptions to the detailed QRCodeJs Options structure.
|
6
|
+
* @param styles - The StyleOptions object to map.
|
7
|
+
* @returns A RecursivePartial<Options> object reflecting the styles.
|
8
|
+
*/
|
9
|
+
export declare function mapStyleToOptions(styles: StyleOptions): RecursivePartial<Options>;
|
10
|
+
export declare function validateStyleOptions(styles: any): {
|
11
|
+
isValid: boolean;
|
12
|
+
errors: string[];
|
13
|
+
};
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Represents the decoded payload of a valid license token.
|
3
|
+
*/
|
4
|
+
export interface DecodedLicenseToken {
|
5
|
+
sub: string;
|
6
|
+
client: string;
|
7
|
+
email?: string;
|
8
|
+
domains?: string[];
|
9
|
+
iat: number;
|
10
|
+
exp: number;
|
11
|
+
}
|
12
|
+
/**
|
13
|
+
* Validates a JWT access token using the public key.
|
14
|
+
*
|
15
|
+
* @param token The JWT token string to validate.
|
16
|
+
* @returns The decoded token payload if the token is valid and not expired.
|
17
|
+
* @throws {Error} If the token is invalid, expired, or verification fails for any other reason.
|
18
|
+
*/
|
19
|
+
export declare function validateToken(token: string): Promise<DecodedLicenseToken>;
|
package/lib/node.d.ts
CHANGED
@@ -2,6 +2,7 @@ import { QRCodeJs as _QRCodeJs } from './core/qr-code-js';
|
|
2
2
|
import { type ValidationResult } from './license/LicenseManagerNode';
|
3
3
|
import type * as _browserUtils from './tools/browser-utils';
|
4
4
|
import { RecursivePartial } from './types/helper';
|
5
|
+
import { StyleOptions } from './types/style-options';
|
5
6
|
import { Options } from './utils/options';
|
6
7
|
import { ScanValidatorResponse } from './utils/scan-validators/abstract-scan-validator';
|
7
8
|
import { type DecodedLicenseToken } from './utils/token-validator';
|
@@ -28,31 +29,58 @@ export declare class QRCodeJs extends _QRCodeJs {
|
|
28
29
|
* @param url The absolute URL for fetching license tokens (e.g., https://api.example.com/get-token).
|
29
30
|
*/
|
30
31
|
static setLicenseUrl(url: string): typeof QRCodeJs;
|
31
|
-
|
32
|
+
static _xmldomSync: any;
|
33
|
+
static _initPromise: Promise<void> | null;
|
34
|
+
static initXmldom(): Promise<void>;
|
35
|
+
constructor(options: RecursivePartial<Options>, _?: boolean);
|
32
36
|
validateScanning(): Promise<ScanValidatorResponse>;
|
33
37
|
/**
|
34
38
|
* Creates a QRCodeBuilder instance initialized with a specific template.
|
35
39
|
* Allows for fluent configuration chaining. We need it here to avoid circular dependency
|
36
40
|
* @param templateName - The name of the template to start with.
|
41
|
+
* @param templateNameOrOptions - The name of the template or a partial options object to start with.
|
37
42
|
* @returns A new QRCodeBuilder instance.
|
38
43
|
*/
|
39
|
-
static useTemplate(
|
44
|
+
static useTemplate(templateNameOrOptions: string | RecursivePartial<Options>): QRCodeBuilder;
|
45
|
+
/**
|
46
|
+
* Creates a QRCodeBuilder instance initialized with a specific style.
|
47
|
+
* Allows for fluent configuration chaining.
|
48
|
+
* @param styleNameOrOptions - The name of the predefined style or a StyleOptions object.
|
49
|
+
* @returns A new QRCodeBuilder instance.
|
50
|
+
*/
|
51
|
+
static useStyle(styleNameOrOptions: string | StyleOptions): QRCodeBuilder;
|
40
52
|
}
|
41
|
-
|
42
|
-
declare class QRCodeBuilder<T extends QRCodeJs> {
|
53
|
+
declare class QRCodeBuilder {
|
43
54
|
protected config: RecursivePartial<Options>;
|
44
|
-
protected qrCodeJsConstructor: QRCodeJsConstructor<T>;
|
45
55
|
/**
|
46
|
-
* Creates a new
|
47
|
-
* @param
|
56
|
+
* Creates a new QRCodeBuilder instance.
|
57
|
+
* @param templateNameOrOptions - Optional name of a predefined template or a partial options object to start with.
|
58
|
+
*/
|
59
|
+
constructor(templateNameOrOptions?: string | RecursivePartial<Options>);
|
60
|
+
/**
|
61
|
+
* Applies a template to the builder's configuration. Template options
|
62
|
+
* will be overridden by subsequently chained .style() or .options() calls.
|
63
|
+
* @param templateNameOrOptions - The name of the template or a partial options object to apply.
|
64
|
+
* @returns The builder instance for chaining.
|
65
|
+
*/
|
66
|
+
useTemplate(templateNameOrOptions: string | RecursivePartial<Options>): this;
|
67
|
+
/**
|
68
|
+
* Applies style options to the builder's configuration.
|
69
|
+
* @param styleNameOrOptions - Name of a predefined style or Style options object to apply.
|
70
|
+
* @returns The builder instance for chaining.
|
48
71
|
*/
|
49
|
-
|
72
|
+
useStyle(styleNameOrOptions: string | StyleOptions): this;
|
50
73
|
/**
|
51
|
-
* Merges the provided options into the builder's configuration
|
74
|
+
* Merges the provided options into the builder's configuration.
|
52
75
|
* @param options - A partial options object to merge.
|
76
|
+
* @returns The builder instance for chaining.
|
77
|
+
*/
|
78
|
+
options(options: RecursivePartial<Options>): QRCodeJs;
|
79
|
+
/**
|
80
|
+
* Builds the QRCodeJs instance with the accumulated configuration.
|
53
81
|
* @returns The created QRCodeJs instance.
|
54
82
|
*/
|
55
|
-
|
83
|
+
build(): QRCodeJs;
|
56
84
|
}
|
57
85
|
export declare class _ extends QRCodeJs {
|
58
86
|
protected _hls(): boolean;
|