qrdx 0.0.50 → 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 (527) hide show
  1. package/README.md +111 -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 +2 -5
  19. package/dist/node.js.map +1 -1
  20. package/dist/node.mjs +2 -5
  21. package/dist/node.mjs.map +1 -1
  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 -38
  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.map +1 -1
  79. package/dist/src/plain.d.ts +31 -0
  80. package/dist/src/plain.d.ts.map +1 -0
  81. package/dist/src/qr-code-canvas.d.ts +1 -1
  82. package/dist/src/qr-code-canvas.d.ts.map +1 -1
  83. package/dist/src/qr-code-props.d.ts +22 -0
  84. package/dist/src/qr-code-props.d.ts.map +1 -0
  85. package/dist/src/qr-code-svg.d.ts +10 -0
  86. package/dist/src/qr-code-svg.d.ts.map +1 -0
  87. package/dist/src/qr-code.d.ts +2 -10
  88. package/dist/src/qr-code.d.ts.map +1 -1
  89. package/dist/src/react-elements.d.ts +3 -0
  90. package/dist/src/react-elements.d.ts.map +1 -0
  91. package/dist/src/render/attributes.d.ts +33 -0
  92. package/dist/src/render/attributes.d.ts.map +1 -0
  93. package/dist/src/render/dom.d.ts +8 -0
  94. package/dist/src/render/dom.d.ts.map +1 -0
  95. package/dist/src/render/hyperscript.d.ts +10 -0
  96. package/dist/src/render/hyperscript.d.ts.map +1 -0
  97. package/dist/src/render/string.d.ts +8 -0
  98. package/dist/src/render/string.d.ts.map +1 -0
  99. package/dist/src/svg.d.ts +14 -0
  100. package/dist/src/svg.d.ts.map +1 -0
  101. package/dist/src/template/arrow.d.ts +1 -0
  102. package/dist/src/template/arrow.d.ts.map +1 -1
  103. package/dist/src/template/default.d.ts +1 -0
  104. package/dist/src/template/default.d.ts.map +1 -1
  105. package/dist/src/template/halloween.d.ts +1 -0
  106. package/dist/src/template/halloween.d.ts.map +1 -1
  107. package/dist/src/template/square-border.d.ts +1 -0
  108. package/dist/src/template/square-border.d.ts.map +1 -1
  109. package/dist/src/template/standard-box.d.ts +1 -0
  110. package/dist/src/template/standard-box.d.ts.map +1 -1
  111. package/dist/src/template/striked-box.d.ts +1 -0
  112. package/dist/src/template/striked-box.d.ts.map +1 -1
  113. package/dist/src/utils.d.ts +9 -3
  114. package/dist/src/utils.d.ts.map +1 -1
  115. package/dist/src/vanilla-api.d.ts +47 -0
  116. package/dist/src/vanilla-api.d.ts.map +1 -0
  117. package/dist/src/vanilla-browser.d.ts +4 -0
  118. package/dist/src/vanilla-browser.d.ts.map +1 -0
  119. package/dist/src/vanilla.d.ts +4 -0
  120. package/dist/src/vanilla.d.ts.map +1 -0
  121. package/dist/src/vue.d.ts +56 -0
  122. package/dist/src/vue.d.ts.map +1 -0
  123. package/dist/types/index.d.ts +2 -2
  124. package/dist/types/index.d.ts.map +1 -1
  125. package/dist/types/index.js +2 -2
  126. package/dist/types/index.mjs +2 -2
  127. package/dist/types/public.d.ts +3 -0
  128. package/dist/types/public.d.ts.map +1 -0
  129. package/dist/types/qr.d.ts +17 -4
  130. package/dist/types/qr.d.ts.map +1 -1
  131. package/dist/types/react.d.ts +5 -0
  132. package/dist/types/react.d.ts.map +1 -0
  133. package/dist/types/template.d.ts +7 -1
  134. package/dist/types/template.d.ts.map +1 -1
  135. package/dist/vanilla.browser.mjs +92 -0
  136. package/dist/vanilla.browser.mjs.map +1 -0
  137. package/dist/vanilla.js +2 -0
  138. package/dist/vanilla.js.map +1 -0
  139. package/dist/vanilla.mjs +2 -0
  140. package/dist/vanilla.mjs.map +1 -0
  141. package/dist/vue.js +2 -0
  142. package/dist/vue.js.map +1 -0
  143. package/dist/vue.mjs +2 -0
  144. package/dist/vue.mjs.map +1 -0
  145. package/package.json +52 -6
  146. package/src/api.tsx +16 -140
  147. package/src/art.tsx +18 -16
  148. package/src/body-patterns.tsx +5 -3
  149. package/src/core.ts +13 -0
  150. package/src/corner-dot.tsx +4 -2
  151. package/src/download.tsx +1 -1
  152. package/src/engine.ts +170 -0
  153. package/src/export.ts +212 -0
  154. package/src/frame.tsx +7 -6
  155. package/src/frames/catalogue/all.ts +606 -0
  156. package/src/frames/catalogue/automotive.ts +61 -0
  157. package/src/frames/catalogue/beauty-wellness.ts +61 -0
  158. package/src/frames/catalogue/business.ts +68 -0
  159. package/src/frames/catalogue/call-to-action.ts +60 -0
  160. package/src/frames/catalogue/counts.ts +12 -7
  161. package/src/frames/catalogue/food-drink.ts +78 -0
  162. package/src/frames/catalogue/health-learning.ts +62 -14
  163. package/src/frames/catalogue/index.ts +2440 -16
  164. package/src/frames/catalogue/nonprofit.ts +65 -0
  165. package/src/frames/catalogue/places.ts +0 -18
  166. package/src/frames/catalogue/real-estate.ts +79 -0
  167. package/src/frames/catalogue/shopping.ts +68 -0
  168. package/src/frames/catalogue/sports-fitness.ts +81 -0
  169. package/src/frames/catalogue/tags.ts +354 -0
  170. package/src/frames/collections.ts +5 -0
  171. package/src/frames/official/add-engraving.json +90 -0
  172. package/src/frames/official/add-to-calendar.json +98 -0
  173. package/src/frames/official/adopt-me.json +72 -0
  174. package/src/frames/official/aftercare-guide.json +98 -0
  175. package/src/frames/official/alterations.json +142 -0
  176. package/src/frames/official/annual-report.json +85 -0
  177. package/src/frames/official/archery-lesson.json +106 -0
  178. package/src/frames/official/arrival-guide.json +71 -0
  179. package/src/frames/official/art-class.json +137 -0
  180. package/src/frames/official/ask-a-stylist.json +112 -0
  181. package/src/frames/official/assembly-guide.json +93 -0
  182. package/src/frames/official/badminton-session.json +104 -0
  183. package/src/frames/official/bake-sale.json +158 -0
  184. package/src/frames/official/bakery-board.json +80 -0
  185. package/src/frames/official/barber-booking.json +64 -0
  186. package/src/frames/official/bath-ritual.json +70 -0
  187. package/src/frames/official/bathroom-showroom.json +113 -0
  188. package/src/frames/official/battery-check.json +95 -0
  189. package/src/frames/official/beauty-rewards.json +81 -0
  190. package/src/frames/official/become-a-member.json +79 -0
  191. package/src/frames/official/bike-service.json +113 -0
  192. package/src/frames/official/book-a-call.json +105 -0
  193. package/src/frames/official/book-a-cleaning.json +92 -0
  194. package/src/frames/official/book-a-consultation.json +101 -0
  195. package/src/frames/official/book-a-court.json +74 -0
  196. package/src/frames/official/book-a-facial.json +108 -0
  197. package/src/frames/official/book-a-massage.json +80 -0
  198. package/src/frames/official/book-a-vaccine.json +88 -0
  199. package/src/frames/official/book-this-room.json +80 -0
  200. package/src/frames/official/boxing-class.json +81 -0
  201. package/src/frames/official/brewery-tour.json +89 -0
  202. package/src/frames/official/bridal-beauty.json +80 -0
  203. package/src/frames/official/brunch-menu.json +79 -0
  204. package/src/frames/official/bubble-tea.json +81 -0
  205. package/src/frames/official/bulk-orders.json +108 -0
  206. package/src/frames/official/burger-order.json +80 -0
  207. package/src/frames/official/call-a-server.json +115 -0
  208. package/src/frames/official/car-detailing.json +102 -0
  209. package/src/frames/official/car-details.json +90 -0
  210. package/src/frames/official/car-for-sale.json +74 -0
  211. package/src/frames/official/car-service.json +92 -0
  212. package/src/frames/official/carpool.json +79 -0
  213. package/src/frames/official/catering-order.json +79 -0
  214. package/src/frames/official/charging-prices.json +105 -0
  215. package/src/frames/official/charity-shop.json +75 -0
  216. package/src/frames/official/check-symptoms.json +80 -0
  217. package/src/frames/official/cheese-pairing.json +91 -0
  218. package/src/frames/official/chess-club.json +64 -0
  219. package/src/frames/official/chess-lessons.json +83 -0
  220. package/src/frames/official/choose-your-plan.json +113 -0
  221. package/src/frames/official/choose-your-wash.json +86 -0
  222. package/src/frames/official/clean-beauty.json +94 -0
  223. package/src/frames/official/click-and-collect.json +85 -0
  224. package/src/frames/official/clock-in.json +101 -0
  225. package/src/frames/official/club-fees.json +94 -0
  226. package/src/frames/official/coach-sign-up.json +108 -0
  227. package/src/frames/official/community-notices.json +107 -0
  228. package/src/frames/official/compare-specs.json +112 -0
  229. package/src/frames/official/consultation-form.json +120 -0
  230. package/src/frames/official/continued-online.json +81 -0
  231. package/src/frames/official/cookie-box.json +88 -0
  232. package/src/frames/official/cooking-class.json +89 -0
  233. package/src/frames/official/coworking-pass.json +89 -0
  234. package/src/frames/official/cricket-club.json +158 -0
  235. package/src/frames/official/cupcake-order.json +108 -0
  236. package/src/frames/official/damage-report.json +114 -0
  237. package/src/frames/official/dashboard-lights.json +106 -0
  238. package/src/frames/official/delivery-instructions.json +98 -0
  239. package/src/frames/official/diy-how-to.json +87 -0
  240. package/src/frames/official/donate-coats.json +74 -0
  241. package/src/frames/official/donate-food.json +80 -0
  242. package/src/frames/official/donation-jar.json +101 -0
  243. package/src/frames/official/donut-shop.json +94 -0
  244. package/src/frames/official/dress-fitting.json +64 -0
  245. package/src/frames/official/driving-lessons.json +110 -0
  246. package/src/frames/official/dumpling-house.json +82 -0
  247. package/src/frames/official/eye-exam.json +70 -0
  248. package/src/frames/official/eyewear-try-on.json +99 -0
  249. package/src/frames/official/fan-club.json +152 -0
  250. package/src/frames/official/farm-stand.json +109 -0
  251. package/src/frames/official/farmers-market.json +74 -0
  252. package/src/frames/official/find-a-charger.json +107 -0
  253. package/src/frames/official/find-a-doctor.json +85 -0
  254. package/src/frames/official/find-it-in-store.json +101 -0
  255. package/src/frames/official/find-our-office.json +80 -0
  256. package/src/frames/official/first-aid-guide.json +109 -0
  257. package/src/frames/official/fish-market.json +113 -0
  258. package/src/frames/official/fitness-challenge.json +1 -1
  259. package/src/frames/official/fitness-equipment.json +1 -1
  260. package/src/frames/official/fitness-kettlebell.json +1 -1
  261. package/src/frames/official/fitness-schedule.json +1 -1
  262. package/src/frames/official/fitness-test.json +94 -0
  263. package/src/frames/official/fitness-timer.json +1 -1
  264. package/src/frames/official/fitness-trial.json +1 -1
  265. package/src/frames/official/fitness-yoga.json +1 -1
  266. package/src/frames/official/food-support.json +102 -0
  267. package/src/frames/official/food-truck-location.json +80 -0
  268. package/src/frames/official/furnished-rental.json +101 -0
  269. package/src/frames/official/game-night.json +79 -0
  270. package/src/frames/official/garden-design.json +70 -0
  271. package/src/frames/official/garden-plot.json +74 -0
  272. package/src/frames/official/get-a-quote.json +113 -0
  273. package/src/frames/official/get-it-delivered.json +82 -0
  274. package/src/frames/official/get-started-rocket.json +80 -0
  275. package/src/frames/official/get-the-brochure.json +116 -0
  276. package/src/frames/official/gift-ideas.json +86 -0
  277. package/src/frames/official/gift-message.json +85 -0
  278. package/src/frames/official/give-blood.json +88 -0
  279. package/src/frames/official/giving-jar.json +89 -0
  280. package/src/frames/official/golf-scorecard.json +120 -0
  281. package/src/frames/official/grand-opening.json +158 -0
  282. package/src/frames/official/grill-menu.json +92 -0
  283. package/src/frames/official/hand-washing.json +106 -0
  284. package/src/frames/official/handyman.json +130 -0
  285. package/src/frames/official/hear-it-spoken.json +86 -0
  286. package/src/frames/official/home-valuation.json +87 -0
  287. package/src/frames/official/homework-help.json +79 -0
  288. package/src/frames/official/hot-shave.json +121 -0
  289. package/src/frames/official/house-rules.json +121 -0
  290. package/src/frames/official/how-it-works.json +98 -0
  291. package/src/frames/official/how-to-apply.json +93 -0
  292. package/src/frames/official/impact-report.json +90 -0
  293. package/src/frames/official/intake-forms.json +114 -0
  294. package/src/frames/official/join-a-league.json +94 -0
  295. package/src/frames/official/join-the-cleanup.json +110 -0
  296. package/src/frames/official/join-the-waitlist.json +102 -0
  297. package/src/frames/official/join-the-webinar.json +108 -0
  298. package/src/frames/official/juice-bar.json +70 -0
  299. package/src/frames/official/kids-haircuts.json +75 -0
  300. package/src/frames/official/kids-menu.json +107 -0
  301. package/src/frames/official/large-print.json +80 -0
  302. package/src/frames/official/lash-bar.json +86 -0
  303. package/src/frames/official/last-chance.json +94 -0
  304. package/src/frames/official/late-night-menu.json +77 -0
  305. package/src/frames/official/learn-the-signs.json +107 -0
  306. package/src/frames/official/library-card.json +90 -0
  307. package/src/frames/official/live-scores.json +101 -0
  308. package/src/frames/official/lost-and-found.json +85 -0
  309. package/src/frames/official/lost-pet-tag.json +84 -0
  310. package/src/frames/official/make-a-claim.json +74 -0
  311. package/src/frames/official/makeup-artist.json +94 -0
  312. package/src/frames/official/math-practice.json +136 -0
  313. package/src/frames/official/meal-plan.json +121 -0
  314. package/src/frames/official/meet-the-maker.json +91 -0
  315. package/src/frames/official/meet-the-team.json +82 -0
  316. package/src/frames/official/membership-card.json +108 -0
  317. package/src/frames/official/mortgage-calculator.json +94 -0
  318. package/src/frames/official/moving-checklist.json +108 -0
  319. package/src/frames/official/music-lessons.json +64 -0
  320. package/src/frames/official/nail-studio.json +70 -0
  321. package/src/frames/official/neighborhood-guide.json +98 -0
  322. package/src/frames/official/nutrition-facts.json +98 -0
  323. package/src/frames/official/online-class.json +82 -0
  324. package/src/frames/official/open-an-account.json +88 -0
  325. package/src/frames/official/open-house-sign-in.json +104 -0
  326. package/src/frames/official/parcel-room.json +98 -0
  327. package/src/frames/official/parent-meeting.json +108 -0
  328. package/src/frames/official/parking-permit.json +74 -0
  329. package/src/frames/official/pay-at-the-pump.json +108 -0
  330. package/src/frames/official/pay-for-parking.json +89 -0
  331. package/src/frames/official/pay-it-forward.json +102 -0
  332. package/src/frames/official/pay-your-rent.json +105 -0
  333. package/src/frames/official/permission-form.json +120 -0
  334. package/src/frames/official/personal-trainer.json +76 -0
  335. package/src/frames/official/physio-exercises.json +86 -0
  336. package/src/frames/official/pick-your-own.json +158 -0
  337. package/src/frames/official/plant-a-tree.json +88 -0
  338. package/src/frames/official/plant-based-menu.json +103 -0
  339. package/src/frames/official/plant-care.json +84 -0
  340. package/src/frames/official/podcast.json +107 -0
  341. package/src/frames/official/polling-place.json +109 -0
  342. package/src/frames/official/pool-timetable.json +113 -0
  343. package/src/frames/official/portfolio-card.json +110 -0
  344. package/src/frames/official/pre-order-bread.json +110 -0
  345. package/src/frames/official/press-kit.json +136 -0
  346. package/src/frames/official/price-list.json +111 -0
  347. package/src/frames/official/privacy-notice.json +115 -0
  348. package/src/frames/official/property-floor-plan.json +1 -1
  349. package/src/frames/official/property-for-sale.json +1 -1
  350. package/src/frames/official/property-house-light.json +1 -1
  351. package/src/frames/official/property-house.json +1 -1
  352. package/src/frames/official/property-key.json +1 -1
  353. package/src/frames/official/property-open-house.json +1 -1
  354. package/src/frames/official/property-rent.json +1 -1
  355. package/src/frames/official/property-virtual-tour.json +1 -1
  356. package/src/frames/official/questions-cloud.json +65 -0
  357. package/src/frames/official/race-entry.json +90 -0
  358. package/src/frames/official/race-photos.json +93 -0
  359. package/src/frames/official/rate-your-ride.json +103 -0
  360. package/src/frames/official/read-a-sample.json +108 -0
  361. package/src/frames/official/read-the-ebook.json +116 -0
  362. package/src/frames/official/read-the-faq.json +88 -0
  363. package/src/frames/official/read-the-reviews.json +110 -0
  364. package/src/frames/official/read-the-story.json +90 -0
  365. package/src/frames/official/read-the-transcript.json +142 -0
  366. package/src/frames/official/reading-challenge.json +97 -0
  367. package/src/frames/official/rebook-visit.json +86 -0
  368. package/src/frames/official/recipe-card.json +120 -0
  369. package/src/frames/official/refill-reminder.json +104 -0
  370. package/src/frames/official/register-interest.json +82 -0
  371. package/src/frames/official/register-to-vote.json +80 -0
  372. package/src/frames/official/renovation-quote.json +80 -0
  373. package/src/frames/official/rent-a-bike.json +95 -0
  374. package/src/frames/official/rent-this-item.json +95 -0
  375. package/src/frames/official/rental-car-guide.json +115 -0
  376. package/src/frames/official/report-a-problem.json +114 -0
  377. package/src/frames/official/report-a-repair.json +79 -0
  378. package/src/frames/official/report-a-street-issue.json +113 -0
  379. package/src/frames/official/request-maintenance.json +74 -0
  380. package/src/frames/official/resident-portal.json +98 -0
  381. package/src/frames/official/restaurant-gift-card.json +94 -0
  382. package/src/frames/official/restock-alert.json +98 -0
  383. package/src/frames/official/restroom-feedback.json +86 -0
  384. package/src/frames/official/return-your-cup.json +130 -0
  385. package/src/frames/official/return-your-rental.json +113 -0
  386. package/src/frames/official/ring-size.json +107 -0
  387. package/src/frames/official/roadside-help.json +92 -0
  388. package/src/frames/official/run-club.json +79 -0
  389. package/src/frames/official/safety-information.json +92 -0
  390. package/src/frames/official/salon-prices.json +92 -0
  391. package/src/frames/official/save-for-later.json +79 -0
  392. package/src/frames/official/scan-for-the-answer.json +86 -0
  393. package/src/frames/official/scan-for-the-checklist.json +108 -0
  394. package/src/frames/official/scan-for-the-latest.json +74 -0
  395. package/src/frames/official/scan-for-translations.json +108 -0
  396. package/src/frames/official/scan-here-arrow.json +76 -0
  397. package/src/frames/official/scan-here-post.json +89 -0
  398. package/src/frames/official/scan-me-banner.json +147 -0
  399. package/src/frames/official/scan-me-cloud.json +73 -0
  400. package/src/frames/official/scan-me-folded.json +74 -0
  401. package/src/frames/official/scan-me-stack.json +93 -0
  402. package/src/frames/official/scan-to-unlock.json +107 -0
  403. package/src/frames/official/scent-finder.json +94 -0
  404. package/src/frames/official/scholarships.json +108 -0
  405. package/src/frames/official/school-supply-list.json +80 -0
  406. package/src/frames/official/science-fair.json +89 -0
  407. package/src/frames/official/season-schedule.json +66 -0
  408. package/src/frames/official/see-more-stack.json +91 -0
  409. package/src/frames/official/see-our-pitch.json +85 -0
  410. package/src/frames/official/see-the-full-list.json +107 -0
  411. package/src/frames/official/see-the-map.json +79 -0
  412. package/src/frames/official/send-flowers.json +93 -0
  413. package/src/frames/official/service-times.json +115 -0
  414. package/src/frames/official/shade-finder.json +113 -0
  415. package/src/frames/official/shoe-size-check.json +95 -0
  416. package/src/frames/official/sign-rider.json +1 -1
  417. package/src/frames/official/sign-the-agreement.json +120 -0
  418. package/src/frames/official/sign-the-petition.json +120 -0
  419. package/src/frames/official/site-hoarding.json +158 -0
  420. package/src/frames/official/site-induction.json +120 -0
  421. package/src/frames/official/size-guide.json +80 -0
  422. package/src/frames/official/skate-park-rules.json +109 -0
  423. package/src/frames/official/skincare-routine.json +85 -0
  424. package/src/frames/official/sofa-fabric.json +84 -0
  425. package/src/frames/official/spa-gift.json +90 -0
  426. package/src/frames/official/spa-menu.json +124 -0
  427. package/src/frames/official/split-the-bill.json +77 -0
  428. package/src/frames/official/sponsor-a-pet.json +102 -0
  429. package/src/frames/official/sponsor-my-run.json +136 -0
  430. package/src/frames/official/sports-camp.json +142 -0
  431. package/src/frames/official/staff-handbook.json +121 -0
  432. package/src/frames/official/staff-rota.json +112 -0
  433. package/src/frames/official/start-a-return.json +92 -0
  434. package/src/frames/official/start-charging.json +104 -0
  435. package/src/frames/official/start-here-arrow.json +79 -0
  436. package/src/frames/official/start-saving.json +74 -0
  437. package/src/frames/official/storage-units.json +79 -0
  438. package/src/frames/official/student-portal.json +80 -0
  439. package/src/frames/official/style-gallery.json +111 -0
  440. package/src/frames/official/sushi-menu.json +115 -0
  441. package/src/frames/official/swim-lessons.json +70 -0
  442. package/src/frames/official/table-tennis.json +116 -0
  443. package/src/frames/official/take-a-closer-look.json +94 -0
  444. package/src/frames/official/takeout-order.json +98 -0
  445. package/src/frames/official/talk-to-someone.json +115 -0
  446. package/src/frames/official/talk-to-the-agent.json +115 -0
  447. package/src/frames/official/tea-menu.json +70 -0
  448. package/src/frames/official/tea-time.json +124 -0
  449. package/src/frames/official/team-jersey.json +77 -0
  450. package/src/frames/official/team-kit.json +85 -0
  451. package/src/frames/official/tee-time.json +85 -0
  452. package/src/frames/official/tennis-court.json +94 -0
  453. package/src/frames/official/test-drive.json +88 -0
  454. package/src/frames/official/test-results.json +85 -0
  455. package/src/frames/official/tire-change.json +74 -0
  456. package/src/frames/official/town-hall.json +158 -0
  457. package/src/frames/official/toy-finder.json +81 -0
  458. package/src/frames/official/trace-your-coffee.json +87 -0
  459. package/src/frames/official/trade-it-in.json +97 -0
  460. package/src/frames/official/try-the-demo.json +106 -0
  461. package/src/frames/official/unlock-this-car.json +82 -0
  462. package/src/frames/official/upload-receipts.json +108 -0
  463. package/src/frames/official/validate-parking.json +91 -0
  464. package/src/frames/official/vehicle-history.json +106 -0
  465. package/src/frames/official/virtual-try-on.json +93 -0
  466. package/src/frames/official/visiting-hours.json +90 -0
  467. package/src/frames/official/visitor-map.json +92 -0
  468. package/src/frames/official/visitor-sign-in.json +98 -0
  469. package/src/frames/official/volunteer.json +74 -0
  470. package/src/frames/official/vote-for-us.json +103 -0
  471. package/src/frames/official/walk-in-queue.json +102 -0
  472. package/src/frames/official/wash-club.json +81 -0
  473. package/src/frames/official/watch-repair.json +115 -0
  474. package/src/frames/official/watch-the-experiment.json +93 -0
  475. package/src/frames/official/water-refill.json +95 -0
  476. package/src/frames/official/weekly-deals.json +107 -0
  477. package/src/frames/official/wellness-retreat.json +85 -0
  478. package/src/frames/official/whats-inside.json +91 -0
  479. package/src/frames/official/wholesale.json +85 -0
  480. package/src/frames/official/window-quote.json +121 -0
  481. package/src/frames/official/wine-pairings.json +142 -0
  482. package/src/frames/official/wine-staff-pick.json +100 -0
  483. package/src/frames/official/winery-tasting.json +94 -0
  484. package/src/frames/official/yard-sign-coming-soon.json +115 -0
  485. package/src/frames/official/yard-sign-for-sale.json +150 -0
  486. package/src/frames/official/yard-sign-sold.json +162 -0
  487. package/src/frames/official/yard-sign-viewing.json +121 -0
  488. package/src/frames/official/your-prescription.json +107 -0
  489. package/src/frames/official/youth-club.json +104 -0
  490. package/src/frames/official-types.ts +6 -1
  491. package/src/frames/official.ts +4 -4
  492. package/src/index.tsx +6 -361
  493. package/src/jsx/index.ts +3 -0
  494. package/src/jsx/jsx-dev-runtime.ts +14 -0
  495. package/src/jsx/jsx-runtime.ts +34 -0
  496. package/src/jsx/runtime.ts +209 -0
  497. package/src/logo.tsx +5 -3
  498. package/src/node.ts +3 -3
  499. package/src/plain.tsx +194 -0
  500. package/src/qr-code-canvas.tsx +1 -1
  501. package/src/qr-code-props.ts +115 -0
  502. package/src/qr-code-svg.tsx +17 -0
  503. package/src/qr-code.tsx +34 -114
  504. package/src/react-elements.ts +13 -0
  505. package/src/render/attributes.ts +404 -0
  506. package/src/render/dom.ts +90 -0
  507. package/src/render/hyperscript.ts +66 -0
  508. package/src/render/string.ts +70 -0
  509. package/src/scan-score.ts +1 -1
  510. package/src/svg.ts +27 -0
  511. package/src/template/arrow.tsx +1 -0
  512. package/src/template/default.tsx +1 -0
  513. package/src/template/halloween.tsx +1 -0
  514. package/src/template/square-border.tsx +1 -0
  515. package/src/template/standard-box.tsx +1 -0
  516. package/src/template/striked-box.tsx +1 -0
  517. package/src/utils/print-shared.ts +1 -1
  518. package/src/utils.tsx +24 -23
  519. package/src/vanilla-api.ts +146 -0
  520. package/src/vanilla-browser.ts +11 -0
  521. package/src/vanilla.ts +10 -0
  522. package/src/vue.ts +220 -0
  523. package/types/index.ts +4 -2
  524. package/types/public.ts +4 -0
  525. package/types/qr.ts +19 -5
  526. package/types/react.ts +8 -0
  527. package/types/template.ts +10 -3
@@ -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,6 +40,7 @@ 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
46
  import { partMarker, type QRPart, type QRPartEye } from "./part-markers";
@@ -148,7 +148,7 @@ function generateDataCircles(
148
148
  /** Decorative modules (a circle code's ring): no finders or alignment */
149
149
  plain?: boolean;
150
150
  }
151
- ): JSX.Element[] {
151
+ ): QRNode[] {
152
152
  const { margin, pixelSize, pattern = "circle", plain = false } = options;
153
153
  if (isShapedBodyPattern(pattern)) {
154
154
  return renderShapedBody(modules, {
@@ -160,7 +160,7 @@ function generateDataCircles(
160
160
  });
161
161
  }
162
162
  const scale = clampModuleScale(options.scale, pattern);
163
- const shapes: JSX.Element[] = [];
163
+ const shapes: QRNode[] = [];
164
164
  const qrSize = modules.length;
165
165
  const radius = pixelSize * 0.45; // radius for circles (≥0.45 needed for reliable scanning)
166
166
  const isAlignmentModule = plain ? () => false : alignmentMask(qrSize);
@@ -350,7 +350,7 @@ function generateDataCircles(
350
350
 
351
351
  // A smaller moduleScale shrinks the shape around its center
352
352
  if (scale !== 1 && shapes.length > start) {
353
- const shape = shapes.pop() as JSX.Element;
353
+ const shape = shapes.pop() as QRNode;
354
354
  shapes.push(
355
355
  <g
356
356
  key={key}
@@ -473,7 +473,7 @@ function renderConicPattern(
473
473
  cy: number,
474
474
  radius: number,
475
475
  size: number
476
- ): JSX.Element {
476
+ ): QRNode {
477
477
  const fan = conicWedges(gradient.stops, gradient.angle ?? 0, cx, cy, radius);
478
478
  const wedges = fan.wedges.map((wedge, index) => (
479
479
  <path
@@ -532,7 +532,7 @@ function renderImagePattern(
532
532
  id: string,
533
533
  paint: ImagePaint,
534
534
  size: number
535
- ): JSX.Element {
535
+ ): QRNode {
536
536
  const scale = paint.scale ?? 1;
537
537
  const tile = paint.fit === "tile";
538
538
  const side = tile ? (size / 4) * scale : size;
@@ -590,7 +590,7 @@ function generateCornerGradientDef(
590
590
  cornerType: "top-left" | "top-right" | "bottom-left",
591
591
  idPrefix: string,
592
592
  size: number
593
- ): { id: string; element: JSX.Element } | null {
593
+ ): { id: string; element: QRNode } | null {
594
594
  const normalized = normalizeColorConfig(colorConfig);
595
595
 
596
596
  if (normalized.type === "solid") {
@@ -690,7 +690,7 @@ function generateGradientDef(
690
690
  colorConfig: ColorConfig,
691
691
  size: number,
692
692
  idPrefix: string
693
- ): { id: string; element: JSX.Element } | null {
693
+ ): { id: string; element: QRNode } | null {
694
694
  const normalized = normalizeColorConfig(colorConfig);
695
695
 
696
696
  if (normalized.type === "solid") {
@@ -776,10 +776,10 @@ const hasPaintDef = (color: ColorConfig) =>
776
776
 
777
777
  /** Definitions once each: image fills that share a picture share an id. */
778
778
  function uniqueDefs(
779
- defs: ({ id: string; element: JSX.Element } | null | undefined)[]
780
- ): JSX.Element[] {
779
+ defs: ({ id: string; element: QRNode } | null | undefined)[]
780
+ ): QRNode[] {
781
781
  const seen = new Set<string>();
782
- const out: JSX.Element[] = [];
782
+ const out: QRNode[] = [];
783
783
  for (const def of defs) {
784
784
  if (def && !seen.has(def.id)) {
785
785
  seen.add(def.id);
@@ -938,7 +938,12 @@ export function convertImageSettingsToPixels(
938
938
  return { imgWidth, imgHeight, imgLeft, imgTop };
939
939
  }
940
940
 
941
- 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 {
942
947
  const {
943
948
  value,
944
949
  size = DEFAULT_SIZE,
@@ -975,7 +980,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
975
980
  // With a frame, the caller's SVG attributes belong on the outer frame <svg>.
976
981
  const framed = isFrameActive(frame);
977
982
  const rootProps: typeof otherProps = framed ? {} : otherProps;
978
- const withFrame = (element: JSX.Element) =>
983
+ const withFrame = (element: QRNode) =>
979
984
  framed
980
985
  ? wrapWithFrame(element, {
981
986
  size,
@@ -1046,7 +1051,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1046
1051
  imageSettings
1047
1052
  );
1048
1053
 
1049
- let image: null | JSX.Element = null;
1054
+ let image: null | QRNode = null;
1050
1055
  if (imageSettings != null && calculatedImageSettings != null) {
1051
1056
  if (calculatedImageSettings.excavation != null) {
1052
1057
  cells = excavateModules(cells, calculatedImageSettings.excavation);
@@ -1096,7 +1101,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1096
1101
  h: imgHeight,
1097
1102
  });
1098
1103
  if (partMarkers) {
1099
- image = React.cloneElement(image, part("logo"));
1104
+ image = cloneElement(image, part("logo"));
1100
1105
  }
1101
1106
  }
1102
1107
  }
@@ -1131,9 +1136,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1131
1136
  })
1132
1137
  : null;
1133
1138
  const markedArtLayer =
1134
- artLayer && partMarkers
1135
- ? React.cloneElement(artLayer, part("body"))
1136
- : artLayer;
1139
+ artLayer && partMarkers ? cloneElement(artLayer, part("body")) : artLayer;
1137
1140
  const artEyes =
1138
1141
  artLayer && art
1139
1142
  ? getQRArtEyeColors({ art, version: qrCode.version, ...artColors })
@@ -1558,7 +1561,6 @@ export function QRCodeSVG(props: QRPropsSVG) {
1558
1561
  // Clone the wrapped SVG element and override width/height to match requested size
1559
1562
  // This ensures downloads get the proper size while keeping viewBox for scaling
1560
1563
  // Remove percentage-based styles that would interfere with absolute sizing
1561
- // @ts-expect-error
1562
1564
  const originalStyle = wrappedSvg?.props?.style || {};
1563
1565
  const newStyle = {
1564
1566
  ...originalStyle,
@@ -1570,8 +1572,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
1570
1572
  // Forward the caller's SVG attributes (className, aria-*, etc.) to the
1571
1573
  // root element, same as the non-template path below.
1572
1574
  return withFrame(
1573
- // @ts-expect-error
1574
- React.cloneElement(wrappedSvg, {
1575
+ cloneElement(wrappedSvg, {
1575
1576
  ...rootProps,
1576
1577
  width: size,
1577
1578
  height: size,
@@ -0,0 +1,146 @@
1
+ // createQRCode: a code drawn into an element and kept up to date, for plain
2
+ // JavaScript (qrdx/vanilla re-exports it with the core).
3
+
4
+ import type { QRSVGOptions } from "../types";
5
+ import {
6
+ createQRCodeTree,
7
+ DEFAULT_SIZE,
8
+ type DownloadFormat,
9
+ downloadQRCode,
10
+ getQRCodeDataUrl,
11
+ renderToDOM,
12
+ renderToString,
13
+ } from "./engine";
14
+
15
+ /** Options for `toDataURL` and `download`. */
16
+ export interface QRCodeExportOptions {
17
+ /** Pixel size of the code (the frame adds to it); defaults to the code's `size` */
18
+ size?: number;
19
+ /** WebP only: 0 to 1 for a smaller lossy file */
20
+ quality?: number;
21
+ }
22
+
23
+ export interface QRCodeDownloadOptions extends QRCodeExportOptions {
24
+ /** "png" (default), "jpg", "webp", "svg", "pdf" (needs jspdf) or "eps" */
25
+ format?: DownloadFormat;
26
+ /** File name; defaults to one with the format and pixel size */
27
+ filename?: string;
28
+ }
29
+
30
+ /** A code drawn into an element by `createQRCode`. */
31
+ export interface QRCodeInstance {
32
+ /** The `<svg>` element on the page (null once destroyed) */
33
+ readonly svg: SVGSVGElement | null;
34
+ /** The options the code is drawn with now */
35
+ readonly options: Readonly<QRSVGOptions>;
36
+ /**
37
+ * Merges `options` into the current ones and redraws (pass `undefined` to
38
+ * drop an option). Nothing on the page changes when the markup doesn't.
39
+ */
40
+ update(options: Partial<QRSVGOptions>): void;
41
+ /** The code's SVG markup, as `toSVGString` writes it */
42
+ toSVGString(): string;
43
+ /** The code as a data URL: "png" (default), "jpg", "webp", "svg", "pdf" or "eps" */
44
+ toDataURL(
45
+ format?: DownloadFormat,
46
+ options?: QRCodeExportOptions
47
+ ): Promise<string>;
48
+ /** Saves the code as a file (a PNG unless `format` says otherwise) */
49
+ download(options?: QRCodeDownloadOptions): Promise<void>;
50
+ /** Removes the code from the page; `update` throws afterwards */
51
+ destroy(): void;
52
+ }
53
+
54
+ const exportSize = (options: QRSVGOptions, size?: number) => {
55
+ const side = size ?? options.size ?? DEFAULT_SIZE;
56
+ return { width: side, height: side };
57
+ };
58
+
59
+ /**
60
+ * Draws a QR code into `container` (an element, or a CSS selector for one)
61
+ * and returns a handle to update, export or remove it. Takes every option
62
+ * `QRCodeSVG` takes; attributes such as `className` or `aria-label` go on
63
+ * the `<svg>`.
64
+ *
65
+ * @example
66
+ * const qr = createQRCode("#qr", { value: "https://qrdx.dev", size: 256 });
67
+ * qr.update({ fgColor: "#1d4ed8" });
68
+ */
69
+ export function createQRCode(
70
+ container: Element | string,
71
+ options: QRSVGOptions
72
+ ): QRCodeInstance {
73
+ const parent =
74
+ typeof container === "string"
75
+ ? document.querySelector(container)
76
+ : container;
77
+ if (!parent) {
78
+ throw new Error(`qrdx: no element matches ${String(container)}`);
79
+ }
80
+ let current: QRSVGOptions = { ...options };
81
+ let svg: SVGSVGElement | null = null;
82
+ let markup = "";
83
+ let destroyed = false;
84
+
85
+ const draw = () => {
86
+ const tree = createQRCodeTree(current);
87
+ const next = renderToString(tree);
88
+ if (svg && next === markup) {
89
+ return;
90
+ }
91
+ const element = renderToDOM(tree, parent.ownerDocument)
92
+ .firstChild as SVGSVGElement;
93
+ if (svg?.parentNode === parent) {
94
+ svg.replaceWith(element);
95
+ } else {
96
+ parent.appendChild(element);
97
+ }
98
+ svg = element;
99
+ markup = next;
100
+ };
101
+
102
+ draw();
103
+
104
+ return {
105
+ get svg() {
106
+ return svg;
107
+ },
108
+ get options() {
109
+ return current;
110
+ },
111
+ update(next) {
112
+ if (destroyed) {
113
+ throw new Error("qrdx: this QR code was destroyed");
114
+ }
115
+ current = { ...current, ...next } as QRSVGOptions;
116
+ draw();
117
+ },
118
+ toSVGString() {
119
+ return markup || renderToString(createQRCodeTree(current));
120
+ },
121
+ toDataURL(format = "png", exportOptions = {}) {
122
+ return getQRCodeDataUrl(
123
+ current,
124
+ format,
125
+ exportSize(current, exportOptions.size),
126
+ { quality: exportOptions.quality }
127
+ );
128
+ },
129
+ download(downloadOptions = {}) {
130
+ return downloadQRCode(current, {
131
+ format: downloadOptions.format ?? "png",
132
+ size: exportSize(current, downloadOptions.size),
133
+ filename: downloadOptions.filename,
134
+ quality: downloadOptions.quality,
135
+ });
136
+ },
137
+ destroy() {
138
+ if (destroyed) {
139
+ return;
140
+ }
141
+ destroyed = true;
142
+ svg?.remove();
143
+ svg = null;
144
+ },
145
+ };
146
+ }
@@ -0,0 +1,11 @@
1
+ /** biome-ignore-all lint/performance/noBarrelFile: the no-bundler build */
2
+ // dist/vanilla.browser.mjs: qrdx/vanilla as one self-contained ES module for
3
+ // <script type="module"> without a bundler (zod inlined). It leaves out the
4
+ // official frame library's data (OFFICIAL_FRAMES, getOfficialFrame,
5
+ // OFFICIAL_FRAME_INDEX), which is hundreds of kilobytes; a page that wants
6
+ // it imports dist/frames-official.mjs next to this file. PDF export and the
7
+ // scan score load jspdf and jsqr on demand, which a page maps with an
8
+ // import map.
9
+
10
+ export * from "./engine";
11
+ export * from "./vanilla-api";
package/src/vanilla.ts ADDED
@@ -0,0 +1,10 @@
1
+ /** biome-ignore-all lint/performance/noBarrelFile: the vanilla entry re-exports the core */
2
+ // qrdx/vanilla: QR codes in plain JavaScript, no framework. `createQRCode`
3
+ // draws a code into an element and keeps it up to date, and everything in
4
+ // qrdx/core (markup, downloads, the scan score…) is re-exported, so one
5
+ // import covers a page. Built as dist/vanilla.mjs, which imports
6
+ // dist/core.mjs, for bundlers; vanilla-browser.ts is the same API as one
7
+ // file for <script type="module"> without a bundler.
8
+
9
+ export * from "./core";
10
+ export * from "./vanilla-api";
package/src/vue.ts ADDED
@@ -0,0 +1,220 @@
1
+ /** biome-ignore-all lint/performance/noBarrelFile: the Vue entry re-exports the core */
2
+ // qrdx/vue: QR codes for Vue 3. `QRCode` and `QRCodeSVG` draw the core's
3
+ // tree (`createQRCodeTree`) as Vue's own elements, through `toHyperscript`,
4
+ // so they render on the server with `vue/server-renderer` and hydrate
5
+ // without a mismatch, and Vue patches the <svg> in place when props change.
6
+ // `useQRCode` is the same code as a composable: the markup, PNG/SVG data URLs
7
+ // and downloads. Everything in qrdx/core is re-exported, so one import covers
8
+ // a component. Written as a render function (no .vue file), so building it
9
+ // needs no Vue compiler. Built as dist/vue.mjs, which imports dist/core.mjs
10
+ // and vue.
11
+
12
+ import {
13
+ type ComputedRef,
14
+ computed,
15
+ type DefineSetupFnComponent,
16
+ defineComponent,
17
+ h,
18
+ isVNode,
19
+ type MaybeRefOrGetter,
20
+ toValue,
21
+ type VNode,
22
+ type VNodeArrayChildren,
23
+ type VNodeChild,
24
+ } from "vue";
25
+ import {
26
+ createQRCodeTree,
27
+ DEFAULT_SIZE,
28
+ type DownloadFormat,
29
+ downloadQRCode,
30
+ getQRCodeDataUrl,
31
+ type QRCodeProps,
32
+ type QRProps,
33
+ type QRSVGOptions,
34
+ resolveQRCodeProps,
35
+ toHyperscript,
36
+ toSVGString,
37
+ } from "./core";
38
+ import type { QRCodeDownloadOptions, QRCodeExportOptions } from "./vanilla-api";
39
+
40
+ export * from "./core";
41
+ export type { QRCodeDownloadOptions, QRCodeExportOptions } from "./vanilla-api";
42
+
43
+ /**
44
+ * `<QRCodeSVG>`'s props: every `QRProps` option. `class`, `style`,
45
+ * `aria-label` and other attributes go on the `<svg>`, listeners too.
46
+ */
47
+ export type QRCodeSVGVueProps = Omit<QRProps, "style">;
48
+
49
+ /**
50
+ * `<QRCode>`'s props: React's `QRCode` props (`QRProps` with `logo`,
51
+ * `logoOptions`, `hideLogo` and `scale`). Attributes go on the `<svg>`.
52
+ */
53
+ export type QRCodeVueProps = Omit<QRCodeProps, "style">;
54
+
55
+ // Runtime prop declarations. Booleans default to undefined, not false, so a
56
+ // missing flag draws exactly what the core draws without it, and
57
+ // `<QRCode auto-level />` still reads as true. `style` isn't declared: it
58
+ // arrives with the other attributes and goes on the <svg>.
59
+ const flag = { type: Boolean, default: undefined };
60
+
61
+ const svgProps = {
62
+ value: { type: String, required: true },
63
+ size: Number,
64
+ level: null,
65
+ bgColor: null,
66
+ fgColor: null,
67
+ eyeColor: null,
68
+ dotColor: null,
69
+ bodyPattern: null,
70
+ cornerEyePattern: null,
71
+ cornerEyeDotPattern: null,
72
+ margin: Number,
73
+ imageSettings: null,
74
+ isOGContext: flag,
75
+ templateId: null,
76
+ customTemplate: null,
77
+ customProps: null,
78
+ frame: null,
79
+ art: null,
80
+ eyeColors: null,
81
+ moduleScale: Number,
82
+ autoLevel: flag,
83
+ shape: null,
84
+ frameLabelMarkers: flag,
85
+ partMarkers: flag,
86
+ } as const;
87
+
88
+ const codeProps = {
89
+ ...svgProps,
90
+ logo: String,
91
+ logoOptions: null,
92
+ hideLogo: flag,
93
+ scale: Number,
94
+ } as const;
95
+
96
+ // Vue's test for a listener prop (onClick, onUpdate:x…)
97
+ const isListener = (key: string) => /^on[^a-z]/.test(key);
98
+
99
+ /**
100
+ * The code as Vue elements. Attributes join the options, so the core puts
101
+ * them where React would (on the frame's outer <svg> when there is a frame)
102
+ * and drops listeners from the markup; listeners go on the root element.
103
+ */
104
+ function draw(
105
+ options: QRSVGOptions,
106
+ attrs: Record<string, unknown>
107
+ ): VNodeChild {
108
+ const nodes = toHyperscript<VNode>(
109
+ createQRCodeTree({ ...options, ...attrs }),
110
+ (type, attributes, children, key) =>
111
+ h(type, key === null ? attributes : { ...attributes, key }, children)
112
+ );
113
+ let listeners: Record<string, unknown> | null = null;
114
+ for (const key of Object.keys(attrs)) {
115
+ if (isListener(key)) {
116
+ listeners ??= {};
117
+ listeners[key] = attrs[key];
118
+ }
119
+ }
120
+ const [root] = nodes;
121
+ if (listeners && isVNode(root)) {
122
+ // Spread into the root's own props: cloneVNode would merge them with
123
+ // mergeProps, which rewrites the core's CSS text for `style`
124
+ nodes[0] = h(
125
+ root.type as string,
126
+ { ...root.props, ...listeners },
127
+ root.children as VNodeArrayChildren
128
+ );
129
+ }
130
+ return nodes.length === 1 ? nodes[0] : nodes;
131
+ }
132
+
133
+ /**
134
+ * A QR code with every styling option, drawn as SVG: the Vue version of
135
+ * React's `QRCodeSVG`, with the same props and the same markup.
136
+ *
137
+ * @example
138
+ * <QRCodeSVG value="https://qrdx.dev" :size="256" body-pattern="rounded" />
139
+ */
140
+ export const QRCodeSVG: DefineSetupFnComponent<QRCodeSVGVueProps> =
141
+ defineComponent(
142
+ (props: QRCodeSVGVueProps, { attrs }) =>
143
+ () =>
144
+ draw(props, attrs),
145
+ { name: "QRCodeSVG", inheritAttrs: false, props: svgProps }
146
+ );
147
+
148
+ /**
149
+ * A QR code with the simpler logo API (`logo`, `logoOptions`, `hideLogo`,
150
+ * `scale`): the Vue version of React's `QRCode`, with the same props and the
151
+ * same markup. Attributes such as `class` or `aria-label` go on the `<svg>`.
152
+ *
153
+ * @example
154
+ * <QRCode value="https://qrdx.dev" logo="/logo.png" :size="256" />
155
+ */
156
+ export const QRCode: DefineSetupFnComponent<QRCodeVueProps> = defineComponent(
157
+ (props: QRCodeVueProps, { attrs }) => {
158
+ // The logo layout only reruns when a prop it reads changes
159
+ const options = computed(() => resolveQRCodeProps(props));
160
+ return () => draw(options.value, attrs);
161
+ },
162
+ { name: "QRCode", inheritAttrs: false, props: codeProps }
163
+ );
164
+
165
+ /** What `useQRCode` returns. */
166
+ export interface UseQRCodeReturn {
167
+ /** The options the code is drawn with: `<QRCode>`'s props resolved */
168
+ readonly options: ComputedRef<QRSVGOptions>;
169
+ /** The code's SVG markup, as `toSVGString` writes it; follows the props */
170
+ readonly svg: ComputedRef<string>;
171
+ /** The code as a data URL: "png" (default), "jpg", "webp", "svg", "pdf" or "eps" */
172
+ toDataURL(
173
+ format?: DownloadFormat,
174
+ options?: QRCodeExportOptions
175
+ ): Promise<string>;
176
+ /** Saves the code as a file (a PNG unless `format` says otherwise) */
177
+ download(options?: QRCodeDownloadOptions): Promise<void>;
178
+ }
179
+
180
+ const exportSize = (options: QRSVGOptions, size?: number) => {
181
+ const side = size ?? options.size ?? DEFAULT_SIZE;
182
+ return { width: side, height: side };
183
+ };
184
+
185
+ /**
186
+ * A QR code as a composable: takes `<QRCode>`'s props (a plain object, a
187
+ * ref, a reactive object or a getter) and returns its SVG markup, which
188
+ * follows the props, plus `toDataURL` and `download`. The markup works in
189
+ * SSR; PNG, JPG and WebP need a browser.
190
+ *
191
+ * @example
192
+ * const url = ref("https://qrdx.dev");
193
+ * const { svg, download } = useQRCode(() => ({ value: url.value, size: 256 }));
194
+ */
195
+ export function useQRCode(
196
+ props: MaybeRefOrGetter<QRCodeProps>
197
+ ): UseQRCodeReturn {
198
+ const options = computed(() => resolveQRCodeProps(toValue(props)));
199
+ const svg = computed(() => toSVGString(options.value));
200
+ return {
201
+ options,
202
+ svg,
203
+ toDataURL(format = "png", exportOptions = {}) {
204
+ return getQRCodeDataUrl(
205
+ options.value,
206
+ format,
207
+ exportSize(options.value, exportOptions.size),
208
+ { quality: exportOptions.quality }
209
+ );
210
+ },
211
+ download(downloadOptions = {}) {
212
+ return downloadQRCode(options.value, {
213
+ format: downloadOptions.format ?? "png",
214
+ size: exportSize(options.value, downloadOptions.size),
215
+ filename: downloadOptions.filename,
216
+ quality: downloadOptions.quality,
217
+ });
218
+ },
219
+ };
220
+ }
package/types/index.ts CHANGED
@@ -118,10 +118,11 @@ export type {
118
118
  LogoShape,
119
119
  QRCodeShape,
120
120
  QRProps,
121
- QRPropsCanvas,
122
- QRPropsSVG,
123
121
  QRShape,
124
122
  QRSilhouette,
123
+ QRStyle,
124
+ QRSVGAttributes,
125
+ QRSVGOptions,
125
126
  } from "./qr";
126
127
  export {
127
128
  AUTO_LEVEL_LOGO_COVERAGE,
@@ -153,6 +154,7 @@ export type {
153
154
  BaseTemplateProps,
154
155
  TemplateConfig,
155
156
  TemplateDefinition,
157
+ TemplateNode,
156
158
  } from "./template";
157
159
  export {
158
160
  baseTemplatePropsSchema,
@@ -0,0 +1,4 @@
1
+ // The `qrdx/types` entry: every schema and type, plus the React components'
2
+ // prop types (types/react.ts), which the React-free barrel (./index) leaves out.
3
+ export * from "./index";
4
+ export type { QRPropsCanvas, QRPropsSVG } from "./react";
package/types/qr.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { CSSProperties } from "react";
1
+ import type * as CSS from "csstype";
2
2
  import { z } from "zod";
3
3
  import { type QRArt, qrArtSchema } from "./art";
4
4
  import { type ColorConfig, colorConfigSchema } from "./color";
@@ -211,7 +211,7 @@ export interface QRProps {
211
211
  cornerEyePattern?: CornerEyePattern;
212
212
  cornerEyeDotPattern?: CornerEyeDotPattern;
213
213
  margin?: number;
214
- style?: CSSProperties;
214
+ style?: QRStyle;
215
215
  imageSettings?: ImageSettings;
216
216
  isOGContext?: boolean;
217
217
  templateId?: string;
@@ -249,6 +249,20 @@ export interface QRProps {
249
249
  partMarkers?: boolean;
250
250
  }
251
251
 
252
- export type QRPropsCanvas = QRProps &
253
- React.CanvasHTMLAttributes<HTMLCanvasElement>;
254
- export type QRPropsSVG = QRProps & React.SVGProps<SVGSVGElement>;
252
+ /**
253
+ * Inline styles for the root element, as a style object (`{ maxWidth: 200 }`):
254
+ * the same type as React's `CSSProperties`, without needing React.
255
+ */
256
+ export type QRStyle = CSS.Properties<string | number>;
257
+
258
+ /**
259
+ * Attributes for the root `<svg>`, with React's names (`className`, `style`,
260
+ * `aria-label`, `data-*`…). Event handlers and functions are left out of
261
+ * markup, as React leaves them out.
262
+ */
263
+ export interface QRSVGAttributes {
264
+ [attribute: string]: any;
265
+ }
266
+
267
+ /** What the core draws (`createQRCodeTree`, `toSVGString`): `QRProps` plus root attributes. */
268
+ export type QRSVGOptions = QRProps & QRSVGAttributes;
package/types/react.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Prop types of the React components. Only the React entry (and the
2
+ // `qrdx/types` entry, for compatibility) reach this file; the core's types
3
+ // never do, so they work without React's types installed.
4
+ import type { CanvasHTMLAttributes, SVGProps } from "react";
5
+ import type { QRProps } from "./qr";
6
+
7
+ export type QRPropsCanvas = QRProps & CanvasHTMLAttributes<HTMLCanvasElement>;
8
+ export type QRPropsSVG = QRProps & SVGProps<SVGSVGElement>;
package/types/template.ts CHANGED
@@ -30,7 +30,7 @@ export const templateConfigSchema = z.object({
30
30
  url: z.string(),
31
31
  });
32
32
 
33
- // Note: TemplateDefinition cannot be fully represented in Zod due to React.ReactNode and function types
33
+ // Note: TemplateDefinition cannot be fully represented in Zod due to its element and function types
34
34
  // We'll keep the type definition but add validation for the serializable parts
35
35
  export const templateDefinitionBaseSchema = z.object({
36
36
  id: z.string(),
@@ -42,14 +42,21 @@ export const templateDefinitionBaseSchema = z.object({
42
42
  export type BaseTemplateProps = z.infer<typeof baseTemplatePropsSchema>;
43
43
  export type TemplateConfig = z.infer<typeof templateConfigSchema>;
44
44
 
45
+ /**
46
+ * What a template wrapper receives and returns: React elements when a React
47
+ * component draws the code, the core's plain nodes (`QRNode`) otherwise. A
48
+ * wrapper written with JSX or `h` from "qrdx/core" works in both.
49
+ */
50
+ export type TemplateNode = any;
51
+
45
52
  // Generic template definition that allows custom props
46
53
  export interface TemplateDefinition<TCustomProps = Record<string, never>> {
47
54
  id: string;
48
55
  name: string;
49
56
  description?: string;
50
57
  wrapper: (
51
- children: React.ReactNode,
58
+ children: TemplateNode,
52
59
  props?: BaseTemplateProps & TCustomProps,
53
60
  templateConfig?: TemplateConfig
54
- ) => React.ReactNode;
61
+ ) => TemplateNode;
55
62
  }