@liquid-js/qr-code-styling 3.0.0-2 → 3.0.0-4

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.
Files changed (34) hide show
  1. package/README.md +1 -2
  2. package/lib/core/{QRCodeStyling.d.ts → qr-code-styling.d.ts} +16 -22
  3. package/lib/core/qr-svg.d.ts +31 -0
  4. package/lib/figures/corner-dot.d.ts +24 -0
  5. package/lib/figures/corner-square.d.ts +22 -0
  6. package/lib/figures/dot.d.ts +28 -0
  7. package/lib/index.d.ts +9 -5
  8. package/lib/kanji.js +1 -1
  9. package/lib/kanji.js.map +1 -1
  10. package/lib/node.d.ts +13 -6
  11. package/lib/qr-code-styling-node.js +891 -1539
  12. package/lib/qr-code-styling-node.js.map +1 -1
  13. package/lib/qr-code-styling.js +1 -1
  14. package/lib/qr-code-styling.js.map +1 -1
  15. package/lib/tools/{browserImageTools.d.ts → browser-image-tools.d.ts} +1 -2
  16. package/lib/tools/browser-utils.d.ts +18 -0
  17. package/lib/types/helper.d.ts +23 -0
  18. package/lib/types/qrcode.d.ts +64 -0
  19. package/lib/utils/canvas-options.d.ts +7 -0
  20. package/lib/utils/gradient.d.ts +26 -0
  21. package/lib/{tools → utils}/merge.d.ts +3 -1
  22. package/lib/{types/index.d.ts → utils/options.d.ts} +29 -151
  23. package/lib/{constants/errorCorrectionPercents.d.ts → utils/qrcode.d.ts} +2 -0
  24. package/lib/utils/svg.d.ts +2 -0
  25. package/package.json +1 -1
  26. package/lib/core/QROptions.d.ts +0 -32
  27. package/lib/core/QRSVG.d.ts +0 -58
  28. package/lib/figures/cornerDot/QRCornerDot.d.ts +0 -27
  29. package/lib/figures/cornerSquare/QRCornerSquare.d.ts +0 -25
  30. package/lib/figures/dot/QRDot.d.ts +0 -31
  31. package/lib/tools/browserUtils.d.ts +0 -11
  32. package/lib/tools/getMode.d.ts +0 -2
  33. package/lib/tools/sanitizeOptions.d.ts +0 -3
  34. /package/lib/{tools/calculateImageSize.d.ts → utils/image.d.ts} +0 -0
