qrdx 0.0.49 → 0.0.51

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 (534) hide show
  1. package/README.md +123 -3
  2. package/dist/core.js +31 -0
  3. package/dist/core.js.map +1 -0
  4. package/dist/core.mjs +31 -0
  5. package/dist/core.mjs.map +1 -0
  6. package/dist/frames-index.js +1 -1
  7. package/dist/frames-index.js.map +1 -1
  8. package/dist/frames-index.mjs +1 -1
  9. package/dist/frames-index.mjs.map +1 -1
  10. package/dist/frames-official.js +1 -1
  11. package/dist/frames-official.js.map +1 -1
  12. package/dist/frames-official.mjs +1 -1
  13. package/dist/frames-official.mjs.map +1 -1
  14. package/dist/index.js +7 -7
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +7 -7
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/node.js +3 -0
  19. package/dist/node.js.map +1 -0
  20. package/dist/node.mjs +3 -0
  21. package/dist/node.mjs.map +1 -0
  22. package/dist/qr-code-canvas.js +1 -1
  23. package/dist/qr-code-canvas.js.map +1 -1
  24. package/dist/qr-code-canvas.mjs +1 -1
  25. package/dist/qr-code-canvas.mjs.map +1 -1
  26. package/dist/src/api.d.ts +8 -2
  27. package/dist/src/api.d.ts.map +1 -1
  28. package/dist/src/art.d.ts +4 -3
  29. package/dist/src/art.d.ts.map +1 -1
  30. package/dist/src/body-patterns.d.ts +3 -2
  31. package/dist/src/body-patterns.d.ts.map +1 -1
  32. package/dist/src/core.d.ts +5 -0
  33. package/dist/src/core.d.ts.map +1 -0
  34. package/dist/src/corner-dot.d.ts +3 -2
  35. package/dist/src/corner-dot.d.ts.map +1 -1
  36. package/dist/src/engine.d.ts +44 -0
  37. package/dist/src/engine.d.ts.map +1 -0
  38. package/dist/src/export.d.ts +5 -0
  39. package/dist/src/export.d.ts.map +1 -0
  40. package/dist/src/frame.d.ts +6 -4
  41. package/dist/src/frame.d.ts.map +1 -1
  42. package/dist/src/frames/catalogue/all.d.ts.map +1 -1
  43. package/dist/src/frames/catalogue/automotive.d.ts +5 -0
  44. package/dist/src/frames/catalogue/automotive.d.ts.map +1 -0
  45. package/dist/src/frames/catalogue/beauty-wellness.d.ts +5 -0
  46. package/dist/src/frames/catalogue/beauty-wellness.d.ts.map +1 -0
  47. package/dist/src/frames/catalogue/business.d.ts.map +1 -1
  48. package/dist/src/frames/catalogue/call-to-action.d.ts.map +1 -1
  49. package/dist/src/frames/catalogue/counts.d.ts +12 -7
  50. package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
  51. package/dist/src/frames/catalogue/food-drink.d.ts.map +1 -1
  52. package/dist/src/frames/catalogue/health-learning.d.ts.map +1 -1
  53. package/dist/src/frames/catalogue/index.d.ts.map +1 -1
  54. package/dist/src/frames/catalogue/nonprofit.d.ts +5 -0
  55. package/dist/src/frames/catalogue/nonprofit.d.ts.map +1 -0
  56. package/dist/src/frames/catalogue/places.d.ts.map +1 -1
  57. package/dist/src/frames/catalogue/real-estate.d.ts +5 -0
  58. package/dist/src/frames/catalogue/real-estate.d.ts.map +1 -0
  59. package/dist/src/frames/catalogue/shopping.d.ts.map +1 -1
  60. package/dist/src/frames/catalogue/sports-fitness.d.ts +5 -0
  61. package/dist/src/frames/catalogue/sports-fitness.d.ts.map +1 -0
  62. package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
  63. package/dist/src/frames/collections.d.ts.map +1 -1
  64. package/dist/src/frames/official-types.d.ts +1 -1
  65. package/dist/src/frames/official-types.d.ts.map +1 -1
  66. package/dist/src/index.d.ts +3 -37
  67. package/dist/src/index.d.ts.map +1 -1
  68. package/dist/src/jsx/index.d.ts +2 -0
  69. package/dist/src/jsx/index.d.ts.map +1 -0
  70. package/dist/src/jsx/jsx-dev-runtime.d.ts +5 -0
  71. package/dist/src/jsx/jsx-dev-runtime.d.ts.map +1 -0
  72. package/dist/src/jsx/jsx-runtime.d.ts +30 -0
  73. package/dist/src/jsx/jsx-runtime.d.ts.map +1 -0
  74. package/dist/src/jsx/runtime.d.ts +73 -0
  75. package/dist/src/jsx/runtime.d.ts.map +1 -0
  76. package/dist/src/logo.d.ts +3 -2
  77. package/dist/src/logo.d.ts.map +1 -1
  78. package/dist/src/node.d.ts +23 -0
  79. package/dist/src/node.d.ts.map +1 -0
  80. package/dist/src/part-markers.d.ts +15 -0
  81. package/dist/src/part-markers.d.ts.map +1 -0
  82. package/dist/src/plain.d.ts +31 -0
  83. package/dist/src/plain.d.ts.map +1 -0
  84. package/dist/src/qr-code-canvas.d.ts +1 -1
  85. package/dist/src/qr-code-canvas.d.ts.map +1 -1
  86. package/dist/src/qr-code-props.d.ts +22 -0
  87. package/dist/src/qr-code-props.d.ts.map +1 -0
  88. package/dist/src/qr-code-svg.d.ts +10 -0
  89. package/dist/src/qr-code-svg.d.ts.map +1 -0
  90. package/dist/src/qr-code.d.ts +2 -10
  91. package/dist/src/qr-code.d.ts.map +1 -1
  92. package/dist/src/rasterize.d.ts +25 -0
  93. package/dist/src/rasterize.d.ts.map +1 -0
  94. package/dist/src/react-elements.d.ts +3 -0
  95. package/dist/src/react-elements.d.ts.map +1 -0
  96. package/dist/src/render/attributes.d.ts +33 -0
  97. package/dist/src/render/attributes.d.ts.map +1 -0
  98. package/dist/src/render/dom.d.ts +8 -0
  99. package/dist/src/render/dom.d.ts.map +1 -0
  100. package/dist/src/render/hyperscript.d.ts +10 -0
  101. package/dist/src/render/hyperscript.d.ts.map +1 -0
  102. package/dist/src/render/string.d.ts +8 -0
  103. package/dist/src/render/string.d.ts.map +1 -0
  104. package/dist/src/svg.d.ts +14 -0
  105. package/dist/src/svg.d.ts.map +1 -0
  106. package/dist/src/template/arrow.d.ts +1 -0
  107. package/dist/src/template/arrow.d.ts.map +1 -1
  108. package/dist/src/template/default.d.ts +1 -0
  109. package/dist/src/template/default.d.ts.map +1 -1
  110. package/dist/src/template/halloween.d.ts +1 -0
  111. package/dist/src/template/halloween.d.ts.map +1 -1
  112. package/dist/src/template/square-border.d.ts +1 -0
  113. package/dist/src/template/square-border.d.ts.map +1 -1
  114. package/dist/src/template/standard-box.d.ts +1 -0
  115. package/dist/src/template/standard-box.d.ts.map +1 -1
  116. package/dist/src/template/striked-box.d.ts +1 -0
  117. package/dist/src/template/striked-box.d.ts.map +1 -1
  118. package/dist/src/utils.d.ts +9 -3
  119. package/dist/src/utils.d.ts.map +1 -1
  120. package/dist/src/vanilla-api.d.ts +47 -0
  121. package/dist/src/vanilla-api.d.ts.map +1 -0
  122. package/dist/src/vanilla-browser.d.ts +4 -0
  123. package/dist/src/vanilla-browser.d.ts.map +1 -0
  124. package/dist/src/vanilla.d.ts +4 -0
  125. package/dist/src/vanilla.d.ts.map +1 -0
  126. package/dist/src/vue.d.ts +56 -0
  127. package/dist/src/vue.d.ts.map +1 -0
  128. package/dist/types/index.d.ts +2 -2
  129. package/dist/types/index.d.ts.map +1 -1
  130. package/dist/types/index.js +2 -2
  131. package/dist/types/index.mjs +2 -2
  132. package/dist/types/public.d.ts +3 -0
  133. package/dist/types/public.d.ts.map +1 -0
  134. package/dist/types/qr.d.ts +18 -4
  135. package/dist/types/qr.d.ts.map +1 -1
  136. package/dist/types/react.d.ts +5 -0
  137. package/dist/types/react.d.ts.map +1 -0
  138. package/dist/types/template.d.ts +7 -1
  139. package/dist/types/template.d.ts.map +1 -1
  140. package/dist/vanilla.browser.mjs +92 -0
  141. package/dist/vanilla.browser.mjs.map +1 -0
  142. package/dist/vanilla.js +2 -0
  143. package/dist/vanilla.js.map +1 -0
  144. package/dist/vanilla.mjs +2 -0
  145. package/dist/vanilla.mjs.map +1 -0
  146. package/dist/vue.js +2 -0
  147. package/dist/vue.js.map +1 -0
  148. package/dist/vue.mjs +2 -0
  149. package/dist/vue.mjs.map +1 -0
  150. package/package.json +71 -6
  151. package/src/api.tsx +16 -139
  152. package/src/art.tsx +18 -16
  153. package/src/body-patterns.tsx +5 -3
  154. package/src/core.ts +13 -0
  155. package/src/corner-dot.tsx +4 -2
  156. package/src/download.tsx +1 -1
  157. package/src/engine.ts +170 -0
  158. package/src/export.ts +212 -0
  159. package/src/frame.tsx +7 -6
  160. package/src/frames/catalogue/all.ts +606 -0
  161. package/src/frames/catalogue/automotive.ts +61 -0
  162. package/src/frames/catalogue/beauty-wellness.ts +61 -0
  163. package/src/frames/catalogue/business.ts +68 -0
  164. package/src/frames/catalogue/call-to-action.ts +60 -0
  165. package/src/frames/catalogue/counts.ts +12 -7
  166. package/src/frames/catalogue/food-drink.ts +78 -0
  167. package/src/frames/catalogue/health-learning.ts +62 -14
  168. package/src/frames/catalogue/index.ts +2440 -16
  169. package/src/frames/catalogue/nonprofit.ts +65 -0
  170. package/src/frames/catalogue/places.ts +0 -18
  171. package/src/frames/catalogue/real-estate.ts +79 -0
  172. package/src/frames/catalogue/shopping.ts +68 -0
  173. package/src/frames/catalogue/sports-fitness.ts +81 -0
  174. package/src/frames/catalogue/tags.ts +354 -0
  175. package/src/frames/collections.ts +5 -0
  176. package/src/frames/official/add-engraving.json +90 -0
  177. package/src/frames/official/add-to-calendar.json +98 -0
  178. package/src/frames/official/adopt-me.json +72 -0
  179. package/src/frames/official/aftercare-guide.json +98 -0
  180. package/src/frames/official/alterations.json +142 -0
  181. package/src/frames/official/annual-report.json +85 -0
  182. package/src/frames/official/archery-lesson.json +106 -0
  183. package/src/frames/official/arrival-guide.json +71 -0
  184. package/src/frames/official/art-class.json +137 -0
  185. package/src/frames/official/ask-a-stylist.json +112 -0
  186. package/src/frames/official/assembly-guide.json +93 -0
  187. package/src/frames/official/badminton-session.json +104 -0
  188. package/src/frames/official/bake-sale.json +158 -0
  189. package/src/frames/official/bakery-board.json +80 -0
  190. package/src/frames/official/barber-booking.json +64 -0
  191. package/src/frames/official/bath-ritual.json +70 -0
  192. package/src/frames/official/bathroom-showroom.json +113 -0
  193. package/src/frames/official/battery-check.json +95 -0
  194. package/src/frames/official/beauty-rewards.json +81 -0
  195. package/src/frames/official/become-a-member.json +79 -0
  196. package/src/frames/official/bike-service.json +113 -0
  197. package/src/frames/official/book-a-call.json +105 -0
  198. package/src/frames/official/book-a-cleaning.json +92 -0
  199. package/src/frames/official/book-a-consultation.json +101 -0
  200. package/src/frames/official/book-a-court.json +74 -0
  201. package/src/frames/official/book-a-facial.json +108 -0
  202. package/src/frames/official/book-a-massage.json +80 -0
  203. package/src/frames/official/book-a-vaccine.json +88 -0
  204. package/src/frames/official/book-this-room.json +80 -0
  205. package/src/frames/official/boxing-class.json +81 -0
  206. package/src/frames/official/brewery-tour.json +89 -0
  207. package/src/frames/official/bridal-beauty.json +80 -0
  208. package/src/frames/official/brunch-menu.json +79 -0
  209. package/src/frames/official/bubble-tea.json +81 -0
  210. package/src/frames/official/bulk-orders.json +108 -0
  211. package/src/frames/official/burger-order.json +80 -0
  212. package/src/frames/official/call-a-server.json +115 -0
  213. package/src/frames/official/car-detailing.json +102 -0
  214. package/src/frames/official/car-details.json +90 -0
  215. package/src/frames/official/car-for-sale.json +74 -0
  216. package/src/frames/official/car-service.json +92 -0
  217. package/src/frames/official/carpool.json +79 -0
  218. package/src/frames/official/catering-order.json +79 -0
  219. package/src/frames/official/charging-prices.json +105 -0
  220. package/src/frames/official/charity-shop.json +75 -0
  221. package/src/frames/official/check-symptoms.json +80 -0
  222. package/src/frames/official/cheese-pairing.json +91 -0
  223. package/src/frames/official/chess-club.json +64 -0
  224. package/src/frames/official/chess-lessons.json +83 -0
  225. package/src/frames/official/choose-your-plan.json +113 -0
  226. package/src/frames/official/choose-your-wash.json +86 -0
  227. package/src/frames/official/clean-beauty.json +94 -0
  228. package/src/frames/official/click-and-collect.json +85 -0
  229. package/src/frames/official/clock-in.json +101 -0
  230. package/src/frames/official/club-fees.json +94 -0
  231. package/src/frames/official/coach-sign-up.json +108 -0
  232. package/src/frames/official/community-notices.json +107 -0
  233. package/src/frames/official/compare-specs.json +112 -0
  234. package/src/frames/official/consultation-form.json +120 -0
  235. package/src/frames/official/continued-online.json +81 -0
  236. package/src/frames/official/cookie-box.json +88 -0
  237. package/src/frames/official/cooking-class.json +89 -0
  238. package/src/frames/official/coworking-pass.json +89 -0
  239. package/src/frames/official/cricket-club.json +158 -0
  240. package/src/frames/official/cupcake-order.json +108 -0
  241. package/src/frames/official/damage-report.json +114 -0
  242. package/src/frames/official/dashboard-lights.json +106 -0
  243. package/src/frames/official/delivery-instructions.json +98 -0
  244. package/src/frames/official/diy-how-to.json +87 -0
  245. package/src/frames/official/donate-coats.json +74 -0
  246. package/src/frames/official/donate-food.json +80 -0
  247. package/src/frames/official/donation-jar.json +101 -0
  248. package/src/frames/official/donut-shop.json +94 -0
  249. package/src/frames/official/dress-fitting.json +64 -0
  250. package/src/frames/official/driving-lessons.json +110 -0
  251. package/src/frames/official/dumpling-house.json +82 -0
  252. package/src/frames/official/eye-exam.json +70 -0
  253. package/src/frames/official/eyewear-try-on.json +99 -0
  254. package/src/frames/official/fan-club.json +152 -0
  255. package/src/frames/official/farm-stand.json +109 -0
  256. package/src/frames/official/farmers-market.json +74 -0
  257. package/src/frames/official/find-a-charger.json +107 -0
  258. package/src/frames/official/find-a-doctor.json +85 -0
  259. package/src/frames/official/find-it-in-store.json +101 -0
  260. package/src/frames/official/find-our-office.json +80 -0
  261. package/src/frames/official/first-aid-guide.json +109 -0
  262. package/src/frames/official/fish-market.json +113 -0
  263. package/src/frames/official/fitness-challenge.json +1 -1
  264. package/src/frames/official/fitness-equipment.json +1 -1
  265. package/src/frames/official/fitness-kettlebell.json +1 -1
  266. package/src/frames/official/fitness-schedule.json +1 -1
  267. package/src/frames/official/fitness-test.json +94 -0
  268. package/src/frames/official/fitness-timer.json +1 -1
  269. package/src/frames/official/fitness-trial.json +1 -1
  270. package/src/frames/official/fitness-yoga.json +1 -1
  271. package/src/frames/official/food-support.json +102 -0
  272. package/src/frames/official/food-truck-location.json +80 -0
  273. package/src/frames/official/furnished-rental.json +101 -0
  274. package/src/frames/official/game-night.json +79 -0
  275. package/src/frames/official/garden-design.json +70 -0
  276. package/src/frames/official/garden-plot.json +74 -0
  277. package/src/frames/official/get-a-quote.json +113 -0
  278. package/src/frames/official/get-it-delivered.json +82 -0
  279. package/src/frames/official/get-started-rocket.json +80 -0
  280. package/src/frames/official/get-the-brochure.json +116 -0
  281. package/src/frames/official/gift-ideas.json +86 -0
  282. package/src/frames/official/gift-message.json +85 -0
  283. package/src/frames/official/give-blood.json +88 -0
  284. package/src/frames/official/giving-jar.json +89 -0
  285. package/src/frames/official/golf-scorecard.json +120 -0
  286. package/src/frames/official/grand-opening.json +158 -0
  287. package/src/frames/official/grill-menu.json +92 -0
  288. package/src/frames/official/hand-washing.json +106 -0
  289. package/src/frames/official/handyman.json +130 -0
  290. package/src/frames/official/hear-it-spoken.json +86 -0
  291. package/src/frames/official/home-valuation.json +87 -0
  292. package/src/frames/official/homework-help.json +79 -0
  293. package/src/frames/official/hot-shave.json +121 -0
  294. package/src/frames/official/house-rules.json +121 -0
  295. package/src/frames/official/how-it-works.json +98 -0
  296. package/src/frames/official/how-to-apply.json +93 -0
  297. package/src/frames/official/impact-report.json +90 -0
  298. package/src/frames/official/intake-forms.json +114 -0
  299. package/src/frames/official/join-a-league.json +94 -0
  300. package/src/frames/official/join-the-cleanup.json +110 -0
  301. package/src/frames/official/join-the-waitlist.json +102 -0
  302. package/src/frames/official/join-the-webinar.json +108 -0
  303. package/src/frames/official/juice-bar.json +70 -0
  304. package/src/frames/official/kids-haircuts.json +75 -0
  305. package/src/frames/official/kids-menu.json +107 -0
  306. package/src/frames/official/large-print.json +80 -0
  307. package/src/frames/official/lash-bar.json +86 -0
  308. package/src/frames/official/last-chance.json +94 -0
  309. package/src/frames/official/late-night-menu.json +77 -0
  310. package/src/frames/official/learn-the-signs.json +107 -0
  311. package/src/frames/official/library-card.json +90 -0
  312. package/src/frames/official/live-scores.json +101 -0
  313. package/src/frames/official/lost-and-found.json +85 -0
  314. package/src/frames/official/lost-pet-tag.json +84 -0
  315. package/src/frames/official/make-a-claim.json +74 -0
  316. package/src/frames/official/makeup-artist.json +94 -0
  317. package/src/frames/official/math-practice.json +136 -0
  318. package/src/frames/official/meal-plan.json +121 -0
  319. package/src/frames/official/meet-the-maker.json +91 -0
  320. package/src/frames/official/meet-the-team.json +82 -0
  321. package/src/frames/official/membership-card.json +108 -0
  322. package/src/frames/official/mortgage-calculator.json +94 -0
  323. package/src/frames/official/moving-checklist.json +108 -0
  324. package/src/frames/official/music-lessons.json +64 -0
  325. package/src/frames/official/nail-studio.json +70 -0
  326. package/src/frames/official/neighborhood-guide.json +98 -0
  327. package/src/frames/official/nutrition-facts.json +98 -0
  328. package/src/frames/official/online-class.json +82 -0
  329. package/src/frames/official/open-an-account.json +88 -0
  330. package/src/frames/official/open-house-sign-in.json +104 -0
  331. package/src/frames/official/parcel-room.json +98 -0
  332. package/src/frames/official/parent-meeting.json +108 -0
  333. package/src/frames/official/parking-permit.json +74 -0
  334. package/src/frames/official/pay-at-the-pump.json +108 -0
  335. package/src/frames/official/pay-for-parking.json +89 -0
  336. package/src/frames/official/pay-it-forward.json +102 -0
  337. package/src/frames/official/pay-your-rent.json +105 -0
  338. package/src/frames/official/permission-form.json +120 -0
  339. package/src/frames/official/personal-trainer.json +76 -0
  340. package/src/frames/official/physio-exercises.json +86 -0
  341. package/src/frames/official/pick-your-own.json +158 -0
  342. package/src/frames/official/plant-a-tree.json +88 -0
  343. package/src/frames/official/plant-based-menu.json +103 -0
  344. package/src/frames/official/plant-care.json +84 -0
  345. package/src/frames/official/podcast.json +107 -0
  346. package/src/frames/official/polling-place.json +109 -0
  347. package/src/frames/official/pool-timetable.json +113 -0
  348. package/src/frames/official/portfolio-card.json +110 -0
  349. package/src/frames/official/pre-order-bread.json +110 -0
  350. package/src/frames/official/press-kit.json +136 -0
  351. package/src/frames/official/price-list.json +111 -0
  352. package/src/frames/official/privacy-notice.json +115 -0
  353. package/src/frames/official/property-floor-plan.json +1 -1
  354. package/src/frames/official/property-for-sale.json +1 -1
  355. package/src/frames/official/property-house-light.json +1 -1
  356. package/src/frames/official/property-house.json +1 -1
  357. package/src/frames/official/property-key.json +1 -1
  358. package/src/frames/official/property-open-house.json +1 -1
  359. package/src/frames/official/property-rent.json +1 -1
  360. package/src/frames/official/property-virtual-tour.json +1 -1
  361. package/src/frames/official/questions-cloud.json +65 -0
  362. package/src/frames/official/race-entry.json +90 -0
  363. package/src/frames/official/race-photos.json +93 -0
  364. package/src/frames/official/rate-your-ride.json +103 -0
  365. package/src/frames/official/read-a-sample.json +108 -0
  366. package/src/frames/official/read-the-ebook.json +116 -0
  367. package/src/frames/official/read-the-faq.json +88 -0
  368. package/src/frames/official/read-the-reviews.json +110 -0
  369. package/src/frames/official/read-the-story.json +90 -0
  370. package/src/frames/official/read-the-transcript.json +142 -0
  371. package/src/frames/official/reading-challenge.json +97 -0
  372. package/src/frames/official/rebook-visit.json +86 -0
  373. package/src/frames/official/recipe-card.json +120 -0
  374. package/src/frames/official/refill-reminder.json +104 -0
  375. package/src/frames/official/register-interest.json +82 -0
  376. package/src/frames/official/register-to-vote.json +80 -0
  377. package/src/frames/official/renovation-quote.json +80 -0
  378. package/src/frames/official/rent-a-bike.json +95 -0
  379. package/src/frames/official/rent-this-item.json +95 -0
  380. package/src/frames/official/rental-car-guide.json +115 -0
  381. package/src/frames/official/report-a-problem.json +114 -0
  382. package/src/frames/official/report-a-repair.json +79 -0
  383. package/src/frames/official/report-a-street-issue.json +113 -0
  384. package/src/frames/official/request-maintenance.json +74 -0
  385. package/src/frames/official/resident-portal.json +98 -0
  386. package/src/frames/official/restaurant-gift-card.json +94 -0
  387. package/src/frames/official/restock-alert.json +98 -0
  388. package/src/frames/official/restroom-feedback.json +86 -0
  389. package/src/frames/official/return-your-cup.json +130 -0
  390. package/src/frames/official/return-your-rental.json +113 -0
  391. package/src/frames/official/ring-size.json +107 -0
  392. package/src/frames/official/roadside-help.json +92 -0
  393. package/src/frames/official/run-club.json +79 -0
  394. package/src/frames/official/safety-information.json +92 -0
  395. package/src/frames/official/salon-prices.json +92 -0
  396. package/src/frames/official/save-for-later.json +79 -0
  397. package/src/frames/official/scan-for-the-answer.json +86 -0
  398. package/src/frames/official/scan-for-the-checklist.json +108 -0
  399. package/src/frames/official/scan-for-the-latest.json +74 -0
  400. package/src/frames/official/scan-for-translations.json +108 -0
  401. package/src/frames/official/scan-here-arrow.json +76 -0
  402. package/src/frames/official/scan-here-post.json +89 -0
  403. package/src/frames/official/scan-me-banner.json +147 -0
  404. package/src/frames/official/scan-me-cloud.json +73 -0
  405. package/src/frames/official/scan-me-folded.json +74 -0
  406. package/src/frames/official/scan-me-stack.json +93 -0
  407. package/src/frames/official/scan-to-unlock.json +107 -0
  408. package/src/frames/official/scent-finder.json +94 -0
  409. package/src/frames/official/scholarships.json +108 -0
  410. package/src/frames/official/school-supply-list.json +80 -0
  411. package/src/frames/official/science-fair.json +89 -0
  412. package/src/frames/official/season-schedule.json +66 -0
  413. package/src/frames/official/see-more-stack.json +91 -0
  414. package/src/frames/official/see-our-pitch.json +85 -0
  415. package/src/frames/official/see-the-full-list.json +107 -0
  416. package/src/frames/official/see-the-map.json +79 -0
  417. package/src/frames/official/send-flowers.json +93 -0
  418. package/src/frames/official/service-times.json +115 -0
  419. package/src/frames/official/shade-finder.json +113 -0
  420. package/src/frames/official/shoe-size-check.json +95 -0
  421. package/src/frames/official/sign-rider.json +1 -1
  422. package/src/frames/official/sign-the-agreement.json +120 -0
  423. package/src/frames/official/sign-the-petition.json +120 -0
  424. package/src/frames/official/site-hoarding.json +158 -0
  425. package/src/frames/official/site-induction.json +120 -0
  426. package/src/frames/official/size-guide.json +80 -0
  427. package/src/frames/official/skate-park-rules.json +109 -0
  428. package/src/frames/official/skincare-routine.json +85 -0
  429. package/src/frames/official/sofa-fabric.json +84 -0
  430. package/src/frames/official/spa-gift.json +90 -0
  431. package/src/frames/official/spa-menu.json +124 -0
  432. package/src/frames/official/split-the-bill.json +77 -0
  433. package/src/frames/official/sponsor-a-pet.json +102 -0
  434. package/src/frames/official/sponsor-my-run.json +136 -0
  435. package/src/frames/official/sports-camp.json +142 -0
  436. package/src/frames/official/staff-handbook.json +121 -0
  437. package/src/frames/official/staff-rota.json +112 -0
  438. package/src/frames/official/start-a-return.json +92 -0
  439. package/src/frames/official/start-charging.json +104 -0
  440. package/src/frames/official/start-here-arrow.json +79 -0
  441. package/src/frames/official/start-saving.json +74 -0
  442. package/src/frames/official/storage-units.json +79 -0
  443. package/src/frames/official/student-portal.json +80 -0
  444. package/src/frames/official/style-gallery.json +111 -0
  445. package/src/frames/official/sushi-menu.json +115 -0
  446. package/src/frames/official/swim-lessons.json +70 -0
  447. package/src/frames/official/table-tennis.json +116 -0
  448. package/src/frames/official/take-a-closer-look.json +94 -0
  449. package/src/frames/official/takeout-order.json +98 -0
  450. package/src/frames/official/talk-to-someone.json +115 -0
  451. package/src/frames/official/talk-to-the-agent.json +115 -0
  452. package/src/frames/official/tea-menu.json +70 -0
  453. package/src/frames/official/tea-time.json +124 -0
  454. package/src/frames/official/team-jersey.json +77 -0
  455. package/src/frames/official/team-kit.json +85 -0
  456. package/src/frames/official/tee-time.json +85 -0
  457. package/src/frames/official/tennis-court.json +94 -0
  458. package/src/frames/official/test-drive.json +88 -0
  459. package/src/frames/official/test-results.json +85 -0
  460. package/src/frames/official/tire-change.json +74 -0
  461. package/src/frames/official/town-hall.json +158 -0
  462. package/src/frames/official/toy-finder.json +81 -0
  463. package/src/frames/official/trace-your-coffee.json +87 -0
  464. package/src/frames/official/trade-it-in.json +97 -0
  465. package/src/frames/official/try-the-demo.json +106 -0
  466. package/src/frames/official/unlock-this-car.json +82 -0
  467. package/src/frames/official/upload-receipts.json +108 -0
  468. package/src/frames/official/validate-parking.json +91 -0
  469. package/src/frames/official/vehicle-history.json +106 -0
  470. package/src/frames/official/virtual-try-on.json +93 -0
  471. package/src/frames/official/visiting-hours.json +90 -0
  472. package/src/frames/official/visitor-map.json +92 -0
  473. package/src/frames/official/visitor-sign-in.json +98 -0
  474. package/src/frames/official/volunteer.json +74 -0
  475. package/src/frames/official/vote-for-us.json +103 -0
  476. package/src/frames/official/walk-in-queue.json +102 -0
  477. package/src/frames/official/wash-club.json +81 -0
  478. package/src/frames/official/watch-repair.json +115 -0
  479. package/src/frames/official/watch-the-experiment.json +93 -0
  480. package/src/frames/official/water-refill.json +95 -0
  481. package/src/frames/official/weekly-deals.json +107 -0
  482. package/src/frames/official/wellness-retreat.json +85 -0
  483. package/src/frames/official/whats-inside.json +91 -0
  484. package/src/frames/official/wholesale.json +85 -0
  485. package/src/frames/official/window-quote.json +121 -0
  486. package/src/frames/official/wine-pairings.json +142 -0
  487. package/src/frames/official/wine-staff-pick.json +100 -0
  488. package/src/frames/official/winery-tasting.json +94 -0
  489. package/src/frames/official/yard-sign-coming-soon.json +115 -0
  490. package/src/frames/official/yard-sign-for-sale.json +150 -0
  491. package/src/frames/official/yard-sign-sold.json +162 -0
  492. package/src/frames/official/yard-sign-viewing.json +121 -0
  493. package/src/frames/official/your-prescription.json +107 -0
  494. package/src/frames/official/youth-club.json +104 -0
  495. package/src/frames/official-types.ts +6 -1
  496. package/src/frames/official.ts +4 -4
  497. package/src/index.tsx +6 -352
  498. package/src/jsx/index.ts +3 -0
  499. package/src/jsx/jsx-dev-runtime.ts +14 -0
  500. package/src/jsx/jsx-runtime.ts +34 -0
  501. package/src/jsx/runtime.ts +209 -0
  502. package/src/logo.tsx +5 -3
  503. package/src/node.ts +61 -0
  504. package/src/part-markers.ts +40 -0
  505. package/src/plain.tsx +194 -0
  506. package/src/qr-code-canvas.tsx +2 -1
  507. package/src/qr-code-props.ts +115 -0
  508. package/src/qr-code-svg.tsx +17 -0
  509. package/src/qr-code.tsx +34 -112
  510. package/src/rasterize.ts +282 -0
  511. package/src/react-elements.ts +13 -0
  512. package/src/render/attributes.ts +404 -0
  513. package/src/render/dom.ts +90 -0
  514. package/src/render/hyperscript.ts +66 -0
  515. package/src/render/string.ts +70 -0
  516. package/src/scan-score.ts +1 -1
  517. package/src/svg.ts +27 -0
  518. package/src/template/arrow.tsx +1 -0
  519. package/src/template/default.tsx +1 -0
  520. package/src/template/halloween.tsx +1 -0
  521. package/src/template/square-border.tsx +1 -0
  522. package/src/template/standard-box.tsx +1 -0
  523. package/src/template/striked-box.tsx +1 -0
  524. package/src/utils/print-shared.ts +1 -1
  525. package/src/utils.tsx +82 -38
  526. package/src/vanilla-api.ts +146 -0
  527. package/src/vanilla-browser.ts +11 -0
  528. package/src/vanilla.ts +10 -0
  529. package/src/vue.ts +220 -0
  530. package/types/index.ts +4 -2
  531. package/types/public.ts +4 -0
  532. package/types/qr.ts +24 -5
  533. package/types/react.ts +8 -0
  534. package/types/template.ts +10 -3
