qrdx 0.0.45 → 0.0.47
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/LICENSE +21 -0
- package/README.md +353 -300
- package/dist/index.js +27 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -7
- package/dist/index.mjs.map +1 -1
- package/dist/qr-code-canvas.js +12 -0
- package/dist/qr-code-canvas.js.map +1 -0
- package/dist/qr-code-canvas.mjs +12 -0
- package/dist/qr-code-canvas.mjs.map +1 -0
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/art-trace.d.ts +46 -0
- package/dist/src/art-trace.d.ts.map +1 -0
- package/dist/src/art.d.ts +138 -0
- package/dist/src/art.d.ts.map +1 -0
- package/dist/src/body-patterns.d.ts +34 -0
- package/dist/src/body-patterns.d.ts.map +1 -0
- package/dist/src/codegen.d.ts +5 -5
- package/dist/src/codegen.d.ts.map +1 -1
- package/dist/src/codeword-map.d.ts +40 -0
- package/dist/src/codeword-map.d.ts.map +1 -0
- package/dist/src/constants.d.ts +4 -7
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/corner-dot.d.ts +3 -1
- package/dist/src/corner-dot.d.ts.map +1 -1
- package/dist/src/corner-eye.d.ts +5 -2
- package/dist/src/corner-eye.d.ts.map +1 -1
- package/dist/src/detection.d.ts.map +1 -1
- package/dist/src/download.d.ts +22 -5
- package/dist/src/download.d.ts.map +1 -1
- package/dist/src/eps.d.ts +62 -0
- package/dist/src/eps.d.ts.map +1 -0
- package/dist/src/frame-icons.d.ts +11 -0
- package/dist/src/frame-icons.d.ts.map +1 -0
- package/dist/src/frame-import.d.ts +61 -0
- package/dist/src/frame-import.d.ts.map +1 -0
- package/dist/src/frame-spec.d.ts +24 -0
- package/dist/src/frame-spec.d.ts.map +1 -0
- package/dist/src/frame-styles.d.ts +50 -0
- package/dist/src/frame-styles.d.ts.map +1 -0
- package/dist/src/frame.d.ts +126 -0
- package/dist/src/frame.d.ts.map +1 -0
- package/dist/src/frames/builtin.d.ts +8 -0
- package/dist/src/frames/builtin.d.ts.map +1 -0
- package/dist/src/frames/official.d.ts +18 -0
- package/dist/src/frames/official.d.ts.map +1 -0
- package/dist/src/helpers.d.ts +15 -2
- package/dist/src/helpers.d.ts.map +1 -1
- package/dist/src/index.d.ts +24 -13
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/logo-budget.d.ts +54 -0
- package/dist/src/logo-budget.d.ts.map +1 -0
- package/dist/src/logo-cleanup.d.ts +25 -0
- package/dist/src/logo-cleanup.d.ts.map +1 -0
- package/dist/src/logo.d.ts +28 -0
- package/dist/src/logo.d.ts.map +1 -0
- package/dist/src/print.d.ts +73 -0
- package/dist/src/print.d.ts.map +1 -0
- package/dist/src/qr-code-canvas.d.ts +13 -0
- package/dist/src/qr-code-canvas.d.ts.map +1 -0
- package/dist/src/qr-code.d.ts +4 -2
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/qr-outline.d.ts +41 -0
- package/dist/src/qr-outline.d.ts.map +1 -0
- package/dist/src/qr-shape.d.ts +72 -0
- package/dist/src/qr-shape.d.ts.map +1 -0
- package/dist/src/scan-risk.d.ts +40 -0
- package/dist/src/scan-risk.d.ts.map +1 -0
- package/dist/src/scan-score.d.ts +154 -0
- package/dist/src/scan-score.d.ts.map +1 -0
- package/dist/src/shapes.d.ts +36 -0
- package/dist/src/shapes.d.ts.map +1 -0
- package/dist/src/silhouette.d.ts +28 -0
- package/dist/src/silhouette.d.ts.map +1 -0
- package/dist/src/utils/color.d.ts.map +1 -1
- package/dist/src/utils/fmt.d.ts +24 -0
- package/dist/src/utils/fmt.d.ts.map +1 -0
- package/dist/src/utils/paint.d.ts +80 -0
- package/dist/src/utils/paint.d.ts.map +1 -0
- package/dist/src/utils/parse-color.d.ts +21 -0
- package/dist/src/utils/parse-color.d.ts.map +1 -0
- package/dist/src/utils/path-data.d.ts +24 -0
- package/dist/src/utils/path-data.d.ts.map +1 -0
- package/dist/src/utils/png.d.ts +16 -0
- package/dist/src/utils/png.d.ts.map +1 -0
- package/dist/src/utils/polygon-clip.d.ts +26 -0
- package/dist/src/utils/polygon-clip.d.ts.map +1 -0
- package/dist/src/utils/print-shared.d.ts +20 -0
- package/dist/src/utils/print-shared.d.ts.map +1 -0
- package/dist/src/utils/svg-geometry.d.ts +49 -0
- package/dist/src/utils/svg-geometry.d.ts.map +1 -0
- package/dist/src/utils/svg-gradient.d.ts +59 -0
- package/dist/src/utils/svg-gradient.d.ts.map +1 -0
- package/dist/src/utils/svg-painter.d.ts +152 -0
- package/dist/src/utils/svg-painter.d.ts.map +1 -0
- package/dist/src/utils.d.ts +18 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/types/art.d.ts +64 -0
- package/dist/types/art.d.ts.map +1 -0
- package/dist/types/color.d.ts +125 -7
- package/dist/types/color.d.ts.map +1 -1
- package/dist/types/corner-dot.d.ts +52 -2
- package/dist/types/corner-dot.d.ts.map +1 -1
- package/dist/types/corner-eye.d.ts +43 -2
- package/dist/types/corner-eye.d.ts.map +1 -1
- package/dist/types/frame-spec.d.ts +3509 -0
- package/dist/types/frame-spec.d.ts.map +1 -0
- package/dist/types/frame.d.ts +68 -0
- package/dist/types/frame.d.ts.map +1 -0
- package/dist/types/image-pattern.d.ts +15 -1
- package/dist/types/image-pattern.d.ts.map +1 -1
- package/dist/types/index.d.ts +15 -9
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +6 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/qr.d.ts +1684 -4
- package/dist/types/qr.d.ts.map +1 -1
- package/dist/types/template.d.ts +2 -2
- package/dist/types/template.d.ts.map +1 -1
- package/package.json +63 -20
- package/src/api.tsx +67 -17
- package/src/art-trace.ts +554 -0
- package/src/art.tsx +2226 -0
- package/src/body-patterns.tsx +389 -0
- package/src/codegen.ts +10 -5
- package/src/codeword-map.ts +265 -0
- package/src/constants.ts +4 -8
- package/src/corner-dot.tsx +209 -33
- package/src/corner-eye.ts +328 -60
- package/src/detection.ts +5 -11
- package/src/download.tsx +123 -52
- package/src/eps.ts +701 -0
- package/src/frame-icons.ts +325 -0
- package/src/frame-import.ts +1198 -0
- package/src/frame-spec.ts +518 -0
- package/src/frame-styles.ts +1095 -0
- package/src/frame.tsx +630 -0
- package/src/frames/builtin/banner-bottom.json +58 -0
- package/src/frames/builtin/circle.json +81 -0
- package/src/frames/builtin/rounded-border.json +60 -0
- package/src/frames/builtin/ticket.json +51 -0
- package/src/frames/builtin.ts +20 -0
- package/src/frames/official/attendance.json +110 -0
- package/src/frames/official/audio-guide.json +95 -0
- package/src/frames/official/book-now.json +103 -0
- package/src/frames/official/check-in.json +110 -0
- package/src/frames/official/christmas.json +131 -0
- package/src/frames/official/donate.json +77 -0
- package/src/frames/official/event-ticket.json +77 -0
- package/src/frames/official/feedback-bubble.json +73 -0
- package/src/frames/official/follow-us.json +83 -0
- package/src/frames/official/get-the-app.json +107 -0
- package/src/frames/official/halloween.json +80 -0
- package/src/frames/official/new-year.json +94 -0
- package/src/frames/official/order-at-table.json +86 -0
- package/src/frames/official/product-info.json +119 -0
- package/src/frames/official/register-product.json +77 -0
- package/src/frames/official/review-us.json +127 -0
- package/src/frames/official/rsvp-card.json +112 -0
- package/src/frames/official/save-contact.json +117 -0
- package/src/frames/official/scan-to-pay.json +94 -0
- package/src/frames/official/shop-window.json +81 -0
- package/src/frames/official/sign-rider.json +81 -0
- package/src/frames/official/table-tent.json +75 -0
- package/src/frames/official/wifi-card.json +89 -0
- package/src/frames/official/winter.json +142 -0
- package/src/frames/official.ts +77 -0
- package/src/helpers.ts +168 -11
- package/src/index.tsx +141 -172
- package/src/logo-budget.ts +226 -0
- package/src/logo-cleanup.ts +146 -0
- package/src/logo.tsx +137 -0
- package/src/print.ts +794 -0
- package/src/qr-code-canvas.tsx +241 -0
- package/src/qr-code.tsx +51 -16
- package/src/qr-outline.ts +511 -0
- package/src/qr-shape.ts +255 -0
- package/src/scan-risk.ts +197 -0
- package/src/scan-score.ts +1629 -0
- package/src/shapes.ts +169 -0
- package/src/silhouette.ts +334 -0
- package/src/utils/color.ts +10 -1
- package/src/utils/fmt.ts +59 -0
- package/src/utils/paint.ts +317 -0
- package/src/utils/parse-color.ts +135 -0
- package/src/utils/path-data.ts +182 -0
- package/src/utils/png.ts +175 -0
- package/src/utils/polygon-clip.ts +163 -0
- package/src/utils/print-shared.ts +74 -0
- package/src/utils/svg-geometry.ts +838 -0
- package/src/utils/svg-gradient.ts +407 -0
- package/src/utils/svg-painter.ts +946 -0
- package/src/utils.tsx +794 -385
- package/types/art.ts +74 -0
- package/types/color.ts +132 -12
- package/types/corner-dot.ts +41 -4
- package/types/corner-eye.ts +31 -4
- package/types/frame-spec.ts +748 -0
- package/types/frame.ts +67 -0
- package/types/image-pattern.ts +15 -0
- package/types/index.ts +106 -4
- package/types/qr.ts +180 -2
- package/types/template.ts +2 -2
- package/dist/cli.js +0 -4231
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** biome-ignore-all lint/style/noMagicNumbers: geometry */
|
|
2
|
+
export interface SvgNode {
|
|
3
|
+
name: string;
|
|
4
|
+
attrs: Record<string, string>;
|
|
5
|
+
children: SvgNode[];
|
|
6
|
+
text: string;
|
|
7
|
+
}
|
|
8
|
+
/** Parses SVG/XML markup into a tree and returns the first `<svg>` element. */
|
|
9
|
+
export declare function parseSvgMarkup(markup: string): SvgNode | null;
|
|
10
|
+
/** Affine matrix [a, b, c, d, e, f] as in SVG `matrix()` */
|
|
11
|
+
export type Matrix = [number, number, number, number, number, number];
|
|
12
|
+
export declare const IDENTITY: Matrix;
|
|
13
|
+
/** Returns `m1 × m2` (m2 is applied first). */
|
|
14
|
+
export declare function multiply(m1: Matrix, m2: Matrix): Matrix;
|
|
15
|
+
export declare function applyMatrix(m: Matrix, x: number, y: number): [number, number];
|
|
16
|
+
/** Average linear scale of a matrix (for stroke widths and font sizes). */
|
|
17
|
+
export declare function matrixScale(m: Matrix): number;
|
|
18
|
+
export declare function parseNumbers(value: string | undefined): number[];
|
|
19
|
+
/** Parses an SVG `transform` attribute into a single matrix. */
|
|
20
|
+
export declare function parseTransform(value: string | undefined): Matrix;
|
|
21
|
+
export type Segment = {
|
|
22
|
+
op: "M";
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
} | {
|
|
26
|
+
op: "L";
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
} | {
|
|
30
|
+
op: "C";
|
|
31
|
+
x1: number;
|
|
32
|
+
y1: number;
|
|
33
|
+
x2: number;
|
|
34
|
+
y2: number;
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
} | {
|
|
38
|
+
op: "Z";
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Parses SVG path data into absolute M/L/C/Z segments (H/V/S/Q/T/A are
|
|
42
|
+
* converted). Stops at the first malformed command, like browsers do.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parsePathData(d: string): Segment[];
|
|
45
|
+
/** Ellipse as four cubic segments. */
|
|
46
|
+
export declare function ellipseSegments(cx: number, cy: number, rx: number, ry: number): Segment[];
|
|
47
|
+
/** Rectangle (optionally rounded) as segments. */
|
|
48
|
+
export declare function rectSegments(x: number, y: number, width: number, height: number, rxIn?: number, ryIn?: number): Segment[];
|
|
49
|
+
//# sourceMappingURL=svg-geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-geometry.d.ts","sourceRoot":"","sources":["../../../src/utils/svg-geometry.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAI3D,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AA2QD,+E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C;AA+FhB;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,CAqMlD;AAID,sCAAsC;AACtC,wBAAgB,eAAe,CAC7B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACT,OAAO,EAAE,CA8CX;AAED,kDAAkD;AAClD,wBAAgB,YAAY,CAC1B,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,SAAI,EACR,IAAI,SAAI,GACP,OAAO,EAAE,CAuDX"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type RGBAColor } from "./parse-color";
|
|
2
|
+
import { type Matrix, type Segment, type SvgNode } from "./svg-geometry";
|
|
3
|
+
export interface ShadingStop {
|
|
4
|
+
/** 0–1, never below the previous stop's offset */
|
|
5
|
+
offset: number;
|
|
6
|
+
color: RGBAColor;
|
|
7
|
+
}
|
|
8
|
+
/** A gradient element with the attributes and stops it inherits via `href`. */
|
|
9
|
+
export interface SvgGradient {
|
|
10
|
+
kind: "linear" | "radial";
|
|
11
|
+
attrs: Record<string, string>;
|
|
12
|
+
stops: ShadingStop[];
|
|
13
|
+
}
|
|
14
|
+
/** A gradient placed on one shape. */
|
|
15
|
+
export interface PlacedGradient {
|
|
16
|
+
kind: "linear" | "radial";
|
|
17
|
+
/**
|
|
18
|
+
* Shading `Coords` in gradient space: `[x1 y1 x2 y2]` for linear,
|
|
19
|
+
* `[fx fy fr cx cy r]` (focal circle to end circle) for radial.
|
|
20
|
+
*/
|
|
21
|
+
coords: number[];
|
|
22
|
+
/** Gradient space → the shape's user space */
|
|
23
|
+
matrix: Matrix;
|
|
24
|
+
stops: ShadingStop[];
|
|
25
|
+
}
|
|
26
|
+
export type ShadingColorSpace = "rgb" | "cmyk";
|
|
27
|
+
/** Every gradient in the tree by id, with `href` inheritance resolved. */
|
|
28
|
+
export declare function collectGradients(root: SvgNode): Map<string, SvgGradient>;
|
|
29
|
+
/** Tight bounding box of segments (cubic extrema included). */
|
|
30
|
+
export declare function boundingBox(segments: Segment[]): {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
} | null;
|
|
36
|
+
/** Inverse of an affine matrix, or null when it is singular. */
|
|
37
|
+
export declare function invertMatrix(m: Matrix): Matrix | null;
|
|
38
|
+
/**
|
|
39
|
+
* Places a gradient on a shape (segments in the shape's user space, `viewport`
|
|
40
|
+
* for percentage lengths). Returns the solid color SVG paints instead when the
|
|
41
|
+
* gradient is degenerate (one stop, a zero-length vector, a zero radius), or
|
|
42
|
+
* null when the shape gets no paint (no stops, all stops transparent, a
|
|
43
|
+
* bounding box with no width or height).
|
|
44
|
+
*
|
|
45
|
+
* `spreadMethod` reflect/repeat are drawn as pad, and stop opacity is ignored
|
|
46
|
+
* (PostScript has no transparency; the PDF stays consistent with it).
|
|
47
|
+
*/
|
|
48
|
+
export declare function placeGradient(gradient: SvgGradient, segments: Segment[], viewport: [number, number]): PlacedGradient | RGBAColor | null;
|
|
49
|
+
/** Shading matrix for PDF and PostScript (6 decimals: it scales). */
|
|
50
|
+
export declare function formatMatrix(matrix: Matrix): string;
|
|
51
|
+
/**
|
|
52
|
+
* Shading dictionary for a placed gradient, valid both as a PDF object and as
|
|
53
|
+
* PostScript LanguageLevel 3 `shfill` operand. Its `Coords` are in gradient
|
|
54
|
+
* space: concatenate `gradient.matrix` (and the shape's matrix) first.
|
|
55
|
+
* Colors use the same space as the writer's solid fills (DeviceCMYK through
|
|
56
|
+
* `rgbToCmyk` in "cmyk" mode), so the blend runs between the converted stops.
|
|
57
|
+
*/
|
|
58
|
+
export declare function shadingDictionary(gradient: PlacedGradient, space: ShadingColorSpace): string;
|
|
59
|
+
//# sourceMappingURL=svg-gradient.d.ts.map
|
|
@@ -0,0 +1 @@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CAAC,GACzB,cAAc,GAAG,SAAS,GAAG,IAAI,CAsEnC;AAED,qEAAqE;AACrE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AA4DD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,iBAAiB,GACvB,MAAM,CAQR"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { type RGBAColor } from "./parse-color";
|
|
2
|
+
import { type Matrix, type Segment, type SvgNode } from "./svg-geometry";
|
|
3
|
+
import { type PlacedGradient, type SvgGradient } from "./svg-gradient";
|
|
4
|
+
export interface PaintState {
|
|
5
|
+
matrix: Matrix;
|
|
6
|
+
fill: string;
|
|
7
|
+
fillRule: string;
|
|
8
|
+
stroke: string;
|
|
9
|
+
strokeWidth: number;
|
|
10
|
+
fontSize: number;
|
|
11
|
+
fontWeight: string;
|
|
12
|
+
textAnchor: string;
|
|
13
|
+
/** Viewport size, for percentage lengths */
|
|
14
|
+
viewport: [number, number];
|
|
15
|
+
/** Inherited `fill-opacity` (1 when unset) */
|
|
16
|
+
fillOpacity?: number;
|
|
17
|
+
/**
|
|
18
|
+
* `opacity` of this element times its ancestors' (1 when unset). Exact for
|
|
19
|
+
* shapes that don't overlap inside a see-through group, as in QR codes.
|
|
20
|
+
*/
|
|
21
|
+
opacity?: number;
|
|
22
|
+
}
|
|
23
|
+
export type PaintColor = RGBAColor | null;
|
|
24
|
+
/**
|
|
25
|
+
* A fill: a solid color (its `a` folds in fill-opacity and opacity), a
|
|
26
|
+
* gradient placed on the shape being painted (`alpha` multiplies its stops'
|
|
27
|
+
* own alpha), or a userSpaceOnUse `<pattern>` (angular gradients and image
|
|
28
|
+
* fills) whose content is painted inside the shape.
|
|
29
|
+
*/
|
|
30
|
+
export type FillPaint = {
|
|
31
|
+
color: RGBAColor;
|
|
32
|
+
} | {
|
|
33
|
+
gradient: PlacedGradient;
|
|
34
|
+
alpha: number;
|
|
35
|
+
} | {
|
|
36
|
+
pattern: SvgNode;
|
|
37
|
+
alpha: number;
|
|
38
|
+
};
|
|
39
|
+
export declare function readStyle(node: SvgNode, name: string): string | undefined;
|
|
40
|
+
export declare function length(value: string | undefined, reference: number, fallback?: number): number;
|
|
41
|
+
export declare function collectGradientColors(node: SvgNode, out: Map<string, string>): Map<string, string>;
|
|
42
|
+
export declare function collectImageHrefs(node: SvgNode, out: Set<string>): Set<string>;
|
|
43
|
+
export declare function imageFormat(href: string): "PNG" | "JPEG" | null;
|
|
44
|
+
/** Converts logos jsPDF can't embed (SVG, WebP, URLs) to PNG in the browser. */
|
|
45
|
+
export declare function rasterizeImage(href: string): Promise<string | null>;
|
|
46
|
+
export interface ImageBox {
|
|
47
|
+
x: number;
|
|
48
|
+
y: number;
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Where an `<image>` draws, in its user space: its x/y/width/height box,
|
|
54
|
+
* or, with an explicit preserveAspectRatio other than "none" and the
|
|
55
|
+
* picture's own size, the picture fitted into it (`meet`) or covering it
|
|
56
|
+
* (`slice`, which then clips to the box). Without the attribute the picture
|
|
57
|
+
* is stretched to the box, as the engine's logos ask ("none").
|
|
58
|
+
*/
|
|
59
|
+
export declare function imagePlacement(node: SvgNode, viewport: [number, number], intrinsic?: {
|
|
60
|
+
width: number;
|
|
61
|
+
height: number;
|
|
62
|
+
} | null): {
|
|
63
|
+
draw: ImageBox;
|
|
64
|
+
clip: ImageBox | null;
|
|
65
|
+
} | null;
|
|
66
|
+
export declare abstract class SvgPainter {
|
|
67
|
+
protected readonly gradients: Map<string, string>;
|
|
68
|
+
/** Gradients the backend shades natively (see `resolveFill`) */
|
|
69
|
+
protected readonly shadings: Map<string, SvgGradient> | null;
|
|
70
|
+
/** `<clipPath>`s of the document being walked (collected at its root) */
|
|
71
|
+
private clipPaths;
|
|
72
|
+
/** `<pattern>`s of the document being walked (collected at its root) */
|
|
73
|
+
private patterns;
|
|
74
|
+
/**
|
|
75
|
+
* Opaque color see-through paint is flattened over where a backend can't
|
|
76
|
+
* blend (PostScript; a PDF gradient whose stops differ in alpha; a PDF
|
|
77
|
+
* angular fan): the code's background on paper. The background itself is
|
|
78
|
+
* flattened over `paper`: the shape filled with the background gradient
|
|
79
|
+
* (`url(#bg-color-…)`) or with the background color. Exporters set all
|
|
80
|
+
* three from the props.
|
|
81
|
+
*/
|
|
82
|
+
backdrop: RGBAColor;
|
|
83
|
+
paper: RGBAColor;
|
|
84
|
+
/** The background's color as drawn (alpha included), when it is solid */
|
|
85
|
+
background: RGBAColor | null;
|
|
86
|
+
/** True while painting the background shape (and its pattern) */
|
|
87
|
+
protected onPaper: boolean;
|
|
88
|
+
/** True while painting an angular gradient's wedge fan */
|
|
89
|
+
protected inConic: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* `gradients` maps gradient ids to the color they flatten to. Pass
|
|
92
|
+
* `shadings` (from `collectGradients`) when the backend can shade them.
|
|
93
|
+
*/
|
|
94
|
+
constructor(gradients: Map<string, string>, shadings?: Map<string, SvgGradient> | null);
|
|
95
|
+
resolveColor(value: string | undefined): PaintColor;
|
|
96
|
+
/** The gradient a `url(#id)` paint shades natively, if any. */
|
|
97
|
+
shadedGradient(value: string | undefined): SvgGradient | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Resolves a fill for these segments: a gradient this painter shades is
|
|
100
|
+
* placed on the shape (or becomes the solid color SVG paints for a
|
|
101
|
+
* degenerate gradient), a userSpaceOnUse pattern is returned to paint
|
|
102
|
+
* inside the shape, and anything else goes through `resolveColor`.
|
|
103
|
+
* `alpha` (fill-opacity times opacity) is folded into solid colors and
|
|
104
|
+
* returned alongside gradients and patterns.
|
|
105
|
+
*/
|
|
106
|
+
resolveFill(value: string | undefined, segments: Segment[], viewport: [number, number], alpha?: number): FillPaint | null;
|
|
107
|
+
/** The userSpaceOnUse `<pattern>` a `url(#id)` paint points to, if any. */
|
|
108
|
+
patternOf(value: string | undefined): SvgNode | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* `color` made opaque for a backend without transparency: over paper
|
|
111
|
+
* while painting the background, over the backdrop otherwise.
|
|
112
|
+
*/
|
|
113
|
+
flatten(color: RGBAColor): RGBAColor;
|
|
114
|
+
/**
|
|
115
|
+
* Paints a pattern's content inside `segments` (the shape, in the user
|
|
116
|
+
* space of `state`): clip to the shape, then walk the tiles that meet it.
|
|
117
|
+
* The tile at (x, y) holds the content with its origin at the tile's
|
|
118
|
+
* corner, and content past a tile is cut off when there is more than one.
|
|
119
|
+
* A pattern marked `data-qrdx-conic` (an angular gradient's wedge fan)
|
|
120
|
+
* only walks the wedges whose `data-arc` meets the shape.
|
|
121
|
+
* Returns false when this backend can't clip (nothing is painted).
|
|
122
|
+
*/
|
|
123
|
+
paintPattern(segments: Segment[], state: PaintState, pattern: SvgNode, alpha: number): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Paints the output rectangle `box` ([x0, y0, x1, y1] in output
|
|
126
|
+
* coordinates) with a gradient `fill`, placed in the user space of `root`
|
|
127
|
+
* as walked with `state`, so a background gradient continues into the
|
|
128
|
+
* bleed. Returns false (painting nothing) when `fill` is not a gradient
|
|
129
|
+
* this painter shades.
|
|
130
|
+
*/
|
|
131
|
+
paintBleed(root: SvgNode, state: PaintState, fill: string, box: [number, number, number, number]): boolean;
|
|
132
|
+
abstract paint(segments: Segment[], node: SvgNode, state: PaintState): void;
|
|
133
|
+
abstract text(node: SvgNode, state: PaintState): void;
|
|
134
|
+
abstract image(node: SvgNode, state: PaintState): void;
|
|
135
|
+
/**
|
|
136
|
+
* Restricts painting to `segments` (device space via `matrix`) until the
|
|
137
|
+
* matching `endClip`. Backends that can't clip leave this as is, so they
|
|
138
|
+
* paint the element unclipped.
|
|
139
|
+
*/
|
|
140
|
+
beginClip(_segments: Segment[], _matrix: Matrix, _evenOdd: boolean): boolean;
|
|
141
|
+
/** Ends the clip a `beginClip` that returned true started. */
|
|
142
|
+
endClip(): void;
|
|
143
|
+
/**
|
|
144
|
+
* The `clip-path="url(#id)"` outline of `node` (userSpaceOnUse: the
|
|
145
|
+
* node's own user space), or null when it has none or it can't be found.
|
|
146
|
+
*/
|
|
147
|
+
private clipOf;
|
|
148
|
+
viewportMatrix(node: SvgNode, state: PaintState): [Matrix, [number, number]];
|
|
149
|
+
walk(node: SvgNode, parent: PaintState, isRoot?: boolean): void;
|
|
150
|
+
private paintNode;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=svg-painter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg-painter.d.ts","sourceRoot":"","sources":["../../../src/utils/svg-painter.ts"],"names":[],"mappings":"AAIA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAGL,KAAK,MAAM,EAMX,KAAK,OAAO,EACZ,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAGL,KAAK,cAAc,EAEnB,KAAK,WAAW,EACjB,MAAM,gBAAgB,CAAC;AAiBxB,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GACjB;IAAE,KAAK,EAAE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
import type { ErrorLevel, Excavation, ImageSettings, Modules, QRPropsSVG } from "../types";
|
|
3
|
+
import { type QRCodeShape } from "../types/qr";
|
|
3
4
|
export declare function excavateModules(modules: Modules, excavation: Excavation): Modules;
|
|
4
5
|
export declare function generatePath(modules: Modules, margin?: number): string;
|
|
5
6
|
export { getSolidColor } from "./utils/color";
|
|
6
|
-
export declare function getImageSettings(cells: Modules, size: number,
|
|
7
|
+
export declare function getImageSettings(cells: Modules, size: number, margin: number, imageSettings?: ImageSettings): null | {
|
|
7
8
|
x: number;
|
|
8
9
|
y: number;
|
|
9
10
|
h: number;
|
|
10
11
|
w: number;
|
|
11
12
|
excavation: Excavation | null;
|
|
12
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Error correction level a code is drawn at. With `autoLevel`, a logo that
|
|
16
|
+
* covers more than `AUTO_LEVEL_LOGO_COVERAGE` (7%) of the code raises the
|
|
17
|
+
* level to H. `isOGContext` with an excavated logo raises L/M to Q (as before).
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveErrorLevel(props: {
|
|
20
|
+
value: string;
|
|
21
|
+
size?: number;
|
|
22
|
+
level?: ErrorLevel;
|
|
23
|
+
margin?: number;
|
|
24
|
+
imageSettings?: ImageSettings;
|
|
25
|
+
isOGContext?: boolean;
|
|
26
|
+
autoLevel?: boolean;
|
|
27
|
+
shape?: QRCodeShape;
|
|
28
|
+
}): ErrorLevel;
|
|
13
29
|
export declare function convertImageSettingsToPixels(calculatedImageSettings: {
|
|
14
30
|
x: number;
|
|
15
31
|
y: number;
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK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EAAE,MAAM,CAAC;IACV,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CAC/B,EACD,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM;;;;;EASf;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,eAomB1C;AAOD,eAAO,MAAM,eAAe,SAOxB,CAAC;AAGL,eAAO,MAAM,QAAQ,GACnB,KAAK,MAAM,KACV;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAqBxC,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAM9D,CAAC;AAcF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,QAAQ,MAAM,KAAG,MAejE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,MAAM,KACZ;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAmBpD,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Art modes blend a picture into the code itself (vector output, no AI):
|
|
4
|
+
* - "logo" (Logo QR): the logo, traced into crisp vector shapes, either fills
|
|
5
|
+
* the code under a fine dot screen ("blend") or sits on a rounded plate in
|
|
6
|
+
* the middle of a code tinted with its colors ("badge").
|
|
7
|
+
* - "halftone" (Image QR): the photo shows through every module around a
|
|
8
|
+
* small center dot that keeps the module's dark/light value, in full color
|
|
9
|
+
* ("color") or as an error-diffused black-and-white halftone ("mono").
|
|
10
|
+
* Finder, alignment and format patterns always stay crisp.
|
|
11
|
+
*/
|
|
12
|
+
export declare const QR_ART_MODES: readonly ["logo", "halftone"];
|
|
13
|
+
export declare const qrArtModeSchema: z.ZodEnum<{
|
|
14
|
+
logo: "logo";
|
|
15
|
+
halftone: "halftone";
|
|
16
|
+
}>;
|
|
17
|
+
export type QRArtMode = z.infer<typeof qrArtModeSchema>;
|
|
18
|
+
/** Looks within each mode; the first one is the mode's default. */
|
|
19
|
+
export declare const QR_ART_VARIANTS: {
|
|
20
|
+
readonly logo: readonly ["blend", "badge"];
|
|
21
|
+
readonly halftone: readonly ["color", "mono"];
|
|
22
|
+
};
|
|
23
|
+
export declare const qrArtVariantSchema: z.ZodEnum<{
|
|
24
|
+
color: "color";
|
|
25
|
+
blend: "blend";
|
|
26
|
+
badge: "badge";
|
|
27
|
+
mono: "mono";
|
|
28
|
+
}>;
|
|
29
|
+
export type QRArtVariant = z.infer<typeof qrArtVariantSchema>;
|
|
30
|
+
/** Largest side of an art sample grid, in pixels. */
|
|
31
|
+
export declare const QR_ART_MAX_SAMPLE_SIZE = 192;
|
|
32
|
+
/**
|
|
33
|
+
* A small RGBA bitmap sampled from the source image (see `createQRArtImage`
|
|
34
|
+
* and `loadQRArtImage`). Storing pixels instead of an image URL keeps
|
|
35
|
+
* rendering synchronous and identical in the browser, on the server and in
|
|
36
|
+
* the CLI, and never fetches anything.
|
|
37
|
+
*/
|
|
38
|
+
export declare const qrArtImageSchema: z.ZodObject<{
|
|
39
|
+
width: z.ZodNumber;
|
|
40
|
+
height: z.ZodNumber;
|
|
41
|
+
data: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type QRArtImage = z.infer<typeof qrArtImageSchema>;
|
|
44
|
+
export declare const qrArtSchema: z.ZodObject<{
|
|
45
|
+
mode: z.ZodEnum<{
|
|
46
|
+
logo: "logo";
|
|
47
|
+
halftone: "halftone";
|
|
48
|
+
}>;
|
|
49
|
+
image: z.ZodObject<{
|
|
50
|
+
width: z.ZodNumber;
|
|
51
|
+
height: z.ZodNumber;
|
|
52
|
+
data: z.ZodString;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
intensity: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
variant: z.ZodOptional<z.ZodEnum<{
|
|
56
|
+
color: "color";
|
|
57
|
+
blend: "blend";
|
|
58
|
+
badge: "badge";
|
|
59
|
+
mono: "mono";
|
|
60
|
+
}>>;
|
|
61
|
+
matchEyes: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type QRArt = z.infer<typeof qrArtSchema>;
|
|
64
|
+
//# sourceMappingURL=art.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"art.d.ts","sourceRoot":"","sources":["../../types/art.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,+BAAgC,CAAC;AAE1D,eAAO,MAAM,eAAe;;;EAAuB,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,mEAAmE;AACnE,eAAO,MAAM,eAAe;;;CAG6B,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;;;;EAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,qDAAqD;AACrD,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAI1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;iBAa1B,CAAC;AACJ,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;iBAgBtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/dist/types/color.d.ts
CHANGED
|
@@ -6,10 +6,14 @@ export declare const colorTypeSchema: z.ZodEnum<{
|
|
|
6
6
|
solid: "solid";
|
|
7
7
|
linear: "linear";
|
|
8
8
|
radial: "radial";
|
|
9
|
+
angular: "angular";
|
|
10
|
+
image: "image";
|
|
9
11
|
}>;
|
|
10
12
|
export type ColorType = z.infer<typeof colorTypeSchema>;
|
|
11
13
|
/**
|
|
12
|
-
* Solid color configuration
|
|
14
|
+
* Solid color configuration. `color` is any CSS color the engine parses
|
|
15
|
+
* (hex with or without alpha, rgb()/rgba(), a name); alpha is kept in it,
|
|
16
|
+
* e.g. "#1d4ed880" or "rgba(29, 78, 216, 0.5)".
|
|
13
17
|
*/
|
|
14
18
|
export declare const solidColorSchema: z.ZodObject<{
|
|
15
19
|
type: z.ZodLiteral<"solid">;
|
|
@@ -17,7 +21,8 @@ export declare const solidColorSchema: z.ZodObject<{
|
|
|
17
21
|
}, z.core.$strip>;
|
|
18
22
|
export type SolidColor = z.infer<typeof solidColorSchema>;
|
|
19
23
|
/**
|
|
20
|
-
* Gradient stop configuration
|
|
24
|
+
* Gradient stop configuration. A stop's color may carry alpha, as a solid
|
|
25
|
+
* color does.
|
|
21
26
|
*/
|
|
22
27
|
export declare const gradientStopSchema: z.ZodObject<{
|
|
23
28
|
color: z.ZodString;
|
|
@@ -49,13 +54,87 @@ export declare const radialGradientSchema: z.ZodObject<{
|
|
|
49
54
|
}, z.core.$strip>>;
|
|
50
55
|
}, z.core.$strip>;
|
|
51
56
|
export type RadialGradient = z.infer<typeof radialGradientSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* Angular (conic) gradient: the color sweeps clockwise around the centre of
|
|
59
|
+
* the shape it fills, like CSS `conic-gradient(from <angle>deg, …)`.
|
|
60
|
+
* `angle` is where the sweep starts, in degrees clockwise from the top
|
|
61
|
+
* (0 = 12 o'clock). Offsets run 0–100 around the full turn.
|
|
62
|
+
*/
|
|
63
|
+
export declare const angularGradientSchema: z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"angular">;
|
|
65
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
66
|
+
color: z.ZodString;
|
|
67
|
+
offset: z.ZodNumber;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
angle: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export type AngularGradient = z.infer<typeof angularGradientSchema>;
|
|
72
|
+
/** Any gradient: linear, radial or angular. */
|
|
73
|
+
export type Gradient = LinearGradient | RadialGradient | AngularGradient;
|
|
74
|
+
/** How an image fill sits in the code: fill it, fit inside it, or repeat. */
|
|
75
|
+
export declare const imageFitSchema: z.ZodEnum<{
|
|
76
|
+
cover: "cover";
|
|
77
|
+
contain: "contain";
|
|
78
|
+
tile: "tile";
|
|
79
|
+
}>;
|
|
80
|
+
export type ImageFit = z.infer<typeof imageFitSchema>;
|
|
81
|
+
/** Which part of the image stays in view (cover) or where it sits (contain). */
|
|
82
|
+
export declare const imagePositionSchema: z.ZodEnum<{
|
|
83
|
+
center: "center";
|
|
84
|
+
"top-left": "top-left";
|
|
85
|
+
top: "top";
|
|
86
|
+
"top-right": "top-right";
|
|
87
|
+
left: "left";
|
|
88
|
+
right: "right";
|
|
89
|
+
"bottom-left": "bottom-left";
|
|
90
|
+
bottom: "bottom";
|
|
91
|
+
"bottom-right": "bottom-right";
|
|
92
|
+
}>;
|
|
93
|
+
export type ImagePosition = z.infer<typeof imagePositionSchema>;
|
|
94
|
+
/**
|
|
95
|
+
* An image fill: a picture painted through the shapes it fills, laid over
|
|
96
|
+
* the code's whole area (so the dots and the eyes show one picture).
|
|
97
|
+
*
|
|
98
|
+
* `src` is held like a logo: a data URL (PNG or JPEG embed everywhere; other
|
|
99
|
+
* formats are redrawn as PNG in the browser). Servers never fetch a remote
|
|
100
|
+
* address. `scale` zooms around `position` (cover, contain) or sizes the
|
|
101
|
+
* tiles (1 = four across). `opacity` lets `underlay`, a solid color under
|
|
102
|
+
* the picture, show through: darken a photo for the dots, lighten it for
|
|
103
|
+
* the background.
|
|
104
|
+
*/
|
|
105
|
+
export declare const imagePaintSchema: z.ZodObject<{
|
|
106
|
+
type: z.ZodLiteral<"image">;
|
|
107
|
+
src: z.ZodString;
|
|
108
|
+
fit: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
cover: "cover";
|
|
110
|
+
contain: "contain";
|
|
111
|
+
tile: "tile";
|
|
112
|
+
}>>>;
|
|
113
|
+
scale: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
114
|
+
position: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
115
|
+
center: "center";
|
|
116
|
+
"top-left": "top-left";
|
|
117
|
+
top: "top";
|
|
118
|
+
"top-right": "top-right";
|
|
119
|
+
left: "left";
|
|
120
|
+
right: "right";
|
|
121
|
+
"bottom-left": "bottom-left";
|
|
122
|
+
bottom: "bottom";
|
|
123
|
+
"bottom-right": "bottom-right";
|
|
124
|
+
}>>>;
|
|
125
|
+
opacity: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
126
|
+
underlay: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strip>;
|
|
128
|
+
export type ImagePaint = z.infer<typeof imagePaintSchema>;
|
|
52
129
|
/**
|
|
53
130
|
* Union type for color configuration
|
|
54
131
|
* Supports:
|
|
55
132
|
* - string: backward compatible solid color
|
|
56
133
|
* - SolidColor: explicit solid color object
|
|
57
|
-
* - LinearGradient: linear gradient with
|
|
58
|
-
* - RadialGradient: radial gradient
|
|
134
|
+
* - LinearGradient: linear gradient with stops and an angle
|
|
135
|
+
* - RadialGradient: radial gradient from the centre out
|
|
136
|
+
* - AngularGradient: conic gradient around the centre
|
|
137
|
+
* - ImagePaint: a picture painted through the shapes
|
|
59
138
|
*/
|
|
60
139
|
export declare const colorConfigSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
61
140
|
type: z.ZodLiteral<"solid">;
|
|
@@ -73,20 +152,59 @@ export declare const colorConfigSchema: z.ZodUnion<readonly [z.ZodString, z.ZodO
|
|
|
73
152
|
color: z.ZodString;
|
|
74
153
|
offset: z.ZodNumber;
|
|
75
154
|
}, z.core.$strip>>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"angular">;
|
|
157
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
158
|
+
color: z.ZodString;
|
|
159
|
+
offset: z.ZodNumber;
|
|
160
|
+
}, z.core.$strip>>;
|
|
161
|
+
angle: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"image">;
|
|
164
|
+
src: z.ZodString;
|
|
165
|
+
fit: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
166
|
+
cover: "cover";
|
|
167
|
+
contain: "contain";
|
|
168
|
+
tile: "tile";
|
|
169
|
+
}>>>;
|
|
170
|
+
scale: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
171
|
+
position: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
172
|
+
center: "center";
|
|
173
|
+
"top-left": "top-left";
|
|
174
|
+
top: "top";
|
|
175
|
+
"top-right": "top-right";
|
|
176
|
+
left: "left";
|
|
177
|
+
right: "right";
|
|
178
|
+
"bottom-left": "bottom-left";
|
|
179
|
+
bottom: "bottom";
|
|
180
|
+
"bottom-right": "bottom-right";
|
|
181
|
+
}>>>;
|
|
182
|
+
opacity: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
183
|
+
underlay: z.ZodOptional<z.ZodString>;
|
|
76
184
|
}, z.core.$strip>]>;
|
|
77
185
|
export type ColorConfig = z.infer<typeof colorConfigSchema>;
|
|
78
186
|
/**
|
|
79
187
|
* Helper to normalize color config to object format
|
|
80
188
|
*/
|
|
81
|
-
export declare function normalizeColorConfig(color: ColorConfig | undefined, fallback?: string): SolidColor |
|
|
189
|
+
export declare function normalizeColorConfig(color: ColorConfig | undefined, fallback?: string): SolidColor | Gradient | ImagePaint;
|
|
82
190
|
/**
|
|
83
191
|
* Helper to check if color is gradient
|
|
84
192
|
*/
|
|
85
|
-
export declare function isGradient(color: ColorConfig | undefined): color is
|
|
193
|
+
export declare function isGradient(color: ColorConfig | undefined): color is Gradient;
|
|
194
|
+
/** True for an image fill. */
|
|
195
|
+
export declare function isImagePaint(color: ColorConfig | undefined): color is ImagePaint;
|
|
86
196
|
/**
|
|
87
197
|
* Helper to get a solid color string from any ColorConfig
|
|
88
|
-
* For gradients, returns the first stop color
|
|
198
|
+
* For gradients, returns the first stop color; for an image fill, its
|
|
199
|
+
* underlay (or `fallback`)
|
|
89
200
|
*/
|
|
90
201
|
export declare function getColorString(color: ColorConfig | undefined, fallback?: string): string;
|
|
202
|
+
/** CSS `background-position` for an image fill's position. */
|
|
203
|
+
export declare function imagePositionCss(position?: ImagePosition): string;
|
|
204
|
+
/**
|
|
205
|
+
* CSS `background` for a color config, for swatches and previews: the color
|
|
206
|
+
* itself, or a CSS gradient that matches how the engine draws it (a linear
|
|
207
|
+
* angle of 0 runs left to right, as in the QR code).
|
|
208
|
+
*/
|
|
91
209
|
export declare function getNormalizedColor(color: ColorConfig | string | undefined): string;
|
|
92
210
|
//# sourceMappingURL=color.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../types/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../types/color.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;EAM1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD;;;;GAIG;AACH,eAA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;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,WAAW,GAAG,SAAS,EAC9B,QAAQ,SAAY,GACnB,UAAU,GAAG,QAAQ,GAAG,UAAU,CAQpC;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,KAAK,IAAI,QAAQ,CAS5E;AAED,8BAA8B;AAC9B,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,KAAK,IAAI,UAAU,CAErB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,WAAW,GAAG,SAAS,EAC9B,QAAQ,SAAY,GACnB,MAAM,CASR;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,QAAQ,GAAE,aAAwB,GAAG,MAAM,CAW3E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,GACtC,MAAM,CA2CR"}
|
|
@@ -1,17 +1,67 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Eye centres to offer: every one decodes with jsQR and ZXing through a
|
|
4
|
+
* phone-camera model and in sharp renders (tests/catalog-*.test.ts).
|
|
5
|
+
*/
|
|
6
|
+
export declare const CORNER_EYE_DOT_PATTERNS: readonly ["square", "rounded", "circle", "message", "message-reverse", "diya", "diya-reverse", "rounded-triangle", "leaf", "drop", "plus", "cross-rounded", "hexagon", "octagon", "flower", "heart", "squircle", "dots", "extra-rounded", "leaf-reverse", "drop-reverse"];
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated Retired eye centres: they don't decode reliably (`diamond`
|
|
9
|
+
* and `star` fail ZXing at phone distances, `banner` fails jsQR in every
|
|
10
|
+
* sharp render). The renderer still draws them so saved designs keep
|
|
11
|
+
* working, but nothing offers them any more.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RETIRED_CORNER_EYE_DOT_PATTERNS: readonly ["diamond", "star", "banner"];
|
|
14
|
+
/** Accepts current and retired values, so saved designs still validate. */
|
|
3
15
|
export declare const cornerEyeDotPatternSchema: z.ZodEnum<{
|
|
4
16
|
message: "message";
|
|
5
17
|
square: "square";
|
|
6
18
|
rounded: "rounded";
|
|
7
19
|
circle: "circle";
|
|
8
|
-
diamond: "diamond";
|
|
9
20
|
"message-reverse": "message-reverse";
|
|
10
21
|
diya: "diya";
|
|
11
22
|
"diya-reverse": "diya-reverse";
|
|
12
23
|
"rounded-triangle": "rounded-triangle";
|
|
24
|
+
leaf: "leaf";
|
|
25
|
+
drop: "drop";
|
|
26
|
+
plus: "plus";
|
|
27
|
+
"cross-rounded": "cross-rounded";
|
|
28
|
+
hexagon: "hexagon";
|
|
29
|
+
octagon: "octagon";
|
|
30
|
+
flower: "flower";
|
|
31
|
+
heart: "heart";
|
|
32
|
+
squircle: "squircle";
|
|
33
|
+
dots: "dots";
|
|
34
|
+
"extra-rounded": "extra-rounded";
|
|
35
|
+
"leaf-reverse": "leaf-reverse";
|
|
36
|
+
"drop-reverse": "drop-reverse";
|
|
37
|
+
diamond: "diamond";
|
|
13
38
|
star: "star";
|
|
14
39
|
banner: "banner";
|
|
15
40
|
}>;
|
|
41
|
+
/** Current values only: for anything that offers a choice (UI, AI, MCP). */
|
|
42
|
+
export declare const pickableCornerEyeDotPatternSchema: z.ZodEnum<{
|
|
43
|
+
message: "message";
|
|
44
|
+
square: "square";
|
|
45
|
+
rounded: "rounded";
|
|
46
|
+
circle: "circle";
|
|
47
|
+
"message-reverse": "message-reverse";
|
|
48
|
+
diya: "diya";
|
|
49
|
+
"diya-reverse": "diya-reverse";
|
|
50
|
+
"rounded-triangle": "rounded-triangle";
|
|
51
|
+
leaf: "leaf";
|
|
52
|
+
drop: "drop";
|
|
53
|
+
plus: "plus";
|
|
54
|
+
"cross-rounded": "cross-rounded";
|
|
55
|
+
hexagon: "hexagon";
|
|
56
|
+
octagon: "octagon";
|
|
57
|
+
flower: "flower";
|
|
58
|
+
heart: "heart";
|
|
59
|
+
squircle: "squircle";
|
|
60
|
+
dots: "dots";
|
|
61
|
+
"extra-rounded": "extra-rounded";
|
|
62
|
+
"leaf-reverse": "leaf-reverse";
|
|
63
|
+
"drop-reverse": "drop-reverse";
|
|
64
|
+
}>;
|
|
16
65
|
export type CornerEyeDotPattern = z.infer<typeof cornerEyeDotPatternSchema>;
|
|
66
|
+
export type PickableCornerEyeDotPattern = (typeof CORNER_EYE_DOT_PATTERNS)[number];
|
|
17
67
|
//# sourceMappingURL=corner-dot.d.ts.map
|