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.
- package/README.md +102 -6
- package/dist/angular.js +252 -0
- package/dist/angular.js.map +1 -0
- package/dist/angular.mjs +226 -0
- package/dist/angular.mjs.map +1 -0
- package/dist/core.js +7 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +7 -7
- package/dist/core.mjs.map +1 -1
- package/dist/element-define.browser.mjs +2 -0
- package/dist/element-define.browser.mjs.map +1 -0
- package/dist/element-define.js +2 -0
- package/dist/element-define.js.map +1 -0
- package/dist/element-define.mjs +2 -0
- package/dist/element-define.mjs.map +1 -0
- package/dist/element.browser.mjs +91 -0
- package/dist/element.browser.mjs.map +1 -0
- package/dist/element.js +2 -0
- package/dist/element.js.map +1 -0
- package/dist/element.mjs +2 -0
- package/dist/element.mjs.map +1 -0
- package/dist/frames-index.js +1 -1
- package/dist/frames-index.js.map +1 -1
- package/dist/frames-index.mjs +1 -1
- package/dist/frames-index.mjs.map +1 -1
- package/dist/frames-official.js +1 -1
- package/dist/frames-official.js.map +1 -1
- package/dist/frames-official.mjs +1 -1
- package/dist/frames-official.mjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/preact.js +2 -0
- package/dist/preact.js.map +1 -0
- package/dist/preact.mjs +2 -0
- package/dist/preact.mjs.map +1 -0
- package/dist/qr-code-canvas.js +1 -1
- package/dist/qr-code-canvas.js.map +1 -1
- package/dist/qr-code-canvas.mjs +1 -1
- package/dist/qr-code-canvas.mjs.map +1 -1
- package/dist/solid.js +2 -0
- package/dist/solid.js.map +1 -0
- package/dist/solid.mjs +2 -0
- package/dist/solid.mjs.map +1 -0
- package/dist/src/angular.d.ts +94 -0
- package/dist/src/element-define.d.ts +3 -0
- package/dist/src/element-define.d.ts.map +1 -0
- package/dist/src/element.d.ts +150 -0
- package/dist/src/element.d.ts.map +1 -0
- package/dist/src/engine.d.ts +3 -3
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/frame-spec.d.ts +22 -4
- package/dist/src/frame-spec.d.ts.map +1 -1
- package/dist/src/frame-text.d.ts +19 -0
- package/dist/src/frame-text.d.ts.map +1 -0
- package/dist/src/frame.d.ts +25 -10
- package/dist/src/frame.d.ts.map +1 -1
- package/dist/src/frames/builtin.d.ts +53 -5
- package/dist/src/frames/builtin.d.ts.map +1 -1
- package/dist/src/frames/catalogue/all.d.ts.map +1 -1
- package/dist/src/frames/catalogue/automotive.d.ts.map +1 -1
- package/dist/src/frames/catalogue/counts.d.ts +6 -6
- package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
- package/dist/src/frames/catalogue/events.d.ts.map +1 -1
- package/dist/src/frames/catalogue/holidays.d.ts.map +1 -1
- package/dist/src/frames/catalogue/index.d.ts.map +1 -1
- package/dist/src/frames/catalogue/places.d.ts.map +1 -1
- package/dist/src/frames/catalogue/seasons.d.ts.map +1 -1
- package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
- package/dist/src/preact.d.ts +29 -0
- package/dist/src/preact.d.ts.map +1 -0
- package/dist/src/scan-score.d.ts +4 -3
- package/dist/src/scan-score.d.ts.map +1 -1
- package/dist/src/solid.d.ts +21 -0
- package/dist/src/solid.d.ts.map +1 -0
- package/dist/src/template/arrow.d.ts +0 -1
- package/dist/src/template/arrow.d.ts.map +1 -1
- package/dist/src/template/dot-ring-layout.d.ts +44 -0
- package/dist/src/template/dot-ring-layout.d.ts.map +1 -0
- package/dist/src/template/dot-ring.d.ts +41 -0
- package/dist/src/template/dot-ring.d.ts.map +1 -0
- package/dist/src/template/frame-template.d.ts +19 -0
- package/dist/src/template/frame-template.d.ts.map +1 -0
- package/dist/src/template/halloween.d.ts +0 -1
- package/dist/src/template/halloween.d.ts.map +1 -1
- package/dist/src/template/index.d.ts +1 -0
- package/dist/src/template/index.d.ts.map +1 -1
- package/dist/src/template/square-border.d.ts +0 -1
- package/dist/src/template/square-border.d.ts.map +1 -1
- package/dist/src/template/standard-box.d.ts +0 -1
- package/dist/src/template/standard-box.d.ts.map +1 -1
- package/dist/src/template/striked-box.d.ts +0 -1
- package/dist/src/template/striked-box.d.ts.map +1 -1
- package/dist/src/template-placement.d.ts +8 -0
- package/dist/src/template-placement.d.ts.map +1 -0
- package/dist/src/templates.d.ts.map +1 -1
- package/dist/types/frame-spec.d.ts +703 -14
- package/dist/types/frame-spec.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/index.mjs +2 -2
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/qr.d.ts +137 -3
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/template.d.ts +7 -0
- package/dist/types/template.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +32 -32
- package/dist/vanilla.browser.mjs.map +1 -1
- package/package.json +81 -5
- package/src/angular.ts +218 -0
- package/src/element-define.ts +9 -0
- package/src/element.ts +608 -0
- package/src/engine.ts +13 -2
- package/src/frame-spec.ts +331 -56
- package/src/frame-text.ts +111 -0
- package/src/frame.tsx +74 -287
- package/src/frames/builtin/badge.json +108 -0
- package/src/frames/builtin/banner-bottom.json +2 -1
- package/src/frames/builtin/banner-top-bottom.json +72 -0
- package/src/frames/builtin/banner-top.json +59 -0
- package/src/frames/builtin/border.json +62 -0
- package/src/frames/builtin/chat-bubble.json +54 -0
- package/src/frames/builtin/circle.json +2 -1
- package/src/frames/builtin/envelope.json +81 -0
- package/src/frames/builtin/focus.json +88 -0
- package/src/frames/builtin/gradient-border.json +76 -0
- package/src/frames/builtin/menu-card.json +108 -0
- package/src/frames/builtin/phone.json +75 -0
- package/src/frames/builtin/polaroid.json +56 -0
- package/src/frames/builtin/rounded-border.json +8 -4
- package/src/frames/builtin/speech-bubble-top.json +76 -0
- package/src/frames/builtin/speech-bubble.json +76 -0
- package/src/frames/builtin/sticker.json +78 -0
- package/src/frames/builtin/tag.json +55 -0
- package/src/frames/builtin.ts +181 -12
- package/src/frames/catalogue/all.ts +584 -0
- package/src/frames/catalogue/automotive.ts +2 -0
- package/src/frames/catalogue/counts.ts +6 -6
- package/src/frames/catalogue/events.ts +90 -0
- package/src/frames/catalogue/holidays.ts +336 -0
- package/src/frames/catalogue/index.ts +2733 -0
- package/src/frames/catalogue/places.ts +92 -0
- package/src/frames/catalogue/seasons.ts +64 -0
- package/src/frames/catalogue/tags.ts +384 -0
- package/src/frames/official/africa-day.json +110 -0
- package/src/frames/official/aquarium-feeding.json +113 -0
- package/src/frames/official/autumn-apple-picking.json +81 -0
- package/src/frames/official/autumn-mushroom.json +72 -0
- package/src/frames/official/autumn-pumpkin-patch.json +83 -0
- package/src/frames/official/avurudu-pot.json +87 -0
- package/src/frames/official/beach-conditions.json +113 -0
- package/src/frames/official/beach-info-sticker.json +81 -0
- package/src/frames/official/beach-lifeguard.json +71 -0
- package/src/frames/official/blood-donor-drop.json +87 -0
- package/src/frames/official/blood-donor-sticker.json +94 -0
- package/src/frames/official/book-day-arch.json +71 -0
- package/src/frames/official/book-day-list.json +114 -0
- package/src/frames/official/camp-check-in.json +74 -0
- package/src/frames/official/camp-fire-rules.json +114 -0
- package/src/frames/official/camp-map.json +85 -0
- package/src/frames/official/carnival-mask.json +76 -0
- package/src/frames/official/carnival-pass.json +85 -0
- package/src/frames/official/carnival-plume.json +71 -0
- package/src/frames/official/childrens-day-carp.json +114 -0
- package/src/frames/official/childrens-day-sticker.json +88 -0
- package/src/frames/official/chuseok-gift-tag.json +59 -0
- package/src/frames/official/chuseok-moon.json +99 -0
- package/src/frames/official/chuseok-songpyeon.json +114 -0
- package/src/frames/official/cowork-desk.json +82 -0
- package/src/frames/official/cowork-meeting-room.json +107 -0
- package/src/frames/official/dragon-boat-race.json +83 -0
- package/src/frames/official/dragon-boat-ticket.json +98 -0
- package/src/frames/official/dragon-boat-zongzi.json +81 -0
- package/src/frames/official/durga-puja-lotus.json +114 -0
- package/src/frames/official/dussehra-seal.json +187 -0
- package/src/frames/official/earth-day-globe.json +77 -0
- package/src/frames/official/earth-day-pledge.json +66 -0
- package/src/frames/official/earth-day-recycle.json +109 -0
- package/src/frames/official/enkutatash-daisy.json +87 -0
- package/src/frames/official/enkutatash-seal.json +179 -0
- package/src/frames/official/environment-day.json +83 -0
- package/src/frames/official/event-anniversary.json +107 -0
- package/src/frames/official/event-awards.json +93 -0
- package/src/frames/official/event-baby-gifts.json +113 -0
- package/src/frames/official/event-baby-shower.json +70 -0
- package/src/frames/official/event-birth-announcement.json +71 -0
- package/src/frames/official/event-book-fair.json +142 -0
- package/src/frames/official/event-booth.json +98 -0
- package/src/frames/official/event-craft-fair.json +96 -0
- package/src/frames/official/event-cupcake.json +81 -0
- package/src/frames/official/event-engagement.json +116 -0
- package/src/frames/official/event-film-festival.json +92 -0
- package/src/frames/official/event-food-festival.json +108 -0
- package/src/frames/official/event-fun-run.json +107 -0
- package/src/frames/official/event-gala.json +121 -0
- package/src/frames/official/event-game-night.json +97 -0
- package/src/frames/official/event-grad-diploma.json +126 -0
- package/src/frames/official/event-grad-party.json +108 -0
- package/src/frames/official/event-grad-seal.json +186 -0
- package/src/frames/official/event-grad-stream.json +94 -0
- package/src/frames/official/event-guest-book.json +121 -0
- package/src/frames/official/event-hackathon.json +82 -0
- package/src/frames/official/event-keynote.json +74 -0
- package/src/frames/official/event-match-lineup.json +66 -0
- package/src/frames/official/event-meetup.json +86 -0
- package/src/frames/official/event-memorial.json +124 -0
- package/src/frames/official/event-milestone.json +168 -0
- package/src/frames/official/event-night-market.json +88 -0
- package/src/frames/official/event-open-mic.json +94 -0
- package/src/frames/official/event-party-hat.json +74 -0
- package/src/frames/official/event-prom.json +82 -0
- package/src/frames/official/event-quince.json +70 -0
- package/src/frames/official/event-retirement.json +92 -0
- package/src/frames/official/event-reunion.json +98 -0
- package/src/frames/official/event-runner-tracker.json +101 -0
- package/src/frames/official/event-season-ticket.json +89 -0
- package/src/frames/official/event-session-feedback.json +89 -0
- package/src/frames/official/event-setlist.json +70 -0
- package/src/frames/official/event-short-films.json +113 -0
- package/src/frames/official/event-slides.json +85 -0
- package/src/frames/official/event-speaker-qa.json +112 -0
- package/src/frames/official/event-talent-show.json +130 -0
- package/src/frames/official/event-tour-merch.json +63 -0
- package/src/frames/official/event-tournament.json +98 -0
- package/src/frames/official/event-trivia.json +79 -0
- package/src/frames/official/event-workshop.json +127 -0
- package/src/frames/official/festa-della-repubblica.json +100 -0
- package/src/frames/official/festa-junina-bonfire.json +81 -0
- package/src/frames/official/festa-junina-corn.json +72 -0
- package/src/frames/official/festa-junina-flags.json +110 -0
- package/src/frames/official/fiestas-patrias-chile.json +76 -0
- package/src/frames/official/food-day-wheat.json +109 -0
- package/src/frames/official/freedom-day-south-africa.json +109 -0
- package/src/frames/official/ganesh-marigold.json +71 -0
- package/src/frames/official/ganesh-modak.json +81 -0
- package/src/frames/official/ganesh-pandal.json +109 -0
- package/src/frames/official/garden-plant-label.json +98 -0
- package/src/frames/official/german-unity-day.json +100 -0
- package/src/frames/official/green-ribbon.json +123 -0
- package/src/frames/official/gudi-padwa.json +81 -0
- package/src/frames/official/hanami-arch.json +71 -0
- package/src/frames/official/hanami-picnic.json +90 -0
- package/src/frames/official/hanami-sakura.json +81 -0
- package/src/frames/official/hari-raya-haji.json +122 -0
- package/src/frames/official/hari-raya-ketupat.json +81 -0
- package/src/frames/official/hari-raya-open-house.json +114 -0
- package/src/frames/official/hari-raya-pelita.json +77 -0
- package/src/frames/official/harvest-basket.json +87 -0
- package/src/frames/official/harvest-corn.json +115 -0
- package/src/frames/official/harvest-hay.json +89 -0
- package/src/frames/official/harvest-market.json +109 -0
- package/src/frames/official/hijri-new-year-stamp.json +77 -0
- package/src/frames/official/hijri-new-year.json +122 -0
- package/src/frames/official/historic-marker.json +176 -0
- package/src/frames/official/hostel-check-in.json +113 -0
- package/src/frames/official/hostel-house-rules.json +136 -0
- package/src/frames/official/hostel-local-tips.json +86 -0
- package/src/frames/official/independence-argentina.json +105 -0
- package/src/frames/official/independence-bangladesh.json +64 -0
- package/src/frames/official/independence-colombia.json +108 -0
- package/src/frames/official/independence-ghana.json +105 -0
- package/src/frames/official/independence-indonesia.json +92 -0
- package/src/frames/official/independence-nigeria.json +100 -0
- package/src/frames/official/independence-pakistan.json +95 -0
- package/src/frames/official/independence-peru.json +100 -0
- package/src/frames/official/independence-poland.json +92 -0
- package/src/frames/official/independence-ukraine.json +92 -0
- package/src/frames/official/inti-raymi-sun.json +183 -0
- package/src/frames/official/jamhuri-day.json +116 -0
- package/src/frames/official/janmashtami-feather.json +77 -0
- package/src/frames/official/janmashtami-flute.json +81 -0
- package/src/frames/official/juneteenth-seal.json +187 -0
- package/src/frames/official/juneteenth-star.json +81 -0
- package/src/frames/official/kindness-day.json +109 -0
- package/src/frames/official/kings-day-crown.json +88 -0
- package/src/frames/official/kwanzaa-bands.json +100 -0
- package/src/frames/official/kwanzaa-harvest.json +77 -0
- package/src/frames/official/kwanzaa-kinara.json +81 -0
- package/src/frames/official/lantern-festival-riddles.json +77 -0
- package/src/frames/official/lantern-festival-tangyuan.json +122 -0
- package/src/frames/official/library-catalog.json +120 -0
- package/src/frames/official/library-ebooks.json +107 -0
- package/src/frames/official/library-hours.json +107 -0
- package/src/frames/official/lohri-bonfire.json +81 -0
- package/src/frames/official/lohri-dhol.json +114 -0
- package/src/frames/official/loy-krathong-float.json +88 -0
- package/src/frames/official/loy-krathong-moon.json +96 -0
- package/src/frames/official/loy-krathong-program.json +128 -0
- package/src/frames/official/mardi-gras-seal.json +183 -0
- package/src/frames/official/marina-welcome.json +172 -0
- package/src/frames/official/maslenitsa-pancakes.json +81 -0
- package/src/frames/official/maslenitsa-sun.json +183 -0
- package/src/frames/official/mid-autumn-gift.json +105 -0
- package/src/frames/official/mid-autumn-lantern-walk.json +96 -0
- package/src/frames/official/mid-autumn-mooncake.json +81 -0
- package/src/frames/official/mid-autumn-rabbit.json +77 -0
- package/src/frames/official/mid-autumn-seal.json +178 -0
- package/src/frames/official/monsoon-boots.json +88 -0
- package/src/frames/official/monsoon-chai.json +82 -0
- package/src/frames/official/monsoon-cloud.json +114 -0
- package/src/frames/official/monsoon-paper-boat.json +71 -0
- package/src/frames/official/monsoon-umbrella.json +81 -0
- package/src/frames/official/muertos-marigold.json +87 -0
- package/src/frames/official/muertos-ofrenda.json +129 -0
- package/src/frames/official/muertos-pan.json +78 -0
- package/src/frames/official/muertos-papel-picado.json +120 -0
- package/src/frames/official/muertos-seal.json +185 -0
- package/src/frames/official/museum-artist-note.json +124 -0
- package/src/frames/official/museum-exhibit-label.json +106 -0
- package/src/frames/official/museum-gallery-map.json +99 -0
- package/src/frames/official/museum-ticket.json +86 -0
- package/src/frames/official/national-day-belgium.json +100 -0
- package/src/frames/official/national-day-singapore.json +120 -0
- package/src/frames/official/navratri-dandiya.json +88 -0
- package/src/frames/official/navratri-garba-pass.json +90 -0
- package/src/frames/official/navratri-lamp.json +72 -0
- package/src/frames/official/nowruz-goldfish.json +71 -0
- package/src/frames/official/nowruz-party.json +90 -0
- package/src/frames/official/nowruz-sabzeh.json +81 -0
- package/src/frames/official/nowruz-seal.json +187 -0
- package/src/frames/official/obon-lantern.json +81 -0
- package/src/frames/official/obon-sign.json +109 -0
- package/src/frames/official/ocean-day-waves.json +114 -0
- package/src/frames/official/onam-boat-race.json +83 -0
- package/src/frames/official/onam-kasavu.json +122 -0
- package/src/frames/official/onam-pookalam.json +175 -0
- package/src/frames/official/onam-sadya.json +114 -0
- package/src/frames/official/orthodox-christmas-candle.json +71 -0
- package/src/frames/official/orthodox-christmas-star.json +76 -0
- package/src/frames/official/orthodox-easter-arch.json +77 -0
- package/src/frames/official/orthodox-easter-pysanka.json +87 -0
- package/src/frames/official/orthodox-easter-seal.json +185 -0
- package/src/frames/official/pancake-day.json +114 -0
- package/src/frames/official/park-bench-walks.json +121 -0
- package/src/frames/official/park-dog-rules.json +88 -0
- package/src/frames/official/park-map.json +92 -0
- package/src/frames/official/park-playground.json +64 -0
- package/src/frames/official/park-report.json +118 -0
- package/src/frames/official/parking-find-car.json +89 -0
- package/src/frames/official/peace-day-dove.json +66 -0
- package/src/frames/official/pink-ribbon-seal.json +180 -0
- package/src/frames/official/pink-ribbon.json +82 -0
- package/src/frames/official/pohela-boishakh-mela.json +116 -0
- package/src/frames/official/pohela-boishakh.json +120 -0
- package/src/frames/official/pongal-offers.json +120 -0
- package/src/frames/official/pongal-pot.json +81 -0
- package/src/frames/official/pongal-sun.json +183 -0
- package/src/frames/official/posadas-candle.json +71 -0
- package/src/frames/official/posadas-pinata.json +114 -0
- package/src/frames/official/pride-flag.json +124 -0
- package/src/frames/official/pride-heart.json +83 -0
- package/src/frames/official/pride-rainbow.json +81 -0
- package/src/frames/official/purim-mask.json +109 -0
- package/src/frames/official/purim-pastry.json +71 -0
- package/src/frames/official/puthandu-sun.json +101 -0
- package/src/frames/official/rakhi-envelope.json +75 -0
- package/src/frames/official/rakhi-gift-tag.json +59 -0
- package/src/frames/official/rakhi-thread.json +114 -0
- package/src/frames/official/ramadan-dates.json +81 -0
- package/src/frames/official/ramadan-suhoor.json +94 -0
- package/src/frames/official/red-ribbon.json +66 -0
- package/src/frames/official/republic-day-india-bands.json +120 -0
- package/src/frames/official/republic-day-india.json +182 -0
- package/src/frames/official/reyes-crown.json +78 -0
- package/src/frames/official/reyes-rosca.json +89 -0
- package/src/frames/official/rosh-hashanah-apple.json +81 -0
- package/src/frames/official/rosh-hashanah-honey.json +71 -0
- package/src/frames/official/rosh-hashanah-shofar.json +128 -0
- package/src/frames/official/sankranti-kite.json +114 -0
- package/src/frames/official/sankranti-sky.json +98 -0
- package/src/frames/official/sankranti-sticker.json +90 -0
- package/src/frames/official/school-backpack.json +81 -0
- package/src/frames/official/school-bus-routes.json +83 -0
- package/src/frames/official/school-lunch-menu.json +81 -0
- package/src/frames/official/school-uniform.json +109 -0
- package/src/frames/official/school-welcome-apple.json +71 -0
- package/src/frames/official/seollal-knot.json +122 -0
- package/src/frames/official/sham-el-nessim.json +81 -0
- package/src/frames/official/shogatsu-kadomatsu.json +81 -0
- package/src/frames/official/songkran-bands.json +123 -0
- package/src/frames/official/songkran-bowl.json +81 -0
- package/src/frames/official/songkran-drop.json +90 -0
- package/src/frames/official/songkran-waves.json +96 -0
- package/src/frames/official/spring-cleaning.json +107 -0
- package/src/frames/official/spring-showers.json +71 -0
- package/src/frames/official/spring-watering-can.json +114 -0
- package/src/frames/official/summer-camp.json +90 -0
- package/src/frames/official/summer-pool.json +95 -0
- package/src/frames/official/summer-reading.json +81 -0
- package/src/frames/official/summer-sunglasses.json +114 -0
- package/src/frames/official/summer-watermelon.json +89 -0
- package/src/frames/official/tabaski.json +114 -0
- package/src/frames/official/tanabata-stars.json +170 -0
- package/src/frames/official/tanabata-wishes.json +114 -0
- package/src/frames/official/teachers-day-apple.json +81 -0
- package/src/frames/official/teachers-day-note.json +109 -0
- package/src/frames/official/tet-apricot.json +114 -0
- package/src/frames/official/tet-banh-chung.json +81 -0
- package/src/frames/official/transit-bike-share.json +94 -0
- package/src/frames/official/transit-bus-arrivals.json +113 -0
- package/src/frames/official/transit-fare.json +97 -0
- package/src/frames/official/transit-ferry.json +88 -0
- package/src/frames/official/transit-next-trains.json +119 -0
- package/src/frames/official/transit-report.json +99 -0
- package/src/frames/official/transit-train-timetable.json +98 -0
- package/src/frames/official/ugadi-leaves.json +66 -0
- package/src/frames/official/vaisakhi-bands.json +120 -0
- package/src/frames/official/vaisakhi-dhol.json +81 -0
- package/src/frames/official/vaisakhi-wheat.json +73 -0
- package/src/frames/official/vesak-candle.json +122 -0
- package/src/frames/official/vesak-lantern.json +114 -0
- package/src/frames/official/vesak-lotus.json +71 -0
- package/src/frames/official/vesak-seal.json +179 -0
- package/src/frames/official/visitor-info.json +78 -0
- package/src/frames/official/visitor-town-map.json +108 -0
- package/src/frames/official/visitor-wildlife.json +70 -0
- package/src/frames/official/water-day-drop.json +81 -0
- package/src/frames/official/wifi-cafe-cup.json +81 -0
- package/src/frames/official/wifi-cowork.json +63 -0
- package/src/frames/official/wifi-hostel-board.json +80 -0
- package/src/frames/official/wifi-library.json +96 -0
- package/src/frames/official/wifi-reception.json +118 -0
- package/src/frames/official/wifi-rental.json +91 -0
- package/src/frames/official/wifi-venue.json +80 -0
- package/src/frames/official/wifi-waiting-room.json +89 -0
- package/src/frames/official/winter-lift-pass.json +90 -0
- package/src/frames/official/winter-sale.json +120 -0
- package/src/frames/official/winter-skating.json +71 -0
- package/src/frames/official/winter-snowman.json +81 -0
- package/src/frames/official/womens-day-mimosa.json +81 -0
- package/src/frames/official/womens-day-seal.json +179 -0
- package/src/frames/official/yalda-poem.json +122 -0
- package/src/frames/official/yalda-pomegranate.json +81 -0
- package/src/frames/official/yalda-watermelon.json +72 -0
- package/src/frames/official/yoga-day-lotus.json +81 -0
- package/src/frames/official/zoo-animal-facts.json +109 -0
- package/src/preact.ts +80 -0
- package/src/scan-score.ts +14 -7
- package/src/solid.ts +75 -0
- package/src/template/arrow.ts +14 -0
- package/src/template/dot-ring-layout.ts +230 -0
- package/src/template/dot-ring.tsx +165 -0
- package/src/template/frame-template.tsx +70 -0
- package/src/template/halloween.ts +14 -0
- package/src/template/index.ts +1 -0
- package/src/template/specs/arrow.json +26 -0
- package/src/template/specs/halloween.json +144 -0
- package/src/template/specs/square-border.json +27 -0
- package/src/template/specs/standard-box.json +31 -0
- package/src/template/specs/striked-box.json +56 -0
- package/src/template/square-border.ts +14 -0
- package/src/template/standard-box.ts +14 -0
- package/src/template/striked-box.ts +14 -0
- package/src/template-placement.ts +149 -0
- package/src/templates.tsx +16 -1
- package/types/frame-spec.ts +278 -11
- package/types/qr.ts +1 -1
- package/types/template.ts +7 -0
- package/dist/src/frame-styles.d.ts +0 -50
- package/dist/src/frame-styles.d.ts.map +0 -1
- package/src/frame-styles.ts +0 -1095
- package/src/template/arrow.tsx +0 -40
- package/src/template/halloween.tsx +0 -147
- package/src/template/square-border.tsx +0 -43
- package/src/template/standard-box.tsx +0 -43
- package/src/template/striked-box.tsx +0 -42
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// Where a template draws the code in its artwork. A template wraps the code
|
|
2
|
+
// (a 300 × 300 drawing) in artwork of its own and usually draws it smaller
|
|
3
|
+
// than the whole, so the scan score measures the code's share of the
|
|
4
|
+
// artwork to test the code at its real size.
|
|
5
|
+
import type { QRProps } from "../types";
|
|
6
|
+
import { getTemplate } from "./templates";
|
|
7
|
+
import {
|
|
8
|
+
applyMatrix,
|
|
9
|
+
IDENTITY,
|
|
10
|
+
type Matrix,
|
|
11
|
+
multiply,
|
|
12
|
+
parseNumbers,
|
|
13
|
+
parseTransform,
|
|
14
|
+
} from "./utils/svg-geometry";
|
|
15
|
+
|
|
16
|
+
/** The code's own drawing size inside a template (see utils.tsx). */
|
|
17
|
+
const TEMPLATE_CODE_SIZE = 300;
|
|
18
|
+
|
|
19
|
+
interface ElementLike {
|
|
20
|
+
type?: unknown;
|
|
21
|
+
props?: Record<string, unknown>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const toNumber = (value: unknown): number | undefined => {
|
|
25
|
+
const number =
|
|
26
|
+
typeof value === "number" ? value : Number.parseFloat(String(value));
|
|
27
|
+
return Number.isFinite(number) ? number : undefined;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** A nested `<svg>`'s mapping from its viewBox into its parent's units. */
|
|
31
|
+
function viewportMatrix(props: Record<string, unknown>): Matrix {
|
|
32
|
+
const x = toNumber(props.x) ?? 0;
|
|
33
|
+
const y = toNumber(props.y) ?? 0;
|
|
34
|
+
const viewBox = parseNumbers(
|
|
35
|
+
typeof props.viewBox === "string" ? props.viewBox : undefined
|
|
36
|
+
);
|
|
37
|
+
const width = toNumber(props.width);
|
|
38
|
+
const height = toNumber(props.height);
|
|
39
|
+
if (viewBox.length !== 4 || !(viewBox[2] && viewBox[3] && width && height)) {
|
|
40
|
+
return [1, 0, 0, 1, x, y];
|
|
41
|
+
}
|
|
42
|
+
const [vbX, vbY, vbWidth, vbHeight] = viewBox as [
|
|
43
|
+
number,
|
|
44
|
+
number,
|
|
45
|
+
number,
|
|
46
|
+
number,
|
|
47
|
+
];
|
|
48
|
+
// preserveAspectRatio's default (xMidYMid meet)
|
|
49
|
+
const scale = Math.min(width / vbWidth, height / vbHeight);
|
|
50
|
+
return [
|
|
51
|
+
scale,
|
|
52
|
+
0,
|
|
53
|
+
0,
|
|
54
|
+
scale,
|
|
55
|
+
x + (width - vbWidth * scale) / 2 - vbX * scale,
|
|
56
|
+
y + (height - vbHeight * scale) / 2 - vbY * scale,
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The transform from `target`'s parent into the root's units, or null. */
|
|
61
|
+
function locate(
|
|
62
|
+
node: unknown,
|
|
63
|
+
target: object,
|
|
64
|
+
matrix: Matrix,
|
|
65
|
+
isRoot: boolean
|
|
66
|
+
): Matrix | null {
|
|
67
|
+
if (node === target) {
|
|
68
|
+
return matrix;
|
|
69
|
+
}
|
|
70
|
+
if (Array.isArray(node)) {
|
|
71
|
+
for (const child of node) {
|
|
72
|
+
const found = locate(child, target, matrix, false);
|
|
73
|
+
if (found) {
|
|
74
|
+
return found;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const element = node as ElementLike | null;
|
|
80
|
+
if (!element || typeof element !== "object" || !element.props) {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
const { props } = element;
|
|
84
|
+
let inner = multiply(
|
|
85
|
+
matrix,
|
|
86
|
+
parseTransform(
|
|
87
|
+
typeof props.transform === "string" ? props.transform : undefined
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
if (element.type === "svg" && !isRoot) {
|
|
91
|
+
inner = multiply(inner, viewportMatrix(props));
|
|
92
|
+
}
|
|
93
|
+
return locate(props.children, target, inner, false);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The code's width as a share of the artwork `props` draws: below 1 when a
|
|
98
|
+
* template draws it smaller than its artwork, 1 without a template (or when
|
|
99
|
+
* the template's wrapper doesn't place the code it is given).
|
|
100
|
+
*/
|
|
101
|
+
export function getTemplateCodeShare(props: QRProps): number {
|
|
102
|
+
const template =
|
|
103
|
+
props.customTemplate ||
|
|
104
|
+
(props.templateId ? getTemplate(props.templateId) : undefined);
|
|
105
|
+
if (!template) {
|
|
106
|
+
return 1;
|
|
107
|
+
}
|
|
108
|
+
const marker = {
|
|
109
|
+
type: "svg",
|
|
110
|
+
props: {
|
|
111
|
+
height: TEMPLATE_CODE_SIZE,
|
|
112
|
+
viewBox: `0 0 ${TEMPLATE_CODE_SIZE} ${TEMPLATE_CODE_SIZE}`,
|
|
113
|
+
width: TEMPLATE_CODE_SIZE,
|
|
114
|
+
},
|
|
115
|
+
key: null,
|
|
116
|
+
};
|
|
117
|
+
let root: ElementLike | null;
|
|
118
|
+
try {
|
|
119
|
+
root = template.wrapper(
|
|
120
|
+
marker,
|
|
121
|
+
{
|
|
122
|
+
fgColor: typeof props.fgColor === "string" ? props.fgColor : undefined,
|
|
123
|
+
bgColor: typeof props.bgColor === "string" ? props.bgColor : undefined,
|
|
124
|
+
...(props.customProps ?? {}),
|
|
125
|
+
},
|
|
126
|
+
{ pixelSize: 10, url: props.value }
|
|
127
|
+
) as ElementLike | null;
|
|
128
|
+
} catch {
|
|
129
|
+
return 1;
|
|
130
|
+
}
|
|
131
|
+
const rootProps = root?.props;
|
|
132
|
+
if (!rootProps) {
|
|
133
|
+
return 1;
|
|
134
|
+
}
|
|
135
|
+
const viewBox = parseNumbers(
|
|
136
|
+
typeof rootProps.viewBox === "string" ? rootProps.viewBox : undefined
|
|
137
|
+
);
|
|
138
|
+
const artworkWidth =
|
|
139
|
+
viewBox.length === 4 ? viewBox[2] : toNumber(rootProps.width);
|
|
140
|
+
const matrix = locate(root, marker, IDENTITY, true);
|
|
141
|
+
if (!(matrix && artworkWidth)) {
|
|
142
|
+
return 1;
|
|
143
|
+
}
|
|
144
|
+
const [x0, y0] = applyMatrix(matrix, 0, 0);
|
|
145
|
+
const [x1, y1] = applyMatrix(matrix, TEMPLATE_CODE_SIZE, TEMPLATE_CODE_SIZE);
|
|
146
|
+
const width = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0));
|
|
147
|
+
const share = width / artworkWidth;
|
|
148
|
+
return share > 0 && share <= 1 ? share : 1;
|
|
149
|
+
}
|
package/src/templates.tsx
CHANGED
|
@@ -19,12 +19,27 @@ export const TEMPLATES: Record<string, TemplateDefinition<any>> = {
|
|
|
19
19
|
SquareBorder: templates.SquareBorder,
|
|
20
20
|
StrikedBox: templates.StrikedBox,
|
|
21
21
|
Halloween: templates.Halloween,
|
|
22
|
+
DotRing: templates.DotRing,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Earlier ids that still draw their template, so designs saved with them keep
|
|
26
|
+
// working. getTemplateIds and getAllTemplates leave them out.
|
|
27
|
+
const TEMPLATE_ALIASES: Record<string, string> = {
|
|
28
|
+
FlamQR: "DotRing",
|
|
22
29
|
};
|
|
23
30
|
|
|
24
31
|
// Utility functions
|
|
25
32
|
export const getTemplate = (
|
|
26
33
|
templateId: string
|
|
27
|
-
): TemplateDefinition<any> | undefined =>
|
|
34
|
+
): TemplateDefinition<any> | undefined => {
|
|
35
|
+
if (Object.hasOwn(TEMPLATES, templateId)) {
|
|
36
|
+
return TEMPLATES[templateId];
|
|
37
|
+
}
|
|
38
|
+
const alias = Object.hasOwn(TEMPLATE_ALIASES, templateId)
|
|
39
|
+
? TEMPLATE_ALIASES[templateId]
|
|
40
|
+
: undefined;
|
|
41
|
+
return alias ? TEMPLATES[alias] : undefined;
|
|
42
|
+
};
|
|
28
43
|
|
|
29
44
|
export const getAllTemplates = (): TemplateDefinition<any>[] =>
|
|
30
45
|
Object.values(TEMPLATES);
|
package/types/frame-spec.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { countPathSegments, tokenizePathData } from "../src/utils/path-data";
|
|
11
|
-
import { segmentsBounds } from "../src/utils/polygon-clip";
|
|
11
|
+
import { clipPolygon, segmentsBounds } from "../src/utils/polygon-clip";
|
|
12
12
|
import { parsePathData } from "../src/utils/svg-geometry";
|
|
13
13
|
import {
|
|
14
14
|
FRAME_FONT_SCALE_MAX,
|
|
@@ -165,15 +165,30 @@ const hexColorSchema = z
|
|
|
165
165
|
|
|
166
166
|
const baseColorSchema = z.union([z.enum(FRAME_COLOR_TOKENS), hexColorSchema]);
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
export const frameSpecColorSchema = z.union([
|
|
170
|
-
baseColorSchema,
|
|
168
|
+
const mixSchema = <T extends z.ZodType>(base: T) =>
|
|
171
169
|
z
|
|
172
170
|
.object({
|
|
173
|
-
mix: z.tuple([
|
|
171
|
+
mix: z.tuple([base, base]),
|
|
174
172
|
amount: z.number().min(0).max(1).refine(hasPrecision),
|
|
175
173
|
})
|
|
176
|
-
.strict()
|
|
174
|
+
.strict();
|
|
175
|
+
|
|
176
|
+
/** A theme token, a fixed hex color, or an opaque mix of two of them. */
|
|
177
|
+
export const frameSpecColorSchema = z.union([
|
|
178
|
+
baseColorSchema,
|
|
179
|
+
mixSchema(baseColorSchema),
|
|
180
|
+
]);
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The text color's default: a hex color, or a mix of the frame and accent
|
|
184
|
+
* colors (and fixed colors), worked out from the frame's own colors. It
|
|
185
|
+
* can't refer to `text` itself.
|
|
186
|
+
*/
|
|
187
|
+
const defaultTextColorSchema = z.union([
|
|
188
|
+
hexColorSchema,
|
|
189
|
+
mixSchema(
|
|
190
|
+
z.union([z.enum(["frame", "accent", "background"]), hexColorSchema])
|
|
191
|
+
),
|
|
177
192
|
]);
|
|
178
193
|
|
|
179
194
|
/**
|
|
@@ -207,6 +222,18 @@ const boxFields = {
|
|
|
207
222
|
height: positive,
|
|
208
223
|
};
|
|
209
224
|
|
|
225
|
+
/**
|
|
226
|
+
* An outline drawn along a shape's edge, centered on it (half inside, half
|
|
227
|
+
* outside), in one solid color. Corners are mitered, as SVG draws them.
|
|
228
|
+
*/
|
|
229
|
+
const strokeSchema = z
|
|
230
|
+
.object({
|
|
231
|
+
color: frameSpecColorSchema,
|
|
232
|
+
/** Thickness, at most 10% of the artboard's shorter side */
|
|
233
|
+
width: positive,
|
|
234
|
+
})
|
|
235
|
+
.strict();
|
|
236
|
+
|
|
210
237
|
const rectShapeSchema = z
|
|
211
238
|
.object({
|
|
212
239
|
type: z.literal("rect"),
|
|
@@ -218,6 +245,7 @@ const rectShapeSchema = z
|
|
|
218
245
|
.object({ ...boxFields, radius: nonNegative.optional() })
|
|
219
246
|
.strict()
|
|
220
247
|
.optional(),
|
|
248
|
+
stroke: strokeSchema.optional(),
|
|
221
249
|
})
|
|
222
250
|
.strict();
|
|
223
251
|
|
|
@@ -230,6 +258,7 @@ const circleShapeSchema = z
|
|
|
230
258
|
/** Radius of a hole in the middle (a ring) */
|
|
231
259
|
hole: positive.optional(),
|
|
232
260
|
fill: frameSpecPaintSchema,
|
|
261
|
+
stroke: strokeSchema.optional(),
|
|
233
262
|
})
|
|
234
263
|
.strict();
|
|
235
264
|
|
|
@@ -241,6 +270,7 @@ const ellipseShapeSchema = z
|
|
|
241
270
|
rx: positive,
|
|
242
271
|
ry: positive,
|
|
243
272
|
fill: frameSpecPaintSchema,
|
|
273
|
+
stroke: strokeSchema.optional(),
|
|
244
274
|
})
|
|
245
275
|
.strict();
|
|
246
276
|
|
|
@@ -252,6 +282,7 @@ const polygonShapeSchema = z
|
|
|
252
282
|
.min(3)
|
|
253
283
|
.max(FRAME_SPEC_LIMITS.maxPolygonPoints),
|
|
254
284
|
fill: frameSpecPaintSchema,
|
|
285
|
+
stroke: strokeSchema.optional(),
|
|
255
286
|
})
|
|
256
287
|
.strict();
|
|
257
288
|
|
|
@@ -262,6 +293,7 @@ const pathShapeSchema = z
|
|
|
262
293
|
d: z.string().min(2).max(FRAME_SPEC_LIMITS.maxPathLength),
|
|
263
294
|
fill: frameSpecPaintSchema,
|
|
264
295
|
fillRule: z.enum(["nonzero", "evenodd"]).optional(),
|
|
296
|
+
stroke: strokeSchema.optional(),
|
|
265
297
|
})
|
|
266
298
|
.strict();
|
|
267
299
|
|
|
@@ -318,6 +350,14 @@ const labelFields = {
|
|
|
318
350
|
maxLength: z.int().min(1).max(FRAME_TEXT_MAX_LENGTH).optional(),
|
|
319
351
|
color: frameSpecColorSchema,
|
|
320
352
|
weight: z.enum(["bold", "regular"]).optional(),
|
|
353
|
+
/**
|
|
354
|
+
* A band of the artboard that goes away when the label shows no text:
|
|
355
|
+
* the rows from `y` to `y + height` are cut out, everything below moves
|
|
356
|
+
* up and the artwork gets shorter. Shapes that lie wholly inside the band
|
|
357
|
+
* are left out; shapes that cross it are shortened. The band never
|
|
358
|
+
* touches the code or its padding.
|
|
359
|
+
*/
|
|
360
|
+
collapse: z.object({ y: number, height: positive }).strict().optional(),
|
|
321
361
|
};
|
|
322
362
|
|
|
323
363
|
const textLabelSchema = z
|
|
@@ -386,13 +426,30 @@ const frameSpecObjectSchema = z
|
|
|
386
426
|
padding: nonNegative.optional(),
|
|
387
427
|
/** Corner radius of the plate */
|
|
388
428
|
radius: nonNegative.optional(),
|
|
429
|
+
/**
|
|
430
|
+
* What the plate and `background` fills are painted with when the
|
|
431
|
+
* code's background is see-through. "opaque" (the default) paints
|
|
432
|
+
* them white, so artwork never shows through the quiet zone.
|
|
433
|
+
* "background" keeps them see-through too (and leaves the plate
|
|
434
|
+
* out); it's allowed only when nothing but `background` fills, or a
|
|
435
|
+
* ring whose hole clears the plate, lies under the plate. "none"
|
|
436
|
+
* paints no plate at all: the code's own background and margin are
|
|
437
|
+
* its light space, so `padding` may be under 4% (down to 0), and
|
|
438
|
+
* whatever lies under the code shows through a see-through
|
|
439
|
+
* background.
|
|
440
|
+
*/
|
|
441
|
+
plate: z.enum(["opaque", "background", "none"]).optional(),
|
|
389
442
|
})
|
|
390
443
|
.strict(),
|
|
391
444
|
/** Default colors, used when the theme sets none */
|
|
392
445
|
colors: z
|
|
393
446
|
.object({
|
|
394
447
|
frame: hexColorSchema,
|
|
395
|
-
|
|
448
|
+
/**
|
|
449
|
+
* Default text color (else the frame color): a hex color, or a mix
|
|
450
|
+
* of `frame`, `accent` and fixed colors
|
|
451
|
+
*/
|
|
452
|
+
text: defaultTextColorSchema.optional(),
|
|
396
453
|
accent: hexColorSchema.optional(),
|
|
397
454
|
})
|
|
398
455
|
.strict(),
|
|
@@ -408,6 +465,8 @@ const frameSpecObjectSchema = z
|
|
|
408
465
|
.strict();
|
|
409
466
|
|
|
410
467
|
export type FrameSpecColor = z.infer<typeof frameSpecColorSchema>;
|
|
468
|
+
/** A spec's default text color (`colors.text`). */
|
|
469
|
+
export type FrameSpecDefaultTextColor = z.infer<typeof defaultTextColorSchema>;
|
|
411
470
|
export type FrameSpecPaint = z.infer<typeof frameSpecPaintSchema>;
|
|
412
471
|
export type FrameSpecShape = z.infer<typeof frameSpecShapeSchema>;
|
|
413
472
|
export type FrameSpecLabel = z.infer<typeof frameSpecLabelSchema>;
|
|
@@ -434,16 +493,174 @@ export function frameSpecQrZone(spec: FrameSpec): Box {
|
|
|
434
493
|
};
|
|
435
494
|
}
|
|
436
495
|
|
|
496
|
+
/** The code itself, without its padding. */
|
|
497
|
+
function frameSpecQrBox(spec: FrameSpec): Box {
|
|
498
|
+
return {
|
|
499
|
+
x0: spec.qr.x,
|
|
500
|
+
y0: spec.qr.y,
|
|
501
|
+
x1: spec.qr.x + spec.qr.size,
|
|
502
|
+
y1: spec.qr.y + spec.qr.size,
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
437
506
|
/** The plate's padding around the code, in spec units. */
|
|
438
507
|
export function frameSpecPadding(spec: FrameSpec): number {
|
|
439
508
|
return spec.qr.padding ?? spec.qr.size * FRAME_SPEC_LIMITS.defaultPadding;
|
|
440
509
|
}
|
|
441
510
|
|
|
511
|
+
/** Font size of a text label with no `fontSize`, as a share of its row. */
|
|
512
|
+
export const FRAME_SPEC_DEFAULT_FONT = 0.52;
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Half the height a label's capitals fill, as a share of its font size: a
|
|
516
|
+
* text label's letters are centered on its row, so they fill the row's
|
|
517
|
+
* middle, this far above and below it.
|
|
518
|
+
*/
|
|
519
|
+
export const FRAME_SPEC_CAP_HALF = 0.35;
|
|
520
|
+
|
|
521
|
+
/** The largest font a text label draws (at the largest fontScale). */
|
|
522
|
+
function textLabelMaxFont(
|
|
523
|
+
label: Extract<FrameSpecLabel, { type: "text" }>
|
|
524
|
+
): number {
|
|
525
|
+
const base = label.fontSize ?? label.box.height * FRAME_SPEC_DEFAULT_FONT;
|
|
526
|
+
return Math.min(
|
|
527
|
+
base * FRAME_FONT_SCALE_MAX,
|
|
528
|
+
label.box.height * FRAME_SPEC_LABEL_MAX_FONT
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
|
|
442
532
|
const overlaps = (a: Box, b: Box) =>
|
|
443
533
|
Math.min(a.x1, b.x1) - Math.max(a.x0, b.x0) > 1e-6 &&
|
|
444
534
|
Math.min(a.y1, b.y1) - Math.max(a.y0, b.y0) > 1e-6;
|
|
445
535
|
|
|
446
|
-
|
|
536
|
+
// ── The plate ─────────────────────────────────────────────────────────────
|
|
537
|
+
|
|
538
|
+
type Point = [number, number];
|
|
539
|
+
|
|
540
|
+
/** Points along the plate's outline (its corners rounded by `qr.radius`). */
|
|
541
|
+
function plateOutline(spec: FrameSpec): Point[] {
|
|
542
|
+
const zone = frameSpecQrZone(spec);
|
|
543
|
+
const r = Math.min(
|
|
544
|
+
spec.qr.radius ?? 0,
|
|
545
|
+
(zone.x1 - zone.x0) / 2,
|
|
546
|
+
(zone.y1 - zone.y0) / 2
|
|
547
|
+
);
|
|
548
|
+
const corners: [number, number, number][] = [
|
|
549
|
+
[zone.x0 + r, zone.y0 + r, Math.PI],
|
|
550
|
+
[zone.x1 - r, zone.y0 + r, -Math.PI / 2],
|
|
551
|
+
[zone.x1 - r, zone.y1 - r, 0],
|
|
552
|
+
[zone.x0 + r, zone.y1 - r, Math.PI / 2],
|
|
553
|
+
];
|
|
554
|
+
const points: Point[] = [];
|
|
555
|
+
for (const [cx, cy, start] of corners) {
|
|
556
|
+
for (let i = 0; i <= 8; i++) {
|
|
557
|
+
const angle = start + (Math.PI / 2) * (i / 8);
|
|
558
|
+
points.push([cx + r * Math.cos(angle), cy + r * Math.sin(angle)]);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return points;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function insideRoundedBox(
|
|
565
|
+
[x, y]: Point,
|
|
566
|
+
box: { x: number; y: number; width: number; height: number },
|
|
567
|
+
radius: number
|
|
568
|
+
): boolean {
|
|
569
|
+
const tolerance = 0.01;
|
|
570
|
+
if (
|
|
571
|
+
x < box.x - tolerance ||
|
|
572
|
+
y < box.y - tolerance ||
|
|
573
|
+
x > box.x + box.width + tolerance ||
|
|
574
|
+
y > box.y + box.height + tolerance
|
|
575
|
+
) {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
const r = Math.min(radius, box.width / 2, box.height / 2);
|
|
579
|
+
const cx = Math.min(Math.max(x, box.x + r), box.x + box.width - r);
|
|
580
|
+
const cy = Math.min(Math.max(y, box.y + r), box.y + box.height - r);
|
|
581
|
+
return Math.hypot(x - cx, y - cy) <= r + tolerance;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
/** Area of a simple polygon (shoelace). */
|
|
585
|
+
function polygonArea(points: Point[]): number {
|
|
586
|
+
let twice = 0;
|
|
587
|
+
points.forEach(([x0, y0], i) => {
|
|
588
|
+
const [x1, y1] = points[(i + 1) % points.length] as Point;
|
|
589
|
+
twice += x0 * y1 - x1 * y0;
|
|
590
|
+
});
|
|
591
|
+
return Math.abs(twice) / 2;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* True when `shape` may paint under the plate: anything but a `background`
|
|
596
|
+
* fill, a ring whose hole holds the whole plate, or a polygon that stays
|
|
597
|
+
* off it. Paths, lines, ellipses and icons count when their bounds reach
|
|
598
|
+
* the plate.
|
|
599
|
+
*/
|
|
600
|
+
function paintsUnderPlate(
|
|
601
|
+
shape: FrameSpecShape,
|
|
602
|
+
spec: FrameSpec,
|
|
603
|
+
bounds: Box
|
|
604
|
+
): boolean {
|
|
605
|
+
const zone = frameSpecQrZone(spec);
|
|
606
|
+
if (!overlaps(bounds, zone)) {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
if ("stroke" in shape && shape.stroke) {
|
|
610
|
+
return true;
|
|
611
|
+
}
|
|
612
|
+
if (shape.fill === "background") {
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
if (shape.type === "rect" && shape.hole) {
|
|
616
|
+
const { hole } = shape;
|
|
617
|
+
return !plateOutline(spec).every((point) =>
|
|
618
|
+
insideRoundedBox(point, hole, hole.radius ?? 0)
|
|
619
|
+
);
|
|
620
|
+
}
|
|
621
|
+
if (shape.type === "circle" && shape.hole) {
|
|
622
|
+
const hole = shape.hole;
|
|
623
|
+
return !plateOutline(spec).every(
|
|
624
|
+
([x, y]) => Math.hypot(x - shape.cx, y - shape.cy) <= hole + 0.01
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
if (shape.type === "polygon") {
|
|
628
|
+
const clipped = clipPolygon(shape.points as Point[], zone);
|
|
629
|
+
return clipped.length > 2 && polygonArea(clipped) > 1e-6;
|
|
630
|
+
}
|
|
631
|
+
return true;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Bounds of a spec shape (null for path data outside the grammar) and the
|
|
636
|
+
* segments it counts against FRAME_SPEC_LIMITS.maxSegments.
|
|
637
|
+
*/
|
|
638
|
+
export function frameSpecShapeBounds(shape: FrameSpecShape): {
|
|
639
|
+
bounds: Box | null;
|
|
640
|
+
segments: number;
|
|
641
|
+
} {
|
|
642
|
+
const outline = outlineBounds(shape);
|
|
643
|
+
const stroke = "stroke" in shape ? shape.stroke : undefined;
|
|
644
|
+
if (!(stroke && outline.bounds)) {
|
|
645
|
+
return outline;
|
|
646
|
+
}
|
|
647
|
+
// Half the width outside a curve; a mitered corner reaches further (up to
|
|
648
|
+
// SVG's default miter limit of 4 half widths)
|
|
649
|
+
const reach =
|
|
650
|
+
shape.type === "circle" || shape.type === "ellipse"
|
|
651
|
+
? stroke.width / 2
|
|
652
|
+
: shape.type === "rect"
|
|
653
|
+
? (stroke.width * Math.SQRT2) / 2
|
|
654
|
+
: stroke.width * 2;
|
|
655
|
+
const { x0, y0, x1, y1 } = outline.bounds;
|
|
656
|
+
return {
|
|
657
|
+
bounds: { x0: x0 - reach, y0: y0 - reach, x1: x1 + reach, y1: y1 + reach },
|
|
658
|
+
// The outline is drawn a second time, as the stroke
|
|
659
|
+
segments: outline.segments * 2,
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function outlineBounds(shape: FrameSpecShape): {
|
|
447
664
|
bounds: Box | null;
|
|
448
665
|
segments: number;
|
|
449
666
|
} {
|
|
@@ -557,7 +774,7 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
|
|
|
557
774
|
// The code: big enough, inside the artboard with its padding
|
|
558
775
|
const { qr } = spec;
|
|
559
776
|
const padding = frameSpecPadding(spec);
|
|
560
|
-
if (padding < qr.size * limits.minPadding - 1e-9) {
|
|
777
|
+
if (qr.plate !== "none" && padding < qr.size * limits.minPadding - 1e-9) {
|
|
561
778
|
issue(
|
|
562
779
|
`qr.padding must be at least ${limits.minPadding * 100}% of qr.size`,
|
|
563
780
|
["qr", "padding"]
|
|
@@ -587,7 +804,7 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
|
|
|
587
804
|
let gradientWork = 0;
|
|
588
805
|
spec.shapes.forEach((shape, index) => {
|
|
589
806
|
const path = ["shapes", index];
|
|
590
|
-
const { bounds, segments: count } =
|
|
807
|
+
const { bounds, segments: count } = frameSpecShapeBounds(shape);
|
|
591
808
|
if (!bounds) {
|
|
592
809
|
issue(
|
|
593
810
|
"Path data must use only M L H V C S Q T A Z, plain numbers (up to 3 decimals) and start with M",
|
|
@@ -612,6 +829,23 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
|
|
|
612
829
|
if (shape.type === "circle" && shape.hole && shape.hole >= shape.r) {
|
|
613
830
|
issue("The hole must be smaller than the circle", [...path, "hole"]);
|
|
614
831
|
}
|
|
832
|
+
if (
|
|
833
|
+
"stroke" in shape &&
|
|
834
|
+
shape.stroke &&
|
|
835
|
+
shape.stroke.width > Math.min(width, height) * 0.1 + 1e-9
|
|
836
|
+
) {
|
|
837
|
+
issue("A stroke may be at most 10% of the artboard's shorter side", [
|
|
838
|
+
...path,
|
|
839
|
+
"stroke",
|
|
840
|
+
"width",
|
|
841
|
+
]);
|
|
842
|
+
}
|
|
843
|
+
if (qr.plate === "background" && paintsUnderPlate(shape, spec, bounds)) {
|
|
844
|
+
issue(
|
|
845
|
+
'With qr.plate "background", only background fills (or a ring whose hole holds the plate) may lie under the plate',
|
|
846
|
+
path
|
|
847
|
+
);
|
|
848
|
+
}
|
|
615
849
|
segments += count;
|
|
616
850
|
if (typeof shape.fill === "object" && "gradient" in shape.fill) {
|
|
617
851
|
gradientWork += (shape.fill.gradient.steps ?? 32) * count;
|
|
@@ -630,6 +864,7 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
|
|
|
630
864
|
}
|
|
631
865
|
|
|
632
866
|
// Labels: clean text, inside the artboard, never over the code
|
|
867
|
+
const bands: { y: number; height: number }[] = [];
|
|
633
868
|
const ids = new Set<string>();
|
|
634
869
|
const slots = new Set<string>();
|
|
635
870
|
spec.labels.forEach((label, index) => {
|
|
@@ -671,7 +906,17 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
|
|
|
671
906
|
"fontSize",
|
|
672
907
|
]);
|
|
673
908
|
}
|
|
674
|
-
|
|
909
|
+
// The row may reach into the padding, but never over the code, and
|
|
910
|
+
// the band its capitals fill (at the largest font) stays off both
|
|
911
|
+
const middle = label.box.y + label.box.height / 2;
|
|
912
|
+
const reach = textLabelMaxFont(label) * FRAME_SPEC_CAP_HALF;
|
|
913
|
+
const letters: Box = {
|
|
914
|
+
x0: box.x0,
|
|
915
|
+
x1: box.x1,
|
|
916
|
+
y0: middle - reach,
|
|
917
|
+
y1: middle + reach,
|
|
918
|
+
};
|
|
919
|
+
if (overlaps(box, frameSpecQrBox(spec)) || overlaps(letters, zone)) {
|
|
675
920
|
issue("The label overlaps the code or its padding", [...path, "box"]);
|
|
676
921
|
}
|
|
677
922
|
} else {
|
|
@@ -701,6 +946,28 @@ function checkFrameSpec(spec: FrameSpec, ctx: z.RefinementCtx) {
|
|
|
701
946
|
if (!inside(box)) {
|
|
702
947
|
issue("The label extends outside the artboard", path);
|
|
703
948
|
}
|
|
949
|
+
if (label.collapse) {
|
|
950
|
+
const band = label.collapse;
|
|
951
|
+
const end = band.y + band.height;
|
|
952
|
+
if (band.y < -1e-9 || end > height + 1e-9) {
|
|
953
|
+
issue("The collapse band must sit inside the artboard", [
|
|
954
|
+
...path,
|
|
955
|
+
"collapse",
|
|
956
|
+
]);
|
|
957
|
+
}
|
|
958
|
+
if (end > zone.y0 + 1e-6 && band.y < zone.y1 - 1e-6) {
|
|
959
|
+
issue("The collapse band crosses the code or its padding", [
|
|
960
|
+
...path,
|
|
961
|
+
"collapse",
|
|
962
|
+
]);
|
|
963
|
+
}
|
|
964
|
+
for (const other of bands) {
|
|
965
|
+
if (end > other.y + 1e-6 && band.y < other.y + other.height - 1e-6) {
|
|
966
|
+
issue("Collapse bands may not overlap", [...path, "collapse"]);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
bands.push(band);
|
|
970
|
+
}
|
|
704
971
|
});
|
|
705
972
|
}
|
|
706
973
|
|
package/types/qr.ts
CHANGED
|
@@ -218,7 +218,7 @@ export interface QRProps {
|
|
|
218
218
|
// Custom template definition - if provided, this will be used instead of looking up by templateId
|
|
219
219
|
customTemplate?: TemplateDefinition<any>;
|
|
220
220
|
// Generic custom props that can be used by any template
|
|
221
|
-
// Each template can define its own custom props type (e.g.,
|
|
221
|
+
// Each template can define its own custom props type (e.g., DotRingProps)
|
|
222
222
|
customProps?: Record<string, any>;
|
|
223
223
|
// Frame around the code: a built-in style, or { style: "custom", spec }
|
|
224
224
|
// (see types/frame-spec.ts); the rendered output grows to fit it
|
package/types/template.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { FrameSpec } from "./frame-spec";
|
|
2
3
|
|
|
3
4
|
// Zod schemas
|
|
4
5
|
export const baseTemplatePropsSchema = z.object({
|
|
@@ -54,6 +55,12 @@ export interface TemplateDefinition<TCustomProps = Record<string, never>> {
|
|
|
54
55
|
id: string;
|
|
55
56
|
name: string;
|
|
56
57
|
description?: string;
|
|
58
|
+
/**
|
|
59
|
+
* The frame spec a built-in template draws its artwork from (they're all
|
|
60
|
+
* frames: `{ style: "custom", spec }` draws the same artwork as a frame).
|
|
61
|
+
* Templates that draw in code, like custom ones, have none.
|
|
62
|
+
*/
|
|
63
|
+
spec?: FrameSpec;
|
|
57
64
|
wrapper: (
|
|
58
65
|
children: TemplateNode,
|
|
59
66
|
props?: BaseTemplateProps & TCustomProps,
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/noMagicNumbers: frame proportions */
|
|
2
|
-
import type { FrameStyle, QRFrame } from "../types";
|
|
3
|
-
import type { FrameLabel, FrameLayout } from "./frame";
|
|
4
|
-
export declare const SHAPED_FRAME_STYLES: readonly ["banner-top-bottom", "speech-bubble-top", "chat-bubble", "circle", "polaroid", "phone", "ticket", "badge", "envelope", "tag", "menu-card", "sticker", "gradient-border", "focus"];
|
|
5
|
-
export type ShapedFrameStyle = (typeof SHAPED_FRAME_STYLES)[number];
|
|
6
|
-
export declare function isShapedFrameStyle(style: FrameStyle): style is ShapedFrameStyle;
|
|
7
|
-
/** Default colors of "gradient-border" when `color` / `secondaryColor` are unset. */
|
|
8
|
-
export declare const GRADIENT_FRAME_DEFAULTS: {
|
|
9
|
-
from: string;
|
|
10
|
-
to: string;
|
|
11
|
-
};
|
|
12
|
-
/** Rough em width of one character in a bold sans-serif. */
|
|
13
|
-
export declare function charEm(char: string): number;
|
|
14
|
-
export declare function estimateTextEm(text: string): number;
|
|
15
|
-
/**
|
|
16
|
-
* Opaque mix of two colors (`amount` 0 = `from`, 1 = `to`). Frames use solid
|
|
17
|
-
* tints instead of transparency, because EPS has no transparency.
|
|
18
|
-
*/
|
|
19
|
-
export declare function mixFrameColors(from: string, to: string, amount: number): string;
|
|
20
|
-
export interface FrameStyleContext {
|
|
21
|
-
/** Width of the QR code (margin included) */
|
|
22
|
-
size: number;
|
|
23
|
-
frame: QRFrame;
|
|
24
|
-
/** Frame color (`frame.color` or black) */
|
|
25
|
-
color: string;
|
|
26
|
-
/** Solid page color behind the code */
|
|
27
|
-
background: string;
|
|
28
|
-
text: string;
|
|
29
|
-
secondaryText: string;
|
|
30
|
-
gap: number;
|
|
31
|
-
border: number;
|
|
32
|
-
band: number;
|
|
33
|
-
fontScale: number;
|
|
34
|
-
/**
|
|
35
|
-
* Label fitted in a row: font from the row height, shrunk to `maxWidth`.
|
|
36
|
-
* `field` is the frame text it draws ("text" unless given).
|
|
37
|
-
*/
|
|
38
|
-
fitLabel: (text: string, centerX: number, centerY: number, rowHeight: number, maxWidth: number, color: string, field?: "text" | "secondaryText") => FrameLabel | null;
|
|
39
|
-
}
|
|
40
|
-
type Layout = (ctx: FrameStyleContext) => FrameLayout;
|
|
41
|
-
/**
|
|
42
|
-
* Letters of `text` set along a circle of `radius` around (cx, cy): over the
|
|
43
|
-
* top reading clockwise, or along the bottom reading left to right, upright.
|
|
44
|
-
*/
|
|
45
|
-
export declare function arcLabels(text: string, cx: number, cy: number, radius: number, fontSize: number, where: "top" | "bottom", color: string,
|
|
46
|
-
/** The frame text the letters draw (FrameLabel.field) */
|
|
47
|
-
field: string): FrameLabel[];
|
|
48
|
-
export declare const SHAPED_FRAMES: Record<ShapedFrameStyle, Layout>;
|
|
49
|
-
export {};
|
|
50
|
-
//# sourceMappingURL=frame-styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"frame-styles.d.ts","sourceRoot":"","sources":["../../src/frame-styles.ts"],"names":[],"mappings":"AAAA,oEAAoE;AAKpE,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAEV,UAAU,EACV,WAAW,EAIZ,MAAM,SAAS,CAAC;AAKjB,eAAO,MAAM,mBAAmB,6LAeU,CAAC;AAE3C,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,GAChB,KAAK,IAAI,gBAAgB,CAE3B;AAED,qFAAqF;AACrF,eAAO,MAAM,uBAAuB;;;CAAqC,CAAC;AAM1E,4DAA4D;AAC5D,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAc3C;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMnD;AASD;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,MAAM,CAKR;AA6CD,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,EAAE,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GAAG,eAAe,KAC7B,UAAU,GAAG,IAAI,CAAC;CACxB;AAED,KAAK,MAAM,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,WAAW,CAAC;AA2ItD;;;GAGG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,KAAK,GAAG,QAAQ,EACvB,KAAK,EAAE,MAAM;AACb,yDAAyD;AACzD,KAAK,EAAE,MAAM,GACZ,UAAU,EAAE,CAoCd;AA+sBD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAe1D,CAAC"}
|