@vkontakte/vk-qr 3.0.0 → 3.1.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 +21 -2
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/figures.d.ts +9 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +848 -672
- package/dist/index.js.map +1 -1
- package/dist/qr.d.ts +62 -70
- package/dist/qr.d.ts.map +1 -1
- package/dist/svg-path.d.ts +8 -0
- package/dist/svg-path.d.ts.map +1 -0
- package/dist/svg.d.ts +5 -9
- package/dist/svg.d.ts.map +1 -1
- package/dist/types.d.ts +13 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/constants.ts +9 -0
- package/src/figures.ts +106 -0
- package/src/index.ts +16 -10
- package/src/qr.ts +707 -871
- package/src/svg-path.ts +254 -0
- package/src/svg.ts +129 -270
- package/src/types.ts +15 -1
package/dist/qr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../src/qr.ts"],"names":[],"mappings":"AAuBA,KAAK,GAAG,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../src/qr.ts"],"names":[],"mappings":"AAuBA,KAAK,GAAG,GAAG,MAAM,CAAC;AAElB,KAAK,GAAG,GAAG,MAAM,CAAC;AAOlB,eAAO,MAAM,SAAS;aACpB,GAAG;iBAAI,OAAO,EAAE,CAAC;iBAAE,UAAU,EAAE,CAAC;;aAChC,MAAM;iBAAI,OAAO,EAAE,CAAC;iBAAE,UAAU,EAAE,CAAC;;aACnC,QAAQ;iBAAI,OAAO,EAAE,CAAC;iBAAE,UAAU,EAAE,CAAC;;aACrC,IAAI;iBAAI,OAAO,EAAE,CAAC;iBAAE,UAAU,EAAE,CAAC;;CACzB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAKxE,eAAO,MAAM,aAAa;aACxB,OAAO;iBAAI,QAAQ,EAAE,CAAG;iBAAE,gBAAgB,YAAG,EAAE,EAAE,EAAE,EAAE,EAAE;;aACvD,YAAY;iBAAI,QAAQ,EAAE,CAAG;iBAAE,gBAAgB,YAAG,CAAC,EAAE,EAAE,EAAE,EAAE;;aAC3D,IAAI;iBAAI,QAAQ,EAAE,CAAG;iBAAE,gBAAgB,YAAG,CAAC,EAAE,EAAE,EAAE,EAAE;;aACnD,KAAK;iBAAI,QAAQ,EAAE,CAAG;iBAAE,gBAAgB,YAAG,CAAC,EAAE,EAAE,EAAE,EAAE;;aACpD,GAAG;iBAAI,QAAQ,EAAE,CAAG;iBAAE,gBAAgB,YAAG,CAAC,EAAE,CAAC,EAAE,CAAC;;CACxC,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAapF,MAAM,WAAW,MAAM;IACrB,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,oBAAoB,EAAE,cAAc,CAAC;IAC9C,iGAAiG;IACjG,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,uFAAuF;IACvF,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC;CAC/B;AAaD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,EAAE,EACjB,GAAG,EAAE,cAAc,EACnB,UAAU,GAAE,GAAO,EACnB,UAAU,GAAE,GAAQ,EACpB,IAAI,GAAE,GAAQ,EACd,QAAQ,GAAE,OAAc,GACvB,MAAM,CA2DR;AA4aD,MAAM,WAAW,SAAS;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,GAAG,CAAC;IACvB,2DAA2D;IAC3D,OAAO,IAAI,GAAG,EAAE,CAAC;CAClB;AA2DD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,CAMtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-path.d.ts","sourceRoot":"","sources":["../src/svg-path.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,UAAU,cAAc;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAcD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,MAAM,CAOpF"}
|
package/dist/svg.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type { QrCode } from './qr.
|
|
2
|
-
import type { RequiredQrOptions } from './types.
|
|
3
|
-
export declare const INC_TILE_SIZE
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
* @param qrCode QrCode instance
|
|
7
|
-
* @param options Convertation options
|
|
8
|
-
*/
|
|
9
|
-
export declare const convertSegmentsToSvgString: (qrCode: QrCode, options: RequiredQrOptions) => string;
|
|
1
|
+
import type { QrCode } from './qr.js';
|
|
2
|
+
import type { RequiredQrOptions } from './types.js';
|
|
3
|
+
export declare const INC_TILE_SIZE = 100;
|
|
4
|
+
/** Converts a QR module matrix to SVG. */
|
|
5
|
+
export declare function convertSegmentsToSvgString(qrCode: QrCode, options: RequiredQrOptions): string;
|
|
10
6
|
//# sourceMappingURL=svg.d.ts.map
|
package/dist/svg.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["../src/svg.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAUpD,eAAO,MAAM,aAAa,MAAY,CAAC;AASvC,0CAA0C;AAC1C,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAiC7F"}
|
package/dist/types.d.ts
CHANGED
|
@@ -23,6 +23,18 @@ export type QrOptions = {
|
|
|
23
23
|
* @default "#ffffff"
|
|
24
24
|
*/
|
|
25
25
|
backgroundColor?: string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Background frame thickness in output pixels. Works if `isShowBackground` is enabled.
|
|
28
|
+
* Must be finite and non-negative. Clamped to half of `qrSize`.
|
|
29
|
+
* @default 20
|
|
30
|
+
*/
|
|
31
|
+
backgroundPadding?: number | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Background corner radius in output pixels. Works if `isShowBackground` is enabled.
|
|
34
|
+
* Must be finite and non-negative. Clamped to half of `qrSize`.
|
|
35
|
+
* @default 36
|
|
36
|
+
*/
|
|
37
|
+
backgroundRadius?: number | undefined;
|
|
26
38
|
/**
|
|
27
39
|
* QR code HEX color
|
|
28
40
|
*/
|
|
@@ -45,7 +57,7 @@ export type QrOptions = {
|
|
|
45
57
|
*/
|
|
46
58
|
ecc?: number | undefined;
|
|
47
59
|
/**
|
|
48
|
-
*
|
|
60
|
+
* @deprecated Ignored. QR module size is fixed internally.
|
|
49
61
|
*/
|
|
50
62
|
incTileSize?: number | undefined;
|
|
51
63
|
};
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;CAAE,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEvC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEvC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEtC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAErC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAErC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,KAAK,YAAY,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC;CAAE,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vkontakte/vk-qr",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "QR Code generator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"test": "node --test tests/**/*.test.ts",
|
|
23
|
-
"test:update": "UPDATE_SNAPSHOTS=1 node --
|
|
23
|
+
"test:update": "UPDATE_SNAPSHOTS=1 node --test tests/**/*.test.ts",
|
|
24
24
|
"watch": "rslib --watch",
|
|
25
25
|
"build": "rslib",
|
|
26
26
|
"lint": "yarn lint:biome && yarn lint:types",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@biomejs/biome": "^2.4.12",
|
|
42
|
-
"@rslib/core": "^0.
|
|
43
|
-
"@size-limit/preset-small-lib": "^
|
|
44
|
-
"@types/node": "^
|
|
45
|
-
"size-limit": "^
|
|
46
|
-
"typescript": "^
|
|
42
|
+
"@rslib/core": "^1.0.2",
|
|
43
|
+
"@size-limit/preset-small-lib": "^14.0.0",
|
|
44
|
+
"@types/node": "^26.0.0",
|
|
45
|
+
"size-limit": "^14.0.0",
|
|
46
|
+
"typescript": "^7.0.2"
|
|
47
47
|
},
|
|
48
48
|
"size-limit": [
|
|
49
49
|
{
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** SVG units per QR module. */
|
|
2
|
+
export const TILE_SIZE = 100;
|
|
3
|
+
export const FINDER_PATTERN_SIZE = 7;
|
|
4
|
+
export const SMALL_QR_SIZE = 25;
|
|
5
|
+
export const MODULE_CORNER_RADIUS = 35;
|
|
6
|
+
export const FINDER_CORNER_RADIUS = 67;
|
|
7
|
+
/** Default background dimensions in output pixels. */
|
|
8
|
+
export const BACKGROUND_PADDING = 20;
|
|
9
|
+
export const BACKGROUND_RADIUS = 36;
|
package/src/figures.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { FINDER_PATTERN_SIZE } from './constants.ts';
|
|
2
|
+
|
|
3
|
+
/** A connected group of modules stored in its smallest bounding box. */
|
|
4
|
+
export interface Figure {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
pixels: boolean[][];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function isFinderPattern(figure: Figure, size: number): boolean {
|
|
11
|
+
const { x, y, pixels } = figure;
|
|
12
|
+
const width = pixels[0]?.length ?? 0;
|
|
13
|
+
const height = pixels.length;
|
|
14
|
+
const right = x + width - 1;
|
|
15
|
+
const bottom = y + height - 1;
|
|
16
|
+
|
|
17
|
+
const finderRegions: Array<[number, number, number, number]> = [
|
|
18
|
+
[0, 0, FINDER_PATTERN_SIZE - 1, FINDER_PATTERN_SIZE - 1],
|
|
19
|
+
[size - FINDER_PATTERN_SIZE, 0, size - 1, FINDER_PATTERN_SIZE - 1],
|
|
20
|
+
[0, size - FINDER_PATTERN_SIZE, FINDER_PATTERN_SIZE - 1, size - 1],
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
for (const [rx1, ry1, rx2, ry2] of finderRegions) {
|
|
24
|
+
if (x >= rx1 && y >= ry1 && right <= rx2 && bottom <= ry2) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function extractFigures(image: boolean[][]): Figure[] {
|
|
33
|
+
const height = image.length;
|
|
34
|
+
const width = image[0]?.length ?? 0;
|
|
35
|
+
|
|
36
|
+
const visited: boolean[][] = Array.from({ length: height }, () => Array(width).fill(false));
|
|
37
|
+
|
|
38
|
+
const figures: Figure[] = [];
|
|
39
|
+
|
|
40
|
+
const directions = [
|
|
41
|
+
[0, -1], // up
|
|
42
|
+
[1, 0], // right
|
|
43
|
+
[0, 1], // down
|
|
44
|
+
[-1, 0], // left
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function isInside(x: number, y: number): boolean {
|
|
48
|
+
return y >= 0 && y < height && x >= 0 && x < width;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
for (let y = 0; y < height; y++) {
|
|
52
|
+
for (let x = 0; x < width; x++) {
|
|
53
|
+
if (visited[y][x]) continue;
|
|
54
|
+
if (!image[y][x]) continue;
|
|
55
|
+
|
|
56
|
+
const cells: Array<[number, number]> = [[x, y]];
|
|
57
|
+
|
|
58
|
+
visited[y][x] = true;
|
|
59
|
+
|
|
60
|
+
let minX = x;
|
|
61
|
+
let maxX = x;
|
|
62
|
+
let minY = y;
|
|
63
|
+
let maxY = y;
|
|
64
|
+
|
|
65
|
+
for (let head = 0; head < cells.length; head++) {
|
|
66
|
+
const [cx, cy] = cells[head];
|
|
67
|
+
|
|
68
|
+
minX = Math.min(minX, cx);
|
|
69
|
+
maxX = Math.max(maxX, cx);
|
|
70
|
+
minY = Math.min(minY, cy);
|
|
71
|
+
maxY = Math.max(maxY, cy);
|
|
72
|
+
|
|
73
|
+
for (const [dx, dy] of directions) {
|
|
74
|
+
const nx = cx + dx;
|
|
75
|
+
const ny = cy + dy;
|
|
76
|
+
|
|
77
|
+
if (!isInside(nx, ny)) continue;
|
|
78
|
+
if (visited[ny][nx]) continue;
|
|
79
|
+
if (!image[ny][nx]) continue;
|
|
80
|
+
|
|
81
|
+
visited[ny][nx] = true;
|
|
82
|
+
cells.push([nx, ny]);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const figureWidth = maxX - minX + 1;
|
|
87
|
+
const figureHeight = maxY - minY + 1;
|
|
88
|
+
|
|
89
|
+
const pixels: boolean[][] = Array.from({ length: figureHeight }, () =>
|
|
90
|
+
Array(figureWidth).fill(false),
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
for (const [cellX, cellY] of cells) {
|
|
94
|
+
pixels[cellY - minY][cellX - minX] = true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
figures.push({
|
|
98
|
+
x: minX,
|
|
99
|
+
y: minY,
|
|
100
|
+
pixels,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return figures;
|
|
106
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { convertSegmentsToSvgString, INC_TILE_SIZE } from './svg.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { makeSegments, encodeSegments, QrCodeEcc } from './qr.ts';
|
|
3
3
|
import type { QrOptions, RequiredQrOptions } from './types.ts';
|
|
4
|
+
import { BACKGROUND_PADDING, BACKGROUND_RADIUS } from './constants.ts';
|
|
4
5
|
|
|
5
6
|
/** Default width and height of QR code */
|
|
6
7
|
const DEFAULT_SIZE = 128;
|
|
@@ -84,6 +85,18 @@ export function createQR(
|
|
|
84
85
|
typeof options.backgroundColor === 'string'
|
|
85
86
|
? options.backgroundColor
|
|
86
87
|
: BACKGROUND_COLOR_DEFAULT,
|
|
88
|
+
backgroundPadding:
|
|
89
|
+
typeof options.backgroundPadding === 'number' &&
|
|
90
|
+
Number.isFinite(options.backgroundPadding) &&
|
|
91
|
+
options.backgroundPadding >= 0
|
|
92
|
+
? options.backgroundPadding
|
|
93
|
+
: BACKGROUND_PADDING,
|
|
94
|
+
backgroundRadius:
|
|
95
|
+
typeof options.backgroundRadius === 'number' &&
|
|
96
|
+
Number.isFinite(options.backgroundRadius) &&
|
|
97
|
+
options.backgroundRadius >= 0
|
|
98
|
+
? options.backgroundRadius
|
|
99
|
+
: BACKGROUND_RADIUS,
|
|
87
100
|
logoColor: typeof options.logoColor === 'string' ? options.logoColor : LOGO_COLOR_DEFAULT,
|
|
88
101
|
suffix: options.suffix ? options.suffix.toString() : '0',
|
|
89
102
|
logoData: typeof options.logoData === 'string' ? options.logoData : null,
|
|
@@ -92,15 +105,8 @@ export function createQR(
|
|
|
92
105
|
};
|
|
93
106
|
|
|
94
107
|
// Code generation
|
|
95
|
-
const segments
|
|
96
|
-
const qrCode
|
|
97
|
-
segments,
|
|
98
|
-
eccLevels[fallbackOptions.ecc],
|
|
99
|
-
1,
|
|
100
|
-
40,
|
|
101
|
-
-1,
|
|
102
|
-
true,
|
|
103
|
-
);
|
|
108
|
+
const segments = makeSegments(text);
|
|
109
|
+
const qrCode = encodeSegments(segments, eccLevels[fallbackOptions.ecc], 1, 40, -1, true);
|
|
104
110
|
const svgCode = convertSegmentsToSvgString(qrCode, fallbackOptions);
|
|
105
111
|
|
|
106
112
|
return svgCode;
|