tktechnico-react-face-detection 1.0.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.
@@ -0,0 +1,40 @@
1
+ export interface FaceDetection {
2
+ topLeft: [number, number];
3
+ bottomRight: [number, number];
4
+ probability: number;
5
+ landmarks?: number[][];
6
+ }
7
+ export interface DetectionResult {
8
+ success: boolean;
9
+ face: FaceDetection | null;
10
+ confidence: number;
11
+ isLowConfidence: boolean;
12
+ errorMessage: string | null;
13
+ }
14
+ export interface FaceDetectorConfig {
15
+ /** Confidence threshold for low quality warning (default: 0.7) */
16
+ confidenceThreshold?: number;
17
+ /** Max image size for processing (default: 640) */
18
+ maxImageSize?: number;
19
+ /** Show face bounding box overlay (default: true) */
20
+ showOverlay?: boolean;
21
+ /** Show detection result message (default: true) */
22
+ showResult?: boolean;
23
+ /** Callback when detection completes */
24
+ onDetectionComplete?: (result: DetectionResult) => void;
25
+ /** Callback on error */
26
+ onError?: (error: string) => void;
27
+ }
28
+ export interface CameraConfig {
29
+ /** Default camera direction (default: 'front') */
30
+ defaultFacing?: 'front' | 'rear';
31
+ /** Allow switching between front/rear camera (default: true) */
32
+ allowCameraSwitch?: boolean;
33
+ /** Image quality 1-100 (default: 90) */
34
+ quality?: number;
35
+ }
36
+ export interface FaceDetectorProps extends FaceDetectorConfig, CameraConfig {
37
+ /** Additional CSS classes */
38
+ className?: string;
39
+ }
40
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC,kEAAkE;IAClE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mDAAmD;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oDAAoD;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wCAAwC;IACxC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACxD,wBAAwB;IACxB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,YAAY;IAC3B,kDAAkD;IAClD,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,gEAAgE;IAChE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAkB,SAAQ,kBAAkB,EAAE,YAAY;IACzE,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,14 @@
1
+ import type { DetectionResult } from './types';
2
+ interface UseFaceDetectionCoreOptions {
3
+ confidenceThreshold?: number;
4
+ maxImageSize?: number;
5
+ }
6
+ interface UseFaceDetectionCoreReturn {
7
+ isModelLoading: boolean;
8
+ modelError: string | null;
9
+ detectFace: (imageElement: HTMLImageElement) => Promise<DetectionResult>;
10
+ retryModelLoad: () => void;
11
+ }
12
+ export declare function useFaceDetectionCore(options?: UseFaceDetectionCoreOptions): UseFaceDetectionCoreReturn;
13
+ export {};
14
+ //# sourceMappingURL=useFaceDetectionCore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFaceDetectionCore.d.ts","sourceRoot":"","sources":["../src/useFaceDetectionCore.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,SAAS,CAAC;AAE9D,UAAU,2BAA2B;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,0BAA0B;IAClC,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,UAAU,EAAE,CAAC,YAAY,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACzE,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAKD,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,0BAA0B,CAyI5B"}
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "tktechnico-react-face-detection",
3
+ "version": "1.0.0",
4
+ "description": "TKTechnico's powerful face detection component for React and Ionic applications. Real-time AI-powered face detection using TensorFlow.js BlazeFace with native mobile camera support.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md"
11
+ ],
12
+ "scripts": {
13
+ "build": "npm run build:js && npm run build:types",
14
+ "build:js": "tsup src/index.ts --format cjs,esm --clean --external react --external react-dom",
15
+ "build:types": "tsc -p tsconfig.json --emitDeclarationOnly --declaration --outDir dist",
16
+ "dev": "tsup src/index.ts --format cjs,esm --watch --external react --external react-dom",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/tktechnico/react-face-detection.git"
22
+ },
23
+ "homepage": "https://github.com/tktechnico/react-face-detection#readme",
24
+ "bugs": {
25
+ "url": "https://github.com/tktechnico/react-face-detection/issues"
26
+ },
27
+ "keywords": [
28
+ "tktechnico",
29
+ "react",
30
+ "face-detection",
31
+ "face-recognition",
32
+ "tensorflow",
33
+ "blazeface",
34
+ "ionic",
35
+ "capacitor",
36
+ "camera",
37
+ "ai",
38
+ "machine-learning",
39
+ "computer-vision",
40
+ "biometric",
41
+ "selfie",
42
+ "mobile",
43
+ "native",
44
+ "typescript",
45
+ "react-component"
46
+ ],
47
+ "author": "TKTechnico",
48
+ "license": "MIT",
49
+ "peerDependencies": {
50
+ "react": "^18.0.0",
51
+ "react-dom": "^18.0.0"
52
+ },
53
+ "dependencies": {
54
+ "@capacitor/camera": "^8.0.0",
55
+ "@tensorflow-models/blazeface": "^0.1.0",
56
+ "@tensorflow/tfjs": "^4.22.0"
57
+ },
58
+ "devDependencies": {
59
+ "@types/react": "^18.3.0",
60
+ "@types/react-dom": "^18.3.0",
61
+ "react": "^18.3.1",
62
+ "react-dom": "^18.3.1",
63
+ "tsup": "^8.0.0",
64
+ "typescript": "^5.0.0"
65
+ }
66
+ }