qrdx 0.0.51 → 0.0.53

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 (467) hide show
  1. package/README.md +102 -6
  2. package/dist/angular.js +252 -0
  3. package/dist/angular.js.map +1 -0
  4. package/dist/angular.mjs +226 -0
  5. package/dist/angular.mjs.map +1 -0
  6. package/dist/core.js +7 -7
  7. package/dist/core.js.map +1 -1
  8. package/dist/core.mjs +7 -7
  9. package/dist/core.mjs.map +1 -1
  10. package/dist/element-define.browser.mjs +2 -0
  11. package/dist/element-define.browser.mjs.map +1 -0
  12. package/dist/element-define.js +2 -0
  13. package/dist/element-define.js.map +1 -0
  14. package/dist/element-define.mjs +2 -0
  15. package/dist/element-define.mjs.map +1 -0
  16. package/dist/element.browser.mjs +91 -0
  17. package/dist/element.browser.mjs.map +1 -0
  18. package/dist/element.js +2 -0
  19. package/dist/element.js.map +1 -0
  20. package/dist/element.mjs +2 -0
  21. package/dist/element.mjs.map +1 -0
  22. package/dist/frames-index.js +1 -1
  23. package/dist/frames-index.js.map +1 -1
  24. package/dist/frames-index.mjs +1 -1
  25. package/dist/frames-index.mjs.map +1 -1
  26. package/dist/frames-official.js +1 -1
  27. package/dist/frames-official.js.map +1 -1
  28. package/dist/frames-official.mjs +1 -1
  29. package/dist/frames-official.mjs.map +1 -1
  30. package/dist/index.js +7 -7
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +7 -7
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/preact.js +2 -0
  35. package/dist/preact.js.map +1 -0
  36. package/dist/preact.mjs +2 -0
  37. package/dist/preact.mjs.map +1 -0
  38. package/dist/qr-code-canvas.js +1 -1
  39. package/dist/qr-code-canvas.js.map +1 -1
  40. package/dist/qr-code-canvas.mjs +1 -1
  41. package/dist/qr-code-canvas.mjs.map +1 -1
  42. package/dist/solid.js +2 -0
  43. package/dist/solid.js.map +1 -0
  44. package/dist/solid.mjs +2 -0
  45. package/dist/solid.mjs.map +1 -0
  46. package/dist/src/angular.d.ts +94 -0
  47. package/dist/src/element-define.d.ts +3 -0
  48. package/dist/src/element-define.d.ts.map +1 -0
  49. package/dist/src/element.d.ts +150 -0
  50. package/dist/src/element.d.ts.map +1 -0
  51. package/dist/src/engine.d.ts +3 -3
  52. package/dist/src/engine.d.ts.map +1 -1
  53. package/dist/src/frame-spec.d.ts +22 -4
  54. package/dist/src/frame-spec.d.ts.map +1 -1
  55. package/dist/src/frame-text.d.ts +19 -0
  56. package/dist/src/frame-text.d.ts.map +1 -0
  57. package/dist/src/frame.d.ts +25 -10
  58. package/dist/src/frame.d.ts.map +1 -1
  59. package/dist/src/frames/builtin.d.ts +53 -5
  60. package/dist/src/frames/builtin.d.ts.map +1 -1
  61. package/dist/src/frames/catalogue/all.d.ts.map +1 -1
  62. package/dist/src/frames/catalogue/automotive.d.ts.map +1 -1
  63. package/dist/src/frames/catalogue/counts.d.ts +6 -6
  64. package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
  65. package/dist/src/frames/catalogue/events.d.ts.map +1 -1
  66. package/dist/src/frames/catalogue/holidays.d.ts.map +1 -1
  67. package/dist/src/frames/catalogue/index.d.ts.map +1 -1
  68. package/dist/src/frames/catalogue/places.d.ts.map +1 -1
  69. package/dist/src/frames/catalogue/seasons.d.ts.map +1 -1
  70. package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
  71. package/dist/src/preact.d.ts +29 -0
  72. package/dist/src/preact.d.ts.map +1 -0
  73. package/dist/src/scan-score.d.ts +4 -3
  74. package/dist/src/scan-score.d.ts.map +1 -1
  75. package/dist/src/solid.d.ts +21 -0
  76. package/dist/src/solid.d.ts.map +1 -0
  77. package/dist/src/template/arrow.d.ts +0 -1
  78. package/dist/src/template/arrow.d.ts.map +1 -1
  79. package/dist/src/template/dot-ring-layout.d.ts +44 -0
  80. package/dist/src/template/dot-ring-layout.d.ts.map +1 -0
  81. package/dist/src/template/dot-ring.d.ts +41 -0
  82. package/dist/src/template/dot-ring.d.ts.map +1 -0
  83. package/dist/src/template/frame-template.d.ts +19 -0
  84. package/dist/src/template/frame-template.d.ts.map +1 -0
  85. package/dist/src/template/halloween.d.ts +0 -1
  86. package/dist/src/template/halloween.d.ts.map +1 -1
  87. package/dist/src/template/index.d.ts +1 -0
  88. package/dist/src/template/index.d.ts.map +1 -1
  89. package/dist/src/template/square-border.d.ts +0 -1
  90. package/dist/src/template/square-border.d.ts.map +1 -1
  91. package/dist/src/template/standard-box.d.ts +0 -1
  92. package/dist/src/template/standard-box.d.ts.map +1 -1
  93. package/dist/src/template/striked-box.d.ts +0 -1
  94. package/dist/src/template/striked-box.d.ts.map +1 -1
  95. package/dist/src/template-placement.d.ts +8 -0
  96. package/dist/src/template-placement.d.ts.map +1 -0
  97. package/dist/src/templates.d.ts.map +1 -1
  98. package/dist/types/frame-spec.d.ts +703 -14
  99. package/dist/types/frame-spec.d.ts.map +1 -1
  100. package/dist/types/index.js +2 -2
  101. package/dist/types/index.js.map +1 -1
  102. package/dist/types/index.mjs +2 -2
  103. package/dist/types/index.mjs.map +1 -1
  104. package/dist/types/qr.d.ts +137 -3
  105. package/dist/types/qr.d.ts.map +1 -1
  106. package/dist/types/template.d.ts +7 -0
  107. package/dist/types/template.d.ts.map +1 -1
  108. package/dist/vanilla.browser.mjs +32 -32
  109. package/dist/vanilla.browser.mjs.map +1 -1
  110. package/package.json +81 -5
  111. package/src/angular.ts +218 -0
  112. package/src/element-define.ts +9 -0
  113. package/src/element.ts +608 -0
  114. package/src/engine.ts +13 -2
  115. package/src/frame-spec.ts +331 -56
  116. package/src/frame-text.ts +111 -0
  117. package/src/frame.tsx +74 -287
  118. package/src/frames/builtin/badge.json +108 -0
  119. package/src/frames/builtin/banner-bottom.json +2 -1
  120. package/src/frames/builtin/banner-top-bottom.json +72 -0
  121. package/src/frames/builtin/banner-top.json +59 -0
  122. package/src/frames/builtin/border.json +62 -0
  123. package/src/frames/builtin/chat-bubble.json +54 -0
  124. package/src/frames/builtin/circle.json +2 -1
  125. package/src/frames/builtin/envelope.json +81 -0
  126. package/src/frames/builtin/focus.json +88 -0
  127. package/src/frames/builtin/gradient-border.json +76 -0
  128. package/src/frames/builtin/menu-card.json +108 -0
  129. package/src/frames/builtin/phone.json +75 -0
  130. package/src/frames/builtin/polaroid.json +56 -0
  131. package/src/frames/builtin/rounded-border.json +8 -4
  132. package/src/frames/builtin/speech-bubble-top.json +76 -0
  133. package/src/frames/builtin/speech-bubble.json +76 -0
  134. package/src/frames/builtin/sticker.json +78 -0
  135. package/src/frames/builtin/tag.json +55 -0
  136. package/src/frames/builtin.ts +181 -12
  137. package/src/frames/catalogue/all.ts +584 -0
  138. package/src/frames/catalogue/automotive.ts +2 -0
  139. package/src/frames/catalogue/counts.ts +6 -6
  140. package/src/frames/catalogue/events.ts +90 -0
  141. package/src/frames/catalogue/holidays.ts +336 -0
  142. package/src/frames/catalogue/index.ts +2733 -0
  143. package/src/frames/catalogue/places.ts +92 -0
  144. package/src/frames/catalogue/seasons.ts +64 -0
  145. package/src/frames/catalogue/tags.ts +384 -0
  146. package/src/frames/official/africa-day.json +110 -0
  147. package/src/frames/official/aquarium-feeding.json +113 -0
  148. package/src/frames/official/autumn-apple-picking.json +81 -0
  149. package/src/frames/official/autumn-mushroom.json +72 -0
  150. package/src/frames/official/autumn-pumpkin-patch.json +83 -0
  151. package/src/frames/official/avurudu-pot.json +87 -0
  152. package/src/frames/official/beach-conditions.json +113 -0
  153. package/src/frames/official/beach-info-sticker.json +81 -0
  154. package/src/frames/official/beach-lifeguard.json +71 -0
  155. package/src/frames/official/blood-donor-drop.json +87 -0
  156. package/src/frames/official/blood-donor-sticker.json +94 -0
  157. package/src/frames/official/book-day-arch.json +71 -0
  158. package/src/frames/official/book-day-list.json +114 -0
  159. package/src/frames/official/camp-check-in.json +74 -0
  160. package/src/frames/official/camp-fire-rules.json +114 -0
  161. package/src/frames/official/camp-map.json +85 -0
  162. package/src/frames/official/carnival-mask.json +76 -0
  163. package/src/frames/official/carnival-pass.json +85 -0
  164. package/src/frames/official/carnival-plume.json +71 -0
  165. package/src/frames/official/childrens-day-carp.json +114 -0
  166. package/src/frames/official/childrens-day-sticker.json +88 -0
  167. package/src/frames/official/chuseok-gift-tag.json +59 -0
  168. package/src/frames/official/chuseok-moon.json +99 -0
  169. package/src/frames/official/chuseok-songpyeon.json +114 -0
  170. package/src/frames/official/cowork-desk.json +82 -0
  171. package/src/frames/official/cowork-meeting-room.json +107 -0
  172. package/src/frames/official/dragon-boat-race.json +83 -0
  173. package/src/frames/official/dragon-boat-ticket.json +98 -0
  174. package/src/frames/official/dragon-boat-zongzi.json +81 -0
  175. package/src/frames/official/durga-puja-lotus.json +114 -0
  176. package/src/frames/official/dussehra-seal.json +187 -0
  177. package/src/frames/official/earth-day-globe.json +77 -0
  178. package/src/frames/official/earth-day-pledge.json +66 -0
  179. package/src/frames/official/earth-day-recycle.json +109 -0
  180. package/src/frames/official/enkutatash-daisy.json +87 -0
  181. package/src/frames/official/enkutatash-seal.json +179 -0
  182. package/src/frames/official/environment-day.json +83 -0
  183. package/src/frames/official/event-anniversary.json +107 -0
  184. package/src/frames/official/event-awards.json +93 -0
  185. package/src/frames/official/event-baby-gifts.json +113 -0
  186. package/src/frames/official/event-baby-shower.json +70 -0
  187. package/src/frames/official/event-birth-announcement.json +71 -0
  188. package/src/frames/official/event-book-fair.json +142 -0
  189. package/src/frames/official/event-booth.json +98 -0
  190. package/src/frames/official/event-craft-fair.json +96 -0
  191. package/src/frames/official/event-cupcake.json +81 -0
  192. package/src/frames/official/event-engagement.json +116 -0
  193. package/src/frames/official/event-film-festival.json +92 -0
  194. package/src/frames/official/event-food-festival.json +108 -0
  195. package/src/frames/official/event-fun-run.json +107 -0
  196. package/src/frames/official/event-gala.json +121 -0
  197. package/src/frames/official/event-game-night.json +97 -0
  198. package/src/frames/official/event-grad-diploma.json +126 -0
  199. package/src/frames/official/event-grad-party.json +108 -0
  200. package/src/frames/official/event-grad-seal.json +186 -0
  201. package/src/frames/official/event-grad-stream.json +94 -0
  202. package/src/frames/official/event-guest-book.json +121 -0
  203. package/src/frames/official/event-hackathon.json +82 -0
  204. package/src/frames/official/event-keynote.json +74 -0
  205. package/src/frames/official/event-match-lineup.json +66 -0
  206. package/src/frames/official/event-meetup.json +86 -0
  207. package/src/frames/official/event-memorial.json +124 -0
  208. package/src/frames/official/event-milestone.json +168 -0
  209. package/src/frames/official/event-night-market.json +88 -0
  210. package/src/frames/official/event-open-mic.json +94 -0
  211. package/src/frames/official/event-party-hat.json +74 -0
  212. package/src/frames/official/event-prom.json +82 -0
  213. package/src/frames/official/event-quince.json +70 -0
  214. package/src/frames/official/event-retirement.json +92 -0
  215. package/src/frames/official/event-reunion.json +98 -0
  216. package/src/frames/official/event-runner-tracker.json +101 -0
  217. package/src/frames/official/event-season-ticket.json +89 -0
  218. package/src/frames/official/event-session-feedback.json +89 -0
  219. package/src/frames/official/event-setlist.json +70 -0
  220. package/src/frames/official/event-short-films.json +113 -0
  221. package/src/frames/official/event-slides.json +85 -0
  222. package/src/frames/official/event-speaker-qa.json +112 -0
  223. package/src/frames/official/event-talent-show.json +130 -0
  224. package/src/frames/official/event-tour-merch.json +63 -0
  225. package/src/frames/official/event-tournament.json +98 -0
  226. package/src/frames/official/event-trivia.json +79 -0
  227. package/src/frames/official/event-workshop.json +127 -0
  228. package/src/frames/official/festa-della-repubblica.json +100 -0
  229. package/src/frames/official/festa-junina-bonfire.json +81 -0
  230. package/src/frames/official/festa-junina-corn.json +72 -0
  231. package/src/frames/official/festa-junina-flags.json +110 -0
  232. package/src/frames/official/fiestas-patrias-chile.json +76 -0
  233. package/src/frames/official/food-day-wheat.json +109 -0
  234. package/src/frames/official/freedom-day-south-africa.json +109 -0
  235. package/src/frames/official/ganesh-marigold.json +71 -0
  236. package/src/frames/official/ganesh-modak.json +81 -0
  237. package/src/frames/official/ganesh-pandal.json +109 -0
  238. package/src/frames/official/garden-plant-label.json +98 -0
  239. package/src/frames/official/german-unity-day.json +100 -0
  240. package/src/frames/official/green-ribbon.json +123 -0
  241. package/src/frames/official/gudi-padwa.json +81 -0
  242. package/src/frames/official/hanami-arch.json +71 -0
  243. package/src/frames/official/hanami-picnic.json +90 -0
  244. package/src/frames/official/hanami-sakura.json +81 -0
  245. package/src/frames/official/hari-raya-haji.json +122 -0
  246. package/src/frames/official/hari-raya-ketupat.json +81 -0
  247. package/src/frames/official/hari-raya-open-house.json +114 -0
  248. package/src/frames/official/hari-raya-pelita.json +77 -0
  249. package/src/frames/official/harvest-basket.json +87 -0
  250. package/src/frames/official/harvest-corn.json +115 -0
  251. package/src/frames/official/harvest-hay.json +89 -0
  252. package/src/frames/official/harvest-market.json +109 -0
  253. package/src/frames/official/hijri-new-year-stamp.json +77 -0
  254. package/src/frames/official/hijri-new-year.json +122 -0
  255. package/src/frames/official/historic-marker.json +176 -0
  256. package/src/frames/official/hostel-check-in.json +113 -0
  257. package/src/frames/official/hostel-house-rules.json +136 -0
  258. package/src/frames/official/hostel-local-tips.json +86 -0
  259. package/src/frames/official/independence-argentina.json +105 -0
  260. package/src/frames/official/independence-bangladesh.json +64 -0
  261. package/src/frames/official/independence-colombia.json +108 -0
  262. package/src/frames/official/independence-ghana.json +105 -0
  263. package/src/frames/official/independence-indonesia.json +92 -0
  264. package/src/frames/official/independence-nigeria.json +100 -0
  265. package/src/frames/official/independence-pakistan.json +95 -0
  266. package/src/frames/official/independence-peru.json +100 -0
  267. package/src/frames/official/independence-poland.json +92 -0
  268. package/src/frames/official/independence-ukraine.json +92 -0
  269. package/src/frames/official/inti-raymi-sun.json +183 -0
  270. package/src/frames/official/jamhuri-day.json +116 -0
  271. package/src/frames/official/janmashtami-feather.json +77 -0
  272. package/src/frames/official/janmashtami-flute.json +81 -0
  273. package/src/frames/official/juneteenth-seal.json +187 -0
  274. package/src/frames/official/juneteenth-star.json +81 -0
  275. package/src/frames/official/kindness-day.json +109 -0
  276. package/src/frames/official/kings-day-crown.json +88 -0
  277. package/src/frames/official/kwanzaa-bands.json +100 -0
  278. package/src/frames/official/kwanzaa-harvest.json +77 -0
  279. package/src/frames/official/kwanzaa-kinara.json +81 -0
  280. package/src/frames/official/lantern-festival-riddles.json +77 -0
  281. package/src/frames/official/lantern-festival-tangyuan.json +122 -0
  282. package/src/frames/official/library-catalog.json +120 -0
  283. package/src/frames/official/library-ebooks.json +107 -0
  284. package/src/frames/official/library-hours.json +107 -0
  285. package/src/frames/official/lohri-bonfire.json +81 -0
  286. package/src/frames/official/lohri-dhol.json +114 -0
  287. package/src/frames/official/loy-krathong-float.json +88 -0
  288. package/src/frames/official/loy-krathong-moon.json +96 -0
  289. package/src/frames/official/loy-krathong-program.json +128 -0
  290. package/src/frames/official/mardi-gras-seal.json +183 -0
  291. package/src/frames/official/marina-welcome.json +172 -0
  292. package/src/frames/official/maslenitsa-pancakes.json +81 -0
  293. package/src/frames/official/maslenitsa-sun.json +183 -0
  294. package/src/frames/official/mid-autumn-gift.json +105 -0
  295. package/src/frames/official/mid-autumn-lantern-walk.json +96 -0
  296. package/src/frames/official/mid-autumn-mooncake.json +81 -0
  297. package/src/frames/official/mid-autumn-rabbit.json +77 -0
  298. package/src/frames/official/mid-autumn-seal.json +178 -0
  299. package/src/frames/official/monsoon-boots.json +88 -0
  300. package/src/frames/official/monsoon-chai.json +82 -0
  301. package/src/frames/official/monsoon-cloud.json +114 -0
  302. package/src/frames/official/monsoon-paper-boat.json +71 -0
  303. package/src/frames/official/monsoon-umbrella.json +81 -0
  304. package/src/frames/official/muertos-marigold.json +87 -0
  305. package/src/frames/official/muertos-ofrenda.json +129 -0
  306. package/src/frames/official/muertos-pan.json +78 -0
  307. package/src/frames/official/muertos-papel-picado.json +120 -0
  308. package/src/frames/official/muertos-seal.json +185 -0
  309. package/src/frames/official/museum-artist-note.json +124 -0
  310. package/src/frames/official/museum-exhibit-label.json +106 -0
  311. package/src/frames/official/museum-gallery-map.json +99 -0
  312. package/src/frames/official/museum-ticket.json +86 -0
  313. package/src/frames/official/national-day-belgium.json +100 -0
  314. package/src/frames/official/national-day-singapore.json +120 -0
  315. package/src/frames/official/navratri-dandiya.json +88 -0
  316. package/src/frames/official/navratri-garba-pass.json +90 -0
  317. package/src/frames/official/navratri-lamp.json +72 -0
  318. package/src/frames/official/nowruz-goldfish.json +71 -0
  319. package/src/frames/official/nowruz-party.json +90 -0
  320. package/src/frames/official/nowruz-sabzeh.json +81 -0
  321. package/src/frames/official/nowruz-seal.json +187 -0
  322. package/src/frames/official/obon-lantern.json +81 -0
  323. package/src/frames/official/obon-sign.json +109 -0
  324. package/src/frames/official/ocean-day-waves.json +114 -0
  325. package/src/frames/official/onam-boat-race.json +83 -0
  326. package/src/frames/official/onam-kasavu.json +122 -0
  327. package/src/frames/official/onam-pookalam.json +175 -0
  328. package/src/frames/official/onam-sadya.json +114 -0
  329. package/src/frames/official/orthodox-christmas-candle.json +71 -0
  330. package/src/frames/official/orthodox-christmas-star.json +76 -0
  331. package/src/frames/official/orthodox-easter-arch.json +77 -0
  332. package/src/frames/official/orthodox-easter-pysanka.json +87 -0
  333. package/src/frames/official/orthodox-easter-seal.json +185 -0
  334. package/src/frames/official/pancake-day.json +114 -0
  335. package/src/frames/official/park-bench-walks.json +121 -0
  336. package/src/frames/official/park-dog-rules.json +88 -0
  337. package/src/frames/official/park-map.json +92 -0
  338. package/src/frames/official/park-playground.json +64 -0
  339. package/src/frames/official/park-report.json +118 -0
  340. package/src/frames/official/parking-find-car.json +89 -0
  341. package/src/frames/official/peace-day-dove.json +66 -0
  342. package/src/frames/official/pink-ribbon-seal.json +180 -0
  343. package/src/frames/official/pink-ribbon.json +82 -0
  344. package/src/frames/official/pohela-boishakh-mela.json +116 -0
  345. package/src/frames/official/pohela-boishakh.json +120 -0
  346. package/src/frames/official/pongal-offers.json +120 -0
  347. package/src/frames/official/pongal-pot.json +81 -0
  348. package/src/frames/official/pongal-sun.json +183 -0
  349. package/src/frames/official/posadas-candle.json +71 -0
  350. package/src/frames/official/posadas-pinata.json +114 -0
  351. package/src/frames/official/pride-flag.json +124 -0
  352. package/src/frames/official/pride-heart.json +83 -0
  353. package/src/frames/official/pride-rainbow.json +81 -0
  354. package/src/frames/official/purim-mask.json +109 -0
  355. package/src/frames/official/purim-pastry.json +71 -0
  356. package/src/frames/official/puthandu-sun.json +101 -0
  357. package/src/frames/official/rakhi-envelope.json +75 -0
  358. package/src/frames/official/rakhi-gift-tag.json +59 -0
  359. package/src/frames/official/rakhi-thread.json +114 -0
  360. package/src/frames/official/ramadan-dates.json +81 -0
  361. package/src/frames/official/ramadan-suhoor.json +94 -0
  362. package/src/frames/official/red-ribbon.json +66 -0
  363. package/src/frames/official/republic-day-india-bands.json +120 -0
  364. package/src/frames/official/republic-day-india.json +182 -0
  365. package/src/frames/official/reyes-crown.json +78 -0
  366. package/src/frames/official/reyes-rosca.json +89 -0
  367. package/src/frames/official/rosh-hashanah-apple.json +81 -0
  368. package/src/frames/official/rosh-hashanah-honey.json +71 -0
  369. package/src/frames/official/rosh-hashanah-shofar.json +128 -0
  370. package/src/frames/official/sankranti-kite.json +114 -0
  371. package/src/frames/official/sankranti-sky.json +98 -0
  372. package/src/frames/official/sankranti-sticker.json +90 -0
  373. package/src/frames/official/school-backpack.json +81 -0
  374. package/src/frames/official/school-bus-routes.json +83 -0
  375. package/src/frames/official/school-lunch-menu.json +81 -0
  376. package/src/frames/official/school-uniform.json +109 -0
  377. package/src/frames/official/school-welcome-apple.json +71 -0
  378. package/src/frames/official/seollal-knot.json +122 -0
  379. package/src/frames/official/sham-el-nessim.json +81 -0
  380. package/src/frames/official/shogatsu-kadomatsu.json +81 -0
  381. package/src/frames/official/songkran-bands.json +123 -0
  382. package/src/frames/official/songkran-bowl.json +81 -0
  383. package/src/frames/official/songkran-drop.json +90 -0
  384. package/src/frames/official/songkran-waves.json +96 -0
  385. package/src/frames/official/spring-cleaning.json +107 -0
  386. package/src/frames/official/spring-showers.json +71 -0
  387. package/src/frames/official/spring-watering-can.json +114 -0
  388. package/src/frames/official/summer-camp.json +90 -0
  389. package/src/frames/official/summer-pool.json +95 -0
  390. package/src/frames/official/summer-reading.json +81 -0
  391. package/src/frames/official/summer-sunglasses.json +114 -0
  392. package/src/frames/official/summer-watermelon.json +89 -0
  393. package/src/frames/official/tabaski.json +114 -0
  394. package/src/frames/official/tanabata-stars.json +170 -0
  395. package/src/frames/official/tanabata-wishes.json +114 -0
  396. package/src/frames/official/teachers-day-apple.json +81 -0
  397. package/src/frames/official/teachers-day-note.json +109 -0
  398. package/src/frames/official/tet-apricot.json +114 -0
  399. package/src/frames/official/tet-banh-chung.json +81 -0
  400. package/src/frames/official/transit-bike-share.json +94 -0
  401. package/src/frames/official/transit-bus-arrivals.json +113 -0
  402. package/src/frames/official/transit-fare.json +97 -0
  403. package/src/frames/official/transit-ferry.json +88 -0
  404. package/src/frames/official/transit-next-trains.json +119 -0
  405. package/src/frames/official/transit-report.json +99 -0
  406. package/src/frames/official/transit-train-timetable.json +98 -0
  407. package/src/frames/official/ugadi-leaves.json +66 -0
  408. package/src/frames/official/vaisakhi-bands.json +120 -0
  409. package/src/frames/official/vaisakhi-dhol.json +81 -0
  410. package/src/frames/official/vaisakhi-wheat.json +73 -0
  411. package/src/frames/official/vesak-candle.json +122 -0
  412. package/src/frames/official/vesak-lantern.json +114 -0
  413. package/src/frames/official/vesak-lotus.json +71 -0
  414. package/src/frames/official/vesak-seal.json +179 -0
  415. package/src/frames/official/visitor-info.json +78 -0
  416. package/src/frames/official/visitor-town-map.json +108 -0
  417. package/src/frames/official/visitor-wildlife.json +70 -0
  418. package/src/frames/official/water-day-drop.json +81 -0
  419. package/src/frames/official/wifi-cafe-cup.json +81 -0
  420. package/src/frames/official/wifi-cowork.json +63 -0
  421. package/src/frames/official/wifi-hostel-board.json +80 -0
  422. package/src/frames/official/wifi-library.json +96 -0
  423. package/src/frames/official/wifi-reception.json +118 -0
  424. package/src/frames/official/wifi-rental.json +91 -0
  425. package/src/frames/official/wifi-venue.json +80 -0
  426. package/src/frames/official/wifi-waiting-room.json +89 -0
  427. package/src/frames/official/winter-lift-pass.json +90 -0
  428. package/src/frames/official/winter-sale.json +120 -0
  429. package/src/frames/official/winter-skating.json +71 -0
  430. package/src/frames/official/winter-snowman.json +81 -0
  431. package/src/frames/official/womens-day-mimosa.json +81 -0
  432. package/src/frames/official/womens-day-seal.json +179 -0
  433. package/src/frames/official/yalda-poem.json +122 -0
  434. package/src/frames/official/yalda-pomegranate.json +81 -0
  435. package/src/frames/official/yalda-watermelon.json +72 -0
  436. package/src/frames/official/yoga-day-lotus.json +81 -0
  437. package/src/frames/official/zoo-animal-facts.json +109 -0
  438. package/src/preact.ts +80 -0
  439. package/src/scan-score.ts +14 -7
  440. package/src/solid.ts +75 -0
  441. package/src/template/arrow.ts +14 -0
  442. package/src/template/dot-ring-layout.ts +230 -0
  443. package/src/template/dot-ring.tsx +165 -0
  444. package/src/template/frame-template.tsx +70 -0
  445. package/src/template/halloween.ts +14 -0
  446. package/src/template/index.ts +1 -0
  447. package/src/template/specs/arrow.json +26 -0
  448. package/src/template/specs/halloween.json +144 -0
  449. package/src/template/specs/square-border.json +27 -0
  450. package/src/template/specs/standard-box.json +31 -0
  451. package/src/template/specs/striked-box.json +56 -0
  452. package/src/template/square-border.ts +14 -0
  453. package/src/template/standard-box.ts +14 -0
  454. package/src/template/striked-box.ts +14 -0
  455. package/src/template-placement.ts +149 -0
  456. package/src/templates.tsx +16 -1
  457. package/types/frame-spec.ts +278 -11
  458. package/types/qr.ts +1 -1
  459. package/types/template.ts +7 -0
  460. package/dist/src/frame-styles.d.ts +0 -50
  461. package/dist/src/frame-styles.d.ts.map +0 -1
  462. package/src/frame-styles.ts +0 -1095
  463. package/src/template/arrow.tsx +0 -40
  464. package/src/template/halloween.tsx +0 -147
  465. package/src/template/square-border.tsx +0 -43
  466. package/src/template/standard-box.tsx +0 -43
  467. package/src/template/striked-box.tsx +0 -42
