@scanly/react 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -30
- package/package.json +43 -43
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
# @scanly/react
|
|
2
|
-
|
|
3
|
-
Thin React adapter over `@scanly/browser` for Scanly SDK v2.0.
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install @scanly/react
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
"use client";
|
|
11
|
-
import { useScanly } from "@scanly/react";
|
|
12
|
-
|
|
13
|
-
export function UploadScanner() {
|
|
14
|
-
const { outcome, scanning, scanFile, cancel } = useScanly();
|
|
15
|
-
return <>
|
|
16
|
-
<input type="file" accept="image/*" onChange={(event) => {
|
|
17
|
-
const file = event.currentTarget.files?.[0];
|
|
18
|
-
if (file) void scanFile(file);
|
|
19
|
-
}} />
|
|
20
|
-
<button onClick={cancel} disabled={!scanning}>Cancel</button>
|
|
21
|
-
<output>{outcome?.ok ? outcome.primary.rawText : ""}</output>
|
|
22
|
-
</>;
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
`useScanly` owns one `BrowserCaptureSession`, starts it after mount, and disposes its session and Worker on unmount. For camera UI, compose `BrowserCameraSource` from `@scanly/browser` in an effect and stop/dispose it in the effect cleanup.
|
|
27
|
-
|
|
28
|
-
This is the standard public React package for React 18 and 19-compatible peer ranges (`>=18 <20`).
|
|
29
|
-
|
|
30
|
-
Version: 2.0
|
|
1
|
+
# @scanly/react
|
|
2
|
+
|
|
3
|
+
Thin React adapter over `@scanly/browser` for Scanly SDK v2.1.0. Decoding, Worker ownership, camera runtime, tracking, and memory management remain outside React.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @scanly/react
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
"use client";
|
|
11
|
+
import { useScanly } from "@scanly/react";
|
|
12
|
+
|
|
13
|
+
export function UploadScanner() {
|
|
14
|
+
const { outcome, scanning, scanFile, cancel } = useScanly();
|
|
15
|
+
return <>
|
|
16
|
+
<input type="file" accept="image/*" onChange={(event) => {
|
|
17
|
+
const file = event.currentTarget.files?.[0];
|
|
18
|
+
if (file) void scanFile(file);
|
|
19
|
+
}} />
|
|
20
|
+
<button onClick={cancel} disabled={!scanning}>Cancel</button>
|
|
21
|
+
<output>{outcome?.ok ? outcome.primary.rawText : ""}</output>
|
|
22
|
+
</>;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`useScanly` owns one `BrowserCaptureSession`, starts it after mount, and disposes its session and Worker on unmount. For camera UI, compose `BrowserCameraSource` from `@scanly/browser` in an effect and stop/dispose it in the effect cleanup.
|
|
27
|
+
|
|
28
|
+
This is the standard public React package for React 18 and 19-compatible peer ranges (`>=18 <20`).
|
|
29
|
+
|
|
30
|
+
Version: 2.1.0 · [React usage](https://github.com/Yangjunjie-Lin/Scanly/blob/main/docs/sdk/usage.md)
|
package/package.json
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@scanly/react",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"description": "React adapter for the Scanly browser barcode scanning runtime",
|
|
5
|
-
"keywords": ["barcode", "qr-code", "scanner", "react", "hook", "scanly"],
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/Yangjunjie-Lin/Scanly.git",
|
|
9
|
-
"directory": "packages/react"
|
|
10
|
-
},
|
|
11
|
-
"homepage": "https://github.com/Yangjunjie-Lin/Scanly#readme",
|
|
12
|
-
"bugs": {
|
|
13
|
-
"url": "https://github.com/Yangjunjie-Lin/Scanly/issues"
|
|
14
|
-
},
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"type": "module",
|
|
17
|
-
"sideEffects": false,
|
|
18
|
-
"main": "./dist/index.js",
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
20
|
-
"exports": {
|
|
21
|
-
".": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
23
|
-
"import": "./dist/index.js"
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
"files": [
|
|
27
|
-
"dist",
|
|
28
|
-
"README.md"
|
|
29
|
-
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsc -p tsconfig.build.json"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"@scanly/browser": "2.0
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"react": ">=18 <20"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@types/react": "^18.3.3",
|
|
41
|
-
"react": "^18.3.1"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@scanly/react",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "React adapter for the Scanly browser barcode scanning runtime",
|
|
5
|
+
"keywords": ["barcode", "qr-code", "scanner", "react", "hook", "scanly"],
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Yangjunjie-Lin/Scanly.git",
|
|
9
|
+
"directory": "packages/react"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Yangjunjie-Lin/Scanly#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Yangjunjie-Lin/Scanly/issues"
|
|
14
|
+
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist",
|
|
28
|
+
"README.md"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.build.json"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@scanly/browser": "2.1.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"react": ">=18 <20"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/react": "^18.3.3",
|
|
41
|
+
"react": "^18.3.1"
|
|
42
|
+
}
|
|
43
|
+
}
|