qrdx 0.0.46 → 0.0.48

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 (212) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +358 -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 +50 -6
  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 +25 -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/webp.d.ts +25 -0
  97. package/dist/src/utils/webp.d.ts.map +1 -0
  98. package/dist/src/utils.d.ts +18 -2
  99. package/dist/src/utils.d.ts.map +1 -1
  100. package/dist/src/webp.d.ts +19 -0
  101. package/dist/src/webp.d.ts.map +1 -0
  102. package/dist/types/art.d.ts +64 -0
  103. package/dist/types/art.d.ts.map +1 -0
  104. package/dist/types/color.d.ts +125 -7
  105. package/dist/types/color.d.ts.map +1 -1
  106. package/dist/types/corner-dot.d.ts +52 -2
  107. package/dist/types/corner-dot.d.ts.map +1 -1
  108. package/dist/types/corner-eye.d.ts +43 -2
  109. package/dist/types/corner-eye.d.ts.map +1 -1
  110. package/dist/types/frame-spec.d.ts +3509 -0
  111. package/dist/types/frame-spec.d.ts.map +1 -0
  112. package/dist/types/frame.d.ts +68 -0
  113. package/dist/types/frame.d.ts.map +1 -0
  114. package/dist/types/image-pattern.d.ts +15 -1
  115. package/dist/types/image-pattern.d.ts.map +1 -1
  116. package/dist/types/index.d.ts +15 -9
  117. package/dist/types/index.d.ts.map +1 -1
  118. package/dist/types/index.js +6 -0
  119. package/dist/types/index.js.map +1 -0
  120. package/dist/types/index.mjs +6 -0
  121. package/dist/types/index.mjs.map +1 -0
  122. package/dist/types/qr.d.ts +1684 -4
  123. package/dist/types/qr.d.ts.map +1 -1
  124. package/dist/types/template.d.ts +2 -2
  125. package/dist/types/template.d.ts.map +1 -1
  126. package/package.json +70 -25
  127. package/src/api.tsx +67 -17
  128. package/src/art-trace.ts +554 -0
  129. package/src/art.tsx +2226 -0
  130. package/src/body-patterns.tsx +389 -0
  131. package/src/codegen.ts +10 -5
  132. package/src/codeword-map.ts +265 -0
  133. package/src/constants.ts +4 -8
  134. package/src/corner-dot.tsx +209 -33
  135. package/src/corner-eye.ts +328 -60
  136. package/src/detection.ts +5 -11
  137. package/src/download.tsx +174 -70
  138. package/src/eps.ts +701 -0
  139. package/src/frame-icons.ts +325 -0
  140. package/src/frame-import.ts +1198 -0
  141. package/src/frame-spec.ts +518 -0
  142. package/src/frame-styles.ts +1095 -0
  143. package/src/frame.tsx +630 -0
  144. package/src/frames/builtin/banner-bottom.json +58 -0
  145. package/src/frames/builtin/circle.json +81 -0
  146. package/src/frames/builtin/rounded-border.json +60 -0
  147. package/src/frames/builtin/ticket.json +51 -0
  148. package/src/frames/builtin.ts +20 -0
  149. package/src/frames/official/attendance.json +110 -0
  150. package/src/frames/official/audio-guide.json +95 -0
  151. package/src/frames/official/book-now.json +103 -0
  152. package/src/frames/official/check-in.json +110 -0
  153. package/src/frames/official/christmas.json +131 -0
  154. package/src/frames/official/donate.json +77 -0
  155. package/src/frames/official/event-ticket.json +77 -0
  156. package/src/frames/official/feedback-bubble.json +73 -0
  157. package/src/frames/official/follow-us.json +83 -0
  158. package/src/frames/official/get-the-app.json +107 -0
  159. package/src/frames/official/halloween.json +80 -0
  160. package/src/frames/official/new-year.json +94 -0
  161. package/src/frames/official/order-at-table.json +86 -0
  162. package/src/frames/official/product-info.json +119 -0
  163. package/src/frames/official/register-product.json +77 -0
  164. package/src/frames/official/review-us.json +127 -0
  165. package/src/frames/official/rsvp-card.json +112 -0
  166. package/src/frames/official/save-contact.json +117 -0
  167. package/src/frames/official/scan-to-pay.json +94 -0
  168. package/src/frames/official/shop-window.json +81 -0
  169. package/src/frames/official/sign-rider.json +81 -0
  170. package/src/frames/official/table-tent.json +75 -0
  171. package/src/frames/official/wifi-card.json +89 -0
  172. package/src/frames/official/winter.json +142 -0
  173. package/src/frames/official.ts +77 -0
  174. package/src/helpers.ts +168 -11
  175. package/src/index.tsx +150 -172
  176. package/src/logo-budget.ts +226 -0
  177. package/src/logo-cleanup.ts +146 -0
  178. package/src/logo.tsx +137 -0
  179. package/src/print.ts +794 -0
  180. package/src/qr-code-canvas.tsx +241 -0
  181. package/src/qr-code.tsx +51 -16
  182. package/src/qr-outline.ts +511 -0
  183. package/src/qr-shape.ts +255 -0
  184. package/src/scan-risk.ts +197 -0
  185. package/src/scan-score.ts +1629 -0
  186. package/src/shapes.ts +169 -0
  187. package/src/silhouette.ts +334 -0
  188. package/src/utils/color.ts +10 -1
  189. package/src/utils/fmt.ts +59 -0
  190. package/src/utils/paint.ts +317 -0
  191. package/src/utils/parse-color.ts +135 -0
  192. package/src/utils/path-data.ts +182 -0
  193. package/src/utils/png.ts +175 -0
  194. package/src/utils/polygon-clip.ts +163 -0
  195. package/src/utils/print-shared.ts +74 -0
  196. package/src/utils/svg-geometry.ts +838 -0
  197. package/src/utils/svg-gradient.ts +407 -0
  198. package/src/utils/svg-painter.ts +946 -0
  199. package/src/utils/webp.ts +556 -0
  200. package/src/utils.tsx +794 -385
  201. package/src/webp.ts +84 -0
  202. package/types/art.ts +74 -0
  203. package/types/color.ts +132 -12
  204. package/types/corner-dot.ts +41 -4
  205. package/types/corner-eye.ts +31 -4
  206. package/types/frame-spec.ts +748 -0
  207. package/types/frame.ts +67 -0
  208. package/types/image-pattern.ts +15 -0
  209. package/types/index.ts +106 -4
  210. package/types/qr.ts +180 -2
  211. package/types/template.ts +2 -2
  212. package/dist/cli.js +0 -4319
