-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3feb695
commit b54b33e
Showing
25 changed files
with
1,141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
module.exports = { | ||
root: true, | ||
parser: "babel-eslint", | ||
parserOptions: { | ||
sourceType: "module" | ||
}, | ||
extends: "prettier", | ||
// required to lint *.vue files | ||
plugins: ["html"], | ||
env: { | ||
browser: true | ||
} | ||
// add your custom rules here | ||
// 'rules': { | ||
// // allow paren-less arrow functions | ||
// 'arrow-parens': 0, | ||
// // allow async-await | ||
// 'generator-star-spacing': 0, | ||
// // allow debugger during development | ||
// 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
// // trailing comma | ||
// 'comma-dangle': ['error', 'always-multiline'], | ||
// } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.vue linguist-detectable=true | ||
*.js linguist-detectable=false | ||
*.html linguist-detectable=false | ||
*.xml linguist-detectable=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# OS Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Dev/Build Artifacts | ||
/dist/ | ||
/tests/e2e/videos/ | ||
/tests/e2e/screenshots/ | ||
/tests/unit/coverage/ | ||
jsconfig.json | ||
|
||
# Local Env Files | ||
.env.local | ||
.env.*.local | ||
|
||
# Log Files | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Unconfigured Editors | ||
.idea | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw* | ||
#Yarn | ||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1.0.0 (JULY 23, 2020) | ||
Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,123 @@ | ||
# Vue-QRCode-Scanner | ||
# Vue QR Scanner Component | ||
|
||
A Vue.js based QR Code scanner component, allowing you to detect and decode QR codes without leaving the browser. | ||
|
||
## Table of contents | ||
|
||
- [Browser Support](#browser-support) | ||
- [Getting started](#getting-started) | ||
- [Usage](#usage) | ||
- [Want to Contribute?](#want-to-contribute) | ||
- [Need Help / Support?](#need-help) | ||
- [Collection of Components](#collection-of-components) | ||
- [Changelog](#changelog) | ||
- [Credits](#credits) | ||
- [License](#license) | ||
- [Keywords](#Keywords) | ||
|
||
## Browser Support | ||
|
||
#### `QrcodeStream` | ||
|
||
This component fundamentally depends on the [Stream API](https://caniuse.com/#feat=stream). | ||
|
||
 |  |  |  |  | | ||
--- | --- | --- | --- | --- | --- | | ||
83.0 ✔ | 77.0 ✔ | 13.1.1 ✔ | 83.0 ✔ | Not verified | | ||
|
||
1. Chrome requires [HTTPS or localhost](https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins) (see _Troubleshooting_ for help) | ||
2. Safari also requires HTTPS **even** on localhost. It also won't work in: | ||
- _Chrome for iOS_, _Firefox for iOS_, | ||
- WkWebView component of native iOS apps | ||
- web apps added to home screen (PWA mode) **prior to iOS 13.4** | ||
|
||
#### `QrcodeDropZone` and `QrcodeCapture` | ||
|
||
The newest API these components depend on is the [FileReader API](https://caniuse.com/#feat=filereader). | ||
|
||
 |  |  |  |  | | ||
--- | --- | --- | --- | --- | --- | | ||
83.0 ✔ | 77.0 ✔ | 13.1.1 ✔ | 83.0 ✔ | 10+ | | ||
|
||
## Getting started | ||
|
||
Install the npm package: | ||
|
||
``` bash | ||
npm install vue-weblineindia-qrcode-scanner | ||
#OR | ||
yarn add vue-weblineindia-qrcode-scanner | ||
``` | ||
|
||
## Usage | ||
|
||
Use the `<vue-weblineindia-qrcode-scanner>` component: | ||
|
||
Either import the components independantly for local registration: | ||
|
||
```javascript | ||
import { QrcodeStream, QrcodeDropZone, QrcodeCapture } from 'vue-weblineindia-qr-scanner' | ||
|
||
const MyComponent = { | ||
|
||
components: { | ||
QrcodeStream, | ||
QrcodeDropZone, | ||
QrcodeCapture | ||
}, | ||
|
||
// ... | ||
)) | ||
``` | ||
Or register all of them globally: | ||
```javascript | ||
import Vue from "vue"; | ||
import VueQrcodeReader from "vue-weblineindia-qr-scanner"; | ||
|
||
Vue.use(VueQrcodeReader); | ||
``` | ||
## Import Css | ||
- `<link href="`[vue-weblineindia-qr-scanner.css](https://unpkg.com/vue-weblineindia-qr-scanner/lib/vue-qrcode-reader.css)`" rel="stylesheet">` | ||
- `<script src="`[vue-weblineindia-qr-scanner.browser.js](https://unpkg.com/vue-weblineindia-qr-scanner/lib/vue-qrcode-reader.browser.js)`"></script>` | ||
## Want to Contribute? | ||
- Created something awesome, made this code better, added some functionality, or whatever (this is the hardest part). | ||
- [Fork it](http://help.github.com/forking/). | ||
- Create new branch to contribute your changes. | ||
- Commit all your changes to your branch. | ||
- Submit a [pull request](http://help.github.com/pull-requests/). | ||
----- | ||
## Need Help? | ||
We also provide a free, basic support for all users who want to use this VueJS QR code scanner in their software project. In case you want to customize this VueJS QR code scanner to suit your development needs, then feel free to contact our [VueJS developers](https://www.weblineindia.com/hire-vuejs-developer.html). | ||
----- | ||
## Collection of Components | ||
We have built many other components and free resources for software development in various programming languages. Kindly click here to view our [Free Resources for Software Development](https://www.weblineindia.com/software-development-resources.html ) | ||
------ | ||
## Changelog | ||
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md). | ||
## Credits | ||
vue-weblineindia-qr-scanner is inspired by [vue-qrcode-reader](https://www.npmjs.com/package/vue-qrcode-reader). | ||
## License | ||
[MIT](LICENSE) | ||
[mit]: https://github.com/weblineindia/Vue-CK-Editor/blob/master/LICENSE | ||
## Keywords | ||
vue-weblineindia-qr-scanner, vue, vuejs, vue-component, qrcode, qrcode-reader, qrcode-scanner, webrtc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var webpack = require("webpack"); | ||
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | ||
|
||
var outputFile = "vue-qrcode-reader"; | ||
var globalName = "VueQrcodeReader"; | ||
|
||
var config = require("../package.json"); | ||
|
||
module.exports = { | ||
entry: "./src/index.js", | ||
module: { | ||
rules: [ | ||
{ | ||
enforce: "pre", | ||
test: /\.(js|vue)$/, | ||
loader: "eslint-loader", | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /worker\//, | ||
loader: "worker-loader", | ||
options: { | ||
inline: true, | ||
fallback: false | ||
} | ||
}, | ||
{ | ||
test: /.js$/, | ||
use: "babel-loader", | ||
exclude: /node_modules/ | ||
}, | ||
{ | ||
test: /\.vue$/, | ||
loader: "vue-loader", | ||
options: { | ||
loaders: { | ||
css: ExtractTextPlugin.extract({ | ||
use: { | ||
loader: "css-loader", | ||
options: { minimize: true } | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [new ExtractTextPlugin(outputFile + ".css")] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var webpack = require('webpack') | ||
var merge = require('webpack-merge') | ||
var base = require('./webpack.config.base') | ||
var path = require('path') | ||
|
||
var outputFile = 'vue-qrcode-reader' | ||
var globalName = 'VueQrcodeReader' | ||
|
||
module.exports = merge(base, { | ||
output: { | ||
path: path.resolve(__dirname, '../lib'), | ||
filename: outputFile + '.browser.js', | ||
library: globalName, | ||
libraryTarget: 'umd', | ||
}, | ||
externals: { | ||
// Put external libraries like lodash here | ||
// With their global name | ||
// Example: 'lodash': '_' | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: true, | ||
}, | ||
mangle: true, | ||
}), | ||
], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
var webpack = require("webpack"); | ||
var merge = require("webpack-merge"); | ||
var base = require("./webpack.config.base"); | ||
var path = require("path"); | ||
|
||
var outputFile = "vue-qrcode-reader"; | ||
var globalName = "VueQrcodeReader"; | ||
|
||
module.exports = merge(base, { | ||
output: { | ||
path: path.resolve(__dirname, "../lib"), | ||
filename: outputFile + ".common.js", | ||
libraryTarget: "commonjs2" | ||
}, | ||
target: "node", | ||
externals: { | ||
// Put external libraries like lodash here | ||
// With their package name | ||
// Example: 'lodash': 'lodash' | ||
jsqr: "jsqr", | ||
"babel-runtime": "babel-runtime", | ||
"webrtc-adapter": "webrtc-adapter" | ||
}, | ||
plugins: [ | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compress: { | ||
warnings: true | ||
}, | ||
mangle: true | ||
}) | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
var merge = require('webpack-merge') | ||
var base = require('./webpack.config.base') | ||
var path = require('path') | ||
|
||
var outputFile = 'vue-qrcode-reader' | ||
var globalName = 'VueQrcodeReader' | ||
|
||
module.exports = merge(base, { | ||
output: { | ||
path: path.resolve(__dirname, '../lib'), | ||
filename: outputFile + '.common.js', | ||
library: globalName, | ||
libraryTarget: 'umd', | ||
}, | ||
devtool: 'eval-source-map', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { default } from './lib/vue-qrcode-reader.common' | ||
export * from './lib/vue-qrcode-reader.common' | ||
import './lib/vue-qrcode-reader.css' |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "vue-weblineindia-qr-scanner", | ||
"version": "1.0.0", | ||
"description": "> A set of Vue.js components, allowing you to detect and decode QR codes, without leaving the browser.", | ||
"main": "dist/vue-qrcode-reader.common.js", | ||
"author": "weblineindia", | ||
"license": "MLT", | ||
"repository": "https://github.com/weblineindia/Vue-Image-Crop-Upload", | ||
"homepage": "https://www.weblineindia.com/software-development-resources.html", | ||
"keywords": [ | ||
"vue-weblineindia-qr-scanner", | ||
"vue-component", | ||
"qrcode", | ||
"qrcode-reader", | ||
"qrcode-scanner", | ||
"vue", | ||
"vuejs", | ||
"webrtc" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<template lang="html"> | ||
<input | ||
@change="onChangeInput" | ||
type="file" | ||
name="image" | ||
accept="image/*" | ||
capture="environment" | ||
multiple | ||
/> | ||
</template> | ||
|
||
<script> | ||
import { scan } from "../misc/scanner.js"; | ||
import { imageDataFromFile } from "../misc/image-data.js"; | ||
import CommonAPI from "../mixins/CommonAPI.vue"; | ||
import Worker from "../worker/jsqr.js"; | ||
export default { | ||
name: "qrcode-capture", | ||
mixins: [CommonAPI], | ||
props: { | ||
worker: { | ||
type: Function, | ||
default: Worker | ||
} | ||
}, | ||
methods: { | ||
onChangeInput(event) { | ||
const files = [...event.target.files]; | ||
const resultPromises = files.map(this.processFile); | ||
resultPromises.forEach(this.onDetect); | ||
}, | ||
async processFile(file) { | ||
const imageData = await imageDataFromFile(file); | ||
const scanResult = await scan(this.worker, imageData); | ||
return scanResult; | ||
} | ||
} | ||
}; | ||
</script> |
Oops, something went wrong.