@liquid-js/qr-code-styling 1.6.0-rc.4 → 1.6.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.
@@ -1,8 +1,9 @@
1
- import { RequiredOptions } from "../core/QROptions";
2
- export declare const browserImageTools: {
3
- toDataURL(url: string | Buffer | Blob): Promise<string>;
4
- getSize(options: RequiredOptions): Promise<{
5
- width: number;
6
- height: number;
7
- }>;
8
- };
1
+ /// <reference types="node" />
2
+ import { RequiredOptions } from "../core/QROptions";
3
+ export declare const browserImageTools: {
4
+ toDataURL(url: string | Buffer | Blob): Promise<string>;
5
+ getSize(options: RequiredOptions): Promise<{
6
+ width: number;
7
+ height: number;
8
+ }>;
9
+ };
@@ -1,11 +1,11 @@
1
- import { QRCodeStyling } from "../core/QRCodeStyling";
2
- import { CanvasOptions, FileExtension } from "../types";
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
+ import { QRCodeStyling } from "../core/QRCodeStyling";
2
+ import { CanvasOptions, FileExtension } from "../types";
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,15 +1,15 @@
1
- interface ImageSizeOptions {
2
- originalHeight: number;
3
- originalWidth: number;
4
- maxHiddenDots: number;
5
- maxHiddenAxisDots?: number;
6
- dotSize: number;
7
- }
8
- interface ImageSizeResult {
9
- height: number;
10
- width: number;
11
- hideYDots: number;
12
- hideXDots: number;
13
- }
14
- export declare function calculateImageSize({ originalHeight, originalWidth, maxHiddenDots, maxHiddenAxisDots, dotSize }: ImageSizeOptions): ImageSizeResult;
15
- export {};
1
+ interface ImageSizeOptions {
2
+ originalHeight: number;
3
+ originalWidth: number;
4
+ maxHiddenDots: number;
5
+ maxHiddenAxisDots?: number;
6
+ dotSize: number;
7
+ }
8
+ interface ImageSizeResult {
9
+ height: number;
10
+ width: number;
11
+ hideYDots: number;
12
+ hideXDots: number;
13
+ }
14
+ export declare function calculateImageSize({ originalHeight, originalWidth, maxHiddenDots, maxHiddenAxisDots, dotSize }: ImageSizeOptions): ImageSizeResult;
15
+ export {};
@@ -1,2 +1,2 @@
1
- import { Mode } from "../types";
2
- export declare function getMode(data: string): Mode;
1
+ import { Mode } from "../types";
2
+ export declare function getMode(data: string): Mode;
@@ -1,2 +1,2 @@
1
- import { UnknownObject } from "../types";
2
- export declare function mergeDeep(target: UnknownObject, ...sources: UnknownObject[]): UnknownObject;
1
+ import { UnknownObject } from "../types";
2
+ export declare function mergeDeep(target: UnknownObject, ...sources: UnknownObject[]): UnknownObject;
@@ -1,3 +1,3 @@
1
- import { RequiredCanvasOptions, RequiredOptions } from "../core/QROptions";
2
- export declare function sanitizeOptions(options: RequiredOptions): RequiredOptions;
3
- export declare function sanitizeCanvasOptions(options: RequiredCanvasOptions): RequiredCanvasOptions;
1
+ import { RequiredCanvasOptions, RequiredOptions } from "../core/QROptions";
2
+ export declare function sanitizeOptions(options: RequiredOptions): RequiredOptions;
3
+ export declare function sanitizeCanvasOptions(options: RequiredCanvasOptions): RequiredCanvasOptions;
@@ -1,175 +1,175 @@
1
- /// <reference types="node" />
2
- import { browserImageTools } from "../tools/browserImageTools";
3
- export interface UnknownObject {
4
- [key: string]: any;
5
- }
6
- export declare enum DotType {
7
- dots = "dots",
8
- rounded = "rounded",
9
- classy = "classy",
10
- classyRounded = "classy-rounded",
11
- square = "square",
12
- extraRounded = "extra-rounded"
13
- }
14
- export declare enum CornerDotType {
15
- dot = "dot",
16
- square = "square"
17
- }
18
- export declare enum CornerSquareType {
19
- dot = "dot",
20
- square = "square",
21
- extraRounded = "extra-rounded"
22
- }
23
- export declare enum GradientType {
24
- radial = "radial",
25
- linear = "linear"
26
- }
27
- export declare enum ShapeType {
28
- square = "square",
29
- circle = "circle"
30
- }
31
- export declare type Gradient = {
32
- type: GradientType;
33
- rotation?: number;
34
- colorStops: {
35
- offset: number;
36
- color: string;
37
- }[];
38
- };
39
- declare 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;
40
- declare const TypeNumber: {
41
- 0: 0;
42
- 1: 1;
43
- 2: 2;
44
- 10: 10;
45
- 3: 3;
46
- 4: 4;
47
- 5: 5;
48
- 6: 6;
49
- 7: 7;
50
- 8: 8;
51
- 9: 9;
52
- 11: 11;
53
- 12: 12;
54
- 13: 13;
55
- 14: 14;
56
- 15: 15;
57
- 16: 16;
58
- 17: 17;
59
- 18: 18;
60
- 19: 19;
61
- 20: 20;
62
- 21: 21;
63
- 22: 22;
64
- 23: 23;
65
- 24: 24;
66
- 25: 25;
67
- 26: 26;
68
- 27: 27;
69
- 28: 28;
70
- 29: 29;
71
- 30: 30;
72
- 31: 31;
73
- 32: 32;
74
- 33: 33;
75
- 34: 34;
76
- 35: 35;
77
- 36: 36;
78
- 37: 37;
79
- 38: 38;
80
- 39: 39;
81
- 40: 40;
82
- };
83
- export { TypeNumber };
84
- export declare enum ErrorCorrectionLevel {
85
- L = "L",
86
- M = "M",
87
- Q = "Q",
88
- H = "H"
89
- }
90
- export declare enum Mode {
91
- numeric = "Numeric",
92
- alphanumeric = "Alphanumeric",
93
- byte = "Byte",
94
- kanji = "Kanji"
95
- }
96
- export interface QRCode {
97
- addData(data: string, mode?: Mode): void;
98
- make(): void;
99
- getModuleCount(): number;
100
- isDark(row: number, col: number): boolean;
101
- }
102
- export declare type Options = {
103
- document?: Document;
104
- shape?: ShapeType;
105
- width?: number;
106
- height?: number;
107
- data?: string;
108
- image?: string | Buffer | Blob;
109
- imageTools?: typeof browserImageTools;
110
- qrOptions?: {
111
- typeNumber?: TypeNumber;
112
- mode?: Mode;
113
- errorCorrectionLevel?: ErrorCorrectionLevel;
114
- };
115
- imageOptions?: {
116
- hideBackgroundDots?: boolean;
117
- imageSize?: number;
118
- crossOrigin?: string;
119
- margin?: number;
120
- };
121
- dotsOptions?: {
122
- type?: DotType;
123
- color?: string;
124
- gradient?: Gradient;
125
- };
126
- cornersSquareOptions?: {
127
- type?: CornerSquareType;
128
- color?: string;
129
- gradient?: Gradient;
130
- };
131
- cornersDotOptions?: {
132
- type?: CornerDotType;
133
- color?: string;
134
- gradient?: Gradient;
135
- };
136
- backgroundOptions?: {
137
- round?: number;
138
- color?: string;
139
- gradient?: Gradient;
140
- } | false;
141
- };
142
- export declare type CanvasOptions = {
143
- width?: number;
144
- height?: number;
145
- margin?: number;
146
- };
147
- export declare type FilterFunction = (i: number, j: number) => boolean;
148
- export declare type DrawArgs = {
149
- x: number;
150
- y: number;
151
- size: number;
152
- rotation?: number;
153
- getNeighbor?: GetNeighbor;
154
- };
155
- export declare type BasicFigureDrawArgs = {
156
- x: number;
157
- y: number;
158
- size: number;
159
- rotation?: number;
160
- };
161
- export declare type RotateFigureArgs = {
162
- x: number;
163
- y: number;
164
- size: number;
165
- rotation?: number;
166
- draw: () => void;
167
- };
168
- export declare type GetNeighbor = (x: number, y: number) => boolean;
169
- export declare type ExtensionFunction = (svg: SVGElement, options: Options) => void;
170
- export declare enum FileExtension {
171
- svg = "svg",
172
- png = "png",
173
- jpeg = "jpeg",
174
- webp = "webp"
175
- }
1
+ /// <reference types="node" />
2
+ import { browserImageTools } from "../tools/browserImageTools";
3
+ export interface UnknownObject {
4
+ [key: string]: any;
5
+ }
6
+ export declare enum DotType {
7
+ dots = "dots",
8
+ rounded = "rounded",
9
+ classy = "classy",
10
+ classyRounded = "classy-rounded",
11
+ square = "square",
12
+ extraRounded = "extra-rounded"
13
+ }
14
+ export declare enum CornerDotType {
15
+ dot = "dot",
16
+ square = "square"
17
+ }
18
+ export declare enum CornerSquareType {
19
+ dot = "dot",
20
+ square = "square",
21
+ extraRounded = "extra-rounded"
22
+ }
23
+ export declare enum GradientType {
24
+ radial = "radial",
25
+ linear = "linear"
26
+ }
27
+ export declare enum ShapeType {
28
+ square = "square",
29
+ circle = "circle"
30
+ }
31
+ export type Gradient = {
32
+ type: GradientType;
33
+ rotation?: number;
34
+ colorStops: {
35
+ offset: number;
36
+ color: string;
37
+ }[];
38
+ };
39
+ 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;
40
+ declare const TypeNumber: {
41
+ 0: 0;
42
+ 1: 1;
43
+ 2: 2;
44
+ 3: 3;
45
+ 4: 4;
46
+ 5: 5;
47
+ 6: 6;
48
+ 7: 7;
49
+ 8: 8;
50
+ 9: 9;
51
+ 10: 10;
52
+ 11: 11;
53
+ 12: 12;
54
+ 13: 13;
55
+ 14: 14;
56
+ 15: 15;
57
+ 16: 16;
58
+ 17: 17;
59
+ 18: 18;
60
+ 19: 19;
61
+ 20: 20;
62
+ 21: 21;
63
+ 22: 22;
64
+ 23: 23;
65
+ 24: 24;
66
+ 25: 25;
67
+ 26: 26;
68
+ 27: 27;
69
+ 28: 28;
70
+ 29: 29;
71
+ 30: 30;
72
+ 31: 31;
73
+ 32: 32;
74
+ 33: 33;
75
+ 34: 34;
76
+ 35: 35;
77
+ 36: 36;
78
+ 37: 37;
79
+ 38: 38;
80
+ 39: 39;
81
+ 40: 40;
82
+ };
83
+ export { TypeNumber };
84
+ export declare enum ErrorCorrectionLevel {
85
+ L = "L",
86
+ M = "M",
87
+ Q = "Q",
88
+ H = "H"
89
+ }
90
+ export declare enum Mode {
91
+ numeric = "Numeric",
92
+ alphanumeric = "Alphanumeric",
93
+ byte = "Byte",
94
+ kanji = "Kanji"
95
+ }
96
+ export interface QRCode {
97
+ addData(data: string, mode?: Mode): void;
98
+ make(): void;
99
+ getModuleCount(): number;
100
+ isDark(row: number, col: number): boolean;
101
+ }
102
+ export type Options = {
103
+ document?: Document;
104
+ shape?: ShapeType;
105
+ width?: number;
106
+ height?: number;
107
+ data?: string;
108
+ image?: string | Buffer | Blob;
109
+ imageTools?: typeof browserImageTools;
110
+ qrOptions?: {
111
+ typeNumber?: TypeNumber;
112
+ mode?: Mode;
113
+ errorCorrectionLevel?: ErrorCorrectionLevel;
114
+ };
115
+ imageOptions?: {
116
+ hideBackgroundDots?: boolean;
117
+ imageSize?: number;
118
+ crossOrigin?: string;
119
+ margin?: number;
120
+ };
121
+ dotsOptions?: {
122
+ type?: DotType;
123
+ color?: string;
124
+ gradient?: Gradient;
125
+ };
126
+ cornersSquareOptions?: {
127
+ type?: CornerSquareType;
128
+ color?: string;
129
+ gradient?: Gradient;
130
+ };
131
+ cornersDotOptions?: {
132
+ type?: CornerDotType;
133
+ color?: string;
134
+ gradient?: Gradient;
135
+ };
136
+ backgroundOptions?: {
137
+ round?: number;
138
+ color?: string;
139
+ gradient?: Gradient;
140
+ } | false;
141
+ };
142
+ export type CanvasOptions = {
143
+ width?: number;
144
+ height?: number;
145
+ margin?: number;
146
+ };
147
+ export type FilterFunction = (i: number, j: number) => boolean;
148
+ export type DrawArgs = {
149
+ x: number;
150
+ y: number;
151
+ size: number;
152
+ rotation?: number;
153
+ getNeighbor?: GetNeighbor;
154
+ };
155
+ export type BasicFigureDrawArgs = {
156
+ x: number;
157
+ y: number;
158
+ size: number;
159
+ rotation?: number;
160
+ };
161
+ export type RotateFigureArgs = {
162
+ x: number;
163
+ y: number;
164
+ size: number;
165
+ rotation?: number;
166
+ draw: () => void;
167
+ };
168
+ export type GetNeighbor = (x: number, y: number) => boolean;
169
+ export type ExtensionFunction = (svg: SVGElement, options: Options) => void;
170
+ export declare enum FileExtension {
171
+ svg = "svg",
172
+ png = "png",
173
+ jpeg = "jpeg",
174
+ webp = "webp"
175
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liquid-js/qr-code-styling",
3
- "version": "1.6.0-rc.4",
3
+ "version": "1.6.1",
4
4
  "description": "Add a style and an image to your QR code",
5
5
  "main": "lib/qr-code-styling-node.js",
6
6
  "browser": "lib/qr-code-styling-node.js",
@@ -10,42 +10,42 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "file-type": "<17.0.0",
13
- "jsdom": "^19.0.0",
13
+ "jsdom": "^22.1.0",
14
14
  "node-fetch": "<3.0.0",
15
15
  "qrcode-generator": "^1.4.4",
16
- "sharp": "^0.30.4"
16
+ "sharp": "^0.32.1"
17
17
  },
