@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,61 @@
|
|
1
|
+
import { CanvasOptions } from '~/utils/canvas-options';
|
2
|
+
import { RecursivePartial } from '../types/helper';
|
3
|
+
import { StyleOptions } from '../types/style-options';
|
4
|
+
import { Options } from '../utils/options';
|
5
|
+
export declare enum FileExtension {
|
6
|
+
svg = "svg",
|
7
|
+
png = "png",
|
8
|
+
jpeg = "jpeg",
|
9
|
+
webp = "webp"
|
10
|
+
}
|
11
|
+
export type ExtensionFunction = (svg: SVGElement, options: RecursivePartial<Options>) => void;
|
12
|
+
export declare class QRCodeJs {
|
13
|
+
/** Library version injected at build time */
|
14
|
+
static version: string;
|
15
|
+
private static _selectedTemplate;
|
16
|
+
private static _selectedStyle;
|
17
|
+
private options;
|
18
|
+
private container?;
|
19
|
+
private qr?;
|
20
|
+
private extension?;
|
21
|
+
private svgDrawingPromise?;
|
22
|
+
private qrSVG?;
|
23
|
+
get size(): {
|
24
|
+
width: number;
|
25
|
+
height: number;
|
26
|
+
} | undefined;
|
27
|
+
constructor(options: RecursivePartial<Options>, _?: boolean);
|
28
|
+
static setTemplate(templateNameOrOptions: string | RecursivePartial<Options>): typeof QRCodeJs;
|
29
|
+
/**
|
30
|
+
* Sets the static style to be used as a base for new instances.
|
31
|
+
* Accepts either a predefined style name or a StyleOptions object.
|
32
|
+
* @param styleNameOrOptions - The name of the style or the StyleOptions object.
|
33
|
+
* @returns The QRCodeJs class for chaining.
|
34
|
+
*/
|
35
|
+
static setStyle(styleNameOrOptions: string | StyleOptions): typeof QRCodeJs;
|
36
|
+
update(options?: RecursivePartial<Options>): Promise<void>;
|
37
|
+
append(
|
38
|
+
/** This container will be used for appending of the QR code */
|
39
|
+
container?: HTMLElement): QRCodeJs | undefined;
|
40
|
+
applyExtension(extension: ExtensionFunction): Promise<void>;
|
41
|
+
deleteExtension(): Promise<void>;
|
42
|
+
serialize(inverted?: boolean): Promise<string | undefined>;
|
43
|
+
private _setupSvgAsync;
|
44
|
+
protected _drawToCanvasForValidation(options?: RecursivePartial<CanvasOptions>): Promise<HTMLCanvasElement>;
|
45
|
+
protected drawToCanvas(options?: RecursivePartial<CanvasOptions>): Promise<{
|
46
|
+
canvas: HTMLCanvasElement;
|
47
|
+
canvasDrawingPromise: Promise<void> | undefined;
|
48
|
+
} | undefined>;
|
49
|
+
private downloadURI;
|
50
|
+
download(downloadOptions?: {
|
51
|
+
name?: string;
|
52
|
+
extension: `${FileExtension}`;
|
53
|
+
}, canvasOptions?: RecursivePartial<CanvasOptions>): Promise<void>;
|
54
|
+
protected createOptimizedQRCanvas(options?: RecursivePartial<CanvasOptions>): Promise<HTMLCanvasElement>;
|
55
|
+
/**
|
56
|
+
* Apply thresholding to enhance QR code contrast
|
57
|
+
*/
|
58
|
+
private applyQRThreshold;
|
59
|
+
protected _hls(): boolean;
|
60
|
+
private _logValidationWarnings;
|
61
|
+
}
|
@@ -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,10 @@
|
|
1
|
+
import { type Options } from '~/utils/options';
|
2
|
+
import { RecursivePartial } from '~/types/helper';
|
3
|
+
export declare const plainQRTemplate: RecursivePartial<Options>;
|
4
|
+
export declare const basicQRTemplate: RecursivePartial<Options>;
|
5
|
+
export declare const roundedQRTemplate: RecursivePartial<Options>;
|
6
|
+
export declare const dotsQRTemplate: RecursivePartial<Options>;
|
7
|
+
export declare const classyQRTemplate: RecursivePartial<Options>;
|
8
|
+
export declare const qrTemplates: {
|
9
|
+
[key: string]: RecursivePartial<Options>;
|
10
|
+
};
|
@@ -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
|
+
}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import { QRCodeJs as _QRCodeJs } from './core/qr-code-js';
|
2
|
+
import { RecursivePartial } from './types/helper';
|
3
|
+
import { StyleOptions } from './types/style-options';
|
4
|
+
import { Options, type Options as QRCodeJsOptions } from './utils/options';
|
5
|
+
import { ScanValidatorResponse } from './utils/scan-validators/abstract-scan-validator';
|
6
|
+
import { type DecodedLicenseToken } from './utils/token-validator';
|
7
|
+
export { ErrorCorrectionLevel, Mode, TypeNumber } from './lib/qrcode/QRCodeMinimal';
|
8
|
+
export { type ExtensionFunction } from './core/qr-code-js';
|
9
|
+
export { FileExtension } from './tools/browser-utils';
|
10
|
+
export { type RecursivePartial } from './types/helper';
|
11
|
+
export { type CanvasOptions } from './utils/canvas-options';
|
12
|
+
export { GradientType, type Gradient } from './utils/gradient';
|
13
|
+
export { STORAGE_KEY } from './license/LicenseManager';
|
14
|
+
export { type BorderOptions, CornerDotType, CornerSquareType, DotType, ImageMode, ShapeType, type Options as QRCodeJsOptions } from './utils/options.js';
|
15
|
+
export declare class QRCodeJs extends _QRCodeJs {
|
16
|
+
constructor(options: RecursivePartial<QRCodeJsOptions>, _?: boolean);
|
17
|
+
protected _hls(): boolean;
|
18
|
+
static initializeIfNeeded(): Promise<boolean>;
|
19
|
+
static get hls(): boolean;
|
20
|
+
static getLicenseDetails(): DecodedLicenseToken | null;
|
21
|
+
static configureLicenseFetcher(fetcher: (licenseKey: string) => Promise<string>): void;
|
22
|
+
/**
|
23
|
+
* Activate the license using a pre-fetched JWT token via LicenseManager.
|
24
|
+
* @param token The JWT token string, or null to clear the license.
|
25
|
+
* @returns A Promise resolving to the validation result.
|
26
|
+
*/
|
27
|
+
static token(token: string | null): Promise<{
|
28
|
+
isValid: boolean;
|
29
|
+
token: string | null;
|
30
|
+
license: DecodedLicenseToken | null;
|
31
|
+
}>;
|
32
|
+
/**
|
33
|
+
* Sets the default URL used by the built-in license fetcher.
|
34
|
+
* Call this *before* activating with a key if you are not providing a custom fetcher.
|
35
|
+
* @param url The new default URL for fetching license tokens.
|
36
|
+
*/
|
37
|
+
static setLicenseUrl(url: string): typeof QRCodeJs;
|
38
|
+
/**
|
39
|
+
* Activate the license using a license key via LicenseManager.
|
40
|
+
* @param licenseKey The license key string.
|
41
|
+
* @returns A Promise resolving to the validation result.
|
42
|
+
*/
|
43
|
+
static license(licenseKey: string): Promise<{
|
44
|
+
isValid: boolean;
|
45
|
+
token: string | null;
|
46
|
+
license: DecodedLicenseToken | null;
|
47
|
+
}>;
|
48
|
+
validateScanning(_validatorId?: string, // Default validator
|
49
|
+
debug?: boolean): Promise<ScanValidatorResponse>;
|
50
|
+
/**
|
51
|
+
* Creates a QRCodeBuilder instance initialized with a specific template.
|
52
|
+
* Allows for fluent configuration chaining. We need it here to avoid circular dependency
|
53
|
+
* @param templateName - The name of the template to start with.
|
54
|
+
* @param templateNameOrOptions - The name of the template or a partial options object to start with.
|
55
|
+
* @returns A new QRCodeBuilder instance.
|
56
|
+
*/
|
57
|
+
static useTemplate(templateNameOrOptions: string | RecursivePartial<Options>): QRCodeBuilder;
|
58
|
+
/**
|
59
|
+
* Creates a QRCodeBuilder instance initialized with a specific style.
|
60
|
+
* Allows for fluent configuration chaining.
|
61
|
+
* @param styleNameOrOptions - The name of the predefined style or a StyleOptions object.
|
62
|
+
* @returns A new QRCodeBuilder instance.
|
63
|
+
*/
|
64
|
+
static useStyle(styleNameOrOptions: string | StyleOptions): QRCodeBuilder;
|
65
|
+
}
|
66
|
+
export declare class _ extends QRCodeJs {
|
67
|
+
protected _hls(): boolean;
|
68
|
+
constructor(options: QRCodeJsOptions);
|
69
|
+
}
|
70
|
+
declare class QRCodeBuilder {
|
71
|
+
protected config: RecursivePartial<Options>;
|
72
|
+
/**
|
73
|
+
* Creates a new QRCodeBuilder instance.
|
74
|
+
* @param templateNameOrOptions - Optional name of a predefined template or a partial options object to start with.
|
75
|
+
*/
|
76
|
+
constructor(templateNameOrOptions?: string | RecursivePartial<Options>);
|
77
|
+
/**
|
78
|
+
* Applies a template to the builder's configuration. Template options
|
79
|
+
* will be overridden by subsequently chained .style() or .options() calls.
|
80
|
+
* @param templateNameOrOptions - The name of the template or a partial options object to apply.
|
81
|
+
* @returns The builder instance for chaining.
|
82
|
+
*/
|
83
|
+
useTemplate(templateNameOrOptions: string | RecursivePartial<Options>): this;
|
84
|
+
/**
|
85
|
+
* Applies style options to the builder's configuration.
|
86
|
+
* @param styleNameOrOptions - Name of a predefined style or Style options object to apply.
|
87
|
+
* @returns The builder instance for chaining.
|
88
|
+
*/
|
89
|
+
useStyle(styleNameOrOptions: string | StyleOptions): this;
|
90
|
+
/**
|
91
|
+
* Merges the provided options into the builder's configuration.
|
92
|
+
* @param options - A partial options object to merge.
|
93
|
+
* @returns The builder instance for chaining.
|
94
|
+
*/
|
95
|
+
options(options: RecursivePartial<Options>): QRCodeJs;
|
96
|
+
/**
|
97
|
+
* Builds the QRCodeJs instance with the accumulated configuration.
|
98
|
+
* @returns The created QRCodeJs instance.
|
99
|
+
*/
|
100
|
+
build(): QRCodeJs;
|
101
|
+
}
|
@@ -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
|
+
}
|