qrdx 0.0.46 → 0.0.47
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/LICENSE +21 -0
- package/README.md +353 -300
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -7
- package/dist/index.mjs.map +1 -1
- package/dist/qr-code-canvas.js +12 -0
- package/dist/qr-code-canvas.js.map +1 -0
- package/dist/qr-code-canvas.mjs +12 -0
- package/dist/qr-code-canvas.mjs.map +1 -0
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/art-trace.d.ts +46 -0
- package/dist/src/art-trace.d.ts.map +1 -0
- package/dist/src/art.d.ts +138 -0
- package/dist/src/art.d.ts.map +1 -0
- package/dist/src/body-patterns.d.ts +34 -0
- package/dist/src/body-patterns.d.ts.map +1 -0
- package/dist/src/codegen.d.ts +5 -5
- package/dist/src/codegen.d.ts.map +1 -1
- package/dist/src/codeword-map.d.ts +40 -0
- package/dist/src/codeword-map.d.ts.map +1 -0
- package/dist/src/constants.d.ts +4 -7
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/corner-dot.d.ts +3 -1
- package/dist/src/corner-dot.d.ts.map +1 -1
- package/dist/src/corner-eye.d.ts +5 -2
- package/dist/src/corner-eye.d.ts.map +1 -1
- package/dist/src/detection.d.ts.map +1 -1
- package/dist/src/download.d.ts +22 -5
- package/dist/src/download.d.ts.map +1 -1
- package/dist/src/eps.d.ts +62 -0
- package/dist/src/eps.d.ts.map +1 -0
- package/dist/src/frame-icons.d.ts +11 -0
- package/dist/src/frame-icons.d.ts.map +1 -0
- package/dist/src/frame-import.d.ts +61 -0
- package/dist/src/frame-import.d.ts.map +1 -0
- package/dist/src/frame-spec.d.ts +24 -0
- package/dist/src/frame-spec.d.ts.map +1 -0
- package/dist/src/frame-styles.d.ts +50 -0
- package/dist/src/frame-styles.d.ts.map +1 -0
- package/dist/src/frame.d.ts +126 -0
- package/dist/src/frame.d.ts.map +1 -0
- package/dist/src/frames/builtin.d.ts +8 -0
- package/dist/src/frames/builtin.d.ts.map +1 -0
- package/dist/src/frames/official.d.ts +18 -0
- package/dist/src/frames/official.d.ts.map +1 -0
- package/dist/src/helpers.d.ts +15 -2
- package/dist/src/helpers.d.ts.map +1 -1
- package/dist/src/index.d.ts +24 -13
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logo-budget.d.ts +54 -0
- package/dist/src/logo-budget.d.ts.map +1 -0
- package/dist/src/logo-cleanup.d.ts +25 -0
- package/dist/src/logo-cleanup.d.ts.map +1 -0
- package/dist/src/logo.d.ts +28 -0
- package/dist/src/logo.d.ts.map +1 -0
- package/dist/src/print.d.ts +73 -0
- package/dist/src/print.d.ts.map +1 -0
- package/dist/src/qr-code-canvas.d.ts +13 -0
- package/dist/src/qr-code-canvas.d.ts.map +1 -0
- package/dist/src/qr-code.d.ts +4 -2
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/qr-outline.d.ts +41 -0
- package/dist/src/qr-outline.d.ts.map +1 -0
- package/dist/src/qr-shape.d.ts +72 -0
- package/dist/src/qr-shape.d.ts.map +1 -0
- package/dist/src/scan-risk.d.ts +40 -0
- package/dist/src/scan-risk.d.ts.map +1 -0
- package/dist/src/scan-score.d.ts +154 -0
- package/dist/src/scan-score.d.ts.map +1 -0
- package/dist/src/shapes.d.ts +36 -0
- package/dist/src/shapes.d.ts.map +1 -0
- package/dist/src/silhouette.d.ts +28 -0
- package/dist/src/silhouette.d.ts.map +1 -0
- package/dist/src/utils/color.d.ts.map +1 -1
- package/dist/src/utils/fmt.d.ts +24 -0
- package/dist/src/utils/fmt.d.ts.map +1 -0
- package/dist/src/utils/paint.d.ts +80 -0
- package/dist/src/utils/paint.d.ts.map +1 -0
- package/dist/src/utils/parse-color.d.ts +21 -0
- package/dist/src/utils/parse-color.d.ts.map +1 -0
- package/dist/src/utils/path-data.d.ts +24 -0
- package/dist/src/utils/path-data.d.ts.map +1 -0
- package/dist/src/utils/png.d.ts +16 -0
- package/dist/src/utils/png.d.ts.map +1 -0
- package/dist/src/utils/polygon-clip.d.ts +26 -0
- package/dist/src/utils/polygon-clip.d.ts.map +1 -0
- package/dist/src/utils/print-shared.d.ts +20 -0
- package/dist/src/utils/print-shared.d.ts.map +1 -0
- package/dist/src/utils/svg-geometry.d.ts +49 -0
- package/dist/src/utils/svg-geometry.d.ts.map +1 -0
- package/dist/src/utils/svg-gradient.d.ts +59 -0
- package/dist/src/utils/svg-gradient.d.ts.map +1 -0
- package/dist/src/utils/svg-painter.d.ts +152 -0
- package/dist/src/utils/svg-painter.d.ts.map +1 -0
- package/dist/src/utils.d.ts +18 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/types/art.d.ts +64 -0
- package/dist/types/art.d.ts.map +1 -0
- package/dist/types/color.d.ts +125 -7
- package/dist/types/color.d.ts.map +1 -1
- package/dist/types/corner-dot.d.ts +52 -2
- package/dist/types/corner-dot.d.ts.map +1 -1
- package/dist/types/corner-eye.d.ts +43 -2
- package/dist/types/corner-eye.d.ts.map +1 -1
- package/dist/types/frame-spec.d.ts +3509 -0
- package/dist/types/frame-spec.d.ts.map +1 -0
- package/dist/types/frame.d.ts +68 -0
- package/dist/types/frame.d.ts.map +1 -0
- package/dist/types/image-pattern.d.ts +15 -1
- package/dist/types/image-pattern.d.ts.map +1 -1
- package/dist/types/index.d.ts +15 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +6 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/qr.d.ts +1684 -4
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/template.d.ts +2 -2
- package/dist/types/template.d.ts.map +1 -1
- package/package.json +68 -25
- package/src/api.tsx +67 -17
- package/src/art-trace.ts +554 -0
- package/src/art.tsx +2226 -0
- package/src/body-patterns.tsx +389 -0
- package/src/codegen.ts +10 -5
- package/src/codeword-map.ts +265 -0
- package/src/constants.ts +4 -8
- package/src/corner-dot.tsx +209 -33
- package/src/corner-eye.ts +328 -60
- package/src/detection.ts +5 -11
- package/src/download.tsx +123 -52
- package/src/eps.ts +701 -0
- package/src/frame-icons.ts +325 -0
- package/src/frame-import.ts +1198 -0
- package/src/frame-spec.ts +518 -0
- package/src/frame-styles.ts +1095 -0
- package/src/frame.tsx +630 -0
- package/src/frames/builtin/banner-bottom.json +58 -0
- package/src/frames/builtin/circle.json +81 -0
- package/src/frames/builtin/rounded-border.json +60 -0
- package/src/frames/builtin/ticket.json +51 -0
- package/src/frames/builtin.ts +20 -0
- package/src/frames/official/attendance.json +110 -0
- package/src/frames/official/audio-guide.json +95 -0
- package/src/frames/official/book-now.json +103 -0
- package/src/frames/official/check-in.json +110 -0
- package/src/frames/official/christmas.json +131 -0
- package/src/frames/official/donate.json +77 -0
- package/src/frames/official/event-ticket.json +77 -0
- package/src/frames/official/feedback-bubble.json +73 -0
- package/src/frames/official/follow-us.json +83 -0
- package/src/frames/official/get-the-app.json +107 -0
- package/src/frames/official/halloween.json +80 -0
- package/src/frames/official/new-year.json +94 -0
- package/src/frames/official/order-at-table.json +86 -0
- package/src/frames/official/product-info.json +119 -0
- package/src/frames/official/register-product.json +77 -0
- package/src/frames/official/review-us.json +127 -0
- package/src/frames/official/rsvp-card.json +112 -0
- package/src/frames/official/save-contact.json +117 -0
- package/src/frames/official/scan-to-pay.json +94 -0
- package/src/frames/official/shop-window.json +81 -0
- package/src/frames/official/sign-rider.json +81 -0
- package/src/frames/official/table-tent.json +75 -0
- package/src/frames/official/wifi-card.json +89 -0
- package/src/frames/official/winter.json +142 -0
- package/src/frames/official.ts +77 -0
- package/src/helpers.ts +168 -11
- package/src/index.tsx +141 -172
- package/src/logo-budget.ts +226 -0
- package/src/logo-cleanup.ts +146 -0
- package/src/logo.tsx +137 -0
- package/src/print.ts +794 -0
- package/src/qr-code-canvas.tsx +241 -0
- package/src/qr-code.tsx +51 -16
- package/src/qr-outline.ts +511 -0
- package/src/qr-shape.ts +255 -0
- package/src/scan-risk.ts +197 -0
- package/src/scan-score.ts +1629 -0
- package/src/shapes.ts +169 -0
- package/src/silhouette.ts +334 -0
- package/src/utils/color.ts +10 -1
- package/src/utils/fmt.ts +59 -0
- package/src/utils/paint.ts +317 -0
- package/src/utils/parse-color.ts +135 -0
- package/src/utils/path-data.ts +182 -0
- package/src/utils/png.ts +175 -0
- package/src/utils/polygon-clip.ts +163 -0
- package/src/utils/print-shared.ts +74 -0
- package/src/utils/svg-geometry.ts +838 -0
- package/src/utils/svg-gradient.ts +407 -0
- package/src/utils/svg-painter.ts +946 -0
- package/src/utils.tsx +794 -385
- package/types/art.ts +74 -0
- package/types/color.ts +132 -12
- package/types/corner-dot.ts +41 -4
- package/types/corner-eye.ts +31 -4
- package/types/frame-spec.ts +748 -0
- package/types/frame.ts +67 -0
- package/types/image-pattern.ts +15 -0
- package/types/index.ts +106 -4
- package/types/qr.ts +180 -2
- package/types/template.ts +2 -2
- package/dist/cli.js +0 -4319
package/dist/types/qr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../types/qr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../types/qr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,cAAc,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAGzC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAGlC,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,GAAG,CAAC,EAAE,KAAK,CAAC;IAEZ,SAAS,CAAC,EAAE,SAAS,CAAC;IAGtB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,SAAS,CAAC,EAAE,OAAO,CAAC;IAIpB,KAAK,CAAC,EAAE,WAAW,CAAC;IAKpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,GACjC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC"}
|
package/dist/types/template.d.ts
CHANGED
|
@@ -33,10 +33,10 @@ export declare const templateDefinitionBaseSchema: z.ZodObject<{
|
|
|
33
33
|
}, z.core.$strip>;
|
|
34
34
|
export type BaseTemplateProps = z.infer<typeof baseTemplatePropsSchema>;
|
|
35
35
|
export type TemplateConfig = z.infer<typeof templateConfigSchema>;
|
|
36
|
-
export
|
|
36
|
+
export interface TemplateDefinition<TCustomProps = Record<string, never>> {
|
|
37
37
|
id: string;
|
|
38
38
|
name: string;
|
|
39
39
|
description?: string;
|
|
40
40
|
wrapper: (children: React.ReactNode, props?: BaseTemplateProps & TCustomProps, templateConfig?: TemplateConfig) => React.ReactNode;
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../types/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,MAAM,
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../types/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,MAAM,WAAW,kBAAkB,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,CACP,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,KAAK,CAAC,EAAE,iBAAiB,GAAG,YAAY,EACxC,cAAc,CAAC,EAAE,cAAc,KAC5B,KAAK,CAAC,SAAS,CAAC;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qrdx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.47",
|
|
4
|
+
"description": "Customizable QR code generator for React: SVG and canvas rendering, dot and eye patterns, gradients, logos, frames, Logo QR and Image QR art, PNG/SVG/PDF/EPS export, a scan score and QR scanning.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"qr-code",
|
|
7
|
+
"qrcode",
|
|
8
|
+
"qr-code-generator",
|
|
9
|
+
"react-qr-code",
|
|
10
|
+
"react",
|
|
11
|
+
"svg",
|
|
12
|
+
"typescript",
|
|
13
|
+
"qr-scanner",
|
|
14
|
+
"qr-code-svg",
|
|
15
|
+
"qr-code-logo",
|
|
16
|
+
"eps",
|
|
17
|
+
"pdf"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://qrdx.dev/docs",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/bucharitesh/qrdx/issues"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/bucharitesh/qrdx.git",
|
|
26
|
+
"directory": "packages/qrdx"
|
|
27
|
+
},
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"author": "Ritesh Bucha",
|
|
30
|
+
"sideEffects": false,
|
|
4
31
|
"main": "./dist/index.js",
|
|
5
32
|
"module": "./dist/index.mjs",
|
|
6
33
|
"types": "./dist/src/index.d.ts",
|
|
@@ -16,41 +43,57 @@
|
|
|
16
43
|
}
|
|
17
44
|
},
|
|
18
45
|
"./types": {
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./dist/types/index.d.ts",
|
|
48
|
+
"default": "./dist/types/index.mjs"
|
|
49
|
+
},
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./dist/types/index.d.ts",
|
|
52
|
+
"default": "./dist/types/index.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"./package.json": "./package.json"
|
|
26
56
|
},
|
|
27
57
|
"files": [
|
|
28
58
|
"dist",
|
|
29
59
|
"types",
|
|
30
60
|
"src"
|
|
31
61
|
],
|
|
32
|
-
"scripts": {
|
|
33
|
-
"build": "tsup && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
34
|
-
"clean": "git clean -xdf .cache .turbo dist node_modules",
|
|
35
|
-
"typecheck": "tsc --noEmit"
|
|
36
|
-
},
|
|
37
62
|
"dependencies": {
|
|
38
|
-
"jspdf": "^3.0.4",
|
|
39
63
|
"jsqr": "^1.4.0",
|
|
40
|
-
"
|
|
41
|
-
"sharp": "^0.34.2",
|
|
42
|
-
"zod": "^4.3.5"
|
|
64
|
+
"zod": "^4.6.7"
|
|
43
65
|
},
|
|
44
66
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@types/
|
|
47
|
-
"@types/react": "19.
|
|
48
|
-
"
|
|
49
|
-
"next": "16.
|
|
50
|
-
"
|
|
51
|
-
"
|
|
67
|
+
"@types/node": "26.6.6",
|
|
68
|
+
"@types/react": "19.3.0",
|
|
69
|
+
"@types/react-dom": "19.3.0",
|
|
70
|
+
"jspdf": "^4.2.1",
|
|
71
|
+
"next": "16.4.3",
|
|
72
|
+
"react": "^19.3.1",
|
|
73
|
+
"tsup": "^9.0.0",
|
|
74
|
+
"typescript": "6.0.3",
|
|
75
|
+
"vitest": "^5.0.5",
|
|
76
|
+
"@repo/typescript-config": "0.0.0"
|
|
52
77
|
},
|
|
53
78
|
"peerDependencies": {
|
|
79
|
+
"jspdf": "^2.5.0 || ^3.0.0 || ^4.0.0",
|
|
80
|
+
"react": ">=18.0.0",
|
|
54
81
|
"react-dom": ">=18.0.0"
|
|
82
|
+
},
|
|
83
|
+
"peerDependenciesMeta": {
|
|
84
|
+
"jspdf": {
|
|
85
|
+
"optional": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=18"
|
|
90
|
+
},
|
|
91
|
+
"scripts": {
|
|
92
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsup && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
93
|
+
"build:inplace": "tsup && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
94
|
+
"clean": "git clean -xdf .cache .turbo dist node_modules",
|
|
95
|
+
"typecheck": "tsc --noEmit",
|
|
96
|
+
"test": "vitest run",
|
|
97
|
+
"readme": "node scripts/readme-catalogue.mjs"
|
|
55
98
|
}
|
|
56
|
-
}
|
|
99
|
+
}
|
package/src/api.tsx
CHANGED
|
@@ -8,7 +8,15 @@ import {
|
|
|
8
8
|
DEFAULT_SIZE,
|
|
9
9
|
ERROR_LEVEL_MAP,
|
|
10
10
|
} from "./constants";
|
|
11
|
-
import {
|
|
11
|
+
import { isFrameActive, wrapWithFrame } from "./frame";
|
|
12
|
+
import { renderLogo } from "./logo";
|
|
13
|
+
import { capImageSettings } from "./logo-budget";
|
|
14
|
+
import {
|
|
15
|
+
excavateModules,
|
|
16
|
+
generatePath,
|
|
17
|
+
getImageSettings,
|
|
18
|
+
resolveErrorLevel,
|
|
19
|
+
} from "./utils";
|
|
12
20
|
import { getSolidColor } from "./utils/color";
|
|
13
21
|
|
|
14
22
|
export async function getQRAsSVG(props: QRPropsSVG) {
|
|
@@ -19,13 +27,42 @@ export async function getQRAsSVG(props: QRPropsSVG) {
|
|
|
19
27
|
bgColor = DEFAULT_BGCOLOR,
|
|
20
28
|
fgColor = DEFAULT_FGCOLOR,
|
|
21
29
|
margin = DEFAULT_MARGIN,
|
|
22
|
-
imageSettings,
|
|
30
|
+
imageSettings: requestedImageSettings,
|
|
31
|
+
// Styling props this plain renderer does not support; keep them off <svg>.
|
|
32
|
+
eyeColor: _eyeColor,
|
|
33
|
+
dotColor: _dotColor,
|
|
34
|
+
bodyPattern: _bodyPattern,
|
|
35
|
+
cornerEyePattern: _cornerEyePattern,
|
|
36
|
+
cornerEyeDotPattern: _cornerEyeDotPattern,
|
|
37
|
+
isOGContext: _isOGContext,
|
|
38
|
+
templateId: _templateId,
|
|
39
|
+
customTemplate: _customTemplate,
|
|
40
|
+
customProps: _customProps,
|
|
41
|
+
frame,
|
|
42
|
+
art: _art,
|
|
43
|
+
eyeColors: _eyeColors,
|
|
44
|
+
moduleScale: _moduleScale,
|
|
45
|
+
frameLabelMarkers: _frameLabelMarkers,
|
|
46
|
+
autoLevel,
|
|
23
47
|
...otherProps
|
|
24
48
|
} = props;
|
|
49
|
+
// A logo no bigger than the code can repair (logo-budget.ts)
|
|
50
|
+
const imageSettings = capImageSettings(
|
|
51
|
+
{ value, size, margin, level, autoLevel },
|
|
52
|
+
requestedImageSettings
|
|
53
|
+
);
|
|
54
|
+
const effectiveLevel = resolveErrorLevel({
|
|
55
|
+
value,
|
|
56
|
+
size,
|
|
57
|
+
level,
|
|
58
|
+
margin,
|
|
59
|
+
imageSettings,
|
|
60
|
+
autoLevel,
|
|
61
|
+
});
|
|
25
62
|
|
|
26
63
|
let cells = qrcodegen.QrCode.encodeText(
|
|
27
64
|
value,
|
|
28
|
-
ERROR_LEVEL_MAP[
|
|
65
|
+
ERROR_LEVEL_MAP[effectiveLevel]
|
|
29
66
|
).getModules();
|
|
30
67
|
|
|
31
68
|
const numCells = cells.length + margin * 2;
|
|
@@ -42,19 +79,27 @@ export async function getQRAsSVG(props: QRPropsSVG) {
|
|
|
42
79
|
cells = excavateModules(cells, calculatedImageSettings.excavation);
|
|
43
80
|
}
|
|
44
81
|
|
|
45
|
-
const base64Image =
|
|
46
|
-
|
|
47
|
-
|
|
82
|
+
const base64Image = imageSettings.src.startsWith("data:")
|
|
83
|
+
? imageSettings.src
|
|
84
|
+
: await fetch(
|
|
85
|
+
`https://wsrv.nl/?url=${encodeURIComponent(imageSettings.src)}&w=100&h=100&encoding=base64`
|
|
86
|
+
).then((res) => {
|
|
87
|
+
if (!res.ok) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`Failed to load QR logo (${res.status}): ${imageSettings.src}`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return res.text();
|
|
93
|
+
});
|
|
48
94
|
|
|
49
|
-
image = (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/>
|
|
95
|
+
image = renderLogo(
|
|
96
|
+
{ ...imageSettings, src: base64Image },
|
|
97
|
+
{
|
|
98
|
+
x: calculatedImageSettings.x + margin,
|
|
99
|
+
y: calculatedImageSettings.y + margin,
|
|
100
|
+
w: calculatedImageSettings.w,
|
|
101
|
+
h: calculatedImageSettings.h,
|
|
102
|
+
}
|
|
58
103
|
);
|
|
59
104
|
}
|
|
60
105
|
|
|
@@ -65,14 +110,15 @@ export async function getQRAsSVG(props: QRPropsSVG) {
|
|
|
65
110
|
// For level 1, 441 nodes -> 2
|
|
66
111
|
// For level 40, 31329 -> 2
|
|
67
112
|
const fgPath = generatePath(cells, margin);
|
|
113
|
+
const framed = isFrameActive(frame);
|
|
68
114
|
|
|
69
|
-
|
|
115
|
+
const code = (
|
|
70
116
|
<svg
|
|
71
117
|
height={size}
|
|
72
118
|
viewBox={`0 0 ${numCells} ${numCells}`}
|
|
73
119
|
width={size}
|
|
74
120
|
xmlns="http://www.w3.org/2000/svg"
|
|
75
|
-
{...otherProps}
|
|
121
|
+
{...(framed ? {} : otherProps)}
|
|
76
122
|
>
|
|
77
123
|
<path
|
|
78
124
|
d={`M0,0 h${numCells}v${numCells}H0z`}
|
|
@@ -87,4 +133,8 @@ export async function getQRAsSVG(props: QRPropsSVG) {
|
|
|
87
133
|
{image}
|
|
88
134
|
</svg>
|
|
89
135
|
);
|
|
136
|
+
|
|
137
|
+
return framed
|
|
138
|
+
? wrapWithFrame(code, { size, frame, bgColor, svgProps: otherProps })
|
|
139
|
+
: code;
|
|
90
140
|
}
|