qrdx 0.0.45 → 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.
Files changed (206) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +353 -300
  3. package/dist/index.js +27 -7
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +27 -7
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/qr-code-canvas.js +12 -0
  8. package/dist/qr-code-canvas.js.map +1 -0
  9. package/dist/qr-code-canvas.mjs +12 -0
  10. package/dist/qr-code-canvas.mjs.map +1 -0
  11. package/dist/src/api.d.ts.map +1 -1
  12. package/dist/src/art-trace.d.ts +46 -0
  13. package/dist/src/art-trace.d.ts.map +1 -0
  14. package/dist/src/art.d.ts +138 -0
  15. package/dist/src/art.d.ts.map +1 -0
  16. package/dist/src/body-patterns.d.ts +34 -0
  17. package/dist/src/body-patterns.d.ts.map +1 -0
  18. package/dist/src/codegen.d.ts +5 -5
  19. package/dist/src/codegen.d.ts.map +1 -1
  20. package/dist/src/codeword-map.d.ts +40 -0
  21. package/dist/src/codeword-map.d.ts.map +1 -0
  22. package/dist/src/constants.d.ts +4 -7
  23. package/dist/src/constants.d.ts.map +1 -1
  24. package/dist/src/corner-dot.d.ts +3 -1
  25. package/dist/src/corner-dot.d.ts.map +1 -1
  26. package/dist/src/corner-eye.d.ts +5 -2
  27. package/dist/src/corner-eye.d.ts.map +1 -1
  28. package/dist/src/detection.d.ts.map +1 -1
  29. package/dist/src/download.d.ts +22 -5
  30. package/dist/src/download.d.ts.map +1 -1
  31. package/dist/src/eps.d.ts +62 -0
  32. package/dist/src/eps.d.ts.map +1 -0
  33. package/dist/src/frame-icons.d.ts +11 -0
  34. package/dist/src/frame-icons.d.ts.map +1 -0
  35. package/dist/src/frame-import.d.ts +61 -0
  36. package/dist/src/frame-import.d.ts.map +1 -0
  37. package/dist/src/frame-spec.d.ts +24 -0
  38. package/dist/src/frame-spec.d.ts.map +1 -0
  39. package/dist/src/frame-styles.d.ts +50 -0
  40. package/dist/src/frame-styles.d.ts.map +1 -0
  41. package/dist/src/frame.d.ts +126 -0
  42. package/dist/src/frame.d.ts.map +1 -0
  43. package/dist/src/frames/builtin.d.ts +8 -0
  44. package/dist/src/frames/builtin.d.ts.map +1 -0
  45. package/dist/src/frames/official.d.ts +18 -0
  46. package/dist/src/frames/official.d.ts.map +1 -0
  47. package/dist/src/helpers.d.ts +15 -2
  48. package/dist/src/helpers.d.ts.map +1 -1
  49. package/dist/src/index.d.ts +24 -13
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/dist/src/logo-budget.d.ts +54 -0
  52. package/dist/src/logo-budget.d.ts.map +1 -0
  53. package/dist/src/logo-cleanup.d.ts +25 -0
  54. package/dist/src/logo-cleanup.d.ts.map +1 -0
  55. package/dist/src/logo.d.ts +28 -0
  56. package/dist/src/logo.d.ts.map +1 -0
  57. package/dist/src/print.d.ts +73 -0
  58. package/dist/src/print.d.ts.map +1 -0
  59. package/dist/src/qr-code-canvas.d.ts +13 -0
  60. package/dist/src/qr-code-canvas.d.ts.map +1 -0
  61. package/dist/src/qr-code.d.ts +4 -2
  62. package/dist/src/qr-code.d.ts.map +1 -1
  63. package/dist/src/qr-outline.d.ts +41 -0
  64. package/dist/src/qr-outline.d.ts.map +1 -0
  65. package/dist/src/qr-shape.d.ts +72 -0
  66. package/dist/src/qr-shape.d.ts.map +1 -0
  67. package/dist/src/scan-risk.d.ts +40 -0
  68. package/dist/src/scan-risk.d.ts.map +1 -0
  69. package/dist/src/scan-score.d.ts +154 -0
  70. package/dist/src/scan-score.d.ts.map +1 -0
  71. package/dist/src/shapes.d.ts +36 -0
  72. package/dist/src/shapes.d.ts.map +1 -0
  73. package/dist/src/silhouette.d.ts +28 -0
  74. package/dist/src/silhouette.d.ts.map +1 -0
  75. package/dist/src/utils/color.d.ts.map +1 -1
  76. package/dist/src/utils/fmt.d.ts +24 -0
  77. package/dist/src/utils/fmt.d.ts.map +1 -0
  78. package/dist/src/utils/paint.d.ts +80 -0
  79. package/dist/src/utils/paint.d.ts.map +1 -0
  80. package/dist/src/utils/parse-color.d.ts +21 -0
  81. package/dist/src/utils/parse-color.d.ts.map +1 -0
  82. package/dist/src/utils/path-data.d.ts +24 -0
  83. package/dist/src/utils/path-data.d.ts.map +1 -0
  84. package/dist/src/utils/png.d.ts +16 -0
  85. package/dist/src/utils/png.d.ts.map +1 -0
  86. package/dist/src/utils/polygon-clip.d.ts +26 -0
  87. package/dist/src/utils/polygon-clip.d.ts.map +1 -0
  88. package/dist/src/utils/print-shared.d.ts +20 -0
  89. package/dist/src/utils/print-shared.d.ts.map +1 -0
  90. package/dist/src/utils/svg-geometry.d.ts +49 -0
  91. package/dist/src/utils/svg-geometry.d.ts.map +1 -0
  92. package/dist/src/utils/svg-gradient.d.ts +59 -0
  93. package/dist/src/utils/svg-gradient.d.ts.map +1 -0
  94. package/dist/src/utils/svg-painter.d.ts +152 -0
  95. package/dist/src/utils/svg-painter.d.ts.map +1 -0
  96. package/dist/src/utils.d.ts +18 -2
  97. package/dist/src/utils.d.ts.map +1 -1
  98. package/dist/types/art.d.ts +64 -0
  99. package/dist/types/art.d.ts.map +1 -0
  100. package/dist/types/color.d.ts +125 -7
  101. package/dist/types/color.d.ts.map +1 -1
  102. package/dist/types/corner-dot.d.ts +52 -2
  103. package/dist/types/corner-dot.d.ts.map +1 -1
  104. package/dist/types/corner-eye.d.ts +43 -2
  105. package/dist/types/corner-eye.d.ts.map +1 -1
  106. package/dist/types/frame-spec.d.ts +3509 -0
  107. package/dist/types/frame-spec.d.ts.map +1 -0
  108. package/dist/types/frame.d.ts +68 -0
  109. package/dist/types/frame.d.ts.map +1 -0
  110. package/dist/types/image-pattern.d.ts +15 -1
  111. package/dist/types/image-pattern.d.ts.map +1 -1
  112. package/dist/types/index.d.ts +15 -9
  113. package/dist/types/index.d.ts.map +1 -1
  114. package/dist/types/index.js +6 -0
  115. package/dist/types/index.js.map +1 -0
  116. package/dist/types/index.mjs +6 -0
  117. package/dist/types/index.mjs.map +1 -0
  118. package/dist/types/qr.d.ts +1684 -4
  119. package/dist/types/qr.d.ts.map +1 -1
  120. package/dist/types/template.d.ts +2 -2
  121. package/dist/types/template.d.ts.map +1 -1
  122. package/package.json +63 -20
  123. package/src/api.tsx +67 -17
  124. package/src/art-trace.ts +554 -0
  125. package/src/art.tsx +2226 -0
  126. package/src/body-patterns.tsx +389 -0
  127. package/src/codegen.ts +10 -5
  128. package/src/codeword-map.ts +265 -0
  129. package/src/constants.ts +4 -8
  130. package/src/corner-dot.tsx +209 -33
  131. package/src/corner-eye.ts +328 -60
  132. package/src/detection.ts +5 -11
  133. package/src/download.tsx +123 -52
  134. package/src/eps.ts +701 -0
  135. package/src/frame-icons.ts +325 -0
  136. package/src/frame-import.ts +1198 -0
  137. package/src/frame-spec.ts +518 -0
  138. package/src/frame-styles.ts +1095 -0
  139. package/src/frame.tsx +630 -0
  140. package/src/frames/builtin/banner-bottom.json +58 -0
  141. package/src/frames/builtin/circle.json +81 -0
  142. package/src/frames/builtin/rounded-border.json +60 -0
  143. package/src/frames/builtin/ticket.json +51 -0
  144. package/src/frames/builtin.ts +20 -0
  145. package/src/frames/official/attendance.json +110 -0
  146. package/src/frames/official/audio-guide.json +95 -0
  147. package/src/frames/official/book-now.json +103 -0
  148. package/src/frames/official/check-in.json +110 -0
  149. package/src/frames/official/christmas.json +131 -0
  150. package/src/frames/official/donate.json +77 -0
  151. package/src/frames/official/event-ticket.json +77 -0
  152. package/src/frames/official/feedback-bubble.json +73 -0
  153. package/src/frames/official/follow-us.json +83 -0
  154. package/src/frames/official/get-the-app.json +107 -0
  155. package/src/frames/official/halloween.json +80 -0
  156. package/src/frames/official/new-year.json +94 -0
  157. package/src/frames/official/order-at-table.json +86 -0
  158. package/src/frames/official/product-info.json +119 -0
  159. package/src/frames/official/register-product.json +77 -0
  160. package/src/frames/official/review-us.json +127 -0
  161. package/src/frames/official/rsvp-card.json +112 -0
  162. package/src/frames/official/save-contact.json +117 -0
  163. package/src/frames/official/scan-to-pay.json +94 -0
  164. package/src/frames/official/shop-window.json +81 -0
  165. package/src/frames/official/sign-rider.json +81 -0
  166. package/src/frames/official/table-tent.json +75 -0
  167. package/src/frames/official/wifi-card.json +89 -0
  168. package/src/frames/official/winter.json +142 -0
  169. package/src/frames/official.ts +77 -0
  170. package/src/helpers.ts +168 -11
  171. package/src/index.tsx +141 -172
  172. package/src/logo-budget.ts +226 -0
  173. package/src/logo-cleanup.ts +146 -0
  174. package/src/logo.tsx +137 -0
  175. package/src/print.ts +794 -0
  176. package/src/qr-code-canvas.tsx +241 -0
  177. package/src/qr-code.tsx +51 -16
  178. package/src/qr-outline.ts +511 -0
  179. package/src/qr-shape.ts +255 -0
  180. package/src/scan-risk.ts +197 -0
  181. package/src/scan-score.ts +1629 -0
  182. package/src/shapes.ts +169 -0
  183. package/src/silhouette.ts +334 -0
  184. package/src/utils/color.ts +10 -1
  185. package/src/utils/fmt.ts +59 -0
  186. package/src/utils/paint.ts +317 -0
  187. package/src/utils/parse-color.ts +135 -0
  188. package/src/utils/path-data.ts +182 -0
  189. package/src/utils/png.ts +175 -0
  190. package/src/utils/polygon-clip.ts +163 -0
  191. package/src/utils/print-shared.ts +74 -0
  192. package/src/utils/svg-geometry.ts +838 -0
  193. package/src/utils/svg-gradient.ts +407 -0
  194. package/src/utils/svg-painter.ts +946 -0
  195. package/src/utils.tsx +794 -385
  196. package/types/art.ts +74 -0
  197. package/types/color.ts +132 -12
  198. package/types/corner-dot.ts +41 -4
  199. package/types/corner-eye.ts +31 -4
  200. package/types/frame-spec.ts +748 -0
  201. package/types/frame.ts +67 -0
  202. package/types/image-pattern.ts +15 -0
  203. package/types/index.ts +106 -4
  204. package/types/qr.ts +180 -2
  205. package/types/template.ts +2 -2
  206. package/dist/cli.js +0 -4231
