/** * @typedef {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} VERSION_NUM */ /** * @typedef {{ type: "radial-gradient" position: Parameters colorStops: ColorStop[] }} RadialGradient */ /** * @typedef {{ type: "linear-gradient" position: Parameters colorStops: ColorStop[] }} LinearGradient */ /** * @typedef {[number, string]} ColorStop */ /** * @typedef {Object} QrObject * @property {Settings["text"]} text * @property {Settings["ecLevel"]} level * @property {Settings["maxVersion"]} version * @property {number} moduleCount * @property {(row: number, col: number) => boolean} isDark */ /** * @typedef {Object} Settings * @property {VERSION_NUM} Settings.minVersion * @property {VERSION_NUM} Settings.maxVersion * @property {'L' | 'M' | 'Q' | 'H'} Settings.ecLevel - error correction level * @property {number} Settings.left * @property {number} Settings.top * @property {number} Settings.size * @property {string | LinearGradient | RadialGradient} Settings.fill * @property {string | null} Settings.background * @property {string} Settings.text * @property {number} Settings.radius * @property {number} Settings.quiet * @property {string | LinearGradient | RadialGradient | null} Settings.cornerFill - color to fill the corners * @property {string | null} Settings.image - url for the image * @property {string | null} Settings.imageBackground - color settings for the imageBackground * @property {number | null} Settings.imageEcCover - error correction to apply to the image, between 0-1, default is 0.5 * @property {number | null} Settings.imagePadding - padding to apply on the image */ export class QrCreator { /** * @param {Partial} config * @param {HTMLElement} $element * @param {() => void} [callback] */ static render(config: Partial, $element: HTMLElement, callback?: () => void): void; } export default QrCreator; export type VERSION_NUM = 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; export type RadialGradient = { type: "radial-gradient"; position: Parameters; colorStops: ColorStop[]; }; export type LinearGradient = { type: "linear-gradient"; position: Parameters; colorStops: ColorStop[]; }; export type ColorStop = [number, string]; export type QrObject = { text: Settings["text"]; level: Settings["ecLevel"]; version: Settings["maxVersion"]; moduleCount: number; isDark: (row: number, col: number) => boolean; }; export type Settings = { minVersion: VERSION_NUM; maxVersion: VERSION_NUM; /** * - error correction level */ ecLevel: "L" | "M" | "Q" | "H"; left: number; top: number; size: number; fill: string | LinearGradient | RadialGradient; background: string | null; text: string; radius: number; quiet: number; /** * - color to fill the corners */ cornerFill: string | LinearGradient | RadialGradient | null; /** * - url for the image */ image: string | null; /** * - color settings for the imageBackground */ imageBackground: string | null; /** * - error correction to apply to the image, between 0-1, default is 0.5 */ imageEcCover: number | null; /** * - padding to apply on the image */ imagePadding: number | null; };