angularx-qrcode
Advanced tools
| import * as i0 from '@angular/core'; | ||
| import { OnChanges, EventEmitter, ElementRef, Renderer2 } from '@angular/core'; | ||
| import { SafeUrl, DomSanitizer } from '@angular/platform-browser'; | ||
| type QRCodeErrorCorrectionLevel = "L" | "M" | "Q" | "H" | "low" | "medium" | "quartile" | "high"; | ||
| interface QRCodeConfigType { | ||
| color: { | ||
| dark: string; | ||
| light: string; | ||
| }; | ||
| errorCorrectionLevel: QRCodeErrorCorrectionLevel; | ||
| margin: number; | ||
| scale: number; | ||
| version?: QRCodeVersion; | ||
| width: number; | ||
| } | ||
| type QRCodeElementType = "url" | "img" | "canvas" | "svg"; | ||
| type QRCodeVersion = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40; | ||
| type RGBAColor = `#${string}`; | ||
| type FixMeLater = any; | ||
| declare class QRCodeComponent implements OnChanges { | ||
| private renderer; | ||
| private sanitizer; | ||
| allowEmptyString: boolean; | ||
| colorDark: string; | ||
| colorLight: string; | ||
| cssClass: string; | ||
| elementType: QRCodeElementType; | ||
| errorCorrectionLevel: QRCodeErrorCorrectionLevel; | ||
| imageSrc?: string; | ||
| imageHeight?: number; | ||
| imageWidth?: number; | ||
| margin: number; | ||
| qrdata: string; | ||
| scale: number; | ||
| version?: QRCodeVersion; | ||
| width: number; | ||
| alt?: string; | ||
| ariaLabel?: string; | ||
| title?: string; | ||
| qrCodeURL: EventEmitter<SafeUrl>; | ||
| qrcElement: ElementRef; | ||
| context: CanvasRenderingContext2D | null; | ||
| private centerImage?; | ||
| constructor(renderer: Renderer2, sanitizer: DomSanitizer); | ||
| ngOnChanges(): Promise<void>; | ||
| protected isValidQrCodeText(data: string | null): boolean; | ||
| private toDataURL; | ||
| private toCanvas; | ||
| private toSVG; | ||
| private renderElement; | ||
| private createQRCode; | ||
| convertBase64ImageUrlToBlob(base64ImageUrl: string): Blob; | ||
| emitQRCodeURL(element: HTMLCanvasElement | HTMLImageElement | SVGSVGElement): void; | ||
| static ɵfac: i0.ɵɵFactoryDeclaration<QRCodeComponent, never>; | ||
| static ɵcmp: i0.ɵɵComponentDeclaration<QRCodeComponent, "qrcode", never, { "allowEmptyString": { "alias": "allowEmptyString"; "required": false; }; "colorDark": { "alias": "colorDark"; "required": false; }; "colorLight": { "alias": "colorLight"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "elementType": { "alias": "elementType"; "required": false; }; "errorCorrectionLevel": { "alias": "errorCorrectionLevel"; "required": false; }; "imageSrc": { "alias": "imageSrc"; "required": false; }; "imageHeight": { "alias": "imageHeight"; "required": false; }; "imageWidth": { "alias": "imageWidth"; "required": false; }; "margin": { "alias": "margin"; "required": false; }; "qrdata": { "alias": "qrdata"; "required": false; }; "scale": { "alias": "scale"; "required": false; }; "version": { "alias": "version"; "required": false; }; "width": { "alias": "width"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, { "qrCodeURL": "qrCodeURL"; }, never, never, true, never>; | ||
| } | ||
| export { QRCodeComponent }; | ||
| export type { FixMeLater, QRCodeConfigType, QRCodeElementType, QRCodeErrorCorrectionLevel, QRCodeVersion, RGBAColor }; |
@@ -7,17 +7,29 @@ import * as i0 from '@angular/core'; | ||
| class QRCodeComponent { | ||
| renderer; | ||
| sanitizer; | ||
| allowEmptyString = false; | ||
| colorDark = "#000000ff"; | ||
| colorLight = "#ffffffff"; | ||
| cssClass = "qrcode"; | ||
| elementType = "canvas"; | ||
| errorCorrectionLevel = "M"; | ||
| imageSrc; | ||
| imageHeight; | ||
| imageWidth; | ||
| margin = 4; | ||
| qrdata = ""; | ||
| scale = 4; | ||
| version; | ||
| width = 10; | ||
| // Accessibility features introduced in 13.0.4+ | ||
| alt; | ||
| ariaLabel; | ||
| title; | ||
| qrCodeURL = new EventEmitter(); | ||
| qrcElement; | ||
| context = null; | ||
| centerImage; | ||
| constructor(renderer, sanitizer) { | ||
| this.renderer = renderer; | ||
| this.sanitizer = sanitizer; | ||
| this.allowEmptyString = false; | ||
| this.colorDark = "#000000ff"; | ||
| this.colorLight = "#ffffffff"; | ||
| this.cssClass = "qrcode"; | ||
| this.elementType = "canvas"; | ||
| this.errorCorrectionLevel = "M"; | ||
| this.margin = 4; | ||
| this.qrdata = ""; | ||
| this.scale = 4; | ||
| this.width = 10; | ||
| this.qrCodeURL = new EventEmitter(); | ||
| this.context = null; | ||
| } | ||
@@ -236,6 +248,6 @@ async ngOnChanges() { | ||
| } | ||
| static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: QRCodeComponent, deps: [{ token: i0.Renderer2 }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); } | ||
| static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0", type: QRCodeComponent, isStandalone: true, selector: "qrcode", inputs: { allowEmptyString: "allowEmptyString", colorDark: "colorDark", colorLight: "colorLight", cssClass: "cssClass", elementType: "elementType", errorCorrectionLevel: "errorCorrectionLevel", imageSrc: "imageSrc", imageHeight: "imageHeight", imageWidth: "imageWidth", margin: "margin", qrdata: "qrdata", scale: "scale", version: "version", width: "width", alt: "alt", ariaLabel: "ariaLabel", title: "title" }, outputs: { qrCodeURL: "qrCodeURL" }, viewQueries: [{ propertyName: "qrcElement", first: true, predicate: ["qrcElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<div #qrcElement [class]="cssClass"></div>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); } | ||
| static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: QRCodeComponent, deps: [{ token: i0.Renderer2 }, { token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); | ||
| static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.0.0", type: QRCodeComponent, isStandalone: true, selector: "qrcode", inputs: { allowEmptyString: "allowEmptyString", colorDark: "colorDark", colorLight: "colorLight", cssClass: "cssClass", elementType: "elementType", errorCorrectionLevel: "errorCorrectionLevel", imageSrc: "imageSrc", imageHeight: "imageHeight", imageWidth: "imageWidth", margin: "margin", qrdata: "qrdata", scale: "scale", version: "version", width: "width", alt: "alt", ariaLabel: "ariaLabel", title: "title" }, outputs: { qrCodeURL: "qrCodeURL" }, viewQueries: [{ propertyName: "qrcElement", first: true, predicate: ["qrcElement"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: `<div #qrcElement [class]="cssClass"></div>`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); | ||
| } | ||
| i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0", ngImport: i0, type: QRCodeComponent, decorators: [{ | ||
| i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0", ngImport: i0, type: QRCodeComponent, decorators: [{ | ||
| type: Component, | ||
@@ -242,0 +254,0 @@ args: [{ |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"angularx-qrcode.mjs","sources":["../../../projects/angularx-qrcode/src/lib/angularx-qrcode.component.ts","../../../projects/angularx-qrcode/src/public-api.ts","../../../projects/angularx-qrcode/src/angularx-qrcode.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n Renderer2,\n ViewChild,\n} from \"@angular/core\"\nimport { DomSanitizer, SafeUrl } from \"@angular/platform-browser\"\nimport {\n QRCodeRenderersOptions,\n QRCodeToDataURLOptions,\n QRCodeToStringOptions,\n toCanvas,\n toDataURL,\n toString,\n} from \"qrcode\"\nimport {\n QRCodeVersion,\n QRCodeElementType,\n FixMeLater,\n QRCodeConfigType,\n QRCodeErrorCorrectionLevel,\n} from \"./types\"\n\n@Component({\n selector: \"qrcode\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `<div #qrcElement [class]=\"cssClass\"></div>`,\n})\nexport class QRCodeComponent implements OnChanges {\n @Input() public allowEmptyString = false\n @Input() public colorDark = \"#000000ff\"\n @Input() public colorLight = \"#ffffffff\"\n @Input() public cssClass = \"qrcode\"\n @Input() public elementType: QRCodeElementType = \"canvas\"\n @Input()\n public errorCorrectionLevel: QRCodeErrorCorrectionLevel = \"M\"\n @Input() public imageSrc?: string\n @Input() public imageHeight?: number\n @Input() public imageWidth?: number\n @Input() public margin = 4\n @Input() public qrdata = \"\"\n @Input() public scale = 4\n @Input() public version?: QRCodeVersion\n @Input() public width = 10\n\n // Accessibility features introduced in 13.0.4+\n @Input() public alt?: string\n @Input() public ariaLabel?: string\n @Input() public title?: string\n\n @Output() qrCodeURL = new EventEmitter<SafeUrl>()\n\n @ViewChild(\"qrcElement\", { static: true }) public qrcElement!: ElementRef\n\n public context: CanvasRenderingContext2D | null = null\n private centerImage?: HTMLImageElement\n\n constructor(\n private renderer: Renderer2,\n private sanitizer: DomSanitizer\n ) {}\n\n public async ngOnChanges(): Promise<void> {\n await this.createQRCode()\n }\n\n protected isValidQrCodeText(data: string | null): boolean {\n if (this.allowEmptyString === false) {\n return !(\n typeof data === \"undefined\" ||\n data === \"\" ||\n data === \"null\" ||\n data === null\n )\n }\n return !(typeof data === \"undefined\")\n }\n\n private toDataURL(qrCodeConfig: QRCodeToDataURLOptions): Promise<FixMeLater> {\n return new Promise(\n (\n resolve: (arg: FixMeLater) => FixMeLater,\n reject: (arg: FixMeLater) => FixMeLater\n ) => {\n toDataURL(\n this.qrdata,\n qrCodeConfig,\n (err: Error | null | undefined, url: string) => {\n if (err) {\n reject(err)\n } else {\n resolve(url)\n }\n }\n )\n }\n )\n }\n\n private toCanvas(\n canvas: HTMLCanvasElement,\n qrCodeConfig: QRCodeRenderersOptions\n ): Promise<FixMeLater> {\n return new Promise(\n (\n resolve: (arg: FixMeLater) => FixMeLater,\n reject: (arg: FixMeLater) => FixMeLater\n ) => {\n toCanvas(\n canvas,\n this.qrdata,\n qrCodeConfig,\n (error: Error | null | undefined) => {\n if (error) {\n reject(error)\n } else {\n resolve(\"success\")\n }\n }\n )\n }\n )\n }\n\n private toSVG(qrCodeConfig: QRCodeToStringOptions): Promise<FixMeLater> {\n return new Promise(\n (\n resolve: (arg: FixMeLater) => FixMeLater,\n reject: (arg: FixMeLater) => FixMeLater\n ) => {\n toString(\n this.qrdata,\n qrCodeConfig,\n (err: Error | null | undefined, url: string) => {\n if (err) {\n reject(err)\n } else {\n resolve(url)\n }\n }\n )\n }\n )\n }\n\n private renderElement(element: Element): void {\n for (const node of this.qrcElement.nativeElement.childNodes) {\n this.renderer.removeChild(this.qrcElement.nativeElement, node)\n }\n this.renderer.appendChild(this.qrcElement.nativeElement, element)\n }\n\n private async createQRCode(): Promise<void> {\n // Set sensitive defaults\n if (this.version && this.version > 40) {\n console.warn(\"[angularx-qrcode] max value for `version` is 40\")\n this.version = 40\n } else if (this.version && this.version < 1) {\n console.warn(\"[angularx-qrcode]`min value for `version` is 1\")\n this.version = 1\n } else if (this.version !== undefined && isNaN(this.version)) {\n console.warn(\n \"[angularx-qrcode] version should be a number, defaulting to auto.\"\n )\n this.version = undefined\n }\n\n try {\n if (!this.isValidQrCodeText(this.qrdata)) {\n throw new Error(\n \"[angularx-qrcode] Field `qrdata` is empty, set 'allowEmptyString=\\\"true\\\"' to overwrite this behaviour.\"\n )\n }\n\n // This is a workaround to allow an empty string as qrdata\n if (this.isValidQrCodeText(this.qrdata) && this.qrdata === \"\") {\n this.qrdata = \" \"\n }\n\n const config: QRCodeConfigType = {\n color: {\n dark: this.colorDark,\n light: this.colorLight,\n },\n errorCorrectionLevel: this.errorCorrectionLevel,\n margin: this.margin,\n scale: this.scale,\n version: this.version,\n width: this.width,\n }\n\n const centerImageSrc = this.imageSrc\n const centerImageHeight = this.imageHeight || 40\n const centerImageWidth = this.imageWidth || 40\n\n switch (this.elementType) {\n case \"canvas\": {\n const canvasElement: HTMLCanvasElement =\n this.renderer.createElement(\"canvas\")\n this.context = canvasElement.getContext(\"2d\")\n this.toCanvas(canvasElement, config)\n .then(() => {\n if (this.ariaLabel) {\n this.renderer.setAttribute(\n canvasElement,\n \"aria-label\",\n `${this.ariaLabel}`\n )\n }\n if (this.title) {\n this.renderer.setAttribute(\n canvasElement,\n \"title\",\n `${this.title}`\n )\n }\n\n if (centerImageSrc && this.context) {\n this.centerImage = new Image(\n centerImageWidth,\n centerImageHeight\n )\n\n if (centerImageSrc !== this.centerImage.src) {\n this.centerImage.crossOrigin = \"anonymous\"\n this.centerImage.src = centerImageSrc\n }\n\n if (centerImageHeight !== this.centerImage.height) {\n this.centerImage.height = centerImageHeight\n }\n\n if (centerImageWidth !== this.centerImage.width) {\n this.centerImage.width = centerImageWidth\n }\n\n const centerImage = this.centerImage\n\n if (centerImage) {\n centerImage.onload = () => {\n this.context?.drawImage(\n centerImage,\n canvasElement.width / 2 - centerImageWidth / 2,\n canvasElement.height / 2 - centerImageHeight / 2,\n centerImageWidth,\n centerImageHeight\n )\n }\n }\n }\n\n this.renderElement(canvasElement)\n this.emitQRCodeURL(canvasElement as HTMLCanvasElement)\n })\n .catch((e) => {\n console.error(\"[angularx-qrcode] canvas error:\", e)\n })\n break\n }\n case \"svg\": {\n const svgParentElement: HTMLElement =\n this.renderer.createElement(\"div\")\n this.toSVG(config)\n .then((svgString: string) => {\n this.renderer.setProperty(\n svgParentElement,\n \"innerHTML\",\n svgString\n )\n const svgElement = svgParentElement.firstChild as SVGSVGElement\n this.renderer.setAttribute(svgElement, \"height\", `${this.width}`)\n this.renderer.setAttribute(svgElement, \"width\", `${this.width}`)\n this.renderElement(svgElement)\n this.emitQRCodeURL(svgElement)\n })\n .catch((e) => {\n console.error(\"[angularx-qrcode] svg error:\", e)\n })\n break\n }\n case \"url\":\n case \"img\":\n default: {\n const imgElement: HTMLImageElement =\n this.renderer.createElement(\"img\")\n this.toDataURL(config)\n .then((dataUrl: string) => {\n if (this.alt) {\n imgElement.setAttribute(\"alt\", this.alt)\n }\n if (this.ariaLabel) {\n imgElement.setAttribute(\"aria-label\", this.ariaLabel)\n }\n imgElement.setAttribute(\"src\", dataUrl)\n if (this.title) {\n imgElement.setAttribute(\"title\", this.title)\n }\n this.renderElement(imgElement)\n this.emitQRCodeURL(imgElement)\n })\n .catch((e) => {\n console.error(\"[angularx-qrcode] img/url error:\", e)\n })\n }\n }\n } catch (e: FixMeLater) {\n console.error(\"[angularx-qrcode] Error generating QR Code:\", e.message)\n }\n }\n\n convertBase64ImageUrlToBlob(base64ImageUrl: string) {\n // split into two parts\n const parts = base64ImageUrl.split(\";base64,\")\n // hold the content/mime type f.e. image/png\n const imageType = parts[0].split(\":\")[1]\n // decode base64 string\n const decodedData = atob(parts[1])\n // create unit8array of size same as row data length\n const uInt8Array = new Uint8Array(decodedData.length)\n // insert all character code into uint8array\n for (let i = 0; i < decodedData.length; ++i) {\n uInt8Array[i] = decodedData.charCodeAt(i)\n }\n // return blob image after conversion\n return new Blob([uInt8Array], { type: imageType })\n }\n\n emitQRCodeURL(element: HTMLCanvasElement | HTMLImageElement | SVGSVGElement) {\n const className = element.constructor.name\n if (className === SVGSVGElement.name) {\n const svgHTML = element.outerHTML\n const blob = new Blob([svgHTML], { type: \"image/svg+xml\" })\n const urlSvg = URL.createObjectURL(blob)\n const urlSanitized = this.sanitizer.bypassSecurityTrustUrl(urlSvg)\n this.qrCodeURL.emit(urlSanitized)\n return\n }\n\n let urlImage = \"\"\n\n if (className === HTMLCanvasElement.name) {\n urlImage = (element as HTMLCanvasElement).toDataURL(\"image/png\")\n }\n\n if (className === HTMLImageElement.name) {\n urlImage = (element as HTMLImageElement).src\n }\n\n const blobData: Blob = this.convertBase64ImageUrlToBlob(urlImage)\n const urlBlob = URL.createObjectURL(blobData)\n const urlSanitized = this.sanitizer.bypassSecurityTrustUrl(urlBlob)\n this.qrCodeURL.emit(urlSanitized)\n }\n}\n","/*\n * Public API Surface of angularx-qrcode\n */\n\nexport { QRCodeComponent } from \"./lib/angularx-qrcode.component\"\nexport * from \"./lib/types\"\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAiCa,eAAe,CAAA;IA6B1B,WACU,CAAA,QAAmB,EACnB,SAAuB,EAAA;QADvB,IAAQ,CAAA,QAAA,GAAR,QAAQ;QACR,IAAS,CAAA,SAAA,GAAT,SAAS;QA9BH,IAAgB,CAAA,gBAAA,GAAG,KAAK;QACxB,IAAS,CAAA,SAAA,GAAG,WAAW;QACvB,IAAU,CAAA,UAAA,GAAG,WAAW;QACxB,IAAQ,CAAA,QAAA,GAAG,QAAQ;QACnB,IAAW,CAAA,WAAA,GAAsB,QAAQ;QAElD,IAAoB,CAAA,oBAAA,GAA+B,GAAG;QAI7C,IAAM,CAAA,MAAA,GAAG,CAAC;QACV,IAAM,CAAA,MAAA,GAAG,EAAE;QACX,IAAK,CAAA,KAAA,GAAG,CAAC;QAET,IAAK,CAAA,KAAA,GAAG,EAAE;AAOhB,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,YAAY,EAAW;QAI1C,IAAO,CAAA,OAAA,GAAoC,IAAI;;AAQ/C,IAAA,MAAM,WAAW,GAAA;AACtB,QAAA,MAAM,IAAI,CAAC,YAAY,EAAE;;AAGjB,IAAA,iBAAiB,CAAC,IAAmB,EAAA;AAC7C,QAAA,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK,EAAE;AACnC,YAAA,OAAO,EACL,OAAO,IAAI,KAAK,WAAW;AAC3B,gBAAA,IAAI,KAAK,EAAE;AACX,gBAAA,IAAI,KAAK,MAAM;gBACf,IAAI,KAAK,IAAI,CACd;;AAEH,QAAA,OAAO,EAAE,OAAO,IAAI,KAAK,WAAW,CAAC;;AAG/B,IAAA,SAAS,CAAC,YAAoC,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,CAAA;sBAA1B;gBAEM,oBAAoB,EAAA,CAAA;sBAD1B;gBAEe,QAAQ,EAAA,CAAA;sBAAvB;gBACe,WAAW,EAAA,CAAA;sBAA1B;gBACe,UAAU,EAAA,CAAA;sBAAzB;gBACe,MAAM,EAAA,CAAA;sBAArB;gBACe,MAAM,EAAA,CAAA;sBAArB;gBACe,KAAK,EAAA,CAAA;sBAApB;gBACe,OAAO,EAAA,CAAA;sBAAtB;gBACe,KAAK,EAAA,CAAA;sBAApB;gBAGe,GAAG,EAAA,CAAA;sBAAlB;gBACe,SAAS,EAAA,CAAA;sBAAxB;gBACe,KAAK,EAAA,CAAA;sBAApB;gBAES,SAAS,EAAA,CAAA;sBAAlB;gBAEiD,UAAU,EAAA,CAAA;sBAA3D,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,YAAY,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;ACzD3C;;AAEG;;ACFH;;AAEG;;;;"} | ||
| {"version":3,"file":"angularx-qrcode.mjs","sources":["../../../projects/angularx-qrcode/src/lib/angularx-qrcode.component.ts","../../../projects/angularx-qrcode/src/public-api.ts","../../../projects/angularx-qrcode/src/angularx-qrcode.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n EventEmitter,\n Input,\n OnChanges,\n Output,\n Renderer2,\n ViewChild,\n} from \"@angular/core\"\nimport { DomSanitizer, SafeUrl } from \"@angular/platform-browser\"\nimport {\n QRCodeRenderersOptions,\n QRCodeToDataURLOptions,\n QRCodeToStringOptions,\n toCanvas,\n toDataURL,\n toString,\n} from \"qrcode\"\nimport {\n QRCodeVersion,\n QRCodeElementType,\n FixMeLater,\n QRCodeConfigType,\n QRCodeErrorCorrectionLevel,\n} from \"./types\"\n\n@Component({\n selector: \"qrcode\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `<div #qrcElement [class]=\"cssClass\"></div>`,\n})\nexport class QRCodeComponent implements OnChanges {\n @Input() public allowEmptyString = false\n @Input() public colorDark = \"#000000ff\"\n @Input() public colorLight = \"#ffffffff\"\n @Input() public cssClass = \"qrcode\"\n @Input() public elementType: QRCodeElementType = \"canvas\"\n @Input()\n public errorCorrectionLevel: QRCodeErrorCorrectionLevel = \"M\"\n @Input() public imageSrc?: string\n @Input() public imageHeight?: number\n @Input() public imageWidth?: number\n @Input() public margin = 4\n @Input() public qrdata = \"\"\n @Input() public scale = 4\n @Input() public version?: QRCodeVersion\n @Input() public width = 10\n\n // Accessibility features introduced in 13.0.4+\n @Input() public alt?: string\n @Input() public ariaLabel?: string\n @Input() public title?: string\n\n @Output() qrCodeURL = new EventEmitter<SafeUrl>()\n\n @ViewChild(\"qrcElement\", { static: true }) public qrcElement!: ElementRef\n\n public context: CanvasRenderingContext2D | null = null\n private centerImage?: HTMLImageElement\n\n constructor(\n private renderer: Renderer2,\n private sanitizer: DomSanitizer\n ) {}\n\n public async ngOnChanges(): Promise<void> {\n await this.createQRCode()\n }\n\n protected isValidQrCodeText(data: string | null): boolean {\n if (this.allowEmptyString === false) {\n return !(\n typeof data === \"undefined\" ||\n data === \"\" ||\n data === \"null\" ||\n data === null\n )\n }\n return !(typeof data === \"undefined\")\n }\n\n private toDataURL(qrCodeConfig: QRCodeToDataURLOptions): Promise<FixMeLater> {\n return new Promise(\n (\n resolve: (arg: FixMeLater) => FixMeLater,\n reject: (arg: FixMeLater) => FixMeLater\n ) => {\n toDataURL(\n this.qrdata,\n qrCodeConfig,\n (err: Error | null | undefined, url: string) => {\n if (err) {\n reject(err)\n } else {\n resolve(url)\n }\n }\n )\n }\n )\n }\n\n private toCanvas(\n canvas: HTMLCanvasElement,\n qrCodeConfig: QRCodeRenderersOptions\n ): Promise<FixMeLater> {\n return new Promise(\n (\n resolve: (arg: FixMeLater) => FixMeLater,\n reject: (arg: FixMeLater) => FixMeLater\n ) => {\n toCanvas(\n canvas,\n this.qrdata,\n qrCodeConfig,\n (error: Error | null | undefined) => {\n if (error) {\n reject(error)\n } else {\n resolve(\"success\")\n }\n }\n )\n }\n )\n }\n\n private toSVG(qrCodeConfig: QRCodeToStringOptions): Promise<FixMeLater> {\n return new Promise(\n (\n resolve: (arg: FixMeLater) => FixMeLater,\n reject: (arg: FixMeLater) => FixMeLater\n ) => {\n toString(\n this.qrdata,\n qrCodeConfig,\n (err: Error | null | undefined, url: string) => {\n if (err) {\n reject(err)\n } else {\n resolve(url)\n }\n }\n )\n }\n )\n }\n\n private renderElement(element: Element): void {\n for (const node of this.qrcElement.nativeElement.childNodes) {\n this.renderer.removeChild(this.qrcElement.nativeElement, node)\n }\n this.renderer.appendChild(this.qrcElement.nativeElement, element)\n }\n\n private async createQRCode(): Promise<void> {\n // Set sensitive defaults\n if (this.version && this.version > 40) {\n console.warn(\"[angularx-qrcode] max value for `version` is 40\")\n this.version = 40\n } else if (this.version && this.version < 1) {\n console.warn(\"[angularx-qrcode]`min value for `version` is 1\")\n this.version = 1\n } else if (this.version !== undefined && isNaN(this.version)) {\n console.warn(\n \"[angularx-qrcode] version should be a number, defaulting to auto.\"\n )\n this.version = undefined\n }\n\n try {\n if (!this.isValidQrCodeText(this.qrdata)) {\n throw new Error(\n \"[angularx-qrcode] Field `qrdata` is empty, set 'allowEmptyString=\\\"true\\\"' to overwrite this behaviour.\"\n )\n }\n\n // This is a workaround to allow an empty string as qrdata\n if (this.isValidQrCodeText(this.qrdata) && this.qrdata === \"\") {\n this.qrdata = \" \"\n }\n\n const config: QRCodeConfigType = {\n color: {\n dark: this.colorDark,\n light: this.colorLight,\n },\n errorCorrectionLevel: this.errorCorrectionLevel,\n margin: this.margin,\n scale: this.scale,\n version: this.version,\n width: this.width,\n }\n\n const centerImageSrc = this.imageSrc\n const centerImageHeight = this.imageHeight || 40\n const centerImageWidth = this.imageWidth || 40\n\n switch (this.elementType) {\n case \"canvas\": {\n const canvasElement: HTMLCanvasElement =\n this.renderer.createElement(\"canvas\")\n this.context = canvasElement.getContext(\"2d\")\n this.toCanvas(canvasElement, config)\n .then(() => {\n if (this.ariaLabel) {\n this.renderer.setAttribute(\n canvasElement,\n \"aria-label\",\n `${this.ariaLabel}`\n )\n }\n if (this.title) {\n this.renderer.setAttribute(\n canvasElement,\n \"title\",\n `${this.title}`\n )\n }\n\n if (centerImageSrc && this.context) {\n this.centerImage = new Image(\n centerImageWidth,\n centerImageHeight\n )\n\n if (centerImageSrc !== this.centerImage.src) {\n this.centerImage.crossOrigin = \"anonymous\"\n this.centerImage.src = centerImageSrc\n }\n\n if (centerImageHeight !== this.centerImage.height) {\n this.centerImage.height = centerImageHeight\n }\n\n if (centerImageWidth !== this.centerImage.width) {\n this.centerImage.width = centerImageWidth\n }\n\n const centerImage = this.centerImage\n\n if (centerImage) {\n centerImage.onload = () => {\n this.context?.drawImage(\n centerImage,\n canvasElement.width / 2 - centerImageWidth / 2,\n canvasElement.height / 2 - centerImageHeight / 2,\n centerImageWidth,\n centerImageHeight\n )\n }\n }\n }\n\n this.renderElement(canvasElement)\n this.emitQRCodeURL(canvasElement as HTMLCanvasElement)\n })\n .catch((e) => {\n console.error(\"[angularx-qrcode] canvas error:\", e)\n })\n break\n }\n case \"svg\": {\n const svgParentElement: HTMLElement =\n this.renderer.createElement(\"div\")\n this.toSVG(config)\n .then((svgString: string) => {\n this.renderer.setProperty(\n svgParentElement,\n \"innerHTML\",\n svgString\n )\n const svgElement = svgParentElement.firstChild as SVGSVGElement\n this.renderer.setAttribute(svgElement, \"height\", `${this.width}`)\n this.renderer.setAttribute(svgElement, \"width\", `${this.width}`)\n this.renderElement(svgElement)\n this.emitQRCodeURL(svgElement)\n })\n .catch((e) => {\n console.error(\"[angularx-qrcode] svg error:\", e)\n })\n break\n }\n case \"url\":\n case \"img\":\n default: {\n const imgElement: HTMLImageElement =\n this.renderer.createElement(\"img\")\n this.toDataURL(config)\n .then((dataUrl: string) => {\n if (this.alt) {\n imgElement.setAttribute(\"alt\", this.alt)\n }\n if (this.ariaLabel) {\n imgElement.setAttribute(\"aria-label\", this.ariaLabel)\n }\n imgElement.setAttribute(\"src\", dataUrl)\n if (this.title) {\n imgElement.setAttribute(\"title\", this.title)\n }\n this.renderElement(imgElement)\n this.emitQRCodeURL(imgElement)\n })\n .catch((e) => {\n console.error(\"[angularx-qrcode] img/url error:\", e)\n })\n }\n }\n } catch (e: FixMeLater) {\n console.error(\"[angularx-qrcode] Error generating QR Code:\", e.message)\n }\n }\n\n convertBase64ImageUrlToBlob(base64ImageUrl: string) {\n // split into two parts\n const parts = base64ImageUrl.split(\";base64,\")\n // hold the content/mime type f.e. image/png\n const imageType = parts[0].split(\":\")[1]\n // decode base64 string\n const decodedData = atob(parts[1])\n // create unit8array of size same as row data length\n const uInt8Array = new Uint8Array(decodedData.length)\n // insert all character code into uint8array\n for (let i = 0; i < decodedData.length; ++i) {\n uInt8Array[i] = decodedData.charCodeAt(i)\n }\n // return blob image after conversion\n return new Blob([uInt8Array], { type: imageType })\n }\n\n emitQRCodeURL(element: HTMLCanvasElement | HTMLImageElement | SVGSVGElement) {\n const className = element.constructor.name\n if (className === SVGSVGElement.name) {\n const svgHTML = element.outerHTML\n const blob = new Blob([svgHTML], { type: \"image/svg+xml\" })\n const urlSvg = URL.createObjectURL(blob)\n const urlSanitized = this.sanitizer.bypassSecurityTrustUrl(urlSvg)\n this.qrCodeURL.emit(urlSanitized)\n return\n }\n\n let urlImage = \"\"\n\n if (className === HTMLCanvasElement.name) {\n urlImage = (element as HTMLCanvasElement).toDataURL(\"image/png\")\n }\n\n if (className === HTMLImageElement.name) {\n urlImage = (element as HTMLImageElement).src\n }\n\n const blobData: Blob = this.convertBase64ImageUrlToBlob(urlImage)\n const urlBlob = URL.createObjectURL(blobData)\n const urlSanitized = this.sanitizer.bypassSecurityTrustUrl(urlBlob)\n this.qrCodeURL.emit(urlSanitized)\n }\n}\n","/*\n * Public API Surface of angularx-qrcode\n */\n\nexport { QRCodeComponent } from \"./lib/angularx-qrcode.component\"\nexport * from \"./lib/types\"\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names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A;;sBACA;;sBACA;;sBACA;;sBAGA;;sBACA;;sBACA;;sBAEA;;sBAEA,SAAS;AAAC,gBAAA,IAAA,EAAA,CAAA,YAAY,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;;;ACzD3C;;AAEG;;ACFH;;AAEG;;;;"} |
+3
-3
@@ -1,3 +0,3 @@ | ||
| The MIT License (MIT) | ||
| --------------------- | ||
| ## The MIT License (MIT) | ||
| Copyright (c) 2018 - present Andreas Jacob (Cordobo) | ||
@@ -21,2 +21,2 @@ | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. | ||
| THE SOFTWARE. |
+9
-8
| { | ||
| "name": "angularx-qrcode", | ||
| "version": "20.0.0", | ||
| "version": "21.0.0", | ||
| "author": { | ||
@@ -8,6 +8,7 @@ "name": "Andreas Jacob <andreas@cordobo.de>", | ||
| }, | ||
| "description": "Simple QRCode module generator for Angular 4-20 and Ionic 3-8 using node-qrcode", | ||
| "description": "Simple QRCode module generator for Angular 4-21 and Ionic 3-8 using node-qrcode", | ||
| "license": "MIT", | ||
| "peerDependencies": { | ||
| "@angular/core": "^20.0.0" | ||
| "@angular/common": "^21.0.0", | ||
| "@angular/core": "^21.0.0" | ||
| }, | ||
@@ -20,11 +21,11 @@ "dependencies": { | ||
| "type": "git", | ||
| "url": "https://github.com/cordobo/angularx-qrcode.git" | ||
| "url": "https://github.com/Cordobo/angularx-qrcode" | ||
| }, | ||
| "bugs": { | ||
| "url": "https://github.com/cordobo/angularx-qrcode/issues" | ||
| "url": "https://github.com/Cordobo/angularx-qrcode/issues" | ||
| }, | ||
| "homepage": "https://github.com/cordobo/angularx-qrcode#readme", | ||
| "homepage": "https://github.com/Cordobo/angularx-qrcode", | ||
| "sideEffects": false, | ||
| "module": "fesm2022/angularx-qrcode.mjs", | ||
| "typings": "index.d.ts", | ||
| "typings": "types/angularx-qrcode.d.ts", | ||
| "exports": { | ||
@@ -35,3 +36,3 @@ "./package.json": { | ||
| ".": { | ||
| "types": "./index.d.ts", | ||
| "types": "./types/angularx-qrcode.d.ts", | ||
| "default": "./fesm2022/angularx-qrcode.mjs" | ||
@@ -38,0 +39,0 @@ } |
+22
-20
@@ -5,3 +5,3 @@ # angularx-qrcode - Angular QR Code Generator | ||
| - Compatible with **Angular 20** and **Ionic** | ||
| - Compatible with **Angular 21** and **Ionic** | ||
| - Under active development | ||
@@ -15,3 +15,3 @@ - Standalone component support | ||
| `angularx-qrcode` is compatible with Ionic 3-8 and Angular 4-20 with support for the Ivy compiler. It is a drop-in replacement for the no-longer-maintained angular component ng2-qrcode and based on node-qrcode. | ||
| `angularx-qrcode` is compatible with Ionic 3-8 and Angular 4-21 with support for the Ivy compiler. It is a drop-in replacement for the no-longer-maintained angular component ng2-qrcode and based on node-qrcode. | ||
@@ -28,14 +28,24 @@ - [Installation](#installation) | ||
| **Angular 20 and Ionic with angularx-qrcode 20** | ||
| **Angular 21 and Ionic with angularx-qrcode 21** | ||
| ``` | ||
| ```console | ||
| # npm | ||
| npm install angularx-qrcode --save | ||
| # Or with yarn | ||
| # yarn | ||
| yarn add angularx-qrcode | ||
| # pnpm | ||
| pnpm add angularx-qrcode | ||
| ``` | ||
| **Angular 20 and Ionic with angularx-qrcode 20** | ||
| ```console | ||
| npm install angularx-qrcode@20.0.0 --save | ||
| # Or with yarn | ||
| yarn add angularx-qrcode@20.0.0 | ||
| ``` | ||
| **Angular 19 and Ionic with angularx-qrcode 19** | ||
| ``` | ||
| ```console | ||
| npm install angularx-qrcode@19.0.0 --save | ||
@@ -48,3 +58,3 @@ # Or with yarn | ||
| ``` | ||
| ```console | ||
| npm install angularx-qrcode@18.0.2 --save | ||
@@ -55,10 +65,2 @@ # Or with yarn | ||
| **Angular 17 and Ionic with angularx-qrcode 17** | ||
| ``` | ||
| npm install angularx-qrcode@17.0.1 --save | ||
| # Or with yarn | ||
| yarn add angularx-qrcode@17.0.1 | ||
| ``` | ||
| **All supported angular versions** | ||
@@ -68,2 +70,3 @@ | ||
| | --------------- | ----------------------- | | ||
| | ^21 | ^21.0.0 | | ||
| | ^20 | ^20.0.0 | | ||
@@ -107,4 +110,3 @@ | ^19 | ^19.0.0 | | ||
| ```` | ||
| ``` | ||
| # OLD - angular 18 and older | ||
@@ -117,8 +119,8 @@ # File: app.module.ts | ||
| import { QRCodeComponent } from 'angularx-qrcode'; | ||
| ```` | ||
| ``` | ||
| For more uses with angular 18 and earlier see: [angularx/qrcode as ngModule](https://github.com/Cordobo/angularx-qrcode/tree/18.0.0) | ||
| ### Import the component and add it to your imports section in your main AppComponent: | ||
| ### Import the component and add it to your imports section in your main AppComponent: | ||
| ``` | ||
@@ -125,0 +127,0 @@ // For angular 19, see above for angular 18 and older |
-61
| import * as i0 from '@angular/core'; | ||
| import { OnChanges, EventEmitter, ElementRef, Renderer2 } from '@angular/core'; | ||
| import { SafeUrl, DomSanitizer } from '@angular/platform-browser'; | ||
| type QRCodeErrorCorrectionLevel = "L" | "M" | "Q" | "H" | "low" | "medium" | "quartile" | "high"; | ||
| interface QRCodeConfigType { | ||
| color: { | ||
| dark: string; | ||
| light: string; | ||
| }; | ||
| errorCorrectionLevel: QRCodeErrorCorrectionLevel; | ||
| margin: number; | ||
| scale: number; | ||
| version?: QRCodeVersion; | ||
| width: number; | ||
| } | ||
| type QRCodeElementType = "url" | "img" | "canvas" | "svg"; | ||
| type QRCodeVersion = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40; | ||
| type RGBAColor = `#${string}`; | ||
| type FixMeLater = any; | ||
| declare class QRCodeComponent implements OnChanges { | ||
| private renderer; | ||
| private sanitizer; | ||
| allowEmptyString: boolean; | ||
| colorDark: string; | ||
| colorLight: string; | ||
| cssClass: string; | ||
| elementType: QRCodeElementType; | ||
| errorCorrectionLevel: QRCodeErrorCorrectionLevel; | ||
| imageSrc?: string; | ||
| imageHeight?: number; | ||
| imageWidth?: number; | ||
| margin: number; | ||
| qrdata: string; | ||
| scale: number; | ||
| version?: QRCodeVersion; | ||
| width: number; | ||
| alt?: string; | ||
| ariaLabel?: string; | ||
| title?: string; | ||
| qrCodeURL: EventEmitter<SafeUrl>; | ||
| qrcElement: ElementRef; | ||
| context: CanvasRenderingContext2D | null; | ||
| private centerImage?; | ||
| constructor(renderer: Renderer2, sanitizer: DomSanitizer); | ||
| ngOnChanges(): Promise<void>; | ||
| protected isValidQrCodeText(data: string | null): boolean; | ||
| private toDataURL; | ||
| private toCanvas; | ||
| private toSVG; | ||
| private renderElement; | ||
| private createQRCode; | ||
| convertBase64ImageUrlToBlob(base64ImageUrl: string): Blob; | ||
| emitQRCodeURL(element: HTMLCanvasElement | HTMLImageElement | SVGSVGElement): void; | ||
| static ɵfac: i0.ɵɵFactoryDeclaration<QRCodeComponent, never>; | ||
| static ɵcmp: i0.ɵɵComponentDeclaration<QRCodeComponent, "qrcode", never, { "allowEmptyString": { "alias": "allowEmptyString"; "required": false; }; "colorDark": { "alias": "colorDark"; "required": false; }; "colorLight": { "alias": "colorLight"; "required": false; }; "cssClass": { "alias": "cssClass"; "required": false; }; "elementType": { "alias": "elementType"; "required": false; }; "errorCorrectionLevel": { "alias": "errorCorrectionLevel"; "required": false; }; "imageSrc": { "alias": "imageSrc"; "required": false; }; "imageHeight": { "alias": "imageHeight"; "required": false; }; "imageWidth": { "alias": "imageWidth"; "required": false; }; "margin": { "alias": "margin"; "required": false; }; "qrdata": { "alias": "qrdata"; "required": false; }; "scale": { "alias": "scale"; "required": false; }; "version": { "alias": "version"; "required": false; }; "width": { "alias": "width"; "required": false; }; "alt": { "alias": "alt"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "title": { "alias": "title"; "required": false; }; }, { "qrCodeURL": "qrCodeURL"; }, never, never, true, never>; | ||
| } | ||
| export { QRCodeComponent }; | ||
| export type { FixMeLater, QRCodeConfigType, QRCodeElementType, QRCodeErrorCorrectionLevel, QRCodeVersion, RGBAColor }; |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
48929
0.19%367
3.38%259
0.78%4
33.33%