qrdx 0.0.1 → 0.0.2-beta.2

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.
Files changed (41) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +2 -2
  4. package/dist/index.mjs.map +1 -1
  5. package/dist/src/constants.d.ts +40 -5
  6. package/dist/src/constants.d.ts.map +1 -1
  7. package/dist/src/corner-dot.d.ts +8 -0
  8. package/dist/src/corner-dot.d.ts.map +1 -1
  9. package/dist/src/corner-eye.d.ts +8 -0
  10. package/dist/src/corner-eye.d.ts.map +1 -1
  11. package/dist/src/helpers.d.ts +7 -32
  12. package/dist/src/helpers.d.ts.map +1 -1
  13. package/dist/src/qr-code.d.ts +5 -16
  14. package/dist/src/qr-code.d.ts.map +1 -1
  15. package/dist/types/common.d.ts +8 -6
  16. package/dist/types/common.d.ts.map +1 -1
  17. package/dist/types/corner-dot.d.ts +9 -2
  18. package/dist/types/corner-dot.d.ts.map +1 -1
  19. package/dist/types/corner-eye.d.ts +9 -2
  20. package/dist/types/corner-eye.d.ts.map +1 -1
  21. package/dist/types/image-pattern.d.ts +12 -1
  22. package/dist/types/image-pattern.d.ts.map +1 -1
  23. package/dist/types/index.d.ts +8 -5
  24. package/dist/types/index.d.ts.map +1 -1
  25. package/dist/types/qr.d.ts +69 -12
  26. package/dist/types/qr.d.ts.map +1 -1
  27. package/dist/types/template.d.ts +16 -8
  28. package/dist/types/template.d.ts.map +1 -1
  29. package/package.json +3 -2
  30. package/src/constants.ts +46 -7
  31. package/src/corner-dot.tsx +9 -45
  32. package/src/corner-eye.ts +18 -84
  33. package/src/helpers.ts +15 -23
  34. package/src/qr-code.tsx +12 -28
  35. package/types/common.ts +12 -1
  36. package/types/corner-dot.ts +7 -6
  37. package/types/corner-eye.ts +7 -6
  38. package/types/image-pattern.ts +7 -1
  39. package/types/index.ts +28 -4
  40. package/types/qr.ts +41 -12
  41. package/types/template.ts +23 -9
@@ -1,15 +1,50 @@
1
+ import type { ErrorLevel } from "../types";
1
2
  import qrcodegen from "./codegen";
2
- export declare const ERROR_LEVEL_MAP: {
3
- [index: string]: qrcodegen.QrCode.Ecc;
4
- };
3
+ /**
4
+ * Mapping of error correction levels to qrcodegen.QrCode.Ecc values
5
+ */
6
+ export declare const ERROR_LEVEL_MAP: Record<ErrorLevel, qrcodegen.QrCode.Ecc>;
7
+ /**
8
+ * Default QR code size in pixels
9
+ */
5
10
  export declare const DEFAULT_SIZE = 128;
6
- export declare const DEFAULT_LEVEL = "Q";
11
+ /**
12
+ * Default error correction level
13
+ */
14
+ export declare const DEFAULT_LEVEL: ErrorLevel;
15
+ /**
16
+ * Default background color
17
+ */
7
18
  export declare const DEFAULT_BGCOLOR = "#FFFFFF";
19
+ /**
20
+ * Default foreground color
21
+ */
8
22
  export declare const DEFAULT_FGCOLOR = "#000000";
23
+ /**
24
+ * Default eye color
25
+ */
9
26
  export declare const DEFAULT_EYECOLOR = "#000000";
27
+ /**
28
+ * Default dot color
29
+ */
10
30
  export declare const DEFAULT_DOTCOLOR = "#000000";
31
+ /**
32
+ * Default margin around the QR code
33
+ */
11
34
  export declare const DEFAULT_MARGIN = 0;
