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.
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 +68 -25
  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 -4319
@@ -0,0 +1,325 @@
1
+ /** biome-ignore-all lint/style/noMagicNumbers: icon geometry */
2
+ // The glyphs a frame spec can place by id (`{ type: "icon", icon: "wifi" }`),
3
+ // so a spec never needs an image. Each is path data in a 24 × 24 box, built
4
+ // from the same primitives as the frames. Generic shapes only: no brand
5
+ // marks. Shapes in one icon either never overlap (nonzero) or use even-odd
6
+ // for their holes; every outline runs clockwise on screen, so overlapping
7
+ // parts of a nonzero icon join instead of cancelling out.
8
+ import type { FrameSpecIcon } from "../types/frame-spec";
9
+ import {
10
+ circlePath,
11
+ heartPath,
12
+ type Point,
13
+ polygonPath,
14
+ roundedRectPath,
15
+ starPoints,
16
+ } from "./shapes";
17
+ import { fmt } from "./utils/fmt";
18
+
19
+ /** Side of the box icons are drawn in. */
20
+ export const FRAME_ICON_BOX = 24;
21
+
22
+ export interface FrameIconPath {
23
+ d: string;
24
+ fillRule: "nonzero" | "evenodd";
25
+ }
26
+
27
+ const at = (cx: number, cy: number, r: number, degrees: number): Point => {
28
+ const angle = (degrees * Math.PI) / 180;
29
+ return [cx + r * Math.cos(angle), cy + r * Math.sin(angle)];
30
+ };
31
+ const pt = ([x, y]: Point) => `${fmt(x)} ${fmt(y)}`;
32
+
33
+ /** Ring sector from angle `a0` to `a1` (degrees, clockwise on screen). */
34
+ function sector(
35
+ cx: number,
36
+ cy: number,
37
+ inner: number,
38
+ outer: number,
39
+ a0: number,
40
+ a1: number
41
+ ): string {
42
+ const large = a1 - a0 > 180 ? 1 : 0;
43
+ return (
44
+ `M${pt(at(cx, cy, outer, a0))}` +
45
+ `A${fmt(outer)} ${fmt(outer)} 0 ${large} 1 ${pt(at(cx, cy, outer, a1))}` +
46
+ `L${pt(at(cx, cy, inner, a1))}` +
47
+ `A${fmt(inner)} ${fmt(inner)} 0 ${large} 0 ${pt(at(cx, cy, inner, a0))}Z`
48
+ );
49
+ }
50
+
51
+ /** Ellipse as two arcs, clockwise. */
52
+ function ellipse(cx: number, cy: number, rx: number, ry: number): string {
53
+ return (
54
+ `M${fmt(cx - rx)} ${fmt(cy)}A${fmt(rx)} ${fmt(ry)} 0 1 1 ${fmt(cx + rx)} ${fmt(cy)}` +
55
+ `A${fmt(rx)} ${fmt(ry)} 0 1 1 ${fmt(cx - rx)} ${fmt(cy)}Z`
56
+ );
57
+ }
58
+
59
+ /** Signed area (positive when clockwise on screen). */
60
+ function area(points: Point[]): number {
61
+ let sum = 0;
62
+ points.forEach(([x, y], i) => {
63
+ const [nx, ny] = points[(i + 1) % points.length] as Point;
64
+ sum += x * ny - nx * y;
65
+ });
66
+ return sum / 2;
67
+ }
68
+
69
+ /** Polygon path running clockwise on screen. */
70
+ function clockwise(points: Point[]): string {
71
+ return polygonPath(area(points) < 0 ? [...points].reverse() : points);
72
+ }
73
+
74
+ /** A bar of `width` from (x1, y1) to (x2, y2), square ends. */
75
+ function bar(
76
+ x1: number,
77
+ y1: number,
78
+ x2: number,
79
+ y2: number,
80
+ width: number
81
+ ): string {
82
+ const length = Math.hypot(x2 - x1, y2 - y1) || 1;
83
+ const nx = (-(y2 - y1) / length) * (width / 2);
84
+ const ny = ((x2 - x1) / length) * (width / 2);
85
+ return clockwise([
86
+ [x1 + nx, y1 + ny],
87
+ [x2 + nx, y2 + ny],
88
+ [x2 - nx, y2 - ny],
89
+ [x1 - nx, y1 - ny],
90
+ ]);
91
+ }
92
+
93
+ const nonzero = (...parts: string[]): FrameIconPath => ({
94
+ d: parts.join(""),
95
+ fillRule: "nonzero",
96
+ });
97
+ const evenodd = (...parts: string[]): FrameIconPath => ({
98
+ d: parts.join(""),
99
+ fillRule: "evenodd",
100
+ });
101
+
102
+ function snowflake(): FrameIconPath {
103
+ const parts: string[] = [];
104
+ for (const angle of [0, 60, 120]) {
105
+ const [x1, y1] = at(12, 12, 10.5, angle + 180);
106
+ const [x2, y2] = at(12, 12, 10.5, angle);
107
+ parts.push(bar(x1, y1, x2, y2, 2));
108
+ }
109
+ for (let arm = 0; arm < 6; arm++) {
110
+ const angle = arm * 60;
111
+ const [bx, by] = at(12, 12, 6.2, angle);
112
+ for (const turn of [-45, 45]) {
113
+ const [ex, ey] = at(bx, by, 3.6, angle + turn);
114
+ parts.push(bar(bx, by, ex, ey, 1.7));
115
+ }
116
+ }
117
+ return nonzero(...parts);
118
+ }
119
+
120
+ const ICONS: Record<FrameSpecIcon, () => FrameIconPath> = {
121
+ wifi: () =>
122
+ nonzero(
123
+ sector(12, 20, 4.6, 7.2, -135, -45),
124
+ sector(12, 20, 9.2, 11.8, -135, -45),
125
+ sector(12, 20, 13.8, 16.4, -135, -45),
126
+ circlePath(12, 20, 2.2)
127
+ ),
128
+ star: () => nonzero(polygonPath(starPoints(12, 12.8, 11.6, 4.8))),
129
+ heart: () => nonzero(heartPath(12, 12.4, 22)),
130
+ phone: () =>
131
+ evenodd(
132
+ roundedRectPath(6, 1.5, 12, 21, 2.6),
133
+ roundedRectPath(7.8, 4.2, 8.4, 13.4, 0.6),
134
+ circlePath(12, 19.8, 1.1)
135
+ ),
136
+ headphones: () =>
137
+ nonzero(
138
+ sector(12, 13, 7.6, 9.8, -180, 0),
139
+ roundedRectPath(2, 12, 5, 9.5, 2),
140
+ roundedRectPath(17, 12, 5, 9.5, 2)
141
+ ),
142
+ calendar: () =>
143
+ evenodd(
144
+ roundedRectPath(2.5, 4, 19, 17.5, 2.5),
145
+ roundedRectPath(4.6, 9, 14.8, 10.6, 0.8),
146
+ roundedRectPath(7, 11.4, 2.6, 2.6, 0.4),
147
+ roundedRectPath(10.7, 11.4, 2.6, 2.6, 0.4),
148
+ roundedRectPath(14.4, 11.4, 2.6, 2.6, 0.4),
149
+ roundedRectPath(7, 15.1, 2.6, 2.6, 0.4),
150
+ roundedRectPath(10.7, 15.1, 2.6, 2.6, 0.4),
151
+ roundedRectPath(6.5, 1.4, 2.4, 2.6, [1.2, 1.2, 0, 0]),
152
+ roundedRectPath(15.1, 1.4, 2.4, 2.6, [1.2, 1.2, 0, 0])
153
+ ),
154
+ user: () =>
155
+ nonzero(
156
+ circlePath(12, 7.5, 4.6),
157
+ "M3 21.5C3 16.2 7 13.6 12 13.6C17 13.6 21 16.2 21 21.5Z"
158
+ ),
159
+ chat: () =>
160
+ evenodd(
161
+ roundedRectPath(2, 3, 20, 14, 4),
162
+ polygonPath([
163
+ [6.5, 17],
164
+ [11.5, 17],
165
+ [5.8, 21.8],
166
+ ]),
167
+ circlePath(7.5, 10, 1.5),
168
+ circlePath(12, 10, 1.5),
169
+ circlePath(16.5, 10, 1.5)
170
+ ),
171
+ bag: () =>
172
+ nonzero(
173
+ roundedRectPath(3.5, 7.5, 17, 14.5, 2),
174
+ sector(12, 7.5, 3.1, 4.8, -180, 0)
175
+ ),
176
+ bell: () =>
177
+ nonzero(
178
+ "M3.5 17.2A8.5 8.5 0 0 1 20.5 17.2Z",
179
+ roundedRectPath(1.5, 18.2, 21, 2.6, 1.3),
180
+ roundedRectPath(11.2, 6.6, 1.6, 2.6, 0),
181
+ roundedRectPath(9.8, 4.6, 4.4, 2.4, 1.2)
182
+ ),
183
+ cup: () =>
184
+ nonzero(
185
+ "M4 6.5H17V13.5A6.5 6.5 0 0 1 4 13.5Z",
186
+ sector(17, 10.2, 1.7, 3.6, -90, 90),
187
+ roundedRectPath(2, 20.6, 17, 2, 1),
188
+ roundedRectPath(7, 1.6, 1.6, 3.4, 0.8),
189
+ roundedRectPath(11.6, 1.6, 1.6, 3.4, 0.8)
190
+ ),
191
+ card: () =>
192
+ evenodd(
193
+ roundedRectPath(1.5, 4.5, 21, 15, 2.5),
194
+ roundedRectPath(1.5, 8, 21, 3, 0),
195
+ roundedRectPath(4.5, 13.6, 4.6, 3.2, 0.6)
196
+ ),
197
+ check: () =>
198
+ evenodd(
199
+ circlePath(12, 12, 10.5),
200
+ polygonPath([
201
+ [6.6, 12.4],
202
+ [8.4, 10.6],
203
+ [10.6, 12.8],
204
+ [15.8, 7.6],
205
+ [17.6, 9.4],
206
+ [10.6, 16.4],
207
+ ])
208
+ ),
209
+ info: () =>
210
+ evenodd(
211
+ circlePath(12, 12, 10.5),
212
+ circlePath(12, 7.2, 1.6),
213
+ roundedRectPath(10.6, 10, 2.8, 8, 0.8)
214
+ ),
215
+ home: () =>
216
+ evenodd(
217
+ polygonPath([
218
+ [12, 2.5],
219
+ [22.5, 11.5],
220
+ [19.5, 11.5],
221
+ [19.5, 21.5],
222
+ [4.5, 21.5],
223
+ [4.5, 11.5],
224
+ [1.5, 11.5],
225
+ ]),
226
+ roundedRectPath(10, 14.5, 4, 7, [0.6, 0.6, 0, 0])
227
+ ),
228
+ pin: () =>
229
+ evenodd(
230
+ "M12 22.5C8.5 17.6 4.5 14 4.5 9.5A7.5 7.5 0 0 1 19.5 9.5C19.5 14 15.5 17.6 12 22.5Z",
231
+ circlePath(12, 9.5, 3)
232
+ ),
233
+ share: () =>
234
+ nonzero(
235
+ bar(6, 12, 18, 5, 1.8),
236
+ bar(6, 12, 18, 19, 1.8),
237
+ circlePath(18, 5, 3.2),
238
+ circlePath(6, 12, 3.2),
239
+ circlePath(18, 19, 3.2)
240
+ ),
241
+ download: () =>
242
+ nonzero(
243
+ roundedRectPath(10.6, 2, 2.8, 9.5, 0),
244
+ polygonPath([
245
+ [6, 10],
246
+ [18, 10],
247
+ [12, 16.5],
248
+ ]),
249
+ polygonPath([
250
+ [2.5, 15],
251
+ [5.3, 15],
252
+ [5.3, 19],
253
+ [18.7, 19],
254
+ [18.7, 15],
255
+ [21.5, 15],
256
+ [21.5, 21.8],
257
+ [2.5, 21.8],
258
+ ])
259
+ ),
260
+ clock: () =>
261
+ evenodd(
262
+ circlePath(12, 12, 10.5),
263
+ circlePath(12, 12, 8.4),
264
+ polygonPath([
265
+ [11, 5.4],
266
+ [13, 5.4],
267
+ [13, 11.3],
268
+ [16.9, 13.5],
269
+ [15.9, 15.2],
270
+ [11, 12.5],
271
+ ])
272
+ ),
273
+ snowflake,
274
+ pumpkin: () =>
275
+ nonzero(
276
+ ellipse(7.8, 14.6, 5.8, 6.9),
277
+ ellipse(16.2, 14.6, 5.8, 6.9),
278
+ ellipse(12, 14.6, 4.8, 7.4),
279
+ roundedRectPath(10.9, 3.4, 2.2, 4.6, 0.8),
280
+ clockwise([
281
+ [13, 4.2],
282
+ [17.2, 3],
283
+ [16.2, 5.4],
284
+ [13, 6],
285
+ ])
286
+ ),
287
+ tree: () =>
288
+ nonzero(
289
+ polygonPath([
290
+ [12, 1.5],
291
+ [16.8, 8.2],
292
+ [7.2, 8.2],
293
+ ]),
294
+ polygonPath([
295
+ [12, 5.2],
296
+ [19, 13.6],
297
+ [5, 13.6],
298
+ ]),
299
+ polygonPath([
300
+ [12, 9.4],
301
+ [21.2, 19.2],
302
+ [2.8, 19.2],
303
+ ]),
304
+ roundedRectPath(10.4, 18.6, 3.2, 3.9, 0.4)
305
+ ),
306
+ sparkle: () =>
307
+ nonzero(
308
+ polygonPath(starPoints(9.5, 13.5, 9, 2.4, 4)),
309
+ polygonPath(starPoints(19, 5, 4, 1.1, 4))
310
+ ),
311
+ gift: () =>
312
+ nonzero(
313
+ roundedRectPath(3, 11.2, 7.8, 10.6, 1),
314
+ roundedRectPath(13.2, 11.2, 7.8, 10.6, 1),
315
+ roundedRectPath(2, 7.4, 8.8, 3.2, 1),
316
+ roundedRectPath(13.2, 7.4, 8.8, 3.2, 1),
317
+ ellipse(8.8, 4.8, 2.9, 1.9),
318
+ ellipse(15.2, 4.8, 2.9, 1.9)
319
+ ),
320
+ };
321
+
322
+ /** Path data of a built-in icon, in a 24 × 24 box. */
323
+ export function getFrameIconPath(icon: FrameSpecIcon): FrameIconPath {
324
+ return ICONS[icon]();
325
+ }