package/src/constants.ts CHANGED
@@ -42,9 +42,10 @@ export const DEFAULT_EYECOLOR = "#000000";
42
42
  export const DEFAULT_DOTCOLOR = "#000000";
43
43
 
44
44
  /**
45
- * Default margin around the QR code.
46
- * The QR spec requires a minimum quiet zone of 4 modules on all sides
47
- * for reliable scanning.
45
+ * Default margin (quiet zone) around the QR code, in modules.
46
+ * Defaults to 0 so the code fills its box; the QR spec recommends a 4-module
47
+ * light quiet zone, so set `margin` (or give the container light padding)
48
+ * when the code sits on a busy or dark background.
48
49
  */
49
50
  export const DEFAULT_MARGIN = 0;
50
51
 
@@ -60,8 +61,3 @@ export const QR_LEVELS: readonly ErrorLevel[] = ["L", "M", "Q", "H"] as const;
60
61
  * get an explicit height or width, I'd rather default to something than throw.
61
62
  */
62
63
  export const DEFAULT_IMG_SCALE = 0.1;
63
-
64
- /**
65
- * Default logo URL for QR codes
66
- */
67
- export const FLAM_QR_LOGO = "https://qrdx.dev/logo.png";
@@ -1,5 +1,20 @@
1
1
  import type { JSX } from "react";
2
2
  import type { CornerEyeDotPattern } from "../types/corner-dot";
3
+ import type { EyeCorner } from "./corner-eye";
4
+ import {
5
+ circlePath,
6
+ heartPath,
7
+ polygonPath,
8
+ regularPolygon,
9
+ roundedRectPath,
10
+ superellipsePoints,
11
+ } from "./shapes";
12
+ import { compact, fmt, SCALE_DECIMALS } from "./utils/fmt";
13
+
14
+ /** Index (top-left, top-right, bottom-right, bottom-left) of the outer corner. */
15
+ function outerCornerIndex(corner: EyeCorner) {
16
+ return corner === "top-left" ? 0 : corner === "top-right" ? 1 : 3;
17
+ }
3
18
 
4
19
  /**
5
20
  * Generate corner dot pattern based on type
@@ -7,47 +22,192 @@ import type { CornerEyeDotPattern } from "../types/corner-dot";
7
22
  * @param cy - Center Y coordinate
8
23
  * @param radius - Radius of the dot
9
24
  * @param pattern - Pattern type for the corner dot
25
+ * @param corner - Which finder this is (leaf and drop dots face outward)
10
26
  * @returns JSX element representing the pattern
11
27
  */