12
- export declare const QR_LEVELS: readonly ["L", "M", "Q", "H"];
35
+ /**
36
+ * Available QR error correction levels
37
+ */
38
+ export declare const QR_LEVELS: readonly ErrorLevel[];
39
+ /**
40
+ * This is *very* rough estimate of max amount of QRCode allowed to be covered.
41
+ * It is "wrong" in a lot of ways (area is a terrible way to estimate, it
42
+ * really should be number of modules covered), but if for some reason we don't
43
+ * get an explicit height or width, I'd rather default to something than throw.
44
+ */
13
45
  export declare const DEFAULT_IMG_SCALE = 0.1;
46
+ /**
47
+ * Default logo URL for QR codes
48
+ */
14
49
  export declare const FLAM_QR_LOGO = "https://instant.flamapp.ai/flogo-qr.svg";
15
50
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,eAAO,MAAM,eAAe,EAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAA;CAKpE,CAAC;AAEF,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,eAAO,MAAM,eAAe,YAAY,CAAC;AACzC,eAAO,MAAM,eAAe,YAAY,CAAC;AACzC,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,eAAO,MAAM,SAAS,+BAAgC,CAAC;AAMvD,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,YAAY,4CAA4C,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAKpE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,UAAgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,eAAe,YAAY,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,UAAU,EAAkC,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,YAAY,4CAA4C,CAAC"}
@@ -1,4 +1,12 @@
1
1
  import type { JSX } from "react";
2
2
  import type { CornerEyeDotPattern } from "../types/corner-dot";
3
+ /**
4
+ * Generate corner dot pattern based on type
5
+ * @param cx - Center X coordinate
6
+ * @param cy - Center Y coordinate
7
+ * @param radius - Radius of the dot
8
+ * @param pattern - Pattern type for the corner dot
9
+ * @returns JSX element representing the pattern
10
+ */
3
11
  export declare function generateCornerDotPath(cx: number, cy: number, radius: number, pattern?: CornerEyeDotPattern): JSX.Element;
4
12
  //# sourceMappingURL=corner-dot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"corner-dot.d.ts","sourceRoot":"","sources":["../../src/corner-dot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAA8B,GACtC,GAAG,CAAC,OAAO,CA2Fb"}