@@ -0,0 +1,90 @@
1
+ import { isFragment, isQRNode, type QRChild } from "../jsx/runtime";
2
+ import { toAttribute, VALID_TAG } from "./attributes";
3
+
4
+ const SVG_NS = "http://www.w3.org/2000/svg";
5
+ const HTML_NS = "http://www.w3.org/1999/xhtml";
6
+ const XLINK_NS = "http://www.w3.org/1999/xlink";
7
+ const XML_NS = "http://www.w3.org/XML/1998/namespace";
8
+ const XMLNS_NS = "http://www.w3.org/2000/xmlns/";
9
+
10
+ function setAttribute(element: Element, name: string, value: string) {
11
+ if (name === "xmlns" || name.startsWith("xmlns:")) {
12
+ element.setAttributeNS(XMLNS_NS, name, value);
13
+ } else if (name.startsWith("xlink:")) {
14
+ element.setAttributeNS(XLINK_NS, name, value);
15
+ } else if (name.startsWith("xml:")) {
16
+ element.setAttributeNS(XML_NS, name, value);
17
+ } else {
18
+ element.setAttribute(name, value);
19
+ }
20
+ }
21
+
22
+ function append(
23
+ parent: Node,
24
+ node: QRChild,
25
+ namespace: string,
26
+ doc: Document
27
+ ): void {
28
+ if (node === null || node === undefined || typeof node === "boolean") {
29
+ return;
30
+ }
31
+ if (
32
+ typeof node === "string" ||
33
+ typeof node === "number" ||
34
+ typeof node === "bigint"
35
+ ) {
36
+ parent.appendChild(doc.createTextNode(`${node}`));
37
+ return;
38
+ }
39
+ if (Array.isArray(node)) {
40
+ for (const child of node) {
41
+ append(parent, child, namespace, doc);
42
+ }
43
+ return;
44
+ }
45
+ if (!isQRNode(node)) {
46
+ throw new TypeError("qrdx: can't render this value as DOM nodes");
47
+ }
48
+ const { type, props } = node;
49
+ if (isFragment(type)) {
50
+ append(parent, props.children, namespace, doc);
51
+ return;
52
+ }
53
+ if (typeof type === "function") {
54
+ append(parent, type(props), namespace, doc);
55
+ return;
56
+ }
57
+ if (!VALID_TAG.test(type)) {
58
+ throw new TypeError(`qrdx: invalid element name: ${type}`);
59
+ }
60
+ const ns = type === "svg" ? SVG_NS : namespace;
61
+ const element = doc.createElementNS(ns, type);
62
+ for (const prop of Object.keys(props)) {
63
+ const attribute = toAttribute(prop, props[prop]);
64
+ if (attribute) {
65
+ setAttribute(element, attribute.name, attribute.value);
66
+ }
67
+ }
68
+ // foreignObject holds HTML again
69
+ append(
70
+ element,
71
+ props.children,
72
+ ns === SVG_NS && type === "foreignObject" ? HTML_NS : ns,
73
+ doc
74
+ );
75
+ parent.appendChild(element);
76
+ }
77
+
78
+ /**
79
+ * DOM nodes for a tree: the elements and attributes `renderToString` writes,
80
+ * built with `createElementNS` (no HTML is parsed, so it works under a
81
+ * Trusted Types policy).
82
+ */
83
+ export function renderToDOM(
84
+ node: QRChild,
85
+ doc: Document = document
86
+ ): DocumentFragment {
87
+ const fragment = doc.createDocumentFragment();
88
+ append(fragment, node, HTML_NS, doc);
89
+ return fragment;
90
+ }
@@ -0,0 +1,66 @@
1
+ import { isFragment, isQRNode } from "../jsx/runtime";
2
+ import { toAttribute } from "./attributes";
3
+
4
+ /** A framework's element factory, called with DOM attribute names. */
5
+ export type CreateElement<T> = (
6
+ type: string,
7
+ attributes: Record<string, string>,
8
+ children: (T | string)[],
9
+ key: string | null
10
+ ) => T;
11
+
12
+ /**
13
+ * A tree as another framework's elements (Vue's `h`, Preact's `h`…):
14
+ * fragments flattened, components called, attributes named and valued as
15
+ * `renderToString` writes them (`fill-rule`, `class`, CSS text), so every
16
+ * framework draws the same SVG.
17
+ */
18
+ export function toHyperscript<T>(
19
+ node: unknown,
20
+ create: CreateElement<T>
21
+ ): (T | string)[] {
22
+ const out: (T | string)[] = [];
23
+ const visit = (child: unknown) => {
24
+ if (child === null || child === undefined || typeof child === "boolean") {
25
+ return;
26
+ }
27
+ if (
28
+ typeof child === "string" ||
29
+ typeof child === "number" ||
30
+ typeof child === "bigint"
31
+ ) {
32
+ out.push(`${child}`);
33
+ return;
34
+ }
35
+ if (Array.isArray(child)) {
36
+ for (const item of child) {
37
+ visit(item);
38
+ }
39
+ return;
40
+ }
41
+ if (!isQRNode(child)) {
42
+ throw new TypeError("qrdx: can't render this value");
43
+ }
44
+ const { type, props, key } = child;
45
+ if (isFragment(type)) {
46
+ visit(props.children);
47
+ return;
48
+ }
49
+ if (typeof type === "function") {
50
+ visit(type(props));
51
+ return;
52
+ }
53
+ const attributes: Record<string, string> = {};
54
+ for (const prop of Object.keys(props)) {
55
+ const attribute = toAttribute(prop, props[prop]);
56
+ if (attribute) {
57
+ attributes[attribute.name] = attribute.value;
58
+ }
59
+ }
60
+ out.push(
61
+ create(type, attributes, toHyperscript(props.children, create), key)
62
+ );
63
+ };
64
+ visit(node);
65
+ return out;
66
+ }
@@ -0,0 +1,70 @@
1
+ import {
2
+ isFragment,
3
+ isQRNode,
4
+ type QRChild,
5
+ type QRNode,
6
+ } from "../jsx/runtime";
7
+ import {
8
+ escapeText,
9
+ toAttribute,
10
+ VALID_TAG,
11
+ VOID_ELEMENTS,
12
+ } from "./attributes";
13
+
14
+ /**
15
+ * Markup of a tree: byte for byte what React's `renderToStaticMarkup` writes
16
+ * for the same elements (see attributes.ts), with no React. React elements
17
+ * in the tree (a custom template written for React) are drawn the same way.
18
+ */
19
+ export function renderToString(node: QRChild): string {
20
+ if (node === null || node === undefined || typeof node === "boolean") {
21
+ return "";
22
+ }
23
+ if (typeof node === "string") {
24
+ return escapeText(node);
25
+ }
26
+ if (typeof node === "number" || typeof node === "bigint") {
27
+ return `${node}`;
28
+ }
29
+ if (Array.isArray(node)) {
30
+ let out = "";
31
+ for (const child of node) {
32
+ out += renderToString(child);
33
+ }
34
+ return out;
35
+ }
36
+ if (!isQRNode(node)) {
37
+ throw new TypeError("qrdx: can't render this value as SVG markup");
38
+ }
39
+ return renderElement(node);
40
+ }
41
+
42
+ function renderElement(node: QRNode): string {
43
+ const { type, props } = node;
44
+ if (isFragment(type)) {
45
+ return renderToString(props.children);
46
+ }
47
+ if (typeof type === "function") {
48
+ return renderToString(type(props));
49
+ }
50
+ if (!VALID_TAG.test(type)) {
51
+ throw new TypeError(`qrdx: invalid element name: ${type}`);
52
+ }
53
+ let out = `<${type}`;
54
+ for (const prop of Object.keys(props)) {
55
+ const attribute = toAttribute(prop, props[prop]);
56
+ if (attribute) {
57
+ out += ` ${attribute.name}="${escapeText(attribute.value)}"`;
58
+ }
59
+ }
60
+ if (VOID_ELEMENTS.has(type)) {
61
+ return `${out}/>`;
62
+ }
63
+ const html = (props.dangerouslySetInnerHTML as { __html?: unknown } | null)
64
+ ?.__html;
65
+ const inner =
66
+ html === null || html === undefined
67
+ ? renderToString(props.children)
68
+ : `${html}`;
69
+ return `${out}>${inner}</${type}>`;
70
+ }
package/src/scan-score.ts CHANGED
@@ -14,8 +14,8 @@ import {
14
14
  } from "./constants";
