@liquid-js/qr-code-styling 3.1.3 → 4.0.0-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,5 +1,5 @@
1
+ import { ErrorCorrectionLevel, Mode, TypeNumber } from "@liquid-js/qrcode-generator/lib/qrcode/QRCodeMinimal.js";
1
2
  import { browserImageTools } from "../tools/browser-image-tools.js";
2
- import { ErrorCorrectionLevel, TypeNumber } from "../types/qrcode.js";
3
3
  import { Gradient } from "./gradient.js";
4
4
  export declare enum DotType {
5
5
  dot = "dot",
@@ -12,6 +12,7 @@ export declare enum DotType {
12
12
  classyRounded = "classy-rounded",
13
13
  square = "square",
14
14
  smallSquare = "small-square",
15
+ tinySquare = "tiny-square",
15
16
  diamond = "diamond"
16
17
  }
17
18
  export declare enum CornerDotType {
@@ -35,6 +36,16 @@ export declare enum ShapeType {
35
36
  square = "square",
36
37
  circle = "circle"
37
38
  }
39
+ export declare enum ImageMode {
40
+ /**
41
+ * Place image in the center of the code
42
+ */
43
+ center = "center",
44
+ /**
45
+ * Use image as background, draw dots over it
46
+ */
47
+ background = "background"
48
+ }
38
49
  export interface Options {
39
50
  /** Use a custom DOM domplementation */
40
51
  document: Document;
@@ -54,7 +65,7 @@ export interface Options {
54
65
  * @default ShapeType.square
55
66
  */
56
67
  shape: `${ShapeType}`;
57
- /** Options will be passed to `qrcode-generator` lib */
68
+ /** Options will be passed to `@liquid-js/qrcode-generator` lib */
58
69
  qrOptions: {
59
70
  typeNumber: TypeNumber;
60
71
  mode?: `${Mode}`;
@@ -63,11 +74,24 @@ export interface Options {
63
74
  };
64
75
  imageOptions: {
65
76
  /**
66
- * Hide all dots covered by the image
77
+ * Image mode
67
78
  *
68
- * @default true
79
+ * @default ImageMode.center
80
+ */
81
+ mode: `${ImageMode}`;
82
+ /**
83
+ * Fill blank areas of the code with selected color
69
84
  */
70
- hideBackgroundDots: boolean;
85
+ fill: {
86
+ /**
87
+ * Color of QR dots
88
+ *
89
+ * @default "rgba(255,255,255,0.75)"
90
+ */
91
+ color: string;
92
+ /** Gradient of Corners Dot */
93
+ gradient?: Gradient;
94
+ };
71
95
  /**
72
96
  * Coefficient of the image size
73
97
  *
@@ -1,4 +1,4 @@
1
- import { Mode } from "../types/qrcode.js";
1
+ import { Mode } from "@liquid-js/qrcode-generator/lib/qrcode/QRCodeMinimal.js";
2
2
  export declare const ErrorCorrectionPercents: {
3
3
  L: number;
4
4
  M: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liquid-js/qr-code-styling",
3
- "version": "3.1.3",
3
+ "version": "4.0.0-1",
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",
@@ -24,19 +24,19 @@
24
24
  "lib"
25
25
  ],
26
26
  "peerDependencies": {
27
+ "@liquid-js/qrcode-generator": "^1.0.0-8",
27
28
  "@xmldom/xmldom": "^0.9.0",
28
29
  "file-type": "^19.0.0",
29
- "qrcode-generator": "^1.4.4",
30
30
  "sharp": ">0.32.1 <1.0.0"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
- "@xmldom/xmldom": {
33
+ "@liquid-js/qrcode-generator": {
34
34
  "optional": true
35
35
  },
36
- "file-type": {
36
+ "@xmldom/xmldom": {
37
37
  "optional": true
38
38
  },
39
- "qrcode-generator": {
39
+ "file-type": {
40
40
  "optional": true
41
41
  },
42
42
  "sharp": {
@@ -70,5 +70,8 @@
70
70
  "bugs": {
71
71
  "url": "https://github.com/Liquid-JS/qr-code-styling/issues"
72
72
  },
73
- "homepage": "https://styled-qr.liquidjs.io/"
73
+ "homepage": "https://styled-qr.liquidjs.io/",
74
+ "dependencies": {
75
+ "mocha": "^10.7.3"
76
+ }
74
77
  }
@@ -1,22 +0,0 @@
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: { [P in TypeNumber]: P; };
3
- export { TypeNumber };
4
- export declare enum ErrorCorrectionLevel {
5
- L = "L",
6
- M = "M",
7
- Q = "Q",
8
- H = "H"
9
- }
10
- export declare enum Mode {
11
- numeric = "Numeric",
12
- alphanumeric = "Alphanumeric",
13
- byte = "Byte",
14
- kanji = "Kanji",
15
- unicode = "Unicode"
16
- }
17
- export interface QRCode {
18
- addData(data: string, mode?: Mode.alphanumeric | Mode.byte | Mode.kanji | Mode.numeric): void;
19
- make(): void;
20
- getModuleCount(): number;
21
- isDark(row: number, col: number): boolean;
22
- }