Initial project upload

This commit is contained in:
Mohamed Mathar Irfan
2026-07-28 17:57:02 +05:30
commit ed6610d5d8
23919 changed files with 3003316 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
import { RequiredOptions } from "./QROptions";
import { QRCode, Gradient, FilterFunction } from "../types";
export default class QRCanvas {
_canvas: HTMLCanvasElement;
_options: RequiredOptions;
_qr?: QRCode;
_image?: HTMLImageElement;
constructor(options: RequiredOptions);
get context(): CanvasRenderingContext2D | null;
get width(): number;
get height(): number;
getCanvas(): HTMLCanvasElement;
clear(): void;
drawQR(qr: QRCode): Promise<void>;
drawBackground(): void;
drawDots(filter?: FilterFunction): void;
drawCorners(filter?: FilterFunction): void;
loadImage(): Promise<void>;
drawImage({ width, height, count, dotSize }: {
width: number;
height: number;
count: number;
dotSize: number;
}): void;
_createGradient({ context, options, additionalRotation, x, y, size }: {
context: CanvasRenderingContext2D;
options: Gradient;
additionalRotation: number;
x: number;
y: number;
size: number;
}): CanvasGradient;
}

View File

@@ -0,0 +1,20 @@
import QRCanvas from "./QRCanvas";
import QRSVG from "./QRSVG";
import { RequiredOptions } from "./QROptions";
import { Extension, QRCode, Options, DownloadOptions } from "../types";
export default class QRCodeStyling {
_options: RequiredOptions;
_container?: HTMLElement;
_canvas?: QRCanvas;
_svg?: QRSVG;
_qr?: QRCode;
_canvasDrawingPromise?: Promise<void>;
_svgDrawingPromise?: Promise<void>;
constructor(options?: Partial<Options>);
static _clearContainer(container?: HTMLElement): void;
_getQRStylingElement(extension?: Extension): Promise<QRCanvas | QRSVG>;
update(options?: Partial<Options>): void;
append(container?: HTMLElement): void;
getRawData(extension?: Extension): Promise<Blob | null>;
download(downloadOptions?: Partial<DownloadOptions> | string): Promise<void>;
}

View File

@@ -0,0 +1,30 @@
import { DotType, Options, TypeNumber, ErrorCorrectionLevel, Mode, DrawType, Gradient } from "../types";
export interface RequiredOptions extends Options {
type: DrawType;
width: number;
height: number;
margin: number;
data: string;
qrOptions: {
typeNumber: TypeNumber;
mode?: Mode;
errorCorrectionLevel: ErrorCorrectionLevel;
};
imageOptions: {
hideBackgroundDots: boolean;
imageSize: number;
crossOrigin?: string;
margin: number;
};
dotsOptions: {
type: DotType;
color: string;
gradient?: Gradient;
};
backgroundOptions: {
color: string;
gradient?: Gradient;
};
}
declare const defaultOptions: RequiredOptions;
export default defaultOptions;

View File

@@ -0,0 +1,38 @@
import { RequiredOptions } from "./QROptions";
import { QRCode, FilterFunction, Gradient } from "../types";
export default class QRSVG {
_element: SVGElement;
_defs: SVGElement;
_dotsClipPath?: SVGElement;
_cornersSquareClipPath?: SVGElement;
_cornersDotClipPath?: SVGElement;
_options: RequiredOptions;
_qr?: QRCode;
_image?: HTMLImageElement;
constructor(options: RequiredOptions);
get width(): number;
get height(): number;
getElement(): SVGElement;
clear(): void;
drawQR(qr: QRCode): Promise<void>;
drawBackground(): void;
drawDots(filter?: FilterFunction): void;
drawCorners(): void;
loadImage(): Promise<void>;
drawImage({ width, height, count, dotSize }: {
width: number;
height: number;
count: number;
dotSize: number;
}): void;
_createColor({ options, color, additionalRotation, x, y, height, width, name }: {
options?: Gradient;
color?: string;
additionalRotation: number;
x: number;
y: number;
height: number;
width: number;
name: string;
}): void;
}