-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathqrcode.d.mts
More file actions
87 lines (62 loc) · 2.87 KB
/
Copy pathqrcode.d.mts
File metadata and controls
87 lines (62 loc) · 2.87 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
export interface GenerateOptions {
/** 0 to 3 */
errorCorrectionLevel?: number
/** default true, to maximize the error-correction level within the chosen output size */
optimizeEcc?: boolean
/** 1 to 40 */
minVersion?: number
/** 1 to 40 */
maxVersion?: number
/** 0 to 7 */
maskPattern?: number
/** boolean flag to invert the code, not as widely supported */
invert?: boolean
/** the size, in modules, of the quiet area around the code */
quiet?: number
}
export type RenderMode = 'large' | 'medium' | 'compact' | 'svg' | 'bmp' | 'svg-uri' | 'bmp-uri' | 'sixel'
export type RenderOptions = SvgRenderOptions | BmpRenderOptions | SixelRenderOptions | PngRenderOptions
export interface SvgRenderOptions {
/** (svg / svg-uri / png) the CSS color of each module (default: 'currentColor') */
color?: string
/** (svg / svg-uri) the unit dimensions of each module */
moduleSize?: number
/** (svg / svg-uri) output the non-set modules (otherwise will be transparent background) */
white?: boolean
/** (svg / svg-uri / png) proportion of how rounded the modules are */
moduleRound?: number
/** (svg / svg-uri / png) to hide the standard finder modules and instead output a shape with the specified roundness */
finderRound?: number
/** (svg / svg-uri / png) to hide the standard alignment modules and instead output a shape with the specified roundness */
alignmentRound?: number
}
export interface BmpRenderOptions {
/** (bmp / bmp-uri) for the size of a module */
scale?: number
/** (bmp / bmp-uri) to use a transparent background */
alpha?: boolean
/** (bmp / bmp-uri) can set a specific image size (rather than scaling the matrix dimensions) */
width?: boolean
/** (bmp / bmp-uri) can set a specific image size (rather than scaling the matrix dimensions) */
height?: boolean
}
export interface SixelRenderOptions {
/** (sixel) for the size of a module */
scale?: number
}
export interface PngRenderOptions extends SvgRenderOptions {
/** (png) the width and height of the generated image */
size: number
/** (png) the CSS color to draw behind the code */
background: string
}
export class Matrix {}
export default class QrCode {
static generate(data: string, options?: GenerateOptions): Matrix
static render(mode: 'large' | 'medium' | 'compact' | 'tiny', matrix: Matrix, options?: RenderOptions): string
static render(mode: 'svg' | 'svg-uri', matrix: Matrix, options?: SvgRenderOptions): string
static render(mode: 'bmp', matrix: Matrix, options?: BmpRenderOptions): Uint8Array
static render(mode: 'bmp-uri', matrix: Matrix, options?: BmpRenderOptions): string
static render(mode: 'sixel', matrix: Matrix, options?: SixelRenderOptions): string
static render(mode: 'png', matrix: Matrix, options?: PngRenderOptions): Promise<Blob>
}