@@ -0,0 +1,241 @@
1
+ /** biome-ignore-all lint/style/noMagicNumbers: false positive */
2
+ /** biome-ignore-all lint/correctness/useImageSize: false positive */
3
+ /** biome-ignore-all lint/performance/noImgElement: false positive */
4
+ /** biome-ignore-all lint/a11y/noNoninteractiveElementInteractions: hidden loader image */
5
+
6
+ "use client";
7
+
8
+ /**
9
+ * @license qrcode.react
10
+ * Copyright (c) Paul O'Shannessy
11
+ * SPDX-License-Identifier: ISC
12
+ */
13
+ import { type JSX, useEffect, useRef, useState } from "react";
14
+ import type { QRPropsCanvas } from "../types";
15
+ import qrcodegen from "./codegen";
16
+ import {
17
+ DEFAULT_BGCOLOR,
18
+ DEFAULT_FGCOLOR,
19
+ DEFAULT_LEVEL,
20
+ DEFAULT_MARGIN,
21
+ DEFAULT_SIZE,
22
+ ERROR_LEVEL_MAP,
23
+ } from "./constants";
24
+ import { drawFrameOnCanvas, getFrameLayout, isFrameActive } from "./frame";
25
+ import { logoImageBox, traceLogoShape } from "./logo";
26
+ import { capImageSettings } from "./logo-budget";
27
+ import { getLayoutMargin, shapeBackground, shapeDecoration } from "./qr-shape";
28
+ import {
29
+ excavateModules,
30
+ generatePath,
31
+ getImageSettings,
32
+ resolveErrorLevel,
33
+ SUPPORTS_PATH2D,
34
+ } from "./utils";
35
+ import { getSolidColor } from "./utils/color";
36
+
37
+ export function QRCodeCanvas(props: QRPropsCanvas) {
38
+ const {
39
+ value,
40
+ size = DEFAULT_SIZE,
41
+ level = DEFAULT_LEVEL,
42
+ bgColor = DEFAULT_BGCOLOR,
43
+ fgColor = DEFAULT_FGCOLOR,
44
+ margin = DEFAULT_MARGIN,
45
+ style,
46
+ imageSettings: requestedImageSettings,
47
+ // SVG-only styling props: the canvas renderer draws plain square modules,
48
+ // so keep these off the <canvas> element.
49
+ eyeColor: _eyeColor,
50
+ dotColor: _dotColor,
51
+ bodyPattern: _bodyPattern,
52
+ cornerEyePattern: _cornerEyePattern,
53
+ cornerEyeDotPattern: _cornerEyeDotPattern,
54
+ isOGContext: _isOGContext,
55
+ templateId: _templateId,
56
+ customTemplate: _customTemplate,
57
+ customProps: _customProps,
58
+ frame,
59
+ art: _art,
60
+ eyeColors: _eyeColors,
61
+ moduleScale: _moduleScale,
62
+ frameLabelMarkers: _frameLabelMarkers,
63
+ autoLevel,
64
+ shape,
65
+ ...otherProps
66
+ } = props;
67
+ // A logo no bigger than the code can repair (logo-budget.ts)
68
+ const imageSettings = capImageSettings(
69
+ { value, size, margin, level, shape, autoLevel },
70
+ requestedImageSettings
71
+ );
72
+ const effectiveLevel = resolveErrorLevel({
73
+ value,
74
+ size,
75
+ level,
76
+ margin,
77
+ imageSettings,
78
+ autoLevel,
79
+ shape,
80
+ });
81
+ const imgSrc = imageSettings?.src;
82
+ const frameLayout = isFrameActive(frame)
83
+ ? getFrameLayout(size, frame, bgColor)
84
+ : null;
85
+ const outputWidth = frameLayout?.width ?? size;
86
+ const outputHeight = frameLayout?.height ?? size;
87
+ const _canvas = useRef<HTMLCanvasElement>(null);
88
+ const _image = useRef<HTMLImageElement>(null);
89
+
90
+ // We're just using this state to trigger rerenders when images load. We
91
+ // Don't actually read the value anywhere. A smarter use of useEffect would
92
+ // depend on this value.
93
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
94
+ const [_isImgLoaded, setIsImageLoaded] = useState(false);
95
+
96
+ useEffect(() => {
97
+ // Always update the canvas. It's cheap enough and we want to be correct
98
+ // with the current state.
99
+ if (_canvas.current != null) {
100
+ const canvas = _canvas.current;
101
+
102
+ const ctx = canvas.getContext("2d");
103
+ if (!ctx) {
104
+ return;
105
+ }
106
+
107
+ let cells = qrcodegen.QrCode.encodeText(
108
+ value,
109
+ ERROR_LEVEL_MAP[effectiveLevel]
110
+ ).getModules();
111
+
112
+ // A shaped code (circle, heart, silhouette) sits further in, inside
113
+ // its outline, with decorative modules around its quiet ring
114
+ const layoutMargin = getLayoutMargin(cells.length, margin, shape);
115
+ const decoration = shapeDecoration(value, cells.length, margin, shape);
116
+ const numCells = cells.length + layoutMargin * 2;
117
+ const calculatedImageSettings = getImageSettings(
118
+ cells,
119
+ size,
120
+ layoutMargin,
121
+ imageSettings
122
+ );
123
+
124
+ const image = _image.current;
125
+ const haveImageToRender =
126
+ calculatedImageSettings != null &&
127
+ image?.complete &&
128
+ image.naturalHeight !== 0 &&
129
+ image.naturalWidth !== 0;
130
+
131
+ if (haveImageToRender && calculatedImageSettings.excavation != null) {
132
+ cells = excavateModules(cells, calculatedImageSettings.excavation);
133
+ }
134
+
135
+ // We're going to scale this so that the number of drawable units
136
+ // matches the number of cells. This avoids rounding issues, but does
137
+ // result in some potentially unwanted single pixel issues between
138
+ // blocks, only in environments that don't support Path2D.
139
+ const pixelRatio = window.devicePixelRatio || 1;
140
+ canvas.width = outputWidth * pixelRatio;
141
+ canvas.height = outputHeight * pixelRatio;
142
+ ctx.scale(pixelRatio, pixelRatio);
143
+ if (frameLayout) {
144
+ drawFrameOnCanvas(ctx, frameLayout);
145
+ ctx.translate(frameLayout.qrX, frameLayout.qrY);
146
+ }
147
+ const scale = size / numCells;
148
+ ctx.scale(scale, scale);
149
+
150
+ // Draw solid background, only paint dark modules. This canvas draws
151
+ // solid colors only: a gradient uses its first stop, an image fill its
152
+ // underlay (QRCodeSVG and the exports draw them in full).
153
+ ctx.fillStyle = getSolidColor(bgColor, DEFAULT_BGCOLOR);
154
+ const background = shapeBackground(shape, numCells);
155
+ if (background && "circle" in background) {
156
+ ctx.beginPath();
157
+ ctx.arc(numCells / 2, numCells / 2, background.circle, 0, 2 * Math.PI);
158
+ ctx.fill();
159
+ } else if (background && SUPPORTS_PATH2D) {
160
+ ctx.fill(new Path2D(background.path), "evenodd");
161
+ } else {
162
+ ctx.fillRect(0, 0, numCells, numCells);
163
+ }
164
+
165
+ ctx.fillStyle = getSolidColor(fgColor, DEFAULT_FGCOLOR);
166
+ if (SUPPORTS_PATH2D) {
167
+ // $FlowFixMe: Path2D c'tor doesn't support args yet.
168
+ ctx.fill(new Path2D(generatePath(cells, layoutMargin)));
169
+ if (decoration) {
170
+ ctx.fill(new Path2D(generatePath(decoration, 0)));
171
+ }
172
+ } else {
173
+ for (const [grid, offset] of [
174
+ [cells, layoutMargin],
175
+ [decoration ?? [], 0],
176
+ ] as const) {
177
+ grid.forEach((row, rdx) => {
178
+ row.forEach((cell, cdx) => {
179
+ if (cell) {
180
+ ctx.fillRect(cdx + offset, rdx + offset, 1, 1);
181
+ }
182
+ });
183
+ });
184
+ }
185
+ }
186
+
187
+ if (haveImageToRender) {
188
+ const box = {
189
+ x: calculatedImageSettings.x + layoutMargin,
190
+ y: calculatedImageSettings.y + layoutMargin,
191
+ w: calculatedImageSettings.w,
192
+ h: calculatedImageSettings.h,
193
+ };
194
+ const shape = imageSettings?.shape ?? "square";
195
+ const plate = imageSettings?.plate;
196
+ const imageBox = logoImageBox(box, plate);
197
+ ctx.save();
198
+ if (plate) {
199
+ traceLogoShape(ctx, shape, box);
200
+ ctx.fillStyle = plate;
201
+ ctx.fill();
202
+ }
203
+ if (shape !== "square") {
204
+ traceLogoShape(ctx, shape, imageBox);
205
+ ctx.clip();
206
+ }
207
+ ctx.drawImage(image, imageBox.x, imageBox.y, imageBox.w, imageBox.h);
208
+ ctx.restore();
209
+ }
210
+ }
211
+ });
212
+
213
+ const canvasStyle = { height: outputHeight, width: outputWidth, ...style };
214
+ let img: JSX.Element | null = null;
215
+ if (imgSrc != null) {
216
+ img = (
217
+ <img
218
+ alt="QR code"
219
+ key={imgSrc}
220
+ onLoad={() => {
221
+ setIsImageLoaded(true);
222
+ }}
223
+ ref={_image}
224
+ src={imgSrc}
225
+ style={{ display: "none" }}
226
+ />
227
+ );
228
+ }
229
+ return (
230
+ <>
231
+ <canvas
232
+ height={outputHeight}
233
+ ref={_canvas}
234
+ style={canvasStyle}
235
+ width={outputWidth}
236
+ {...otherProps}
237
+ />
238
+ {img}
239
+ </>
240
+ );
241
+ }
package/src/qr-code.tsx CHANGED
@@ -1,14 +1,16 @@
1
- "use client";
2
-
1
+ // memo/useMemo are available in React Server Components, so QRCode can render
2
+ // on the server; only QRCodeCanvas needs a client boundary.
3
3
  import { memo, useMemo } from "react";
