qrdx 0.0.60 → 0.0.61
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/README.md +1 -1
- package/dist/core.js +7 -7
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +7 -7
- package/dist/core.mjs.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/dist/node.js +2 -2
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +2 -2
- package/dist/node.mjs.map +1 -1
- package/dist/qr-code-canvas.js +1 -1
- package/dist/qr-code-canvas.js.map +1 -1
- package/dist/qr-code-canvas.mjs +1 -1
- package/dist/qr-code-canvas.mjs.map +1 -1
- package/dist/src/api.d.ts +2 -3
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/qr-code-canvas.d.ts +2 -8
- package/dist/src/qr-code-canvas.d.ts.map +1 -1
- package/dist/src/qr-code-svg.d.ts +2 -3
- package/dist/src/qr-code-svg.d.ts.map +1 -1
- package/dist/src/qr-code.d.ts +2 -2
- package/dist/src/qr-code.d.ts.map +1 -1
- package/dist/src/qr-frame-svg.d.ts +2 -3
- package/dist/src/qr-frame-svg.d.ts.map +1 -1
- package/dist/src/rasterize.d.ts +8 -0
- package/dist/src/rasterize.d.ts.map +1 -1
- package/dist/src/react-elements.d.ts.map +1 -1
- package/dist/src/scan-score.d.ts +34 -0
- package/dist/src/scan-score.d.ts.map +1 -1
- package/dist/types/react.d.ts +21 -3
- package/dist/types/react.d.ts.map +1 -1
- package/dist/vanilla.browser.mjs +12 -12
- package/dist/vanilla.browser.mjs.map +1 -1
- package/package.json +4 -6
- package/src/api.tsx +3 -4
- package/src/qr-code-canvas.tsx +34 -27
- package/src/qr-code-svg.tsx +3 -4
- package/src/qr-code.tsx +7 -5
- package/src/qr-frame-svg.tsx +3 -4
- package/src/rasterize.ts +14 -1
- package/src/react-elements.ts +40 -2
- package/src/scan-score.ts +220 -47
- package/types/react.ts +22 -3
package/types/react.ts
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
// Prop types of the React components. Only the React entry (and the
|
|
2
2
|
// `qrdx/types` entry, for compatibility) reach this file; the core's types
|
|
3
3
|
// never do, so they work without React's types installed.
|
|
4
|
-
import type { CanvasHTMLAttributes, ReactElement, SVGProps } from "react";
|
|
4
|
+
import type { CanvasHTMLAttributes, ReactElement, Ref, SVGProps } from "react";
|
|
5
5
|
import type { FrameTreeOptions } from "../src/frame";
|
|
6
6
|
import type { QRCodeProps } from "../src/qr-code-props";
|
|
7
7
|
import type { QRProps } from "./qr";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* What the React components return: `ReactElement<any, any>`, the type that
|
|
11
|
+
* React 18 and 19's types call `JSX.Element`. It's spelled out because the
|
|
12
|
+
* `react` module of @types/react 16 and 17 has no `JSX` to import.
|
|
13
|
+
*/
|
|
14
|
+
export type ReactQRElement = ReactElement<any, any>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* React's attributes for the `<svg>`, with `ref` a ref object or callback.
|
|
18
|
+
* @types/react 16 to 18 also allow a string there (a legacy string ref,
|
|
19
|
+
* which React never took on a function component), and with it a typed set
|
|
20
|
+
* of these props didn't type-check when spread into `QRCode`, a memo
|
|
21
|
+
* component, under those versions' types. React 19's types are the same
|
|
22
|
+
* either way.
|
|
23
|
+
*/
|
|
24
|
+
type SVGRootProps = Omit<SVGProps<SVGSVGElement>, "ref"> & {
|
|
25
|
+
ref?: Ref<SVGSVGElement>;
|
|
26
|
+
};
|
|
27
|
+
|
|
9
28
|
export type QRPropsCanvas = QRProps & CanvasHTMLAttributes<HTMLCanvasElement>;
|
|
10
|
-
export type QRPropsSVG = QRProps &
|
|
29
|
+
export type QRPropsSVG = QRProps & SVGRootProps;
|
|
11
30
|
/**
|
|
12
31
|
* React's `QRCode` props: `QRCodeProps` (the logo API included) plus the
|
|
13
32
|
* SVG attributes, which go on the `<svg>` as with `QRCodeSVG`.
|
|
14
33
|
*/
|
|
15
|
-
export type QRCodePropsSVG = QRCodeProps &
|
|
34
|
+
export type QRCodePropsSVG = QRCodeProps & SVGRootProps;
|
|
16
35
|
|
|
17
36
|
/**
|
|
18
37
|
* `QRFrameSVG`'s props: the frame, the code size it's laid out around and
|