@lglab/react-qr-code 1.4.9 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +1684 -1317
- package/dist/src/components/background.d.ts +9 -0
- package/dist/src/components/background.d.ts.map +1 -0
- package/dist/src/components/data-modules.d.ts +4 -0
- package/dist/src/components/data-modules.d.ts.map +1 -0
- package/dist/src/components/data-modules.test.d.ts +2 -0
- package/dist/src/components/data-modules.test.d.ts.map +1 -0
- package/dist/src/components/finder-patter-inner.test.d.ts +2 -0
- package/dist/src/components/finder-patter-inner.test.d.ts.map +1 -0
- package/dist/src/components/finder-patter-outer.test.d.ts +2 -0
- package/dist/src/components/finder-patter-outer.test.d.ts.map +1 -0
- package/dist/src/components/finder-patterns-inner.d.ts +4 -0
- package/dist/src/components/finder-patterns-inner.d.ts.map +1 -0
- package/dist/src/components/finder-patterns-outer.d.ts +4 -0
- package/dist/src/components/finder-patterns-outer.d.ts.map +1 -0
- package/dist/src/components/gradient.d.ts +8 -0
- package/dist/src/components/gradient.d.ts.map +1 -0
- package/dist/src/constants.d.ts +74 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/hooks/use-ids.d.ts +5 -0
- package/dist/src/hooks/use-ids.d.ts.map +1 -0
- package/dist/src/hooks/use-qr-code.d.ts +18 -0
- package/dist/src/hooks/use-qr-code.d.ts.map +1 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/lib/qrcodegen/index.d.ts +101 -0
- package/dist/src/lib/qrcodegen/index.d.ts.map +1 -0
- package/dist/src/react-qr-code.d.ts +4 -0
- package/dist/src/react-qr-code.d.ts.map +1 -0
- package/dist/src/react-qr-code.test.d.ts +2 -0
- package/dist/src/react-qr-code.test.d.ts.map +1 -0
- package/dist/src/test/data-modules-neightbours.d.ts +29 -0
- package/dist/src/test/data-modules-neightbours.d.ts.map +1 -0
- package/dist/src/types/lib.d.ts +174 -0
- package/dist/src/types/lib.d.ts.map +1 -0
- package/dist/src/types/utils.d.ts +55 -0
- package/dist/src/types/utils.d.ts.map +1 -0
- package/dist/src/utils/data-modules.d.ts +28 -0
- package/dist/src/utils/data-modules.d.ts.map +1 -0
- package/dist/src/utils/data-modules.test.d.ts +2 -0
- package/dist/src/utils/data-modules.test.d.ts.map +1 -0
- package/dist/src/utils/download.d.ts +4 -0
- package/dist/src/utils/download.d.ts.map +1 -0
- package/dist/src/utils/finder-patterns-inner.d.ts +13 -0
- package/dist/src/utils/finder-patterns-inner.d.ts.map +1 -0
- package/dist/src/utils/finder-patterns-outer.d.ts +18 -0
- package/dist/src/utils/finder-patterns-outer.d.ts.map +1 -0
- package/dist/src/utils/qr-code.d.ts +6 -0
- package/dist/src/utils/qr-code.d.ts.map +1 -0
- package/dist/src/utils/qr-code.test.d.ts +2 -0
- package/dist/src/utils/qr-code.test.d.ts.map +1 -0
- package/dist/src/utils/settings.d.ts +15 -0
- package/dist/src/utils/settings.d.ts.map +1 -0
- package/dist/src/utils/svg.d.ts +13 -0
- package/dist/src/utils/svg.d.ts.map +1 -0
- package/package.json +12 -13
- package/dist/index.d.ts +0 -300
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BackgroundSettings } from '../types/lib';
|
|
2
|
+
interface BackgroundProps {
|
|
3
|
+
background?: BackgroundSettings;
|
|
4
|
+
bgGradientId: string;
|
|
5
|
+
numCells: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const Background: ({ background, bgGradientId, numCells }: BackgroundProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=background.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../../src/components/background.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGtD,UAAU,eAAe;IACvB,UAAU,CAAC,EAAE,kBAAkB,CAAA;IAC/B,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAMD,eAAO,MAAM,UAAU,GAAI,wCAAwC,eAAe,mDA2CjF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-modules.d.ts","sourceRoot":"","sources":["../../../src/components/data-modules.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAA;AAO5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AA6BtD,eAAO,MAAM,WAAW,GAAI,sDAMzB,gBAAgB,KAAG,SAkKrB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-modules.test.d.ts","sourceRoot":"","sources":["../../../src/components/data-modules.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finder-patter-inner.test.d.ts","sourceRoot":"","sources":["../../../src/components/finder-patter-inner.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finder-patter-outer.test.d.ts","sourceRoot":"","sources":["../../../src/components/finder-patter-outer.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FinderPatternsInnerProps } from '../types/utils';
|
|
3
|
+
export declare const FinderPatternsInner: ({ modules, margin, settings, gradient, gradientId, }: FinderPatternsInnerProps) => ReactNode;
|
|
4
|
+
//# sourceMappingURL=finder-patterns-inner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finder-patterns-inner.d.ts","sourceRoot":"","sources":["../../../src/components/finder-patterns-inner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAA;AAS/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAY9D,eAAO,MAAM,mBAAmB,GAAI,sDAMjC,wBAAwB,KAAG,SAwJ7B,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { FinderPatternsOuterProps } from '../types/utils';
|
|
3
|
+
export declare const FinderPatternsOuter: ({ modules, margin, settings, gradient, gradientId, }: FinderPatternsOuterProps) => ReactNode;
|
|
4
|
+
//# sourceMappingURL=finder-patterns-outer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finder-patterns-outer.d.ts","sourceRoot":"","sources":["../../../src/components/finder-patterns-outer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAA;AAO/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAY9D,eAAO,MAAM,mBAAmB,GAAI,sDAMjC,wBAAwB,KAAG,SA6H7B,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GradientSettings } from '../types/lib';
|
|
2
|
+
interface GradientProps {
|
|
3
|
+
gradient?: GradientSettings;
|
|
4
|
+
gradientId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const Gradient: ({ gradient, gradientId }: GradientProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=gradient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gradient.d.ts","sourceRoot":"","sources":["../../../src/components/gradient.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAGpD,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,QAAQ,GAAI,0BAA0B,aAAa,mDA8B/D,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DataModulesStyle, ERROR_LEVEL_MAPPED_TYPE, ErrorCorrectionLevel, FinderPatternInnerStyle, FinderPatternOuterStyle } from './types/lib';
|
|
2
|
+
/**
|
|
3
|
+
* Error correction level map.
|
|
4
|
+
*/
|
|
5
|
+
export declare const ERROR_LEVEL_MAP: ERROR_LEVEL_MAPPED_TYPE;
|
|
6
|
+
/**
|
|
7
|
+
* Default values.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_SIZE = 128;
|
|
10
|
+
export declare const DEFAULT_LEVEL: ErrorCorrectionLevel;
|
|
11
|
+
export declare const DEFAULT_BGCOLOR = "#FFFFFF";
|
|
12
|
+
export declare const DEFAULT_MINVERSION = 1;
|
|
13
|
+
export declare const DEFAULT_MARGIN_SIZE = 4;
|
|
14
|
+
export declare const DEFAULT_NUM_STAR_POINTS = 5;
|
|
15
|
+
export declare const DEFAULT_DATA_MODULES_COLOR = "#000000";
|
|
16
|
+
export declare const DEFAULT_FINDER_PATTERN_OUTER_STYLE: FinderPatternOuterStyle;
|
|
17
|
+
export declare const DEFAULT_FINDER_PATTERN_INNER_STYLE: FinderPatternInnerStyle;
|
|
18
|
+
export declare const DEFAULT_DATA_MODULES_STYLE: DataModulesStyle;
|
|
19
|
+
export declare const CIRCUIT_BOARD_LINE_WIDTH = 0.5;
|
|
20
|
+
export declare const CIRCUIT_BOARD_PAD_RADIUS = 0.5;
|
|
21
|
+
export declare const DEFAULT_FILENAME = "react-qr-code";
|
|
22
|
+
export declare const GRADIENT_ID = "react-qr-code-gradient";
|
|
23
|
+
export declare const BG_GRADIENT_ID = "react-qr-code-bg-gradient";
|
|
24
|
+
export declare const DEFAULT_IMG_SCALE = 0.1;
|
|
25
|
+
/**
|
|
26
|
+
* Finder pattern.
|
|
27
|
+
*/
|
|
28
|
+
export declare const FINDER_PATTERN_SIZE = 7;
|
|
29
|
+
export declare const FINDER_PATTERN_INNER_SIZE = 3;
|
|
30
|
+
export declare const FINDER_PATTERN_OUTER_MASK: number[][];
|
|
31
|
+
export declare const FINDER_PATTERN_OUTER_ROTATIONS: {
|
|
32
|
+
'inpoint-sm': number[];
|
|
33
|
+
inpoint: number[];
|
|
34
|
+
'inpoint-lg': number[];
|
|
35
|
+
'outpoint-sm': number[];
|
|
36
|
+
outpoint: number[];
|
|
37
|
+
'outpoint-lg': number[];
|
|
38
|
+
'leaf-sm': number[];
|
|
39
|
+
leaf: number[];
|
|
40
|
+
'leaf-lg': number[];
|
|
41
|
+
};
|
|
42
|
+
export declare const FINDER_PATTERN_OUTER_RADIUSES: {
|
|
43
|
+
'rounded-sm': number;
|
|
44
|
+
rounded: number;
|
|
45
|
+
'rounded-lg': number;
|
|
46
|
+
'leaf-sm': number;
|
|
47
|
+
leaf: number;
|
|
48
|
+
'leaf-lg': number;
|
|
49
|
+
'inpoint-sm': number;
|
|
50
|
+
inpoint: number;
|
|
51
|
+
'inpoint-lg': number;
|
|
52
|
+
'outpoint-sm': number;
|
|
53
|
+
outpoint: number;
|
|
54
|
+
'outpoint-lg': number;
|
|
55
|
+
};
|
|
56
|
+
export declare const FINDER_PATTERN_INNER_RADIUSES: {
|
|
57
|
+
square: number;
|
|
58
|
+
diamond: number;
|
|
59
|
+
circle: number;
|
|
60
|
+
'rounded-sm': number;
|
|
61
|
+
rounded: number;
|
|
62
|
+
'rounded-lg': number;
|
|
63
|
+
'leaf-sm': number;
|
|
64
|
+
leaf: number;
|
|
65
|
+
'leaf-lg': number;
|
|
66
|
+
'inpoint-sm': number;
|
|
67
|
+
inpoint: number;
|
|
68
|
+
'inpoint-lg': number;
|
|
69
|
+
'outpoint-sm': number;
|
|
70
|
+
outpoint: number;
|
|
71
|
+
'outpoint-lg': number;
|
|
72
|
+
};
|
|
73
|
+
export declare const FINDER_PATTERN_INNER_MASK: number[][];
|
|
74
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-ids.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-ids.tsx"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;CAOlB,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as qrcodegen } from '../lib/qrcodegen';
|
|
2
|
+
import { ErrorCorrectionLevel, ImageSettings } from '../types/lib';
|
|
3
|
+
export declare const useQRCode: ({ value, level, minVersion, marginSize, imageSettings, size, boostLevel, }: {
|
|
4
|
+
value: string | string[];
|
|
5
|
+
level: ErrorCorrectionLevel;
|
|
6
|
+
minVersion: number;
|
|
7
|
+
marginSize?: number;
|
|
8
|
+
imageSettings?: ImageSettings;
|
|
9
|
+
size: number;
|
|
10
|
+
boostLevel?: boolean;
|
|
11
|
+
}) => {
|
|
12
|
+
qrcode: qrcodegen.QrCode;
|
|
13
|
+
margin: number;
|
|
14
|
+
cells: boolean[][];
|
|
15
|
+
numCells: number;
|
|
16
|
+
calculatedImageSettings: import('../types/utils').CalculatedImageSettings | null;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=use-qr-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-qr-code.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-qr-code.tsx"],"names":[],"mappings":"AAGA,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGvE,eAAO,MAAM,SAAS,GAAI,4EAQvB;IACD,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACxB,KAAK,EAAE,oBAAoB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;;;;;;CAsCA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license QR Code generator library (TypeScript)
|
|
3
|
+
* Copyright (c) Project Nayuki.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
declare namespace qrcodegen {
|
|
7
|
+
type bit = number;
|
|
8
|
+
type byte = number;
|
|
9
|
+
type int = number;
|
|
10
|
+
export class QrCode {
|
|
11
|
+
readonly version: int;
|
|
12
|
+
readonly errorCorrectionLevel: QrCode.Ecc;
|
|
13
|
+
static encodeText(text: string, ecl: QrCode.Ecc): QrCode;
|
|
14
|
+
static encodeBinary(data: Readonly<Array<byte>>, ecl: QrCode.Ecc): QrCode;
|
|
15
|
+
static encodeSegments(segs: Readonly<Array<QrSegment>>, ecl: QrCode.Ecc, minVersion?: int, maxVersion?: int, mask?: int, boostEcl?: boolean): QrCode;
|
|
16
|
+
readonly size: int;
|
|
17
|
+
readonly mask: int;
|
|
18
|
+
private readonly modules;
|
|
19
|
+
private readonly isFunction;
|
|
20
|
+
constructor(version: int, errorCorrectionLevel: QrCode.Ecc, dataCodewords: Readonly<Array<byte>>, msk: int);
|
|
21
|
+
getModule(x: int, y: int): boolean;
|
|
22
|
+
getModules(): boolean[][];
|
|
23
|
+
private drawFunctionPatterns;
|
|
24
|
+
private drawFormatBits;
|
|
25
|
+
private drawVersion;
|
|
26
|
+
private drawFinderPattern;
|
|
27
|
+
private drawAlignmentPattern;
|
|
28
|
+
private setFunctionModule;
|
|
29
|
+
private addEccAndInterleave;
|
|
30
|
+
private drawCodewords;
|
|
31
|
+
private applyMask;
|
|
32
|
+
private getPenaltyScore;
|
|
33
|
+
private getAlignmentPatternPositions;
|
|
34
|
+
private static getNumRawDataModules;
|
|
35
|
+
private static getNumDataCodewords;
|
|
36
|
+
private static reedSolomonComputeDivisor;
|
|
37
|
+
private static reedSolomonComputeRemainder;
|
|
38
|
+
private static reedSolomonMultiply;
|
|
39
|
+
private finderPenaltyCountPatterns;
|
|
40
|
+
private finderPenaltyTerminateAndCount;
|
|
41
|
+
private finderPenaltyAddHistory;
|
|
42
|
+
static readonly MIN_VERSION: int;
|
|
43
|
+
static readonly MAX_VERSION: int;
|
|
44
|
+
private static readonly PENALTY_N1;
|
|
45
|
+
private static readonly PENALTY_N2;
|
|
46
|
+
private static readonly PENALTY_N3;
|
|
47
|
+
private static readonly PENALTY_N4;
|
|
48
|
+
private static readonly ECC_CODEWORDS_PER_BLOCK;
|
|
49
|
+
private static readonly NUM_ERROR_CORRECTION_BLOCKS;
|
|
50
|
+
}
|
|
51
|
+
export class QrSegment {
|
|
52
|
+
readonly mode: QrSegment.Mode;
|
|
53
|
+
readonly numChars: int;
|
|
54
|
+
private readonly bitData;
|
|
55
|
+
static makeBytes(data: Readonly<Array<byte>>): QrSegment;
|
|
56
|
+
static makeNumeric(digits: string): QrSegment;
|
|
57
|
+
static makeAlphanumeric(text: string): QrSegment;
|
|
58
|
+
static makeSegments(text: string): Array<QrSegment>;
|
|
59
|
+
static makeEci(assignVal: int): QrSegment;
|
|
60
|
+
static isNumeric(text: string): boolean;
|
|
61
|
+
static isAlphanumeric(text: string): boolean;
|
|
62
|
+
constructor(mode: QrSegment.Mode, numChars: int, bitData: Array<bit>);
|
|
63
|
+
getData(): Array<bit>;
|
|
64
|
+
static getTotalBits(segs: Readonly<Array<QrSegment>>, version: int): number;
|
|
65
|
+
private static toUtf8ByteArray;
|
|
66
|
+
private static readonly NUMERIC_REGEX;
|
|
67
|
+
private static readonly ALPHANUMERIC_REGEX;
|
|
68
|
+
private static readonly ALPHANUMERIC_CHARSET;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
}
|
|
72
|
+
declare namespace qrcodegen.QrCode {
|
|
73
|
+
type int = number;
|
|
74
|
+
export class Ecc {
|
|
75
|
+
readonly ordinal: int;
|
|
76
|
+
readonly formatBits: int;
|
|
77
|
+
static readonly LOW: Ecc;
|
|
78
|
+
static readonly MEDIUM: Ecc;
|
|
79
|
+
static readonly QUARTILE: Ecc;
|
|
80
|
+
static readonly HIGH: Ecc;
|
|
81
|
+
private constructor();
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
84
|
+
}
|
|
85
|
+
declare namespace qrcodegen.QrSegment {
|
|
86
|
+
type int = number;
|
|
87
|
+
export class Mode {
|
|
88
|
+
readonly modeBits: int;
|
|
89
|
+
private readonly numBitsCharCount;
|
|
90
|
+
static readonly NUMERIC: Mode;
|
|
91
|
+
static readonly ALPHANUMERIC: Mode;
|
|
92
|
+
static readonly BYTE: Mode;
|
|
93
|
+
static readonly KANJI: Mode;
|
|
94
|
+
static readonly ECI: Mode;
|
|
95
|
+
private constructor();
|
|
96
|
+
numCharCountBits(ver: int): int;
|
|
97
|
+
}
|
|
98
|
+
export {};
|
|
99
|
+
}
|
|
100
|
+
export default qrcodegen;
|
|
101
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/qrcodegen/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,kBAAU,SAAS,CAAC;IAClB,KAAK,GAAG,GAAG,MAAM,CAAA;IACjB,KAAK,IAAI,GAAG,MAAM,CAAA;IAClB,KAAK,GAAG,GAAG,MAAM,CAAA;IAoBjB,MAAM,OAAO,MAAM;iBAkIC,OAAO,EAAE,GAAG;iBAGZ,oBAAoB,EAAE,MAAM,CAAC,GAAG;eA7HpC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,GAAG,MAAM;eASjD,YAAY,CAAC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,EAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM;QAWlF,OAAO,CAAC,MAAM,CAAC,eAAe;QAgB9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAqB;QAG1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAkC;QAI5E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CACK;KAClD;;CACF;AAID,kBAAU,SAAS,CAAC,MAAM,CAAC;IACzB,KAAK,GAAG,GAAG,MAAM,CAAA;IAKjB,MAAM,OAAO,GAAG;iBAYI,OAAO,EAAE,GAAG;iBAEZ,UAAU,EAAE,GAAG;QAXjC,gBAAuB,GAAG,MAAgB;QAC1C,gBAAuB,MAAM,MAAgB;QAC7C,gBAAuB,QAAQ,MAAgB;QAC/C,gBAAuB,IAAI,MAAgB;QAI3C,OAAO;KAMR;;CACF;AAID,kBAAU,SAAS,CAAC,SAAS,CAAC;IAC5B,KAAK,GAAG,GAAG,MAAM,CAAA;IAKjB,MAAM,OAAO,IAAI;iBAaG,QAAQ,EAAE,GAAG;QAE7B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;QAZnC,gBAAuB,OAAO,OAA8B;QAC5D,gBAAuB,YAAY,OAA6B;QAChE,gBAAuB,IAAI,OAA6B;QACxD,gBAAuB,KAAK,OAA6B;QACzD,gBAAuB,GAAG,OAA2B;QAIrD,OAAO;QAWA,gBAAgB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG;KAGvC;;CACF;AAGD,eAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactQRCodeProps, ReactQRCodeRef } from './types/lib';
|
|
2
|
+
declare const ReactQRCode: import('react').ForwardRefExoticComponent<Omit<ReactQRCodeProps, "ref"> & import('react').RefAttributes<ReactQRCodeRef>>;
|
|
3
|
+
export { ReactQRCode };
|
|
4
|
+
//# sourceMappingURL=react-qr-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-qr-code.d.ts","sourceRoot":"","sources":["../../src/react-qr-code.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAmB,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIpF,QAAA,MAAM,WAAW,0HA2Gf,CAAA;AAIF,OAAO,EAAE,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-qr-code.test.d.ts","sourceRoot":"","sources":["../../src/react-qr-code.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const dataModulesRoundedNeighbours: (string | {
|
|
2
|
+
left: boolean;
|
|
3
|
+
right: boolean;
|
|
4
|
+
top: boolean;
|
|
5
|
+
bottom: boolean;
|
|
6
|
+
count: number;
|
|
7
|
+
})[][];
|
|
8
|
+
export declare const dataModulesLeafNeighbours: (string | {
|
|
9
|
+
left: boolean;
|
|
10
|
+
right: boolean;
|
|
11
|
+
top: boolean;
|
|
12
|
+
bottom: boolean;
|
|
13
|
+
count: number;
|
|
14
|
+
})[][];
|
|
15
|
+
export declare const dataModulesVerticalLineNeighbours: (string | {
|
|
16
|
+
left: boolean;
|
|
17
|
+
right: boolean;
|
|
18
|
+
top: boolean;
|
|
19
|
+
bottom: boolean;
|
|
20
|
+
count: number;
|
|
21
|
+
})[][];
|
|
22
|
+
export declare const dataModulesHorizontalLineNeighbours: (string | {
|
|
23
|
+
left: boolean;
|
|
24
|
+
right: boolean;
|
|
25
|
+
top: boolean;
|
|
26
|
+
bottom: boolean;
|
|
27
|
+
count: number;
|
|
28
|
+
})[][];
|
|
29
|
+
//# sourceMappingURL=data-modules-neightbours.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-modules-neightbours.d.ts","sourceRoot":"","sources":["../../../src/test/data-modules-neightbours.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B;;;;;;MAyHxC,CAAA;AAED,eAAO,MAAM,yBAAyB;;;;;;MAmDrC,CAAA;AAED,eAAO,MAAM,iCAAiC;;;;;;MAqL7C,CAAA;AAED,eAAO,MAAM,mCAAmC;;;;;;MA6D/C,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { default as qrcodegen } from '../lib/qrcodegen';
|
|
2
|
+
/**
|
|
3
|
+
* qrcodegen
|
|
4
|
+
*/
|
|
5
|
+
export type Modules = ReturnType<qrcodegen.QrCode['getModules']>;
|
|
6
|
+
export type Excavation = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
w: number;
|
|
10
|
+
h: number;
|
|
11
|
+
};
|
|
12
|
+
export type ErrorCorrectionLevel = 'L' | 'M' | 'Q' | 'H';
|
|
13
|
+
export type CrossOrigin = 'anonymous' | 'use-credentials' | '' | undefined;
|
|
14
|
+
export type ERROR_LEVEL_MAPPED_TYPE = {
|
|
15
|
+
[index in ErrorCorrectionLevel]: qrcodegen.QrCode.Ecc;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* ReactQRCode props.
|
|
19
|
+
*/
|
|
20
|
+
export type BackgroundSettings = string | GradientSettings;
|
|
21
|
+
export type GradientSettingsType = 'linear' | 'radial';
|
|
22
|
+
export interface GradientSettingsStop {
|
|
23
|
+
offset: string;
|
|
24
|
+
color: string;
|
|
25
|
+
}
|
|
26
|
+
export interface GradientSettings {
|
|
27
|
+
type: GradientSettingsType;
|
|
28
|
+
stops: GradientSettingsStop[];
|
|
29
|
+
rotation?: number;
|
|
30
|
+
}
|
|
31
|
+
export type DataModulesStyle = 'square' | 'square-sm' | 'pinched-square' | 'rounded' | 'leaf' | 'vertical-line' | 'horizontal-line' | 'circuit-board' | 'circle' | 'diamond' | 'star' | 'heart' | 'hashtag';
|
|
32
|
+
export interface DataModulesSettings {
|
|
33
|
+
color?: string;
|
|
34
|
+
style?: DataModulesStyle;
|
|
35
|
+
randomSize?: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type FinderPatternOuterStyle = 'square' | 'pinched-square' | 'rounded-sm' | 'rounded' | 'rounded-lg' | 'circle' | 'inpoint-sm' | 'inpoint' | 'inpoint-lg' | 'outpoint-sm' | 'outpoint' | 'outpoint-lg' | 'leaf-sm' | 'leaf' | 'leaf-lg';
|
|
38
|
+
export interface FinderPatternOuterSettings {
|
|
39
|
+
color?: string;
|
|
40
|
+
style?: FinderPatternOuterStyle;
|
|
41
|
+
}
|
|
42
|
+
export type FinderPatternInnerStyle = 'square' | 'pinched-square' | 'rounded-sm' | 'rounded' | 'rounded-lg' | 'circle' | 'inpoint-sm' | 'inpoint' | 'inpoint-lg' | 'outpoint-sm' | 'outpoint' | 'outpoint-lg' | 'leaf-sm' | 'leaf' | 'leaf-lg' | 'diamond' | 'star' | 'heart' | 'hashtag' | 'microchip';
|
|
43
|
+
export interface FinderPatternInnerSettings {
|
|
44
|
+
color?: string;
|
|
45
|
+
style?: FinderPatternInnerStyle;
|
|
46
|
+
}
|
|
47
|
+
export type DownloadFileFormat = 'svg' | 'png' | 'jpeg';
|
|
48
|
+
export interface DownloadOptions {
|
|
49
|
+
name?: string;
|
|
50
|
+
format?: DownloadFileFormat;
|
|
51
|
+
size?: number;
|
|
52
|
+
}
|
|
53
|
+
export interface ReactQRCodeRef {
|
|
54
|
+
svg: SVGSVGElement | null;
|
|
55
|
+
download: (options: DownloadOptions) => void;
|
|
56
|
+
}
|
|
57
|
+
export interface ReactQRCodeProps {
|
|
58
|
+
ref?: React.Ref<ReactQRCodeRef>;
|
|
59
|
+
/**
|
|
60
|
+
* The value to encode into the QR Code. An array of strings can be passed in
|
|
61
|
+
* to represent multiple segments to further optimize the QR Code.
|
|
62
|
+
*/
|
|
63
|
+
value: string | string[];
|
|
64
|
+
/**
|
|
65
|
+
* The size, in pixels, to render the QR Code.
|
|
66
|
+
* @defaultValue 128
|
|
67
|
+
*/
|
|
68
|
+
size?: number;
|
|
69
|
+
/**
|
|
70
|
+
* The Error Correction Level to use.
|
|
71
|
+
* @see https://www.qrcode.com/en/about/error_correction.html
|
|
72
|
+
* @defaultValue L
|
|
73
|
+
*/
|
|
74
|
+
level?: ErrorCorrectionLevel;
|
|
75
|
+
/**
|
|
76
|
+
* The number of _modules_ to use for margin. The QR Code specification
|
|
77
|
+
* requires `4`, however you can specify any number. Values will be turned to
|
|
78
|
+
* integers with `Math.floor`.
|
|
79
|
+
* @defaultValue 0
|
|
80
|
+
*/
|
|
81
|
+
marginSize?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The minimum version used when encoding the QR Code. Valid values are 1-40
|
|
84
|
+
* with higher values resulting in more complex QR Codes. The optimal
|
|
85
|
+
* (lowest) version is determined for the `value` provided, using `minVersion`
|
|
86
|
+
* as the lower bound.
|
|
87
|
+
* @defaultValue 1
|
|
88
|
+
*/
|
|
89
|
+
minVersion?: number;
|
|
90
|
+
/**
|
|
91
|
+
* If enabled, the Error Correction Level of the result may be higher than
|
|
92
|
+
* the specified Error Correction Level option if it can be done without
|
|
93
|
+
* increasing the version.
|
|
94
|
+
* @defaultValue true
|
|
95
|
+
*/
|
|
96
|
+
boostLevel?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The QR code background either a hex color or GradientSettings.
|
|
99
|
+
* @defaultValue #FFFFFF
|
|
100
|
+
*/
|
|
101
|
+
background?: BackgroundSettings;
|
|
102
|
+
/**
|
|
103
|
+
* The gradient settings applied to the qr code data modules and finder patterns.
|
|
104
|
+
*/
|
|
105
|
+
gradient?: GradientSettings;
|
|
106
|
+
/**
|
|
107
|
+
* The settings for the data modules.
|
|
108
|
+
*/
|
|
109
|
+
dataModulesSettings?: DataModulesSettings;
|
|
110
|
+
/**
|
|
111
|
+
* The settings for the finder pattern outer modules.
|
|
112
|
+
*/
|
|
113
|
+
finderPatternOuterSettings?: FinderPatternOuterSettings;
|
|
114
|
+
/**
|
|
115
|
+
* The settings for the finder pattern outer modules.
|
|
116
|
+
*/
|
|
117
|
+
finderPatternInnerSettings?: FinderPatternInnerSettings;
|
|
118
|
+
/**
|
|
119
|
+
* The settings for the embedded image.
|
|
120
|
+
*/
|
|
121
|
+
imageSettings?: ImageSettings;
|
|
122
|
+
/**
|
|
123
|
+
* Optional props to pass to the SVG element.
|
|
124
|
+
*/
|
|
125
|
+
svgProps?: React.SVGProps<SVGSVGElement>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Image settings for the QR Code.
|
|
129
|
+
*/
|
|
130
|
+
export interface ImageSettings {
|
|
131
|
+
/**
|
|
132
|
+
* The URI of the embedded image.
|
|
133
|
+
*/
|
|
134
|
+
src: string;
|
|
135
|
+
/**
|
|
136
|
+
* The height, in pixels, of the image.
|
|
137
|
+
*/
|
|
138
|
+
height: number;
|
|
139
|
+
/**
|
|
140
|
+
* The width, in pixels, of the image.
|
|
141
|
+
*/
|
|
142
|
+
width: number;
|
|
143
|
+
/**
|
|
144
|
+
* Whether or not to "excavate" the modules around the embedded image. This
|
|
145
|
+
* means that any modules the embedded image overlaps will use the background
|
|
146
|
+
* color.
|
|
147
|
+
*/
|
|
148
|
+
excavate?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* The horiztonal offset of the embedded image, starting from the top left corner.
|
|
151
|
+
* Will center if not specified.
|
|
152
|
+
*/
|
|
153
|
+
x?: number;
|
|
154
|
+
/**
|
|
155
|
+
* The vertical offset of the embedded image, starting from the top left corner.
|
|
156
|
+
* Will center if not specified.
|
|
157
|
+
*/
|
|
158
|
+
y?: number;
|
|
159
|
+
/**
|
|
160
|
+
* The opacity of the embedded image in the range of 0-1.
|
|
161
|
+
* @defaultValue 1
|
|
162
|
+
*/
|
|
163
|
+
opacity?: number;
|
|
164
|
+
/**
|
|
165
|
+
* The cross-origin value to use when loading the image. This is used to
|
|
166
|
+
* ensure compatibility with CORS, particularly when extracting image data
|
|
167
|
+
* from QRCodeCanvas.
|
|
168
|
+
* Note: `undefined` is treated differently than the seemingly equivalent
|
|
169
|
+
* empty string. This is intended to align with HTML behavior where omitting
|
|
170
|
+
* the attribute behaves differently than the empty string.
|
|
171
|
+
*/
|
|
172
|
+
crossOrigin?: CrossOrigin;
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/types/lib.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,kBAAkB,CAAA;AAE7C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAA;AAChE,MAAM,MAAM,UAAU,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACvE,MAAM,MAAM,oBAAoB,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAA;AACxD,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,iBAAiB,GAAG,EAAE,GAAG,SAAS,CAAA;AAE1E,MAAM,MAAM,uBAAuB,GAAG;KACnC,KAAK,IAAI,oBAAoB,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG;CACtD,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,gBAAgB,CAAA;AAE1D,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,QAAQ,CAAA;AACtD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd;AACD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,oBAAoB,CAAA;IAC1B,KAAK,EAAE,oBAAoB,EAAE,CAAA;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAA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E,MAAM,CAAA;IACV;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { CrossOrigin, DataModulesSettings, DownloadFileFormat, Excavation, FinderPatternInnerSettings, FinderPatternOuterSettings, GradientSettings, ImageSettings, Modules } from './lib';
|
|
3
|
+
export interface FilterFnProps {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
numCells: number;
|
|
7
|
+
}
|
|
8
|
+
export interface GeneratePathFnProps {
|
|
9
|
+
modules: Modules;
|
|
10
|
+
margin: number;
|
|
11
|
+
gradient?: GradientSettings;
|
|
12
|
+
gradientId: string;
|
|
13
|
+
}
|
|
14
|
+
export interface FinderPatternsOuterProps extends GeneratePathFnProps {
|
|
15
|
+
settings?: FinderPatternOuterSettings;
|
|
16
|
+
}
|
|
17
|
+
export interface FinderPatternsInnerProps extends GeneratePathFnProps {
|
|
18
|
+
settings?: FinderPatternInnerSettings;
|
|
19
|
+
}
|
|
20
|
+
export interface DataModulesProps extends GeneratePathFnProps {
|
|
21
|
+
settings?: DataModulesSettings;
|
|
22
|
+
}
|
|
23
|
+
export interface DataModulesNeighbours {
|
|
24
|
+
left: boolean;
|
|
25
|
+
right: boolean;
|
|
26
|
+
top: boolean;
|
|
27
|
+
bottom: boolean;
|
|
28
|
+
count: number;
|
|
29
|
+
}
|
|
30
|
+
export interface DownloadSVGProps {
|
|
31
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
32
|
+
fileSize: number;
|
|
33
|
+
fileName: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DownloadRasterProps {
|
|
36
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
37
|
+
fileSize: number;
|
|
38
|
+
fileName: string;
|
|
39
|
+
imageSettings: ImageSettings | undefined;
|
|
40
|
+
calculatedImageSettings: CalculatedImageSettings | null;
|
|
41
|
+
fileFormat: DownloadFileFormat;
|
|
42
|
+
size: number;
|
|
43
|
+
numCells: number;
|
|
44
|
+
margin: number;
|
|
45
|
+
}
|
|
46
|
+
export interface CalculatedImageSettings {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
h: number;
|
|
50
|
+
w: number;
|
|
51
|
+
excavation: Excavation | null;
|
|
52
|
+
opacity: number;
|
|
53
|
+
crossOrigin: CrossOrigin;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,0BAA0B,EAC1B,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACb,OAAO,EACR,MAAM,OAAO,CAAA;AAEd,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,QAAQ,CAAC,EAAE,0BAA0B,CAAA;CACtC;AAED,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;IACnE,QAAQ,CAAC,EAAE,0BAA0B,CAAA;CACtC;AAED,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,QAAQ,CAAC,EAAE,mBAAmB,CAAA;CAC/B;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;IACd,GAAG,EAAE,OAAO,CAAA;IACZ,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;IACvC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAA;IACxC,uBAAuB,EAAE,uBAAuB,GAAG,IAAI,CAAA;IACvD,UAAU,EAAE,kBAAkB,CAAA;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,UAAU,EAAE,UAAU,GAAG,IAAI,CAAA;IAC7B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,WAAW,CAAA;CACzB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DataModulesStyle, Modules } from '../types/lib';
|
|
2
|
+
import { DataModulesNeighbours } from '../types/utils';
|
|
3
|
+
export declare const dataModuleCanBeRandomSize: (style: DataModulesStyle) => boolean;
|
|
4
|
+
export declare const getScaleFactor: (style: string, isRandom: boolean) => number;
|
|
5
|
+
export declare const getModuleNeighbours: (x: number, y: number, modules: Modules) => DataModulesNeighbours;
|
|
6
|
+
export declare const isRenderableDataModule: ({ x, y, modules, numCells, }: {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
modules: Modules;
|
|
10
|
+
numCells: number;
|
|
11
|
+
}) => boolean;
|
|
12
|
+
export declare const getRenderableDataModuleNeighbours: (x: number, y: number, modules: Modules, numCells: number) => DataModulesNeighbours;
|
|
13
|
+
export declare const rect: (x: number, y: number, width: number, height: number) => string;
|
|
14
|
+
export declare const square: (x: number, y: number, size: number) => string;
|
|
15
|
+
export declare const circle: (x: number, y: number, size: number) => string;
|
|
16
|
+
export declare const diamond: (x: number, y: number, size: number) => string;
|
|
17
|
+
export declare const circuitBoardPad: (cx: number, cy: number, radius: number) => string;
|
|
18
|
+
export declare const circuitBoardShouldDrawPad: ({ count }: DataModulesNeighbours) => boolean;
|
|
19
|
+
export declare const topRightRounded: (x: number, y: number) => string;
|
|
20
|
+
export declare const topLeftRounded: (x: number, y: number) => string;
|
|
21
|
+
export declare const bottomRightRounded: (x: number, y: number) => string;
|
|
22
|
+
export declare const bottomLeftRounded: (x: number, y: number) => string;
|
|
23
|
+
export declare const rightRounded: (x: number, y: number) => string;
|
|
24
|
+
export declare const leftRounded: (x: number, y: number) => string;
|
|
25
|
+
export declare const topRounded: (x: number, y: number) => string;
|
|
26
|
+
export declare const bottomRounded: (x: number, y: number) => string;
|
|
27
|
+
export declare const leaf: (x: number, y: number, size: number) => string;
|
|
28
|
+
//# sourceMappingURL=data-modules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-modules.d.ts","sourceRoot":"","sources":["../../../src/utils/data-modules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAI3D,eAAO,MAAM,yBAAyB,GAAI,OAAO,gBAAgB,KAAG,OAO/C,CAAA;AAErB,eAAO,MAAM,c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