qr-kit 2.2.0 → 2.2.2
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/CHANGELOG.md +51 -0
- package/README.md +2 -2
- package/package.json +71 -71
- package/utils/logo.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,57 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.2.2] - 2025-02-22
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- **Logo overlay reliability**: Reduced default `LOGO_MAX_COVERAGE_ECC_M` from 11% to 6% to ensure better scan reliability with ECC M. Empirical testing showed that 11% could sometimes interfere with decoding, while 6% provides a safe margin. Users can still override `maxCoverage` if a larger logo is required.
|
|
14
|
+
- Updated documentation to reflect the new recommended coverage values.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## [2.2.2] - 2025-02-22
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
- **Badges on readme**: Fix badges
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
[2.2.0] - 2025-02-21
|
|
26
|
+
Added
|
|
27
|
+
functionMask in QR model: now every QR code generated by makeQr includes a flat Uint8Array functionMask indicating functional modules (finder, timing, alignment, format/version). This enables advanced styling and custom renderers.
|
|
28
|
+
|
|
29
|
+
isFunctionModule helper: check whether a given module is functional (model.functionMask[y * model.size + x] === 1).
|
|
30
|
+
|
|
31
|
+
Branded rendering: makeQrSvgString now accepts an optional fnColor parameter to style functional modules separately from data modules. The new makeQrPathSplit function splits the SVG path into data and function parts.
|
|
32
|
+
|
|
33
|
+
Playground: added a live demo with Basic, Rounded and Branded modes, Link Builder, PDF export, and download options (SVG, PNG, JPEG).
|
|
34
|
+
|
|
35
|
+
Fixed
|
|
36
|
+
Critical module placement bug: corrected placeFunctionPatterns and setReserve to properly reserve separators, format areas, and version information. Previously, data could be written into reserved areas, making QR codes unreadable. Now all QR codes are fully compliant and scan reliably.
|
|
37
|
+
|
|
38
|
+
Golden tests: updated snapshots to reflect the correct output; all 109 tests pass.
|
|
39
|
+
|
|
40
|
+
TypeScript declarations: added missing @types/react dependency to CI to fix namespace errors during type checking.
|
|
41
|
+
|
|
42
|
+
Changed
|
|
43
|
+
Internal performance: optimised mask application and penalty score calculation; refactored helpers to work efficiently with flat Uint8Array.
|
|
44
|
+
|
|
45
|
+
Documentation: updated README with examples for branded rendering and clarified API usage.
|
|
46
|
+
|
|
47
|
+
Deprecated
|
|
48
|
+
Nothing deprecated in this release.
|
|
49
|
+
|
|
50
|
+
Removed
|
|
51
|
+
Nothing removed.
|
|
52
|
+
|
|
53
|
+
Security
|
|
54
|
+
No security changes.
|
|
55
|
+
|
|
56
|
+
⚠️ Experimental Feature
|
|
57
|
+
Logo overlay (utils/logo.js) is still under development and may not produce reliably scannable QR codes. It is not recommended for production use until further notice. The API may change in future releases.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
10
61
|
## [2.1.0] — Logo overlay, Web Worker, AbortSignal
|
|
11
62
|
|
|
12
63
|
### Added
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/qr-kit)
|
|
8
8
|
[](https://bundlephobia.com/package/qr-kit)
|
|
9
9
|
[](tests/)
|
|
10
|
-
[](https://github.com/Yaroslav3991/qr-kit/blob/main/LICENSE)
|
|
11
11
|
|
|
12
12
|
**[🛝 Live Playground](playground/index.html)** · **[📖 Docs](#installation)** · **[🎨 Examples](#quick-start)**
|
|
13
13
|
|
|
@@ -66,7 +66,7 @@ import { buildQrWithLogoSvgAsync } from 'qr-kit/utils/logo';
|
|
|
66
66
|
const model = makeQr('https://example.com', { eccLevel: 'M' });
|
|
67
67
|
const svg = await buildQrWithLogoSvgAsync(model, '/logo.svg', {
|
|
68
68
|
size: 400,
|
|
69
|
-
maxCoverage: 0.
|
|
69
|
+
maxCoverage: 0.06, // 6% of QR area — recommended for reliable scanning with ECC M
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
document.body.innerHTML = svg; // self-contained SVG string
|
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "qr-kit",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "Complete QR code toolkit. Zero dependencies. Logo overlay, PDF export, link optimizer. 5.4 kB core.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"module": "index.js",
|
|
8
|
-
"types": "types/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": "./index.js",
|
|
11
|
-
"./qr/qr-core": "./qr/qr-core.js",
|
|
12
|
-
"./utils/layout": "./utils/layout.js",
|
|
13
|
-
"./utils/url": "./utils/url.js",
|
|
14
|
-
"./utils/link": "./utils/link.js",
|
|
15
|
-
"./utils/logo": "./utils/logo.js",
|
|
16
|
-
"./renderers/svg": "./renderers/svg.js",
|
|
17
|
-
"./renderers/canvas": "./renderers/canvas.js",
|
|
18
|
-
"./utils/raster": "./utils/raster.js",
|
|
19
|
-
"./utils/jpegQr": "./utils/jpegQr.js",
|
|
20
|
-
"./utils/poster": "./utils/poster.js",
|
|
21
|
-
"./utils/pdf": "./utils/pdf.js",
|
|
22
|
-
"./worker/qr.worker": "./worker/qr.worker.js"
|
|
23
|
-
},
|
|
24
|
-
"scripts": {
|
|
25
|
-
"test": "node tests/run.js",
|
|
26
|
-
"test:watch": "node --watch tests/run.js",
|
|
27
|
-
"size": "node scripts/size.js"
|
|
28
|
-
},
|
|
29
|
-
"sideEffects": false,
|
|
30
|
-
"keywords": [
|
|
31
|
-
"qr",
|
|
32
|
-
"qrcode",
|
|
33
|
-
"qr-code",
|
|
34
|
-
"generator",
|
|
35
|
-
"zero-dependencies",
|
|
36
|
-
"logo",
|
|
37
|
-
"pdf",
|
|
38
|
-
"svg",
|
|
39
|
-
"react",
|
|
40
|
-
"typescript",
|
|
41
|
-
"browser",
|
|
42
|
-
"nodejs"
|
|
43
|
-
],
|
|
44
|
-
"peerDependencies": {
|
|
45
|
-
"react": ">=17"
|
|
46
|
-
},
|
|
47
|
-
"peerDependenciesMeta": {
|
|
48
|
-
"react": {
|
|
49
|
-
"optional": true
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"files": [
|
|
53
|
-
"index.js",
|
|
54
|
-
"qr/",
|
|
55
|
-
"components/",
|
|
56
|
-
"renderers/",
|
|
57
|
-
"utils/",
|
|
58
|
-
"worker/",
|
|
59
|
-
"types/",
|
|
60
|
-
"CHANGELOG.md"
|
|
61
|
-
],
|
|
62
|
-
"license": "MIT",
|
|
63
|
-
"repository": {
|
|
64
|
-
"type": "git",
|
|
65
|
-
"url": "https://github.com/Yaroslav3991/qr-kit.git"
|
|
66
|
-
},
|
|
67
|
-
"bugs": {
|
|
68
|
-
"url": "https://github.com/Yaroslav3991/qr-kit/issues"
|
|
69
|
-
},
|
|
70
|
-
"homepage": "https://github.com/Yaroslav3991/qr-kit#readme"
|
|
71
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "qr-kit",
|
|
3
|
+
"version": "2.2.2",
|
|
4
|
+
"description": "Complete QR code toolkit. Zero dependencies. Logo overlay, PDF export, link optimizer. 5.4 kB core.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"module": "index.js",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js",
|
|
11
|
+
"./qr/qr-core": "./qr/qr-core.js",
|
|
12
|
+
"./utils/layout": "./utils/layout.js",
|
|
13
|
+
"./utils/url": "./utils/url.js",
|
|
14
|
+
"./utils/link": "./utils/link.js",
|
|
15
|
+
"./utils/logo": "./utils/logo.js",
|
|
16
|
+
"./renderers/svg": "./renderers/svg.js",
|
|
17
|
+
"./renderers/canvas": "./renderers/canvas.js",
|
|
18
|
+
"./utils/raster": "./utils/raster.js",
|
|
19
|
+
"./utils/jpegQr": "./utils/jpegQr.js",
|
|
20
|
+
"./utils/poster": "./utils/poster.js",
|
|
21
|
+
"./utils/pdf": "./utils/pdf.js",
|
|
22
|
+
"./worker/qr.worker": "./worker/qr.worker.js"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node tests/run.js",
|
|
26
|
+
"test:watch": "node --watch tests/run.js",
|
|
27
|
+
"size": "node scripts/size.js"
|
|
28
|
+
},
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"keywords": [
|
|
31
|
+
"qr",
|
|
32
|
+
"qrcode",
|
|
33
|
+
"qr-code",
|
|
34
|
+
"generator",
|
|
35
|
+
"zero-dependencies",
|
|
36
|
+
"logo",
|
|
37
|
+
"pdf",
|
|
38
|
+
"svg",
|
|
39
|
+
"react",
|
|
40
|
+
"typescript",
|
|
41
|
+
"browser",
|
|
42
|
+
"nodejs"
|
|
43
|
+
],
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=17"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"react": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"index.js",
|
|
54
|
+
"qr/",
|
|
55
|
+
"components/",
|
|
56
|
+
"renderers/",
|
|
57
|
+
"utils/",
|
|
58
|
+
"worker/",
|
|
59
|
+
"types/",
|
|
60
|
+
"CHANGELOG.md"
|
|
61
|
+
],
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/Yaroslav3991/qr-kit.git"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://github.com/Yaroslav3991/qr-kit/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/Yaroslav3991/qr-kit#readme"
|
|
71
|
+
}
|
package/utils/logo.js
CHANGED
|
@@ -26,7 +26,7 @@ import { makeQrPathSplit } from '../renderers/svg.js';
|
|
|
26
26
|
// ─── Public constants ──────────────────────────────────────────────────────────
|
|
27
27
|
|
|
28
28
|
/** Maximum fraction of QR area safe to cover with ECC M (~15% budget, 4% safety margin). */
|
|
29
|
-
export const LOGO_MAX_COVERAGE_ECC_M = 0.
|
|
29
|
+
export const LOGO_MAX_COVERAGE_ECC_M = 0.06;
|
|
30
30
|
|
|
31
31
|
/** Maximum fraction of QR area safe to cover with ECC L (~7% budget, 3% safety margin). */
|
|
32
32
|
export const LOGO_MAX_COVERAGE_ECC_L = 0.04;
|