@liquid-js/qr-code-styling 5.0.0-2 → 5.0.0-3
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 +38 -0
- package/lib/border-plugin.js +2 -0
- package/lib/border-plugin.js.map +1 -0
- package/lib/core/qr-code-styling.d.ts +5 -2
- package/lib/core/qr-svg.d.ts +2 -2
- package/lib/figures/corner-dot.d.ts +2 -1
- package/lib/figures/corner-square.d.ts +2 -1
- package/lib/figures/dot.d.ts +3 -2
- package/lib/figures/square-elements.d.ts +0 -1
- package/lib/index.d.ts +1 -1
- package/lib/node.d.ts +1 -1
- package/lib/plugin-utils.js +2 -0
- package/lib/plugin-utils.js.map +1 -0
- package/lib/plugins/border.d.ts +38 -0
- package/lib/plugins/utils.d.ts +2 -0
- package/lib/qr-code-styling-node.js +475 -417
- package/lib/qr-code-styling-node.js.map +1 -1
- package/lib/qr-code-styling.js +1 -1
- package/lib/qr-code-styling.js.map +1 -1
- package/lib/utils/options.d.ts +26 -0
- package/lib/utils/svg.d.ts +7 -1
- package/package.json +12 -2
package/lib/utils/options.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ErrorCorrectionLevel, Mode, TypeNumber } from '@liquid-js/qrcode-generator/lib/qrcode/QRCodeMinimal.js';
|
|
2
2
|
import { browserImageTools } from '../tools/browser-image-tools.js';
|
|
3
|
+
import { DrawArgs } from '../types/helper.js';
|
|
3
4
|
import { Gradient } from './gradient.js';
|
|
4
5
|
export declare enum DotType {
|
|
5
6
|
dot = "dot",
|
|
@@ -63,6 +64,30 @@ export declare enum ImageMode {
|
|
|
63
64
|
*/
|
|
64
65
|
background = "background"
|
|
65
66
|
}
|
|
67
|
+
export interface Plugin {
|
|
68
|
+
/**
|
|
69
|
+
* Draw a single dot
|
|
70
|
+
*
|
|
71
|
+
* @returns Dot element; if undefined, try to use the next plugin or the default function
|
|
72
|
+
*/
|
|
73
|
+
drawDot?: (args: DrawArgs) => SVGElement | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* Draw corner dot
|
|
76
|
+
*
|
|
77
|
+
* @returns Corner dot element; if undefined, try to use the next plugin or the default function
|
|
78
|
+
*/
|
|
79
|
+
drawCornerDot?: (args: DrawArgs) => SVGElement | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Draw corner square
|
|
82
|
+
*
|
|
83
|
+
* @returns Corner square element and corner mask (used with ImageMode.background); if undefined, try to use the next plugin or the default function
|
|
84
|
+
*/
|
|
85
|
+
drawCornerSquare?: (args: DrawArgs) => readonly [SVGElement, SVGElement] | undefined;
|
|
86
|
+
/**
|
|
87
|
+
* Alter the generated SVG, e.g. add borders
|
|
88
|
+
*/
|
|
89
|
+
postProcess?: (svg: SVGSVGElement, options: Options) => void;
|
|
90
|
+
}
|
|
66
91
|
export interface Options {
|
|
67
92
|
/** Use a custom DOM domplementation */
|
|
68
93
|
document: Document;
|
|
@@ -185,6 +210,7 @@ export interface Options {
|
|
|
185
210
|
stringToBytesFuncs?: {
|
|
186
211
|
[encoding: string]: (s: string) => number[];
|
|
187
212
|
};
|
|
213
|
+
plugins?: Plugin[];
|
|
188
214
|
}
|
|
189
215
|
export declare const defaultOptions: Options;
|
|
190
216
|
export declare function sanitizeOptions(options: Options): Options;
|
package/lib/utils/svg.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RotateFigureArgs } from '../types/helper.js';
|
|
2
|
-
export declare function numToAttr(value: number): string;
|
|
2
|
+
export declare function numToAttr(value: number | string): string;
|
|
3
3
|
export declare function svgPath(strings: TemplateStringsArray, ...values: unknown[]): string;
|
|
4
4
|
export declare function rotateFigure<T extends SVGElement | ReadonlyArray<SVGElement>>({ draw, ...args }: RotateFigureArgs<T>): T;
|
|
5
5
|
export declare function scalePath(path: Array<string | number>, { x, y, size }: {
|
|
@@ -7,3 +7,9 @@ export declare function scalePath(path: Array<string | number>, { x, y, size }:
|
|
|
7
7
|
y: number;
|
|
8
8
|
size: number;
|
|
9
9
|
}): string;
|
|
10
|
+
export declare function extendSVG(svg: SVGSVGElement, padding: number): {
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
top: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
} | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liquid-js/qr-code-styling",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-3",
|
|
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",
|
|
@@ -18,6 +18,14 @@
|
|
|
18
18
|
"./kanji": {
|
|
19
19
|
"types": "./lib/kanji.d.ts",
|
|
20
20
|
"default": "./lib/kanji.js"
|
|
21
|
+
},
|
|
22
|
+
"./plugin-utils": {
|
|
23
|
+
"types": "./lib/plugins/utils.d.ts",
|
|
24
|
+
"default": "./lib/plugin-utils.js"
|
|
25
|
+
},
|
|
26
|
+
"./border-plugin": {
|
|
27
|
+
"types": "./lib/plugins/border.d.ts",
|
|
28
|
+
"default": "./lib/border-plugin.js"
|
|
21
29
|
}
|
|
22
30
|
},
|
|
23
31
|
"files": [
|
|
@@ -49,7 +57,9 @@
|
|
|
49
57
|
"logo",
|
|
50
58
|
"design",
|
|
51
59
|
"node",
|
|
52
|
-
"nodejs"
|
|
60
|
+
"nodejs",
|
|
61
|
+
"plugin",
|
|
62
|
+
"plugins"
|
|
53
63
|
],
|
|
54
64
|
"author": "HitkoDev <development@hitko.si>",
|
|
55
65
|
"license": "MIT",
|