@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,372 @@
|
|
1
|
+
# QRCode.js TypeScript Types and Definitions
|
2
|
+
<a id="start"></a>
|
3
|
+
|
4
|
+
Below is a complete TypeScript Types and Definitions section for all options available in the QRCode.js library. This section is designed as a standalone reference, defining the structure of the options object with interfaces and enums to ensure type safety and clarity for users configuring a QR code.
|
5
|
+
|
6
|
+
## Main Options Interface
|
7
|
+
|
8
|
+
The `Options` interface is the top-level configuration object for generating a QR code. It includes properties for the data to encode, shape, layout, and various styling options.
|
9
|
+
|
10
|
+
```typescript
|
11
|
+
import { QRCodeJs, Options } from '@qr-platform/qr-code.js'; // Import from '@qr-platform/qr-code.js' for browser
|
12
|
+
or
|
13
|
+
import { QRCodeJs, Options } from '@qr-platform/qr-code.js/node'; // Import from '@qr-platform/qr-code.js/node' for Node.js
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
```typescript
|
18
|
+
interface Options {
|
19
|
+
/** The text, URL, or other data to encode into the QR code. This is the only required option. */
|
20
|
+
data: string;
|
21
|
+
|
22
|
+
/** The overall shape of the QR code's boundary. */
|
23
|
+
shape: ShapeType;
|
24
|
+
|
25
|
+
/** The quiet zone (empty space) around the QR code in pixels. */
|
26
|
+
margin: number;
|
27
|
+
|
28
|
+
/** When true, the QR code SVG resizes dynamically to fill the width or height of the parent container, with no internal size dimensions applied. */
|
29
|
+
isResponsive: boolean;
|
30
|
+
|
31
|
+
/** Scales the QR code size relative to its container or border. */
|
32
|
+
scale: number;
|
33
|
+
|
34
|
+
/** Applies a vertical offset (positive moves down, negative moves up) relative to the center. */
|
35
|
+
offset: number;
|
36
|
+
|
37
|
+
/** Applies an absolute vertical offset in pixels. */
|
38
|
+
verticalOffset: number;
|
39
|
+
|
40
|
+
/** Applies an absolute horizontal offset in pixels. */
|
41
|
+
horizontalOffset: number;
|
42
|
+
|
43
|
+
/** Options related to the underlying QR code generation algorithm. */
|
44
|
+
qrOptions: QrOptions;
|
45
|
+
|
46
|
+
/** Options for styling the dots in the QR code. */
|
47
|
+
dotsOptions: DotsOptions;
|
48
|
+
|
49
|
+
/** Options for styling the corner squares. Overrides dotsOptions. */
|
50
|
+
cornersSquareOptions?: CornersSquareOptions;
|
51
|
+
|
52
|
+
/** Options for styling the corner dots. Overrides cornersSquareOptions. */
|
53
|
+
cornersDotOptions?: CornersDotOptions;
|
54
|
+
|
55
|
+
/** Options for styling the background. Set to false to disable. */
|
56
|
+
backgroundOptions?: BackgroundOptions | false;
|
57
|
+
|
58
|
+
/** URL, Buffer, or Blob of an image to embed in the QR code. */
|
59
|
+
image?: string | Buffer | Blob;
|
60
|
+
|
61
|
+
/** Options for the embedded image. */
|
62
|
+
imageOptions: ImageOptions;
|
63
|
+
|
64
|
+
/** Options for adding decorative borders (premium feature). */
|
65
|
+
borderOptions?: BorderOptions;
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
### QrOptions
|
70
|
+
|
71
|
+
Options for the QR code generation algorithm.
|
72
|
+
|
73
|
+
```typescript
|
74
|
+
interface QrOptions {
|
75
|
+
/** Specifies the QR code version (size/capacity). 0 means automatic detection. */
|
76
|
+
typeNumber: number;
|
77
|
+
|
78
|
+
/** The encoding mode (e.g., Byte, Numeric, Kanji). Usually auto-detected. */
|
79
|
+
mode?: Mode;
|
80
|
+
|
81
|
+
/** The error correction level, determining redundancy. */
|
82
|
+
errorCorrectionLevel: ErrorCorrectionLevel;
|
83
|
+
}
|
84
|
+
```
|
85
|
+
|
86
|
+
### DotsOptions
|
87
|
+
|
88
|
+
Options for styling the dots in the QR code.
|
89
|
+
|
90
|
+
```typescript
|
91
|
+
interface DotsOptions {
|
92
|
+
/** The shape of the dots. */
|
93
|
+
type: DotType;
|
94
|
+
|
95
|
+
/** The color of the dots. */
|
96
|
+
color: string;
|
97
|
+
|
98
|
+
/** The size of the dots in pixels. */
|
99
|
+
size: number;
|
100
|
+
|
101
|
+
/** Apply a gradient fill to the dots. */
|
102
|
+
gradient?: Gradient;
|
103
|
+
}
|
104
|
+
```
|
105
|
+
|
106
|
+
### CornersSquareOptions
|
107
|
+
|
108
|
+
Options for styling the corner squares.
|
109
|
+
|
110
|
+
```typescript
|
111
|
+
interface CornersSquareOptions {
|
112
|
+
/** The shape of the corner squares. Inherits from dotsOptions.type if not specified. */
|
113
|
+
type?: CornerSquareType;
|
114
|
+
|
115
|
+
/** The color of the corner squares. Inherits from dotsOptions.color if not specified. */
|
116
|
+
color?: string;
|
117
|
+
|
118
|
+
/** Apply a gradient fill to the corner squares. */
|
119
|
+
gradient?: Gradient;
|
120
|
+
}
|
121
|
+
```
|
122
|
+
|
123
|
+
### CornersDotOptions
|
124
|
+
|
125
|
+
Options for styling the corner dots.
|
126
|
+
|
127
|
+
```typescript
|
128
|
+
interface CornersDotOptions {
|
129
|
+
/** The shape of the corner dots. Inherits from cornersSquareOptions.type if not specified. */
|
130
|
+
type?: CornerDotType;
|
131
|
+
|
132
|
+
/** The color of the corner dots. Inherits from cornersSquareOptions.color if not specified. */
|
133
|
+
color?: string;
|
134
|
+
|
135
|
+
/** Apply a gradient fill to the corner dots. */
|
136
|
+
gradient?: Gradient;
|
137
|
+
}
|
138
|
+
```
|
139
|
+
|
140
|
+
### BackgroundOptions
|
141
|
+
|
142
|
+
Options for styling the background.
|
143
|
+
|
144
|
+
```typescript
|
145
|
+
interface BackgroundOptions {
|
146
|
+
/** The background color. */
|
147
|
+
color?: string;
|
148
|
+
|
149
|
+
/** Rounds the corners of the background (0-1 or percentage). */
|
150
|
+
round?: number | string;
|
151
|
+
|
152
|
+
/** Apply a gradient fill to the background. */
|
153
|
+
gradient?: Gradient;
|
154
|
+
}
|
155
|
+
```
|
156
|
+
|
157
|
+
### ImageOptions
|
158
|
+
|
159
|
+
Options for the embedded image.
|
160
|
+
|
161
|
+
```typescript
|
162
|
+
interface ImageOptions {
|
163
|
+
/** How the image is embedded. */
|
164
|
+
mode?: ImageMode;
|
165
|
+
|
166
|
+
/** Relative size of the image (0-1). */
|
167
|
+
imageSize: number;
|
168
|
+
|
169
|
+
/** Margin around the image in dot units. */
|
170
|
+
margin: number;
|
171
|
+
|
172
|
+
/** CORS setting for the image. */
|
173
|
+
crossOrigin?: string;
|
174
|
+
|
175
|
+
/** Fill color or gradient for transparent areas. */
|
176
|
+
fill?: {
|
177
|
+
color: string;
|
178
|
+
gradient?: Gradient;
|
179
|
+
};
|
180
|
+
}
|
181
|
+
```
|
182
|
+
|
183
|
+
### BorderOptions (Premium Feature)
|
184
|
+
|
185
|
+
Options for adding decorative borders.
|
186
|
+
|
187
|
+
```typescript
|
188
|
+
interface BorderOptions {
|
189
|
+
/** Master switch to enable/disable borders. */
|
190
|
+
hasBorder: boolean;
|
191
|
+
|
192
|
+
/** Thickness of the main border in pixels. */
|
193
|
+
thickness: number;
|
194
|
+
|
195
|
+
/** Color of the main border. */
|
196
|
+
color: string;
|
197
|
+
|
198
|
+
/** Corner rounding of the border (e.g., '10%', '20px'). */
|
199
|
+
radius: string;
|
200
|
+
|
201
|
+
/** Thickness for border sides with disabled decorations. */
|
202
|
+
noBorderThickness: number;
|
203
|
+
|
204
|
+
/** Background color for the border area. */
|
205
|
+
background?: string;
|
206
|
+
|
207
|
+
/** Options for scaling/offsetting the inner content area. */
|
208
|
+
inner?: {
|
209
|
+
radius: string;
|
210
|
+
scale: number;
|
211
|
+
horizontalOffset: number;
|
212
|
+
verticalOffset: number;
|
213
|
+
};
|
214
|
+
|
215
|
+
/** Options for an additional outer border. */
|
216
|
+
borderOuter?: {
|
217
|
+
color: string;
|
218
|
+
thickness: number;
|
219
|
+
};
|
220
|
+
|
221
|
+
/** Options for an additional inner border. */
|
222
|
+
borderInner?: {
|
223
|
+
color: string;
|
224
|
+
thickness: number;
|
225
|
+
};
|
226
|
+
|
227
|
+
/** Add text or images to specific sides of the border. */
|
228
|
+
decorations?: {
|
229
|
+
top?: DecorationOptions;
|
230
|
+
right?: DecorationOptions;
|
231
|
+
bottom?: DecorationOptions;
|
232
|
+
left?: DecorationOptions;
|
233
|
+
};
|
234
|
+
}
|
235
|
+
```
|
236
|
+
|
237
|
+
### DecorationOptions (for Border Decorations)
|
238
|
+
|
239
|
+
Options for customizing decorations on border sides.
|
240
|
+
|
241
|
+
```typescript
|
242
|
+
interface DecorationOptions {
|
243
|
+
/** Whether the decoration for this side is disabled. */
|
244
|
+
disabled: boolean;
|
245
|
+
|
246
|
+
/** Whether to enable text on this side of the border. */
|
247
|
+
enableText: boolean;
|
248
|
+
|
249
|
+
/** Positioning offset for the decoration. */
|
250
|
+
offset: number;
|
251
|
+
|
252
|
+
/** Adjustment for the text curve. */
|
253
|
+
curveAdjustment: number;
|
254
|
+
|
255
|
+
/** Whether to disable curved text. */
|
256
|
+
curveDisabled: boolean;
|
257
|
+
|
258
|
+
/** Radius of the text curve (e.g., '50%', '100px'). */
|
259
|
+
curveRadius: string;
|
260
|
+
|
261
|
+
/** The type of decoration to use ('text' or 'image'). */
|
262
|
+
type: 'text' | 'image';
|
263
|
+
|
264
|
+
/** The text content or image URL for the decoration. */
|
265
|
+
value: string;
|
266
|
+
|
267
|
+
/** Style options for text decorations. */
|
268
|
+
style?: {
|
269
|
+
fontFace: string;
|
270
|
+
fontSize: number;
|
271
|
+
fontColor: string;
|
272
|
+
letterSpacing: number;
|
273
|
+
fontWeight: 'normal' | 'bold';
|
274
|
+
};
|
275
|
+
}
|
276
|
+
```
|
277
|
+
|
278
|
+
### Gradient
|
279
|
+
|
280
|
+
Options for applying gradient fills.
|
281
|
+
|
282
|
+
```typescript
|
283
|
+
interface Gradient {
|
284
|
+
/** Specifies the type of gradient: 'linear' or 'radial'. */
|
285
|
+
type: 'linear' | 'radial';
|
286
|
+
|
287
|
+
/** Rotation angle in radians for linear gradients. */
|
288
|
+
rotation?: number;
|
289
|
+
|
290
|
+
/** Array of color stops defining the gradient (offset: 0-1, color: CSS string). */
|
291
|
+
colorStops: Array<{ offset: number; color: string }>;
|
292
|
+
}
|
293
|
+
```
|
294
|
+
|
295
|
+
## Enums
|
296
|
+
|
297
|
+
These enums provide predefined values for certain properties, ensuring type safety.
|
298
|
+
|
299
|
+
```typescript
|
300
|
+
enum ShapeType {
|
301
|
+
square = 'square',
|
302
|
+
circle = 'circle'
|
303
|
+
}
|
304
|
+
|
305
|
+
enum Mode {
|
306
|
+
numeric = 'numeric',
|
307
|
+
alphanumeric = 'alphanumeric',
|
308
|
+
byte = 'byte',
|
309
|
+
kanji = 'kanji',
|
310
|
+
unicode = 'unicode'
|
311
|
+
}
|
312
|
+
|
313
|
+
enum ErrorCorrectionLevel {
|
314
|
+
L = 'L', // 7% error recovery
|
315
|
+
M = 'M', // 15% error recovery
|
316
|
+
Q = 'Q', // 25% error recovery
|
317
|
+
H = 'H' // 30% error recovery
|
318
|
+
}
|
319
|
+
|
320
|
+
enum DotType {
|
321
|
+
dot = 'dot',
|
322
|
+
square = 'square',
|
323
|
+
rounded = 'rounded',
|
324
|
+
extraRounded = 'extra-rounded',
|
325
|
+
classy = 'classy',
|
326
|
+
classyRounded = 'classy-rounded',
|
327
|
+
verticalLine = 'vertical-line',
|
328
|
+
horizontalLine = 'horizontal-line',
|
329
|
+
randomDot = 'random-dot',
|
330
|
+
smallSquare = 'small-square',
|
331
|
+
tinySquare = 'tiny-square',
|
332
|
+
star = 'star',
|
333
|
+
plus = 'plus',
|
334
|
+
diamond = 'diamond'
|
335
|
+
}
|
336
|
+
|
337
|
+
enum CornerSquareType {
|
338
|
+
dot = 'dot',
|
339
|
+
square = 'square',
|
340
|
+
rounded = 'rounded',
|
341
|
+
classy = 'classy',
|
342
|
+
outpoint = 'outpoint',
|
343
|
+
inpoint = 'inpoint'
|
344
|
+
}
|
345
|
+
|
346
|
+
enum CornerDotType {
|
347
|
+
dot = 'dot',
|
348
|
+
square = 'square',
|
349
|
+
heart = 'heart',
|
350
|
+
rounded = 'rounded',
|
351
|
+
classy = 'classy',
|
352
|
+
outpoint = 'outpoint',
|
353
|
+
inpoint = 'inpoint'
|
354
|
+
}
|
355
|
+
|
356
|
+
enum ImageMode {
|
357
|
+
center = 'center',
|
358
|
+
overlay = 'overlay',
|
359
|
+
background = 'background'
|
360
|
+
}
|
361
|
+
```
|
362
|
+
|
363
|
+
---
|
364
|
+
|
365
|
+
### See Also
|
366
|
+
- [QRCode.js Documentation](./documentation.md#start)
|
367
|
+
- [Quick References Guide](./quick-references-guide.md#start)
|
368
|
+
- [API Reference Guide](./api-reference-guide.md#start)
|
369
|
+
- [TypeScript Types and Definitions](./typescript-types-definitions.md#start)
|
370
|
+
- [License Management](./license-management.md#start)
|
371
|
+
- [Basic Examples](./examples.md#start)
|
372
|
+
- [Advanced Examples](./advanced-examples.md#start)
|