From fe8852bbcd01e9ce92688532f0eb9e201e261588 Mon Sep 17 00:00:00 2001 From: Luigui Delyer Date: Thu, 5 Nov 2020 21:17:01 -0300 Subject: [PATCH] npm publish --- .npmignore | 21 + README.md | 182 + Yoonit.Camera.android.d.ts | 17 + Yoonit.Camera.android.js | 188 + Yoonit.Camera.android.js.map | 1 + Yoonit.Camera.android.ts | 263 + Yoonit.Camera.common.d.ts | 26 + Yoonit.Camera.common.js | 26 + Yoonit.Camera.common.js.map | 1 + Yoonit.Camera.common.ts | 70 + Yoonit.Camera.ios.d.ts | 18 + Yoonit.Camera.ios.js | 218 + Yoonit.Camera.ios.js.map | 1 + Yoonit.Camera.ios.ts | 302 + index.d.ts | 65 + package-lock.json | 6685 +++++++++++++++++++++ package.json | 57 + platforms/android/AndroidManifest.xml | 11 + platforms/android/include.gradle | 25 + platforms/android/nativescript_camera.aar | Bin 0 -> 13595 bytes platforms/ios/Info.plist | 8 + platforms/ios/Podfile | 13 + references.d.ts | 1 + tsconfig.json | 34 + typings/android-declarations.d.ts | 4 + typings/android.d.ts | 95 + typings/objc!FaceTracker.d.ts | 75 + vue.js | 90 + 28 files changed, 8497 insertions(+) create mode 100644 .npmignore create mode 100644 README.md create mode 100644 Yoonit.Camera.android.d.ts create mode 100644 Yoonit.Camera.android.js create mode 100644 Yoonit.Camera.android.js.map create mode 100644 Yoonit.Camera.android.ts create mode 100644 Yoonit.Camera.common.d.ts create mode 100644 Yoonit.Camera.common.js create mode 100644 Yoonit.Camera.common.js.map create mode 100644 Yoonit.Camera.common.ts create mode 100644 Yoonit.Camera.ios.d.ts create mode 100644 Yoonit.Camera.ios.js create mode 100644 Yoonit.Camera.ios.js.map create mode 100644 Yoonit.Camera.ios.ts create mode 100644 index.d.ts create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 platforms/android/AndroidManifest.xml create mode 100644 platforms/android/include.gradle create mode 100644 platforms/android/nativescript_camera.aar create mode 100644 platforms/ios/Info.plist create mode 100644 platforms/ios/Podfile create mode 100644 references.d.ts create mode 100644 tsconfig.json create mode 100644 typings/android-declarations.d.ts create mode 100644 typings/android.d.ts create mode 100644 typings/objc!FaceTracker.d.ts create mode 100644 vue.js diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..e709e0b --- /dev/null +++ b/.npmignore @@ -0,0 +1,21 @@ +demo/ +.idea/ +support/ +*.tar +*.tgz +.npmignore +*.map +*.ts +tsconfig.json +scripts +.DS_Store +*.aar +node_modules +*.esm.json +!extractTGZ.js +*.js.map +*.log + +# Editor directories and files +.idea +.vscode diff --git a/README.md b/README.md new file mode 100644 index 0000000..73d21f4 --- /dev/null +++ b/README.md @@ -0,0 +1,182 @@ +[](https://cyberlabs.ai/) + +# NativeScript Yoonit Camera + +![NativeScript](https://img.shields.io/badge/NativeScript-7-lightgrey.svg?style=for-the-badge&logo=nativescript) ![Version](https://img.shields.io/npm/v/@yoonit/nativescript-camera?color=lightgrey&style=for-the-badge&logo=npm) ![Downloads](https://img.shields.io/npm/dm/@yoonit/nativescript-camera?color=lightgrey&logo=npm&style=for-the-badge) + +![Android](https://img.shields.io/badge/Android-YES-lightgrey.svg?style=for-the-badge&logo=android) ![iOS](https://img.shields.io/badge/iOS-YES-lightgrey.svg?style=for-the-badge&logo=apple) ![MIT license](https://img.shields.io/npm/l/@yoonit/nativescript-camera?color=lightgrey&style=for-the-badge) + +A NativeScript plugin to provide: +- Modern Android Camera API (Camera X) +- MLKit integration +- Camera preview (Front & Back) +- Face detection (With Min & Max size (Soon)) +- Landmark detection (Soon) +- Face crop +- Face capture +- Frame capture +- Face ROI (Soon) +- QR Code scanning + +## Installation + +```javascript +npm i -s @yoonit/nativescript-camera +``` + +## Usage + +All the functionalities that the `@yoonit/nativescript-camera` provides is accessed through the `YoonitCamera` component, that includes the camera preview. Below we have the basic usage code, for more details, your can see the [**Methods**](#methods), [**Events**](#events) or the [**Demo Vue**](https://github.com/Yoonit-Labs/nativescript-yoonit-camera/tree/development/demo-vue). + + +#### VueJS Plugin +`main.js` +```javascript +import Vue from 'nativescript-vue' +import YoonitCamera from '@yoonit/nativescript-camera/vue' + +Vue.use(YoonitCamera) +``` + +After that, you can access the camera object in your entire project using `this.$yoo.camera` + +#### Vue Component +`App.vue` +```vue + + + +``` + +## API + +#### Methods + +| Function | Parameters | Valid values | Return Type | Description +| - | - | - | - | - +| **`requestPermission`** | - | - | promise | Ask to user to give the permission to access camera. +| **`hasPermission`** | - | - | boolean | Return if application has camera permission. +| **`preview`** | - | - | void | Start camera preview if has permission. +| **`startCapture`** | `captureType: string` | | void | Set capture type none, face, barcode or frame. +| **`stopCapture`** | - | - | void | Stop any type of capture. +| **`toggleLens`** | - | - | void | Set camera lens facing front or back. +| **`getLens`** | - | - | number | Return `number` that represents lens face state: 0 for front 1 for back camera. +| **`setFaceNumberOfImages`** | `faceNumberOfImages: number` | Any positive `number` value | void | Default value is 0. For value 0 is saved infinity images. When saved images reached the "face number os images", the `onEndCapture` is triggered. +| **`setFaceDetectionBox`** | `faceDetectionBox: boolean` | `true` or `false` | void | Set to show face detection box when face detected. +| **`setFaceTimeBetweenImages`** | `faceTimeBetweenImages: number` | Any positive `number` that represent time in milli seconds | void | Set saving face images time interval in milli seconds. +| **`setFacePaddingPercent`** | `facePaddingPercent: number` | Any positive `number` value | void | Set face image and bounding box padding in percent. +| **`setFaceImageSize`** | `faceImageSize: number` | Any positive `number` value | void | Set face image size to be saved. +| **`setFrameNumberOfImages`** | `frameNumberOfImages: number` | Any positive `number` value | void | Default value is 0. For value 0 is saved infinity images. When saved images reached the "frame number os images", the `onEndCapture` is triggered. +| **`setFrameTimeBetweenImages`** | `frameTimeBetweenImages: number` | Any positive `number` that represent time in milli seconds | void | Set saving frame images time interval in milli seconds. + + +#### Events + +| Event | Parameters | Description +| - | - | - +| faceImage | `{ count: number, total: number, image: object = { path: string, source: blob } }` | Must have started capture type of face. Emitted when the face image file is created: