qrdx 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -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 +2 -5
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +2 -5
- package/dist/node.mjs.map +1 -1
- 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 -38
- 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.map +1 -1
- 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/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 +17 -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 +52 -6
- package/src/api.tsx +16 -140
- 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 -361
- 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 +3 -3
- package/src/plain.tsx +194 -0
- package/src/qr-code-canvas.tsx +1 -1
- package/src/qr-code-props.ts +115 -0
- package/src/qr-code-svg.tsx +17 -0
- package/src/qr-code.tsx +34 -114
- 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 +24 -23
- 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 +19 -5
- package/types/react.ts +8 -0
- package/types/template.ts +10 -3
package/src/index.tsx
CHANGED
|
@@ -1,369 +1,14 @@
|
|
|
1
1
|
/** biome-ignore-all lint/performance/noBarrelFile: false positive */
|
|
2
|
-
|
|
2
|
+
// The main entry: the React components plus everything in qrdx/core (the
|
|
3
|
+
// React-free engine they draw with). The components build React elements
|
|
4
|
+
// through the same renderer as the core, so their markup is the core's.
|
|
3
5
|
|
|
4
|
-
|
|
5
|
-
import { DEFAULT_SIZE } from "./constants";
|
|
6
|
-
import { getFrameDimensions } from "./frame";
|
|
7
|
-
import { blobToDataUrl, canvasToWebP } from "./webp";
|
|
8
|
-
|
|
9
|
-
export * from "../types";
|
|
6
|
+
export type { QRPropsCanvas, QRPropsSVG } from "../types/react";
|
|
10
7
|
export * from "./api";
|
|
11
|
-
export
|
|
12
|
-
createQRArtImage,
|
|
13
|
-
DEFAULT_ART_INTENSITY,
|
|
14
|
-
getQRArtColorIssue,
|
|
15
|
-
getQRArtEyeColors,
|
|
16
|
-
getQRArtVariant,
|
|
17
|
-
getQRFunctionModules,
|
|
18
|
-
isQRArtActive,
|
|
19
|
-
loadQRArtImage,
|
|
20
|
-
QR_ART_MIN_LUMA_GAP,
|
|
21
|
-
QR_ART_SAMPLE_SIZES,
|
|
22
|
-
type QRArtColorIssue,
|
|
23
|
-
type QRArtEyeColorOptions,
|
|
24
|
-
type QRArtPixels,
|
|
25
|
-
type QRArtRenderOptions,
|
|
26
|
-
renderQRArt,
|
|
27
|
-
} from "./art";
|
|
28
|
-
export { clampModuleScale, MODULE_SCALE_FLOOR } from "./body-patterns";
|
|
29
|
-
export * from "./detection";
|
|
30
|
-
export * from "./download";
|
|
31
|
-
export {
|
|
32
|
-
downloadPrintEPS,
|
|
33
|
-
EPS_IMAGE_FILL_REASON,
|
|
34
|
-
type EPSOptions,
|
|
35
|
-
epsToDataUrl,
|
|
36
|
-
getQRAsEPS,
|
|
37
|
-
hasImageFill,
|
|
38
|
-
type SVGToEPSOptions,
|
|
39
|
-
svgToEPS,
|
|
40
|
-
} from "./eps";
|
|
41
|
-
export {
|
|
42
|
-
FRAME_FONT_FAMILY,
|
|
43
|
-
FRAME_GAP_RATIO,
|
|
44
|
-
FRAME_LABEL_ATTRIBUTE,
|
|
45
|
-
type FrameBox,
|
|
46
|
-
type FrameLabel,
|
|
47
|
-
type FrameLayout,
|
|
48
|
-
type FramePath,
|
|
49
|
-
type FramePolygon,
|
|
50
|
-
type FrameRect,
|
|
51
|
-
type FrameShape,
|
|
52
|
-
frameLabels,
|
|
53
|
-
getFrameDimensions,
|
|
54
|
-
getFrameGapRatio,
|
|
55
|
-
getFrameLayout,
|
|
56
|
-
getFrameSecondaryText,
|
|
57
|
-
getFrameText,
|
|
58
|
-
isFrameActive,
|
|
59
|
-
} from "./frame";
|
|
60
|
-
export {
|
|
61
|
-
FRAME_ICON_BOX,
|
|
62
|
-
type FrameIconPath,
|
|
63
|
-
getFrameIconPath,
|
|
64
|
-
} from "./frame-icons";
|
|
65
|
-
export {
|
|
66
|
-
FRAME_IMPORT_LIMITS,
|
|
67
|
-
type FrameImportColor,
|
|
68
|
-
type FrameImportOptions,
|
|
69
|
-
type FrameImportResult,
|
|
70
|
-
type FrameImportWarning,
|
|
71
|
-
importFrameSvg,
|
|
72
|
-
} from "./frame-import";
|
|
73
|
-
export {
|
|
74
|
-
FrameSpecError,
|
|
75
|
-
getCustomFrameLayout,
|
|
76
|
-
getFrameSpecGapRatio,
|
|
77
|
-
resolveFrameSpec,
|
|
78
|
-
} from "./frame-spec";
|
|
79
|
-
export { GRADIENT_FRAME_DEFAULTS, mixFrameColors } from "./frame-styles";
|
|
80
|
-
export { BUILT_IN_FRAME_SPECS } from "./frames/builtin";
|
|
81
|
-
export {
|
|
82
|
-
OFFICIAL_FRAME_COUNT,
|
|
83
|
-
OFFICIAL_FRAME_COUNTS,
|
|
84
|
-
} from "./frames/catalogue/counts";
|
|
85
|
-
// The frame library's data is built as modules of its own and only
|
|
86
|
-
// re-exported here (tsup.config.ts), so bundlers skip what an app never uses.
|
|
87
|
-
export { OFFICIAL_FRAME_INDEX } from "./frames/catalogue/index";
|
|
88
|
-
export { OFFICIAL_FRAME_COLLECTIONS } from "./frames/collections";
|
|
89
|
-
export { getOfficialFrame, OFFICIAL_FRAMES } from "./frames/official";
|
|
90
|
-
export type {
|
|
91
|
-
OfficialFrame,
|
|
92
|
-
OfficialFrameCollection,
|
|
93
|
-
OfficialFrameIndexEntry,
|
|
94
|
-
} from "./frames/official-types";
|
|
95
|
-
export { frameSpecHash } from "./frames/spec-hash";
|
|
96
|
-
export {
|
|
97
|
-
LOGO_PLATE_INSET,
|
|
98
|
-
LOGO_ROUNDED_RADIUS,
|
|
99
|
-
} from "./logo";
|
|
100
|
-
export {
|
|
101
|
-
LOGO_CLEANUP_MAX_SIDE,
|
|
102
|
-
type LogoPixels,
|
|
103
|
-
removeLogoBackdrop,
|
|
104
|
-
removeLogoBackground,
|
|
105
|
-
} from "./logo-cleanup";
|
|
106
|
-
export {
|
|
107
|
-
partMarker,
|
|
108
|
-
QR_EYE_ATTRIBUTE,
|
|
109
|
-
QR_PART_ATTRIBUTE,
|
|
110
|
-
QR_PARTS,
|
|
111
|
-
type QRPart,
|
|
112
|
-
type QRPartEye,
|
|
113
|
-
} from "./part-markers";
|
|
114
|
-
export * from "./print";
|
|
8
|
+
export * from "./core";
|
|
115
9
|
export * from "./qr-code";
|
|
116
10
|
// QRCodeCanvas is the only export that needs client-only hooks. It lives in
|
|
117
11
|
// its own "use client" module (built as a separate entry) so the rest of the
|
|
118
12
|
// package stays usable from React Server Components.
|
|
119
13
|
export { QRCodeCanvas } from "./qr-code-canvas";
|
|
120
|
-
export {
|
|
121
|
-
circleQuietZone,
|
|
122
|
-
getLayoutMargin,
|
|
123
|
-
getQRShapePath,
|
|
124
|
-
getQRSilhouetteFit,
|
|
125
|
-
isShapedCode,
|
|
126
|
-
type QRSilhouetteFit,
|
|
127
|
-
} from "./qr-shape";
|
|
128
|
-
export {
|
|
129
|
-
getStylePairRisk,
|
|
130
|
-
isWeakSharpPair,
|
|
131
|
-
SHARP_DOT_EYE_SAFE_BODIES,
|
|
132
|
-
type StylePairRisk,
|
|
133
|
-
WEAK_BODY_EYES,
|
|
134
|
-
WEAK_DOT_EYES,
|
|
135
|
-
WEAK_DOTS,
|
|
136
|
-
WEAK_EYES,
|
|
137
|
-
WEAK_SHARP_DOT_EYES,
|
|
138
|
-
} from "./scan-risk";
|
|
139
|
-
export * from "./scan-score";
|
|
140
|
-
export {
|
|
141
|
-
createQRSilhouette,
|
|
142
|
-
loadQRSilhouette,
|
|
143
|
-
} from "./silhouette";
|
|
144
|
-
export * from "./templates";
|
|
145
|
-
export * from "./utils";
|
|
146
|
-
/** Reads an 8-bit PNG into RGBA pixels (no DOM or sharp), or null. */
|
|
147
|
-
export { type DecodedImage, decodePng as decodePNGPixels } from "./utils/png";
|
|
148
|
-
export * from "./webp";
|
|
149
|
-
|
|
150
|
-
export async function getQRAsSVGDataUri(props: QRProps) {
|
|
151
|
-
// Import QRCodeSVG and render it to string
|
|
152
|
-
const { QRCodeSVG } = await import("./utils");
|
|
153
|
-
const { renderToStaticMarkup } = await import("react-dom/server");
|
|
154
|
-
const React = await import("react");
|
|
155
|
-
|
|
156
|
-
// If there's an image in imageSettings, convert it to base64 first
|
|
157
|
-
let updatedProps = { ...props };
|
|
158
|
-
if (props.imageSettings?.src) {
|
|
159
|
-
try {
|
|
160
|
-
const base64Image = (await getBase64Image(
|
|
161
|
-
props.imageSettings.src
|
|
162
|
-
)) as string;
|
|
163
|
-
updatedProps = {
|
|
164
|
-
...props,
|
|
165
|
-
imageSettings: {
|
|
166
|
-
...props.imageSettings,
|
|
167
|
-
src: base64Image,
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
} catch {
|
|
171
|
-
// Remove the image from settings if it fails to load
|
|
172
|
-
// This prevents SVG from containing external URLs that will fail during canvas conversion
|
|
173
|
-
const { imageSettings: _removed, ...propsWithoutImage } = props;
|
|
174
|
-
updatedProps = propsWithoutImage;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// Create the SVG element with all props including templateId
|
|
179
|
-
// Filter out props that aren't valid for QRCodeSVG (like hideLogo, url, etc.)
|
|
180
|
-
// Exports never carry the preview's frame label or part markers.
|
|
181
|
-
const {
|
|
182
|
-
hideLogo: _hideLogo,
|
|
183
|
-
url: _url,
|
|
184
|
-
logo: _logo,
|
|
185
|
-
scale: _scale,
|
|
186
|
-
frameLabelMarkers: _frameLabelMarkers,
|
|
187
|
-
partMarkers: _partMarkers,
|
|
188
|
-
...validSVGProps
|
|
189
|
-
} = updatedProps as any;
|
|
190
|
-
|
|
191
|
-
const svgElement = React.createElement(QRCodeSVG, {
|
|
192
|
-
...validSVGProps,
|
|
193
|
-
templateId: updatedProps.templateId, // Ensure templateId is passed
|
|
194
|
-
customTemplate: updatedProps.customTemplate, // Ensure customTemplate is passed
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
const svgString = renderToStaticMarkup(svgElement);
|
|
198
|
-
|
|
199
|
-
return `data:image/svg+xml,${encodeURIComponent(svgString)}`;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const getBase64Image = (imgUrl: string) =>
|
|
203
|
-
new Promise((resolve, reject) => {
|
|
204
|
-
// If already a data URL, return as is
|
|
205
|
-
if (imgUrl.startsWith("data:")) {
|
|
206
|
-
resolve(imgUrl);
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const img = new Image();
|
|
211
|
-
// Set crossOrigin before setting src
|
|
212
|
-
img.crossOrigin = "anonymous";
|
|
213
|
-
|
|
214
|
-
img.onload = () => {
|
|
215
|
-
try {
|
|
216
|
-
const canvas = document.createElement("canvas");
|
|
217
|
-
canvas.width = img.naturalWidth || img.width;
|
|
218
|
-
canvas.height = img.naturalHeight || img.height;
|
|
219
|
-
|
|
220
|
-
const ctx = canvas.getContext("2d");
|
|
221
|
-
if (!ctx) {
|
|
222
|
-
reject(new Error("Could not get canvas context"));
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
ctx.drawImage(img, 0, 0);
|
|
227
|
-
const dataURL = canvas.toDataURL("image/png");
|
|
228
|
-
|
|
229
|
-
canvas.remove();
|
|
230
|
-
resolve(dataURL);
|
|
231
|
-
} catch (error) {
|
|
232
|
-
reject(new Error(`Failed to convert image to base64: ${error}`));
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
img.onerror = () => {
|
|
237
|
-
reject(
|
|
238
|
-
new Error(
|
|
239
|
-
`Could not load image from ${imgUrl.slice(0, 100)}... Check CORS settings or use a data URL.`
|
|
240
|
-
)
|
|
241
|
-
);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
img.src = imgUrl;
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
// function waitUntilImageLoaded(img: HTMLImageElement, src: string) {
|
|
248
|
-
// return new Promise((resolve) => {
|
|
249
|
-
// function onFinish() {
|
|
250
|
-
// img.onload = null;
|
|
251
|
-
// img.onerror = null;
|
|
252
|
-
// resolve(true);
|
|
253
|
-
// }
|
|
254
|
-
// img.onload = onFinish;
|
|
255
|
-
// img.onerror = onFinish;
|
|
256
|
-
// img.src = src;
|
|
257
|
-
// img.loading = "eager";
|
|
258
|
-
// });
|
|
259
|
-
// }
|
|
260
|
-
|
|
261
|
-
export async function getQRAsCanvas(
|
|
262
|
-
props: QRProps,
|
|
263
|
-
type: string,
|
|
264
|
-
getCanvas?: boolean
|
|
265
|
-
): Promise<HTMLCanvasElement | string> {
|
|
266
|
-
// First get the SVG using the same logic as displayed
|
|
267
|
-
const svgDataUri = await getQRAsSVGDataUri(props);
|
|
268
|
-
const svgString = decodeURIComponent(
|
|
269
|
-
svgDataUri.replace("data:image/svg+xml,", "")
|
|
270
|
-
);
|
|
271
|
-
|
|
272
|
-
// Convert SVG to base64 for better compatibility
|
|
273
|
-
let base64DataUri: string;
|
|
274
|
-
try {
|
|
275
|
-
// Use modern approach instead of deprecated unescape
|
|
276
|
-
const utf8Bytes = new TextEncoder().encode(svgString);
|
|
277
|
-
const binaryString = Array.from(utf8Bytes, (byte) =>
|
|
278
|
-
String.fromCharCode(byte)
|
|
279
|
-
).join("");
|
|
280
|
-
const base64SVG = btoa(binaryString);
|
|
281
|
-
base64DataUri = `data:image/svg+xml;base64,${base64SVG}`;
|
|
282
|
-
} catch (error) {
|
|
283
|
-
throw new Error(`Failed to encode SVG for canvas conversion: ${error}`);
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return new Promise((resolve, reject) => {
|
|
287
|
-
const canvas = document.createElement("canvas");
|
|
288
|
-
const ctx = canvas.getContext("2d");
|
|
289
|
-
|
|
290
|
-
if (!ctx) {
|
|
291
|
-
reject(new Error("Could not get canvas context"));
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
const img = new Image();
|
|
296
|
-
|
|
297
|
-
// Set canvas size to match the QR code (plus its frame, if any)
|
|
298
|
-
const { width, height } = getFrameDimensions(
|
|
299
|
-
props.size || DEFAULT_SIZE,
|
|
300
|
-
props.frame
|
|
301
|
-
);
|
|
302
|
-
canvas.width = Math.round(width);
|
|
303
|
-
canvas.height = Math.round(height);
|
|
304
|
-
|
|
305
|
-
// Add timeout to prevent hanging
|
|
306
|
-
const timeout = setTimeout(() => {
|
|
307
|
-
canvas.remove();
|
|
308
|
-
reject(
|
|
309
|
-
new Error(
|
|
310
|
-
"SVG load timeout - image may be too large or contain invalid data"
|
|
311
|
-
)
|
|
312
|
-
);
|
|
313
|
-
}, 30_000); // 30 second timeout
|
|
314
|
-
|
|
315
|
-
img.onload = () => {
|
|
316
|
-
clearTimeout(timeout);
|
|
317
|
-
try {
|
|
318
|
-
// Fill white background for JPG
|
|
319
|
-
if (type === "image/jpeg") {
|
|
320
|
-
ctx.fillStyle = "white";
|
|
321
|
-
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
|
|
325
|
-
|
|
326
|
-
if (getCanvas) {
|
|
327
|
-
resolve(canvas);
|
|
328
|
-
} else if (type === "image/webp") {
|
|
329
|
-
// toDataURL would hand back a PNG where the browser can't encode
|
|
330
|
-
// WebP (Safari); canvasToWebP encodes it itself there.
|
|
331
|
-
canvasToWebP(canvas)
|
|
332
|
-
.then(blobToDataUrl)
|
|
333
|
-
.then(resolve, reject)
|
|
334
|
-
.finally(() => canvas.remove());
|
|
335
|
-
} else {
|
|
336
|
-
const dataUrl = canvas.toDataURL(type, 1.0);
|
|
337
|
-
canvas.remove();
|
|
338
|
-
resolve(dataUrl);
|
|
339
|
-
}
|
|
340
|
-
} catch (error) {
|
|
341
|
-
clearTimeout(timeout);
|
|
342
|
-
canvas.remove();
|
|
343
|
-
reject(new Error(`Failed to draw SVG to canvas: ${error}`));
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
|
|
347
|
-
img.onerror = () => {
|
|
348
|
-
clearTimeout(timeout);
|
|
349
|
-
canvas.remove();
|
|
350
|
-
reject(new Error("Could not load SVG"));
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
// Use base64-encoded data URI for maximum compatibility
|
|
354
|
-
img.src = base64DataUri;
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export {
|
|
359
|
-
type CodewordMap,
|
|
360
|
-
damagedCodewords,
|
|
361
|
-
getCodewordMap,
|
|
362
|
-
} from "./codeword-map";
|
|
363
|
-
export { getLogoSizeLimit, getQRData } from "./helpers";
|
|
364
|
-
export {
|
|
365
|
-
getLogoBlockDamage,
|
|
366
|
-
LOGO_EC_SAFETY,
|
|
367
|
-
type LogoBlockDamage,
|
|
368
|
-
logoFitsBudget,
|
|
369
|
-
} from "./logo-budget";
|
|
14
|
+
export { QRCodeSVG } from "./qr-code-svg";
|
package/src/jsx/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// The development JSX runtime (test runners compile JSX in dev mode).
|
|
2
|
+
import { jsx, jsxs, type QRNode } from "./runtime";
|
|
3
|
+
|
|
4
|
+
export type { JSX } from "./jsx-runtime";
|
|
5
|
+
export { Fragment } from "./runtime";
|
|
6
|
+
|
|
7
|
+
export function jsxDEV(
|
|
8
|
+
type: unknown,
|
|
9
|
+
props: object | null,
|
|
10
|
+
key?: string | number | null,
|
|
11
|
+
isStaticChildren?: boolean
|
|
12
|
+
): QRNode {
|
|
13
|
+
return (isStaticChildren ? jsxs : jsx)(type, props, key);
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The automatic JSX runtime of the SVG renderer (see runtime.ts). A file opts
|
|
3
|
+
* in with `/** @jsxImportSource ./jsx *\/` (relative to it).
|
|
4
|
+
*
|
|
5
|
+
* Attribute names and values are React's (`fillRule`, `strokeWidth`,
|
|
6
|
+
* `style={{ … }}`), checked against React's SVG types when this package is
|
|
7
|
+
* type-checked; nothing here imports React at run time, and the published
|
|
8
|
+
* types of the core never reach this file.
|
|
9
|
+
*/
|
|
10
|
+
import type { JSX as ReactJSX } from "react";
|
|
11
|
+
import type { QRNode } from "./runtime";
|
|
12
|
+
|
|
13
|
+
export { Fragment, jsx, jsxs } from "./runtime";
|
|
14
|
+
|
|
15
|
+
type WithChildren<T> = Omit<T, "children" | "ref"> & { children?: unknown };
|
|
16
|
+
|
|
17
|
+
type IntrinsicElementsMap = {
|
|
18
|
+
[K in keyof ReactJSX.IntrinsicElements]: WithChildren<
|
|
19
|
+
ReactJSX.IntrinsicElements[K]
|
|
20
|
+
>;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// biome-ignore lint/style/noNamespace: TypeScript reads JSX types from a namespace named JSX
|
|
24
|
+
export declare namespace JSX {
|
|
25
|
+
type Element = QRNode;
|
|
26
|
+
interface ElementChildrenAttribute {
|
|
27
|
+
// biome-ignore lint/complexity/noBannedTypes: the JSX convention
|
|
28
|
+
children: {};
|
|
29
|
+
}
|
|
30
|
+
interface IntrinsicAttributes {
|
|
31
|
+
key?: string | number | null;
|
|
32
|
+
}
|
|
33
|
+
interface IntrinsicElements extends IntrinsicElementsMap {}
|
|
34
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The element runtime of the SVG renderer. The renderer's .tsx files compile
|
|
3
|
+
* their JSX against this folder (`/** @jsxImportSource ./jsx *\/`), so they
|
|
4
|
+
* need no framework: by default an element is a plain `QRNode`
|
|
5
|
+
* (`{ type, props, key }`) that `renderToString`, `renderToDOM` and
|
|
6
|
+
* `toHyperscript` turn into markup, DOM nodes or another framework's
|
|
7
|
+
* elements.
|
|
8
|
+
*
|
|
9
|
+
* The React components draw through the same code with React's own element
|
|
10
|
+
* functions plugged in (`withElementFactory`), so they build exactly the
|
|
11
|
+
* React elements they always have, with no conversion step.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** A component: a function from props to a tree. */
|
|
15
|
+
export type QRComponent = (props: any) => QRChild;
|
|
16
|
+
|
|
17
|
+
/** A node of the tree the renderer builds without a framework. */
|
|
18
|
+
export interface QRNode {
|
|
19
|
+
/** An element name ("svg", "path"…), `Fragment`, or a component */
|
|
20
|
+
type: string | QRComponent;
|
|
21
|
+
/** Attributes with React's names (`fillRule`, `className`), plus `children` */
|
|
22
|
+
props: QRNodeProps;
|
|
23
|
+
/** Like React's: a string, or null when none was given */
|
|
24
|
+
key: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface QRNodeProps {
|
|
28
|
+
children?: QRChild;
|
|
29
|
+
[name: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Anything that can sit in a tree. Booleans, null and undefined draw nothing. */
|
|
33
|
+
export type QRChild =
|
|
34
|
+
| QRNode
|
|
35
|
+
| string
|
|
36
|
+
| number
|
|
37
|
+
| bigint
|
|
38
|
+
| boolean
|
|
39
|
+
| null
|
|
40
|
+
| undefined
|
|
41
|
+
| readonly QRChild[];
|
|
42
|
+
|
|
43
|
+
/** Groups children without adding an element. */
|
|
44
|
+
export function Fragment(props: { children?: QRChild }): QRChild {
|
|
45
|
+
return props.children;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type Key = string | number | bigint | null | undefined;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The element functions the renderer calls. `QRNode`s by default; the React
|
|
52
|
+
* entry plugs in React's (see `withElementFactory`).
|
|
53
|
+
*/
|
|
54
|
+
export interface ElementFactory {
|
|
55
|
+
jsx(type: unknown, props: object | null, key?: Key): unknown;
|
|
56
|
+
jsxs(type: unknown, props: object | null, key?: Key): unknown;
|
|
57
|
+
createElement(
|
|
58
|
+
type: unknown,
|
|
59
|
+
props: object | null,
|
|
60
|
+
...children: unknown[]
|
|
61
|
+
): unknown;
|
|
62
|
+
cloneElement(element: unknown, props?: object | null): unknown;
|
|
63
|
+
Fragment: unknown;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const toKey = (key: Key): string | null =>
|
|
67
|
+
key === undefined || key === null ? null : `${key}`;
|
|
68
|
+
|
|
69
|
+
/** Builds a node; a `key` among the props wins and is taken out, as in React. */
|
|
70
|
+
function node(type: unknown, props: object | null, key?: Key): QRNode {
|
|
71
|
+
let ownProps = (props ?? {}) as QRNodeProps;
|
|
72
|
+
let ownKey = key;
|
|
73
|
+
if ("key" in ownProps) {
|
|
74
|
+
const { key: propKey, ...rest } = ownProps;
|
|
75
|
+
if (propKey !== undefined) {
|
|
76
|
+
ownKey = propKey as Key;
|
|
77
|
+
}
|
|
78
|
+
ownProps = rest;
|
|
79
|
+
}
|
|
80
|
+
return { type: type as QRNode["type"], props: ownProps, key: toKey(ownKey) };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* A copy of `element` with `props` merged over its own, like React's
|
|
85
|
+
* `cloneElement` (the key is kept). Works on React elements too (a custom
|
|
86
|
+
* template written for React, drawn without React).
|
|
87
|
+
*/
|
|
88
|
+
function cloneNode(element: unknown, props?: object | null): QRNode {
|
|
89
|
+
const source = element as QRNode;
|
|
90
|
+
return {
|
|
91
|
+
type: source.type,
|
|
92
|
+
props: { ...source.props, ...props },
|
|
93
|
+
key: source.key ?? null,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** `createElement(type, props, ...children)`, the classic signature. */
|
|
98
|
+
function createNode(
|
|
99
|
+
type: unknown,
|
|
100
|
+
config: object | null,
|
|
101
|
+
...children: unknown[]
|
|
102
|
+
): QRNode {
|
|
103
|
+
const props: Record<string, unknown> = { ...config };
|
|
104
|
+
if (children.length > 0) {
|
|
105
|
+
props.children = children.length === 1 ? children[0] : children;
|
|
106
|
+
}
|
|
107
|
+
return node(type, props);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const NODE_FACTORY: ElementFactory = {
|
|
111
|
+
jsx: node,
|
|
112
|
+
jsxs: node,
|
|
113
|
+
createElement: createNode,
|
|
114
|
+
cloneElement: cloneNode,
|
|
115
|
+
Fragment,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
let factory: ElementFactory = NODE_FACTORY;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Runs `render` with another framework's element functions: the React
|
|
122
|
+
* components call the renderer through this, so it builds React elements.
|
|
123
|
+
* Rendering is synchronous, so nothing else runs while the factory is set.
|
|
124
|
+
*/
|
|
125
|
+
export function withElementFactory<T>(
|
|
126
|
+
elements: ElementFactory,
|
|
127
|
+
render: () => T
|
|
128
|
+
): T {
|
|
129
|
+
const previous = factory;
|
|
130
|
+
factory = elements;
|
|
131
|
+
try {
|
|
132
|
+
return render();
|
|
133
|
+
} finally {
|
|
134
|
+
factory = previous;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const typeOf = (type: unknown) => (type === Fragment ? factory.Fragment : type);
|
|
139
|
+
|
|
140
|
+
/** Builds an element (what compiled JSX calls). */
|
|
141
|
+
export function jsx(type: unknown, props: object | null, key?: Key): QRNode {
|
|
142
|
+
return factory.jsx(typeOf(type), props, key) as QRNode;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** Builds an element with children written out (what compiled JSX calls). */
|
|
146
|
+
export function jsxs(type: unknown, props: object | null, key?: Key): QRNode {
|
|
147
|
+
return factory.jsxs(typeOf(type), props, key) as QRNode;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Hyperscript: `h("path", { d: "M0 0h1v1H0z" })`, children last. For custom
|
|
152
|
+
* templates written without JSX; it builds whatever the code is drawn with
|
|
153
|
+
* (React elements inside the React components, `QRNode`s otherwise).
|
|
154
|
+
*/
|
|
155
|
+
export function h(
|
|
156
|
+
type: string | QRComponent,
|
|
157
|
+
props?: Record<string, unknown> | null,
|
|
158
|
+
...children: QRChild[]
|
|
159
|
+
): QRNode {
|
|
160
|
+
return factory.createElement(
|
|
161
|
+
typeOf(type),
|
|
162
|
+
props ?? null,
|
|
163
|
+
...children
|
|
164
|
+
) as QRNode;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** `cloneElement` for the current factory. */
|
|
168
|
+
export function cloneElement(element: unknown, props?: object | null): QRNode {
|
|
169
|
+
return factory.cloneElement(element, props) as QRNode;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const REACT_ELEMENT_TYPES = new Set<unknown>([
|
|
173
|
+
Symbol.for("react.element"),
|
|
174
|
+
Symbol.for("react.transitional.element"),
|
|
175
|
+
]);
|
|
176
|
+
const REACT_FRAGMENT = Symbol.for("react.fragment");
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* A node of this tree, or a React element (a custom template written for
|
|
180
|
+
* React can still be drawn without React: a React element has the same
|
|
181
|
+
* type, props and key).
|
|
182
|
+
*/
|
|
183
|
+
export function isQRNode(value: unknown): value is QRNode {
|
|
184
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
const candidate = value as {
|
|
188
|
+
type?: unknown;
|
|
189
|
+
props?: unknown;
|
|
190
|
+
$$typeof?: unknown;
|
|
191
|
+
};
|
|
192
|
+
if (
|
|
193
|
+
candidate.$$typeof !== undefined &&
|
|
194
|
+
!REACT_ELEMENT_TYPES.has(candidate.$$typeof)
|
|
195
|
+
) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return (
|
|
199
|
+
(typeof candidate.type === "string" ||
|
|
200
|
+
typeof candidate.type === "function" ||
|
|
201
|
+
candidate.type === REACT_FRAGMENT) &&
|
|
202
|
+
typeof candidate.props === "object" &&
|
|
203
|
+
candidate.props !== null
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** True for this runtime's Fragment and React's. */
|
|
208
|
+
export const isFragment = (type: unknown): boolean =>
|
|
209
|
+
type === Fragment || type === REACT_FRAGMENT;
|
package/src/logo.tsx
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
/** @jsxImportSource ./jsx */
|
|
1
2
|
/** biome-ignore-all lint/style/noMagicNumbers: logo geometry */
|
|
2
3
|
// The center logo as SVG: an optional plate behind it and a crop to its
|
|
3
4
|
// shape (imageSettings.shape and .plate). Everything is plain SVG (a filled
|
|
4
5
|
// shape, a <clipPath> and an <image>), which the PDF and EPS exporters
|
|
5
6
|
// draw too: their painters clip to the same outline.
|
|
6
|
-
|
|
7
|
+
|
|
7
8
|
import type { ImageSettings, LogoShape } from "../types";
|
|
9
|
+
import type { QRNode } from "./jsx/runtime";
|
|
8
10
|
import { hashString } from "./shapes";
|
|
9
11
|
import { fmt } from "./utils/fmt";
|
|
10
12
|
|
|
@@ -25,7 +27,7 @@ function shapeElement(
|
|
|
25
27
|
shape: LogoShape,
|
|
26
28
|
box: Box,
|
|
27
29
|
props: Record<string, string> = {}
|
|
28
|
-
):
|
|
30
|
+
): QRNode {
|
|
29
31
|
if (shape === "circle") {
|
|
30
32
|
return (
|
|
31
33
|
<circle
|
|
@@ -65,7 +67,7 @@ function inset(box: Box, share: number): Box {
|
|
|
65
67
|
export function renderLogo(
|
|
66
68
|
settings: Pick<ImageSettings, "src" | "shape" | "plate">,
|
|
67
69
|
box: Box
|
|
68
|
-
):
|
|
70
|
+
): QRNode {
|
|
69
71
|
const shape = settings.shape ?? "square";
|
|
70
72
|
const plate = settings.plate;
|
|
71
73
|
const imageBox = plate ? inset(box, LOGO_PLATE_INSET) : box;
|
package/src/node.ts
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
// library for the browser doesn't try to link a native module. Import it
|
|
6
6
|
// from "qrdx/node", never from "qrdx", when you want a PNG on a server.
|
|
7
7
|
|
|
8
|
+
// It draws with qrdx/core (built as dist/core, which this entry imports), so
|
|
9
|
+
// it needs neither react nor react-dom.
|
|
8
10
|
import type { QRProps } from "../types";
|
|
9
|
-
import { DEFAULT_SIZE } from "./
|
|
10
|
-
import { withQRSize } from "./download";
|
|
11
|
-
import { getQRAsSVGDataUri } from "./index";
|
|
11
|
+
import { DEFAULT_SIZE, getQRAsSVGDataUri, withQRSize } from "./core";
|
|
12
12
|
import {
|
|
13
13
|
loadLogoForRasterizer,
|
|
14
14
|
type RasterLogo,
|