//#region src/mode.d.ts /** Describes how a segment's data bits are interpreted. Immutable. */ declare class Mode { modeBits: number; private numBitsCharCount; constructor(modeBits: number, numBitsCharCount: [number, number, number]); numCharCountBits(ver: number): number; } //#endregion //#region src/segment.d.ts type bit = number; type byte$1 = number; type int$1 = number; declare class QrSegment { readonly mode: Mode; readonly numChars: int$1; private readonly bitData; static makeBytes(data: Readonly>): QrSegment; static makeNumeric(digits: string): QrSegment; static makeAlphanumeric(text: string): QrSegment; static makeSegments(text: string): Array; static makeEci(assignVal: int$1): QrSegment; static isNumeric(text: string): boolean; static isAlphanumeric(text: string): boolean; constructor(mode: Mode, numChars: int$1, bitData: Array); getData(): Array; static getTotalBits(segs: Readonly>, version: int$1): number; private static toUtf8ByteArray; } //#endregion //#region src/ecc.d.ts type EccValue = { readonly ordinal: number; readonly formatBits: number; }; //#endregion //#region src/qrcodegen.d.ts type byte = number; type int = number; declare class QrCode { readonly version: int; readonly errorCorrectionLevel: EccValue; static encodeText(text: string, ecl: EccValue): QrCode; static encodeBinary(data: Readonly>, ecl: EccValue): QrCode; static encodeSegments(segs: Readonly>, ecl: EccValue, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode; readonly size: int; readonly mask: int; private readonly modules; private readonly isFunction; constructor(version: int, errorCorrectionLevel: EccValue, dataCodewords: Readonly>, msk: int); getModule(x: int, y: int): boolean; private drawFunctionPatterns; private drawFormatBits; private drawVersion; private drawFinderPattern; private drawAlignmentPattern; private setFunctionModule; private addEccAndInterleave; private drawCodewords; private applyMask; private getPenaltyScore; private getAlignmentPatternPositions; private static getNumRawDataModules; private static getNumDataCodewords; private static reedSolomonComputeDivisor; private static reedSolomonComputeRemainder; private static reedSolomonMultiply; private finderPenaltyCountPatterns; private finderPenaltyTerminateAndCount; private finderPenaltyAddHistory; } //#endregion //#region src/index.d.ts type ErrorCorrectionLevel = "L" | "M" | "Q" | "H"; type RenderFunction = (qrcode: QrCode, option: RequiredOption) => HTMLElement; /** 图标配置 */ interface IconOption { /** 图标大小 */ size?: number; /** 图标地址 */ src: string; image?: HTMLImageElement; } /** 二维码渲染的配置项 */ interface QRCodeRenderOption { /** 生成的二维码大小 */ size?: number; /** 二维码渲染的节点 */ el?: HTMLElement | null | string; /** 二维码内容 */ text?: string | null; /** 二维码纠错等级, L(默认)、M、Q、H */ level?: ErrorCorrectionLevel; /** 渲染函数 */ renderFn: RenderFunction; /** 二维码填充颜色 */ fill?: string; /** 二维码背景色 */ background?: string; /** 嵌入图片 */ icon?: IconOption; } type RequiredOption = Required> & Pick; declare function createElement(el?: HTMLElement | null | string, tagName?: string, namespace?: string | null): HTMLElement; /** 渲染二维码到表格 */ declare function renderToTable(qrcode: QrCode, option: RequiredOption): HTMLTableElement; declare function renderToSvg(qrcode: QrCode, option: RequiredOption): HTMLElement; declare function renderToCanvas(qr: QrCode, option: RequiredOption): HTMLCanvasElement; declare function renderToImg(qrcode: QrCode, option: RequiredOption): HTMLImageElement; /** 二维码渲染 */ declare class QRCodeRender { option: RequiredOption; private _defaultOption; constructor(option: QRCodeRenderOption); /** 渲染二维码 */ render(): HTMLElement; /** 批量修改渲染配置 */ setOption(option: Partial): void; /** 修改渲染配置项 */ set(key: K, value: QRCodeRenderOption[K]): void; /** 添加数据并渲染二维码 */ addData(data: string): HTMLElement; /** 重置二维码 */ resetData(data: string): HTMLElement; destroy(): void; } //#endregion export { QRCodeRender, QRCodeRenderOption, createElement, renderToCanvas, renderToImg, renderToSvg, renderToTable };