qrdx 0.0.53 → 0.0.55

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 (114) hide show
  1. package/README.md +1 -1
  2. package/dist/core.js +7 -7
  3. package/dist/core.js.map +1 -1
  4. package/dist/core.mjs +7 -7
  5. package/dist/core.mjs.map +1 -1
  6. package/dist/element.browser.mjs +6 -67
  7. package/dist/element.browser.mjs.map +1 -1
  8. package/dist/index.js +7 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.mjs +7 -7
  11. package/dist/index.mjs.map +1 -1
  12. package/dist/qr-code-canvas.js +1 -1
  13. package/dist/qr-code-canvas.js.map +1 -1
  14. package/dist/qr-code-canvas.mjs +1 -1
  15. package/dist/qr-code-canvas.mjs.map +1 -1
  16. package/dist/schemas.js +2 -0
  17. package/dist/schemas.js.map +1 -0
  18. package/dist/schemas.mjs +2 -0
  19. package/dist/schemas.mjs.map +1 -0
  20. package/dist/src/art.d.ts +1 -1
  21. package/dist/src/art.d.ts.map +1 -1
  22. package/dist/src/engine.d.ts +2 -1
  23. package/dist/src/engine.d.ts.map +1 -1
  24. package/dist/src/eps.d.ts.map +1 -1
  25. package/dist/src/frame-import.d.ts +1 -1
  26. package/dist/src/frame-import.d.ts.map +1 -1
  27. package/dist/src/frame-spec.d.ts +5 -4
  28. package/dist/src/frame-spec.d.ts.map +1 -1
  29. package/dist/src/frame.d.ts +1 -1
  30. package/dist/src/frame.d.ts.map +1 -1
  31. package/dist/src/frames/builtin.d.ts +1 -1
  32. package/dist/src/frames/builtin.d.ts.map +1 -1
  33. package/dist/src/qr-outline.d.ts +1 -2
  34. package/dist/src/qr-outline.d.ts.map +1 -1
  35. package/dist/src/qr-shape.d.ts +1 -1
  36. package/dist/src/qr-shape.d.ts.map +1 -1
  37. package/dist/src/silhouette.d.ts +1 -2
  38. package/dist/src/silhouette.d.ts.map +1 -1
  39. package/dist/src/template/dot-ring-layout.d.ts +26 -3
  40. package/dist/src/template/dot-ring-layout.d.ts.map +1 -1
  41. package/dist/src/template/dot-ring.d.ts +22 -4
  42. package/dist/src/template/dot-ring.d.ts.map +1 -1
  43. package/dist/src/utils.d.ts +1 -1
  44. package/dist/src/utils.d.ts.map +1 -1
  45. package/dist/types/art.d.ts +1 -18
  46. package/dist/types/art.d.ts.map +1 -1
  47. package/dist/types/color-helpers.d.ts +26 -0
  48. package/dist/types/color-helpers.d.ts.map +1 -0
  49. package/dist/types/color.d.ts +1 -24
  50. package/dist/types/color.d.ts.map +1 -1
  51. package/dist/types/constants.d.ts +97 -0
  52. package/dist/types/constants.d.ts.map +1 -0
  53. package/dist/types/corner-dot.d.ts +2 -12
  54. package/dist/types/corner-dot.d.ts.map +1 -1
  55. package/dist/types/corner-eye.d.ts +2 -11
  56. package/dist/types/corner-eye.d.ts.map +1 -1
  57. package/dist/types/frame-spec-parse.d.ts +21 -0
  58. package/dist/types/frame-spec-parse.d.ts.map +1 -0
  59. package/dist/types/frame-spec-rules.d.ts +95 -0
  60. package/dist/types/frame-spec-rules.d.ts.map +1 -0
  61. package/dist/types/frame-spec.d.ts +2 -83
  62. package/dist/types/frame-spec.d.ts.map +1 -1
  63. package/dist/types/frame.d.ts +1 -8
  64. package/dist/types/frame.d.ts.map +1 -1
  65. package/dist/types/image-pattern.d.ts +1 -1
  66. package/dist/types/image-pattern.d.ts.map +1 -1
  67. package/dist/types/index.d.ts +3 -22
  68. package/dist/types/index.d.ts.map +1 -1
  69. package/dist/types/index.js +2 -2
  70. package/dist/types/index.js.map +1 -1
  71. package/dist/types/index.mjs +2 -2
  72. package/dist/types/index.mjs.map +1 -1
  73. package/dist/types/plain.d.ts +17 -0
  74. package/dist/types/plain.d.ts.map +1 -0
  75. package/dist/types/qr.d.ts +2 -46
  76. package/dist/types/qr.d.ts.map +1 -1
  77. package/dist/types/schemas.d.ts +12 -0
  78. package/dist/types/schemas.d.ts.map +1 -0
  79. package/dist/vanilla.browser.mjs +28 -28
  80. package/dist/vanilla.browser.mjs.map +1 -1
  81. package/package.json +3 -3
  82. package/src/art.tsx +3 -6
  83. package/src/body-patterns.tsx +1 -1
  84. package/src/engine.ts +53 -1
  85. package/src/eps.ts +6 -1
  86. package/src/frame-import.ts +7 -6
  87. package/src/frame-spec.ts +17 -23
  88. package/src/frame.tsx +3 -2
  89. package/src/frames/builtin.ts +2 -5
  90. package/src/helpers.ts +1 -1
  91. package/src/qr-outline.ts +2 -2
  92. package/src/qr-shape.ts +2 -5
  93. package/src/rasterize.ts +1 -1
  94. package/src/scan-score.ts +2 -2
  95. package/src/silhouette.ts +2 -2
  96. package/src/template/dot-ring-layout.ts +281 -15
  97. package/src/template/dot-ring.tsx +27 -8
  98. package/src/utils/print-shared.ts +1 -1
  99. package/src/utils.tsx +6 -5
  100. package/types/art.ts +10 -20
  101. package/types/color-helpers.ts +132 -0
  102. package/types/color.ts +9 -122
  103. package/types/constants.ts +222 -0
  104. package/types/corner-dot.ts +8 -40
  105. package/types/corner-eye.ts +2 -31
  106. package/types/frame-spec-parse.ts +683 -0
  107. package/types/frame-spec-rules.ts +645 -0
  108. package/types/frame-spec.ts +38 -635
  109. package/types/frame.ts +14 -34
  110. package/types/image-pattern.ts +2 -26
  111. package/types/index.ts +6 -162
  112. package/types/plain.ts +117 -0
  113. package/types/qr.ts +29 -51
  114. package/types/schemas.ts +62 -0