18
18
  "devDependencies": {
19
- "@rollup/plugin-commonjs": "^22.0.0",
20
- "@rollup/plugin-typescript": "^8.3.2",
21
- "@types/jsdom": "^16.2.14",
22
- "@types/node": "^17.0.31",
23
- "@types/node-fetch": "^2.6.1",
24
- "@types/sharp": "^0.30.2",
25
- "@typescript-eslint/eslint-plugin": "^5.22.0",
26
- "@typescript-eslint/parser": "^5.22.0",
27
- "canvas": "^2.9.1",
19
+ "@rollup/plugin-commonjs": "^25.0.1",
20
+ "@rollup/plugin-typescript": "^11.1.1",
21
+ "@types/jsdom": "^21.1.1",
22
+ "@types/node": "<19.0.0",
23
+ "@types/node-fetch": "^2.6.4",
24
+ "@types/sharp": "^0.31.1",
25
+ "@typescript-eslint/eslint-plugin": "^5.59.9",
26
+ "@typescript-eslint/parser": "^5.59.9",
27
+ "canvas": "^2.11.2",
28
28
  "clean-webpack-plugin": "^4.0.0",
29
- "eslint": "^8.14.0",
30
- "eslint-config-prettier": "^8.5.0",
31
- "eslint-plugin-jest": "^26.1.5",
32
- "eslint-plugin-prettier": "^4.0.0",
33
- "eslint-webpack-plugin": "^3.1.1",
34
- "html-webpack-plugin": "^5.5.0",
35
- "jest": "^28.0.3",
36
- "jest-environment-jsdom": "^28.0.2",
37
- "prettier": "^2.6.2",
38
- "rollup": "^2.72.0",
39
- "ts-jest": "^28.0.1",
40
- "ts-loader": "^9.3.0",
41
- "typescript": "^4.6.4",
42
- "webpack": "^5.72.0",
43
- "webpack-cli": "^4.9.2",
44
- "webpack-dev-server": "^4.9.0",
45
- "webpack-merge": "^5.8.0"
29
+ "eslint": "^8.42.0",
30
+ "eslint-config-prettier": "^8.8.0",
31
+ "eslint-plugin-jest": "^27.2.1",
32
+ "eslint-plugin-prettier": "^4.2.1",
33
+ "eslint-webpack-plugin": "^4.0.1",
34
+ "html-webpack-plugin": "^5.5.3",
35
+ "jest": "^29.5.0",
36
+ "jest-environment-jsdom": "^29.5.0",
37
+ "prettier": "^2.8.8",
38
+ "rollup": "^3.25.0",
39
+ "ts-jest": "^29.1.0",
40
+ "ts-loader": "^9.4.3",
41
+ "typescript": "^5.1.3",
42
+ "webpack": "^5.86.0",
43
+ "webpack-cli": "^5.1.4",
44
+ "webpack-dev-server": "^4.15.1",
45
+ "webpack-merge": "^5.9.0"
46
46
  },
47
47
  "scripts": {
48
- "build": "webpack --mode=production --config webpack.config.build.js && rollup -c rollup.config.js",
48
+ "build": "webpack --mode=production --config webpack.config.build.js && rollup -c rollup.config.mjs",
49
49
  "build:dev": "webpack --mode=development --config webpack.config.build.js",
50
50
  "test": "jest",
51
51
  "start": "webpack serve --open --config webpack.config.dev-server.js",