qr-code-styling-node 1.9.0 → 1.10.0
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/README.md +23 -4
- package/lib/art/art.d.ts +12 -8
- package/lib/core/QRCanvas.d.ts +2 -0
- package/lib/core/QRSVG.d.ts +2 -0
- package/lib/figures/shapes.d.ts +11 -0
- package/lib/qr-code-styling.common.js +1 -1
- package/lib/qr-code-styling.common.js.map +1 -1
- package/lib/qr-code-styling.js +1 -1
- package/lib/qr-code-styling.js.map +1 -1
- package/lib/qr-code-styling.mjs +221 -62
- package/lib/qr-code-styling.mjs.map +4 -4
- package/lib/tools/cornerTypes.d.ts +2 -0
- package/lib/tools/qrArea.d.ts +14 -0
- package/lib/types/index.d.ts +14 -3
- package/package.json +3 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { RequiredOptions } from "../core/QROptions";
|
|
2
2
|
import { CornerDotType, CornerSquareType, DotType } from "../types";
|
|
3
|
+
/** Dot types with a round look; blend art matches its corners and correction dots to them. */
|
|
4
|
+
export declare const ROUND_DOT_TYPES: DotType[];
|
|
3
5
|
/** True when alignment patterns must be drawn as plain squares for this dot type to scan. */
|
|
4
6
|
export declare const needsSolidAlignment: (type: DotType) => boolean;
|
|
5
7
|
export default function getCornerTypes(options: RequiredOptions): {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RequiredOptions } from "../core/QROptions";
|
|
2
|
+
export interface QRArea {
|
|
3
|
+
count: number;
|
|
4
|
+
/** Size of one module in pixels. */
|
|
5
|
+
dotSize: number;
|
|
6
|
+
/** Top-left corner of the code (without margin). */
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Where the code sits in the output. By default it is centered and fills the size minus the margin.
|
|
12
|
+
* With art.placement it sits in that square of the picture instead.
|
|
13
|
+
*/
|
|
14
|
+
export default function getQRArea(options: RequiredOptions, count: number): QRArea;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface UnknownObject {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
}
|
|
4
|
-
export type DotType = "dots" | "rounded" | "classy" | "classy-rounded" | "square" | "extra-rounded" | "diamond" | "small-square" | "vertical-lines" | "horizontal-lines";
|
|
4
|
+
export type DotType = "dots" | "rounded" | "classy" | "classy-rounded" | "square" | "extra-rounded" | "diamond" | "small-square" | "vertical-lines" | "horizontal-lines" | "fluid";
|
|
5
5
|
export type CornerDotType = "dot" | "square" | "rounded";
|
|
6
6
|
export type CornerSquareType = "dot" | "square" | "extra-rounded" | "rounded";
|
|
7
7
|
export type Extension = "svg" | "png" | "jpeg" | "webp";
|
|
@@ -87,22 +87,33 @@ export interface ResvgConstructor {
|
|
|
87
87
|
};
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
export type ArtMode = "halftone" | "colorize";
|
|
90
|
+
export type ArtMode = "halftone" | "colorize" | "blend";
|
|
91
91
|
export interface ArtOptions {
|
|
92
92
|
/** The picture to blend into the QR code (URL or data URL). */
|
|
93
93
|
image: string;
|
|
94
94
|
/**
|
|
95
95
|
* "halftone": the picture is redrawn as fine black/white (or colored) pixels, with the QR modules in the middle.
|
|
96
96
|
* "colorize": the dots keep their shape and are painted with a darkened copy of the picture.
|
|
97
|
+
* "blend": the picture fills the whole image; dots are drawn only where the picture is not already
|
|
98
|
+
* dark or light enough for the code, so it reads as an illustration.
|
|
97
99
|
*/
|
|
98
100
|
mode?: ArtMode;
|
|
99
101
|
/** halftone only: use the picture's own colors instead of dotsOptions/backgroundOptions colors. */
|
|
100
102
|
colored?: boolean;
|
|
101
103
|
/** colorize only: also show a light copy of the picture behind the dots. Default true. */
|
|
102
104
|
background?: boolean;
|
|
103
|
-
/** 0 to 1. Higher keeps dark and light further apart: easier to scan, less of the picture. Default 0.5 (halftone), 0.7 (colorize). */
|
|
105
|
+
/** 0 to 1. Higher keeps dark and light further apart: easier to scan, less of the picture. Default 0.5 (halftone), 0.7 (colorize), 0.6 (blend). */
|
|
104
106
|
contrast?: number;
|
|
105
107
|
crossOrigin?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Put the code in a square of the picture instead of the middle, in pixels of the output:
|
|
110
|
+
* { x, y, size }. Mostly for "blend", where the picture fills the whole image. The margin is ignored.
|
|
111
|
+
*/
|
|
112
|
+
placement?: {
|
|
113
|
+
x: number;
|
|
114
|
+
y: number;
|
|
115
|
+
size: number;
|
|
116
|
+
};
|
|
106
117
|
}
|
|
107
118
|
/** Same signature as jsQR: (rgba, width, height) => { data } | null. */
|
|
108
119
|
export type QRDecoder = (data: Uint8ClampedArray, width: number, height: number, options?: Record<string, unknown>) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qr-code-styling-node",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Style your QR codes: dots, corners, gradients and a logo. Works in the browser and on Node.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"qr",
|
|
@@ -72,7 +72,8 @@
|
|
|
72
72
|
"clean": "node -e \"require('fs').rmSync('lib',{recursive:true,force:true})\"",
|
|
73
73
|
"bench": "npm run build && node scripts/bench.mjs",
|
|
74
74
|
"art-examples": "npm run build && node scripts/art-examples.mjs",
|
|
75
|
-
"style-examples": "npm run build && node scripts/style-examples.mjs"
|
|
75
|
+
"style-examples": "npm run build && node scripts/style-examples.mjs",
|
|
76
|
+
"blend-examples": "npm run build && node scripts/blend-examples.mjs"
|
|
76
77
|
},
|
|
77
78
|
"dependencies": {
|
|
78
79
|
"qrcode-generator": "^1.4.3"
|