package/types/frame.ts CHANGED
@@ -1,38 +1,18 @@
1
1
  import { z } from "zod";
2
-
3
- export const FRAME_STYLES = [
4
- "none",
5
- "banner-bottom",
6
- "banner-top",
7
- "border",
8
- "rounded-border",
9
- "speech-bubble",
10
- // Added after 0.0.46
11
- "banner-top-bottom",
12
- "speech-bubble-top",
13
- "chat-bubble",
14
- "circle",
15
- "polaroid",
16
- "phone",
17
- "ticket",
18
- "badge",
19
- "envelope",
20
- "tag",
21
- "menu-card",
22
- "sticker",
23
- "gradient-border",
24
- "focus",
25
- ] as const;
26
-
27
- /** Longest call-to-action label a frame renders. */
28
- export const FRAME_TEXT_MAX_LENGTH = 24;
29
-
30
- /** Label used when a frame has no `text`. Pass `""` to hide the label. */
31
- export const DEFAULT_FRAME_TEXT = "Scan me";
32
-
33
- /** Smallest and largest `fontScale` (label size relative to the default). */
34
- export const FRAME_FONT_SCALE_MIN = 0.5;
35
- export const FRAME_FONT_SCALE_MAX = 1.5;
2
+ import {
3
+ FRAME_FONT_SCALE_MAX,
4
+ FRAME_FONT_SCALE_MIN,
5
+ FRAME_STYLES,
6
+ FRAME_TEXT_MAX_LENGTH,
7
+ } from "./constants";
8
+
9
+ export {
10
+ DEFAULT_FRAME_TEXT,
11
+ FRAME_FONT_SCALE_MAX,
12
+ FRAME_FONT_SCALE_MIN,
13
+ FRAME_STYLES,
14
+ FRAME_TEXT_MAX_LENGTH,
15
+ } from "./constants";
36
16
 
37
17
  // Zod schemas
38
18
  export const frameStyleSchema = z.enum(FRAME_STYLES);
@@ -1,31 +1,7 @@
1
1
  import { z } from "zod";
2
+ import { BODY_PATTERN } from "./constants";
2
3
 
3
- export const BODY_PATTERN = [
4
- "circle",
5
- "circle-large",
6
- "square",
7
- "diamond",
8
- "circle-mixed",
9
- "pacman",
10
- "rounded",
11
- "small-square",
12
- "vertical-line",
13
- // Added after 0.0.46 (drawn by src/body-patterns.tsx)
14
- "horizontal-line",
15
- "liquid",
16
- "liquid-horizontal",
17
- "liquid-vertical",
18
- "classy",
19
- "classy-rounded",
20
- "leaf",
21
- "plus",
22
- "hexagon",
23
- "star",
24
- "heart",
25
- "random-dots",
26
- "mosaic",
27
- "octagon",
28
- ] as const;
4
+ export { BODY_PATTERN } from "./constants";
29
5
 
30
6
  // Zod schema
31
7
  export const bodyPatternSchema = z.enum(BODY_PATTERN);
package/types/index.ts CHANGED
@@ -1,163 +1,7 @@
1
- // Re-export all types from domain files
1
+ /** biome-ignore-all lint/performance/noBarrelFile: qrdx/types without React */
2
+ // Every schema, type and helper of qrdx/types except the React components'
3
+ // prop types (public.ts adds those): the zod-free half (option lists,
4
+ // limits, helpers, types) and the zod schemas.
2
5
 
