├── .editorconfig ├── .eslintignore ├── .eslintrc.json ├── .gitignore ├── .husky ├── .gitignore └── pre-commit ├── .npsrc ├── .nxignore ├── .prettierignore ├── .prettierrc ├── .travis.yml ├── .vscode └── settings.json ├── LICENSE ├── README.md ├── apps ├── demo-angular │ ├── .eslintrc.json │ ├── .gitignore │ ├── nativescript.config.ts │ ├── package.json │ ├── project.json │ ├── references.d.ts │ ├── src │ │ ├── app-routing.module.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── app.scss │ │ ├── home.component.html │ │ ├── home.component.ts │ │ ├── main.ts │ │ ├── plugin-demos │ │ │ ├── .gitkeep │ │ │ ├── mlkit-barcode-scanning.component.html │ │ │ ├── mlkit-barcode-scanning.component.ts │ │ │ ├── mlkit-barcode-scanning.module.ts │ │ │ ├── mlkit-core.component.html │ │ │ ├── mlkit-core.component.ts │ │ │ ├── mlkit-core.module.ts │ │ │ ├── mlkit-custom-object-detection.component.html │ │ │ ├── mlkit-custom-object-detection.component.ts │ │ │ ├── mlkit-custom-object-detection.module.ts │ │ │ ├── mlkit-digital-ink-recognition.component.html │ │ │ ├── mlkit-digital-ink-recognition.component.ts │ │ │ ├── mlkit-digital-ink-recognition.module.ts │ │ │ ├── mlkit-face-detection.component.html │ │ │ ├── mlkit-face-detection.component.ts │ │ │ ├── mlkit-face-detection.module.ts │ │ │ ├── mlkit-image-labeling.component.html │ │ │ ├── mlkit-image-labeling.component.ts │ │ │ ├── mlkit-image-labeling.module.ts │ │ │ ├── mlkit-object-detection.component.html │ │ │ ├── mlkit-object-detection.component.ts │ │ │ ├── mlkit-object-detection.module.ts │ │ │ ├── mlkit-pose-detection.component.html │ │ │ ├── mlkit-pose-detection.component.ts │ │ │ ├── mlkit-pose-detection.module.ts │ │ │ ├── mlkit-selfie-segmentation.component.html │ │ │ ├── mlkit-selfie-segmentation.component.ts │ │ │ ├── mlkit-selfie-segmentation.module.ts │ │ │ ├── mlkit-text-recognition.component.html │ │ │ ├── mlkit-text-recognition.component.ts │ │ │ └── mlkit-text-recognition.module.ts │ │ └── polyfills.ts │ ├── tsconfig.json │ └── webpack.config.js └── demo │ ├── .eslintrc.json │ ├── .gitignore │ ├── nativescript.config.ts │ ├── package.json │ ├── project.json │ ├── references.d.ts │ ├── src │ ├── app-root.xml │ ├── app.scss │ ├── app.ts │ ├── main-page.ts │ ├── main-page.xml │ ├── main-view-model.ts │ └── plugin-demos │ │ ├── .gitkeep │ │ ├── mlkit-barcode-scanning.ts │ │ ├── mlkit-barcode-scanning.xml │ │ ├── mlkit-core.ts │ │ ├── mlkit-core.xml │ │ ├── mlkit-custom-object-detection.ts │ │ ├── mlkit-custom-object-detection.xml │ │ ├── mlkit-digital-ink-recognition.ts │ │ ├── mlkit-digital-ink-recognition.xml │ │ ├── mlkit-face-detection.ts │ │ ├── mlkit-face-detection.xml │ │ ├── mlkit-image-labeling.ts │ │ ├── mlkit-image-labeling.xml │ │ ├── mlkit-object-detection.ts │ │ ├── mlkit-object-detection.xml │ │ ├── mlkit-pose-detection.ts │ │ ├── mlkit-pose-detection.xml │ │ ├── mlkit-selfie-segmentation.ts │ │ ├── mlkit-selfie-segmentation.xml │ │ ├── mlkit-text-recognition.ts │ │ └── mlkit-text-recognition.xml │ ├── tsconfig.json │ └── webpack.config.js ├── jest.config.ts ├── migrations.json ├── nx.json ├── package.json ├── packages ├── .gitkeep ├── mlkit-barcode-scanning │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-core │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── angular │ │ ├── .eslintrc.json │ │ ├── index.ts │ │ ├── mlkit-view-directive.ts │ │ ├── ng-package.json │ │ ├── package.json │ │ ├── tsconfig.angular.json │ │ └── tsconfig.json │ ├── common.ts │ ├── index.android.ts │ ├── index.d.ts │ ├── index.ios.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ ├── Info.plist │ │ │ ├── Podfile │ │ │ └── src │ │ │ ├── TNSBarcodeScanner.swift │ │ │ ├── TNSFaceDetection.swift │ │ │ ├── TNSImageLabeling.swift │ │ │ ├── TNSML.swift │ │ │ ├── TNSMLKitHelper.swift │ │ │ ├── TNSMLKitParsers.swift │ │ │ ├── TNSObjectDetection.swift │ │ │ ├── TNSPoseDetection.swift │ │ │ └── TNSTextRecognition.swift │ ├── project.json │ ├── references.d.ts │ ├── tsconfig.json │ ├── typings │ │ ├── android.d.ts │ │ ├── objc!MLImage.d.ts │ │ ├── objc!MLKitBarcodeScanning.d.ts │ │ ├── objc!MLKitCommon.d.ts │ │ ├── objc!MLKitDigitalInkRecognition.d.ts │ │ ├── objc!MLKitFaceDetection.d.ts │ │ ├── objc!MLKitImageLabeling.d.ts │ │ ├── objc!MLKitImageLabelingCommon.d.ts │ │ ├── objc!MLKitObjectDetection.d.ts │ │ ├── objc!MLKitObjectDetectionCommon.d.ts │ │ ├── objc!MLKitObjectDetectionCustom.d.ts │ │ ├── objc!MLKitPoseDetection.d.ts │ │ ├── objc!MLKitPoseDetectionAccurate.d.ts │ │ ├── objc!MLKitPoseDetectionCommon.d.ts │ │ ├── objc!MLKitSegmentationCommon.d.ts │ │ ├── objc!MLKitSegmentationSelfie.d.ts │ │ ├── objc!MLKitTextRecognition.d.ts │ │ ├── objc!MLKitTextRecognitionCommon.d.ts │ │ ├── objc!MLKitVision.d.ts │ │ └── objc!nsswiftsupport.d.ts │ └── vue │ │ └── index.ts ├── mlkit-custom-object-detection │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-digital-ink-recognition │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-face-detection │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-image-labeling │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-object-detection │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-pose-detection │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── mlkit-selfie-segmentation │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ │ ├── android │ │ │ └── include.gradle │ │ └── ios │ │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json └── mlkit-text-recognition │ ├── .eslintrc.json │ ├── CHANGELOG.md │ ├── README.md │ ├── index.ts │ ├── package.json │ ├── platforms │ ├── android │ │ └── include.gradle │ └── ios │ │ └── Podfile │ ├── project.json │ ├── references.d.ts │ └── tsconfig.json ├── references.d.ts ├── tools ├── assets │ ├── App_Resources │ │ ├── Android │ │ │ ├── app.gradle │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ └── res │ │ │ │ ├── drawable-hdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ │ ├── drawable-ldpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ │ ├── drawable-mdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ │ ├── drawable-nodpi │ │ │ │ └── splash_screen.xml │ │ │ │ ├── drawable-xhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ │ ├── drawable-xxxhdpi │ │ │ │ ├── background.png │ │ │ │ ├── icon.png │ │ │ │ └── logo.png │ │ │ │ ├── values-v21 │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ │ └── values │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ └── iOS │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── icon-1024.png │ │ │ │ ├── icon-20.png │ │ │ │ ├── icon-20@2x.png │ │ │ │ ├── icon-20@3x.png │ │ │ │ ├── icon-29.png │ │ │ │ ├── icon-29@2x.png │ │ │ │ ├── icon-29@3x.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ └── icon-83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── LaunchScreen.AspectFill.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-AspectFill.png │ │ │ │ ├── LaunchScreen-AspectFill@2x.png │ │ │ │ └── LaunchScreen-AspectFill@3x.png │ │ │ └── LaunchScreen.Center.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchScreen-Center.png │ │ │ │ ├── LaunchScreen-Center@2x.png │ │ │ │ └── LaunchScreen-Center@3x.png │ │ │ ├── Info.plist │ │ │ ├── LaunchScreen.storyboard │ │ │ ├── Podfile │ │ │ ├── build.xcconfig │ │ │ ├── icon.png │ │ │ ├── icon@2x.png │ │ │ ├── imagenet.tflite │ │ │ └── imagenet_large.tflite │ ├── README.md │ └── publishing │ │ └── .npmignore ├── demo │ ├── index.ts │ ├── mlkit-barcode-scanning │ │ └── index.ts │ ├── mlkit-core │ │ └── index.ts │ ├── mlkit-custom-object-detection │ │ └── index.ts │ ├── mlkit-digital-ink-recognition │ │ └── index.ts │ ├── mlkit-face-detection │ │ └── index.ts │ ├── mlkit-image-labeling │ │ └── index.ts │ ├── mlkit-object-detection │ │ └── index.ts │ ├── mlkit-pose-detection │ │ └── index.ts │ ├── mlkit-selfie-segmentation │ │ └── index.ts │ ├── mlkit-text-recognition │ │ └── index.ts │ ├── references.d.ts │ ├── tsconfig.json │ └── utils │ │ ├── demo-base.ts │ │ └── index.ts ├── images │ └── 00859323005830.png ├── package-settings.json ├── schematics │ └── .gitkeep ├── scripts │ └── build-finish.ts ├── tsconfig.tools.json └── workspace-scripts.js └── tsconfig.base.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "ignorePatterns": ["**/*"], 4 | "plugins": ["@nx"], 5 | "overrides": [ 6 | { 7 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 8 | "rules": { 9 | "@nx/enforce-module-boundaries": [ 10 | "error", 11 | { 12 | "enforceBuildableLibDependency": true, 13 | "allow": [], 14 | "depConstraints": [ 15 | { 16 | "sourceTag": "*", 17 | "onlyDependOnLibsWithTags": ["*"] 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | }, 24 | { 25 | "files": ["*.ts", "*.tsx"], 26 | "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier", "plugin:@nx/typescript"], 27 | "rules": { 28 | "@typescript-eslint/no-extra-semi": "error", 29 | "no-extra-semi": "off" 30 | } 31 | }, 32 | { 33 | "files": ["*.js", "*.jsx"], 34 | "extends": ["plugin:@nx/javascript"], 35 | "rules": { 36 | "@typescript-eslint/no-extra-semi": "error", 37 | "no-extra-semi": "off" 38 | } 39 | }, 40 | { 41 | "files": ["references.d.ts"], 42 | "rules": { 43 | "@typescript-eslint/triple-slash-reference": "off" 44 | } 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | node_modules 10 | package-lock.json 11 | yarn.lock 12 | 13 | # IDEs and editors 14 | /.idea 15 | .project 16 | .classpath 17 | .c9/ 18 | *.launch 19 | .settings/ 20 | *.sublime-workspace 21 | 22 | # IDE - VSCode 23 | .vscode/* 24 | !.vscode/settings.json 25 | !.vscode/tasks.json 26 | !.vscode/launch.json 27 | !.vscode/extensions.json 28 | 29 | # misc 30 | /.sass-cache 31 | /connect.lock 32 | /coverage 33 | /libpeerconnection.log 34 | npm-debug.log 35 | yarn-error.log 36 | testem.log 37 | /typings 38 | 39 | # System Files 40 | .DS_Store 41 | Thumbs.db 42 | 43 | *.tgz 44 | packages/**/angular/dist 45 | 46 | .nx/cache 47 | .nx/workspace-data 48 | -------------------------------------------------------------------------------- /.husky/.gitignore: -------------------------------------------------------------------------------- 1 | _ 2 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx lint-staged --allow-empty 5 | -------------------------------------------------------------------------------- /.npsrc: -------------------------------------------------------------------------------- 1 | { 2 | "config": "./tools/workspace-scripts.js" 3 | } -------------------------------------------------------------------------------- /.nxignore: -------------------------------------------------------------------------------- 1 | apps/**/*_off -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | # Add files here to ignore them from prettier formatting 2 | 3 | /dist 4 | /coverage 5 | native-src 6 | 7 | /.nx/cache 8 | /.nx/workspace-data -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "useTabs": false, 3 | "printWidth": 800, 4 | "tabWidth": 2, 5 | "singleQuote": true 6 | } 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "node" 4 | script: 5 | - npm run setup 6 | - npm start @nativescript.build-all 7 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "NativescriptExtend.fileAssociations": [ 3 | { 4 | "systemId": "c:\\Users\\sweet\\Documents\\PacktCourses_books\\NATIVESCRIPT\\contributions\\mlkit\\schema\\tns.xsd", 5 | "pattern": "**/**/*.xml" 6 | }, 7 | { 8 | "systemId": "http://www.w3.org/2001/XMLSchema.xsd", 9 | "pattern": "c:\\Users\\sweet\\Documents\\PacktCourses_books\\NATIVESCRIPT\\contributions\\mlkit\\schema\\tns.xsd" 10 | } 11 | ], 12 | "files.exclude": { 13 | "schema": true 14 | }, 15 | "NativescriptExtend.format.enabled": true, 16 | "NativescriptExtend.validation.enabled": true 17 | } 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | - [@nativescript/mlkit-barcode-scanning](packages/mlkit-barcode-scanning/README.md) 2 | - [@nativescript/mlkit-core](packages/mlkit-core/README.md) 3 | - [@nativescript/mlkit-custom-object-detection](packages/mlkit-custom-object-detection/README.md) 4 | - [@nativescript/mlkit-digital-ink-recognition](packages/mlkit-digital-ink-recognition/README.md) 5 | - [@nativescript/mlkit-face-detection](packages/mlkit-face-detection/README.md) 6 | - [@nativescript/mlkit-image-labeling](packages/mlkit-image-labeling/README.md) 7 | - [@nativescript/mlkit-object-detection](packages/mlkit-object-detection/README.md) 8 | - [@nativescript/mlkit-pose-detection](packages/mlkit-pose-detection/README.md) 9 | - [@nativescript/mlkit-selfie-segmentation](packages/mlkit-selfie-segmentation/README.md) 10 | - [@nativescript/mlkit-text-recognition](packages/mlkit-text-recognition/README.md) 11 | 12 | # How to use? 13 | 14 | This workspace manages the suite of plugins listed above. 15 | 16 | In general, when in doubt with what to do, just `npm start`. 17 | 18 | ## How to add a new package to workspace? 19 | 20 | ``` 21 | npm run add 22 | ``` 23 | 24 | At the prompt, enter the name of the new package. 25 | 26 | - This adds a plugin harness in `packages` with the necessary boilerplate to just start developing 27 | - Updates all demo app flavors to support demoing the new package 28 | - Adds shared code in `tools/demo` where you can write demo code **once** and share across all demo flavors 29 | - Updates build tooling to support the new package 30 | - Updates the `npm start` interactive display 31 | - Updates the README here to list the new package 32 | 33 | ## How to add Angular compatibility to a package 34 | 35 | ``` 36 | npm run add-angular 37 | ``` 38 | 39 | At the prompt, enter the name of the package to add an `angular` folder to it with the necessary boilerplate to provide Angular support to the package. 40 | 41 | ## How to focus on just 1 package to develop in isolation 42 | 43 | ``` 44 | npm start 45 | ``` 46 | 47 | - Choose the focus commands for the package you wish to focus on and hit enter. 48 | - All the demo app's will be updated to isolate that 1 package and for supported IDE's (currently VS Code), the source code will also become isolated in the workspace. 49 | 50 | Note: *good to always clean the demo you plan to run after focusing. (You can clean any demo from `npm start` as well)* 51 | 52 | ## How to publish packages? 53 | 54 | ``` 55 | npm run publish-packages 56 | ``` 57 | 58 | - You will be prompted for the package names to publish. Leaving blank and hitting enter will publish them all. 59 | - You will then be prompted for the version to use. Leaving blank will auto bump the patch version (it also handles prerelease types like alpha, beta, rc, etc. - It even auto tags the corresponding prelease type on npm). 60 | - You will then be given a brief sanity check 🧠😊 61 | 62 |

Made with ❤️

63 | -------------------------------------------------------------------------------- /apps/demo-angular/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", "node_modules/**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /apps/demo-angular/.gitignore: -------------------------------------------------------------------------------- 1 | hooks 2 | platforms 3 | !webpack.config.js -------------------------------------------------------------------------------- /apps/demo-angular/nativescript.config.ts: -------------------------------------------------------------------------------- 1 | import { NativeScriptConfig } from '@nativescript/core'; 2 | 3 | export default { 4 | id: 'org.nativescript.plugindemoangular', 5 | appResourcesPath: '../../tools/assets/App_Resources', 6 | android: { 7 | v8Flags: '--expose_gc', 8 | markingMode: 'none', 9 | }, 10 | appPath: 'src', 11 | cli: { 12 | packageManager: 'npm' 13 | } 14 | } as NativeScriptConfig; 15 | -------------------------------------------------------------------------------- /apps/demo-angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./src/main.ts", 3 | "dependencies": { 4 | "@nativescript/core": "file:../../node_modules/@nativescript/core", 5 | "@nativescript/mlkit-text-recognition": "file:../../dist/packages/mlkit-text-recognition", 6 | "@nativescript/mlkit-core": "file:../../dist/packages/mlkit-core", 7 | "@nativescript/mlkit-barcode-scanning": "file:../../dist/packages/mlkit-barcode-scanning", 8 | "@nativescript/mlkit-face-detection": "file:../../dist/packages/mlkit-face-detection", 9 | "@nativescript/mlkit-image-labeling": "file:../../dist/packages/mlkit-image-labeling", 10 | "@nativescript/mlkit-object-detection": "file:../../dist/packages/mlkit-object-detection", 11 | "@nativescript/mlkit-digital-ink-recognition": "file:../../dist/packages/mlkit-digital-ink-recognition", 12 | "@nativescript/mlkit-pose-detection": "file:../../dist/packages/mlkit-pose-detection", 13 | "@nativescript/mlkit-selfie-segmentation": "file:../../dist/packages/mlkit-selfie-segmentation", 14 | "@nativescript/mlkit-custom-object-detection": "file:../../dist/packages/mlkit-custom-object-detection" 15 | }, 16 | "devDependencies": { 17 | "@nativescript/android": "~8.8.0", 18 | "@nativescript/ios": "~8.8.0" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /apps/demo-angular/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo-angular", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "apps/demo-angular/src", 5 | "projectType": "application", 6 | "prefix": "demo", 7 | "targets": { 8 | "build": { 9 | "executor": "@nativescript/nx:build", 10 | "options": { 11 | "noHmr": true, 12 | "production": true, 13 | "uglify": true, 14 | "release": true, 15 | "forDevice": true, 16 | "tsConfig": "apps/demo-angular/tsconfig.json" 17 | }, 18 | "dependsOn": [ 19 | { 20 | "target": "build.all", 21 | "dependencies": true 22 | } 23 | ] 24 | }, 25 | "clean": { 26 | "executor": "@nativescript/nx:clean", 27 | "options": {} 28 | }, 29 | "lint": { 30 | "executor": "@nx/eslint:lint" 31 | }, 32 | "debug": { 33 | "executor": "@nativescript/nx:debug", 34 | "options": { 35 | "noHmr": true, 36 | "uglify": false, 37 | "release": false, 38 | "forDevice": false, 39 | "prepare": false 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /apps/demo-angular/references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /apps/demo-angular/src/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { Routes } from '@angular/router'; 3 | import { NativeScriptRouterModule } from '@nativescript/angular'; 4 | 5 | import { HomeComponent } from './home.component'; 6 | 7 | const routes: Routes = [ 8 | { path: '', redirectTo: '/home', pathMatch: 'full' }, 9 | { path: 'home', component: HomeComponent }, 10 | { path: 'mlkit-barcode-scanning', loadChildren: () => import('./plugin-demos/mlkit-barcode-scanning.module').then((m) => m.MlkitBarcodeScanningModule) }, 11 | { path: 'mlkit-core', loadChildren: () => import('./plugin-demos/mlkit-core.module').then((m) => m.MlkitCoreModule) }, 12 | { path: 'mlkit-custom-object-detection', loadChildren: () => import('./plugin-demos/mlkit-custom-object-detection.module').then((m) => m.MlkitCustomObjectDetectionModule) }, 13 | { path: 'mlkit-digital-ink-recognition', loadChildren: () => import('./plugin-demos/mlkit-digital-ink-recognition.module').then((m) => m.MlkitDigitalInkRecognitionModule) }, 14 | { path: 'mlkit-face-detection', loadChildren: () => import('./plugin-demos/mlkit-face-detection.module').then((m) => m.MlkitFaceDetectionModule) }, 15 | { path: 'mlkit-image-labeling', loadChildren: () => import('./plugin-demos/mlkit-image-labeling.module').then((m) => m.MlkitImageLabelingModule) }, 16 | { path: 'mlkit-object-detection', loadChildren: () => import('./plugin-demos/mlkit-object-detection.module').then((m) => m.MlkitObjectDetectionModule) }, 17 | { path: 'mlkit-pose-detection', loadChildren: () => import('./plugin-demos/mlkit-pose-detection.module').then((m) => m.MlkitPoseDetectionModule) }, 18 | { path: 'mlkit-selfie-segmentation', loadChildren: () => import('./plugin-demos/mlkit-selfie-segmentation.module').then((m) => m.MlkitSelfieSegmentationModule) }, 19 | { path: 'mlkit-text-recognition', loadChildren: () => import('./plugin-demos/mlkit-text-recognition.module').then((m) => m.MlkitTextRecognitionModule) }, 20 | ]; 21 | 22 | @NgModule({ 23 | imports: [NativeScriptRouterModule.forRoot(routes)], 24 | exports: [NativeScriptRouterModule], 25 | }) 26 | export class AppRoutingModule {} 27 | -------------------------------------------------------------------------------- /apps/demo-angular/src/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'demo-app', 5 | template: ` 6 | 7 | `, 8 | }) 9 | export class AppComponent {} 10 | -------------------------------------------------------------------------------- /apps/demo-angular/src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptModule } from '@nativescript/angular'; 3 | 4 | import { AppComponent } from './app.component'; 5 | import { AppRoutingModule } from './app-routing.module'; 6 | import { HomeComponent } from './home.component'; 7 | import { MLKitModule } from '@nativescript/mlkit-core/angular'; 8 | 9 | @NgModule({ 10 | schemas: [NO_ERRORS_SCHEMA], 11 | declarations: [AppComponent, HomeComponent], 12 | bootstrap: [AppComponent], 13 | imports: [NativeScriptModule, AppRoutingModule, MLKitModule], 14 | }) 15 | export class AppModule {} 16 | -------------------------------------------------------------------------------- /apps/demo-angular/src/app.scss: -------------------------------------------------------------------------------- 1 | @import 'nativescript-theme-core/scss/light'; 2 | @import 'nativescript-theme-core/scss/index'; 3 | 4 | button, label, stack-layout { 5 | horizontal-align: center; 6 | } 7 | 8 | button { 9 | font-size: 16; 10 | } 11 | 12 | .title { 13 | font-size: 30; 14 | margin: 20; 15 | } 16 | 17 | .message { 18 | font-size: 20; 19 | color: #284848; 20 | text-align: center; 21 | margin: 0 20; 22 | } 23 | -------------------------------------------------------------------------------- /apps/demo-angular/src/home.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /apps/demo-angular/src/home.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { RouterExtensions } from '@nativescript/angular'; 3 | 4 | @Component({ 5 | selector: 'demo-home', 6 | templateUrl: 'home.component.html', 7 | }) 8 | export class HomeComponent { 9 | demos = [ 10 | { 11 | name: 'mlkit-barcode-scanning', 12 | }, 13 | { 14 | name: 'mlkit-core', 15 | }, 16 | { 17 | name: 'mlkit-custom-object-detection', 18 | }, 19 | { 20 | name: 'mlkit-digital-ink-recognition', 21 | }, 22 | { 23 | name: 'mlkit-face-detection', 24 | }, 25 | { 26 | name: 'mlkit-image-labeling', 27 | }, 28 | { 29 | name: 'mlkit-object-detection', 30 | }, 31 | { 32 | name: 'mlkit-pose-detection', 33 | }, 34 | { 35 | name: 'mlkit-selfie-segmentation', 36 | }, 37 | { 38 | name: 'mlkit-text-recognition', 39 | }, 40 | ]; 41 | } 42 | -------------------------------------------------------------------------------- /apps/demo-angular/src/main.ts: -------------------------------------------------------------------------------- 1 | import { runNativeScriptAngularApp, platformNativeScript } from '@nativescript/angular'; 2 | import { AppModule } from './app.module'; 3 | 4 | runNativeScriptAngularApp({ 5 | appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule), 6 | }); -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/NativeScript/mlkit/2447dc2ba56ca0009b2e132150744246655aa336/apps/demo-angular/src/plugin-demos/.gitkeep -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-barcode-scanning.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-barcode-scanning.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitBarcodeScanning } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-barcode-scanning', 6 | templateUrl: 'mlkit-barcode-scanning.component.html', 7 | }) 8 | export class MlkitBarcodeScanningComponent { 9 | 10 | demoShared: DemoSharedMlkitBarcodeScanning; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitBarcodeScanning(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-barcode-scanning.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitBarcodeScanningComponent } from './mlkit-barcode-scanning.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitBarcodeScanningComponent }])], 7 | declarations: [MlkitBarcodeScanningComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitBarcodeScanningModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-core.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-core.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitCore } from '@demo/shared'; 3 | import { Dialogs, ImageSource } from '@nativescript/core'; 4 | import { DetectionEvent, DetectionType, detectWithStillImage, MLKitView } from '@nativescript/mlkit-core'; 5 | 6 | @Component({ 7 | selector: 'demo-mlkit-core', 8 | templateUrl: 'mlkit-core.component.html', 9 | }) 10 | export class MlkitCoreComponent { 11 | 12 | camera: MLKitView; 13 | detectorType = DetectionType.All; 14 | isPaused = true; 15 | torchOn = true; 16 | demoShared: DemoSharedMlkitCore; 17 | 18 | constructor(private _ngZone: NgZone) { } 19 | 20 | ngOnInit() { 21 | this.demoShared = new DemoSharedMlkitCore(); 22 | } 23 | onLoaded(args) { 24 | this.camera = args.object; 25 | } 26 | 27 | onDetection(event: DetectionEvent) { 28 | console.log('onDetection', event.data, event.type); 29 | } 30 | 31 | toggleCamera(args) { 32 | this.camera.toggleCamera(); 33 | } 34 | 35 | requestPermission(args) { 36 | this.camera.requestCameraPermission(); 37 | } 38 | 39 | changeType(args) { 40 | Dialogs.action('Change Detector Type', 'Cancel', [ 41 | 'all', 42 | 'barcode', 43 | 'digitalInk (unsupport atm)', 44 | 'face', 45 | 'image', 46 | 'object', 47 | 'pose', 48 | 'text', 49 | 'none' 50 | ]).then(value => { 51 | if (value === 'Cancel') { return } 52 | if (value.indexOf('digitalInk') > -1) { 53 | Dialogs.alert('digitalInk is currently unsupported'); 54 | this.detectorType = DetectionType.None; 55 | } else { 56 | this.detectorType = value as any; 57 | } 58 | }) 59 | } 60 | 61 | togglePause(args) { 62 | this.camera.pause = !this.camera.pause; 63 | this.isPaused = this.camera.pause; 64 | } 65 | 66 | toggleTorch(args) { 67 | this.camera.torchOn = !this.camera.torchOn; 68 | this.torchOn = this.camera.torchOn; 69 | } 70 | 71 | async processStill(args) { 72 | try { 73 | const src = await ImageSource.fromUrl('https://www.jqueryscript.net/images/jQuery-Plugin-To-Generate-International-Article-Number-Barcode-EAN13.jpg'); 74 | const result = await detectWithStillImage(src, { 75 | detectorType: DetectionType.Barcode 76 | }); 77 | console.log('processStill', result.barcode[0]); 78 | } catch (e) { 79 | console.log(e); 80 | } 81 | } 82 | 83 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-core.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitCoreComponent } from './mlkit-core.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitCoreComponent }])], 7 | declarations: [MlkitCoreComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitCoreModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-custom-object-detection.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-custom-object-detection.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitCustomObjectDetection } from '@demo/shared'; 3 | import {} from '@nativescript/mlkit-custom-object-detection'; 4 | 5 | @Component({ 6 | selector: 'demo-mlkit-custom-object-detection', 7 | templateUrl: 'mlkit-custom-object-detection.component.html', 8 | }) 9 | export class MlkitCustomObjectDetectionComponent { 10 | demoShared: DemoSharedMlkitCustomObjectDetection; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitCustomObjectDetection(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-custom-object-detection.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitCustomObjectDetectionComponent } from './mlkit-custom-object-detection.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitCustomObjectDetectionComponent }])], 7 | declarations: [MlkitCustomObjectDetectionComponent], 8 | schemas: [NO_ERRORS_SCHEMA], 9 | }) 10 | export class MlkitCustomObjectDetectionModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-digital-ink-recognition.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-digital-ink-recognition.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitDigitalInkRecognition } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-digital-ink-recognition', 6 | templateUrl: 'mlkit-digital-ink-recognition.component.html', 7 | }) 8 | export class MlkitDigitalInkRecognitionComponent { 9 | 10 | demoShared: DemoSharedMlkitDigitalInkRecognition; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitDigitalInkRecognition(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-digital-ink-recognition.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitDigitalInkRecognitionComponent } from './mlkit-digital-ink-recognition.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitDigitalInkRecognitionComponent }])], 7 | declarations: [MlkitDigitalInkRecognitionComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitDigitalInkRecognitionModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-face-detection.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-face-detection.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitFaceDetection } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-face-detection', 6 | templateUrl: 'mlkit-face-detection.component.html', 7 | }) 8 | export class MlkitFaceDetectionComponent { 9 | 10 | demoShared: DemoSharedMlkitFaceDetection; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitFaceDetection(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-face-detection.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitFaceDetectionComponent } from './mlkit-face-detection.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitFaceDetectionComponent }])], 7 | declarations: [MlkitFaceDetectionComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitFaceDetectionModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-image-labeling.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-image-labeling.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitImageLabeling } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-image-labeling', 6 | templateUrl: 'mlkit-image-labeling.component.html', 7 | }) 8 | export class MlkitImageLabelingComponent { 9 | 10 | demoShared: DemoSharedMlkitImageLabeling; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitImageLabeling(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-image-labeling.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitImageLabelingComponent } from './mlkit-image-labeling.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitImageLabelingComponent }])], 7 | declarations: [MlkitImageLabelingComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitImageLabelingModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-object-detection.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-object-detection.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitObjectDetection } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-object-detection', 6 | templateUrl: 'mlkit-object-detection.component.html', 7 | }) 8 | export class MlkitObjectDetectionComponent { 9 | 10 | demoShared: DemoSharedMlkitObjectDetection; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitObjectDetection(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-object-detection.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitObjectDetectionComponent } from './mlkit-object-detection.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitObjectDetectionComponent }])], 7 | declarations: [MlkitObjectDetectionComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitObjectDetectionModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-pose-detection.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-pose-detection.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitPoseDetection } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-pose-detection', 6 | templateUrl: 'mlkit-pose-detection.component.html', 7 | }) 8 | export class MlkitPoseDetectionComponent { 9 | 10 | demoShared: DemoSharedMlkitPoseDetection; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitPoseDetection(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-pose-detection.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitPoseDetectionComponent } from './mlkit-pose-detection.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitPoseDetectionComponent }])], 7 | declarations: [MlkitPoseDetectionComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitPoseDetectionModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-selfie-segmentation.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-selfie-segmentation.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitSelfieSegmentation } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-selfie-segmentation', 6 | templateUrl: 'mlkit-selfie-segmentation.component.html', 7 | }) 8 | export class MlkitSelfieSegmentationComponent { 9 | 10 | demoShared: DemoSharedMlkitSelfieSegmentation; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitSelfieSegmentation(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-selfie-segmentation.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitSelfieSegmentationComponent } from './mlkit-selfie-segmentation.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitSelfieSegmentationComponent }])], 7 | declarations: [MlkitSelfieSegmentationComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitSelfieSegmentationModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-text-recognition.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-text-recognition.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, NgZone } from '@angular/core'; 2 | import { DemoSharedMlkitTextRecognition } from '@demo/shared'; 3 | 4 | @Component({ 5 | selector: 'demo-mlkit-text-recognition', 6 | templateUrl: 'mlkit-text-recognition.component.html', 7 | }) 8 | export class MlkitTextRecognitionComponent { 9 | 10 | demoShared: DemoSharedMlkitTextRecognition; 11 | 12 | constructor(private _ngZone: NgZone) {} 13 | 14 | ngOnInit() { 15 | this.demoShared = new DemoSharedMlkitTextRecognition(); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /apps/demo-angular/src/plugin-demos/mlkit-text-recognition.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; 2 | import { NativeScriptCommonModule, NativeScriptRouterModule } from '@nativescript/angular'; 3 | import { MlkitTextRecognitionComponent } from './mlkit-text-recognition.component'; 4 | 5 | @NgModule({ 6 | imports: [NativeScriptCommonModule, NativeScriptRouterModule.forChild([{ path: '', component: MlkitTextRecognitionComponent }])], 7 | declarations: [MlkitTextRecognitionComponent], 8 | schemas: [ NO_ERRORS_SCHEMA] 9 | }) 10 | export class MlkitTextRecognitionModule {} 11 | -------------------------------------------------------------------------------- /apps/demo-angular/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * NativeScript Polyfills 3 | */ 4 | 5 | // Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame) 6 | import '@nativescript/core/globals'; 7 | // Install @nativescript/angular specific polyfills 8 | import '@nativescript/angular/polyfills'; 9 | 10 | /** 11 | * Zone.js and patches 12 | */ 13 | // Add pre-zone.js patches needed for the NativeScript platform 14 | import '@nativescript/zone-js/dist/pre-zone-polyfills'; 15 | 16 | // Zone JS is required by default for Angular itself 17 | import 'zone.js'; 18 | 19 | // Add NativeScript specific Zone JS patches 20 | import '@nativescript/zone-js'; 21 | -------------------------------------------------------------------------------- /apps/demo-angular/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "paths": { 5 | "~/*": ["src/*"], 6 | "@demo/shared": ["tools/demo/index.ts"], 7 | "@nativescript/mlkit-text-recognition": ["packages/mlkit-text-recognition/index.ts"], 8 | "@nativescript/mlkit-core": ["packages/mlkit-core/index.d.ts"], 9 | "@nativescript/mlkit-core/angular": ["packages/mlkit-core/angular/index.ts"], 10 | "@nativescript/mlkit-custom-object-detection": ["../../packages/mlkit-custom-object-detection/index.d.ts"], 11 | "@nativescript/mlkit-barcode-scanning": ["packages/mlkit-barcode-scanning/index.ts"], 12 | "@nativescript/mlkit-face-detection": ["packages/mlkit-face-detection/index.ts"], 13 | "@nativescript/mlkit-image-labeling": ["packages/mlkit-image-labeling/index.ts"], 14 | "@nativescript/mlkit-object-detection": ["packages/mlkit-object-detection/index.ts"], 15 | "@nativescript/mlkit-digital-ink-recognition": ["packages/mlkit-digital-ink-recognition/index.ts"], 16 | "@nativescript/mlkit-pose-detection": ["packages/mlkit-pose-detection/index.ts"], 17 | "@nativescript/mlkit-selfie-segmentation": ["packages/mlkit-selfie-segmentation/index.ts"], 18 | "@nativescript/*": ["../../dist/packages/*"] 19 | } 20 | }, 21 | "files": ["./references.d.ts", "./src/main.ts", "./src/polyfills.ts"], 22 | "include": ["../../packages/**/references.d.ts"] 23 | } 24 | -------------------------------------------------------------------------------- /apps/demo-angular/webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require('@nativescript/webpack'); 2 | const { resolve } = require('path'); 3 | 4 | module.exports = (env) => { 5 | 6 | webpack.init(env); 7 | webpack.useConfig('angular'); 8 | 9 | webpack.chainWebpack((config) => { 10 | // shared demo code 11 | config.resolve.alias.set('@demo/shared', resolve(__dirname, '..', '..', 'tools', 'demo')); 12 | }); 13 | 14 | // Example if you need to share images across demo apps: 15 | // webpack.Utils.addCopyRule({ 16 | // from: '../../../tools/images', 17 | // to: 'images', 18 | // context: webpack.Utils.project.getProjectFilePath('node_modules') 19 | // }); 20 | 21 | return webpack.resolveConfig(); 22 | }; 23 | -------------------------------------------------------------------------------- /apps/demo/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../.eslintrc.json"], 3 | "ignorePatterns": ["!**/*", "node_modules/**/*"], 4 | "overrides": [ 5 | { 6 | "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], 7 | "rules": {} 8 | }, 9 | { 10 | "files": ["*.ts", "*.tsx"], 11 | "rules": {} 12 | }, 13 | { 14 | "files": ["*.js", "*.jsx"], 15 | "rules": {} 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /apps/demo/.gitignore: -------------------------------------------------------------------------------- 1 | # NativeScript 2 | hooks/ 3 | node_modules/ 4 | platforms/ 5 | 6 | # NativeScript Template 7 | *.js.map 8 | *.js 9 | !webpack.config.js 10 | 11 | # Logs 12 | logs 13 | *.log 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | 18 | # General 19 | .DS_Store 20 | .AppleDouble 21 | .LSOverride 22 | .idea 23 | .cloud 24 | .project 25 | tmp/ 26 | typings/ 27 | 28 | # misc 29 | npm-debug.log 30 | 31 | # app 32 | !*.d.ts 33 | !src/assets/fontawesome.min.css 34 | /report/ 35 | .nsbuildinfo 36 | /temp/ 37 | /src/tns_modules/ 38 | 39 | # app uses platform specific scss which can inadvertently get renamed which will cause problems 40 | app/app.scss 41 | 42 | package-lock.json 43 | -------------------------------------------------------------------------------- /apps/demo/nativescript.config.ts: -------------------------------------------------------------------------------- 1 | import { NativeScriptConfig } from '@nativescript/core'; 2 | 3 | export default { 4 | id: 'org.nativescript.plugindemo', 5 | appResourcesPath: '../../tools/assets/App_Resources', 6 | android: { 7 | v8Flags: '--expose_gc', 8 | markingMode: 'none', 9 | }, 10 | appPath: 'src', 11 | cli: { 12 | packageManager: 'npm' 13 | } 14 | } as NativeScriptConfig; 15 | -------------------------------------------------------------------------------- /apps/demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "./src/app.ts", 3 | "description": "NativeScript Application", 4 | "license": "SEE LICENSE IN ", 5 | "repository": "", 6 | "dependencies": { 7 | "@nativescript/core": "file:../../node_modules/@nativescript/core", 8 | "@nativescript/mlkit-barcode-scanning": "file:../../packages/mlkit-barcode-scanning", 9 | "@nativescript/mlkit-core": "file:../../packages/mlkit-core", 10 | "@nativescript/mlkit-digital-ink-recognition": "file:../../packages/mlkit-digital-ink-recognition", 11 | "@nativescript/mlkit-face-detection": "file:../../packages/mlkit-face-detection", 12 | "@nativescript/mlkit-image-labeling": "file:../../packages/mlkit-image-labeling", 13 | "@nativescript/mlkit-object-detection": "file:../../packages/mlkit-object-detection", 14 | "@nativescript/mlkit-pose-detection": "file:../../packages/mlkit-pose-detection", 15 | "@nativescript/mlkit-selfie-segmentation": "file:../../packages/mlkit-selfie-segmentation", 16 | "@nativescript/mlkit-text-recognition": "file:../../packages/mlkit-text-recognition", 17 | "@nativescript/mlkit-custom-object-detection": "file:../../packages/mlkit-custom-object-detection" 18 | }, 19 | "devDependencies": { 20 | "@nativescript/android": "~8.8.0", 21 | "@nativescript/ios": "~8.8.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /apps/demo/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "demo", 3 | "$schema": "../../node_modules/nx/schemas/project-schema.json", 4 | "sourceRoot": "apps/demo/src", 5 | "projectType": "application", 6 | "prefix": "demo", 7 | "targets": { 8 | "build": { 9 | "executor": "@nativescript/nx:build", 10 | "options": { 11 | "noHmr": true, 12 | "production": true, 13 | "uglify": true, 14 | "release": true, 15 | "forDevice": true, 16 | "tsConfig": "apps/demo/tsconfig.json" 17 | }, 18 | "dependsOn": [ 19 | { 20 | "target": "build.all", 21 | "dependencies": true 22 | } 23 | ] 24 | }, 25 | "clean": { 26 | "executor": "@nativescript/nx:clean", 27 | "options": {} 28 | }, 29 | "lint": { 30 | "executor": "@nx/eslint:lint" 31 | }, 32 | "debug": { 33 | "executor": "@nativescript/nx:debug", 34 | "options": { 35 | "noHmr": true, 36 | "uglify": false, 37 | "release": false, 38 | "forDevice": false, 39 | "prepare": false 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /apps/demo/references.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /apps/demo/src/app-root.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /apps/demo/src/app.scss: -------------------------------------------------------------------------------- 1 | @import 'nativescript-theme-core/scss/light'; 2 | @import 'nativescript-theme-core/scss/index'; -------------------------------------------------------------------------------- /apps/demo/src/app.ts: -------------------------------------------------------------------------------- 1 | import { Application } from '@nativescript/core'; 2 | 3 | Application.run({ moduleName: 'app-root' }); 4 | -------------------------------------------------------------------------------- /apps/demo/src/main-page.ts: -------------------------------------------------------------------------------- 1 | import { EventData, Page } from '@nativescript/core'; 2 | import { MainViewModel } from "./main-view-model"; 3 | 4 | export function navigatingTo(args: EventData) { 5 | const page = args.object; 6 | page.bindingContext = new MainViewModel(); 7 | } 8 | -------------------------------------------------------------------------------- /apps/demo/src/main-page.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |