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
@@ -0,0 +1,404 @@
1
+ /** biome-ignore-all lint/style/noMagicNumbers: character codes */
2
+ /**
3
+ * How a prop becomes an attribute, the way React DOM's server renderer writes
4
+ * it (react-dom 19, `pushAttribute` in ReactFizzConfigDOM): the same names
5
+ * (`fillRule` → `fill-rule`, `className` → `class`), the same values (style
6
+ * objects, URLs, booleans) and the same props left out (event handlers,
7
+ * functions, `ref`). `renderToString`, `renderToDOM` and `toHyperscript` all
8
+ * use it, so markup, DOM nodes and React agree byte for byte.
9
+ *
10
+ * Ported from React (MIT License, Copyright (c) Meta Platforms, Inc. and
11
+ * affiliates).
12
+ */
13
+
14
+ /** camelCase props written under another name (React's `aliases`). */
15
+ const ALIASES = new Map<string, string>([
16
+ ["acceptCharset", "accept-charset"],
17
+ ["htmlFor", "for"],
18
+ ["httpEquiv", "http-equiv"],
19
+ ["crossOrigin", "crossorigin"],
20
+ ["accentHeight", "accent-height"],
21
+ ["alignmentBaseline", "alignment-baseline"],
22
+ ["arabicForm", "arabic-form"],
23
+ ["baselineShift", "baseline-shift"],
24
+ ["capHeight", "cap-height"],
25
+ ["clipPath", "clip-path"],
26
+ ["clipRule", "clip-rule"],
27
+ ["colorInterpolation", "color-interpolation"],
28
+ ["colorInterpolationFilters", "color-interpolation-filters"],
29
+ ["colorProfile", "color-profile"],
30
+ ["colorRendering", "color-rendering"],
31
+ ["dominantBaseline", "dominant-baseline"],
32
+ ["enableBackground", "enable-background"],
33
+ ["fillOpacity", "fill-opacity"],
34
+ ["fillRule", "fill-rule"],
35
+ ["floodColor", "flood-color"],
36
+ ["floodOpacity", "flood-opacity"],
37
+ ["fontFamily", "font-family"],
38
+ ["fontSize", "font-size"],
39
+ ["fontSizeAdjust", "font-size-adjust"],
40
+ ["fontStretch", "font-stretch"],
41
+ ["fontStyle", "font-style"],
42
+ ["fontVariant", "font-variant"],
43
+ ["fontWeight", "font-weight"],
44
+ ["glyphName", "glyph-name"],
45
+ ["glyphOrientationHorizontal", "glyph-orientation-horizontal"],
46
+ ["glyphOrientationVertical", "glyph-orientation-vertical"],
47
+ ["horizAdvX", "horiz-adv-x"],
48
+ ["horizOriginX", "horiz-origin-x"],
49
+ ["imageRendering", "image-rendering"],
50
+ ["letterSpacing", "letter-spacing"],
51
+ ["lightingColor", "lighting-color"],
52
+ ["markerEnd", "marker-end"],
53
+ ["markerMid", "marker-mid"],
54
+ ["markerStart", "marker-start"],
55
+ ["maskType", "mask-type"],
56
+ ["overlinePosition", "overline-position"],
57
+ ["overlineThickness", "overline-thickness"],
58
+ ["paintOrder", "paint-order"],
59
+ ["panose-1", "panose-1"],
60
+ ["pointerEvents", "pointer-events"],
61
+ ["renderingIntent", "rendering-intent"],
62
+ ["shapeRendering", "shape-rendering"],
63
+ ["stopColor", "stop-color"],
64
+ ["stopOpacity", "stop-opacity"],
65
+ ["strikethroughPosition", "strikethrough-position"],
66
+ ["strikethroughThickness", "strikethrough-thickness"],
67
+ ["strokeDasharray", "stroke-dasharray"],
68
+ ["strokeDashoffset", "stroke-dashoffset"],
69
+ ["strokeLinecap", "stroke-linecap"],
70
+ ["strokeLinejoin", "stroke-linejoin"],
71
+ ["strokeMiterlimit", "stroke-miterlimit"],
72
+ ["strokeOpacity", "stroke-opacity"],
73
+ ["strokeWidth", "stroke-width"],
74
+ ["textAnchor", "text-anchor"],
75
+ ["textDecoration", "text-decoration"],
76
+ ["textRendering", "text-rendering"],
77
+ ["transformOrigin", "transform-origin"],
78
+ ["underlinePosition", "underline-position"],
79
+ ["underlineThickness", "underline-thickness"],
80
+ ["unicodeBidi", "unicode-bidi"],
81
+ ["unicodeRange", "unicode-range"],
82
+ ["unitsPerEm", "units-per-em"],
83
+ ["vAlphabetic", "v-alphabetic"],
84
+ ["vHanging", "v-hanging"],
85
+ ["vIdeographic", "v-ideographic"],
86
+ ["vMathematical", "v-mathematical"],
87
+ ["vectorEffect", "vector-effect"],
88
+ ["vertAdvY", "vert-adv-y"],
89
+ ["vertOriginX", "vert-origin-x"],
90
+ ["vertOriginY", "vert-origin-y"],
91
+ ["wordSpacing", "word-spacing"],
92
+ ["writingMode", "writing-mode"],
93
+ ["xmlnsXlink", "xmlns:xlink"],
94
+ ["xHeight", "x-height"],
95
+ ]);
96
+
97
+ /** String attributes React renames (and writes only for non-booleans). */
98
+ const STRING_ATTRIBUTES = new Map<string, string>([
99
+ ["className", "class"],
100
+ ["tabIndex", "tabindex"],
101
+ ["dir", "dir"],
102
+ ["role", "role"],
103
+ ["viewBox", "viewBox"],
104
+ ["width", "width"],
105
+ ["height", "height"],
106
+ ["xlinkActuate", "xlink:actuate"],
107
+ ["xlinkArcrole", "xlink:arcrole"],
108
+ ["xlinkRole", "xlink:role"],
109
+ ["xlinkShow", "xlink:show"],
110
+ ["xlinkTitle", "xlink:title"],
111
+ ["xlinkType", "xlink:type"],
112
+ ["xmlBase", "xml:base"],
113
+ ["xmlLang", "xml:lang"],
114
+ ["xmlSpace", "xml:space"],
115
+ ]);
116
+
117
+ /** Props that are never attributes. */
118
+ const SKIPPED = new Set([
119
+ "children",
120
+ "dangerouslySetInnerHTML",
121
+ "key",
122
+ "defaultValue",
123
+ "defaultChecked",
124
+ "innerHTML",
125
+ "suppressContentEditableWarning",
126
+ "suppressHydrationWarning",
127
+ "ref",
128
+ ]);
129
+
130
+ /** Written as `name=""` when truthy, left out otherwise. */
131
+ const BOOLEAN = new Set([
132
+ "inert",
133
+ "allowFullScreen",
134
+ "async",
135
+ "autoPlay",
136
+ "controls",
137
+ "credentialless",
138
+ "default",
139
+ "defer",
140
+ "disabled",
141
+ "disablePictureInPicture",
142
+ "disableRemotePlayback",
143
+ "formNoValidate",
144
+ "hidden",
145
+ "loop",
146
+ "noModule",
147
+ "noValidate",
148
+ "open",
149
+ "playsInline",
150
+ "readOnly",
151
+ "required",
152
+ "reversed",
153
+ "scoped",
154
+ "seamless",
155
+ "itemScope",
156
+ ]);
157
+
158
+ /** Booleans React writes lower-cased (`autoFocus` → `autofocus=""`). */
159
+ const LOWERCASE_BOOLEAN = new Set(["autoFocus", "multiple", "muted"]);
160
+
161
+ /** Written as their string form, booleans included ("true"/"false"). */
162
+ const BOOLEANISH_STRING = new Set([
163
+ "contentEditable",
164
+ "spellCheck",
165
+ "draggable",
166
+ "value",
167
+ "autoReverse",
168
+ "externalResourcesRequired",
169
+ "focusable",
170
+ "preserveAlpha",
171
+ ]);
172
+
173
+ /** CSS properties whose numbers take no `px` (React's `unitlessNumbers`). */
174
+ const UNITLESS = new Set(
175
+ "animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(
176
+ " "
177
+ )
178
+ );
179
+
180
+ // React's VALID_ATTRIBUTE_NAME_REGEX (XML name characters), written as a
181
+ // string so the ranges stay readable escapes.
182
+ const NAME_START =
183
+ ":A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
184
+ const VALID_ATTRIBUTE_NAME = new RegExp(
185
+ `^[${NAME_START}][${NAME_START}\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`
186
+ );
187
+
188
+ /** Element names React accepts. */
189
+ export const VALID_TAG = /^[a-zA-Z][a-zA-Z:_.\-\d]*$/;
190
+
191
+ const JAVASCRIPT_URL =
192
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: React's pattern
193
+ /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;
194
+
195
+ const BLOCKED_URL =
196
+ "javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')";
197
+
198
+ const sanitizeURL = (url: string) =>
199
+ JAVASCRIPT_URL.test(url) ? BLOCKED_URL : url;
200
+
201
+ /** HTML elements that never have children (`<img/>`). */
202
+ export const VOID_ELEMENTS = new Set([
203
+ "area",
204
+ "base",
205
+ "br",
206
+ "col",
207
+ "embed",
208
+ "hr",
209
+ "img",
210
+ "input",
211
+ "keygen",
212
+ "link",
213
+ "meta",
214
+ "param",
215
+ "source",
216
+ "track",
217
+ "wbr",
218
+ ]);
219
+
220
+ const ESCAPED = /["'&<>]/;
221
+
222
+ /** Escapes `"&'<>` exactly as React does (`'` → `&#x27;`). */
223
+ export function escapeText(value: string): string {
224
+ if (!ESCAPED.test(value)) {
225
+ return value;
226
+ }
227
+ let out = "";
228
+ let last = 0;
229
+ for (let index = 0; index < value.length; index++) {
230
+ let entity: string;
231
+ switch (value.charCodeAt(index)) {
232
+ case 34:
233
+ entity = "&quot;";
234
+ break;
235
+ case 38:
236
+ entity = "&amp;";
237
+ break;
238
+ case 39:
239
+ entity = "&#x27;";
240
+ break;
241
+ case 60:
242
+ entity = "&lt;";
243
+ break;
244
+ case 62:
245
+ entity = "&gt;";
246
+ break;
247
+ default:
248
+ continue;
249
+ }
250
+ out += value.slice(last, index) + entity;
251
+ last = index + 1;
252
+ }
253
+ return out + value.slice(last);
254
+ }
255
+
256
+ const isDropped = (value: unknown) =>
257
+ typeof value === "function" || typeof value === "symbol";
258
+
259
+ const hyphenated = new Map<string, string>();
260
+ const hyphenate = (name: string) => {
261
+ let css = hyphenated.get(name);
262
+ if (css === undefined) {
263
+ css = name
264
+ .replace(/([A-Z])/g, "-$1")
265
+ .toLowerCase()
266
+ .replace(/^ms-/, "-ms-");
267
+ hyphenated.set(name, css);
268
+ }
269
+ return css;
270
+ };
271
+
272
+ /**
273
+ * A style object as CSS text (`{ marginTop: 4 }` → `margin-top:4px`), as
274
+ * React writes it. A string is taken as CSS text already (React itself
275
+ * refuses one).
276
+ */
277
+ export function styleText(style: unknown): string {
278
+ if (typeof style === "string") {
279
+ return style;
280
+ }
281
+ if (typeof style !== "object" || style === null) {
282
+ return "";
283
+ }
284
+ let css = "";
285
+ for (const name of Object.keys(style)) {
286
+ const value = (style as Record<string, unknown>)[name];
287
+ if (
288
+ value === null ||
289
+ value === undefined ||
290
+ typeof value === "boolean" ||
291
+ value === ""
292
+ ) {
293
+ continue;
294
+ }
295
+ let declaration: string;
296
+ if (name.startsWith("--")) {
297
+ declaration = `${name}:${`${value}`.trim()}`;
298
+ } else {
299
+ const text =
300
+ typeof value === "number"
301
+ ? value === 0 || UNITLESS.has(name)
302
+ ? `${value}`
303
+ : `${value}px`
304
+ : `${value}`.trim();
305
+ declaration = `${hyphenate(name)}:${text}`;
306
+ }
307
+ css = css ? `${css};${declaration}` : declaration;
308
+ }
309
+ return css;
310
+ }
311
+
312
+ /**
313
+ * The attribute a prop is written as, with its unescaped value, or null when
314
+ * React leaves it out.
315
+ */
316
+ export function toAttribute(
317
+ prop: string,
318
+ value: unknown
319
+ ): { name: string; value: string } | null {
320
+ if (value === null || value === undefined || SKIPPED.has(prop)) {
321
+ return null;
322
+ }
323
+ const renamed = STRING_ATTRIBUTES.get(prop);
324
+ if (renamed !== undefined) {
325
+ return isDropped(value) || typeof value === "boolean"
326
+ ? null
327
+ : { name: renamed, value: `${value}` };
328
+ }
329
+ switch (prop) {
330
+ case "style": {
331
+ const css = styleText(value);
332
+ return css ? { name: "style", value: css } : null;
333
+ }
334
+ case "src":
335
+ case "href":
336
+ case "action":
337
+ case "formAction":
338
+ case "xlinkHref":
339
+ if ((prop === "src" || prop === "href") && value === "") {
340
+ return null;
341
+ }
342
+ if (isDropped(value) || typeof value === "boolean") {
343
+ return null;
344
+ }
345
+ return {
346
+ name: prop === "xlinkHref" ? "xlink:href" : prop,
347
+ value: sanitizeURL(`${value}`),
348
+ };
349
+ case "capture":
350
+ case "download":
351
+ if (value === true) {
352
+ return { name: prop, value: "" };
353
+ }
354
+ return value === false || isDropped(value)
355
+ ? null
356
+ : { name: prop, value: `${value}` };
357
+ case "cols":
358
+ case "rows":
359
+ case "size":
360
+ case "span":
361
+ return isDropped(value) ||
362
+ Number.isNaN(Number(value)) ||
363
+ !((value as number) >= 1)
364
+ ? null
365
+ : { name: prop, value: `${value}` };
366
+ case "rowSpan":
367
+ case "start":
368
+ return isDropped(value) || Number.isNaN(Number(value))
369
+ ? null
370
+ : { name: prop, value: `${value}` };
371
+ default:
372
+ break;
373
+ }
374
+ if (LOWERCASE_BOOLEAN.has(prop)) {
375
+ return value && !isDropped(value)
376
+ ? { name: prop.toLowerCase(), value: "" }
377
+ : null;
378
+ }
379
+ if (BOOLEANISH_STRING.has(prop)) {
380
+ return isDropped(value) ? null : { name: prop, value: `${value}` };
381
+ }
382
+ if (BOOLEAN.has(prop)) {
383
+ return value && !isDropped(value) ? { name: prop, value: "" } : null;
384
+ }
385
+ // Event handlers (onClick, onload…) are never written, whatever the value
386
+ if (
387
+ prop.length > 2 &&
388
+ (prop[0] === "o" || prop[0] === "O") &&
389
+ (prop[1] === "n" || prop[1] === "N")
390
+ ) {
391
+ return null;
392
+ }
393
+ const name = ALIASES.get(prop) ?? prop;
394
+ if (!VALID_ATTRIBUTE_NAME.test(name) || isDropped(value)) {
395
+ return null;
396
+ }
397
+ if (typeof value === "boolean") {
398
+ const prefix = name.toLowerCase().slice(0, 5);
399
+ if (prefix !== "data-" && prefix !== "aria-") {
400
+ return null;
401
+ }
402
+ }
403
+ return { name, value: `${value}` };
404
+ }
@@ -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 = {