@nddeps/barcode-scanner 0.2.0 → 0.3.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/package.json CHANGED
@@ -1,66 +1,70 @@
1
- {
2
- "name": "@nddeps/barcode-scanner",
3
- "version": "0.2.0",
4
- "private": false,
5
- "keywords": [
6
- "barcode",
7
- "scanner",
8
- "barcode-scanner"
9
- ],
10
- "homepage": "https://github.com/No-Deprecated-Dependencies/barcode-scanner",
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/No-Deprecated-Dependencies/barcode-scanner.git"
14
- },
15
- "license": "MIT",
16
- "author": "Aleksei Saenko",
17
- "type": "module",
18
- "exports": {
19
- ".": {
20
- "types": "./dist/index.d.ts",
21
- "import": "./dist/index.js"
22
- }
23
- },
24
- "main": "./dist/index.js",
25
- "types": "./dist/index.d.ts",
26
- "files": [
27
- "./dist"
28
- ],
29
- "scripts": {
30
- "build": "vite build && tsc -b",
31
- "dev": "vite",
32
- "preview": "vite preview"
33
- },
34
- "overrides": {
35
- "vite": "npm:rolldown-vite@7.2.11"
36
- },
37
- "dependencies": {
38
- "barcode-detector": "^3.0.8",
39
- "jsqr": "^1.4.0",
40
- "zxing-wasm": "^2.2.4"
41
- },
42
- "devDependencies": {
43
- "@eslint/css": "^0.14.1",
44
- "@eslint/js": "^9.39.2",
45
- "@eslint/json": "^0.14.0",
46
- "@eslint/markdown": "^7.5.1",
47
- "@types/emscripten": "^1.41.5",
48
- "@types/node": "^25.0.2",
49
- "eslint": "^9.39.2",
50
- "eslint-config-prettier": "^10.1.8",
51
- "eslint-plugin-perfectionist": "^4.15.1",
52
- "eslint-plugin-prettier": "^5.5.4",
53
- "globals": "^16.5.0",
54
- "jiti": "^2.6.1",
55
- "prettier": "3.7.4",
56
- "sort-package-json": "^3.5.1",
57
- "stylelint": "^16.26.1",
58
- "stylelint-config-recess-order": "^7.4.0",
59
- "stylelint-config-standard": "^39.0.1",
60
- "stylelint-config-standard-scss": "^16.0.0",
61
- "stylelint-order": "^7.0.0",
62
- "typescript": "~5.9.3",
63
- "typescript-eslint": "^8.49.0",
64
- "vite": "npm:rolldown-vite@7.2.11"
65
- }
66
- }
1
+ {
2
+ "name": "@nddeps/barcode-scanner",
3
+ "version": "0.3.0",
4
+ "private": false,
5
+ "keywords": [
6
+ "barcode",
7
+ "scanner",
8
+ "barcode-scanner"
9
+ ],
10
+ "homepage": "https://github.com/No-Deprecated-Dependencies/barcode-scanner",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/No-Deprecated-Dependencies/barcode-scanner.git"
14
+ },
15
+ "license": "MIT",
16
+ "author": "Aleksei Saenko",
17
+ "type": "module",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js"
22
+ },
23
+ "./worker": {
24
+ "import": "./dist/worker.js"
25
+ }
26
+ },
27
+ "main": "./dist/index.js",
28
+ "types": "./dist/index.d.ts",
29
+ "files": [
30
+ "./dist"
31
+ ],
32
+ "scripts": {
33
+ "build": "vite build && tsc -b",
34
+ "dev": "vite",
35
+ "preview": "vite preview",
36
+ "publish": "npm publish --access public"
37
+ },
38
+ "overrides": {
39
+ "vite": "npm:rolldown-vite@7.3.1"
40
+ },
41
+ "dependencies": {
42
+ "barcode-detector": "^3.0.8",
43
+ "jsqr": "^1.4.0",
44
+ "zxing-wasm": "^2.2.4"
45
+ },
46
+ "devDependencies": {
47
+ "@eslint/css": "^0.14.1",
48
+ "@eslint/js": "^9.39.2",
49
+ "@eslint/json": "^1.0.0",
50
+ "@eslint/markdown": "^7.5.1",
51
+ "@types/emscripten": "^1.41.5",
52
+ "@types/node": "^25.1.0",
53
+ "eslint": "^9.39.2",
54
+ "eslint-config-prettier": "^10.1.8",
55
+ "eslint-plugin-perfectionist": "^5.4.0",
56
+ "eslint-plugin-prettier": "^5.5.5",
57
+ "globals": "^17.2.0",
58
+ "jiti": "^2.6.1",
59
+ "prettier": "3.8.1",
60
+ "sort-package-json": "^3.6.1",
61
+ "stylelint": "^16.26.1",
62
+ "stylelint-config-recess-order": "^7.6.0",
63
+ "stylelint-config-standard": "^39.0.1",
64
+ "stylelint-config-standard-scss": "^16.0.0",
65
+ "stylelint-order": "^7.0.1",
66
+ "typescript": "~5.9.3",
67
+ "typescript-eslint": "^8.54.0",
68
+ "vite": "npm:rolldown-vite@7.3.1"
69
+ }
70
+ }
@@ -1,104 +0,0 @@
1
- /**
2
- * Type definitions for the Barcode Detection API
3
- * @see https://wicg.github.io/shape-detection-api/#barcode-detection-api
4
- */
5
- /**
6
- * BarcodeDetector type
7
- * @see https://wicg.github.io/shape-detection-api/#barcodedetector
8
- *
9
- * @example
10
- * ```typescript
11
- * const detector = new BarcodeDetector({ formats: ['qr_code'] });
12
- * const barcodes = await detector.detect(imageElement);
13
- * ```
14
- */
15
- export type BarcodeDetector = {
16
- /**
17
- * Creates a new BarcodeDetector instance
18
- * @param barcodeDetectorOptions Optional configuration for the detector
19
- */
20
- new (barcodeDetectorOptions?: BarcodeDetectorOptions): BarcodeDetector;
21
- /**
22
- * Detects barcodes in the provided image source
23
- * @param image The image source to detect barcodes in
24
- * @returns Promise that resolves to an array of DetectedBarcode objects
25
- *
26
- * @example
27
- * ```typescript
28
- * const detector = new BarcodeDetector();
29
- * const barcodes = await detector.detect(imageElement);
30
- * barcodes.forEach(barcode => {
31
- * console.log('Found:', barcode.rawValue, 'Format:', barcode.format);
32
- * });
33
- * ```
34
- */
35
- detect(image: ImageBitmapSource | Uint8ClampedArray): Promise<DetectedBarcode[]>;
36
- /**
37
- * Returns a promise that resolves to an array of barcode formats
38
- * supported by the user agent
39
- * @returns Promise that resolves to an array of supported BarcodeFormat values
40
- *
41
- * @example
42
- * ```typescript
43
- * const formats = await BarcodeDetector.getSupportedFormats();
44
- * console.log('Supported formats:', formats);
45
- * ```
46
- */
47
- getSupportedFormats(): Promise<BarcodeFormat[]>;
48
- };
49
- /**
50
- * Options for BarcodeDetector constructor
51
- * @see https://wicg.github.io/shape-detection-api/#dictdef-barcodedetectoroptions
52
- */
53
- export type BarcodeDetectorOptions = {
54
- /**
55
- * Optional array of barcode formats to detect.
56
- * If not specified, all supported formats will be detected.
57
- */
58
- formats?: BarcodeFormat[];
59
- };
60
- /**
61
- * Supported barcode formats
62
- * @see https://wicg.github.io/shape-detection-api/#enumdef-barcodeformat
63
- */
64
- export type BarcodeFormat = 'aztec' | 'codabar' | 'code_128' | 'code_39' | 'code_93' | 'data_matrix' | 'ean_13' | 'ean_8' | 'itf' | 'pdf417' | 'qr_code' | 'unknown' | 'upc_a' | 'upc_e';
65
- /**
66
- * Represents a detected barcode in an image
67
- * @see https://wicg.github.io/shape-detection-api/#dictdef-detectedbarcode
68
- */
69
- export type DetectedBarcode = {
70
- /**
71
- * The bounding box of the detected barcode
72
- */
73
- readonly boundingBox: DOMRectReadOnly;
74
- /**
75
- * The four corner points of the detected barcode in clockwise order
76
- * (top-left, top-right, bottom-right, bottom-left)
77
- */
78
- readonly cornerPoints: Point2D[];
79
- /**
80
- * The format of the detected barcode
81
- */
82
- readonly format: BarcodeFormat;
83
- /**
84
- * The raw value decoded from the barcode
85
- */
86
- readonly rawValue: string;
87
- };
88
- /**
89
- * Point2D represents a 2D point with x and y coordinates
90
- * @see https://w3c.github.io/mediacapture-image/#dictdef-point2d
91
- */
92
- export type Point2D = {
93
- x: number;
94
- y: number;
95
- };
96
- /**
97
- * Global declaration for BarcodeDetector (extends Window interface)
98
- * This allows TypeScript to recognize BarcodeDetector as a global when available
99
- */
100
- declare global {
101
- interface Window {
102
- BarcodeDetector?: BarcodeDetector;
103
- }
104
- }
@@ -1,47 +0,0 @@
1
- import type { DetectedBarcode } from './barcode-detector.type';
2
- import type { OnDecode, OnDecodeError, ScanArea } from './barcode-scanner.types';
3
- declare class BarcodeScanner {
4
- private calcScanArea;
5
- private canvas;
6
- private canvasContext;
7
- private debug?;
8
- private decodeFrameRequestTimestamp;
9
- private decodeTimeout;
10
- private isDecodeFrameProcessed;
11
- private isDestroyed;
12
- private onDecode;
13
- private onDecodeError?;
14
- private onVisibilityChange;
15
- private requestFrame;
16
- private resumeOnVisibilityChange;
17
- private scanArea;
18
- private scanRate;
19
- private video;
20
- private videoActive;
21
- private videoPaused;
22
- private worker;
23
- constructor({ onDecode, onDecodeError, options, video, }: {
24
- onDecode: OnDecode;
25
- onDecodeError?: OnDecodeError;
26
- options?: {
27
- calcScanArea?: (video: HTMLVideoElement) => ScanArea;
28
- debug?: boolean;
29
- decodeTimeout?: number;
30
- preferWorker?: boolean;
31
- scanRate?: number;
32
- };
33
- video: HTMLVideoElement;
34
- });
35
- decode(imageData: ImageData): Promise<DetectedBarcode | null>;
36
- destroy(): Promise<void>;
37
- getCameraAccess(): Promise<boolean>;
38
- getScanArea(video: HTMLVideoElement): ScanArea;
39
- hasCameraAccess(): Promise<boolean>;
40
- pause(): void;
41
- start({ facingMode, }?: {
42
- facingMode?: 'environment' | 'user';
43
- }): Promise<void>;
44
- stop(): Promise<void>;
45
- private decodeFrame;
46
- }
47
- export { BarcodeScanner };
@@ -1,17 +0,0 @@
1
- import type { DetectedBarcode } from './barcode-detector.type';
2
- export type OnDecode = (data: null | string, area: ScanArea) => void;
3
- export type OnDecodeError = () => void;
4
- export type ScanArea = {
5
- height: number;
6
- width: number;
7
- x: number;
8
- y: number;
9
- };
10
- export type WorkerRequest = {
11
- data: ImageData | null;
12
- uuid: string;
13
- };
14
- export type WorkerResponse = {
15
- data: DetectedBarcode | null;
16
- uuid: string;
17
- };