@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.
- package/.github/workflows/publish.yml +18 -0
- package/CHANGELOG.md +233 -0
- package/LICENSE.md +77 -0
- package/README.md +188 -0
- package/docs/advanced-examples.md +523 -0
- package/docs/api-reference-guide.md +254 -0
- package/docs/documentation.md +1592 -0
- package/docs/examples.md +322 -0
- package/docs/license-management.md +501 -0
- package/docs/typescript-types-definitions.md +372 -0
- package/docs/usage-guide.md +622 -0
- package/lib/core/qr-code-js.d.ts +48 -0
- package/lib/core/qr-constant.d.ts +9 -0
- package/lib/core/qr-options-validation.d.ts +13 -0
- package/lib/core/qr-svg.d.ts +76 -0
- package/lib/core/qr-templates.d.ts +6 -0
- package/lib/figures/corner-dot.d.ts +24 -0
- package/lib/figures/corner-square.d.ts +24 -0
- package/lib/figures/dot.d.ts +31 -0
- package/lib/index.d.ts +52 -0
- package/lib/lib/image/GIFImage.d.ts +19 -0
- package/lib/lib/io/Base64.d.ts +10 -0
- package/lib/lib/io/Base64DecodeInputStream.d.ts +15 -0
- package/lib/lib/io/Base64EncodeOutputStream.d.ts +17 -0
- package/lib/lib/io/ByteArrayInputStream.d.ts +12 -0
- package/lib/lib/io/ByteArrayOutputStream.d.ts +12 -0
- package/lib/lib/io/InputStream.d.ts +10 -0
- package/lib/lib/io/OutputStream.d.ts +12 -0
- package/lib/lib/qr-code.d.ts +5 -0
- package/lib/lib/qrcode/BitBuffer.d.ts +11 -0
- package/lib/lib/qrcode/ErrorCorrectLevel.d.ts +23 -0
- package/lib/lib/qrcode/MaskPattern.d.ts +39 -0
- package/lib/lib/qrcode/Mode.d.ts +23 -0
- package/lib/lib/qrcode/Polynomial.d.ts +15 -0
- package/lib/lib/qrcode/QR8BitByte.d.ts +13 -0
- package/lib/lib/qrcode/QRAlphaNum.d.ts +13 -0
- package/lib/lib/qrcode/QRCode.d.ts +22 -0
- package/lib/lib/qrcode/QRCodeMinimal.d.ts +58 -0
- package/lib/lib/qrcode/QRData.d.ts +17 -0
- package/lib/lib/qrcode/QRKanji.d.ts +13 -0
- package/lib/lib/qrcode/QRMath.d.ts +13 -0
- package/lib/lib/qrcode/QRNumber.d.ts +14 -0
- package/lib/lib/qrcode/QRUtil.d.ts +25 -0
- package/lib/lib/qrcode/RSBlock.d.ts +16 -0
- package/lib/lib/text/createStringToBytes.d.ts +9 -0
- package/lib/lib/text/stringToBytes_SJIS.d.ts +8 -0
- package/lib/lib/text/stringToBytes_UTF8.d.ts +7 -0
- package/lib/lib/zbar-wasm/index.d.ts +1 -0
- package/lib/lib/zxing-js/src/browser/BrowserCodeReader.d.ts +410 -0
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeReader.d.ts +29 -0
- package/lib/lib/zxing-js/src/browser/BrowserQRCodeSvgWriter.d.ts +46 -0
- package/lib/lib/zxing-js/src/browser/BrowserSvgCodeWriter.d.ts +49 -0
- package/lib/lib/zxing-js/src/browser/DecodeContinuouslyCallback.d.ts +6 -0
- package/lib/lib/zxing-js/src/browser/HTMLCanvasElementLuminanceSource.d.ts +27 -0
- package/lib/lib/zxing-js/src/browser/HTMLVisualMediaElement.d.ts +4 -0
- package/lib/lib/zxing-js/src/browser/VideoInputDevice.d.ts +22 -0
- package/lib/lib/zxing-js/src/browser.d.ts +3 -0
- package/lib/lib/zxing-js/src/core/ArgumentException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ArithmeticException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ArrayIndexOutOfBoundsException.d.ts +10 -0
- package/lib/lib/zxing-js/src/core/BarcodeFormat.d.ts +42 -0
- package/lib/lib/zxing-js/src/core/Binarizer.d.ts +53 -0
- package/lib/lib/zxing-js/src/core/BinaryBitmap.d.ts +78 -0
- package/lib/lib/zxing-js/src/core/ChecksumException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/DecodeHintType.d.ts +91 -0
- package/lib/lib/zxing-js/src/core/Dimension.d.ts +13 -0
- package/lib/lib/zxing-js/src/core/EncodeHintType.d.ts +99 -0
- package/lib/lib/zxing-js/src/core/Exception.d.ts +17 -0
- package/lib/lib/zxing-js/src/core/FormatException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/HighContrastLuminanceSource.d.ts +27 -0
- package/lib/lib/zxing-js/src/core/IllegalArgumentException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/IllegalStateException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/IndexOutOfBoundsException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/InvertedLuminanceSource.d.ts +22 -0
- package/lib/lib/zxing-js/src/core/LuminanceSource.d.ts +84 -0
- package/lib/lib/zxing-js/src/core/NodeLuminanceSource.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/NotFoundException.d.ts +8 -0
- package/lib/lib/zxing-js/src/core/NullPointerException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/OutOfMemoryError.d.ts +6 -0
- package/lib/lib/zxing-js/src/core/PlanarYUVLuminanceSource.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/RGBLuminanceSource.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/Reader.d.ts +49 -0
- package/lib/lib/zxing-js/src/core/ReaderException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/ReedSolomonException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/Result.d.ts +52 -0
- package/lib/lib/zxing-js/src/core/ResultMetadataType.d.ts +68 -0
- package/lib/lib/zxing-js/src/core/ResultPoint.d.ts +34 -0
- package/lib/lib/zxing-js/src/core/ResultPointCallback.d.ts +11 -0
- package/lib/lib/zxing-js/src/core/UniversalLuminanceSource.d.ts +46 -0
- package/lib/lib/zxing-js/src/core/UnsupportedOperationException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/Writer.d.ts +30 -0
- package/lib/lib/zxing-js/src/core/WriterException.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/common/BitArray.d.ts +111 -0
- package/lib/lib/zxing-js/src/core/common/BitMatrix.d.ts +98 -0
- package/lib/lib/zxing-js/src/core/common/BitSource.d.ts +38 -0
- package/lib/lib/zxing-js/src/core/common/CharacterSetECI.d.ts +89 -0
- package/lib/lib/zxing-js/src/core/common/DecoderResult.d.ts +64 -0
- package/lib/lib/zxing-js/src/core/common/DefaultGridSampler.d.ts +10 -0
- package/lib/lib/zxing-js/src/core/common/DetectorResult.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/common/ECIEncoderSet.d.ts +37 -0
- package/lib/lib/zxing-js/src/core/common/ECIInput.d.ts +79 -0
- package/lib/lib/zxing-js/src/core/common/GlobalHistogramBinarizer.d.ts +29 -0
- package/lib/lib/zxing-js/src/core/common/GridSampler.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/GridSamplerInstance.d.ts +18 -0
- package/lib/lib/zxing-js/src/core/common/HybridBinarizer.d.ts +54 -0
- package/lib/lib/zxing-js/src/core/common/MinimalECIInput.d.ts +123 -0
- package/lib/lib/zxing-js/src/core/common/PerspectiveTransform.d.ts +26 -0
- package/lib/lib/zxing-js/src/core/common/StringUtils.d.ts +48 -0
- package/lib/lib/zxing-js/src/core/common/detector/CornerDetector.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/common/detector/MathUtils.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/detector/WhiteRectangleDetector.d.ts +71 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGF.d.ts +34 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/AbstractGenericGFPoly.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGF.d.ts +58 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/GenericGFPoly.d.ts +47 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonDecoder.d.ts +40 -0
- package/lib/lib/zxing-js/src/core/common/reedsolomon/ReedSolomonEncoder.d.ts +41 -0
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeReader.d.ts +35 -0
- package/lib/lib/zxing-js/src/core/qrcode/QRCodeWriter.d.ts +13 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/BitMatrixParser.d.ts +58 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DataBlock.d.ts +28 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DataMask.d.ts +36 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/DecodedBitStreamParser.d.ts +30 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Decoder.d.ts +44 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ECB.d.ts +12 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ECBlocks.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/ErrorCorrectionLevel.d.ts +38 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/FormatInformation.d.ts +33 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Mode.d.ts +56 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/QRCodeDecoderMetaData.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/qrcode/decoder/Version.d.ts +44 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPattern.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/AlignmentPatternFinder.d.ts +82 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/Detector.d.ts +87 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPattern.d.ts +26 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternFinder.d.ts +114 -0
- package/lib/lib/zxing-js/src/core/qrcode/detector/FinderPatternInfo.d.ts +16 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/BlockPair.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/ByteMatrix.d.ts +24 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/Encoder.d.ts +85 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MaskUtil.d.ts +47 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/MatrixUtil.d.ts +37 -0
- package/lib/lib/zxing-js/src/core/qrcode/encoder/QRCode.d.ts +29 -0
- package/lib/lib/zxing-js/src/core/util/Arrays.d.ts +45 -0
- package/lib/lib/zxing-js/src/core/util/ByteArrayOutputStream.d.ts +174 -0
- package/lib/lib/zxing-js/src/core/util/Charset.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/util/Collections.d.ts +11 -0
- package/lib/lib/zxing-js/src/core/util/Float.d.ts +14 -0
- package/lib/lib/zxing-js/src/core/util/Formatter.d.ts +28 -0
- package/lib/lib/zxing-js/src/core/util/Integer.d.ts +19 -0
- package/lib/lib/zxing-js/src/core/util/Long.d.ts +12 -0
- package/lib/lib/zxing-js/src/core/util/OutputStream.d.ts +106 -0
- package/lib/lib/zxing-js/src/core/util/StandardCharsets.d.ts +7 -0
- package/lib/lib/zxing-js/src/core/util/StringBuilder.d.ts +21 -0
- package/lib/lib/zxing-js/src/core/util/StringEncoding.d.ts +51 -0
- package/lib/lib/zxing-js/src/core/util/System.d.ts +10 -0
- package/lib/lib/zxing-js/src/customTypings.d.ts +16 -0
- package/lib/lib/zxing-js/src/index.d.ts +5 -0
- package/lib/lib/zxing-js/src/node.d.ts +1 -0
- package/lib/license/LicenseManager.d.ts +69 -0
- package/lib/license/LicenseManagerNode.d.ts +64 -0
- package/lib/node.d.ts +37 -0
- package/lib/options-demo.d.ts +239 -0
- package/lib/plugins/QRBorderHelpers.d.ts +32 -0
- package/lib/plugins/QRBorderPlugin.d.ts +35 -0
- package/lib/plugins/QRValidatorZbar.d.ts +38 -0
- package/lib/plugins/QRValidatorZbarNode.d.ts +60 -0
- package/lib/plugins/QRValidatorZbarNodeSharp.d.ts +83 -0
- package/lib/qr-code-js-node.js +1 -0
- package/lib/qr-code-js.js +1 -0
- package/lib/templates/borders-inner-outter.d.ts +129 -0
- package/lib/templates/borders-inner-scale-offset.d.ts +497 -0
- package/lib/templates/borders-inner.d.ts +129 -0
- package/lib/templates/borders-no-license.d.ts +129 -0
- package/lib/templates/borders-outter.d.ts +129 -0
- package/lib/templates/borders-text-auto-curved.d.ts +129 -0
- package/lib/templates/borders-text-full-curved.d.ts +133 -0
- package/lib/templates/borders.d.ts +129 -0
- package/lib/templates/scales.d.ts +130 -0
- package/lib/templates/scan-validators/index.d.ts +1 -0
- package/lib/templates/scan-validators/tests/cases/basic-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/basic-no-license.d.ts +3 -0
- package/lib/templates/scan-validators/tests/cases/basic.d.ts +3 -0
- package/lib/templates/scan-validators/tests/cases/colors-inverted.d.ts +2 -0
- package/lib/templates/scan-validators/tests/cases/colors.d.ts +58 -0
- package/lib/templates/scan-validators/tests/cases/out-of-borders-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/out-of-borders.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/position-inverted.d.ts +9 -0
- package/lib/templates/scan-validators/tests/cases/position.d.ts +3 -0
- package/lib/templates/scan-validators/tests/index.d.ts +27 -0
- package/lib/tools/browser-image-tools.d.ts +7 -0
- package/lib/tools/browser-utils.d.ts +18 -0
- package/lib/types/helper.d.ts +23 -0
- package/lib/utils/canvas-options.d.ts +7 -0
- package/lib/utils/color.d.ts +4 -0
- package/lib/utils/gradient.d.ts +26 -0
- package/lib/utils/image.d.ts +16 -0
- package/lib/utils/merge.d.ts +5 -0
- package/lib/utils/options.d.ts +220 -0
- package/lib/utils/qrcode.d.ts +8 -0
- package/lib/utils/scan-validator-node.d.ts +15 -0
- package/lib/utils/scan-validators/abstract-scan-validator.d.ts +43 -0
- package/lib/utils/scan-validators/zbar-scan-validator.d.ts +8 -0
- package/lib/utils/scan-validators/zxing-canvas-scan-validator.d.ts +10 -0
- package/lib/utils/scan-validators/zxing-scan-validator.d.ts +8 -0
- package/lib/utils/svg.d.ts +2 -0
- package/lib/utils/token-validator.d.ts +19 -0
- package/package.json +80 -0
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare const rq = "rq";
|
2
|
+
export declare const dash = "-";
|
3
|
+
export declare const talp = "talp";
|
4
|
+
export declare const mrof = "mrof";
|
5
|
+
export declare const _s: string;
|
6
|
+
export declare const _c: string;
|
7
|
+
export declare const chunks1: string[];
|
8
|
+
export declare const chunks2: string[];
|
9
|
+
export declare const chunks3: string[];
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { RecursivePartial } from '../types/helper';
|
2
|
+
import { Options } from '../utils/options.js';
|
3
|
+
export interface ValidationWarning {
|
4
|
+
path: string;
|
5
|
+
message: string;
|
6
|
+
value: any;
|
7
|
+
}
|
8
|
+
interface ValidationResult {
|
9
|
+
warnings: ValidationWarning[];
|
10
|
+
validatedOptions: RecursivePartial<Options>;
|
11
|
+
}
|
12
|
+
export declare function validateQROptions(options: RecursivePartial<Options>): ValidationResult;
|
13
|
+
export {};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { Position } from '~/plugins/QRBorderHelpers';
|
2
|
+
import { QRCodeMinimal } from '~/lib/qrcode/QRCodeMinimal';
|
3
|
+
import { Gradient } from '../utils/gradient';
|
4
|
+
import { BorderOptions, Options } from '../utils/options';
|
5
|
+
type QRSVGOptions = Pick<Options, 'width' | 'height' | 'isResponsive' | 'margin' | 'document' | 'imageTools' | 'image' | 'imageOptions' | 'dotsOptions' | 'cornersDotOptions' | 'cornersSquareOptions' | 'backgroundOptions' | 'borderOptions' | 'shape' | 'scale' | 'verticalOffset' | 'horizontalOffset' | 'offset'> & {
|
6
|
+
width: number;
|
7
|
+
height: number;
|
8
|
+
hls: boolean;
|
9
|
+
errorCorrectionPercent: number;
|
10
|
+
bordersMain: {
|
11
|
+
[key in Position]: number;
|
12
|
+
};
|
13
|
+
bordersOuter: {
|
14
|
+
[key in Position]: number;
|
15
|
+
};
|
16
|
+
bordersInner: {
|
17
|
+
[key in Position]: number;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
export declare class QRSVG {
|
21
|
+
static instanceCount: number;
|
22
|
+
private _element;
|
23
|
+
private defs;
|
24
|
+
private backgroundMask?;
|
25
|
+
private backgroundMaskGroup?;
|
26
|
+
private dotsMask?;
|
27
|
+
private dotsMaskGroup?;
|
28
|
+
private lightDotsMask?;
|
29
|
+
private lightDotsMaskGroup?;
|
30
|
+
private qr?;
|
31
|
+
private document;
|
32
|
+
private imageTools;
|
33
|
+
private finalWidth;
|
34
|
+
private finalHeight;
|
35
|
+
private _hls;
|
36
|
+
private _innerQrGroup;
|
37
|
+
private _maskedQrGroup;
|
38
|
+
_instanceId: number;
|
39
|
+
private options;
|
40
|
+
constructor(options: QRSVGOptions);
|
41
|
+
get element(): SVGElement;
|
42
|
+
private get qrGroup();
|
43
|
+
get width(): number;
|
44
|
+
get height(): number;
|
45
|
+
get svgSize(): {
|
46
|
+
width: number;
|
47
|
+
height: number;
|
48
|
+
};
|
49
|
+
getElement(): SVGElement;
|
50
|
+
private roundValue;
|
51
|
+
drawQR(qr: QRCodeMinimal): Promise<void>;
|
52
|
+
drawBackground(): void;
|
53
|
+
drawBackgroundForBorder(padding: number, baseRadius: number): SVGElement | undefined;
|
54
|
+
drawDots(filter?: (i: number, j: number) => boolean): void;
|
55
|
+
drawCorners(): void;
|
56
|
+
drawImage({ width, height, count, dotSize }: {
|
57
|
+
width: number;
|
58
|
+
height: number;
|
59
|
+
count: number;
|
60
|
+
dotSize: number;
|
61
|
+
}): Promise<void>;
|
62
|
+
createColor({ options, borderOptions, color, additionalRotation, x, y, height, width, name, returnSVGGroup }: {
|
63
|
+
options?: Gradient;
|
64
|
+
borderOptions?: BorderOptions;
|
65
|
+
color?: string;
|
66
|
+
additionalRotation: number;
|
67
|
+
x: number;
|
68
|
+
y: number;
|
69
|
+
height: number;
|
70
|
+
width: number;
|
71
|
+
name: string;
|
72
|
+
returnSVGGroup?: boolean;
|
73
|
+
}): void | SVGElement;
|
74
|
+
private createMask;
|
75
|
+
}
|
76
|
+
export {};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { type Options } from '~/utils/options';
|
2
|
+
import { RecursivePartial } from '~/types/helper';
|
3
|
+
export declare const basicQRTemplate: RecursivePartial<Options>;
|
4
|
+
export declare const roundedQRTemplate: RecursivePartial<Options>;
|
5
|
+
export declare const dotsQRTemplate: RecursivePartial<Options>;
|
6
|
+
export declare const classyQRTemplate: RecursivePartial<Options>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { DrawArgs } from '../types/helper.js';
|
2
|
+
import { CornerDotType } from '../utils/options.js';
|
3
|
+
export declare class QRCornerDot {
|
4
|
+
private readonly type;
|
5
|
+
private readonly document;
|
6
|
+
private _element?;
|
7
|
+
get element(): SVGElement | undefined;
|
8
|
+
constructor(type: `${CornerDotType}`, document: Document);
|
9
|
+
draw(args: DrawArgs): void;
|
10
|
+
private rotateFigure;
|
11
|
+
private basicDot;
|
12
|
+
private basicSquare;
|
13
|
+
private basicHeart;
|
14
|
+
private basicRounded;
|
15
|
+
private basicClassy;
|
16
|
+
private basicInpoint;
|
17
|
+
private drawDot;
|
18
|
+
private drawSquare;
|
19
|
+
private drawHeart;
|
20
|
+
private drawRounded;
|
21
|
+
private drawClassy;
|
22
|
+
private drawInpoint;
|
23
|
+
private drawOutpoint;
|
24
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { DrawArgs } from '../types/helper.js';
|
2
|
+
import { CornerSquareType } from '../utils/options.js';
|
3
|
+
export declare class QRCornerSquare {
|
4
|
+
private readonly type;
|
5
|
+
private readonly document;
|
6
|
+
private _element?;
|
7
|
+
private _fill?;
|
8
|
+
get element(): SVGElement | undefined;
|
9
|
+
get fill(): SVGElement | undefined;
|
10
|
+
constructor(type: `${CornerSquareType}`, document: Document);
|
11
|
+
draw(args: DrawArgs): void;
|
12
|
+
private rotateFigure;
|
13
|
+
private basicDot;
|
14
|
+
private basicSquare;
|
15
|
+
private basicExtraRounded;
|
16
|
+
private basicClassy;
|
17
|
+
private basicInpoint;
|
18
|
+
private drawDot;
|
19
|
+
private drawSquare;
|
20
|
+
private drawExtraRounded;
|
21
|
+
private drawClassy;
|
22
|
+
private drawInpoint;
|
23
|
+
private drawOutpoint;
|
24
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { DrawArgs } from '../types/helper.js';
|
2
|
+
import { DotType } from '../utils/options.js';
|
3
|
+
export declare class QRDot {
|
4
|
+
private readonly type;
|
5
|
+
private readonly document;
|
6
|
+
private _element?;
|
7
|
+
get element(): SVGElement | undefined;
|
8
|
+
constructor(type: `${DotType}`, document: Document);
|
9
|
+
draw(args: DrawArgs): void;
|
10
|
+
private rotateFigure;
|
11
|
+
private basicDot;
|
12
|
+
private basicSquare;
|
13
|
+
private basicSideRounded;
|
14
|
+
private basicCornerRounded;
|
15
|
+
private basicCornerExtraRounded;
|
16
|
+
private basicCornersRounded;
|
17
|
+
private drawDot;
|
18
|
+
private drawRandomDot;
|
19
|
+
private drawSquare;
|
20
|
+
private drawSmallSquare;
|
21
|
+
private drawTinySquare;
|
22
|
+
private drawDiamond;
|
23
|
+
private drawRounded;
|
24
|
+
private drawVerticalLine;
|
25
|
+
private drawHorizontalLine;
|
26
|
+
private drawExtraRounded;
|
27
|
+
private drawClassy;
|
28
|
+
private drawClassyRounded;
|
29
|
+
private drawStar;
|
30
|
+
private drawPlus;
|
31
|
+
}
|
package/lib/index.d.ts
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
import { QRCodeJs as _QRCodeJs } from './core/qr-code-js';
|
2
|
+
import { type Options as QRCodeJsOptions } from './utils/options';
|
3
|
+
import { ScanValidatorResponse } from './utils/scan-validators/abstract-scan-validator';
|
4
|
+
import { type DecodedLicenseToken } from './utils/token-validator';
|
5
|
+
export { ErrorCorrectionLevel, Mode, TypeNumber } from './lib/qrcode/QRCodeMinimal';
|
6
|
+
export { type ExtensionFunction } from './core/qr-code-js';
|
7
|
+
export { FileExtension } from './tools/browser-utils';
|
8
|
+
export { type RecursivePartial } from './types/helper';
|
9
|
+
export { type CanvasOptions } from './utils/canvas-options';
|
10
|
+
export { GradientType, type Gradient } from './utils/gradient';
|
11
|
+
export { STORAGE_KEY } from './license/LicenseManager';
|
12
|
+
export { type BorderOptions, CornerDotType, CornerSquareType, DotType, ImageMode, ShapeType, type Options as QRCodeJsOptions } from './utils/options.js';
|
13
|
+
export declare class QRCodeJs extends _QRCodeJs {
|
14
|
+
constructor(options: QRCodeJsOptions);
|
15
|
+
protected _hls(): boolean;
|
16
|
+
static initializeIfNeeded(): Promise<boolean>;
|
17
|
+
static get hls(): boolean;
|
18
|
+
static getLicenseDetails(): DecodedLicenseToken | null;
|
19
|
+
static configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
|
20
|
+
/**
|
21
|
+
* Activate the license using a pre-fetched JWT token via LicenseManager.
|
22
|
+
* @param token The JWT token string, or null to clear the license.
|
23
|
+
* @returns A Promise resolving to the validation result.
|
24
|
+
*/
|
25
|
+
static token(token: string | null): Promise<{
|
26
|
+
isValid: boolean;
|
27
|
+
token: string | null;
|
28
|
+
license: DecodedLicenseToken | null;
|
29
|
+
}>;
|
30
|
+
/**
|
31
|
+
* Sets the default URL used by the built-in license fetcher.
|
32
|
+
* Call this *before* activating with a key if you are not providing a custom fetcher.
|
33
|
+
* @param url The new default URL for fetching license tokens.
|
34
|
+
*/
|
35
|
+
static setLicenseUrl(url: string): typeof QRCodeJs;
|
36
|
+
/**
|
37
|
+
* Activate the license using a license key via LicenseManager.
|
38
|
+
* @param licenseKey The license key string.
|
39
|
+
* @returns A Promise resolving to the validation result.
|
40
|
+
*/
|
41
|
+
static license(licenseKey: string): Promise<{
|
42
|
+
isValid: boolean;
|
43
|
+
token: string | null;
|
44
|
+
license: DecodedLicenseToken | null;
|
45
|
+
}>;
|
46
|
+
validateScanning(validatorId?: string, // Default validator
|
47
|
+
debug?: boolean): Promise<ScanValidatorResponse>;
|
48
|
+
}
|
49
|
+
export declare class _ extends QRCodeJs {
|
50
|
+
protected _hls(): boolean;
|
51
|
+
constructor(options: QRCodeJsOptions);
|
52
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { OutputStream } from '../io/OutputStream.js';
|
2
|
+
/**
|
3
|
+
* GIF Image (B/W)
|
4
|
+
*
|
5
|
+
* @author Kazuhiko Arase
|
6
|
+
*/
|
7
|
+
export declare class GIFImage {
|
8
|
+
private width;
|
9
|
+
private height;
|
10
|
+
private data;
|
11
|
+
constructor(width: number, height: number);
|
12
|
+
setPixel(x: number, y: number, pixel: number): void;
|
13
|
+
getPixel(x: number, y: number): number;
|
14
|
+
write(out: OutputStream): void;
|
15
|
+
private getLZWRaster;
|
16
|
+
private writeWord;
|
17
|
+
private writeBytes;
|
18
|
+
toDataURL(): string;
|
19
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { InputStream } from './InputStream.js';
|
2
|
+
/**
|
3
|
+
* Base64DecodeInputStream
|
4
|
+
*
|
5
|
+
* @author Kazuhiko Arase
|
6
|
+
*/
|
7
|
+
export declare class Base64DecodeInputStream extends InputStream {
|
8
|
+
private istream;
|
9
|
+
private buffer;
|
10
|
+
private buflen;
|
11
|
+
constructor(istream: InputStream);
|
12
|
+
readByte(): number;
|
13
|
+
private static isWhitespace;
|
14
|
+
private static decode;
|
15
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { OutputStream } from './OutputStream.js';
|
2
|
+
/**
|
3
|
+
* Base64EncodeOutputStream
|
4
|
+
*
|
5
|
+
* @author Kazuhiko Arase
|
6
|
+
*/
|
7
|
+
export declare class Base64EncodeOutputStream extends OutputStream {
|
8
|
+
private ostream;
|
9
|
+
private buffer;
|
10
|
+
private buflen;
|
11
|
+
private length;
|
12
|
+
constructor(ostream: OutputStream);
|
13
|
+
writeByte(n: number): void;
|
14
|
+
flush(): void;
|
15
|
+
private writeEncoded;
|
16
|
+
private static encode;
|
17
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { InputStream } from './InputStream.js';
|
2
|
+
/**
|
3
|
+
* ByteArrayInputStream
|
4
|
+
*
|
5
|
+
* @author Kazuhiko Arase
|
6
|
+
*/
|
7
|
+
export declare class ByteArrayInputStream extends InputStream {
|
8
|
+
private bytes;
|
9
|
+
private pos;
|
10
|
+
constructor(bytes: number[]);
|
11
|
+
readByte(): number;
|
12
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { OutputStream } from './OutputStream.js';
|
2
|
+
/**
|
3
|
+
* ByteArrayOutputStream
|
4
|
+
*
|
5
|
+
* @author Kazuhiko Arase
|
6
|
+
*/
|
7
|
+
export declare class ByteArrayOutputStream extends OutputStream {
|
8
|
+
private bytes;
|
9
|
+
constructor();
|
10
|
+
writeByte(b: number): void;
|
11
|
+
toByteArray(): number[];
|
12
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
export { QRCode } from './qrcode/QRCode.js';
|
2
|
+
export { ErrorCorrectionLevel, Mode, QRCodeMinimal, TypeNumber } from './qrcode/QRCodeMinimal.js';
|
3
|
+
export { QRUtil } from './qrcode/QRUtil.js';
|
4
|
+
export { stringToBytes_SJIS } from './text/stringToBytes_SJIS.js';
|
5
|
+
export { stringToBytes_UTF8 } from './text/stringToBytes_UTF8.js';
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* MaskPattern
|
3
|
+
*
|
4
|
+
* @author Kazuhiko Arase
|
5
|
+
*/
|
6
|
+
export declare enum MaskPattern {
|
7
|
+
/**
|
8
|
+
* mask pattern 000
|
9
|
+
*/
|
10
|
+
PATTERN000 = 0,
|
11
|
+
/**
|
12
|
+
* mask pattern 001
|
13
|
+
*/
|
14
|
+
PATTERN001 = 1,
|
15
|
+
/**
|
16
|
+
* mask pattern 010
|
17
|
+
*/
|
18
|
+
PATTERN010 = 2,
|
19
|
+
/**
|
20
|
+
* mask pattern 011
|
21
|
+
*/
|
22
|
+
PATTERN011 = 3,
|
23
|
+
/**
|
24
|
+
* mask pattern 100
|
25
|
+
*/
|
26
|
+
PATTERN100 = 4,
|
27
|
+
/**
|
28
|
+
* mask pattern 101
|
29
|
+
*/
|
30
|
+
PATTERN101 = 5,
|
31
|
+
/**
|
32
|
+
* mask pattern 110
|
33
|
+
*/
|
34
|
+
PATTERN110 = 6,
|
35
|
+
/**
|
36
|
+
* mask pattern 111
|
37
|
+
*/
|
38
|
+
PATTERN111 = 7
|
39
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* Mode
|
3
|
+
*
|
4
|
+
* @author Kazuhiko Arase
|
5
|
+
*/
|
6
|
+
export declare enum Mode {
|
7
|
+
/**
|
8
|
+
* number
|
9
|
+
*/
|
10
|
+
MODE_NUMBER = 1,
|
11
|
+
/**
|
12
|
+
* alphabet and number
|
13
|
+
*/
|
14
|
+
MODE_ALPHA_NUM = 2,
|
15
|
+
/**
|
16
|
+
* 8bit byte
|
17
|
+
*/
|
18
|
+
MODE_8BIT_BYTE = 4,
|
19
|
+
/**
|
20
|
+
* KANJI
|
21
|
+
*/
|
22
|
+
MODE_KANJI = 8
|
23
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/**
|
2
|
+
* Polynomial
|
3
|
+
*
|
4
|
+
* @author Kazuhiko Arase
|
5
|
+
*/
|
6
|
+
export declare class Polynomial {
|
7
|
+
private num;
|
8
|
+
constructor(num: number[], shift?: number);
|
9
|
+
getAt(index: number): number;
|
10
|
+
getLength(): number;
|
11
|
+
toString(): string;
|
12
|
+
toLogString(): string;
|
13
|
+
multiply(e: Polynomial): Polynomial;
|
14
|
+
mod(e: Polynomial): Polynomial;
|
15
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BitBuffer } from './BitBuffer.js';
|
2
|
+
import { QRData } from './QRData.js';
|
3
|
+
/**
|
4
|
+
* QR8BitByte
|
5
|
+
*
|
6
|
+
* @author Kazuhiko Arase
|
7
|
+
*/
|
8
|
+
export declare class QR8BitByte extends QRData {
|
9
|
+
private stringToBytes;
|
10
|
+
constructor(data: string, stringToBytes: (s: string) => number[]);
|
11
|
+
write(buffer: BitBuffer): void;
|
12
|
+
getLength(): number;
|
13
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BitBuffer } from './BitBuffer.js';
|
2
|
+
import { QRData } from './QRData.js';
|
3
|
+
/**
|
4
|
+
* QRAlphaNum
|
5
|
+
*
|
6
|
+
* @author Kazuhiko Arase
|
7
|
+
*/
|
8
|
+
export declare class QRAlphaNum extends QRData {
|
9
|
+
constructor(data: string);
|
10
|
+
write(buffer: BitBuffer): void;
|
11
|
+
getLength(): number;
|
12
|
+
private static getCode;
|
13
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { QRCodeMinimal } from './QRCodeMinimal.js';
|
2
|
+
export declare class QRCode extends QRCodeMinimal {
|
3
|
+
private _createHalfASCII;
|
4
|
+
createASCII(cellSize?: number, margin?: number): string;
|
5
|
+
renderTo2dContext(context: CanvasRenderingContext2D, cellSize?: number): void;
|
6
|
+
toDataURL(cellSize?: number, margin?: number): string;
|
7
|
+
createTableTag(cellSize?: number, margin?: number): string;
|
8
|
+
createSvgTag(opts?: {
|
9
|
+
cellSize?: number;
|
10
|
+
margin?: number;
|
11
|
+
scalable?: boolean;
|
12
|
+
alt?: string | {
|
13
|
+
text?: string | null;
|
14
|
+
id?: string | null;
|
15
|
+
};
|
16
|
+
title?: string | {
|
17
|
+
text?: string | null;
|
18
|
+
id?: string | null;
|
19
|
+
};
|
20
|
+
}): string;
|
21
|
+
createImgTag(cellSize?: number, margin?: number, alt?: string): string;
|
22
|
+
}
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import { ErrorCorrectLevel } from './ErrorCorrectLevel.js';
|
2
|
+
import { QRData } from './QRData.js';
|
3
|
+
type TypeNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40;
|
4
|
+
declare const TypeNumber: { [P in TypeNumber]: P; };
|
5
|
+
export { TypeNumber };
|
6
|
+
export declare enum ErrorCorrectionLevel {
|
7
|
+
L = "L",
|
8
|
+
M = "M",
|
9
|
+
Q = "Q",
|
10
|
+
H = "H"
|
11
|
+
}
|
12
|
+
export declare enum Mode {
|
13
|
+
numeric = "numeric",
|
14
|
+
alphanumeric = "alphanumeric",
|
15
|
+
/**
|
16
|
+
* Default
|
17
|
+
*/
|
18
|
+
byte = "byte",
|
19
|
+
kanji = "kanji",
|
20
|
+
unicode = "unicode"
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* QRCode
|
24
|
+
*
|
25
|
+
* @author Kazuhiko Arase
|
26
|
+
*/
|
27
|
+
export declare class QRCodeMinimal {
|
28
|
+
static stringToBytesFuncs: {
|
29
|
+
[encoding: string]: (s: string) => number[];
|
30
|
+
};
|
31
|
+
private static PAD0;
|
32
|
+
private static PAD1;
|
33
|
+
private typeNumber;
|
34
|
+
private errorCorrectLevel;
|
35
|
+
private qrDataList;
|
36
|
+
private modules;
|
37
|
+
private moduleCount;
|
38
|
+
constructor(typeNumber?: TypeNumber, errorCorrectionLevel?: `${ErrorCorrectionLevel}`);
|
39
|
+
getTypeNumber(): number;
|
40
|
+
setTypeNumber(typeNumber: number): void;
|
41
|
+
getErrorCorrectLevel(): ErrorCorrectLevel;
|
42
|
+
setErrorCorrectLevel(errorCorrectLevel: ErrorCorrectLevel): void;
|
43
|
+
clearData(): void;
|
44
|
+
addData(qrData: QRData | string, mode?: `${Mode}`): void;
|
45
|
+
isDark(row: number, col: number): boolean;
|
46
|
+
getModuleCount(): number;
|
47
|
+
make(): void;
|
48
|
+
private getBestMaskPattern;
|
49
|
+
private makeImpl;
|
50
|
+
private mapData;
|
51
|
+
private setupPositionAdjustPattern;
|
52
|
+
private setupPositionProbePattern;
|
53
|
+
private setupTimingPattern;
|
54
|
+
private setupTypeNumber;
|
55
|
+
private setupTypeInfo;
|
56
|
+
static createData(typeNumber: number, errorCorrectLevel: ErrorCorrectLevel, dataArray: QRData[]): number[];
|
57
|
+
private static createBytes;
|
58
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { BitBuffer } from './BitBuffer.js';
|
2
|
+
import { Mode } from './Mode.js';
|
3
|
+
/**
|
4
|
+
* QRData
|
5
|
+
*
|
6
|
+
* @author Kazuhiko Arase
|
7
|
+
*/
|
8
|
+
export declare abstract class QRData {
|
9
|
+
private mode;
|
10
|
+
private data;
|
11
|
+
constructor(mode: Mode, data: string);
|
12
|
+
getMode(): Mode;
|
13
|
+
getData(): string;
|
14
|
+
abstract getLength(): number;
|
15
|
+
abstract write(buffer: BitBuffer): void;
|
16
|
+
getLengthInBits(typeNumber: number): number;
|
17
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { BitBuffer } from './BitBuffer.js';
|
2
|
+
import { QRData } from './QRData.js';
|
3
|
+
/**
|
4
|
+
* QRKanji(SJIS only)
|
5
|
+
*
|
6
|
+
* @author Kazuhiko Arase
|
7
|
+
*/
|
8
|
+
export declare class QRKanji extends QRData {
|
9
|
+
private stringToBytes;
|
10
|
+
constructor(data: string, stringToBytes: (s: string) => number[]);
|
11
|
+
write(buffer: BitBuffer): void;
|
12
|
+
getLength(): number;
|
13
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/**
|
2
|
+
* QRMath
|
3
|
+
*
|
4
|
+
* @author Kazuhiko Arase
|
5
|
+
*/
|
6
|
+
export declare class QRMath {
|
7
|
+
constructor();
|
8
|
+
static initialize: void;
|
9
|
+
private static EXP_TABLE;
|
10
|
+
private static LOG_TABLE;
|
11
|
+
static glog(n: number): number;
|
12
|
+
static gexp(n: number): number;
|
13
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { BitBuffer } from './BitBuffer.js';
|
2
|
+
import { QRData } from './QRData.js';
|
3
|
+
/**
|
4
|
+
* QRNumber
|
5
|
+
*
|
6
|
+
* @author Kazuhiko Arase
|
7
|
+
*/
|
8
|
+
export declare class QRNumber extends QRData {
|
9
|
+
constructor(data: string);
|
10
|
+
write(buffer: BitBuffer): void;
|
11
|
+
getLength(): number;
|
12
|
+
private static strToNum;
|
13
|
+
private static chatToNum;
|
14
|
+
}
|