@liquid-js/qr-code-styling 3.0.0-2 → 3.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 +1 -2
- package/lib/core/{QRCodeStyling.d.ts → qr-code-styling.d.ts} +16 -22
- package/lib/core/qr-svg.d.ts +31 -0
- package/lib/figures/corner-dot.d.ts +24 -0
- package/lib/figures/corner-square.d.ts +22 -0
- package/lib/figures/dot.d.ts +28 -0
- package/lib/index.d.ts +9 -5
- package/lib/node.d.ts +13 -6
- package/lib/qr-code-styling-node.js +449 -439
- 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/tools/{browserImageTools.d.ts → browser-image-tools.d.ts} +1 -2
- package/lib/tools/browser-utils.d.ts +18 -0
- package/lib/types/helper.d.ts +23 -0
- package/lib/types/qrcode.d.ts +64 -0
- package/lib/utils/canvas-options.d.ts +7 -0
- package/lib/utils/gradient.d.ts +26 -0
- package/lib/{tools → utils}/merge.d.ts +3 -1
- package/lib/{types/index.d.ts → utils/options.d.ts} +29 -151
- package/lib/{constants/errorCorrectionPercents.d.ts → utils/qrcode.d.ts} +2 -0
- package/package.json +1 -1
- package/lib/core/QROptions.d.ts +0 -32
- package/lib/core/QRSVG.d.ts +0 -58
- package/lib/figures/cornerDot/QRCornerDot.d.ts +0 -27
- package/lib/figures/cornerSquare/QRCornerSquare.d.ts +0 -25
- package/lib/figures/dot/QRDot.d.ts +0 -31
- package/lib/tools/browserUtils.d.ts +0 -11
- package/lib/tools/getMode.d.ts +0 -2
- package/lib/tools/sanitizeOptions.d.ts +0 -3
- /package/lib/{tools/calculateImageSize.d.ts → utils/image.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -97,8 +97,7 @@ const qrCode = new QRCodeStyling({
|
|
|
97
97
|
|
|
98
98
|
const svgCode = await qrCode.serialize();
|
|
99
99
|
|
|
100
|
-
const width =
|
|
101
|
-
const height = parseFloat(qrCode._svg.getAttribute("height"));
|
|
100
|
+
const { width, height } = qrCode.size || {};
|
|
102
101
|
const buffers = [];
|
|
103
102
|
const doc = new PDFDocument({ size: [width, height] });
|
|
104
103
|
doc.on("data", (v) => buffers.push(v));
|
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { RecursivePartial } from "../types/helper.js";
|
|
2
|
+
import { Options } from "../utils/options.js";
|
|
3
|
+
export type ExtensionFunction = (svg: SVGElement, options: RecursivePartial<Options>) => void;
|
|
3
4
|
export declare class QRCodeStyling {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
_svgDrawingPromise?: Promise<void>;
|
|
16
|
-
constructor(options?: Partial<Options>);
|
|
17
|
-
/** @ignore */
|
|
18
|
-
static _clearContainer(container?: HTMLElement): void;
|
|
19
|
-
/** @ignore */
|
|
20
|
-
_setupSvg(): void;
|
|
21
|
-
/** @ignore */
|
|
22
|
-
_getElement(): Promise<SVGElement | undefined>;
|
|
5
|
+
private options;
|
|
6
|
+
private container?;
|
|
7
|
+
private qr?;
|
|
8
|
+
private extension?;
|
|
9
|
+
private svgDrawingPromise?;
|
|
10
|
+
private qrSVG?;
|
|
11
|
+
get size(): {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
} | undefined;
|
|
15
|
+
constructor(options?: RecursivePartial<Options>);
|
|
23
16
|
update(
|
|
24
17
|
/** The same options as for initialization */
|
|
25
|
-
options?:
|
|
18
|
+
options?: RecursivePartial<Options>): void;
|
|
26
19
|
append(
|
|
27
20
|
/** This container will be used for appending of the QR code */
|
|
28
21
|
container?: HTMLElement): void;
|
|
@@ -57,4 +50,5 @@ export declare class QRCodeStyling {
|
|
|
57
50
|
extension: ExtensionFunction): void;
|
|
58
51
|
deleteExtension(): void;
|
|
59
52
|
serialize(): Promise<string | undefined>;
|
|
53
|
+
private setupSvg;
|
|
60
54
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Options } from "../utils/options.js";
|
|
2
|
+
export declare class QRSVG {
|
|
3
|
+
private options;
|
|
4
|
+
private _element;
|
|
5
|
+
get element(): SVGElement;
|
|
6
|
+
private defs;
|
|
7
|
+
private backgroundMask?;
|
|
8
|
+
private backgroundMaskGroup?;
|
|
9
|
+
private dotsMask?;
|
|
10
|
+
private dotsMaskGroup?;
|
|
11
|
+
private qr?;
|
|
12
|
+
private document;
|
|
13
|
+
private imageTools;
|
|
14
|
+
constructor(options: Pick<Options, "width" | "height" | "document" | "imageTools" | "image" | "imageOptions" | "dotsOptions" | "cornersDotOptions" | "cornersSquareOptions" | "backgroundOptions" | "shape"> & {
|
|
15
|
+
errorCorrectionPercent: number;
|
|
16
|
+
});
|
|
17
|
+
get width(): number;
|
|
18
|
+
get height(): number;
|
|
19
|
+
drawQR(qr: QRCode): Promise<void>;
|
|
20
|
+
drawBackground(): void;
|
|
21
|
+
drawDots(filter?: (i: number, j: number) => boolean): void;
|
|
22
|
+
drawCorners(): void;
|
|
23
|
+
drawImage({ width, height, count, dotSize }: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
count: number;
|
|
27
|
+
dotSize: number;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
private createColor;
|
|
30
|
+
private createMask;
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DrawArgs } from "../types/helper.js";
|
|
2
|
+
import { CornerDotType } from "../utils/options.js";
|
|
3
|
+
export declare class QRCornerDot {
|
|
4
|
+
private readonly type;
|
|
5
|
+
private readonly document;
|
|
6
|
+
private _element?;
|
|
7
|
+
get element(): SVGElement | undefined;
|
|
8
|
+
constructor(type: `${CornerDotType}`, document: Document);
|
|
9
|
+
draw(args: DrawArgs): void;
|
|
10
|
+
private rotateFigure;
|
|
11
|
+
private basicDot;
|
|
12
|
+
private basicSquare;
|
|
13
|
+
private basicHeart;
|
|
14
|
+
private basicRounded;
|
|
15
|
+
private basicClassy;
|
|
16
|
+
private basicInpoint;
|
|
17
|
+
private drawDot;
|
|
18
|
+
private drawSquare;
|
|
19
|
+
private drawHeart;
|
|
20
|
+
private drawRounded;
|
|
21
|
+
private drawClassy;
|
|
22
|
+
private drawInpoint;
|
|
23
|
+
private drawOutpoint;
|
|
24
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DrawArgs } from "../types/helper.js";
|
|
2
|
+
import { CornerSquareType } from "../utils/options.js";
|
|
3
|
+
export declare class QRCornerSquare {
|
|
4
|
+
private readonly type;
|
|
5
|
+
private readonly document;
|
|
6
|
+
private _element?;
|
|
7
|
+
get element(): SVGElement | undefined;
|
|
8
|
+
constructor(type: `${CornerSquareType}`, document: Document);
|
|
9
|
+
draw(args: DrawArgs): void;
|
|
10
|
+
private rotateFigure;
|
|
11
|
+
private basicDot;
|
|
12
|
+
private basicSquare;
|
|
13
|
+
private basicExtraRounded;
|
|
14
|
+
private basicClassy;
|
|
15
|
+
private basicInpoint;
|
|
16
|
+
private drawDot;
|
|
17
|
+
private drawSquare;
|
|
18
|
+
private drawExtraRounded;
|
|
19
|
+
private drawClassy;
|
|
20
|
+
private drawInpoint;
|
|
21
|
+
private drawOutpoint;
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DrawArgs } from "../types/helper.js";
|
|
2
|
+
import { DotType } from "../utils/options.js";
|
|
3
|
+
export declare class QRDot {
|
|
4
|
+
private readonly type;
|
|
5
|
+
private readonly document;
|
|
6
|
+
private _element?;
|
|
7
|
+
get element(): SVGElement | undefined;
|
|
8
|
+
constructor(type: `${DotType}`, document: Document);
|
|
9
|
+
draw(args: DrawArgs): void;
|
|
10
|
+
private rotateFigure;
|
|
11
|
+
private basicDot;
|
|
12
|
+
private basicSquare;
|
|
13
|
+
private basicSideRounded;
|
|
14
|
+
private basicCornerRounded;
|
|
15
|
+
private basicCornerExtraRounded;
|
|
16
|
+
private basicCornersRounded;
|
|
17
|
+
private drawDot;
|
|
18
|
+
private drawRandomDot;
|
|
19
|
+
private drawSquare;
|
|
20
|
+
private drawSmallSquare;
|
|
21
|
+
private drawDiamond;
|
|
22
|
+
private drawRounded;
|
|
23
|
+
private drawVerticalLine;
|
|
24
|
+
private drawHorizontalLine;
|
|
25
|
+
private drawExtraRounded;
|
|
26
|
+
private drawClassy;
|
|
27
|
+
private drawClassyRounded;
|
|
28
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export { type ExtensionFunction, QRCodeStyling } from "./core/qr-code-styling.js";
|
|
2
|
+
export { FileExtension } from "./tools/browser-utils.js";
|
|
3
|
+
export { type RecursivePartial } from "./types/helper.js";
|
|
4
|
+
export { ErrorCorrectionLevel, Mode, TypeNumber } from "./types/qrcode.js";
|
|
5
|
+
export { type CanvasOptions } from "./utils/canvas-options.js";
|
|
6
|
+
export { type Gradient, GradientType } from "./utils/gradient.js";
|
|
7
|
+
export { CornerDotType, CornerSquareType, DotType, type Options, ShapeType } from "./utils/options.js";
|
|
8
|
+
export { ErrorCorrectionPercents } from "./utils/qrcode.js";
|
|
9
|
+
import * as _browserUtils from "./tools/browser-utils.js";
|
|
4
10
|
export declare const browserUtils: typeof _browserUtils | undefined;
|
|
5
|
-
export * from "./types/index.js";
|
|
6
|
-
export { ErrorCorrectionPercents, QRCodeStyling };
|
package/lib/node.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { QRCodeStyling as _QRCodeStyling } from "./core/qr-code-styling.js";
|
|
2
|
+
import type * as _browserUtils from "./tools/browser-utils.js";
|
|
3
|
+
import { RecursivePartial } from "./types/helper.js";
|
|
4
|
+
import { Options } from "./utils/options.js";
|
|
5
|
+
export { type ExtensionFunction } from "./core/qr-code-styling.js";
|
|
6
|
+
export { FileExtension } from "./tools/browser-utils.js";
|
|
7
|
+
export { type RecursivePartial } from "./types/helper.js";
|
|
8
|
+
export { ErrorCorrectionLevel, Mode, TypeNumber } from "./types/qrcode.js";
|
|
9
|
+
export { type CanvasOptions } from "./utils/canvas-options.js";
|
|
10
|
+
export { GradientType, type Gradient } from "./utils/gradient.js";
|
|
11
|
+
export { CornerDotType, CornerSquareType, DotType, ShapeType, type Options } from "./utils/options.js";
|
|
12
|
+
export { ErrorCorrectionPercents } from "./utils/qrcode.js";
|
|
6
13
|
export declare const browserUtils: typeof _browserUtils | undefined;
|
|
7
14
|
export declare class QRCodeStyling extends _QRCodeStyling {
|
|
8
|
-
constructor(options:
|
|
15
|
+
constructor(options: RecursivePartial<Options>);
|
|
9
16
|
}
|