12
28
  export function generateCornerDotPath(
13
29
  cx: number,
14
30
  cy: number,
15
31
  radius: number,
16
- pattern: CornerEyeDotPattern = "circle"
32
+ pattern: CornerEyeDotPattern = "circle",
33
+ corner: EyeCorner = "top-left"
17
34
  ): JSX.Element {
18
35
  const size = radius * 2;
19
36
  const halfSize = radius;
37
+ // One finder module (the dot is 3 × 3 modules)
38
+ const m = size / 3;
20
39
 
21
40
  switch (pattern) {
41
+ case "leaf":
42
+ case "leaf-reverse":
43
+ case "drop":
44
+ case "drop-reverse": {
45
+ const outer = outerCornerIndex(corner);
46
+ const inner = (outer + 2) % 4;
47
+ const round = 1.3 * m;
48
+ // The "sharp" corners stay soft, so blur can't join them to wavy eye
49
+ // frames (fully sharp corners fail inside curly eyes)
50
+ const sharp = 0.7 * m;
51
+ const isSharp = (i: number) => {
52
+ switch (pattern) {
53
+ case "leaf":
54
+ return i === outer || i === inner;
55
+ case "leaf-reverse":
56
+ return !(i === outer || i === inner);
57
+ case "drop":
58
+ return i === outer;
59
+ default:
60
+ return i === inner;
61
+ }
62
+ };
63
+ const radii = [0, 1, 2, 3].map((i) => (isSharp(i) ? sharp : round)) as [
64
+ number,
65
+ number,
66
+ number,
67
+ number,
68
+ ];
69
+ return (
70
+ <path
71
+ d={roundedRectPath(cx - radius, cy - radius, size, size, radii)}
72
+ />
73
+ );
74
+ }
75
+
76
+ case "extra-rounded":
77
+ return (
78
+ <path
79
+ d={roundedRectPath(cx - radius, cy - radius, size, size, 1.15 * m)}
80
+ />
81
+ );
82
+
83
+ case "plus": {
84
+ // Arms 2.3 modules wide keep the 3-module center run on most rows
85
+ // (2-module arms fail jsQR in sharp renders at 8–14 px per module)
86
+ const a = 1.15 * m;
87
+ const l = radius;
88
+ return (
89
+ <path
90
+ d={polygonPath([
91
+ [cx - a, cy - l],
92
+ [cx + a, cy - l],
93
+ [cx + a, cy - a],
94
+ [cx + l, cy - a],
95
+ [cx + l, cy + a],
96
+ [cx + a, cy + a],
97
+ [cx + a, cy + l],
98
+ [cx - a, cy + l],
99
+ [cx - a, cy + a],
100
+ [cx - l, cy + a],
101
+ [cx - l, cy - a],
102
+ [cx - a, cy - a],
103
+ ])}
104
+ />
105
+ );
106
+ }
107
+
108
+ case "cross-rounded": {
109
+ const a = 1.15 * m;
110
+ // Rounder ends (radius 0.7+) fail jsQR at close range
111
+ const r = 0.5 * m;
112
+ return (
113
+ <path
114
+ d={
115
+ roundedRectPath(cx - radius, cy - a, size, 2 * a, r) +
116
+ roundedRectPath(cx - a, cy - radius, 2 * a, size, r)
117
+ }
118
+ />
119
+ );
120
+ }
121
+
122
+ case "hexagon":
123
+ // Pointy-top: three modules wide, so rows through it stay wide
124
+ return <path d={polygonPath(regularPolygon(cx, cy, 1.72 * m, 6))} />;
125
+
126
+ case "octagon":
127
+ return (
128
+ <path
129
+ d={polygonPath(
130
+ regularPolygon(cx, cy, radius / Math.cos(Math.PI / 8), 8, 22.5)
131
+ )}
132
+ />
133
+ );
134
+
135
+ case "flower": {
136
+ // Petals on the diagonals: petals on the axes leave rows near the
137
+ // top and bottom too narrow for the finder's 3-module center.
138
+ const d = 0.6 * m;
139
+ const petal = 0.9 * m;
140
+ return (
141
+ <path
142
+ d={
143
+ circlePath(cx - d, cy - d, petal) +
144
+ circlePath(cx + d, cy - d, petal) +
145
+ circlePath(cx + d, cy + d, petal) +
146
+ circlePath(cx - d, cy + d, petal) +
147
+ circlePath(cx, cy, 1.2 * m)
148
+ }
149
+ />
150
+ );
151
+ }
152
+
153
+ case "heart":
154
+ // A smaller heart's top notch leaves too short a center run
155
+ return <path d={heartPath(cx, cy + 0.12 * m, 3.5 * m)} />;
156
+
157
+ case "squircle":
158
+ return (
159
+ <path
160
+ d={polygonPath(superellipsePoints(cx, cy, radius, radius, 4, 64))}
161
+ />
162
+ );
163
+
164
+ case "dots": {
165
+ const dots: string[] = [];
166
+ for (const dy of [-1, 0, 1]) {
167
+ for (const dx of [-1, 0, 1]) {
168
+ dots.push(
169
+ circlePath(
170
+ // Closer than one module, so the grid reads as a solid 3 × 3
171
+ // center to decoders, sharp or blurred
172
+ cx + dx * m * 0.82,
173
+ cy + dy * m * 0.82,
174
+ 0.58 * m
175
+ )
176
+ );
177
+ }
178
+ }
179
+ return <path d={dots.join("")} />;
180
+ }
181
+
22
182
  case "square":
23
183
  return (
24
184
  <rect
25
- height={size}
26
- transform={`rotate(0,${cx},${cy})`}
27
- width={size}
28
- x={cx - halfSize}
29
- y={cy - halfSize}
185
+ height={fmt(size)}
186
+ transform={compact`rotate(0,${cx},${cy})`}
187
+ width={fmt(size)}
188
+ x={fmt(cx - halfSize)}
189
+ y={fmt(cy - halfSize)}
30
190
  />
31
191
  );
32
192
 
33
193
  case "rounded":
34
194
  return (
35
195
  <rect
36
- height={size}
37
- rx={radius * 0.5}
38
- ry={radius * 0.5}
39
- transform={`rotate(0,${cx},${cy})`}
40
- width={size}
41
- x={cx - halfSize}
42
- y={cy - halfSize}
196
+ height={fmt(size)}
197
+ rx={fmt(radius * 0.5)}
198
+ ry={fmt(radius * 0.5)}
199
+ transform={compact`rotate(0,${cx},${cy})`}
200
+ width={fmt(size)}
201
+ x={fmt(cx - halfSize)}
202
+ y={fmt(cy - halfSize)}
43
203
  />
44
204
  );
45
205
 
46
206
  case "diamond":
47
207
  return (
48
208
  <path
49
- d={`M ${cx - halfSize * 0.714_286} ${cy - halfSize * 0.714_286}v ${size * 0.714_286}h ${size * 0.714_286}v -${size * 0.714_286}z`}
50
- transform={`rotate(45,${cx},${cy})`}
209
+ d={compact`M ${cx - halfSize * 0.714_286} ${cy - halfSize * 0.714_286}v ${size * 0.714_286}h ${size * 0.714_286}v -${size * 0.714_286}z`}
210
+ transform={compact`rotate(45,${cx},${cy})`}
51
211
  />
52
212
  );
53
213
 
@@ -56,9 +216,13 @@ export function generateCornerDotPath(
56
216
  const scale = size / 30;
57
217
  const transformX = (coord: number) => (coord - 40) * scale + cx;
58
218
  const transformY = (coord: number) => (coord - 40) * scale + cy;
59
- const path = `M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}h ${19.285_714_285_714_285 * scale}v -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}h -${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}`;
219
+ const path = compact`M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}h ${19.285_714_285_714_285 * scale}v -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}h -${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}`;
60
220
  return (
61
- <path clipRule="evenodd" d={path} transform={`rotate(0,${cx},${cy})`} />
221
+ <path
222
+ clipRule="evenodd"
223
+ d={path}
224
+ transform={compact`rotate(0,${cx},${cy})`}
225
+ />
62
226
  );
63
227
  }
64
228
 
@@ -67,12 +231,12 @@ export function generateCornerDotPath(
67
231
  const scale = size / 30;
68
232
  const transformX = (coord: number) => (coord - 40) * scale + cx;
69
233
  const transformY = (coord: number) => (coord - 40) * scale + cy;
70
- const path = `M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}h ${19.285_714_285_714_285 * scale}v -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}h -${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}`;
234
+ const path = compact`M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}h ${19.285_714_285_714_285 * scale}v -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}h -${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}`;
71
235
  return (
72
236
  <path
73
237
  clipRule="evenodd"
74
238
  d={path}
75
- transform={`rotate(-180,${cx},${cy})`}
239
+ transform={compact`rotate(-180,${cx},${cy})`}
76
240
  />
77
241
  );
78
242
  }
@@ -82,9 +246,13 @@ export function generateCornerDotPath(
82
246
  const scale = size / 30;
83
247
  const transformX = (coord: number) => (coord - 40) * scale + cx;
84
248
  const transformY = (coord: number) => (coord - 40) * scale + cy;
85
- const path = `M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}h ${19.285_714_285_714_285 * scale}v -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}h -${8.571_428_571_428_571 * scale}H ${transformX(25)}z`;
249
+ const path = compact`M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${8.571_428_571_428_571 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}h ${19.285_714_285_714_285 * scale}v -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}h -${8.571_428_571_428_571 * scale}H ${transformX(25)}z`;
86
250
  return (
87
- <path clipRule="evenodd" d={path} transform={`rotate(0,${cx},${cy})`} />
251
+ <path
252
+ clipRule="evenodd"
253
+ d={path}
254
+ transform={compact`rotate(0,${cx},${cy})`}
255
+ />
88
256
  );
89
257
  }
90
258
 
@@ -93,9 +261,13 @@ export function generateCornerDotPath(
93
261
  const scale = size / 30;
94
262
  const transformX = (coord: number) => (coord - 40) * scale + cx;
95
263
  const transformY = (coord: number) => (coord - 40) * scale + cy;
96
- const path = `M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${19.285_714_285_714_285 * scale}h ${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}v -${19.285_714_285_714_285 * scale}h -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}z`;
264
+ const path = compact`M ${transformX(25)} ${transformY(35.714_285_714_285_715)}v ${19.285_714_285_714_285 * scale}h ${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, ${10.714_285_714_285_714 * scale} -${10.714_285_714_285_714 * scale}v -${19.285_714_285_714_285 * scale}h -${19.285_714_285_714_285 * scale}a ${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}, 0, 0, 0, -${10.714_285_714_285_714 * scale} ${10.714_285_714_285_714 * scale}z`;
97
265
  return (
98
- <path clipRule="evenodd" d={path} transform={`rotate(0,${cx},${cy})`} />
266
+ <path
267
+ clipRule="evenodd"
268
+ d={path}
269
+ transform={compact`rotate(0,${cx},${cy})`}
270
+ />
99
271
  );
100
272
  }
101
273
 
@@ -104,8 +276,8 @@ export function generateCornerDotPath(
104
276
  const scale = size / 21;
105
277
  const transformX = (coord: number) => (coord - 40) * scale + cx;
106
278
  const transformY = (coord: number) => (coord - 40) * scale + cy;
107
- const path = `M ${transformX(33.571_428_571_428_57)} ${transformY(29.285_714_285_714_285)}h ${12.857_142_857_142_856 * scale}c ${4.285_714_285_714_286 * scale} 0 ${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale}v ${12.857_142_857_142_856 * scale}c 0 ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale}h -${12.857_142_857_142_856 * scale}c -${4.285_714_285_714_286 * scale} 0 -${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale}v -${12.857_142_857_142_856 * scale}c 0 -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale}z`;
108
- return <path d={path} transform={`rotate(45,${cx},${cy})`} />;
279
+ const path = compact`M ${transformX(33.571_428_571_428_57)} ${transformY(29.285_714_285_714_285)}h ${12.857_142_857_142_856 * scale}c ${4.285_714_285_714_286 * scale} 0 ${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale}v ${12.857_142_857_142_856 * scale}c 0 ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale}h -${12.857_142_857_142_856 * scale}c -${4.285_714_285_714_286 * scale} 0 -${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale}v -${12.857_142_857_142_856 * scale}c 0 -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale} ${4.285_714_285_714_286 * scale} -${4.285_714_285_714_286 * scale}z`;
280
+ return <path d={path} transform={compact`rotate(45,${cx},${cy})`} />;
109
281
  }
110
282
 
111
283
  case "star": {
@@ -113,9 +285,13 @@ export function generateCornerDotPath(
113
285
  const scale = size / 27;
114
286
  const transformX = (coord: number) => (coord - 40) * scale + cx;
115
287
  const transformY = (coord: number) => (coord - 40) * scale + cy;
116
- const path = `M ${transformX(38.846_153_846_153_85)},${transformY(26.546_153_846_153_846)}c${0.669_230_769_230_769_1 * scale},-${1.015_384_615_384_615_3 * scale},${2.215_384_615_384_615 * scale},-${1.015_384_615_384_615_3 * scale},${2.884_615_384_615_384 * scale},0l${4.038_461_538_461_538 * scale},${6.069_230_769_230_768 * scale}c${0.230_769_230_769_230_75 * scale},${0.346_153_846_153_846_1 * scale},${0.6 * scale},${0.6 * scale},${1.015_384_615_384_615_3 * scale},${0.715_384_615_384_615_3 * scale}l${7.223_076_923_076_922 * scale},${1.823_076_923_076_923 * scale}c${1.2 * scale},${0.3 * scale},${1.684_615_384_615_384_4 * scale},${1.707_692_307_692_307_6 * scale},${0.899_999_999_999_999_9 * scale},${2.653_846_153_846_153_3 * scale}l-${4.730_769_230_769_23 * scale},${5.584_615_384_615_384 * scale}c-${0.276_923_076_923_076_9 * scale},${0.323_076_923_076_923_1 * scale},-${0.415_384_615_384_615_35 * scale},${0.738_461_538_461_538_4 * scale},-${0.392_307_692_307_692_3 * scale},${1.130_769_230_769_230_7 * scale}l${0.438_461_538_461_538_4 * scale},${7.199_999_999_999_999 * scale}c${0.069_230_769_230_769_22 * scale},${1.2 * scale},-${1.176_923_076_923_076_7 * scale},${2.076_923_076_923_076_6 * scale},-${2.330_769_230_769_230_5 * scale},${1.638_461_538_461_538_2 * scale}l-${6.969_230_769_230_768_5 * scale},-${2.607_692_307_692_307_3 * scale}c-${0.392_307_692_307_692_3 * scale},-${0.161_538_461_538_461_55 * scale},-${0.853_846_153_846_153_8 * scale},-${0.161_538_461_538_461_55 * scale},-${1.246_153_846_153_846_2 * scale},0l-${6.969_230_769_230_768_5 * scale},${2.607_692_307_692_307_3 * scale}c-${1.153_846_153_846_153_7 * scale},${0.438_461_538_461_538_4 * scale},-${2.4 * scale},-${0.438_461_538_461_538_4 * scale},-${2.330_769_230_769_230_5 * scale},-${1.638_461_538_461_538_2 * scale}l${0.438_461_538_461_538_4 * scale},-${7.199_999_999_999_999 * scale}c${0.023_076_923_076_923_075 * scale},-${0.415_384_615_384_615_35 * scale},-${0.115_384_615_384_615_38 * scale},-${0.830_769_230_769_230_7 * scale},-${0.392_307_692_307_692_3 * scale},-${1.130_769_230_769_230_7 * scale}l-${4.730_769_230_769_23 * scale},-${5.584_615_384_615_384 * scale}c-${0.784_615_384_615_384_6 * scale},-${0.923_076_923_076_923 * scale},-${0.323_076_923_076_923_1 * scale},-${2.330_769_230_769_230_5 * scale},${0.899_999_999_999_999_9 * scale},-${2.653_846_153_846_153_3 * scale}l${7.223_076_923_076_922 * scale},-${1.823_076_923_076_923 * scale}c${0.415_384_615_384_615_35 * scale},-${0.115_384_615_384_615_38 * scale},${0.784_615_384_615_384_6 * scale},-${0.346_153_846_153_846_1 * scale},${1.015_384_615_384_615_3 * scale},-${0.715_384_615_384_615_3 * scale}l${4.038_461_538_461_538 * scale},-${6.069_230_769_230_768 * scale}z`;
288
+ const path = compact`M ${transformX(38.846_153_846_153_85)},${transformY(26.546_153_846_153_846)}c${0.669_230_769_230_769_1 * scale},-${1.015_384_615_384_615_3 * scale},${2.215_384_615_384_615 * scale},-${1.015_384_615_384_615_3 * scale},${2.884_615_384_615_384 * scale},0l${4.038_461_538_461_538 * scale},${6.069_230_769_230_768 * scale}c${0.230_769_230_769_230_75 * scale},${0.346_153_846_153_846_1 * scale},${0.6 * scale},${0.6 * scale},${1.015_384_615_384_615_3 * scale},${0.715_384_615_384_615_3 * scale}l${7.223_076_923_076_922 * scale},${1.823_076_923_076_923 * scale}c${1.2 * scale},${0.3 * scale},${1.684_615_384_615_384_4 * scale},${1.707_692_307_692_307_6 * scale},${0.899_999_999_999_999_9 * scale},${2.653_846_153_846_153_3 * scale}l-${4.730_769_230_769_23 * scale},${5.584_615_384_615_384 * scale}c-${0.276_923_076_923_076_9 * scale},${0.323_076_923_076_923_1 * scale},-${0.415_384_615_384_615_35 * scale},${0.738_461_538_461_538_4 * scale},-${0.392_307_692_307_692_3 * scale},${1.130_769_230_769_230_7 * scale}l${0.438_461_538_461_538_4 * scale},${7.199_999_999_999_999 * scale}c${0.069_230_769_230_769_22 * scale},${1.2 * scale},-${1.176_923_076_923_076_7 * scale},${2.076_923_076_923_076_6 * scale},-${2.330_769_230_769_230_5 * scale},${1.638_461_538_461_538_2 * scale}l-${6.969_230_769_230_768_5 * scale},-${2.607_692_307_692_307_3 * scale}c-${0.392_307_692_307_692_3 * scale},-${0.161_538_461_538_461_55 * scale},-${0.853_846_153_846_153_8 * scale},-${0.161_538_461_538_461_55 * scale},-${1.246_153_846_153_846_2 * scale},0l-${6.969_230_769_230_768_5 * scale},${2.607_692_307_692_307_3 * scale}c-${1.153_846_153_846_153_7 * scale},${0.438_461_538_461_538_4 * scale},-${2.4 * scale},-${0.438_461_538_461_538_4 * scale},-${2.330_769_230_769_230_5 * scale},-${1.638_461_538_461_538_2 * scale}l${0.438_461_538_461_538_4 * scale},-${7.199_999_999_999_999 * scale}c${0.023_076_923_076_923_075 * scale},-${0.415_384_615_384_615_35 * scale},-${0.115_384_615_384_615_38 * scale},-${0.830_769_230_769_230_7 * scale},-${0.392_307_692_307_692_3 * scale},-${1.130_769_230_769_230_7 * scale}l-${4.730_769_230_769_23 * scale},-${5.584_615_384_615_384 * scale}c-${0.784_615_384_615_384_6 * scale},-${0.923_076_923_076_923 * scale},-${0.323_076_923_076_923_1 * scale},-${2.330_769_230_769_230_5 * scale},${0.899_999_999_999_999_9 * scale},-${2.653_846_153_846_153_3 * scale}l${7.223_076_923_076_922 * scale},-${1.823_076_923_076_923 * scale}c${0.415_384_615_384_615_35 * scale},-${0.115_384_615_384_615_38 * scale},${0.784_615_384_615_384_6 * scale},-${0.346_153_846_153_846_1 * scale},${1.015_384_615_384_615_3 * scale},-${0.715_384_615_384_615_3 * scale}l${4.038_461_538_461_538 * scale},-${6.069_230_769_230_768 * scale}z`;
117
289
  return (
118
- <path clipRule="evenodd" d={path} transform={`rotate(0,${cx},${cy})`} />
290
+ <path
291
+ clipRule="evenodd"
292
+ d={path}
293
+ transform={compact`rotate(0,${cx},${cy})`}
294
+ />
119
295
  );
120
296
  }
121
297
 
@@ -123,10 +299,10 @@ export function generateCornerDotPath(
123
299
  // Scale to match old patterns: new patterns span ~28 units in 80x80, old patterns fill 'size'
124
300
  const scale = size / 28;
125
301
  const path =
126
- "M38.23456923076923 26.10373C38.75864615384615 25.677388461538463, 39.510007692307695 25.677388461538463, 40.03410769230769 26.10373L41.7757 27.520484615384614C42.09088461538461 27.776892307692307, 42.5005 27.886646153846154, 42.90166923076923 27.82219230769231L45.118300000000005 27.466046153846154C45.78536153846154 27.358853846153846, 46.43606153846153 27.734546153846154, 46.676753846153844 28.365815384615384L47.47664615384615 30.463553846153847C47.621407692307685 30.843192307692306, 47.92126923076923 31.143053846153844, 48.300999999999995 31.287815384615385L50.3986923076923 32.08770769230769C51.02984615384615 32.3284, 51.405538461538455 32.9791, 51.29846153846154 33.64616153846154L50.94238461538461 35.8627923076923C50.87776923076923 36.26396153846154, 50.98761538461538 36.67357692307692, 51.244 36.98876153846154L52.6606923076923 38.73035384615385C53.08715384615384 39.254453846153844, 53.08715384615384 40.00581538461538, 52.6606923076923 40.52989230769231L51.244 42.27148461538461C50.98761538461538 42.5866923076923, 50.87776923076923 42.99628461538461, 50.94238461538461 43.397453846153844L51.29846153846154 45.614107692307684C51.405538461538455 46.28114615384615, 51.02984615384615 46.93184615384615, 50.3986923076923 47.17256153846154L48.300999999999995 47.97243076923077C47.92126923076923 48.11730769230769, 47.621407692307685 48.41707692307692, 47.47664615384615 48.796692307692304L46.676753846153844 50.89438461538461C46.43606153846153 51.52576923076923, 45.78536153846154 51.90146153846153, 45.118300000000005 51.79415384615385L42.90166923076923 51.43807692307692C42.5005 51.37369230769231, 42.09088461538461 51.48330769230769, 41.7757 51.73969230769231L40.03410769230769 53.15661538461538C39.510007692307695 53.58284615384615, 38.75864615384615 53.58284615384615, 38.23456923076923 53.15661538461538L36.492976923076924 51.73969230769231C36.17776923076923 51.48330769230769, 35.76817692307692 51.37369230769231, 35.367007692307695 51.43807692307692L33.15035384615385 51.79415384615385C32.48331538461538 51.90146153846153, 31.832615384615384 51.52576923076923, 31.5919 50.89438461538461L30.79203076923077 48.796692307692304C30.647269230769233 48.41707692307692, 30.34740769230769 48.11730769230769, 29.96776923076923 47.97243076923077L27.87000769230769 47.17256153846154C27.23874769230769 46.93184615384615, 26.86306692307692 46.28114615384615, 26.970243076923076 45.614107692307684L27.326384615384615 43.397453846153844C27.39083846153846 42.99628461538461, 27.281093846153844 42.5866923076923, 27.02469076923077 42.27148461538461L25.607936153846154 40.52989230769231C25.181594384615384 40.00581538461538, 25.181594384615384 39.254453846153844, 25.607936153846154 38.73035384615385L27.02469076923077 36.98876153846154C27.281093846153844 36.67357692307692, 27.39083846153846 36.26396153846154, 27.326384615384615 35.8627923076923L26.970243076923076 33.64616153846154C26.86306692307692 32.9791, 27.23874769230769 32.3284, 27.87000769230769 32.08770769230769L29.96776923076923 31.287815384615385C30.34740769230769 31.143053846153844, 30.647269230769233 30.843192307692306, 30.79203076923077 30.463553846153847L31.5919 28.365815384615384C31.832615384615384 27.734546153846154, 32.48331538461538 27.358853846153846, 33.15035384615385 27.466046153846154L35.367007692307695 27.82219230769231C35.76817692307692 27.886646153846154, 36.17776923076923 27.776892307692307, 36.492976923076924 27.520484615384614L38.23456923076923 26.10373Z";
302
+ "M38.235 26.104C38.759 25.677, 39.51 25.677, 40.034 26.104L41.776 27.52C42.091 27.777, 42.501 27.887, 42.902 27.822L45.118 27.466C45.785 27.359, 46.436 27.735, 46.677 28.366L47.477 30.464C47.621 30.843, 47.921 31.143, 48.301 31.288L50.399 32.088C51.03 32.328, 51.406 32.979, 51.298 33.646L50.942 35.863C50.878 36.264, 50.988 36.674, 51.244 36.989L52.661 38.73C53.087 39.254, 53.087 40.006, 52.661 40.53L51.244 42.271C50.988 42.587, 50.878 42.996, 50.942 43.397L51.298 45.614C51.406 46.281, 51.03 46.932, 50.399 47.173L48.301 47.972C47.921 48.117, 47.621 48.417, 47.477 48.797L46.677 50.894C46.436 51.526, 45.785 51.901, 45.118 51.794L42.902 51.438C42.501 51.374, 42.091 51.483, 41.776 51.74L40.034 53.157C39.51 53.583, 38.759 53.583, 38.235 53.157L36.493 51.74C36.178 51.483, 35.768 51.374, 35.367 51.438L33.15 51.794C32.483 51.901, 31.833 51.526, 31.592 50.894L30.792 48.797C30.647 48.417, 30.347 48.117, 29.968 47.972L27.87 47.173C27.239 46.932, 26.863 46.281, 26.97 45.614L27.326 43.397C27.391 42.996, 27.281 42.587, 27.025 42.271L25.608 40.53C25.182 40.006, 25.182 39.254, 25.608 38.73L27.025 36.989C27.281 36.674, 27.391 36.264, 27.326 35.863L26.97 33.646C26.863 32.979, 27.239 32.328, 27.87 32.088L29.968 31.288C30.347 31.143, 30.647 30.843, 30.792 30.464L31.592 28.366C31.833 27.735, 32.483 27.359, 33.15 27.466L35.367 27.822C35.768 27.887, 36.178 27.777, 36.493 27.52L38.235 26.104Z";
127
303
  return (
128
304
  <g
129
- transform={`translate(${cx - 40 * scale},${cy - 40 * scale}) scale(${scale})`}
305
+ transform={compact`translate(${cx - 40 * scale},${cy - 40 * scale}) scale(${fmt(scale, SCALE_DECIMALS)})`}
130
306
  >
131
307
  <path clipRule="evenodd" d={path} />
132
308
  </g>
@@ -136,10 +312,10 @@ export function generateCornerDotPath(
136
312
  default:
137
313
  return (
138
314
  <circle
139
- cx={cx}
140
- cy={cy}
141
- r={radius}
142
- transform={`rotate(0,${cx},${cy})`}
315
+ cx={fmt(cx)}
316
+ cy={fmt(cy)}
317
+ r={fmt(radius)}
318
+ transform={compact`rotate(0,${cx},${cy})`}
143
319
  />
144
320
  );
145
321
  }