1
+ {"version":3,"file":"corner-dot.d.ts","sourceRoot":"","sources":["../../src/corner-dot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAA8B,GACtC,GAAG,CAAC,OAAO,CAgDb"}
@@ -1,3 +1,11 @@
1
1
  import type { CornerEyePattern } from "../types/corner-eye";
2
+ /**
3
+ * Generate corner square path based on pattern type
4
+ * @param offsetX - X offset for the corner
5
+ * @param offsetY - Y offset for the corner
6
+ * @param size - Size of the corner pattern
7
+ * @param pattern - Pattern type for the corner eye
8
+ * @returns SVG path string for the pattern
9
+ */
2
10
  export declare function generateCornerSquarePath(offsetX: number, offsetY: number, size: number, pattern?: CornerEyePattern): string;
3
11
  //# sourceMappingURL=corner-eye.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"corner-eye.d.ts","sourceRoot":"","sources":["../../src/corner-eye.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA0I5D,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAyB,GACjC,MAAM,CAqBR"}
1
+ {"version":3,"file":"corner-eye.d.ts","sourceRoot":"","sources":["../../src/corner-eye.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAyE5D;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAyB,GACjC,MAAM,CAYR"}
@@ -1,36 +1,11 @@
1
- import type { BodyPattern, CornerEyeDotPattern, CornerEyePattern } from "@/types";
2
- export declare function getQRData({ url, fgColor, bgColor, eyeColor, dotColor, bodyPattern, hideLogo, logo, margin, cornerEyePattern, cornerEyeDotPattern, level, templateId, }: {
3
- url: string;
4
- fgColor?: string;
5
- bgColor?: string;
6
- eyeColor?: string;
7
- dotColor?: string;
8
- bodyPattern?: BodyPattern;
1
+ import type { QRProps } from "../types";
2
+ interface QRDataProps extends QRProps {
9
3
  hideLogo?: boolean;
10
4
  logo?: string;
11
- margin?: number;
12
- cornerEyePattern?: CornerEyePattern;
13
- cornerEyeDotPattern?: CornerEyeDotPattern;
14
- level?: "L" | "M" | "Q" | "H";
15
- templateId?: string;
16
- }): {
17
- imageSettings?: {
18
- src: string;
19
- height: number;
20
- width: number;
21
- excavate: boolean;
22
- } | undefined;
23
- value: string;
24
- bgColor: string | undefined;
25
- fgColor: string | undefined;
26
- eyeColor: string | undefined;
27
- dotColor: string | undefined;
28
- bodyPattern: "square" | "rounded" | "circle" | "diamond" | "circle-large" | "circle-mixed" | "pacman" | "clean-square" | undefined;
29
- cornerEyePattern: "square" | "rounded" | "rounded-inward" | "rounded-inward-flipped" | "gear" | "semi-round" | "rounded-extra" | "rounded-square" | "circle" | undefined;
30
- cornerEyeDotPattern: "square" | "rounded-inward" | "rounded-inward-flipped" | "semi-round" | "rounded-square" | "circle" | "leaf" | "diamond" | "diamond-rounded" | undefined;
31
- level: "L" | "M" | "Q" | "H" | undefined;
32
- templateId: string | undefined;
5
+ }
6
+ interface QRDataResult extends QRProps {
33
7
  size: number;
34
- margin: number | undefined;
35
- };
8
+ }
9
+ export declare function getQRData({ value, size, fgColor, bgColor, eyeColor, dotColor, bodyPattern, hideLogo, logo, margin, cornerEyePattern, cornerEyeDotPattern, level, templateId, }: QRDataProps): QRDataResult;
10
+ export {};
36
11
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,EACL,UAAU,GACX,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;;;;;;;;;;;;;;;;;;;EAuBA"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,UAAU,WAAY,SAAQ,OAAO;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,UAAU,YAAa,SAAQ,OAAO;IACpC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,IAAW,EACX,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,EACL,UAAU,GACX,EAAE,WAAW,GAAG,YAAY,CAuB5B"}
@@ -1,20 +1,9 @@
1
- import type { BodyPattern, CornerEyeDotPattern, CornerEyePattern, TemplateDefinition } from "@/types";
2
- export declare const QRCode: import("react").MemoExoticComponent<({ url, fgColor, hideLogo, logo, bgColor, eyeColor, dotColor, bodyPattern, cornerEyePattern, cornerEyeDotPattern, level, scale, margin, templateId, customTemplate, customProps, }: {
3
- url: string;
4
- fgColor?: string;
1
+ import type { QRProps } from "../types";
2
+ interface QRCodeProps extends QRProps {
5
3
  hideLogo?: boolean;
6
4
  logo?: string;
7
- bgColor?: string;
8
- eyeColor?: string;
9
- dotColor?: string;
10
- bodyPattern?: BodyPattern;
11
- cornerEyePattern?: CornerEyePattern;
12
- cornerEyeDotPattern?: CornerEyeDotPattern;
13
- level?: "L" | "M" | "Q" | "H";
14
5
  scale?: number;
15
- margin?: number;
16
- templateId?: string;
17
- customTemplate?: TemplateDefinition<any>;
18
- customProps?: Record<string, any>;
19
- }) => import("react").JSX.Element>;
6
+ }
7
+ export declare const QRCode: import("react").MemoExoticComponent<({ value, fgColor, hideLogo, logo, bgColor, eyeColor, dotColor, bodyPattern, cornerEyePattern, cornerEyeDotPattern, level, scale, margin, templateId, customTemplate, customProps, }: QRCodeProps) => import("react").JSX.Element>;
8
+ export {};
20
9
  //# sourceMappingURL=qr-code.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../src/qr-code.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAKjB,eAAO,MAAM,MAAM,0NAkBd;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,iCAiEF,CAAC"}
1
+ {"version":3,"file":"qr-code.d.ts","sourceRoot":"","sources":["../../src/qr-code.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAKxC,UAAU,WAAY,SAAQ,OAAO;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,MAAM,4NAkBd,WAAW,iCAiEf,CAAC"}
@@ -1,9 +1,11 @@
1
+ import { z } from "zod";
1
2
  import type qrcodegen from "../src/codegen";
2
3
  export type Modules = ReturnType<qrcodegen.QrCode["getModules"]>;
3
- export type Excavation = {
4
- x: number;
5
- y: number;
6
- w: number;
7
- h: number;
8
- };
4
+ export declare const excavationSchema: z.ZodObject<{
5
+ x: z.ZodNumber;
6
+ y: z.ZodNumber;
7
+ w: z.ZodNumber;
8
+ h: z.ZodNumber;
9
+ }, z.core.$strip>;
10
+ export type Excavation = z.infer<typeof excavationSchema>;
9
11
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../types/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;AACjE,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,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../types/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;AAGjE,eAAO,MAAM,gBAAgB;;;;;iBAK3B,CAAC;AAGH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,3 +1,10 @@
1
- export declare const CORNER_EYE_DOT_PATTERNS: readonly ["square", "rounded-square", "circle", "rounded-inward", "rounded-inward-flipped", "semi-round", "leaf", "diamond", "diamond-rounded"];
2
- export type CornerEyeDotPattern = (typeof CORNER_EYE_DOT_PATTERNS)[number];
1
+ import { z } from "zod";
2
+ export declare const CORNER_EYE_DOT_PATTERNS: readonly ["square", "rounded-square", "circle", "diamond"];
3
+ export declare const cornerEyeDotPatternSchema: z.ZodEnum<{
4
+ square: "square";
5
+ "rounded-square": "rounded-square";
6
+ circle: "circle";
7
+ diamond: "diamond";
8
+ }>;
9
+ export type CornerEyeDotPattern = z.infer<typeof cornerEyeDotPatternSchema>;
3
10
  //# sourceMappingURL=corner-dot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"corner-dot.d.ts","sourceRoot":"","sources":["../../types/corner-dot.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,iJAU1B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"corner-dot.d.ts","sourceRoot":"","sources":["../../types/corner-dot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,uBAAuB,4DAK1B,CAAC;AAGX,eAAO,MAAM,yBAAyB;;;;;EAAkC,CAAC;AAGzE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -1,3 +1,10 @@
1
- export declare const CORNER_EYE_PATTERNS: readonly ["square", "rounded", "rounded-inward", "rounded-inward-flipped", "gear", "semi-round", "rounded-extra", "rounded-square", "circle"];
2
- export type CornerEyePattern = (typeof CORNER_EYE_PATTERNS)[number];
1
+ import { z } from "zod";
2
+ export declare const CORNER_EYE_PATTERNS: readonly ["square", "rounded", "gear", "circle"];
3
+ export declare const cornerEyePatternSchema: z.ZodEnum<{
4
+ square: "square";
5
+ circle: "circle";
6
+ rounded: "rounded";
7
+ gear: "gear";
8
+ }>;
9
+ export type CornerEyePattern = z.infer<typeof cornerEyePatternSchema>;
3
10
  //# sourceMappingURL=corner-eye.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"corner-eye.d.ts","sourceRoot":"","sources":["../../types/corner-eye.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,+IAUtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"corner-eye.d.ts","sourceRoot":"","sources":["../../types/corner-eye.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB,kDAKtB,CAAC;AAGX,eAAO,MAAM,sBAAsB;;;;;EAA8B,CAAC;AAGlE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -1,3 +1,14 @@
1
+ import { z } from "zod";
1
2
  export declare const BODY_PATTERN: readonly ["circle", "circle-large", "square", "diamond", "circle-mixed", "pacman", "rounded", "clean-square"];
2
- export type BodyPattern = (typeof BODY_PATTERN)[number];
3
+ export declare const bodyPatternSchema: z.ZodEnum<{
4
+ square: "square";
5
+ circle: "circle";
6
+ diamond: "diamond";
7
+ rounded: "rounded";
8
+ "circle-large": "circle-large";
9
+ "circle-mixed": "circle-mixed";
10
+ pacman: "pacman";
11
+ "clean-square": "clean-square";
12
+ }>;
13
+ export type BodyPattern = z.infer<typeof bodyPatternSchema>;
3
14
  //# sourceMappingURL=image-pattern.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-pattern.d.ts","sourceRoot":"","sources":["../../types/image-pattern.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,+GASf,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"image-pattern.d.ts","sourceRoot":"","sources":["../../types/image-pattern.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,YAAY,+GASf,CAAC;AAGX,eAAO,MAAM,iBAAiB;;;;;;;;;EAAuB,CAAC;AAGtD,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,10 +1,13 @@
1
1
  export type { Excavation, Modules } from "./common";
2
+ export { excavationSchema } from "./common";
2
3
  export type { CornerEyeDotPattern } from "./corner-dot";
3
- export { CORNER_EYE_DOT_PATTERNS } from "./corner-dot";
4
+ export { CORNER_EYE_DOT_PATTERNS, cornerEyeDotPatternSchema, } from "./corner-dot";
4
5
  export type { CornerEyePattern } from "./corner-eye";
5
- export { CORNER_EYE_PATTERNS } from "./corner-eye";
6
+ export { CORNER_EYE_PATTERNS, cornerEyePatternSchema } from "./corner-eye";
6
7
  export type { BodyPattern } from "./image-pattern";
7
- export { BODY_PATTERN } from "./image-pattern";
8
- export type { ImageSettings, QRProps, QRPropsCanvas, QRPropsSVG, } from "./qr";
9
- export type { BaseTemplateProps, TemplateConfig, TemplateDefinition } from "./template";
8
+ export { BODY_PATTERN, bodyPatternSchema } from "./image-pattern";
9
+ export type { ErrorLevel, ImageSettings, QRProps, QRPropsCanvas, QRPropsSVG, } from "./qr";
10
+ export { errorLevelSchema, imageSettingsSchema, qrPropsSchema, } from "./qr";
11
+ export type { BaseTemplateProps, TemplateConfig, TemplateDefinition, } from "./template";
12
+ export { baseTemplatePropsSchema, templateConfigSchema, templateDefinitionBaseSchema, } from "./template";
10
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACV,aAAa,EACb,OAAO,EACP,aAAa,EACb,UAAU,GACX,MAAM,MAAM,CAAC;AACd,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../types/index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAE3E,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAElE,YAAY,EACV,UAAU,EACV,aAAa,EACb,OAAO,EACP,aAAa,EACb,UAAU,GACX,MAAM,MAAM,CAAC;AACd,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,GACd,MAAM,MAAM,CAAC;AAEd,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
@@ -1,20 +1,77 @@
1
1
  import type { CSSProperties } from "react";
2
- import type { CornerEyeDotPattern } from "./corner-dot";
3
- import type { CornerEyePattern } from "./corner-eye";
4
- import type { BodyPattern } from "./image-pattern";
2
+ import { z } from "zod";
3
+ import { type CornerEyeDotPattern } from "./corner-dot";
4
+ import { type CornerEyePattern } from "./corner-eye";
5
+ import { type BodyPattern } from "./image-pattern";
5
6
  import type { TemplateDefinition } from "./template";
6
- export type ImageSettings = {
7
- src: string;
8
- height: number;
9
- width: number;
10
- excavate: boolean;
11
- x?: number;
12
- y?: number;
13
- };
7
+ export declare const imageSettingsSchema: z.ZodObject<{
8
+ src: z.ZodString;
9
+ height: z.ZodNumber;
10
+ width: z.ZodNumber;
11
+ excavate: z.ZodBoolean;
12
+ x: z.ZodOptional<z.ZodNumber>;
13
+ y: z.ZodOptional<z.ZodNumber>;
14
+ }, z.core.$strip>;
15
+ export declare const errorLevelSchema: z.ZodEnum<{
16
+ L: "L";
17
+ M: "M";
18
+ Q: "Q";
19
+ H: "H";
20
+ }>;
21
+ export declare const qrPropsSchema: z.ZodObject<{
22
+ value: z.ZodString;
23
+ size: z.ZodOptional<z.ZodNumber>;
24
+ level: z.ZodOptional<z.ZodEnum<{
25
+ L: "L";
26
+ M: "M";
27
+ Q: "Q";
28
+ H: "H";
29
+ }>>;
30
+ bgColor: z.ZodOptional<z.ZodString>;
31
+ fgColor: z.ZodOptional<z.ZodString>;
32
+ eyeColor: z.ZodOptional<z.ZodString>;
33
+ dotColor: z.ZodOptional<z.ZodString>;
34
+ bodyPattern: z.ZodOptional<z.ZodEnum<{
35
+ square: "square";
36
+ circle: "circle";
37
+ diamond: "diamond";
38
+ rounded: "rounded";
39
+ "circle-large": "circle-large";
40
+ "circle-mixed": "circle-mixed";
41
+ pacman: "pacman";
42
+ "clean-square": "clean-square";
43
+ }>>;
44
+ cornerEyePattern: z.ZodOptional<z.ZodEnum<{
45
+ square: "square";
46
+ circle: "circle";
47
+ rounded: "rounded";
48
+ gear: "gear";
49
+ }>>;
50
+ cornerEyeDotPattern: z.ZodOptional<z.ZodEnum<{
51
+ square: "square";
52
+ "rounded-square": "rounded-square";
53
+ circle: "circle";
54
+ diamond: "diamond";
55
+ }>>;
56
+ margin: z.ZodOptional<z.ZodNumber>;
57
+ imageSettings: z.ZodOptional<z.ZodObject<{
58
+ src: z.ZodString;
59
+ height: z.ZodNumber;
60
+ width: z.ZodNumber;
61
+ excavate: z.ZodBoolean;
62
+ x: z.ZodOptional<z.ZodNumber>;
63
+ y: z.ZodOptional<z.ZodNumber>;
64
+ }, z.core.$strip>>;
65
+ isOGContext: z.ZodOptional<z.ZodBoolean>;
66
+ templateId: z.ZodOptional<z.ZodString>;
67
+ customProps: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
68
+ }, z.core.$strip>;
69
+ export type ImageSettings = z.infer<typeof imageSettingsSchema>;
70
+ export type ErrorLevel = z.infer<typeof errorLevelSchema>;
14
71
  export type QRProps = {
15
72
  value: string;
16
73
  size?: number;
17
- level?: string;
74
+ level?: ErrorLevel;
18
75
  bgColor?: string;
19
76
  fgColor?: string;
20
77
  eyeColor?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../types/qr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,cAAc,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAGzC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,GACjC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"qr.d.ts","sourceRoot":"","sources":["../../types/qr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,eAAO,MAAM,mBAAmB;;;;;;;iBAO9B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;EAA+B,CAAC;AAE7D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgBxB,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,cAAc,CAAC,EAAE,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAGzC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,GACjC,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC"}
@@ -1,7 +1,8 @@
1
- export type BaseTemplateProps = {
2
- fgColor?: string;
3
- bgColor?: string;
4
- };
1
+ import { z } from "zod";
2
+ export declare const baseTemplatePropsSchema: z.ZodObject<{
3
+ fgColor: z.ZodOptional<z.ZodString>;
4
+ bgColor: z.ZodOptional<z.ZodString>;
5
+ }, z.core.$strip>;
5
6
  /**
6
7
  * Configuration object passed to template wrappers containing all QR code metadata.
7
8
  * All dimension values are in the template coordinate space (typically 300x300).
@@ -21,10 +22,17 @@ export type BaseTemplateProps = {
21
22
  * }
22
23
  * ```
23
24
  */
24
- export type TemplateConfig = {
25
- pixelSize: number;
26
- url: string;
27
- };
25
+ export declare const templateConfigSchema: z.ZodObject<{
26
+ pixelSize: z.ZodNumber;
27
+ url: z.ZodString;
28
+ }, z.core.$strip>;
29
+ export declare const templateDefinitionBaseSchema: z.ZodObject<{
30
+ id: z.ZodString;
31
+ name: z.ZodString;
32
+ description: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ export type BaseTemplateProps = z.infer<typeof baseTemplatePropsSchema>;
35
+ export type TemplateConfig = z.infer<typeof templateConfigSchema>;
28
36
  export type TemplateDefinition<TCustomProps = Record<string, never>> = {
29
37
  id: string;
30
38
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../types/template.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAGF,MAAM,MAAM,kBAAkB,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,CACP,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,KAAK,CAAC,EAAE,iBAAiB,GAAG,YAAY,EACxC,cAAc,CAAC,EAAE,cAAc,KAC5B,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../types/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,oBAAoB;;;iBAG/B,CAAC;AAIH,eAAO,MAAM,4BAA4B;;;;iBAIvC,CAAC;AAGH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,MAAM,MAAM,kBAAkB,CAAC,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI;IACrE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,CACP,QAAQ,EAAE,KAAK,CAAC,SAAS,EACzB,KAAK,CAAC,EAAE,iBAAiB,GAAG,YAAY,EACxC,cAAc,CAAC,EAAE,cAAc,KAC5B,KAAK,CAAC,SAAS,CAAC;CACtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qrdx",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-beta.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/src/index.d.ts",
@@ -34,7 +34,8 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "jsqr": "^1.4.0",
37
- "react": "19.2.0"
37
+ "react": "19.2.0",
38
+ "zod": "^4.1.12"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@repo/typescript-config": "workspace:*",
package/src/constants.ts CHANGED
@@ -1,26 +1,65 @@
1
+ import type { ErrorLevel } from "../types";
1
2
  import qrcodegen from "./codegen";
2
3
 
3
- export const ERROR_LEVEL_MAP: { [index: string]: qrcodegen.QrCode.Ecc } = {
4
+ /**
5
+ * Mapping of error correction levels to qrcodegen.QrCode.Ecc values
6
+ */
7
+ export const ERROR_LEVEL_MAP: Record<ErrorLevel, qrcodegen.QrCode.Ecc> = {
4
8
  L: qrcodegen.QrCode.Ecc.LOW,
5
9
  M: qrcodegen.QrCode.Ecc.MEDIUM,
6
10
  Q: qrcodegen.QrCode.Ecc.QUARTILE,
7
11
  H: qrcodegen.QrCode.Ecc.HIGH,
8
12
  };
9
13
 
14
+ /**
15
+ * Default QR code size in pixels
16
+ */
10
17
  export const DEFAULT_SIZE = 128;
11
- export const DEFAULT_LEVEL = "Q";
18
+
19
+ /**
20
+ * Default error correction level
21
+ */
22
+ export const DEFAULT_LEVEL: ErrorLevel = "Q";
23
+
24
+ /**
25
+ * Default background color
26
+ */
12
27
  export const DEFAULT_BGCOLOR = "#FFFFFF";
28
+
29
+ /**
30
+ * Default foreground color
31
+ */
13
32
  export const DEFAULT_FGCOLOR = "#000000";
33
+
34
+ /**
35
+ * Default eye color
36
+ */
14
37
  export const DEFAULT_EYECOLOR = "#000000";
38
+
39
+ /**
40
+ * Default dot color
41
+ */
15
42
  export const DEFAULT_DOTCOLOR = "#000000";
43
+
44
+ /**
45
+ * Default margin around the QR code
46
+ */
16
47
  export const DEFAULT_MARGIN = 0;
17
48
 
18
- export const QR_LEVELS = ["L", "M", "Q", "H"] as const;
49
+ /**
50
+ * Available QR error correction levels
51
+ */
52
+ export const QR_LEVELS: readonly ErrorLevel[] = ["L", "M", "Q", "H"] as const;
19
53
 
20
- // This is *very* rough estimate of max amount of QRCode allowed to be covered.
21
- // It is "wrong" in a lot of ways (area is a terrible way to estimate, it
22
- // really should be number of modules covered), but if for some reason we don't
23
- // get an explicit height or width, I'd rather default to something than throw.
54
+ /**
55
+ * This is *very* rough estimate of max amount of QRCode allowed to be covered.
56
+ * It is "wrong" in a lot of ways (area is a terrible way to estimate, it
57
+ * really should be number of modules covered), but if for some reason we don't
58
+ * get an explicit height or width, I'd rather default to something than throw.
59
+ */
24
60
  export const DEFAULT_IMG_SCALE = 0.1;
25
61
 
62
+ /**
63
+ * Default logo URL for QR codes
64
+ */
26
65
  export const FLAM_QR_LOGO = "https://instant.flamapp.ai/flogo-qr.svg";
@@ -1,7 +1,14 @@
1
1
  import type { JSX } from "react";
2
2
  import type { CornerEyeDotPattern } from "../types/corner-dot";
3
3
 
4
- // Generate corner dot pattern based on type
4
+ /**
5
+ * Generate corner dot pattern based on type
6
+ * @param cx - Center X coordinate
7
+ * @param cy - Center Y coordinate
8
+ * @param radius - Radius of the dot
9
+ * @param pattern - Pattern type for the corner dot
10
+ * @returns JSX element representing the pattern
11
+ */
5
12
  export function generateCornerDotPath(
6
13
  cx: number,
7
14
  cy: number,
@@ -36,42 +43,6 @@ export function generateCornerDotPath(
36
43
  />
37
44
  );
38
45
 
39
- case "rounded-inward":
40
- return (
41
- <path
42
- clipRule="evenodd"
43
- d={`M ${cx - halfSize} ${cy - halfSize * 0.428_571}v ${size * 0.285_714}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, ${size * 0.357_143} ${size * 0.357_143}h ${size * 0.642_857}v -${size * 0.642_857}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, -${size * 0.357_143} -${size * 0.357_143}h -${size * 0.285_714}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, -${size * 0.357_143} ${size * 0.357_143}`}
44
- transform={`rotate(0,${cx},${cy})`}
45
- />
46
- );
47
-
48
- case "rounded-inward-flipped":
49
- return (
50
- <path
51
- clipRule="evenodd"
52
- d={`M ${cx - halfSize} ${cy - halfSize * 0.428_571}v ${size * 0.285_714}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, ${size * 0.357_143} ${size * 0.357_143}h ${size * 0.642_857}v -${size * 0.642_857}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, -${size * 0.357_143} -${size * 0.357_143}h -${size * 0.285_714}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, -${size * 0.357_143} ${size * 0.357_143}`}
53
- transform={`rotate(-180,${cx},${cy})`}
54
- />
55
- );
56
-
57
- case "semi-round":
58
- return (
59
- <path
60
- clipRule="evenodd"
61
- d={`M ${cx - halfSize} ${cy - halfSize * 0.428_571}v ${size * 0.285_714}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, ${size * 0.357_143} ${size * 0.357_143}h ${size * 0.642_857}v -${size * 0.642_857}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, -${size * 0.357_143} -${size * 0.357_143}h -${size * 0.285_714}H ${cx - halfSize}z`}
62
- transform={`rotate(0,${cx},${cy})`}
63
- />
64
- );
65
-
66
- case "leaf":
67
- return (
68
- <path
69
- clipRule="evenodd"
70
- d={`M ${cx - halfSize} ${cy - halfSize * 0.428_571}v ${size * 0.642_857}h ${size * 0.642_857}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, ${size * 0.357_143} -${size * 0.357_143}v -${size * 0.642_857}h -${size * 0.642_857}a ${size * 0.357_143} ${size * 0.357_143}, 0, 0, 0, -${size * 0.357_143} ${size * 0.357_143}z`}
71
- transform={`rotate(0,${cx},${cy})`}
72
- />
73
- );
74
-
75
46
  case "diamond":
76
47
  return (
77
48
  <path
@@ -80,14 +51,7 @@ export function generateCornerDotPath(
80
51
  />
81
52
  );
82
53
 
83
- case "diamond-rounded":
84
- return (
85
- <path
86
- d={`M ${cx - halfSize * 0.571_429} ${cy - halfSize * 0.714_286}h ${size * 0.428_571}c ${size * 0.142_857} 0 ${size * 0.142_857} ${size * 0.142_857} ${size * 0.142_857} ${size * 0.142_857}v ${size * 0.428_571}c 0 ${size * 0.142_857} -${size * 0.142_857} ${size * 0.142_857} -${size * 0.142_857} ${size * 0.142_857}h -${size * 0.428_571}c -${size * 0.142_857} 0 -${size * 0.142_857} -${size * 0.142_857} -${size * 0.142_857} -${size * 0.142_857}v -${size * 0.428_571}c 0 -${size * 0.142_857} ${size * 0.142_857} -${size * 0.142_857} ${size * 0.142_857} -${size * 0.142_857}z`}
87
- transform={`rotate(45,${cx},${cy})`}
88
- />
89
- );
90
-
54
+ // case "circle":
91
55
  default:
92
56
  return (
93
57
  <circle