3
- export { DEFAULT_MARGIN } from "../src/constants";
4
- // Re-export utility functions that don't require React
5
- // These can be used in server contexts without "use client" directive
6
- export { getSolidColor } from "../src/utils/color";
7
- export type { QRArt, QRArtImage, QRArtMode, QRArtVariant } from "./art";
8
- export {
9
- QR_ART_MAX_SAMPLE_SIZE,
10
- QR_ART_MODES,
11
- QR_ART_VARIANTS,
12
- qrArtImageSchema,
13
- qrArtModeSchema,
14
- qrArtSchema,
15
- qrArtVariantSchema,
16
- } from "./art";
17
- export type {
18
- AngularGradient,
19
- ColorConfig,
20
- ColorType,
21
- Gradient,
22
- GradientStop,
23
- ImageFit,
24
- ImagePaint,
25
- ImagePosition,
26
- LinearGradient,
27
- RadialGradient,
28
- SolidColor,
29
- } from "./color";
30
- export {
31
- angularGradientSchema,
32
- colorConfigSchema,
33
- colorTypeSchema,
34
- getColorString,
35
- getNormalizedColor,
36
- gradientStopSchema,
37
- imageFitSchema,
38
- imagePaintSchema,
39
- imagePositionCss,
40
- imagePositionSchema,
41
- isGradient,
42
- isImagePaint,
43
- linearGradientSchema,
44
- normalizeColorConfig,
45
- radialGradientSchema,
46
- solidColorSchema,
47
- } from "./color";
48
- export type { Excavation, Modules } from "./common";
49
- export { excavationSchema } from "./common";
50
- export type {
51
- CornerEyeDotPattern,
52
- PickableCornerEyeDotPattern,
53
- } from "./corner-dot";
54
- export {
55
- CORNER_EYE_DOT_PATTERNS,
56
- cornerEyeDotPatternSchema,
57
- pickableCornerEyeDotPatternSchema,
58
- RETIRED_CORNER_EYE_DOT_PATTERNS,
59
- } from "./corner-dot";
60
- export type { CornerEyePattern, PickableCornerEyePattern } from "./corner-eye";
61
- export {
62
- CORNER_EYE_PATTERNS,
63
- cornerEyePatternSchema,
64
- pickableCornerEyePatternSchema,
65
- RETIRED_CORNER_EYE_PATTERNS,
66
- } from "./corner-eye";
67
- export type { FrameStyle, QRFrame } from "./frame";
68
- export {
69
- DEFAULT_FRAME_TEXT,
70
- FRAME_FONT_SCALE_MAX,
71
- FRAME_FONT_SCALE_MIN,
72
- FRAME_STYLES,
73
- FRAME_TEXT_MAX_LENGTH,
74
- frameSchema,
75
- frameStyleSchema,
76
- } from "./frame";
77
- export type {
78
- AnyQRFrame,
79
- FrameSpec,
80
- FrameSpecColor,
81
- FrameSpecIcon,
82
- FrameSpecLabel,
83
- FrameSpecPaint,
84
- FrameSpecShape,
85
- QRCustomFrame,
86
- } from "./frame-spec";
87
- export {
88
- anyFrameSchema,
89
- CUSTOM_FRAME_STYLE,
90
- customFrameSchema,
91
- FRAME_COLOR_TOKENS,
92
- FRAME_ICON_MAX_SEGMENTS,
93
- FRAME_ICONS,
94
- FRAME_SPEC_KIND,
95
- FRAME_SPEC_LABEL_MAX_FONT,
96
- FRAME_SPEC_LIMITS,
97
- FRAME_SPEC_VERSION,
98
- frameSpecColorSchema,
99
- frameSpecLabelSchema,
100
- frameSpecPadding,
101
- frameSpecPaintSchema,
102
- frameSpecQrZone,
103
- frameSpecSchema,
104
- frameSpecShapeSchema,
105
- getFrameSpecIssues,
106
- isLatin1Text,
107
- sanitizeFrameText,
108
- } from "./frame-spec";
109
- export type { BodyPattern } from "./image-pattern";
110
- export { BODY_PATTERN, bodyPatternSchema } from "./image-pattern";
111
- export type {
112
- ErrorLevel,
113
- EyeColorOverride,
114
- EyeColors,
115
- EyePosition,
116
- ImageSettings,
117
- LogoOptions,
118
- LogoShape,
119
- QRCodeShape,
120
- QRProps,
121
- QRShape,
122
- QRSilhouette,
123
- QRStyle,
124
- QRSVGAttributes,
125
- QRSVGOptions,
126
- } from "./qr";
127
- export {
128
- AUTO_LEVEL_LOGO_COVERAGE,
129
- EYE_POSITIONS,
130
- errorLevelSchema,
131
- eyeColorOverrideSchema,
132
- eyeColorsSchema,
133
- imageSettingsSchema,
134
- LOGO_PADDING_MAX,
135
- LOGO_SHAPES,
136
- LOGO_SIZE_DEFAULT,
137
- LOGO_SIZE_MAX,
138
- LOGO_SIZE_MIN,
139
- logoOptionsSchema,
140
- logoShapeSchema,
141
- MODULE_SCALE_MAX,
142
- MODULE_SCALE_MIN,
143
- QR_CIRCLE_QUIET_MIN,
144
- QR_SHAPES,
145
- QR_SILHOUETTE_MAX_CELLS,
146
- QR_SILHOUETTE_MIN_CELLS,
147
- QR_SILHOUETTE_MIN_SHARE,
148
- qrCodeShapeSchema,
149
- qrPropsSchema,
150
- qrShapeSchema,
151
- qrSilhouetteSchema,
152
- } from "./qr";
153
- export type {
154
- BaseTemplateProps,
155
- TemplateConfig,
156
- TemplateDefinition,
157
- TemplateNode,
158
- } from "./template";
159
- export {
160
- baseTemplatePropsSchema,
161
- templateConfigSchema,
162
- templateDefinitionBaseSchema,
163
- } from "./template";
6
+ export * from "./plain";
7
+ export * from "./schemas";
package/types/plain.ts ADDED
@@ -0,0 +1,117 @@
1
+ /** biome-ignore-all lint/performance/noBarrelFile: the zod-free half of qrdx/types */
2
+ // Everything in qrdx/types except the zod schemas: option lists, limits,
3
+ // helpers and types. The engine (qrdx/core, the React entry and every
4
+ // adapter) draws with these and nothing else, so rendering a code never
5
+ // loads zod. The schemas are in ./schemas, which the engine re-exports from
6
+ // a file of its own (dist/schemas.mjs) that bundlers leave out unless an app
7
+ // uses a schema.
8
+
9
+ export { DEFAULT_MARGIN } from "../src/constants";
10
+ // Utility functions that don't require React (usable in server contexts
11
+ // without a "use client" directive)
12
+ export { getSolidColor } from "../src/utils/color";
13
+ export type { QRArt, QRArtImage, QRArtMode, QRArtVariant } from "./art";
14
+ export type {
15
+ AngularGradient,
16
+ ColorConfig,
17
+ ColorType,
18
+ Gradient,
19
+ GradientStop,
20
+ ImageFit,
21
+ ImagePaint,
22
+ ImagePosition,
23
+ LinearGradient,
24
+ RadialGradient,
25
+ SolidColor,
26
+ } from "./color";
27
+ export {
28
+ getColorString,
29
+ getNormalizedColor,
30
+ imagePositionCss,
31
+ isGradient,
32
+ isImagePaint,
33
+ normalizeColorConfig,
34
+ } from "./color-helpers";
35
+ export type { Excavation, Modules } from "./common";
36
+ export {
37
+ AUTO_LEVEL_LOGO_COVERAGE,
38
+ BODY_PATTERN,
39
+ CORNER_EYE_DOT_PATTERNS,
40
+ CORNER_EYE_PATTERNS,
41
+ DEFAULT_FRAME_TEXT,
42
+ EYE_POSITIONS,
43
+ FRAME_FONT_SCALE_MAX,
44
+ FRAME_FONT_SCALE_MIN,
45
+ FRAME_STYLES,
46
+ FRAME_TEXT_MAX_LENGTH,
47
+ LOGO_PADDING_MAX,
48
+ LOGO_SHAPES,
49
+ LOGO_SIZE_DEFAULT,
50
+ LOGO_SIZE_MAX,
51
+ LOGO_SIZE_MIN,
52
+ MODULE_SCALE_MAX,
53
+ MODULE_SCALE_MIN,
54
+ QR_ART_MAX_SAMPLE_SIZE,
55
+ QR_ART_MODES,
56
+ QR_ART_VARIANTS,
57
+ QR_CIRCLE_QUIET_MIN,
58
+ QR_SHAPES,
59
+ QR_SILHOUETTE_MAX_CELLS,
60
+ QR_SILHOUETTE_MIN_CELLS,
61
+ QR_SILHOUETTE_MIN_SHARE,
62
+ RETIRED_CORNER_EYE_DOT_PATTERNS,
63
+ RETIRED_CORNER_EYE_PATTERNS,
64
+ } from "./constants";
65
+ export type {
66
+ CornerEyeDotPattern,
67
+ PickableCornerEyeDotPattern,
68
+ } from "./corner-dot";
69
+ export type { CornerEyePattern, PickableCornerEyePattern } from "./corner-eye";
70
+ export type { FrameStyle, QRFrame } from "./frame";
71
+ export type {
72
+ AnyQRFrame,
73
+ FrameSpec,
74
+ FrameSpecColor,
75
+ FrameSpecIcon,
76
+ FrameSpecLabel,
77
+ FrameSpecPaint,
78
+ FrameSpecShape,
79
+ QRCustomFrame,
80
+ } from "./frame-spec";
81
+ export {
82
+ CUSTOM_FRAME_STYLE,
83
+ FRAME_COLOR_TOKENS,
84
+ FRAME_ICON_MAX_SEGMENTS,
85
+ FRAME_ICONS,
86
+ FRAME_SPEC_KIND,
87
+ FRAME_SPEC_LABEL_MAX_FONT,
88
+ FRAME_SPEC_LIMITS,
89
+ FRAME_SPEC_VERSION,
90
+ frameSpecPadding,
91
+ frameSpecQrZone,
92
+ isLatin1Text,
93
+ sanitizeFrameText,
94
+ } from "./frame-spec-rules";
95
+ export type { BodyPattern } from "./image-pattern";
96
+ export type {
97
+ ErrorLevel,
98
+ EyeColorOverride,
99
+ EyeColors,
100
+ EyePosition,
101
+ ImageSettings,
102
+ LogoOptions,
103
+ LogoShape,
104
+ QRCodeShape,
105
+ QRProps,
106
+ QRShape,
107
+ QRSilhouette,
108
+ QRStyle,
109
+ QRSVGAttributes,
110
+ QRSVGOptions,
111
+ } from "./qr";
112
+ export type {
113
+ BaseTemplateProps,
114
+ TemplateConfig,
115
+ TemplateDefinition,
116
+ TemplateNode,
117
+ } from "./template";
package/types/qr.ts CHANGED
@@ -2,6 +2,18 @@ import type * as CSS from "csstype";
2
2
  import { z } from "zod";
