Comparing version 2.2.0 to 2.2.1
@@ -1,1 +0,1 @@ | ||
"use strict";const e=e=>{const r=new Error(`lean-qr error ${e}`);throw r.code=e,r},r=(e,r)=>r.map((r=>e[r])),n=["content","minCorrectionLevel","maxCorrectionLevel","minVersion","maxVersion","mask","modes"],t=[...n,"on","off","padX","padY"],o={"image-rendering":"pixelated"},s=e=>{try{return e()}catch(e){return void console.warn(e.message)}};exports.makeAsyncComponent=({createElement:s,useEffect:c,useRef:a}=e(6),l=e(7))=>e=>{const m=a(null),i=a([null,{}]);return c((()=>{try{((e,r,n)=>n.some((n=>e[n]!==r[n])))(e,i.current[1],n)&&(i.current[0]=l(e.content,e)),i.current[0].toCanvas(m.current,e),m.current.hidden=!1}catch(e){console.warn(e.message),m.current.hidden=!0}i.current[1]=e}),r(e,t)),s("canvas",{ref:m,style:o,className:e.className})},exports.makeSyncComponent=({createElement:c,useMemo:a}=e(6),l=e(7),m=e(8))=>e=>{const i=a((()=>s((()=>l(e.content,e)))),r(e,n)),u=a((()=>i&&s((()=>m(i,e)))),[i,...r(e,t)]);return u?c("img",{src:u,style:o,className:e.className}):null}; | ||
"use strict";const e=e=>{const r=new Error(`lean-qr error ${e}`);throw r.code=e,r},r=(e,r)=>r.map((r=>e[r])),n=["content","minCorrectionLevel","maxCorrectionLevel","minVersion","maxVersion","mask","modes"],t=[...n,"on","off","padX","padY"],o={"image-rendering":"pixelated"},s=e=>{try{return e()}catch(e){return void console.warn(e.message)}};exports.makeAsyncComponent=({createElement:s,useEffect:c,useRef:a}=e(6),l=e(7),m={})=>e=>{const i={...m,...e},u=a(null),d=a([null,{}]);return c((()=>{try{((e,r,n)=>n.some((n=>e[n]!==r[n])))(i,d.current[1],n)&&(d.current[0]=l(i.content,i)),d.current[0].toCanvas(u.current,i),u.current.hidden=!1}catch(e){console.warn(e.message),u.current.hidden=!0}d.current[1]=i}),r(i,t)),s("canvas",{ref:u,style:o,className:i.className})},exports.makeSyncComponent=({createElement:c,useMemo:a}=e(6),l=e(7),m=e(8),i={})=>e=>{const u={...i,...e},d=a((()=>s((()=>l(u.content,u)))),r(u,n)),f=a((()=>d&&s((()=>m(d,u)))),[d,...r(u,t)]);return f?c("img",{src:f,style:o,className:u.className}):null}; |
@@ -170,2 +170,3 @@ declare module 'lean-qr' { | ||
generate: GenerateFn, | ||
defaultProps?: Readonly<Partial<AsyncQRComponentProps>>, | ||
) => AsyncQRComponent<T>; | ||
@@ -189,2 +190,3 @@ | ||
toSvgDataURL: toSvgDataURLFn, | ||
defaultProps?: Readonly<Partial<SyncQRComponentProps>>, | ||
) => SyncQRComponent<T>; | ||
@@ -191,0 +193,0 @@ } |
{ | ||
"name": "lean-qr", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "minimal QR code generation", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -607,2 +607,12 @@ # Lean QR | ||
You can also change the default values for the component by passing | ||
an extra argument to the `make` function. For example, if you want | ||
all QR codes to use at least correction level H: | ||
```javascript | ||
const QR = makeAsyncComponent(React, generate, { | ||
minCorrectionLevel: correction.H, | ||
}); | ||
``` | ||
### Server-side Rendering | ||
@@ -609,0 +619,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
54010
262
723
0