4
- import type { QRProps } from "../types";
5
- import { DEFAULT_MARGIN } from "./constants";
4
+ import type { LogoOptions, QRProps } from "../types";
5
+ import { DEFAULT_MARGIN, DEFAULT_SIZE } from "./constants";
6
6
  import { getQRData } from "./helpers";
7
7
  import { QRCodeSVG } from "./utils";
8
8
 
9
9
  interface QRCodeProps extends QRProps {
10
10
  hideLogo?: boolean;
11
11
  logo?: string;
12
+ /** Size, clear space and position of `logo` (see `LogoOptions`) */
13
+ logoOptions?: LogoOptions;
12
14
  scale?: number;
13
15
  }
14
16
 
@@ -18,6 +20,7 @@ export const QRCode = memo(
18
20
  fgColor,
19
21
  hideLogo,
20
22
  logo,
23
+ logoOptions,
21
24
  bgColor,
22
25
  eyeColor,
23
26
  dotColor,
@@ -25,12 +28,23 @@ export const QRCode = memo(
25
28
  cornerEyePattern,
26
29
  cornerEyeDotPattern,
27
30
  level,
31
+ size = DEFAULT_SIZE,
28
32
  scale = 1,
29
33
  margin = DEFAULT_MARGIN,
34
+ style,
30
35
  templateId,
31
36
  customTemplate,
32
37
  customProps,
38
+ frame,
39
+ art,
40
+ eyeColors,
41
+ moduleScale,
42
+ autoLevel,
43
+ shape,
44
+ frameLabelMarkers,
33
45
  }: QRCodeProps) => {
46
+ // getQRData lays the logo out on a 1024px canvas; scale it to the rendered size.
47
+ const renderSize = size * scale;
34
48
  const qrData = useMemo(
35
49
  () =>
36
50
  getQRData({
@@ -46,14 +60,20 @@ export const QRCode = memo(
46
60
  level,
47
61
  templateId,
48
62
  logo,
63
+ logoOptions,
49
64
  margin,
65
+ autoLevel,
66
+ shape,
50
67
  }),
51
68
  [
52
69
  value,
53
70
  fgColor,
54
71
  hideLogo,
55
72
  logo,
73
+ logoOptions,
56
74
  margin,
75
+ autoLevel,
76
+ shape,
57
77
  bgColor,
58
78
  eyeColor,
59
79
  dotColor,
@@ -65,8 +85,26 @@ export const QRCode = memo(
65
85
  ]
66
86
  );
67
87
 
88
+ // Pixels of the 1024px layout → pixels of the rendered code
89
+ const ratio = renderSize / qrData.size;
90
+ const logoSettings = qrData.imageSettings && {
91
+ ...qrData.imageSettings,
92
+ height: qrData.imageSettings.height * ratio,
93
+ width: qrData.imageSettings.width * ratio,
94
+ ...(qrData.imageSettings.x != null && {
95
+ x: qrData.imageSettings.x * ratio,
96
+ }),
97
+ ...(qrData.imageSettings.y != null && {
98
+ y: qrData.imageSettings.y * ratio,
99
+ }),
100
+ ...(qrData.imageSettings.padding != null && {
101
+ padding: qrData.imageSettings.padding * ratio,
102
+ }),
103
+ };
104
+
68
105
  return (
69
106
  <QRCodeSVG
107
+ art={art}
70
108
  bgColor={qrData.bgColor}
71
109
  bodyPattern={qrData.bodyPattern}
72
110
  cornerEyeDotPattern={qrData.cornerEyeDotPattern}
@@ -76,22 +114,19 @@ export const QRCode = memo(
76
114
  dotColor={qrData.dotColor}
77
115
  eyeColor={qrData.eyeColor}
78
116
  fgColor={qrData.fgColor}
117
+ frame={frame}
79
118
  level={level || qrData.level}
80
119
  margin={qrData.margin}
81
- size={(qrData.size / 8) * scale}
120
+ {...(eyeColors && { eyeColors })}
121
+ {...(moduleScale !== undefined && { moduleScale })}
122
+ {...(autoLevel && { autoLevel })}
123
+ {...(shape && shape !== "square" && { shape })}
124
+ {...(frameLabelMarkers && { frameLabelMarkers })}
125
+ size={renderSize}
126
+ style={style}
82
127
  templateId={qrData.templateId}
83
128
  value={qrData.value}
84
- {...(qrData.imageSettings && {
85
- imageSettings: {
86
- ...qrData.imageSettings,
87
- height: qrData.imageSettings
88
- ? (qrData.imageSettings.height / 8) * scale
89
- : 0,
90
- width: qrData.imageSettings
91
- ? (qrData.imageSettings.width / 8) * scale
92
- : 0,
93
- },
94
- })}
129
+ {...(logoSettings && { imageSettings: logoSettings })}
95
130
  />
96
131
  );
97
132
  }