3
3
  import { type QRArt, qrArtSchema } from "./art";
4
4
  import { type ColorConfig, colorConfigSchema } from "./color";
5
+ import {
6
+ type EYE_POSITIONS,
7
+ LOGO_PADDING_MAX,
8
+ LOGO_SHAPES,
9
+ LOGO_SIZE_MAX,
10
+ LOGO_SIZE_MIN,
11
+ MODULE_SCALE_MAX,
12
+ MODULE_SCALE_MIN,
13
+ QR_SHAPES,
14
+ QR_SILHOUETTE_MAX_CELLS,
15
+ QR_SILHOUETTE_MIN_CELLS,
16
+ } from "./constants";
5
17
  import {
6
18
  type CornerEyeDotPattern,
7
19
  cornerEyeDotPatternSchema,
@@ -11,11 +23,23 @@ import { type AnyQRFrame, anyFrameSchema } from "./frame-spec";
11
23
  import { type BodyPattern, bodyPatternSchema } from "./image-pattern";
12
24
  import type { TemplateDefinition } from "./template";
13
25
 
14
- /**
15
- * How a logo is cropped: "square" (as uploaded), "rounded" corners or a
16
- * "circle". A plate behind the logo takes the same shape.
17
- */
18
- export const LOGO_SHAPES = ["square", "rounded", "circle"] as const;
26
+ export {
27
+ AUTO_LEVEL_LOGO_COVERAGE,
28
+ EYE_POSITIONS,
29
+ LOGO_PADDING_MAX,
30
+ LOGO_SHAPES,
31
+ LOGO_SIZE_DEFAULT,
32
+ LOGO_SIZE_MAX,
33
+ LOGO_SIZE_MIN,
34
+ MODULE_SCALE_MAX,
35
+ MODULE_SCALE_MIN,
36
+ QR_CIRCLE_QUIET_MIN,
37
+ QR_SHAPES,
38
+ QR_SILHOUETTE_MAX_CELLS,
39
+ QR_SILHOUETTE_MIN_CELLS,
40
+ QR_SILHOUETTE_MIN_SHARE,
41
+ } from "./constants";
42
+
19
43
  export const logoShapeSchema = z.enum(LOGO_SHAPES);
20
44
  export type LogoShape = z.infer<typeof logoShapeSchema>;
21
45
 
@@ -41,17 +65,6 @@ export const imageSettingsSchema = z.object({
41
65
  plate: z.string().optional(),
42
66
  });
43
67
 
44
- /**
45
- * Smallest and largest logo width, as a share of the code's width. Above
46
- * 25% even level H stops reading in our decode tests (tests/engine-options).
47
- */
48
- export const LOGO_SIZE_MIN = 0.1;
49
- export const LOGO_SIZE_MAX = 0.3;
50
- /** Logo width `getQRData` uses when no size is given (25%). */
51
- export const LOGO_SIZE_DEFAULT = 0.25;
52
- /** Most clear space around a logo, in modules. */
53
- export const LOGO_PADDING_MAX = 2;
54
-
55
68
  /**
56
69
  * Logo layout for `getQRData` and `<QRCode>`, in units that don't depend on
57
70
  * the render size: `size` is a share of the code's width, `padding` is clear
@@ -71,41 +84,8 @@ export type LogoOptions = z.infer<typeof logoOptionsSchema>;
71
84
 
72
85
  export const errorLevelSchema = z.enum(["L", "M", "Q", "H"]);
73
86
 
74
- /** Smallest and largest `moduleScale` (size of each data module). */
75
- export const MODULE_SCALE_MIN = 0.5;
76
- export const MODULE_SCALE_MAX = 1;
77
-
78
- /**
79
- * Share of the code a logo may cover before `autoLevel` raises error
80
- * correction to H (level L recovers about 7%).
81
- */
82
- export const AUTO_LEVEL_LOGO_COVERAGE = 0.07;
83
-
84
- /**
85
- * Outline of the whole code: "square" (the QR symbol as is), "circle" or
86
- * "heart": the symbol sits in a disc or a heart filled with decorative
87
- * modules. Decoders read only the symbol, which keeps its quiet ring
88
- * (`margin`, at least QR_CIRCLE_QUIET_MIN modules) before the decoration
89
- * starts. `shape` also takes a `QRSilhouette`, an outline of your own.
90
- */
91
- export const QR_SHAPES = ["square", "circle", "heart"] as const;
92
87
  export const qrShapeSchema = z.enum(QR_SHAPES);
93
88
  export type QRShape = z.infer<typeof qrShapeSchema>;
94
- /** Smallest light ring between a shaped code's symbol and its decoration. */
95
- export const QR_CIRCLE_QUIET_MIN = 3;
96
-
97
- /** Most cells along a silhouette's longer side. */
98
- export const QR_SILHOUETTE_MAX_CELLS = 64;
99
- /** Fewest cells along each side of a silhouette. */
100
- export const QR_SILHOUETTE_MIN_CELLS = 8;
101
- /**
102
- * Smallest share of the artwork's width the symbol and its quiet ring may
103
- * take inside a silhouette (a circle code's is about 0.7, a heart's 0.6).
104
- * Thinner silhouettes are refused: the code would be a small square in a
105
- * large field of decoration.
106
- */
107
- export const QR_SILHOUETTE_MIN_SHARE = 0.42;
108
-
109
89
  /**
110
90
  * An outline of your own for `shape`: a small grid sampled from a picture's
111
91
  * alpha or darkness (`createQRSilhouette`, `loadQRSilhouette`), never the
@@ -148,8 +128,6 @@ export type QRSilhouette = z.infer<typeof qrSilhouetteSchema>;
148
128
  export const qrCodeShapeSchema = z.union([qrShapeSchema, qrSilhouetteSchema]);
149
129
  export type QRCodeShape = QRShape | QRSilhouette;
150
130
 
151
- /** The three finder patterns, for per-eye colors. */
152
- export const EYE_POSITIONS = ["topLeft", "topRight", "bottomLeft"] as const;
153
131
  export type EyePosition = (typeof EYE_POSITIONS)[number];
154
132
 
155
133
  /** Colors of one eye: `outer` is the frame, `inner` the dot in it. */
@@ -0,0 +1,62 @@
1
+ /** biome-ignore-all lint/performance/noBarrelFile: the zod half of qrdx/types */
2
+ // The zod schemas, and getFrameSpecIssues, which runs one. qrdx/core
3
+ // re-exports this module from a file of its own (dist/schemas.mjs), so a
4
+ // bundler leaves it, and zod, out of an app that never uses a schema. The
5
+ // engine itself validates frame specs with frame-spec-parse.ts instead.
6
+
7
+ export {
8
+ qrArtImageSchema,
9
+ qrArtModeSchema,
10
+ qrArtSchema,
11
+ qrArtVariantSchema,
12
+ } from "./art";
13
+ export {
14
+ angularGradientSchema,
15
+ colorConfigSchema,
16
+ colorTypeSchema,
17
+ gradientStopSchema,
18
+ imageFitSchema,
19
+ imagePaintSchema,
20
+ imagePositionSchema,
21
+ linearGradientSchema,
22
+ radialGradientSchema,
23
+ solidColorSchema,
24
+ } from "./color";
25
+ export { excavationSchema } from "./common";
26
+ export {
27
+ cornerEyeDotPatternSchema,
28
+ pickableCornerEyeDotPatternSchema,
29
+ } from "./corner-dot";
30
+ export {
31
+ cornerEyePatternSchema,
32
+ pickableCornerEyePatternSchema,
33
+ } from "./corner-eye";
34
+ export { frameSchema, frameStyleSchema } from "./frame";
35
+ export {
36
+ anyFrameSchema,
37
+ customFrameSchema,
38
+ frameSpecColorSchema,
39
+ frameSpecLabelSchema,
40
+ frameSpecPaintSchema,
41
+ frameSpecSchema,
42
+ frameSpecShapeSchema,
43
+ getFrameSpecIssues,
44
+ } from "./frame-spec";
45
+ export { bodyPatternSchema } from "./image-pattern";
46
+ export {
47
+ errorLevelSchema,
48
+ eyeColorOverrideSchema,
49
+ eyeColorsSchema,
50
+ imageSettingsSchema,
51
+ logoOptionsSchema,
52
+ logoShapeSchema,
53
+ qrCodeShapeSchema,
54
+ qrPropsSchema,
55
+ qrShapeSchema,
56
+ qrSilhouetteSchema,
57
+ } from "./qr";
58
+ export {
59
+ baseTemplatePropsSchema,
60
+ templateConfigSchema,
61
+ templateDefinitionBaseSchema,
62
+ } from "./template";