@@ -0,0 +1,81 @@
1
+ {
2
+ "id": "yoga-day-lotus",
3
+ "name": "Yoga Day lotus",
4
+ "description": "A solid card with a lotus over the code and the label underneath, in saffron and peach.",
5
+ "category": "seasonal",
6
+ "collection": "holidays",
7
+ "occasion": "yoga-day",
8
+ "contentTypes": [],
9
+ "tags": ["international day of yoga", "yoga", "june 21", "lotus"],
10
+ "license": "CC0-1.0",
11
+ "spec": {
12
+ "kind": "qrdx.frame",
13
+ "version": 1,
14
+ "artboard": {
15
+ "width": 1240,
16
+ "height": 1740
17
+ },
18
+ "qr": {
19
+ "x": 120,
20
+ "y": 410,
21
+ "size": 1000,
22
+ "padding": 80,
23
+ "radius": 24
24
+ },
25
+ "colors": {
26
+ "frame": "#c2410c",
27
+ "text": "#ffffff",
28
+ "accent": "#fed7aa"
29
+ },
30
+ "shapes": [
31
+ {
32
+ "type": "rect",
33
+ "x": 0,
34
+ "y": 0,
35
+ "width": 1240,
36
+ "height": 1740,
37
+ "radius": 72,
38
+ "fill": "frame"
39
+ },
40
+ {
41
+ "type": "path",
42
+ "d": "M620 155C645.74 135.2 645.74 90.65 620 56C594.26 90.65 594.26 135.2 620 155ZM617 158C623.31 135.34 605.76 100.24 578 80C566.8 119.72 584.35 154.82 617 158ZM623 158C655.65 154.82 673.2 119.72 662 80C634.24 100.24 616.69 135.34 623 158ZM614 161C609.26 142.03 582.26 124.48 554 122C562.84 154.36 589.84 171.91 614 161ZM626 161C650.16 171.91 677.16 154.36 686 122C657.74 124.48 630.74 142.03 626 161Z",
43
+ "fill": "text"
44
+ },
45
+ {
46
+ "type": "path",
47
+ "d": "M572 164C599 173 641 173 668 164L665 173C638 182 602 182 575 173Z",
48
+ "fill": "accent"
49
+ }
50
+ ],
51
+ "labels": [
52
+ {
53
+ "type": "text",
54
+ "id": "cta",
55
+ "slot": "primary",
56
+ "text": "Scan for class times",
57
+ "color": "text",
58
+ "box": {
59
+ "x": 80,
60
+ "y": 1530,
61
+ "width": 1080,
62
+ "height": 170
63
+ }
64
+ },
65
+ {
66
+ "type": "text",
67
+ "id": "note",
68
+ "slot": "secondary",
69
+ "text": "International Yoga Day",
70
+ "color": "text",
71
+ "box": {
72
+ "x": 120,
73
+ "y": 200,
74
+ "width": 1000,
75
+ "height": 96
76
+ },
77
+ "weight": "regular"
78
+ }
79
+ ]
80
+ }
81
+ }
@@ -0,0 +1,109 @@
1
+ {
2
+ "id": "zoo-animal-facts",
3
+ "name": "Zoo animal facts",
4
+ "description": "A light card with a bold side bar and left-aligned text and an elephant.",
5
+ "category": "use-case",
6
+ "collection": "places",
7
+ "contentTypes": ["url"],
8
+ "tags": ["zoo", "aquarium", "animals"],
9
+ "license": "CC0-1.0",
10
+ "spec": {
11
+ "kind": "qrdx.frame",
12
+ "version": 1,
13
+ "artboard": {
14
+ "width": 1300,
15
+ "height": 1620
16
+ },
17
+ "qr": {
18
+ "x": 180,
19
+ "y": 140,
20
+ "size": 1000,
21
+ "padding": 80,
22
+ "radius": 24
23
+ },
24
+ "colors": {
25
+ "frame": "#111111",
26
+ "text": "#ffffff",
27
+ "accent": "#111111"
28
+ },
29
+ "shapes": [
30
+ {
31
+ "type": "rect",
32
+ "x": 0,
33
+ "y": 0,
34
+ "width": 1300,
35
+ "height": 1620,
36
+ "fill": {
37
+ "mix": ["frame", "background"],
38
+ "amount": 0.92
39
+ }
40
+ },
41
+ {
42
+ "type": "rect",
43
+ "x": 0,
44
+ "y": 0,
45
+ "width": 40,
46
+ "height": 1620,
47
+ "fill": "accent"
48
+ },
49
+ {
50
+ "type": "rect",
51
+ "x": 0,
52
+ "y": 0,
53
+ "width": 1300,
54
+ "height": 1620,
55
+ "fill": {
56
+ "mix": ["frame", "background"],
57
+ "amount": 0.82
58
+ },
59
+ "hole": {
60
+ "x": 0,
61
+ "y": 8,
62
+ "width": 1292,
63
+ "height": 1604
64
+ }
65
+ },
66
+ {
67
+ "type": "path",
68
+ "d": "M1095.5 1387A46.5 36 0 1 1 1188.5 1387A46.5 36 0 1 1 1095.5 1387ZM1071.5 1375A25.5 25.5 0 1 1 1122.5 1375A25.5 25.5 0 1 1 1071.5 1375ZM1088.87 1388.57L1086.49 1391.76L1084.52 1394.77L1082.81 1397.8L1081.34 1400.87L1080.11 1403.95L1079.12 1407.03L1078.36 1410.12L1077.82 1413.19L1077.5 1416.25L1077.4 1419.28L1077.51 1422.27L1077.84 1425.21L1078.37 1428.09L1079.1 1430.89L1080.04 1433.62L1081.17 1436.25L1082.5 1438.78L1084.12 1441.33L1076.88 1446.67L1074.7 1444.06L1072.62 1441.12L1070.77 1437.99L1069.14 1434.7L1067.75 1431.26L1066.61 1427.68L1065.72 1423.98L1065.1 1420.16L1064.75 1416.25L1064.68 1412.25L1064.91 1408.19L1065.44 1404.08L1066.27 1399.93L1067.42 1395.76L1068.89 1391.58L1070.68 1387.42L1072.82 1383.29L1075.13 1379.43ZM1110.5 1405L1118 1405A4.5 4.5 0 0 1 1122.5 1409.5L1122.5 1445.5A4.5 4.5 0 0 1 1118 1450L1110.5 1450A4.5 4.5 0 0 1 1106 1445.5L1106 1409.5A4.5 4.5 0 0 1 1110.5 1405ZM1133 1408L1140.5 1408A4.5 4.5 0 0 1 1145 1412.5L1145 1445.5A4.5 4.5 0 0 1 1140.5 1450L1133 1450A4.5 4.5 0 0 1 1128.5 1445.5L1128.5 1412.5A4.5 4.5 0 0 1 1133 1408ZM1157 1408L1164.5 1408A4.5 4.5 0 0 1 1169 1412.5L1169 1445.5A4.5 4.5 0 0 1 1164.5 1450L1157 1450A4.5 4.5 0 0 1 1152.5 1445.5L1152.5 1412.5A4.5 4.5 0 0 1 1157 1408ZM1176.5 1402L1182.5 1402A4.5 4.5 0 0 1 1187 1406.5L1187 1445.5A4.5 4.5 0 0 1 1182.5 1450L1176.5 1450A4.5 4.5 0 0 1 1172 1445.5L1172 1406.5A4.5 4.5 0 0 1 1176.5 1402ZM1189.4 1376.95L1199.9 1400.95L1195.1 1403.05L1184.6 1379.05ZM1084.25 1369A3.75 3.75 0 1 0 1091.75 1369A3.75 3.75 0 1 0 1084.25 1369Z",
69
+ "fill": "frame"
70
+ },
71
+ {
72
+ "type": "path",
73
+ "d": "M1103 1354C1124 1348 1133 1369 1127 1393C1118 1405 1103 1399 1101.5 1384Z",
74
+ "fill": "accent"
75
+ }
76
+ ],
77
+ "labels": [
78
+ {
79
+ "type": "text",
80
+ "id": "cta",
81
+ "slot": "primary",
82
+ "text": "Scan for animal facts",
83
+ "color": "frame",
84
+ "box": {
85
+ "x": 180,
86
+ "y": 1270,
87
+ "width": 1000,
88
+ "height": 170
89
+ },
90
+ "align": "start"
91
+ },
92
+ {
93
+ "type": "text",
94
+ "id": "note",
95
+ "slot": "secondary",
96
+ "text": "Meet our residents",
97
+ "color": "frame",
98
+ "box": {
99
+ "x": 180,
100
+ "y": 1450,
101
+ "width": 1000,
102
+ "height": 90
103
+ },
104
+ "weight": "regular",
105
+ "align": "start"
106
+ }
107
+ ]
108
+ }
109
+ }
package/src/preact.ts ADDED
@@ -0,0 +1,80 @@
1
+ // qrdx/preact: the code as Preact components, drawn with Preact's own `h`
2
+ // (no preact/compat). The core builds the tree and `toHyperscript` turns it
3
+ // into Preact elements with DOM attribute names, which Preact sets on SVG
4
+ // elements as given, so the page gets the markup `toSVGString` writes, and
5
+ // preact-render-to-string writes it on a server. Preact diffs the elements
6
+ // itself; a component only rebuilds the tree when its props change.
7
+
8
+ import { Component, h, type VNode } from "preact";
9
+ import {
10
+ createQRCodeTree,
11
+ type QRCodeProps,
12
+ type QRSVGOptions,
13
+ resolveQRCodeProps,
14
+ toHyperscript,
15
+ } from "./core";
16
+
17
+ export type { QRCodeProps, QRSVGOptions } from "./core";
18
+
19
+ const element = (
20
+ type: string,
21
+ attributes: Record<string, string>,
22
+ children: (VNode | string)[],
23
+ key: string | null
24
+ ): VNode =>
25
+ h(type, key === null ? attributes : { ...attributes, key }, ...children);
26
+
27
+ /** The code for `options` as Preact elements. */
28
+ function draw(options: QRSVGOptions): VNode {
29
+ return toHyperscript(createQRCodeTree(options), element)[0] as VNode;
30
+ }
31
+
32
+ function sameProps(a: object, b: object): boolean {
33
+ const keys = Object.keys(a);
34
+ if (keys.length !== Object.keys(b).length) {
35
+ return false;
36
+ }
37
+ return keys.every(
38
+ (key) =>
39
+ Object.hasOwn(b, key) &&
40
+ Object.is(
41
+ (a as Record<string, unknown>)[key],
42
+ (b as Record<string, unknown>)[key]
43
+ )
44
+ );
45
+ }
46
+
47
+ /** Skips a render when no prop changed, as React's `memo` does. */
48
+ // biome-ignore lint/style/useReactFunctionComponents: shouldComponentUpdate skips renders without preact/hooks or preact/compat (memo lives in compat)
49
+ abstract class Drawn<P extends object> extends Component<P> {
50
+ override shouldComponentUpdate(next: P): boolean {
51
+ return !sameProps(this.props, next);
52
+ }
53
+ }
54
+
55
+ /**
56
+ * The code as an `<svg>`, with every styling option `QRCodeSVG` takes in
57
+ * React. Attributes such as `class`, `style` or `aria-label` go on the
58
+ * `<svg>` (on the frame's outer `<svg>` with a frame).
59
+ *
60
+ * @example
61
+ * <QRCodeSVG value="https://qrdx.dev" size={256} bodyPattern="rounded" />
62
+ */
63
+ export class QRCodeSVG extends Drawn<QRSVGOptions> {
64
+ override render(): VNode {
65
+ return draw(this.props);
66
+ }
67
+ }
68
+
69
+ /**
70
+ * `QRCodeSVG` with React's `QRCode` logo API: `logo`, `logoOptions`,
71
+ * `hideLogo` and `scale`.
72
+ *
73
+ * @example
74
+ * <QRCode value="https://qrdx.dev" logo="/logo.png" level="H" />
75
+ */
76
+ export class QRCode extends Drawn<QRCodeProps> {
77
+ override render(): VNode {
78
+ return draw(resolveQRCodeProps(this.props));
79
+ }
80
+ }
package/src/scan-score.ts CHANGED
@@ -19,6 +19,7 @@ import { getFrameDimensions, getFrameGapRatio, isFrameActive } from "./frame";
19
19
  import { getLogoBlockDamage } from "./logo-budget";
