qr-code-styling
Advanced tools
Comparing version
@@ -1,11 +0,10 @@ | ||
import QRCanvas from "./QRCanvas"; | ||
import QRSVG from "./QRSVG"; | ||
import { RequiredOptions } from "./QROptions"; | ||
import { Extension, QRCode, Options, DownloadOptions } from "../types"; | ||
import { Extension, QRCode, Options, DownloadOptions, ExtensionFunction } from "../types"; | ||
export default class QRCodeStyling { | ||
_options: RequiredOptions; | ||
_container?: HTMLElement; | ||
_canvas?: QRCanvas; | ||
_svg?: QRSVG; | ||
_canvas?: HTMLCanvasElement; | ||
_svg?: SVGElement; | ||
_qr?: QRCode; | ||
_extension?: ExtensionFunction; | ||
_canvasDrawingPromise?: Promise<void>; | ||
@@ -15,7 +14,10 @@ _svgDrawingPromise?: Promise<void>; | ||
static _clearContainer(container?: HTMLElement): void; | ||
_getQRStylingElement(extension?: Extension): Promise<QRCanvas | QRSVG>; | ||
_setupSvg(): void; | ||
_setupCanvas(): void; | ||
_getElement(extension?: Extension): Promise<SVGElement | HTMLCanvasElement | undefined>; | ||
update(options?: Partial<Options>): void; | ||
append(container?: HTMLElement): void; | ||
applyExtension(extension: ExtensionFunction): void; | ||
getRawData(extension?: Extension): Promise<Blob | null>; | ||
download(downloadOptions?: Partial<DownloadOptions> | string): Promise<void>; | ||
} |
@@ -1,4 +0,6 @@ | ||
import { DotType, Options, TypeNumber, ErrorCorrectionLevel, Mode, DrawType, Gradient } from "../types"; | ||
import { ShapeType, DotType, Options, TypeNumber, ErrorCorrectionLevel, Mode, DrawType, Gradient } from "../types"; | ||
export interface RequiredOptions extends Options { | ||
experimental: boolean; | ||
type: DrawType; | ||
shape: ShapeType; | ||
width: number; | ||
@@ -25,2 +27,3 @@ height: number; | ||
backgroundOptions: { | ||
round: number; | ||
color: string; | ||
@@ -27,0 +30,0 @@ gradient?: Gradient; |
@@ -6,2 +6,3 @@ import { RequiredOptions } from "./QROptions"; | ||
_defs: SVGElement; | ||
_backgroundClipPath?: SVGElement; | ||
_dotsClipPath?: SVGElement; | ||
@@ -17,3 +18,2 @@ _cornersSquareClipPath?: SVGElement; | ||
getElement(): SVGElement; | ||
clear(): void; | ||
drawQR(qr: QRCode): Promise<void>; | ||
@@ -29,3 +29,3 @@ drawBackground(): void; | ||
dotSize: number; | ||
}): void; | ||
}): Promise<void>; | ||
_createColor({ options, color, additionalRotation, x, y, height, width, name }: { | ||
@@ -32,0 +32,0 @@ options?: Gradient; |
@@ -10,4 +10,6 @@ import QRCodeStyling from "./core/QRCodeStyling"; | ||
import drawTypes from "./constants/drawTypes"; | ||
import shapeTypes from "./constants/shapeTypes"; | ||
import gradientTypes from "./constants/gradientTypes"; | ||
export * from "./types"; | ||
export { dotTypes, cornerDotTypes, cornerSquareTypes, errorCorrectionLevels, errorCorrectionPercents, modes, qrTypes, drawTypes }; | ||
export { dotTypes, cornerDotTypes, cornerSquareTypes, errorCorrectionLevels, errorCorrectionPercents, modes, qrTypes, drawTypes, shapeTypes, gradientTypes }; | ||
export default QRCodeStyling; |
@@ -10,2 +10,3 @@ export interface UnknownObject { | ||
export declare type DrawType = "canvas" | "svg"; | ||
export declare type ShapeType = "square" | "circle"; | ||
export declare type Gradient = { | ||
@@ -34,2 +35,5 @@ type: GradientType; | ||
} | ||
export interface ShapeTypes { | ||
[key: string]: ShapeType; | ||
} | ||
export declare type TypeNumber = 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; | ||
@@ -56,3 +60,5 @@ export declare type ErrorCorrectionLevel = "L" | "M" | "Q" | "H"; | ||
export declare type Options = { | ||
experimental?: boolean; | ||
type?: DrawType; | ||
shape?: ShapeType; | ||
width?: number; | ||
@@ -90,5 +96,7 @@ height?: number; | ||
backgroundOptions?: { | ||
round?: number; | ||
color?: string; | ||
gradient?: Gradient; | ||
}; | ||
extensionOptions?: any; | ||
}; | ||
@@ -120,11 +128,6 @@ export declare type FilterFunction = (i: number, j: number) => boolean; | ||
}; | ||
export declare type DrawArgsCanvas = DrawArgs & { | ||
context: CanvasRenderingContext2D; | ||
}; | ||
export declare type BasicFigureDrawArgsCanvas = BasicFigureDrawArgs & { | ||
context: CanvasRenderingContext2D; | ||
}; | ||
export declare type RotateFigureArgsCanvas = RotateFigureArgs & { | ||
context: CanvasRenderingContext2D; | ||
}; | ||
export declare type GetNeighbor = (x: number, y: number) => boolean; | ||
export declare type ExtensionFunction = ({ options, svg }: { | ||
options: Options; | ||
svg: SVGElement; | ||
}) => void; |
{ | ||
"name": "qr-code-styling", | ||
"version": "1.5.0", | ||
"version": "1.6.0-rc.0", | ||
"description": "Add a style and an image to your QR code", | ||
@@ -5,0 +5,0 @@ "main": "lib/qr-code-styling.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
261482
-18.48%29
-6.45%558
-18.42%1
Infinity%