15
15
  import { handleImageLoad } from "./detection";
16
16
  import { withQRSize } from "./download";
17
+ import { getQRAsSVGDataUri } from "./export";
17
18
  import { getFrameDimensions, getFrameGapRatio, isFrameActive } from "./frame";
18
- import { getQRAsSVGDataUri } from "./index";
19
19
  import { getLogoBlockDamage } from "./logo-budget";
20
20
  import { circleQuietZone, getLayoutMargin, isShapedCode } from "./qr-shape";
21
21
  import { getStylePairRisk } from "./scan-risk";
package/src/svg.ts ADDED
@@ -0,0 +1,27 @@
1
+ // The code as SVG markup or a DOM element, drawn without a framework.
2
+ import type { QRSVGOptions } from "../types";
3
+ import { renderToDOM } from "./render/dom";
4
+ import { renderToString } from "./render/string";
5
+ import { createQRCodeTree } from "./utils";
6
+
7
+ /**
8
+ * The code's SVG markup: byte for byte what `<QRCodeSVG {...props} />`
9
+ * renders with React (attributes forwarded to the root `<svg>`, and to the
10
+ * frame's outer `<svg>` when there is a frame). Works anywhere, server or
11
+ * browser.
12
+ */
13
+ export function toSVGString(props: QRSVGOptions): string {
14
+ return renderToString(createQRCodeTree(props));
15
+ }
16
+
17
+ /**
18
+ * The code as an `<svg>` element, built with `createElementNS` (no HTML is
19
+ * parsed). Pass `doc` to build it in another document.
20
+ */
21
+ export function toSVGElement(
22
+ props: QRSVGOptions,
23
+ doc: Document = document
24
+ ): SVGSVGElement {
25
+ const fragment = renderToDOM(createQRCodeTree(props), doc);
26
+ return fragment.firstChild as SVGSVGElement;
27
+ }
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource ../jsx */
1
2
  import type { TemplateDefinition } from "../../types";
