qrdx 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -3
- package/dist/core.js +31 -0
- package/dist/core.js.map +1 -0
- package/dist/core.mjs +31 -0
- package/dist/core.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/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +3 -0
- package/dist/node.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/src/api.d.ts +8 -2
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/art.d.ts +4 -3
- package/dist/src/art.d.ts.map +1 -1
- package/dist/src/body-patterns.d.ts +3 -2
- package/dist/src/body-patterns.d.ts.map +1 -1
- package/dist/src/core.d.ts +5 -0
- package/dist/src/core.d.ts.map +1 -0
- package/dist/src/corner-dot.d.ts +3 -2
- package/dist/src/corner-dot.d.ts.map +1 -1
- package/dist/src/engine.d.ts +44 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/export.d.ts +5 -0
- package/dist/src/export.d.ts.map +1 -0
- package/dist/src/frame.d.ts +6 -4
- package/dist/src/frame.d.ts.map +1 -1
- package/dist/src/frames/catalogue/all.d.ts.map +1 -1
- package/dist/src/frames/catalogue/automotive.d.ts +5 -0
- package/dist/src/frames/catalogue/automotive.d.ts.map +1 -0
- package/dist/src/frames/catalogue/beauty-wellness.d.ts +5 -0
- package/dist/src/frames/catalogue/beauty-wellness.d.ts.map +1 -0
- package/dist/src/frames/catalogue/business.d.ts.map +1 -1
- package/dist/src/frames/catalogue/call-to-action.d.ts.map +1 -1
- package/dist/src/frames/catalogue/counts.d.ts +12 -7
- package/dist/src/frames/catalogue/counts.d.ts.map +1 -1
- package/dist/src/frames/catalogue/food-drink.d.ts.map +1 -1
- package/dist/src/frames/catalogue/health-learning.d.ts.map +1 -1
- package/dist/src/frames/catalogue/index.d.ts.map +1 -1
- package/dist/src/frames/catalogue/nonprofit.d.ts +5 -0
- package/dist/src/frames/catalogue/nonprofit.d.ts.map +1 -0
- package/dist/src/frames/catalogue/places.d.ts.map +1 -1
- package/dist/src/frames/catalogue/real-estate.d.ts +5 -0
- package/dist/src/frames/catalogue/real-estate.d.ts.map +1 -0
- package/dist/src/frames/catalogue/shopping.d.ts.map +1 -1
- package/dist/src/frames/catalogue/sports-fitness.d.ts +5 -0
- package/dist/src/frames/catalogue/sports-fitness.d.ts.map +1 -0
- package/dist/src/frames/catalogue/tags.d.ts.map +1 -1
- package/dist/src/frames/collections.d.ts.map +1 -1
- package/dist/src/frames/official-types.d.ts +1 -1
- package/dist/src/frames/official-types.d.ts.map +1 -1
- package/dist/src/index.d.ts +3 -37
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/jsx/index.d.ts +2 -0
- package/dist/src/jsx/index.d.ts.map +1 -0
- package/dist/src/jsx/jsx-dev-runtime.d.ts +5 -0
- package/dist/src/jsx/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/src/jsx/jsx-runtime.d.ts +30 -0
- package/dist/src/jsx/jsx-runtime.d.ts.map +1 -0
- package/dist/src/jsx/runtime.d.ts +73 -0
- package/dist/src/jsx/runtime.d.ts.map +1 -0
- package/dist/src/logo.d.ts +3 -2
- package/dist/src/logo.d.ts.map +1 -1
- package/dist/src/node.d.ts +23 -0
- package/dist/src/node.d.ts.map +1 -0
- package/dist/src/part-markers.d.ts +15 -0
- package/dist/src/part-markers.d.ts.map +1 -0
- package/dist/src/plain.d.ts +31 -0
- package/dist/src/plain.d.ts.map +1 -0
- package/dist/src/qr-code-canvas.d.ts +1 -1
- package/dist/src/qr-code-canvas.d.ts.map +1 -1
- package/dist/src/qr-code-props.d.ts +22 -0
- package/dist/src/qr-code-props.d.ts.map +1 -0
- package/dist/src/qr-code-svg.d.ts +10 -0
- package/dist/src/qr-code-svg.d.ts.map +1 -0
- package/dist/src/qr-code.d.ts +2 -10
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/rasterize.d.ts +25 -0
- package/dist/src/rasterize.d.ts.map +1 -0
- package/dist/src/react-elements.d.ts +3 -0
- package/dist/src/react-elements.d.ts.map +1 -0
- package/dist/src/render/attributes.d.ts +33 -0
- package/dist/src/render/attributes.d.ts.map +1 -0
- package/dist/src/render/dom.d.ts +8 -0
- package/dist/src/render/dom.d.ts.map +1 -0
- package/dist/src/render/hyperscript.d.ts +10 -0
- package/dist/src/render/hyperscript.d.ts.map +1 -0
- package/dist/src/render/string.d.ts +8 -0
- package/dist/src/render/string.d.ts.map +1 -0
- package/dist/src/svg.d.ts +14 -0
- package/dist/src/svg.d.ts.map +1 -0
- package/dist/src/template/arrow.d.ts +1 -0
- package/dist/src/template/arrow.d.ts.map +1 -1
- package/dist/src/template/default.d.ts +1 -0
- package/dist/src/template/default.d.ts.map +1 -1
- package/dist/src/template/halloween.d.ts +1 -0
- package/dist/src/template/halloween.d.ts.map +1 -1
- package/dist/src/template/square-border.d.ts +1 -0
- package/dist/src/template/square-border.d.ts.map +1 -1
- package/dist/src/template/standard-box.d.ts +1 -0
- package/dist/src/template/standard-box.d.ts.map +1 -1
- package/dist/src/template/striked-box.d.ts +1 -0
- package/dist/src/template/striked-box.d.ts.map +1 -1
- package/dist/src/utils.d.ts +9 -3
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/vanilla-api.d.ts +47 -0
- package/dist/src/vanilla-api.d.ts.map +1 -0
- package/dist/src/vanilla-browser.d.ts +4 -0
- package/dist/src/vanilla-browser.d.ts.map +1 -0
- package/dist/src/vanilla.d.ts +4 -0
- package/dist/src/vanilla.d.ts.map +1 -0
- package/dist/src/vue.d.ts +56 -0
- package/dist/src/vue.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -2
- package/dist/types/index.mjs +2 -2
- package/dist/types/public.d.ts +3 -0
- package/dist/types/public.d.ts.map +1 -0
- package/dist/types/qr.d.ts +18 -4
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/react.d.ts +5 -0
- package/dist/types/react.d.ts.map +1 -0
- package/dist/types/template.d.ts +7 -1
- package/dist/types/template.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +92 -0
- package/dist/vanilla.browser.mjs.map +1 -0
- package/dist/vanilla.js +2 -0
- package/dist/vanilla.js.map +1 -0
- package/dist/vanilla.mjs +2 -0
- package/dist/vanilla.mjs.map +1 -0
- package/dist/vue.js +2 -0
- package/dist/vue.js.map +1 -0
- package/dist/vue.mjs +2 -0
- package/dist/vue.mjs.map +1 -0
- package/package.json +71 -6
- package/src/api.tsx +16 -139
- package/src/art.tsx +18 -16
- package/src/body-patterns.tsx +5 -3
- package/src/core.ts +13 -0
- package/src/corner-dot.tsx +4 -2
- package/src/download.tsx +1 -1
- package/src/engine.ts +170 -0
- package/src/export.ts +212 -0
- package/src/frame.tsx +7 -6
- package/src/frames/catalogue/all.ts +606 -0
- package/src/frames/catalogue/automotive.ts +61 -0
- package/src/frames/catalogue/beauty-wellness.ts +61 -0
- package/src/frames/catalogue/business.ts +68 -0
- package/src/frames/catalogue/call-to-action.ts +60 -0
- package/src/frames/catalogue/counts.ts +12 -7
- package/src/frames/catalogue/food-drink.ts +78 -0
- package/src/frames/catalogue/health-learning.ts +62 -14
- package/src/frames/catalogue/index.ts +2440 -16
- package/src/frames/catalogue/nonprofit.ts +65 -0
- package/src/frames/catalogue/places.ts +0 -18
- package/src/frames/catalogue/real-estate.ts +79 -0
- package/src/frames/catalogue/shopping.ts +68 -0
- package/src/frames/catalogue/sports-fitness.ts +81 -0
- package/src/frames/catalogue/tags.ts +354 -0
- package/src/frames/collections.ts +5 -0
- package/src/frames/official/add-engraving.json +90 -0
- package/src/frames/official/add-to-calendar.json +98 -0
- package/src/frames/official/adopt-me.json +72 -0
- package/src/frames/official/aftercare-guide.json +98 -0
- package/src/frames/official/alterations.json +142 -0
- package/src/frames/official/annual-report.json +85 -0
- package/src/frames/official/archery-lesson.json +106 -0
- package/src/frames/official/arrival-guide.json +71 -0
- package/src/frames/official/art-class.json +137 -0
- package/src/frames/official/ask-a-stylist.json +112 -0
- package/src/frames/official/assembly-guide.json +93 -0
- package/src/frames/official/badminton-session.json +104 -0
- package/src/frames/official/bake-sale.json +158 -0
- package/src/frames/official/bakery-board.json +80 -0
- package/src/frames/official/barber-booking.json +64 -0
- package/src/frames/official/bath-ritual.json +70 -0
- package/src/frames/official/bathroom-showroom.json +113 -0
- package/src/frames/official/battery-check.json +95 -0
- package/src/frames/official/beauty-rewards.json +81 -0
- package/src/frames/official/become-a-member.json +79 -0
- package/src/frames/official/bike-service.json +113 -0
- package/src/frames/official/book-a-call.json +105 -0
- package/src/frames/official/book-a-cleaning.json +92 -0
- package/src/frames/official/book-a-consultation.json +101 -0
- package/src/frames/official/book-a-court.json +74 -0
- package/src/frames/official/book-a-facial.json +108 -0
- package/src/frames/official/book-a-massage.json +80 -0
- package/src/frames/official/book-a-vaccine.json +88 -0
- package/src/frames/official/book-this-room.json +80 -0
- package/src/frames/official/boxing-class.json +81 -0
- package/src/frames/official/brewery-tour.json +89 -0
- package/src/frames/official/bridal-beauty.json +80 -0
- package/src/frames/official/brunch-menu.json +79 -0
- package/src/frames/official/bubble-tea.json +81 -0
- package/src/frames/official/bulk-orders.json +108 -0
- package/src/frames/official/burger-order.json +80 -0
- package/src/frames/official/call-a-server.json +115 -0
- package/src/frames/official/car-detailing.json +102 -0
- package/src/frames/official/car-details.json +90 -0
- package/src/frames/official/car-for-sale.json +74 -0
- package/src/frames/official/car-service.json +92 -0
- package/src/frames/official/carpool.json +79 -0
- package/src/frames/official/catering-order.json +79 -0
- package/src/frames/official/charging-prices.json +105 -0
- package/src/frames/official/charity-shop.json +75 -0
- package/src/frames/official/check-symptoms.json +80 -0
- package/src/frames/official/cheese-pairing.json +91 -0
- package/src/frames/official/chess-club.json +64 -0
- package/src/frames/official/chess-lessons.json +83 -0
- package/src/frames/official/choose-your-plan.json +113 -0
- package/src/frames/official/choose-your-wash.json +86 -0
- package/src/frames/official/clean-beauty.json +94 -0
- package/src/frames/official/click-and-collect.json +85 -0
- package/src/frames/official/clock-in.json +101 -0
- package/src/frames/official/club-fees.json +94 -0
- package/src/frames/official/coach-sign-up.json +108 -0
- package/src/frames/official/community-notices.json +107 -0
- package/src/frames/official/compare-specs.json +112 -0
- package/src/frames/official/consultation-form.json +120 -0
- package/src/frames/official/continued-online.json +81 -0
- package/src/frames/official/cookie-box.json +88 -0
- package/src/frames/official/cooking-class.json +89 -0
- package/src/frames/official/coworking-pass.json +89 -0
- package/src/frames/official/cricket-club.json +158 -0
- package/src/frames/official/cupcake-order.json +108 -0
- package/src/frames/official/damage-report.json +114 -0
- package/src/frames/official/dashboard-lights.json +106 -0
- package/src/frames/official/delivery-instructions.json +98 -0
- package/src/frames/official/diy-how-to.json +87 -0
- package/src/frames/official/donate-coats.json +74 -0
- package/src/frames/official/donate-food.json +80 -0
- package/src/frames/official/donation-jar.json +101 -0
- package/src/frames/official/donut-shop.json +94 -0
- package/src/frames/official/dress-fitting.json +64 -0
- package/src/frames/official/driving-lessons.json +110 -0
- package/src/frames/official/dumpling-house.json +82 -0
- package/src/frames/official/eye-exam.json +70 -0
- package/src/frames/official/eyewear-try-on.json +99 -0
- package/src/frames/official/fan-club.json +152 -0
- package/src/frames/official/farm-stand.json +109 -0
- package/src/frames/official/farmers-market.json +74 -0
- package/src/frames/official/find-a-charger.json +107 -0
- package/src/frames/official/find-a-doctor.json +85 -0
- package/src/frames/official/find-it-in-store.json +101 -0
- package/src/frames/official/find-our-office.json +80 -0
- package/src/frames/official/first-aid-guide.json +109 -0
- package/src/frames/official/fish-market.json +113 -0
- package/src/frames/official/fitness-challenge.json +1 -1
- package/src/frames/official/fitness-equipment.json +1 -1
- package/src/frames/official/fitness-kettlebell.json +1 -1
- package/src/frames/official/fitness-schedule.json +1 -1
- package/src/frames/official/fitness-test.json +94 -0
- package/src/frames/official/fitness-timer.json +1 -1
- package/src/frames/official/fitness-trial.json +1 -1
- package/src/frames/official/fitness-yoga.json +1 -1
- package/src/frames/official/food-support.json +102 -0
- package/src/frames/official/food-truck-location.json +80 -0
- package/src/frames/official/furnished-rental.json +101 -0
- package/src/frames/official/game-night.json +79 -0
- package/src/frames/official/garden-design.json +70 -0
- package/src/frames/official/garden-plot.json +74 -0
- package/src/frames/official/get-a-quote.json +113 -0
- package/src/frames/official/get-it-delivered.json +82 -0
- package/src/frames/official/get-started-rocket.json +80 -0
- package/src/frames/official/get-the-brochure.json +116 -0
- package/src/frames/official/gift-ideas.json +86 -0
- package/src/frames/official/gift-message.json +85 -0
- package/src/frames/official/give-blood.json +88 -0
- package/src/frames/official/giving-jar.json +89 -0
- package/src/frames/official/golf-scorecard.json +120 -0
- package/src/frames/official/grand-opening.json +158 -0
- package/src/frames/official/grill-menu.json +92 -0
- package/src/frames/official/hand-washing.json +106 -0
- package/src/frames/official/handyman.json +130 -0
- package/src/frames/official/hear-it-spoken.json +86 -0
- package/src/frames/official/home-valuation.json +87 -0
- package/src/frames/official/homework-help.json +79 -0
- package/src/frames/official/hot-shave.json +121 -0
- package/src/frames/official/house-rules.json +121 -0
- package/src/frames/official/how-it-works.json +98 -0
- package/src/frames/official/how-to-apply.json +93 -0
- package/src/frames/official/impact-report.json +90 -0
- package/src/frames/official/intake-forms.json +114 -0
- package/src/frames/official/join-a-league.json +94 -0
- package/src/frames/official/join-the-cleanup.json +110 -0
- package/src/frames/official/join-the-waitlist.json +102 -0
- package/src/frames/official/join-the-webinar.json +108 -0
- package/src/frames/official/juice-bar.json +70 -0
- package/src/frames/official/kids-haircuts.json +75 -0
- package/src/frames/official/kids-menu.json +107 -0
- package/src/frames/official/large-print.json +80 -0
- package/src/frames/official/lash-bar.json +86 -0
- package/src/frames/official/last-chance.json +94 -0
- package/src/frames/official/late-night-menu.json +77 -0
- package/src/frames/official/learn-the-signs.json +107 -0
- package/src/frames/official/library-card.json +90 -0
- package/src/frames/official/live-scores.json +101 -0
- package/src/frames/official/lost-and-found.json +85 -0
- package/src/frames/official/lost-pet-tag.json +84 -0
- package/src/frames/official/make-a-claim.json +74 -0
- package/src/frames/official/makeup-artist.json +94 -0
- package/src/frames/official/math-practice.json +136 -0
- package/src/frames/official/meal-plan.json +121 -0
- package/src/frames/official/meet-the-maker.json +91 -0
- package/src/frames/official/meet-the-team.json +82 -0
- package/src/frames/official/membership-card.json +108 -0
- package/src/frames/official/mortgage-calculator.json +94 -0
- package/src/frames/official/moving-checklist.json +108 -0
- package/src/frames/official/music-lessons.json +64 -0
- package/src/frames/official/nail-studio.json +70 -0
- package/src/frames/official/neighborhood-guide.json +98 -0
- package/src/frames/official/nutrition-facts.json +98 -0
- package/src/frames/official/online-class.json +82 -0
- package/src/frames/official/open-an-account.json +88 -0
- package/src/frames/official/open-house-sign-in.json +104 -0
- package/src/frames/official/parcel-room.json +98 -0
- package/src/frames/official/parent-meeting.json +108 -0
- package/src/frames/official/parking-permit.json +74 -0
- package/src/frames/official/pay-at-the-pump.json +108 -0
- package/src/frames/official/pay-for-parking.json +89 -0
- package/src/frames/official/pay-it-forward.json +102 -0
- package/src/frames/official/pay-your-rent.json +105 -0
- package/src/frames/official/permission-form.json +120 -0
- package/src/frames/official/personal-trainer.json +76 -0
- package/src/frames/official/physio-exercises.json +86 -0
- package/src/frames/official/pick-your-own.json +158 -0
- package/src/frames/official/plant-a-tree.json +88 -0
- package/src/frames/official/plant-based-menu.json +103 -0
- package/src/frames/official/plant-care.json +84 -0
- package/src/frames/official/podcast.json +107 -0
- package/src/frames/official/polling-place.json +109 -0
- package/src/frames/official/pool-timetable.json +113 -0
- package/src/frames/official/portfolio-card.json +110 -0
- package/src/frames/official/pre-order-bread.json +110 -0
- package/src/frames/official/press-kit.json +136 -0
- package/src/frames/official/price-list.json +111 -0
- package/src/frames/official/privacy-notice.json +115 -0
- package/src/frames/official/property-floor-plan.json +1 -1
- package/src/frames/official/property-for-sale.json +1 -1
- package/src/frames/official/property-house-light.json +1 -1
- package/src/frames/official/property-house.json +1 -1
- package/src/frames/official/property-key.json +1 -1
- package/src/frames/official/property-open-house.json +1 -1
- package/src/frames/official/property-rent.json +1 -1
- package/src/frames/official/property-virtual-tour.json +1 -1
- package/src/frames/official/questions-cloud.json +65 -0
- package/src/frames/official/race-entry.json +90 -0
- package/src/frames/official/race-photos.json +93 -0
- package/src/frames/official/rate-your-ride.json +103 -0
- package/src/frames/official/read-a-sample.json +108 -0
- package/src/frames/official/read-the-ebook.json +116 -0
- package/src/frames/official/read-the-faq.json +88 -0
- package/src/frames/official/read-the-reviews.json +110 -0
- package/src/frames/official/read-the-story.json +90 -0
- package/src/frames/official/read-the-transcript.json +142 -0
- package/src/frames/official/reading-challenge.json +97 -0
- package/src/frames/official/rebook-visit.json +86 -0
- package/src/frames/official/recipe-card.json +120 -0
- package/src/frames/official/refill-reminder.json +104 -0
- package/src/frames/official/register-interest.json +82 -0
- package/src/frames/official/register-to-vote.json +80 -0
- package/src/frames/official/renovation-quote.json +80 -0
- package/src/frames/official/rent-a-bike.json +95 -0
- package/src/frames/official/rent-this-item.json +95 -0
- package/src/frames/official/rental-car-guide.json +115 -0
- package/src/frames/official/report-a-problem.json +114 -0
- package/src/frames/official/report-a-repair.json +79 -0
- package/src/frames/official/report-a-street-issue.json +113 -0
- package/src/frames/official/request-maintenance.json +74 -0
- package/src/frames/official/resident-portal.json +98 -0
- package/src/frames/official/restaurant-gift-card.json +94 -0
- package/src/frames/official/restock-alert.json +98 -0
- package/src/frames/official/restroom-feedback.json +86 -0
- package/src/frames/official/return-your-cup.json +130 -0
- package/src/frames/official/return-your-rental.json +113 -0
- package/src/frames/official/ring-size.json +107 -0
- package/src/frames/official/roadside-help.json +92 -0
- package/src/frames/official/run-club.json +79 -0
- package/src/frames/official/safety-information.json +92 -0
- package/src/frames/official/salon-prices.json +92 -0
- package/src/frames/official/save-for-later.json +79 -0
- package/src/frames/official/scan-for-the-answer.json +86 -0
- package/src/frames/official/scan-for-the-checklist.json +108 -0
- package/src/frames/official/scan-for-the-latest.json +74 -0
- package/src/frames/official/scan-for-translations.json +108 -0
- package/src/frames/official/scan-here-arrow.json +76 -0
- package/src/frames/official/scan-here-post.json +89 -0
- package/src/frames/official/scan-me-banner.json +147 -0
- package/src/frames/official/scan-me-cloud.json +73 -0
- package/src/frames/official/scan-me-folded.json +74 -0
- package/src/frames/official/scan-me-stack.json +93 -0
- package/src/frames/official/scan-to-unlock.json +107 -0
- package/src/frames/official/scent-finder.json +94 -0
- package/src/frames/official/scholarships.json +108 -0
- package/src/frames/official/school-supply-list.json +80 -0
- package/src/frames/official/science-fair.json +89 -0
- package/src/frames/official/season-schedule.json +66 -0
- package/src/frames/official/see-more-stack.json +91 -0
- package/src/frames/official/see-our-pitch.json +85 -0
- package/src/frames/official/see-the-full-list.json +107 -0
- package/src/frames/official/see-the-map.json +79 -0
- package/src/frames/official/send-flowers.json +93 -0
- package/src/frames/official/service-times.json +115 -0
- package/src/frames/official/shade-finder.json +113 -0
- package/src/frames/official/shoe-size-check.json +95 -0
- package/src/frames/official/sign-rider.json +1 -1
- package/src/frames/official/sign-the-agreement.json +120 -0
- package/src/frames/official/sign-the-petition.json +120 -0
- package/src/frames/official/site-hoarding.json +158 -0
- package/src/frames/official/site-induction.json +120 -0
- package/src/frames/official/size-guide.json +80 -0
- package/src/frames/official/skate-park-rules.json +109 -0
- package/src/frames/official/skincare-routine.json +85 -0
- package/src/frames/official/sofa-fabric.json +84 -0
- package/src/frames/official/spa-gift.json +90 -0
- package/src/frames/official/spa-menu.json +124 -0
- package/src/frames/official/split-the-bill.json +77 -0
- package/src/frames/official/sponsor-a-pet.json +102 -0
- package/src/frames/official/sponsor-my-run.json +136 -0
- package/src/frames/official/sports-camp.json +142 -0
- package/src/frames/official/staff-handbook.json +121 -0
- package/src/frames/official/staff-rota.json +112 -0
- package/src/frames/official/start-a-return.json +92 -0
- package/src/frames/official/start-charging.json +104 -0
- package/src/frames/official/start-here-arrow.json +79 -0
- package/src/frames/official/start-saving.json +74 -0
- package/src/frames/official/storage-units.json +79 -0
- package/src/frames/official/student-portal.json +80 -0
- package/src/frames/official/style-gallery.json +111 -0
- package/src/frames/official/sushi-menu.json +115 -0
- package/src/frames/official/swim-lessons.json +70 -0
- package/src/frames/official/table-tennis.json +116 -0
- package/src/frames/official/take-a-closer-look.json +94 -0
- package/src/frames/official/takeout-order.json +98 -0
- package/src/frames/official/talk-to-someone.json +115 -0
- package/src/frames/official/talk-to-the-agent.json +115 -0
- package/src/frames/official/tea-menu.json +70 -0
- package/src/frames/official/tea-time.json +124 -0
- package/src/frames/official/team-jersey.json +77 -0
- package/src/frames/official/team-kit.json +85 -0
- package/src/frames/official/tee-time.json +85 -0
- package/src/frames/official/tennis-court.json +94 -0
- package/src/frames/official/test-drive.json +88 -0
- package/src/frames/official/test-results.json +85 -0
- package/src/frames/official/tire-change.json +74 -0
- package/src/frames/official/town-hall.json +158 -0
- package/src/frames/official/toy-finder.json +81 -0
- package/src/frames/official/trace-your-coffee.json +87 -0
- package/src/frames/official/trade-it-in.json +97 -0
- package/src/frames/official/try-the-demo.json +106 -0
- package/src/frames/official/unlock-this-car.json +82 -0
- package/src/frames/official/upload-receipts.json +108 -0
- package/src/frames/official/validate-parking.json +91 -0
- package/src/frames/official/vehicle-history.json +106 -0
- package/src/frames/official/virtual-try-on.json +93 -0
- package/src/frames/official/visiting-hours.json +90 -0
- package/src/frames/official/visitor-map.json +92 -0
- package/src/frames/official/visitor-sign-in.json +98 -0
- package/src/frames/official/volunteer.json +74 -0
- package/src/frames/official/vote-for-us.json +103 -0
- package/src/frames/official/walk-in-queue.json +102 -0
- package/src/frames/official/wash-club.json +81 -0
- package/src/frames/official/watch-repair.json +115 -0
- package/src/frames/official/watch-the-experiment.json +93 -0
- package/src/frames/official/water-refill.json +95 -0
- package/src/frames/official/weekly-deals.json +107 -0
- package/src/frames/official/wellness-retreat.json +85 -0
- package/src/frames/official/whats-inside.json +91 -0
- package/src/frames/official/wholesale.json +85 -0
- package/src/frames/official/window-quote.json +121 -0
- package/src/frames/official/wine-pairings.json +142 -0
- package/src/frames/official/wine-staff-pick.json +100 -0
- package/src/frames/official/winery-tasting.json +94 -0
- package/src/frames/official/yard-sign-coming-soon.json +115 -0
- package/src/frames/official/yard-sign-for-sale.json +150 -0
- package/src/frames/official/yard-sign-sold.json +162 -0
- package/src/frames/official/yard-sign-viewing.json +121 -0
- package/src/frames/official/your-prescription.json +107 -0
- package/src/frames/official/youth-club.json +104 -0
- package/src/frames/official-types.ts +6 -1
- package/src/frames/official.ts +4 -4
- package/src/index.tsx +6 -352
- package/src/jsx/index.ts +3 -0
- package/src/jsx/jsx-dev-runtime.ts +14 -0
- package/src/jsx/jsx-runtime.ts +34 -0
- package/src/jsx/runtime.ts +209 -0
- package/src/logo.tsx +5 -3
- package/src/node.ts +61 -0
- package/src/part-markers.ts +40 -0
- package/src/plain.tsx +194 -0
- package/src/qr-code-canvas.tsx +2 -1
- package/src/qr-code-props.ts +115 -0
- package/src/qr-code-svg.tsx +17 -0
- package/src/qr-code.tsx +34 -112
- package/src/rasterize.ts +282 -0
- package/src/react-elements.ts +13 -0
- package/src/render/attributes.ts +404 -0
- package/src/render/dom.ts +90 -0
- package/src/render/hyperscript.ts +66 -0
- package/src/render/string.ts +70 -0
- package/src/scan-score.ts +1 -1
- package/src/svg.ts +27 -0
- package/src/template/arrow.tsx +1 -0
- package/src/template/default.tsx +1 -0
- package/src/template/halloween.tsx +1 -0
- package/src/template/square-border.tsx +1 -0
- package/src/template/standard-box.tsx +1 -0
- package/src/template/striked-box.tsx +1 -0
- package/src/utils/print-shared.ts +1 -1
- package/src/utils.tsx +82 -38
- package/src/vanilla-api.ts +146 -0
- package/src/vanilla-browser.ts +11 -0
- package/src/vanilla.ts +10 -0
- package/src/vue.ts +220 -0
- package/types/index.ts +4 -2
- package/types/public.ts +4 -0
- package/types/qr.ts +24 -5
- package/types/react.ts +8 -0
- package/types/template.ts +10 -3
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { isFragment, isQRNode, type QRChild } from "../jsx/runtime";
|
|
2
|
+
import { toAttribute, VALID_TAG } from "./attributes";
|
|
3
|
+
|
|
4
|
+
const SVG_NS = "http://www.w3.org/2000/svg";
|
|
5
|
+
const HTML_NS = "http://www.w3.org/1999/xhtml";
|
|
6
|
+
const XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
7
|
+
const XML_NS = "http://www.w3.org/XML/1998/namespace";
|
|
8
|
+
const XMLNS_NS = "http://www.w3.org/2000/xmlns/";
|
|
9
|
+
|
|
10
|
+
function setAttribute(element: Element, name: string, value: string) {
|
|
11
|
+
if (name === "xmlns" || name.startsWith("xmlns:")) {
|
|
12
|
+
element.setAttributeNS(XMLNS_NS, name, value);
|
|
13
|
+
} else if (name.startsWith("xlink:")) {
|
|
14
|
+
element.setAttributeNS(XLINK_NS, name, value);
|
|
15
|
+
} else if (name.startsWith("xml:")) {
|
|
16
|
+
element.setAttributeNS(XML_NS, name, value);
|
|
17
|
+
} else {
|
|
18
|
+
element.setAttribute(name, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function append(
|
|
23
|
+
parent: Node,
|
|
24
|
+
node: QRChild,
|
|
25
|
+
namespace: string,
|
|
26
|
+
doc: Document
|
|
27
|
+
): void {
|
|
28
|
+
if (node === null || node === undefined || typeof node === "boolean") {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (
|
|
32
|
+
typeof node === "string" ||
|
|
33
|
+
typeof node === "number" ||
|
|
34
|
+
typeof node === "bigint"
|
|
35
|
+
) {
|
|
36
|
+
parent.appendChild(doc.createTextNode(`${node}`));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(node)) {
|
|
40
|
+
for (const child of node) {
|
|
41
|
+
append(parent, child, namespace, doc);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (!isQRNode(node)) {
|
|
46
|
+
throw new TypeError("qrdx: can't render this value as DOM nodes");
|
|
47
|
+
}
|
|
48
|
+
const { type, props } = node;
|
|
49
|
+
if (isFragment(type)) {
|
|
50
|
+
append(parent, props.children, namespace, doc);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
if (typeof type === "function") {
|
|
54
|
+
append(parent, type(props), namespace, doc);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (!VALID_TAG.test(type)) {
|
|
58
|
+
throw new TypeError(`qrdx: invalid element name: ${type}`);
|
|
59
|
+
}
|
|
60
|
+
const ns = type === "svg" ? SVG_NS : namespace;
|
|
61
|
+
const element = doc.createElementNS(ns, type);
|
|
62
|
+
for (const prop of Object.keys(props)) {
|
|
63
|
+
const attribute = toAttribute(prop, props[prop]);
|
|
64
|
+
if (attribute) {
|
|
65
|
+
setAttribute(element, attribute.name, attribute.value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// foreignObject holds HTML again
|
|
69
|
+
append(
|
|
70
|
+
element,
|
|
71
|
+
props.children,
|
|
72
|
+
ns === SVG_NS && type === "foreignObject" ? HTML_NS : ns,
|
|
73
|
+
doc
|
|
74
|
+
);
|
|
75
|
+
parent.appendChild(element);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* DOM nodes for a tree: the elements and attributes `renderToString` writes,
|
|
80
|
+
* built with `createElementNS` (no HTML is parsed, so it works under a
|
|
81
|
+
* Trusted Types policy).
|
|
82
|
+
*/
|
|
83
|
+
export function renderToDOM(
|
|
84
|
+
node: QRChild,
|
|
85
|
+
doc: Document = document
|
|
86
|
+
): DocumentFragment {
|
|
87
|
+
const fragment = doc.createDocumentFragment();
|
|
88
|
+
append(fragment, node, HTML_NS, doc);
|
|
89
|
+
return fragment;
|
|
90
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { isFragment, isQRNode } from "../jsx/runtime";
|
|
2
|
+
import { toAttribute } from "./attributes";
|
|
3
|
+
|
|
4
|
+
/** A framework's element factory, called with DOM attribute names. */
|
|
5
|
+
export type CreateElement<T> = (
|
|
6
|
+
type: string,
|
|
7
|
+
attributes: Record<string, string>,
|
|
8
|
+
children: (T | string)[],
|
|
9
|
+
key: string | null
|
|
10
|
+
) => T;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A tree as another framework's elements (Vue's `h`, Preact's `h`…):
|
|
14
|
+
* fragments flattened, components called, attributes named and valued as
|
|
15
|
+
* `renderToString` writes them (`fill-rule`, `class`, CSS text), so every
|
|
16
|
+
* framework draws the same SVG.
|
|
17
|
+
*/
|
|
18
|
+
export function toHyperscript<T>(
|
|
19
|
+
node: unknown,
|
|
20
|
+
create: CreateElement<T>
|
|
21
|
+
): (T | string)[] {
|
|
22
|
+
const out: (T | string)[] = [];
|
|
23
|
+
const visit = (child: unknown) => {
|
|
24
|
+
if (child === null || child === undefined || typeof child === "boolean") {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (
|
|
28
|
+
typeof child === "string" ||
|
|
29
|
+
typeof child === "number" ||
|
|
30
|
+
typeof child === "bigint"
|
|
31
|
+
) {
|
|
32
|
+
out.push(`${child}`);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(child)) {
|
|
36
|
+
for (const item of child) {
|
|
37
|
+
visit(item);
|
|
38
|
+
}
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!isQRNode(child)) {
|
|
42
|
+
throw new TypeError("qrdx: can't render this value");
|
|
43
|
+
}
|
|
44
|
+
const { type, props, key } = child;
|
|
45
|
+
if (isFragment(type)) {
|
|
46
|
+
visit(props.children);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (typeof type === "function") {
|
|
50
|
+
visit(type(props));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const attributes: Record<string, string> = {};
|
|
54
|
+
for (const prop of Object.keys(props)) {
|
|
55
|
+
const attribute = toAttribute(prop, props[prop]);
|
|
56
|
+
if (attribute) {
|
|
57
|
+
attributes[attribute.name] = attribute.value;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
out.push(
|
|
61
|
+
create(type, attributes, toHyperscript(props.children, create), key)
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
visit(node);
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isFragment,
|
|
3
|
+
isQRNode,
|
|
4
|
+
type QRChild,
|
|
5
|
+
type QRNode,
|
|
6
|
+
} from "../jsx/runtime";
|
|
7
|
+
import {
|
|
8
|
+
escapeText,
|
|
9
|
+
toAttribute,
|
|
10
|
+
VALID_TAG,
|
|
11
|
+
VOID_ELEMENTS,
|
|
12
|
+
} from "./attributes";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Markup of a tree: byte for byte what React's `renderToStaticMarkup` writes
|
|
16
|
+
* for the same elements (see attributes.ts), with no React. React elements
|
|
17
|
+
* in the tree (a custom template written for React) are drawn the same way.
|
|
18
|
+
*/
|
|
19
|
+
export function renderToString(node: QRChild): string {
|
|
20
|
+
if (node === null || node === undefined || typeof node === "boolean") {
|
|
21
|
+
return "";
|
|
22
|
+
}
|
|
23
|
+
if (typeof node === "string") {
|
|
24
|
+
return escapeText(node);
|
|
25
|
+
}
|
|
26
|
+
if (typeof node === "number" || typeof node === "bigint") {
|
|
27
|
+
return `${node}`;
|
|
28
|
+
}
|
|
29
|
+
if (Array.isArray(node)) {
|
|
30
|
+
let out = "";
|
|
31
|
+
for (const child of node) {
|
|
32
|
+
out += renderToString(child);
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
if (!isQRNode(node)) {
|
|
37
|
+
throw new TypeError("qrdx: can't render this value as SVG markup");
|
|
38
|
+
}
|
|
39
|
+
return renderElement(node);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function renderElement(node: QRNode): string {
|
|
43
|
+
const { type, props } = node;
|
|
44
|
+
if (isFragment(type)) {
|
|
45
|
+
return renderToString(props.children);
|
|
46
|
+
}
|
|
47
|
+
if (typeof type === "function") {
|
|
48
|
+
return renderToString(type(props));
|
|
49
|
+
}
|
|
50
|
+
if (!VALID_TAG.test(type)) {
|
|
51
|
+
throw new TypeError(`qrdx: invalid element name: ${type}`);
|
|
52
|
+
}
|
|
53
|
+
let out = `<${type}`;
|
|
54
|
+
for (const prop of Object.keys(props)) {
|
|
55
|
+
const attribute = toAttribute(prop, props[prop]);
|
|
56
|
+
if (attribute) {
|
|
57
|
+
out += ` ${attribute.name}="${escapeText(attribute.value)}"`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (VOID_ELEMENTS.has(type)) {
|
|
61
|
+
return `${out}/>`;
|
|
62
|
+
}
|
|
63
|
+
const html = (props.dangerouslySetInnerHTML as { __html?: unknown } | null)
|
|
64
|
+
?.__html;
|
|
65
|
+
const inner =
|
|
66
|
+
html === null || html === undefined
|
|
67
|
+
? renderToString(props.children)
|
|
68
|
+
: `${html}`;
|
|
69
|
+
return `${out}>${inner}</${type}>`;
|
|
70
|
+
}
|
package/src/scan-score.ts
CHANGED
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
} from "./constants";
|
|
15
15
|
import { handleImageLoad } from "./detection";
|
|
16
16
|
import { withQRSize } from "./download";
|
|
17
|
+
import { getQRAsSVGDataUri } from "./export";
|
|
17
18
|
import { getFrameDimensions, getFrameGapRatio, isFrameActive } from "./frame";
|
|
18
|
-
import { getQRAsSVGDataUri } from "./index";
|
|
19
19
|
import { getLogoBlockDamage } from "./logo-budget";
|
|
20
20
|
import { circleQuietZone, getLayoutMargin, isShapedCode } from "./qr-shape";
|
|
21
21
|
import { getStylePairRisk } from "./scan-risk";
|
package/src/svg.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// The code as SVG markup or a DOM element, drawn without a framework.
|
|
2
|
+
import type { QRSVGOptions } from "../types";
|
|
3
|
+
import { renderToDOM } from "./render/dom";
|
|
4
|
+
import { renderToString } from "./render/string";
|
|
5
|
+
import { createQRCodeTree } from "./utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The code's SVG markup: byte for byte what `<QRCodeSVG {...props} />`
|
|
9
|
+
* renders with React (attributes forwarded to the root `<svg>`, and to the
|
|
10
|
+
* frame's outer `<svg>` when there is a frame). Works anywhere, server or
|
|
11
|
+
* browser.
|
|
12
|
+
*/
|
|
13
|
+
export function toSVGString(props: QRSVGOptions): string {
|
|
14
|
+
return renderToString(createQRCodeTree(props));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The code as an `<svg>` element, built with `createElementNS` (no HTML is
|
|
19
|
+
* parsed). Pass `doc` to build it in another document.
|
|
20
|
+
*/
|
|
21
|
+
export function toSVGElement(
|
|
22
|
+
props: QRSVGOptions,
|
|
23
|
+
doc: Document = document
|
|
24
|
+
): SVGSVGElement {
|
|
25
|
+
const fragment = renderToDOM(createQRCodeTree(props), doc);
|
|
26
|
+
return fragment.firstChild as SVGSVGElement;
|
|
27
|
+
}
|
package/src/template/arrow.tsx
CHANGED
package/src/template/default.tsx
CHANGED
|
@@ -2,8 +2,8 @@ import type { QRProps } from "../../types";
|
|
|
2
2
|
import { isGradient } from "../../types/color";
|
|
3
3
|
import { DEFAULT_BGCOLOR, DEFAULT_SIZE } from "../constants";
|
|
4
4
|
import { withQRSize } from "../download";
|
|
5
|
+
import { getQRAsSVGDataUri } from "../export";
|
|
5
6
|
import { getFrameLayout, isFrameActive } from "../frame";
|
|
6
|
-
import { getQRAsSVGDataUri } from "../index";
|
|
7
7
|
import { getSolidColor } from "./color";
|
|
8
8
|
import { flattenOver } from "./paint";
|
|
9
9
|
import { parseColor } from "./parse-color";
|
package/src/utils.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import React from "react";
|
|
1
|
+
/** @jsxImportSource ./jsx */
|
|
3
2
|
import type {
|
|
4
3
|
AngularGradient,
|
|
5
4
|
BodyPattern,
|
|
@@ -11,7 +10,7 @@ import type {
|
|
|
11
10
|
ImageSettings,
|
|
12
11
|
LinearGradient,
|
|
13
12
|
Modules,
|
|
14
|
-
|
|
13
|
+
QRSVGOptions,
|
|
15
14
|
RadialGradient,
|
|
16
15
|
TemplateConfig,
|
|
17
16
|
} from "../types";
|
|
@@ -41,8 +40,10 @@ import {
|
|
|
41
40
|
import { generateCornerDotPath } from "./corner-dot";
|
|
42
41
|
import { generateCornerSquarePath } from "./corner-eye";
|
|
43
42
|
import { isFrameActive, wrapWithFrame } from "./frame";
|
|
43
|
+
import { cloneElement, type QRNode } from "./jsx/runtime";
|
|
44
44
|
import { LOGO_PLATE_INSET, LOGO_ROUNDED_RADIUS, renderLogo } from "./logo";
|
|
45
45
|
import { capImageSettings } from "./logo-budget";
|
|
46
|
+
import { partMarker, type QRPart, type QRPartEye } from "./part-markers";
|
|
46
47
|
import { getLayoutMargin, shapeBackground, shapeDecoration } from "./qr-shape";
|
|
47
48
|
import { hashString } from "./shapes";
|
|
48
49
|
import { getTemplate } from "./templates";
|
|
@@ -147,7 +148,7 @@ function generateDataCircles(
|
|
|
147
148
|
/** Decorative modules (a circle code's ring): no finders or alignment */
|
|
148
149
|
plain?: boolean;
|
|
149
150
|
}
|
|
150
|
-
):
|
|
151
|
+
): QRNode[] {
|
|
151
152
|
const { margin, pixelSize, pattern = "circle", plain = false } = options;
|
|
152
153
|
if (isShapedBodyPattern(pattern)) {
|
|
153
154
|
return renderShapedBody(modules, {
|
|
@@ -159,7 +160,7 @@ function generateDataCircles(
|
|
|
159
160
|
});
|
|
160
161
|
}
|
|
161
162
|
const scale = clampModuleScale(options.scale, pattern);
|
|
162
|
-
const shapes:
|
|
163
|
+
const shapes: QRNode[] = [];
|
|
163
164
|
const qrSize = modules.length;
|
|
164
165
|
const radius = pixelSize * 0.45; // radius for circles (≥0.45 needed for reliable scanning)
|
|
165
166
|
const isAlignmentModule = plain ? () => false : alignmentMask(qrSize);
|
|
@@ -349,7 +350,7 @@ function generateDataCircles(
|
|
|
349
350
|
|
|
350
351
|
// A smaller moduleScale shrinks the shape around its center
|
|
351
352
|
if (scale !== 1 && shapes.length > start) {
|
|
352
|
-
const shape = shapes.pop() as
|
|
353
|
+
const shape = shapes.pop() as QRNode;
|
|
353
354
|
shapes.push(
|
|
354
355
|
<g
|
|
355
356
|
key={key}
|
|
@@ -472,7 +473,7 @@ function renderConicPattern(
|
|
|
472
473
|
cy: number,
|
|
473
474
|
radius: number,
|
|
474
475
|
size: number
|
|
475
|
-
):
|
|
476
|
+
): QRNode {
|
|
476
477
|
const fan = conicWedges(gradient.stops, gradient.angle ?? 0, cx, cy, radius);
|
|
477
478
|
const wedges = fan.wedges.map((wedge, index) => (
|
|
478
479
|
<path
|
|
@@ -531,7 +532,7 @@ function renderImagePattern(
|
|
|
531
532
|
id: string,
|
|
532
533
|
paint: ImagePaint,
|
|
533
534
|
size: number
|
|
534
|
-
):
|
|
535
|
+
): QRNode {
|
|
535
536
|
const scale = paint.scale ?? 1;
|
|
536
537
|
const tile = paint.fit === "tile";
|
|
537
538
|
const side = tile ? (size / 4) * scale : size;
|
|
@@ -589,7 +590,7 @@ function generateCornerGradientDef(
|
|
|
589
590
|
cornerType: "top-left" | "top-right" | "bottom-left",
|
|
590
591
|
idPrefix: string,
|
|
591
592
|
size: number
|
|
592
|
-
): { id: string; element:
|
|
593
|
+
): { id: string; element: QRNode } | null {
|
|
593
594
|
const normalized = normalizeColorConfig(colorConfig);
|
|
594
595
|
|
|
595
596
|
if (normalized.type === "solid") {
|
|
@@ -689,7 +690,7 @@ function generateGradientDef(
|
|
|
689
690
|
colorConfig: ColorConfig,
|
|
690
691
|
size: number,
|
|
691
692
|
idPrefix: string
|
|
692
|
-
): { id: string; element:
|
|
693
|
+
): { id: string; element: QRNode } | null {
|
|
693
694
|
const normalized = normalizeColorConfig(colorConfig);
|
|
694
695
|
|
|
695
696
|
if (normalized.type === "solid") {
|
|
@@ -775,10 +776,10 @@ const hasPaintDef = (color: ColorConfig) =>
|
|
|
775
776
|
|
|
776
777
|
/** Definitions once each: image fills that share a picture share an id. */
|
|
777
778
|
function uniqueDefs(
|
|
778
|
-
defs: ({ id: string; element:
|
|
779
|
-
):
|
|
779
|
+
defs: ({ id: string; element: QRNode } | null | undefined)[]
|
|
780
|
+
): QRNode[] {
|
|
780
781
|
const seen = new Set<string>();
|
|
781
|
-
const out:
|
|
782
|
+
const out: QRNode[] = [];
|
|
782
783
|
for (const def of defs) {
|
|
783
784
|
if (def && !seen.has(def.id)) {
|
|
784
785
|
seen.add(def.id);
|
|
@@ -937,7 +938,12 @@ export function convertImageSettingsToPixels(
|
|
|
937
938
|
return { imgWidth, imgHeight, imgLeft, imgTop };
|
|
938
939
|
}
|
|
939
940
|
|
|
940
|
-
|
|
941
|
+
/**
|
|
942
|
+
* The code as a tree of plain nodes (`QRNode`): what `QRCodeSVG` draws, with
|
|
943
|
+
* no framework. `renderToString` turns it into the same markup React writes,
|
|
944
|
+
* `renderToDOM` into DOM nodes. Every styling option is supported.
|
|
945
|
+
*/
|
|
946
|
+
export function createQRCodeTree(props: QRSVGOptions): QRNode {
|
|
941
947
|
const {
|
|
942
948
|
value,
|
|
943
949
|
size = DEFAULT_SIZE,
|
|
@@ -962,6 +968,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
962
968
|
autoLevel,
|
|
963
969
|
shape,
|
|
964
970
|
frameLabelMarkers,
|
|
971
|
+
partMarkers,
|
|
965
972
|
...otherProps
|
|
966
973
|
} = props;
|
|
967
974
|
// A logo no bigger than the code can repair (logo-budget.ts)
|
|
@@ -973,7 +980,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
973
980
|
// With a frame, the caller's SVG attributes belong on the outer frame <svg>.
|
|
974
981
|
const framed = isFrameActive(frame);
|
|
975
982
|
const rootProps: typeof otherProps = framed ? {} : otherProps;
|
|
976
|
-
const withFrame = (element:
|
|
983
|
+
const withFrame = (element: QRNode) =>
|
|
977
984
|
framed
|
|
978
985
|
? wrapWithFrame(element, {
|
|
979
986
|
size,
|
|
@@ -1006,15 +1013,33 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1006
1013
|
// silhouette (a silhouette that can't hold the code draws square)
|
|
1007
1014
|
const layoutMargin = getLayoutMargin(cells.length, margin, shape);
|
|
1008
1015
|
const decoration = shapeDecoration(value, cells.length, margin, shape);
|
|
1016
|
+
// Editors find each part by its marker (partMarkers, part-markers.ts)
|
|
1017
|
+
const part = (name: QRPart, eye?: QRPartEye) =>
|
|
1018
|
+
partMarker(partMarkers, name, eye);
|
|
1009
1019
|
const outline = (px: number, fill: FillProps) => {
|
|
1010
1020
|
const background = shapeBackground(shape, px);
|
|
1011
1021
|
if (!background) {
|
|
1012
|
-
return
|
|
1022
|
+
return (
|
|
1023
|
+
<rect
|
|
1024
|
+
{...fill}
|
|
1025
|
+
height={px}
|
|
1026
|
+
width={px}
|
|
1027
|
+
x={0}
|
|
1028
|
+
y={0}
|
|
1029
|
+
{...part("background")}
|
|
1030
|
+
/>
|
|
1031
|
+
);
|
|
1013
1032
|
}
|
|
1014
1033
|
return "circle" in background ? (
|
|
1015
|
-
<circle
|
|
1034
|
+
<circle
|
|
1035
|
+
cx={fmt(px / 2)}
|
|
1036
|
+
cy={fmt(px / 2)}
|
|
1037
|
+
{...fill}
|
|
1038
|
+
r={fmt(px / 2)}
|
|
1039
|
+
{...part("background")}
|
|
1040
|
+
/>
|
|
1016
1041
|
) : (
|
|
1017
|
-
<path d={background.path} {...fill} />
|
|
1042
|
+
<path d={background.path} {...fill} {...part("background")} />
|
|
1018
1043
|
);
|
|
1019
1044
|
};
|
|
1020
1045
|
|
|
@@ -1026,7 +1051,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1026
1051
|
imageSettings
|
|
1027
1052
|
);
|
|
1028
1053
|
|
|
1029
|
-
let image: null |
|
|
1054
|
+
let image: null | QRNode = null;
|
|
1030
1055
|
if (imageSettings != null && calculatedImageSettings != null) {
|
|
1031
1056
|
if (calculatedImageSettings.excavation != null) {
|
|
1032
1057
|
cells = excavateModules(cells, calculatedImageSettings.excavation);
|
|
@@ -1075,6 +1100,9 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1075
1100
|
w: imgWidth,
|
|
1076
1101
|
h: imgHeight,
|
|
1077
1102
|
});
|
|
1103
|
+
if (partMarkers) {
|
|
1104
|
+
image = cloneElement(image, part("logo"));
|
|
1105
|
+
}
|
|
1078
1106
|
}
|
|
1079
1107
|
}
|
|
1080
1108
|
|
|
@@ -1107,6 +1135,8 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1107
1135
|
}),
|
|
1108
1136
|
})
|
|
1109
1137
|
: null;
|
|
1138
|
+
const markedArtLayer =
|
|
1139
|
+
artLayer && partMarkers ? cloneElement(artLayer, part("body")) : artLayer;
|
|
1110
1140
|
const artEyes =
|
|
1111
1141
|
artLayer && art
|
|
1112
1142
|
? getQRArtEyeColors({ art, version: qrCode.version, ...artColors })
|
|
@@ -1158,13 +1188,17 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1158
1188
|
);
|
|
1159
1189
|
|
|
1160
1190
|
// Data modules, plus a shaped code's decoration around them
|
|
1161
|
-
const dataLayer =
|
|
1191
|
+
const dataLayer = markedArtLayer ? (
|
|
1162
1192
|
<>
|
|
1163
|
-
{
|
|
1164
|
-
{decorationShapes &&
|
|
1193
|
+
{markedArtLayer}
|
|
1194
|
+
{decorationShapes && (
|
|
1195
|
+
<g {...fgFillValue} {...part("body")}>
|
|
1196
|
+
{decorationShapes}
|
|
1197
|
+
</g>
|
|
1198
|
+
)}
|
|
1165
1199
|
</>
|
|
1166
1200
|
) : (
|
|
1167
|
-
<g {...fgFillValue}>
|
|
1201
|
+
<g {...fgFillValue} {...part("body")}>
|
|
1168
1202
|
{dataCircles}
|
|
1169
1203
|
{decorationShapes}
|
|
1170
1204
|
</g>
|
|
@@ -1356,7 +1390,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1356
1390
|
{dataLayer}
|
|
1357
1391
|
|
|
1358
1392
|
{/* Top-left corner square */}
|
|
1359
|
-
<g {...topLeftEyeFillValue}>
|
|
1393
|
+
<g {...topLeftEyeFillValue} {...part("eye-outer", "top-left")}>
|
|
1360
1394
|
<path
|
|
1361
1395
|
d={topLeftEye}
|
|
1362
1396
|
fillRule="evenodd"
|
|
@@ -1365,10 +1399,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1365
1399
|
</g>
|
|
1366
1400
|
|
|
1367
1401
|
{/* Top-left corner dot */}
|
|
1368
|
-
<g {...topLeftDotFillValue}
|
|
1402
|
+
<g {...topLeftDotFillValue} {...part("eye-centre", "top-left")}>
|
|
1403
|
+
{topLeftDot}
|
|
1404
|
+
</g>
|
|
1369
1405
|
|
|
1370
1406
|
{/* Top-right corner square */}
|
|
1371
|
-
<g {...topRightEyeFillValue}>
|
|
1407
|
+
<g {...topRightEyeFillValue} {...part("eye-outer", "top-right")}>
|
|
1372
1408
|
<path
|
|
1373
1409
|
d={topRightEye}
|
|
1374
1410
|
fillRule="evenodd"
|
|
@@ -1377,10 +1413,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1377
1413
|
</g>
|
|
1378
1414
|
|
|
1379
1415
|
{/* Top-right corner dot */}
|
|
1380
|
-
<g {...topRightDotFillValue}
|
|
1416
|
+
<g {...topRightDotFillValue} {...part("eye-centre", "top-right")}>
|
|
1417
|
+
{topRightDot}
|
|
1418
|
+
</g>
|
|
1381
1419
|
|
|
1382
1420
|
{/* Bottom-left corner square */}
|
|
1383
|
-
<g {...bottomLeftEyeFillValue}>
|
|
1421
|
+
<g {...bottomLeftEyeFillValue} {...part("eye-outer", "bottom-left")}>
|
|
1384
1422
|
<path
|
|
1385
1423
|
d={bottomLeftEye}
|
|
1386
1424
|
fillRule="evenodd"
|
|
@@ -1389,7 +1427,9 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1389
1427
|
</g>
|
|
1390
1428
|
|
|
1391
1429
|
{/* Bottom-left corner dot */}
|
|
1392
|
-
<g {...bottomLeftDotFillValue}
|
|
1430
|
+
<g {...bottomLeftDotFillValue} {...part("eye-centre", "bottom-left")}>
|
|
1431
|
+
{bottomLeftDot}
|
|
1432
|
+
</g>
|
|
1393
1433
|
|
|
1394
1434
|
{image}
|
|
1395
1435
|
</>
|
|
@@ -1449,7 +1489,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1449
1489
|
{dataLayer}
|
|
1450
1490
|
|
|
1451
1491
|
{/* Top-left corner square */}
|
|
1452
|
-
<g {...topLeftEyeFillValue}>
|
|
1492
|
+
<g {...topLeftEyeFillValue} {...part("eye-outer", "top-left")}>
|
|
1453
1493
|
<path
|
|
1454
1494
|
d={topLeftEye}
|
|
1455
1495
|
fillRule="evenodd"
|
|
@@ -1458,10 +1498,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1458
1498
|
</g>
|
|
1459
1499
|
|
|
1460
1500
|
{/* Top-left corner dot */}
|
|
1461
|
-
<g {...topLeftDotFillValue}
|
|
1501
|
+
<g {...topLeftDotFillValue} {...part("eye-centre", "top-left")}>
|
|
1502
|
+
{topLeftDot}
|
|
1503
|
+
</g>
|
|
1462
1504
|
|
|
1463
1505
|
{/* Top-right corner square */}
|
|
1464
|
-
<g {...topRightEyeFillValue}>
|
|
1506
|
+
<g {...topRightEyeFillValue} {...part("eye-outer", "top-right")}>
|
|
1465
1507
|
<path
|
|
1466
1508
|
d={topRightEye}
|
|
1467
1509
|
fillRule="evenodd"
|
|
@@ -1470,10 +1512,12 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1470
1512
|
</g>
|
|
1471
1513
|
|
|
1472
1514
|
{/* Top-right corner dot */}
|
|
1473
|
-
<g {...topRightDotFillValue}
|
|
1515
|
+
<g {...topRightDotFillValue} {...part("eye-centre", "top-right")}>
|
|
1516
|
+
{topRightDot}
|
|
1517
|
+
</g>
|
|
1474
1518
|
|
|
1475
1519
|
{/* Bottom-left corner square */}
|
|
1476
|
-
<g {...bottomLeftEyeFillValue}>
|
|
1520
|
+
<g {...bottomLeftEyeFillValue} {...part("eye-outer", "bottom-left")}>
|
|
1477
1521
|
<path
|
|
1478
1522
|
d={bottomLeftEye}
|
|
1479
1523
|
fillRule="evenodd"
|
|
@@ -1482,7 +1526,9 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1482
1526
|
</g>
|
|
1483
1527
|
|
|
1484
1528
|
{/* Bottom-left corner dot */}
|
|
1485
|
-
<g {...bottomLeftDotFillValue}
|
|
1529
|
+
<g {...bottomLeftDotFillValue} {...part("eye-centre", "bottom-left")}>
|
|
1530
|
+
{bottomLeftDot}
|
|
1531
|
+
</g>
|
|
1486
1532
|
|
|
1487
1533
|
{image}
|
|
1488
1534
|
</g>
|
|
@@ -1515,7 +1561,6 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1515
1561
|
// Clone the wrapped SVG element and override width/height to match requested size
|
|
1516
1562
|
// This ensures downloads get the proper size while keeping viewBox for scaling
|
|
1517
1563
|
// Remove percentage-based styles that would interfere with absolute sizing
|
|
1518
|
-
// @ts-expect-error
|
|
1519
1564
|
const originalStyle = wrappedSvg?.props?.style || {};
|
|
1520
1565
|
const newStyle = {
|
|
1521
1566
|
...originalStyle,
|
|
@@ -1527,8 +1572,7 @@ export function QRCodeSVG(props: QRPropsSVG) {
|
|
|
1527
1572
|
// Forward the caller's SVG attributes (className, aria-*, etc.) to the
|
|
1528
1573
|
// root element, same as the non-template path below.
|
|
1529
1574
|
return withFrame(
|
|
1530
|
-
|
|
1531
|
-
React.cloneElement(wrappedSvg, {
|
|
1575
|
+
cloneElement(wrappedSvg, {
|
|
1532
1576
|
...rootProps,
|
|
1533
1577
|
width: size,
|
|
1534
1578
|
height: size,
|