20
20
  import { circleQuietZone, getLayoutMargin, isShapedCode } from "./qr-shape";
21
21
  import { getStylePairRisk } from "./scan-risk";
22
+ import { getTemplateCodeShare } from "./template-placement";
22
23
  import { getImageSettings, getLuminance, resolveErrorLevel } from "./utils";
23
24
  import { parseColor, type RGBAColor } from "./utils/parse-color";
24
25
 
@@ -1011,9 +1012,12 @@ export async function getScanScore(
1011
1012
  const { signal } = options;
1012
1013
  const sizes = testSizes(options);
1013
1014
 
1015
+ // A template draws the code smaller than its artwork: render the artwork
1016
+ // large enough for the code itself to be SOURCE_SIZE wide
1017
+ const artworkSize = SOURCE_SIZE / getTemplateCodeShare(props);
1014
1018
  const sourceProps = await inlineImagePaints(
1015
1019
  await inlineLogo(
1016
- withQRSize({ ...props, size: props.size ?? DEFAULT_SIZE }, SOURCE_SIZE)
1020
+ withQRSize({ ...props, size: props.size ?? DEFAULT_SIZE }, artworkSize)
1017
1021
  )
1018
1022
  );
1019
1023
  throwIfAborted(signal);
@@ -1033,7 +1037,7 @@ export async function getScanScore(
1033
1037
  const img = await loadImage(svgUri);
1034
1038
  throwIfAborted(signal);
1035
1039
 
1036
- const artwork = getFrameDimensions(SOURCE_SIZE, props.frame);
1040
+ const artwork = getFrameDimensions(artworkSize, props.frame);
1037
1041
  const drawArtwork = (codeWidth: number) => {
1038
1042
  const scale = codeWidth / SOURCE_SIZE;
1039
1043
  const width = artwork.width * scale;
@@ -1062,9 +1066,10 @@ export const PIXEL_SCORE_MIN_CODE_WIDTH = SOURCE_SIZE;
1062
1066
  * `getScanScore` for servers and other places without a DOM: the same
1063
1067
  * checks, weights and camera model, decoding `pixels` instead of drawing the
1064
1068
  * SVG on a canvas. `pixels` is the whole artwork as `props` renders it (the
1065
- * code plus its frame, if any), at any size with the code at least
1066
- * `PIXEL_SCORE_MIN_CODE_WIDTH` px wide (rasterized with resvg, sharp or a
1067
- * canvas). Transparent pixels count as white, like paper. Logos must already
1069
+ * code plus its frame or template, if any), at any size with the code itself
1070
+ * at least `PIXEL_SCORE_MIN_CODE_WIDTH` px wide (rasterized with resvg, sharp
1071
+ * or a canvas; a template draws the code smaller than its artwork).
1072
+ * Transparent pixels count as white, like paper. Logos must already
1068
1073
  * be painted into the pixels; an opaque placeholder of the same size scores
1069
1074
  * the same.
1070
1075
  */
@@ -1080,8 +1085,10 @@ export async function getScanScoreFromPixels(
1080
1085
  const sizes = testSizes(options);
1081
1086
  const size = props.size ?? DEFAULT_SIZE;
1082
1087
  const artwork = getFrameDimensions(size, props.frame);
1083
- // Code width in the source pixels
1084
- const sourceCodeWidth = (width * size) / artwork.width;
1088
+ // Code width in the source pixels (a template draws it smaller than its
1089
+ // artwork)
1090
+ const sourceCodeWidth =
1091
+ (width * size * getTemplateCodeShare(props)) / artwork.width;
1085
1092
  const source = { data: onWhite(pixels), width, height };
1086
1093
 
1087
1094
  const drawArtwork = (codeWidth: number) => {
package/src/solid.ts ADDED
@@ -0,0 +1,75 @@
1
+ // qrdx/solid: the code as Solid components, written without JSX, so the
2
+ // package needs no Solid compiler. On the client a component returns the
3
+ // `<svg>` element itself, built with `renderToDOM` (createElementNS, no HTML
4
+ // parsing), from a memo: Solid inserts it, swaps in a new one when a prop
5
+ // changes the markup, and removes it on unmount. On a server it returns
6
+ // `toSVGString`'s markup with a hydration key on the root element, and
7
+ // hydration adopts that element instead of drawing it again, the way Solid's
8
+ // own <Dynamic> claims server elements.
9
+
10
+ import { createMemo, type JSX, untrack } from "solid-js";
11
+ // A namespace import: solid-js 1.8's server build has no getNextElement, and
12
+ // a named import of it would fail to link there (only the browser calls it)
13
+ import * as web from "solid-js/web";
14
+ import {
15
+ createQRCodeTree,
16
+ type QRCodeProps,
17
+ type QRSVGOptions,
18
+ renderToDOM,
19
+ renderToString,
20
+ resolveQRCodeProps,
21
+ } from "./core";
22
+
23
+ export type { QRCodeProps, QRSVGOptions } from "./core";
24
+
25
+ const ROOT_TAG = /^<[^\s/>]+/;
26
+
27
+ function draw(options: () => QRSVGOptions): JSX.Element {
28
+ if (web.isServer) {
29
+ const markup = renderToString(createQRCodeTree(options()));
30
+ // ssr() output is written as is; the key lets hydration find the element
31
+ const key = web.ssrHydrationKey();
32
+ return web.ssr(
33
+ key ? markup.replace(ROOT_TAG, (tag) => tag + key) : markup
34
+ ) as unknown as JSX.Element;
35
+ }
36
+ const tree = createMemo(() => createQRCodeTree(options()));
37
+ // Strings compare by value, so a change that draws the same markup stops here
38
+ const markup = createMemo(() => renderToString(tree()));
39
+ const fresh = () => {
40
+ const element = renderToDOM(untrack(tree), document).firstChild as Element;
41
+ // Out of its fragment: while hydrating, Solid takes a node that has a
42
+ // parent for one that's already on the page and wouldn't insert it
43
+ element.remove();
44
+ return element;
45
+ };
46
+ const svg = createMemo(() => {
47
+ markup();
48
+ // While hydrating, the server's element (found by its key); otherwise new
49
+ return web.getNextElement(fresh);
50
+ });
51
+ return svg as unknown as JSX.Element;
52
+ }
53
+
54
+ /**
55
+ * The code as an `<svg>`, with every styling option `QRCodeSVG` takes in
56
+ * React. Attributes such as `class`, `style` or `aria-label` go on the
57
+ * `<svg>` (on the frame's outer `<svg>` with a frame).
58
+ *
59
+ * @example
60
+ * <QRCodeSVG value="https://qrdx.dev" size={256} bodyPattern="rounded" />
61
+ */
62
+ export function QRCodeSVG(props: QRSVGOptions): JSX.Element {
63
+ return draw(() => ({ ...props }));
64
+ }
65
+
66
+ /**
67
+ * `QRCodeSVG` with React's `QRCode` logo API: `logo`, `logoOptions`,
68
+ * `hideLogo` and `scale`.
69
+ *
70
+ * @example
71
+ * <QRCode value="https://qrdx.dev" logo="/logo.png" level="H" />
72
+ */
73
+ export function QRCode(props: QRCodeProps): JSX.Element {
74
+ return draw(() => resolveQRCodeProps({ ...props }));
75
+ }
@@ -0,0 +1,14 @@
1
+ // The Arrow template: its artwork is a frame spec (./specs/arrow.json),
2
+ // drawn by the frame engine in the template's own box (./frame-template.tsx).
3
+ import type { TemplateDefinition } from "../../types";
4
+ import type { FrameSpec } from "../../types/frame-spec";
5
+ import { frameTemplate } from "./frame-template";
6
+ import arrow from "./specs/arrow.json";
7
+
8
+ export const Arrow: TemplateDefinition = frameTemplate({
9
+ id: "Arrow",
10
+ name: "Arrow",
11
+ description: "QR code with arrow",
12
+ spec: arrow as unknown as FrameSpec,
13
+ at: { x: 47, y: 95, scale: 1 },
14
+ });
@@ -0,0 +1,230 @@
1
+ /** biome-ignore-all lint/style/noMagicNumbers: the artwork's own geometry */
2
+ // The drawing of the dot ring template (dot-ring.tsx): its geometry, the
3
+ // dots around the code and which of them a link draws, and the text along
4
+ // the ring. Kept out of template/index.ts, so none of it becomes public API.
5
+ // The dot layout and the way a link picks its dots come from the first
6
+ // round design built on qrdx's custom templates (2025), so designs made
7
+ // with it keep their rings.
8
+ import { sanitizeFrameText } from "../../types/frame-spec";
9
+ import { roundTo } from "../utils/fmt";
10
+
11
+ // ── Geometry (a 593 × 593 drawing) ────────────────────────────────────────
12
+
13
+ export const VIEW = 593;
14
+ export const CENTER = 296.5;
15
+ /** The code (300 × 300) sits in the middle. */
16
+ export const CODE_OFFSET = 146.5;
17
+ export const BACKGROUND_RADIUS = 294.5;
18
+ export const RING_INNER_RADIUS = 231.228;
19
+ /** The ring: the whole disc minus the inner one. */
20
+ export const RING_PATH =
21
+ "M296.5 0C460.252 -7.15782e-06 593 132.748 593 296.5C593 460.252 460.253 593 296.5 593C132.748 593 7.15782e-06 460.252 0 296.5C-7.15788e-06 132.748 132.748 7.15788e-06 296.5 0ZM296.5 527.728C424.204 527.728 527.728 424.204 527.728 296.5C527.728 168.796 424.204 65.2713 296.5 65.2713C168.796 65.2713 65.2714 168.796 65.2714 296.5C65.2714 424.204 168.796 527.728 296.5 527.728Z";
22
+
23
+ // ── Decorative dots ───────────────────────────────────────────────────────
24
+
25
+ // The 297 dot centers, in their original order (the order decides which
26
+ // dots a link gets). DOT_X and DOT_Y list the distinct x and y
27
+ // values in ten-thousandths of a unit, each as the base-36 step from the one
28
+ // before; DOT_CELLS gives each dot as three base-36 digits of
29
+ // xIndex × DOT_ROWS + yIndex. tests/dot-ring-template.test.ts checks them
30
+ // against the original table.
31
+ const DOT_X =
32
+ "iaa2 1z3g 1z0y 1z18 1z18 1we8 2mq 1uta 47y 1rx4 73u 1rx4 73u 1rxe 73u 1rx4 73u 1rxe 73u 1rx4 73u 1rxe 73u 1rx4 73u 1rzm 71m 1rzm 71m 1rzc 73u okq 13ce 744 1rx4 744 1rwu 744 1rx4 744 1rx4 73u 1rx4 744 1rx4 73u 1rx4 73u 1rx4 744 1rx4 73u 1rxe 73u 1rx4 73u 1rx4 744 1rzm 71c 1rzm 73u 1rxe 73u 1rx4 744 1rx4 73u 1rx4 73u 1rxe 73u 1rx4 618 12m 1rxe 73u 1z0y 1z18 1z0y 1z18 1z0y 1z18 1z18";
33
+ const DOT_Y =
34
+ "hqpr 5 1z36 1z0y 1z18 1z18 1z0y 1z0y 1a7w otc 1z0y 1z18 1z0y 1z18 1z0y 1z1i 1z0o 1z18 1z0y 1z3q 1z0y 1z18 1z0y 1z18 1z0y 1z18 1z0y 1z18 1z0y 1z18 1z0y 1lk8 dgq 1z18 1z18 1z3g 1z0y 1z0y 1z18 1z18 1z0y 1z0y 1z18 1yx2 3w 1z18 60o 1t0a 1z18 1z0y 1z18 1z0y";
35
+ const DOT_CELLS =
36
+ "3cf27f17c00j3ch21n1ek00l1el3cj1vv1kd00n3cl3cn1q31q500p3cp1vx00r1kb3cs3aw1ej21p00t3ax3ay17b27h00w3b02g20yq01w2d611m01x3b52aa14i01y24i1bq0203bd3be1q21q60253bf39e39f39h14e2ae02d39j11i2da02e39l0ym02f39n2lt0sz03a39p2ix0vv03b39r2d511n39t03d27d17f03f39x39y21l1en03h3a03a11vt1kf03j37w37x1q11q703l37z1k903n1vz3821eh03p21r38714d03t11h03u2db38a0vp2j303w2lz38g03x0st2rk0n804o38l2oo0q404p38n2iw0vw04r36f36h2a814k04u36k36l1vs1kg04z36o36p1n41t405236q36x36y0ss2m005d3720n02rs05f3742uf0kd0633763772on0q506537834y2fz0yt06834z2d311p06935235424f1bt06c35621j1ep06d3581yn1hl06e35a1sv1nd06g35b1pz1q906h35d35e35g1ef21t06l35h1bj24p06m35k35l11f2dd06q35n0vn2j506s35p35q0pv2ox06u35s0mz2rt06v35t33h0k32up06w2x90hi08y2ud0ke08z33r2lp0t20922fx0yu0942a514m09624d1bu0983441yl1hm09a1vp1ki09b1px1qa09d34e1n11t609e1h91yy09g1ed21u09h1a227m0831492ai09l0yh2ga09n0sp2m209p0pt2oy09q0k12uq09s2xo0h52z209t31k0en0bt2780c319z0az0e831z0cq";
37
+ const DOT_ROWS = 52;
38
+ /** How many of the dots a code draws. */
39
+ const DOTS_DRAWN = 240;
40
+
41
+ export interface Dot {
42
+ cx: number;
43
+ cy: number;
44
+ }
45
+
46
+ function decodeSteps(steps: string): number[] {
47
+ let value = 0;
48
+ return steps.split(" ").map((step) => {
49
+ value += Number.parseInt(step, 36);
50
+ return value / 10_000;
51
+ });
52
+ }
53
+
54
+ let ringDots: readonly Dot[] | undefined;
55
+
56
+ /** Every dot position, decoded on first use. */
57
+ export function dotRingPositions(): readonly Dot[] {
58
+ if (!ringDots) {
59
+ const xs = decodeSteps(DOT_X);
60
+ const ys = decodeSteps(DOT_Y);
61
+ const dots: Dot[] = [];
62
+ for (let i = 0; i < DOT_CELLS.length; i += 3) {
63
+ const cell = Number.parseInt(DOT_CELLS.slice(i, i + 3), 36);
64
+ dots.push({
65
+ cx: xs[Math.floor(cell / DOT_ROWS)] as number,
66
+ cy: ys[cell % DOT_ROWS] as number,
67
+ });
68
+ }
69
+ ringDots = dots;
70
+ }
71
+ return ringDots;
72
+ }
73
+
74
+ /** A 31-bit hash of the code's content. */
75
+ function contentHash(text: string): number {
76
+ let hash = 0;
77
+ for (let i = 0; i < text.length; i++) {
78
+ hash = hash * 32 - hash + text.charCodeAt(i);
79
+ hash %= 2_147_483_647;
80
+ }
81
+ return Math.abs(hash);
82
+ }
83
+
84
+ /**
85
+ * The dots `value` draws: a seeded shuffle (a linear congruential
86
+ * generator and a Fisher–Yates pass) picks DOTS_DRAWN of them, kept in
87
+ * their original order.
88
+ */
89
+ export function dotRingDots(value: string): Dot[] {
90
+ const dots = dotRingPositions();
91
+ let state = contentHash(value);
92
+ const random = () => {
93
+ state = (state * 9301 + 49_297) % 233_280;
94
+ return state / 233_280;
95
+ };
96
+ const order = dots.map((_, index) => index);
97
+ for (let i = order.length - 1; i > 0; i--) {
98
+ const j = Math.floor(random() * (i + 1));
99
+ [order[i], order[j]] = [order[j] as number, order[i] as number];
100
+ }
101
+ return order
102
+ .slice(0, DOTS_DRAWN)
103
+ .sort((a, b) => a - b)
104
+ .map((index) => dots[index] as Dot);
105
+ }
106
+
107
+ /** The code's width in the drawing (its 300 × 300 drawing, unscaled). */
108
+ const CODE_SIZE = 300;
109
+ /**
110
+ * A code more than this many modules across (version 9 and up) has modules
111
+ * much smaller than the ring's dots are spaced, and dots right next to it
112
+ * stop decoders finding it at small sizes; up to here they read fine.
113
+ */
114
+ const DENSE_MODULES = 49;
115
+ /** The light band a dense code keeps clear of dots, in modules. */
116
+ const DENSE_QUIET_MODULES = 6;
117
+
118
+ /**
119
+ * `dots` as a code with modules `moduleSize` across draws them, each a disc
120
+ * half a module in radius: all of them, or for a dense code only those at
121
+ * least DENSE_QUIET_MODULES modules clear of it.
122
+ */
123
+ export function dotsClearOfCode(
124
+ dots: readonly Dot[],
125
+ moduleSize: number
126
+ ): readonly Dot[] {
127
+ if (CODE_SIZE / moduleSize <= DENSE_MODULES + 0.5) {
128
+ return dots;
129
+ }
130
+ const start = CODE_OFFSET;
131
+ const end = CODE_OFFSET + CODE_SIZE;
132
+ const band = DENSE_QUIET_MODULES * moduleSize + moduleSize / 2;
133
+ return dots.filter(({ cx, cy }) => {
134
+ const away = Math.max(start - cx, cx - end, start - cy, cy - end);
135
+ return away >= band;
136
+ });
137
+ }
138
+
139
+ // ── Text on the ring ──────────────────────────────────────────────────────
140
+
141
+ /** Four times round, it closes the ring with an even gap at the bottom. */
142
+ export const DEFAULT_TEXT =
143
+ "Scan the QR code * Scan the QR code * Scan the QR code * Scan the QR code *";
144
+ export const DEFAULT_FONT_SIZE = 32;
145
+ export const DEFAULT_LETTER_SPACING = 3.5;
146
+ /** Letters are spaced along this circle. */
147
+ const TEXT_PATH_RADIUS = 246.5;
148
+ /** Half a cap height, in em: the letters' band is centered on TEXT_BAND_RADIUS. */
149
+ const HALF_CAP = 0.36;
150
+ const TEXT_BAND_RADIUS = TEXT_PATH_RADIUS + HALF_CAP * DEFAULT_FONT_SIZE;
151
+ /** Longest text read, in code points (more never fits around the ring). */
152
+ const TEXT_MAX_LENGTH = 400;
153
+
154
+ /** A rough letter width for a heavy sans-serif. */
155
+ function letterWidth(char: string, fontSize: number): number {
156
+ if (char === " " || /[il1|!']/.test(char)) {
157
+ return fontSize * 0.3;
158
+ }
159
+ if (/[mwMW@%&]/.test(char)) {
160
+ return fontSize * 0.8;
161
+ }
162
+ return fontSize * 0.6;
163
+ }
164
+
165
+ /** The text as drawn: no control or invisible characters, spaces kept. */
166
+ function cleanText(text: string): string[] {
167
+ const clean = text
168
+ .slice(0, TEXT_MAX_LENGTH)
169
+ .split(" ")
170
+ .map((word) => sanitizeFrameText(word, TEXT_MAX_LENGTH))
171
+ .join(" ");
172
+ return Array.from(clean).slice(0, TEXT_MAX_LENGTH);
173
+ }
174
+
175
+ export interface RingLetter {
176
+ char: string;
177
+ x: number;
178
+ y: number;
179
+ rotate: number;
180
+ }
181
+
182
+ /** Letters of `text` along the ring, centered at the top or the bottom. */
183
+ export function dotRingLetters(
184
+ text: string,
185
+ options: {
186
+ fontSize: number;
187
+ letterSpacing: number;
188
+ position: "top" | "bottom";
189
+ rotation: number;
190
+ }
191
+ ): RingLetter[] {
192
+ const { fontSize, letterSpacing, position, rotation } = options;
193
+ const circumference = 2 * Math.PI * TEXT_PATH_RADIUS;
194
+ // Keep the letters that fit around the ring
195
+ const kept: { char: string; along: number }[] = [];
196
+ let offset = 0;
197
+ for (const char of cleanText(text)) {
198
+ const width = letterWidth(char, fontSize);
199
+ if (offset + width > circumference) {
200
+ break;
201
+ }
202
+ kept.push({ char, along: offset + width / 2 });
203
+ offset += width + letterSpacing;
204
+ }
205
+ const total = offset - (kept.length > 0 ? letterSpacing : 0);
206
+ const top = position !== "bottom";
207
+ // Baseline: the letters' band centered on TEXT_BAND_RADIUS, rising
208
+ // outwards at the top and inwards at the bottom
209
+ const radius = top
210
+ ? TEXT_BAND_RADIUS - HALF_CAP * fontSize
211
+ : TEXT_BAND_RADIUS + HALF_CAP * fontSize;
212
+ const half = (total / circumference) * 180;
213
+ const letters: RingLetter[] = [];
214
+ for (const { char, along } of kept) {
215
+ if (char.trim() === "") {
216
+ continue;
217
+ }
218
+ const step = (along / circumference) * 360;
219
+ // Degrees clockwise from twelve o'clock
220
+ const angle = top ? rotation - half + step : rotation + 180 + half - step;
221
+ const radians = (angle * Math.PI) / 180;
222
+ letters.push({
223
+ char,
224
+ x: roundTo(CENTER + radius * Math.sin(radians)),
225
+ y: roundTo(CENTER - radius * Math.cos(radians)),
226
+ rotate: roundTo(top ? angle : angle - 180),
227
+ });
228
+ }
229
+ return letters;
230
+ }