@@ -1,8 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { Options } from "../types/index.js";
3
2
  export declare const browserImageTools: {
4
3
  toDataURL(url: string | Buffer | Blob): Promise<string>;
5
- getSize(options: Options): Promise<{
4
+ getSize(src: string | Blob | Buffer, crossOrigin?: string): Promise<{
6
5
  width: number;
7
6
  height: number;
8
7
  }>;
@@ -0,0 +1,18 @@
1
+ import { QRCodeStyling } from "../core/qr-code-styling.js";
2
+ import { RecursivePartial } from "../types/helper.js";
3
+ import { CanvasOptions } from "../utils/canvas-options.js";
4
+ export declare enum FileExtension {
5
+ svg = "svg",
6
+ png = "png",
7
+ jpeg = "jpeg",
8
+ webp = "webp"
9
+ }
10
+ export declare function drawToCanvas(qrCode: QRCodeStyling, options?: RecursivePartial<CanvasOptions>): {
11
+ canvas: HTMLCanvasElement;
12
+ canvasDrawingPromise: Promise<void> | undefined;
13
+ } | undefined;
14
+ export declare function download(qrCode: QRCodeStyling, downloadOptions: `${FileExtension}` | {
15
+ name?: string;
16
+ extension: `${FileExtension}`;
17
+ }, options?: RecursivePartial<CanvasOptions>): Promise<void>;
18
+ export declare function downloadURI(uri: string, name: string): void;
@@ -0,0 +1,23 @@
1
+ export type RecursivePartial<T> = {
2
+ [P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object | undefined ? RecursivePartial<T[P]> : T[P];
3
+ };
4
+ export type DrawArgs = {
5
+ x: number;
6
+ y: number;
7
+ size: number;
8
+ rotation?: number;
9
+ getNeighbor?: (x: number, y: number) => boolean;
10
+ };
11
+ export type BasicFigureDrawArgs = {
12
+ x: number;
13
+ y: number;
14
+ size: number;
15
+ rotation?: number;
16
+ };
17
+ export type RotateFigureArgs = {
18
+ x: number;
19
+ y: number;
20
+ size: number;
21
+ rotation?: number;
22
+ draw: () => void;
23
+ };
@@ -0,0 +1,64 @@
1
+ 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;
2
+ declare const TypeNumber: {
3
+ 0: 0;
4
+ 1: 1;
5
+ 2: 2;
6
+ 3: 3;
7
+ 4: 4;
8
+ 5: 5;
9
+ 6: 6;
10
+ 7: 7;
11
+ 8: 8;
12
+ 9: 9;
13
+ 10: 10;
14
+ 11: 11;
15
+ 12: 12;
16
+ 13: 13;
17
+ 14: 14;
18
+ 15: 15;
19
+ 16: 16;
20
+ 17: 17;
21
+ 18: 18;
22
+ 19: 19;
23
+ 20: 20;
24
+ 21: 21;
25
+ 22: 22;
26
+ 23: 23;
27
+ 24: 24;
28
+ 25: 25;
29
+ 26: 26;
30
+ 27: 27;
31
+ 28: 28;
32
+ 29: 29;
33
+ 30: 30;
34
+ 31: 31;
35
+ 32: 32;
36
+ 33: 33;
37
+ 34: 34;
38
+ 35: 35;
39
+ 36: 36;
40
+ 37: 37;
41
+ 38: 38;
42
+ 39: 39;
43
+ 40: 40;
44
+ };
45
+ export { TypeNumber };
46
+ export declare enum ErrorCorrectionLevel {
47
+ L = "L",
48
+ M = "M",
49
+ Q = "Q",
50
+ H = "H"
51
+ }
52
+ export declare enum Mode {
53
+ numeric = "Numeric",
54
+ alphanumeric = "Alphanumeric",
55
+ byte = "Byte",
56
+ kanji = "Kanji",
57
+ unicode = "Unicode"
58
+ }
59
+ export interface QRCode {
60
+ addData(data: string, mode?: Mode.alphanumeric | Mode.byte | Mode.kanji | Mode.numeric): void;
61
+ make(): void;
62
+ getModuleCount(): number;
63
+ isDark(row: number, col: number): boolean;
64
+ }
@@ -0,0 +1,7 @@
1
+ export interface CanvasOptions {
2
+ width: number;
3
+ height: number;
4
+ margin: number;
5
+ }
6
+ export declare const defaultCanvasOptions: CanvasOptions;
7
+ export declare function sanitizeCanvasOptions(options: CanvasOptions): CanvasOptions;
@@ -0,0 +1,26 @@
1
+ export declare enum GradientType {
2
+ radial = "radial",
3
+ linear = "linear"
4
+ }
5
+ export type Gradient = {
6
+ /**
7
+ * Type of gradient spread
8
+ *
9
+ * @default GradientType.linear
10
+ */
11
+ type: `${GradientType}`;
12
+ /**
13
+ * Rotation of gradient (in radians, Math.PI === 180 degrees)
14
+ *
15
+ * @default 0
16
+ */
17
+ rotation?: number;
18
+ /** Gradient colors. */
19
+ colorStops: {
20
+ /** Position of color in gradient range */
21
+ offset: number;
22
+ /** Color of stop in gradient range */
23
+ color: string;
24
+ }[];
25
+ };
26
+ export declare function sanitizeGradient(gradient: Gradient): Gradient;
@@ -1,2 +1,4 @@
1
- import { UnknownObject } from "../types/index.js";
1
+ export type UnknownObject = {
2
+ [key: string]: any;
3
+ } | undefined;
2
4
  export declare function mergeDeep(target: UnknownObject, ...sources: UnknownObject[]): UnknownObject;
@@ -1,14 +1,13 @@
1
1
  /// <reference types="node" />
2
- import { browserImageTools } from "../tools/browserImageTools.js";
3
- export interface UnknownObject {
4
- [key: string]: any;
5
- }
2
+ import { browserImageTools } from "../tools/browser-image-tools.js";
3
+ import { ErrorCorrectionLevel, TypeNumber } from "../types/qrcode.js";
4
+ import { Gradient } from "./gradient.js";
6
5
  export declare enum DotType {
7
- dots = "dots",
8
- randomDots = "random-dots",
6
+ dot = "dot",
7
+ randomDot = "random-dot",
9
8
  rounded = "rounded",
10
- verticalLines = "vertical-lines",
11
- horizontalLines = "horizontal-lines",
9
+ verticalLine = "vertical-line",
10
+ horizontalLine = "horizontal-line",
12
11
  classy = "classy",
13
12
  classyRounded = "classy-rounded",
14
13
  square = "square",
@@ -33,110 +32,21 @@ export declare enum CornerSquareType {
33
32
  outpoint = "outpoint",
34
33
  inpoint = "inpoint"
35
34
  }
36
- export declare enum GradientType {
37
- radial = "radial",
38
- linear = "linear"
39
- }
40
35
  export declare enum ShapeType {
41
36
  square = "square",
42
37
  circle = "circle"
43
38
  }
44
- export type Gradient = {
45
- /**
46
- * Type of gradient spread
47
- *
48
- * @default GradientType.linear
49
- */
50
- type: GradientType;
51
- /**
52
- * Rotation of gradient (in radians, Math.PI === 180 degrees)
53
- *
54
- * @default 0
55
- */
56
- rotation?: number;
57
- /** Gradient colors. */
58
- colorStops: {
59
- /** Position of color in gradient range */
60
- offset: number;
61
- /** Color of stop in gradient range */
62
- color: string;
63
- }[];
64
- };
65
- 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;
66
- declare const TypeNumber: {
67
- 0: 0;
68
- 1: 1;
69
- 2: 2;
70
- 3: 3;
71
- 4: 4;
72
- 5: 5;
73
- 6: 6;
74
- 7: 7;
75
- 8: 8;
76
- 9: 9;
77
- 10: 10;
78
- 11: 11;
79
- 12: 12;
80
- 13: 13;
81
- 14: 14;
82
- 15: 15;
83
- 16: 16;
84
- 17: 17;
85
- 18: 18;
86
- 19: 19;
87
- 20: 20;
88
- 21: 21;
89
- 22: 22;
90
- 23: 23;
91
- 24: 24;
92
- 25: 25;
93
- 26: 26;
94
- 27: 27;
95
- 28: 28;
96
- 29: 29;
97
- 30: 30;
98
- 31: 31;
99
- 32: 32;
100
- 33: 33;
101
- 34: 34;
102
- 35: 35;
103
- 36: 36;
104
- 37: 37;
105
- 38: 38;
106
- 39: 39;
107
- 40: 40;
108
- };
109
- export { TypeNumber };
110
- export declare enum ErrorCorrectionLevel {
111
- L = "L",
112
- M = "M",
113
- Q = "Q",
114
- H = "H"
115
- }
116
- export declare enum Mode {
117
- numeric = "Numeric",
118
- alphanumeric = "Alphanumeric",
119
- byte = "Byte",
120
- kanji = "Kanji",
121
- unicode = "Unicode"
122
- }
123
- export interface QRCode {
124
- addData(data: string, mode?: Mode.alphanumeric | Mode.byte | Mode.kanji | Mode.numeric): void;
125
- make(): void;
126
- getModuleCount(): number;
127
- isDark(row: number, col: number): boolean;
128
- }
129
- export type Options = {
39
+ export interface Options {
130
40
  /** Use a custom DOM domplementation */
131
- document?: Document;
41
+ document: Document;
132
42
  /** Use a custom image fetching & serializaton implementation */
133
43
  imageTools?: typeof browserImageTools;
134
44
  /** @ignore */
135
- width?: number;
45
+ width: number;
136
46
  /** @ignore */
137
- height?: number;
47
+ height: number;
138
48
  /** The data will be encoded in the QR code */
139
- data?: string;
49
+ data: string;
140
50
  /** The image will be copied to the center of the QR code */
141
51
  image?: string | Buffer | Blob;
142
52
  /**
@@ -144,51 +54,51 @@ export type Options = {
144
54
  *
145
55
  * @default ShapeType.square
146
56
  */
147
- shape?: ShapeType;
57
+ shape: `${ShapeType}`;
148
58
  /** Options will be passed to `qrcode-generator` lib */
149
- qrOptions?: {
150
- typeNumber?: TypeNumber;
151
- mode?: Mode;
59
+ qrOptions: {
60
+ typeNumber: TypeNumber;
61
+ mode?: `${Mode}`;
152
62
  /** @default ErrorCorrectionLevel.Q */
153
- errorCorrectionLevel?: ErrorCorrectionLevel;
63
+ errorCorrectionLevel: `${ErrorCorrectionLevel}`;
154
64
  };
155
- imageOptions?: {
65
+ imageOptions: {
156
66
  /**
157
67
  * Hide all dots covered by the image
158
68
  *
159
69
  * @default true
160
70
  */
161
- hideBackgroundDots?: boolean;
71
+ hideBackgroundDots: boolean;
162
72
  /**
163
73
  * Coefficient of the image size
164
74
  *
165
75
  * @default 0.4
166
76
  */
167
- imageSize?: number;
77
+ imageSize: number;
168
78
  /**
169
79
  * Margin of the image (in blocks)
170
80
  *
171
81
  * @default 0
172
82
  */
173
- margin?: number;
83
+ margin: number;
174
84
  /**
175
85
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLImageElement/crossOrigin)
176
86
  */
177
87
  crossOrigin?: string;
178
88
  };
179
- dotsOptions?: {
89
+ dotsOptions: {
180
90
  /**
181
91
  * QR dot size (in pixels)
182
92
  *
183
93
  * @default 10
184
94
  */
185
- size?: number;
95
+ size: number;
186
96
  /**
187
97
  * Color of QR dots
188
98
  *
189
99
  * @default "#000"
190
100
  */
191
- color?: string;
101
+ color: string;
192
102
  /** Gradient of QR dots */
193
103
  gradient?: Gradient;
194
104
  /**
@@ -196,7 +106,7 @@ export type Options = {
196
106
  *
197
107
  * @default DotType.square
198
108
  */
199
- type?: DotType;
109
+ type: `${DotType}`;
200
110
  };
201
111
  /** Corners Square options, omitted values match dots */
202
112
  cornersSquareOptions?: {
@@ -205,7 +115,7 @@ export type Options = {
205
115
  /** Gradient of Corners Square */
206
116
  gradient?: Gradient;
207
117
  /** Style of Corners Square */
208
- type?: CornerSquareType;
118
+ type?: `${CornerSquareType}`;
209
119
  };
210
120
  /** Corners Dot options, omitted values match squares */
211
121
  cornersDotOptions?: {
@@ -214,7 +124,7 @@ export type Options = {
214
124
  /** Gradient of Corners Dot */
215
125
  gradient?: Gradient;
216
126
  /** Style of Corners Dot */
217
- type?: CornerDotType;
127
+ type?: `${CornerDotType}`;
218
128
  };
219
129
  /** QR background styling options, false to disable background */
220
130
  backgroundOptions?: {
@@ -235,38 +145,6 @@ export type Options = {
235
145
  stringToBytesFuncs?: {
236
146
  [encoding: string]: (s: string) => number[];
237
147
  };
238
- };
239
- export type CanvasOptions = {
240
- width?: number;
241
- height?: number;
242
- margin?: number;
243
- };
244
- export type FilterFunction = (i: number, j: number) => boolean;
245
- export type DrawArgs = {
246
- x: number;
247
- y: number;
248
- size: number;
249
- rotation?: number;
250
- getNeighbor?: GetNeighbor;
251
- };
252
- export type BasicFigureDrawArgs = {
253
- x: number;
254
- y: number;
255
- size: number;
256
- rotation?: number;
257
- };
258
- export type RotateFigureArgs = {
259
- x: number;
260
- y: number;
261
- size: number;
262
- rotation?: number;
263
- draw: () => void;
264
- };
265
- export type GetNeighbor = (x: number, y: number) => boolean;
266
- export type ExtensionFunction = (svg: SVGElement, options: Options) => void;
267
- export declare enum FileExtension {
268
- svg = "svg",
269
- png = "png",
270
- jpeg = "jpeg",
271
- webp = "webp"
272
148
  }
149
+ export declare const defaultOptions: Options;
150
+ export declare function sanitizeOptions(options: Options): Options;
@@ -1,6 +1,8 @@
1
+ import { Mode } from "../types/qrcode.js";
1
2
  export declare const ErrorCorrectionPercents: {
2
3
  L: number;
3
4
  M: number;
4
5
  Q: number;
5
6
  H: number;
6
7
  };
8
+ export declare function getMode(data: string): Mode;
@@ -0,0 +1,2 @@
1
+ export declare function numToAttr(value: number): string;
2
+ export declare function svgPath(strings: TemplateStringsArray, ...values: unknown[]): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liquid-js/qr-code-styling",
3
- "version": "3.0.0-2",
3
+ "version": "3.0.0-4",
4
4
  "description": "Generate styled QR codes on web or in Node",
5
5
  "type": "module",
6
6
  "main": "./lib/qr-code-styling-node.js",
@@ -1,32 +0,0 @@
1
- import { CanvasOptions, DotType, ErrorCorrectionLevel, Gradient, Mode, Options, ShapeType, TypeNumber } from "../types/index.js";
2
- export interface RequiredOptions extends Options {
3
- document: Document;
4
- shape: ShapeType;
5
- width: number;
6
- height: number;
7
- data: string;
8
- qrOptions: {
9
- typeNumber: TypeNumber;
10
- mode?: Mode;
11
- errorCorrectionLevel: ErrorCorrectionLevel;
12
- };
13
- imageOptions: {
14
- hideBackgroundDots: boolean;
15
- imageSize: number;
16
- crossOrigin?: string;
17
- margin: number;
18
- };
19
- dotsOptions: {
20
- type: DotType;
21
- color: string;
22
- gradient?: Gradient;
23
- size: number;
24
- };
25
- }
26
- export declare const defaultOptions: RequiredOptions;
27
- export interface RequiredCanvasOptions extends CanvasOptions {
28
- width: number;
29
- height: number;
30
- margin: number;
31
- }
32
- export declare const defaultCanvasOptions: RequiredCanvasOptions;
@@ -1,58 +0,0 @@
1
- import { FilterFunction, Gradient, QRCode } from "../types/index.js";
2
- import { RequiredOptions } from "./QROptions.js";
3
- export declare class QRSVG {
4
- /** @ignore */
5
- _element: SVGElement;
6
- /** @ignore */
7
- _defs: SVGElement;
8
- /** @ignore */
9
- _backgroundMask?: SVGElement;
10
- /** @ignore */
11
- _backgroundMaskGroup?: SVGElement;
12
- /** @ignore */
13
- _dotsMask?: SVGElement;
14
- /** @ignore */
15
- _dotsMaskGroup?: SVGElement;
16
- /** @ignore */
17
- _cornersSquareMask?: SVGElement;
18
- /** @ignore */
19
- _cornersSquareMaskGroup?: SVGElement;
20
- /** @ignore */
21
- _cornersDotMask?: SVGElement;
22
- /** @ignore */
23
- _cornersDotMaskGroup?: SVGElement;
24
- /** @ignore */
25
- _options: RequiredOptions;
26
- /** @ignore */
27
- _qr?: QRCode;
28
- /** @ignore */
29
- _document: Document;
30
- /** @ignore */
31
- private _imageTools;
32
- constructor(options: RequiredOptions);
33
- get width(): number;
34
- get height(): number;
35
- getElement(): SVGElement;
36
- drawQR(qr: QRCode): Promise<void>;
37
- drawBackground(): void;
38
- drawDots(filter?: FilterFunction): void;
39
- drawCorners(): void;
40
- drawImage({ width, height, count, dotSize }: {
41
- width: number;
42
- height: number;
43
- count: number;
44
- dotSize: number;
45
- }): Promise<void>;
46
- /** @ignore */
47
- _createColor({ options, color, additionalRotation, x, y, height, width, name }: {
48
- options?: Gradient;
49
- color?: string;
50
- additionalRotation: number;
51
- x: number;
52
- y: number;
53
- height: number;
54
- width: number;
55
- name: string;
56
- }): void;
57
- _createMask(id: string): (SVGGElement | SVGMaskElement)[];
58
- }
@@ -1,27 +0,0 @@
1
- import { BasicFigureDrawArgs, CornerDotType, DrawArgs, RotateFigureArgs } from "../../types/index.js";
2
- export declare class QRCornerDot {
3
- _element?: SVGElement;
4
- _svg: SVGElement;
5
- _type: CornerDotType;
6
- _document: Document;
7
- constructor({ svg, type, document }: {
8
- svg: SVGElement;
9
- type: CornerDotType;
10
- document: Document;
11
- });
12
- draw(x: number, y: number, size: number, rotation: number): void;
13
- _rotateFigure({ x, y, size, rotation, draw }: RotateFigureArgs): void;
14
- _basicDot(args: BasicFigureDrawArgs): void;
15
- _basicSquare(args: BasicFigureDrawArgs): void;
16
- _basicHeart(args: BasicFigureDrawArgs): void;
17
- _basicRounded(args: BasicFigureDrawArgs): void;
18
- _basicClassy(args: BasicFigureDrawArgs): void;
19
- _basicInpoint(args: BasicFigureDrawArgs): void;
20
- _drawDot({ x, y, size, rotation }: DrawArgs): void;
21
- _drawSquare({ x, y, size, rotation }: DrawArgs): void;
22
- _drawHeart({ x, y, size, rotation }: DrawArgs): void;
23
- _drawRounded({ x, y, size, rotation }: DrawArgs): void;
24
- _drawClassy({ x, y, size, rotation }: DrawArgs): void;
25
- _drawInpoint({ x, y, size, rotation }: DrawArgs): void;
26
- _drawOutpoint({ x, y, size, rotation }: DrawArgs): void;
27
- }
@@ -1,25 +0,0 @@
1
- import { CornerSquareType, DrawArgs, BasicFigureDrawArgs, RotateFigureArgs } from "../../types/index.js";
2
- export declare class QRCornerSquare {
3
- _element?: SVGElement;
4
- _svg: SVGElement;
5
- _type: CornerSquareType;
6
- _document: Document;
7
- constructor({ svg, type, document }: {
8
- svg: SVGElement;
9
- type: CornerSquareType;
10
- document: Document;
11
- });
12
- draw(x: number, y: number, size: number, rotation: number): void;
13
- _rotateFigure({ x, y, size, rotation, draw }: RotateFigureArgs): void;
14
- _basicDot(args: BasicFigureDrawArgs): void;
15
- _basicSquare(args: BasicFigureDrawArgs): void;
16
- _basicExtraRounded(args: BasicFigureDrawArgs): void;
17
- _basicClassy(args: BasicFigureDrawArgs): void;
18
- _basicInpoint(args: BasicFigureDrawArgs): void;
19
- _drawDot({ x, y, size, rotation }: DrawArgs): void;
20
- _drawSquare({ x, y, size, rotation }: DrawArgs): void;
21
- _drawExtraRounded({ x, y, size, rotation }: DrawArgs): void;
22
- _drawClassy({ x, y, size, rotation }: DrawArgs): void;
23
- _drawInpoint({ x, y, size, rotation }: DrawArgs): void;
24
- _drawOutpoint({ x, y, size, rotation }: DrawArgs): void;
25
- }
@@ -1,31 +0,0 @@
1
- import { DotType, GetNeighbor, DrawArgs, BasicFigureDrawArgs, RotateFigureArgs } from "../../types/index.js";
2
- export declare class QRDot {
3
- _element?: SVGElement;
4
- _svg: SVGElement;
5
- _type: DotType;
6
- _document: Document;
7
- constructor({ svg, type, document }: {
8
- svg: SVGElement;
9
- type: DotType;
10
- document: Document;
11
- });
12
- draw(x: number, y: number, size: number, getNeighbor: GetNeighbor): void;
13
- _rotateFigure({ x, y, size, rotation, draw }: RotateFigureArgs): void;
14
- _basicDot(args: BasicFigureDrawArgs): void;
15
- _basicSquare(args: BasicFigureDrawArgs): void;
16
- _basicSideRounded(args: BasicFigureDrawArgs): void;
17
- _basicCornerRounded(args: BasicFigureDrawArgs): void;
18
- _basicCornerExtraRounded(args: BasicFigureDrawArgs): void;
19
- _basicCornersRounded(args: BasicFigureDrawArgs): void;
20
- _drawDot({ x, y, size }: DrawArgs): void;
21
- _drawRandomDot({ x, y, size }: DrawArgs): void;
22
- _drawSquare({ x, y, size }: DrawArgs): void;
23
- _drawSmallSquare({ x, y, size }: DrawArgs): void;
24
- _drawDiamond({ x, y, size }: DrawArgs): void;
25
- _drawRounded({ x, y, size, getNeighbor }: DrawArgs): void;
26
- _drawVerticalLines({ x, y, size, getNeighbor }: DrawArgs): void;
27
- _drawHorizontalLines({ x, y, size, getNeighbor }: DrawArgs): void;
28
- _drawExtraRounded({ x, y, size, getNeighbor }: DrawArgs): void;
29
- _drawClassy({ x, y, size, getNeighbor }: DrawArgs): void;
30
- _drawClassyRounded({ x, y, size, getNeighbor }: DrawArgs): void;
31
- }
@@ -1,11 +0,0 @@
1
- import { QRCodeStyling } from "../core/QRCodeStyling.js";
2
- import { CanvasOptions, FileExtension } from "../types/index.js";
3
- export declare function drawToCanvas(qrCode: QRCodeStyling, options?: CanvasOptions): {
4
- canvas: HTMLCanvasElement;
5
- canvasDrawingPromise: Promise<void> | undefined;
6
- } | undefined;
7
- export declare function download(qrCode: QRCodeStyling, downloadOptions: FileExtension | {
8
- name?: string;
9
- extension: FileExtension;
10
- }, options?: CanvasOptions): Promise<void>;
11
- export declare function downloadURI(uri: string, name: string): void;
@@ -1,2 +0,0 @@
1
- import { Mode } from "../types/index.js";
2
- export declare function getMode(data: string): Mode;
@@ -1,3 +0,0 @@
1
- import { RequiredCanvasOptions, RequiredOptions } from "../core/QROptions.js";
2
- export declare function sanitizeOptions(options: RequiredOptions): RequiredOptions;
3
- export declare function sanitizeCanvasOptions(options: RequiredCanvasOptions): RequiredCanvasOptions;