Icard/angular-clarity-master(work.../node_modules/angularx-qrcode/fesm2022/angularx-qrcode.mjs.map

1 line
20 KiB
Plaintext
Raw Normal View History

2024-07-16 14:55:36 +00:00
{"version":3,"file":"angularx-qrcode.mjs","sources":["../../../projects/angularx-qrcode/src/lib/angularx-qrcode.component.ts","../../../projects/angularx-qrcode/src/lib/angularx-qrcode.module.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 QRCodeErrorCorrectionLevel,\n QRCodeRenderersOptions,\n QRCodeToDataURLOptions,\n QRCodeToStringOptions,\n toCanvas,\n toDataURL,\n toString,\n} from \"qrcode\"\nimport { QRCodeVersion, QRCodeElementType, FixMeLater } 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(private renderer: Renderer2, private sanitizer: DomSanitizer) {}\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