2
3
 
3
4
  export const Arrow: TemplateDefinition = {
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource ../jsx */
1
2
  import type { TemplateDefinition } from "../../types";
2
3
 
3
4
  export const defaultTemplate: TemplateDefinition = {
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource ../jsx */
1
2
  import type { TemplateDefinition } from "../../types";
2
3
 
3
4
  export const Halloween: TemplateDefinition = {
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource ../jsx */
1
2
  import type { TemplateDefinition } from "../../types";
2
3
 
3
4
  export const SquareBorder: TemplateDefinition = {
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource ../jsx */
1
2
  import type { TemplateDefinition } from "../../types";
2
3
 
3
4
  export const StandardBox: TemplateDefinition = {
@@ -1,3 +1,4 @@
1
+ /** @jsxImportSource ../jsx */
1
2
  import type { TemplateDefinition } from "../../types";
2
3
 
3
4
  export const StrikedBox: TemplateDefinition = {
@@ -2,8 +2,8 @@ import type { QRProps } from "../../types";
2
2
  import { isGradient } from "../../types/color";
3
3
  import { DEFAULT_BGCOLOR, DEFAULT_SIZE } from "../constants";
4
4
  import { withQRSize } from "../download";
5
+ import { getQRAsSVGDataUri } from "../export";
5
6
  import { getFrameLayout, isFrameActive } from "../frame";
6
- import { getQRAsSVGDataUri } from "../index";
7
7
  import { getSolidColor } from "./color";
8
8
  import { flattenOver } from "./paint";
9
9
  import { parseColor } from "./parse-color";
package/src/utils.tsx CHANGED
@@ -1,5 +1,4 @@
1
- import type { JSX } from "react";
2
- import React from "react";
1
+ /** @jsxImportSource ./jsx */
3
2
  import type {
4
3
  AngularGradient,
5
4
  BodyPattern,
@@ -11,7 +10,7 @@ import type {
11
10
  ImageSettings,
12
11
  LinearGradient,
13
12
  Modules,
14
- QRPropsSVG,
13
+ QRSVGOptions,
15
14
  RadialGradient,
16
15
  TemplateConfig,
17
16
  } from "../types";
@@ -41,8 +40,10 @@ import {
41
40
  import { generateCornerDotPath } from "./corner-dot";
42
41
  import { generateCornerSquarePath } from "./corner-eye";
43
42
  import { isFrameActive, wrapWithFrame } from "./frame";
43
+ import { cloneElement, type QRNode } from "./jsx/runtime";
44
44
  import { LOGO_PLATE_INSET, LOGO_ROUNDED_RADIUS, renderLogo } from "./logo";
45
45
  import { capImageSettings } from "./logo-budget";
46
+ import { partMarker, type QRPart, type QRPartEye } from "./part-markers";
46
47
  import { getLayoutMargin, shapeBackground, shapeDecoration } from "./qr-shape";
47
48
  import { hashString } from "./shapes";
48
49
  import { getTemplate } from "./templates";
@@ -147,7 +148,7 @@ function generateDataCircles(
147
148
  /** Decorative modules (a circle code's ring): no finders or alignment */
148
149
  plain?: boolean;
149
150
  }
150
- ): JSX.Element[] {
151
+ ): QRNode[] {
151
152
  const { margin, pixelSize, pattern = "circle", plain = false } = options;
152
153
  if (isShapedBodyPattern(pattern)) {
153
154
  return renderShapedBody(modules, {
@@ -159,7 +160,7 @@ function generateDataCircles(
159
160
  });
160
161
  }
161
162
  const scale = clampModuleScale(options.scale, pattern);
162
- const shapes: JSX.Element[] = [];
163
+ const shapes: QRNode[] = [];
163
164
  const qrSize = modules.length;
164
165
  const radius = pixelSize * 0.45; // radius for circles (≥0.45 needed for reliable scanning)
165
166
  const isAlignmentModule = plain ? () => false : alignmentMask(qrSize);
@@ -349,7 +350,7 @@ function generateDataCircles(
349
350
 
350
351
  // A smaller moduleScale shrinks the shape around its center
351
352
  if (scale !== 1 && shapes.length > start) {
352
- const shape = shapes.pop() as JSX.Element;
353
+ const shape = shapes.pop() as QRNode;
353
354
  shapes.push(
354
355
  <g
355
356
  key={key}
@@ -472,7 +473,7 @@ function renderConicPattern(
472
473
  cy: number,
473
474
  radius: number,
474
475
  size: number
475
- ): JSX.Element {
476
+ ): QRNode {
476
477
  const fan = conicWedges(gradient.stops, gradient.angle ?? 0, cx, cy, radius);
477
478
  const wedges = fan.wedges.map((wedge, index) => (
478
479
  <path
@@ -531,7 +532,7 @@ function renderImagePattern(
531
532
  id: string,
532
533
  paint: ImagePaint,
533
534
  size: number
534
- ): JSX.Element {
535
+ ): QRNode {
535
536
  const scale = paint.scale ?? 1;
536
537
  const tile = paint.fit === "tile";
537
538
  const side = tile ? (size / 4) * scale : size;
@@ -589,7 +590,7 @@ function generateCornerGradientDef(
589
590
  cornerType: "top-left" | "top-right" | "bottom-left",
590
591
  idPrefix: string,
591
592
  size: number
592
- ): { id: string; element: JSX.Element } | null {
593
+ ): { id: string; element: QRNode } | null {
593
594
  const normalized = normalizeColorConfig(colorConfig);
594
595
 
595
596
  if (normalized.type === "solid") {
@@ -689,7 +690,7 @@ function generateGradientDef(
689
690
  colorConfig: ColorConfig,
690
691
  size: number,
691
692
  idPrefix: string
692
- ): { id: string; element: JSX.Element } | null {
693
+ ): { id: string; element: QRNode } | null {
693
694
  const normalized = normalizeColorConfig(colorConfig);
694
695
 
695
696
  if (normalized.type === "solid") {
@@ -775,10 +776,10 @@ const hasPaintDef = (color: ColorConfig) =>
775
776
 
776
777
  /** Definitions once each: image fills that share a picture share an id. */
777
778
  function uniqueDefs(
778
- defs: ({ id: string; element: JSX.Element } | null | undefined)[]
779
- ): JSX.Element[] {
779
+ defs: ({ id: string; element: QRNode } | null | undefined)[]
780
+ ): QRNode[] {
780
781
  const seen = new Set<string>();
781
- const out: JSX.Element[] = [];
782
+ const out: QRNode[] = [];
782
783
  for (const def of defs) {
783
784
  if (def && !seen.has(def.id)) {
784
785
  seen.add(def.id);
@@ -937,7 +938,12 @@ export function convertImageSettingsToPixels(
937
938
  return { imgWidth, imgHeight, imgLeft, imgTop };
938
939
  }
939
940
 
940
- export function QRCodeSVG(props: QRPropsSVG) {
941
+ /**
942
+ * The code as a tree of plain nodes (`QRNode`): what `QRCodeSVG` draws, with
943
+ * no framework. `renderToString` turns it into the same markup React writes,
944
+ * `renderToDOM` into DOM nodes. Every styling option is supported.
945
+ */
946
+ export function createQRCodeTree(props: QRSVGOptions): QRNode {
941
947
  const {
942
948
  value,
943
949
  size = DEFAULT_SIZE,
@@ -962,6 +968,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
962
968
  autoLevel,
963
969
  shape,
964
970
  frameLabelMarkers,
971
+ partMarkers,
965
972
  ...otherProps
966
973
  } = props;
967
974
  // A logo no bigger than the code can repair (logo-budget.ts)
@@ -973,7 +980,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
973
980
  // With a frame, the caller's SVG attributes belong on the outer frame <svg>.
974
981
  const framed = isFrameActive(frame);
975
982
  const rootProps: typeof otherProps = framed ? {} : otherProps;
976
- const withFrame = (element: JSX.Element) =>
983
+ const withFrame = (element: QRNode) =>
977
984
  framed
978
985
  ? wrapWithFrame(element, {
979
986
  size,
@@ -1006,15 +1013,33 @@ export function QRCodeSVG(props: QRPropsSVG) {
1006
1013
  // silhouette (a silhouette that can't hold the code draws square)
1007
1014
  const layoutMargin = getLayoutMargin(cells.length, margin, shape);
1008
1015
  const decoration = shapeDecoration(value, cells.length, margin, shape);
1016
+ // Editors find each part by its marker (partMarkers, part-markers.ts)
1017
+ const part = (name: QRPart, eye?: QRPartEye) =>
1018
+ partMarker(partMarkers, name, eye);
1009
1019
  const outline = (px: number, fill: FillProps) => {
1010
1020
  const background = shapeBackground(shape, px);
1011
1021
  if (!background) {
1012
- return <rect {...fill} height={px} width={px} x={0} y={0} />;
1022
+ return (
1023
+ <rect
1024
+ {...fill}
1025
+ height={px}
1026
+ width={px}
1027
+ x={0}
1028
+ y={0}
1029
+ {...part("background")}
1030
+ />
1031
+ );
1013
1032
  }
1014
1033
  return "circle" in background ? (
1015
- <circle cx={fmt(px / 2)} cy={fmt(px / 2)} {...fill} r={fmt(px / 2)} />
1034
+ <circle
1035
+ cx={fmt(px / 2)}
1036
+ cy={fmt(px / 2)}
1037
+ {...fill}
1038
+ r={fmt(px / 2)}
1039
+ {...part("background")}
1040
+ />
1016
1041
  ) : (
1017
- <path d={background.path} {...fill} />
1042
+ <path d={background.path} {...fill} {...part("background")} />
1018
1043
  );
1019
1044
  };
1020
1045
 
@@ -1026,7 +1051,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1026
1051
  imageSettings
1027
1052
  );
1028
1053
 
1029
- let image: null | JSX.Element = null;
1054
+ let image: null | QRNode = null;
1030
1055
  if (imageSettings != null && calculatedImageSettings != null) {
1031
1056
  if (calculatedImageSettings.excavation != null) {
1032
1057
  cells = excavateModules(cells, calculatedImageSettings.excavation);
@@ -1075,6 +1100,9 @@ export function QRCodeSVG(props: QRPropsSVG) {
1075
1100
  w: imgWidth,
1076
1101
  h: imgHeight,
1077
1102
  });
1103
+ if (partMarkers) {
1104
+ image = cloneElement(image, part("logo"));
1105
+ }
1078
1106
  }
1079
1107
  }
1080
1108
 
@@ -1107,6 +1135,8 @@ export function QRCodeSVG(props: QRPropsSVG) {
1107
1135
  }),
1108
1136
  })
1109
1137
  : null;
1138
+ const markedArtLayer =
1139
+ artLayer && partMarkers ? cloneElement(artLayer, part("body")) : artLayer;
1110
1140
  const artEyes =
1111
1141
  artLayer && art
1112
1142
  ? getQRArtEyeColors({ art, version: qrCode.version, ...artColors })
@@ -1158,13 +1188,17 @@ export function QRCodeSVG(props: QRPropsSVG) {
1158
1188
  );
1159
1189
 
1160
1190
  // Data modules, plus a shaped code's decoration around them
1161
- const dataLayer = artLayer ? (
1191
+ const dataLayer = markedArtLayer ? (
1162
1192
  <>
1163
- {artLayer}
1164
- {decorationShapes && <g {...fgFillValue}>{decorationShapes}</g>}
1193
+ {markedArtLayer}
1194
+ {decorationShapes && (
1195
+ <g {...fgFillValue} {...part("body")}>
1196
+ {decorationShapes}
1197
+ </g>
1198
+ )}
1165
1199
  </>
1166
1200
  ) : (
1167
- <g {...fgFillValue}>
1201
+ <g {...fgFillValue} {...part("body")}>
1168
1202
  {dataCircles}
1169
1203
  {decorationShapes}
1170
1204
  </g>
@@ -1356,7 +1390,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1356
1390
  {dataLayer}
1357
1391
 
1358
1392
  {/* Top-left corner square */}
1359
- <g {...topLeftEyeFillValue}>
1393
+ <g {...topLeftEyeFillValue} {...part("eye-outer", "top-left")}>
1360
1394
  <path
1361
1395
  d={topLeftEye}
1362
1396
  fillRule="evenodd"
@@ -1365,10 +1399,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
1365
1399
  </g>
1366
1400
 
1367
1401
  {/* Top-left corner dot */}
1368
- <g {...topLeftDotFillValue}>{topLeftDot}</g>
1402
+ <g {...topLeftDotFillValue} {...part("eye-centre", "top-left")}>
1403
+ {topLeftDot}
1404
+ </g>
1369
1405
 
1370
1406
  {/* Top-right corner square */}
1371
- <g {...topRightEyeFillValue}>
1407
+ <g {...topRightEyeFillValue} {...part("eye-outer", "top-right")}>
1372
1408
  <path
1373
1409
  d={topRightEye}
1374
1410
  fillRule="evenodd"
@@ -1377,10 +1413,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
1377
1413
  </g>
1378
1414
 
1379
1415
  {/* Top-right corner dot */}
1380
- <g {...topRightDotFillValue}>{topRightDot}</g>
1416
+ <g {...topRightDotFillValue} {...part("eye-centre", "top-right")}>
1417
+ {topRightDot}
1418
+ </g>
1381
1419
 
1382
1420
  {/* Bottom-left corner square */}
1383
- <g {...bottomLeftEyeFillValue}>
1421
+ <g {...bottomLeftEyeFillValue} {...part("eye-outer", "bottom-left")}>
1384
1422
  <path
1385
1423
  d={bottomLeftEye}
1386
1424
  fillRule="evenodd"
@@ -1389,7 +1427,9 @@ export function QRCodeSVG(props: QRPropsSVG) {
1389
1427
  </g>
1390
1428
 
1391
1429
  {/* Bottom-left corner dot */}
1392
- <g {...bottomLeftDotFillValue}>{bottomLeftDot}</g>
1430
+ <g {...bottomLeftDotFillValue} {...part("eye-centre", "bottom-left")}>
1431
+ {bottomLeftDot}
1432
+ </g>
1393
1433
 
1394
1434
  {image}
1395
1435
  </>
@@ -1449,7 +1489,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1449
1489
  {dataLayer}
1450
1490
 
1451
1491
  {/* Top-left corner square */}
1452
- <g {...topLeftEyeFillValue}>
1492
+ <g {...topLeftEyeFillValue} {...part("eye-outer", "top-left")}>
1453
1493
  <path
1454
1494
  d={topLeftEye}
1455
1495
  fillRule="evenodd"
@@ -1458,10 +1498,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
1458
1498
  </g>
1459
1499
 
1460
1500
  {/* Top-left corner dot */}
1461
- <g {...topLeftDotFillValue}>{topLeftDot}</g>
1501
+ <g {...topLeftDotFillValue} {...part("eye-centre", "top-left")}>
1502
+ {topLeftDot}
1503
+ </g>
1462
1504
 
1463
1505
  {/* Top-right corner square */}
1464
- <g {...topRightEyeFillValue}>
1506
+ <g {...topRightEyeFillValue} {...part("eye-outer", "top-right")}>
1465
1507
  <path
1466
1508
  d={topRightEye}
1467
1509
  fillRule="evenodd"
@@ -1470,10 +1512,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
1470
1512
  </g>
1471
1513
 
1472
1514
  {/* Top-right corner dot */}
1473
- <g {...topRightDotFillValue}>{topRightDot}</g>
1515
+ <g {...topRightDotFillValue} {...part("eye-centre", "top-right")}>
1516
+ {topRightDot}
1517
+ </g>
1474
1518
 
1475
1519
  {/* Bottom-left corner square */}
1476
- <g {...bottomLeftEyeFillValue}>
1520
+ <g {...bottomLeftEyeFillValue} {...part("eye-outer", "bottom-left")}>
1477
1521
  <path
1478
1522
  d={bottomLeftEye}
1479
1523
  fillRule="evenodd"
@@ -1482,7 +1526,9 @@ export function QRCodeSVG(props: QRPropsSVG) {
1482
1526
  </g>
1483
1527
 
1484
1528
  {/* Bottom-left corner dot */}
1485
- <g {...bottomLeftDotFillValue}>{bottomLeftDot}</g>
1529
+ <g {...bottomLeftDotFillValue} {...part("eye-centre", "bottom-left")}>
1530
+ {bottomLeftDot}
1531
+ </g>
1486
1532
 
1487
1533
  {image}
1488
1534
  </g>
@@ -1515,7 +1561,6 @@ export function QRCodeSVG(props: QRPropsSVG) {
1515
1561
  // Clone the wrapped SVG element and override width/height to match requested size
1516
1562
  // This ensures downloads get the proper size while keeping viewBox for scaling
1517
1563
  // Remove percentage-based styles that would interfere with absolute sizing
1518
- // @ts-expect-error
1519
1564
  const originalStyle = wrappedSvg?.props?.style || {};
1520
1565
  const newStyle = {
1521
1566
  ...originalStyle,
@@ -1527,8 +1572,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1527
1572
  // Forward the caller's SVG attributes (className, aria-*, etc.) to the
1528
1573
  // root element, same as the non-template path below.
1529
1574
  return withFrame(
1530
- // @ts-expect-error
1531
- React.cloneElement(wrappedSvg, {
1575
+ cloneElement(wrappedSvg, {
1532
1576
  ...rootProps,
1533
1577
  width: size,
1534
1578
  height: size,