初始化项目, 添加TDesign等包

This commit is contained in:
zhengw
2025-11-28 16:49:36 +08:00
commit 3e53beb7bb
980 changed files with 39201 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
export declare class Mode {
static readonly NUMERIC: Mode;
static readonly ALPHANUMERIC: Mode;
static readonly BYTE: Mode;
static readonly KANJI: Mode;
static readonly ECI: Mode;
modeBits: number;
private numBitsCharCount;
private constructor();
numCharCountBits(ver: number): number;
}
export declare class Ecc {
static readonly LOW: Ecc;
static readonly MEDIUM: Ecc;
static readonly QUARTILE: Ecc;
static readonly HIGH: Ecc;
ordinal: number;
formatBits: number;
private constructor();
}
export declare class QrSegment {
static makeBytes(data: Readonly<number[]>): QrSegment;
static makeNumeric(digits: string): QrSegment;
static makeAlphanumeric(text: string): QrSegment;
static makeSegments(text: string): QrSegment[];
static makeEci(assignVal: number): QrSegment;
static isNumeric(text: string): boolean;
static isAlphanumeric(text: string): boolean;
mode: Mode;
numChars: number;
private bitData;
constructor(mode: Mode, numChars: number, bitData: number[]);
getData(): number[];
static getTotalBits(segs: Readonly<QrSegment[]>, version: number): number;
private static toUtf8ByteArray;
private static readonly NUMERIC_REGEX;
private static readonly ALPHANUMERIC_REGEX;
private static readonly ALPHANUMERIC_CHARSET;
}
export declare class QrCode {
static encodeText(text: string, ecl: Ecc): QrCode;
static encodeBinary(data: Readonly<number[]>, ecl: Ecc): QrCode;
static encodeSegments(segs: Readonly<QrSegment[]>, oriEcl: Ecc, minVersion?: number, maxVersion?: number, mask?: number, boostEcl?: boolean): QrCode;
readonly size: number;
readonly mask: number;
private readonly modules;
private readonly isFunction;
version: number;
errorCorrectionLevel: Ecc;
constructor(version: number, errorCorrectionLevel: Ecc, dataCodewords: Readonly<number[]>, oriMsk: number);
getModule(x: number, y: number): boolean;
getModules(): 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;
static readonly MIN_VERSION: number;
static readonly MAX_VERSION: number;
private static readonly PENALTY_N1;
private static readonly PENALTY_N2;
private static readonly PENALTY_N3;
private static readonly PENALTY_N4;
private static readonly ECC_CODEWORDS_PER_BLOCK;
private static readonly NUM_ERROR_CORRECTION_BLOCKS;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
import type { Ecc, QrCode } from './qrcodegen';
export declare type Modules = ReturnType<QrCode['getModules']>;
export declare type Excavation = {
x: number;
y: number;
w: number;
h: number;
};
export declare type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
export declare type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
export declare type ERROR_LEVEL_MAPPED_TYPE = {
[index in ErrorCorrectionLevel]: Ecc;
};
export declare type ImageSettings = {
src: string;
height: number;
width: number;
excavate: boolean;
x?: number;
y?: number;
opacity?: number;
crossOrigin?: CrossOrigin;
};

View File

@@ -0,0 +1,24 @@
import type { CrossOrigin, ERROR_LEVEL_MAPPED_TYPE, ErrorCorrectionLevel, Excavation, ImageSettings } from './types';
export declare const ERROR_LEVEL_MAP: ERROR_LEVEL_MAPPED_TYPE;
export declare const DEFAULT_SIZE = 160;
export declare const DEFAULT_LEVEL: ErrorCorrectionLevel;
export declare const DEFAULT_BACKGROUND_COLOR = "#FFFFFF";
export declare const DEFAULT_FRONT_COLOR = "#000000";
export declare const DEFAULT_NEED_MARGIN = false;
export declare const DEFAULT_MINVERSION = 1;
export declare const SPEC_MARGIN_SIZE = 4;
export declare const DEFAULT_MARGIN_SIZE = 0;
export declare const DEFAULT_IMG_SCALE = 0.1;
export declare const generatePath: (modules: boolean[][], margin?: number) => string;
export declare const excavateModules: (modules: boolean[][], excavation: Excavation) => boolean[][];
export declare const getImageSettings: (cells: boolean[][], size: number, margin: number, imageSettings?: ImageSettings) => {
x: number;
y: number;
h: number;
w: number;
excavation: Excavation | null;
opacity: number;
crossOrigin: CrossOrigin;
};
export declare const getMarginSize: (needMargin: boolean, marginSize?: number) => number;
export declare const isSupportPath2d: boolean;

View File

@@ -0,0 +1 @@
import{Ecc}from"./qrcodegen";export const ERROR_LEVEL_MAP={L:Ecc.LOW,M:Ecc.MEDIUM,Q:Ecc.QUARTILE,H:Ecc.HIGH};export const DEFAULT_SIZE=160;export const DEFAULT_LEVEL="M";export const DEFAULT_BACKGROUND_COLOR="#FFFFFF";export const DEFAULT_FRONT_COLOR="#000000";export const DEFAULT_NEED_MARGIN=!1;export const DEFAULT_MINVERSION=1;export const SPEC_MARGIN_SIZE=4;export const DEFAULT_MARGIN_SIZE=0;export const DEFAULT_IMG_SCALE=.1;export const generatePath=(t,o=0)=>{const e=[];return t.forEach((t,n)=>{let r=null;t.forEach((c,l)=>{if(!c&&null!==r)return e.push(`M${r+o} ${n+o}h${l-r}v1H${r+o}z`),void(r=null);if(l!==t.length-1)c&&null===r&&(r=l);else{if(!c)return;null===r?e.push(`M${l+o},${n+o} h1v1H${l+o}z`):e.push(`M${r+o},${n+o} h${l+1-r}v1H${r+o}z`)}})}),e.join("")};export const excavateModules=(t,o)=>t.slice().map((t,e)=>e<o.y||e>=o.y+o.h?t:t.map((t,e)=>(e<o.x||e>=o.x+o.w)&&t));export const getImageSettings=(t,o,e,n)=>{if(null==n)return null;const r=t.length+2*e,c=Math.floor(.1*o),l=r/o,a=(n.width||c)*l,h=(n.height||c)*l,s=null==n.x?t.length/2-a/2:n.x*l,E=null==n.y?t.length/2-h/2:n.y*l,p=null==n.opacity?1:n.opacity;let i=null;if(n.excavate){const t=Math.floor(s),o=Math.floor(E);i={x:t,y:o,w:Math.ceil(a+s-t),h:Math.ceil(h+E-o)}}const{crossOrigin:x}=n;return{x:s,y:E,h:h,w:a,excavation:i,opacity:p,crossOrigin:x}};export const getMarginSize=(t,o)=>null!=o?Math.max(Math.floor(o),0):t?4:0;export const isSupportPath2d=(()=>{try{(new Path2D).addPath(new Path2D)}catch(t){return!1}return!0})();