mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-27 11:56:05 +02:00
chore: adjust prettier config, .gitignore and use taplo to format toml files (#1728)
* chore: adjust prettier config, .gitignore and use taplo to format toml files This brings the plugins-workspace repository to the same code style of the main tauri repo * format toml * ignore examples gen dir * add .vscode/extensions.json * remove packageManager field * fmt * fix audit * taplo ignore permissions autogenerated files * remove create dummy dist * fix prettier workflow * install fmt in prettier workflow --------- Co-authored-by: Lucas Nogueira <lucas@tauri.app>
This commit is contained in:
@@ -1 +0,0 @@
|
||||
/.tauri
|
||||
@@ -10,12 +10,12 @@ repository = { workspace = true }
|
||||
links = "tauri-plugin-barcode-scanner"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
rustc-args = [ "--cfg", "docsrs" ]
|
||||
rustdoc-args = [ "--cfg", "docsrs" ]
|
||||
targets = [ "x86_64-linux-android" ]
|
||||
rustc-args = ["--cfg", "docsrs"]
|
||||
rustdoc-args = ["--cfg", "docsrs"]
|
||||
targets = ["x86_64-linux-android"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-plugin = { workspace = true, features = [ "build" ] }
|
||||
tauri-plugin = { workspace = true, features = ["build"] }
|
||||
|
||||
[dependencies]
|
||||
serde = { workspace = true }
|
||||
|
||||
@@ -60,12 +60,12 @@ fn main() {
|
||||
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
||||
|
||||
```javascript
|
||||
import { scan } from "@tauri-apps/plugin-barcode-scanner";
|
||||
import { scan } from '@tauri-apps/plugin-barcode-scanner'
|
||||
|
||||
// `windowed: true` actually sets the webview to transparent
|
||||
// instead of opening a separate view for the camera
|
||||
// make sure your user interface is ready to show what is underneath with a transparent element
|
||||
scan({ windowed: true, formats: [""] })
|
||||
scan({ windowed: true, formats: [''] })
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -54,7 +54,6 @@ The camera has two modes. The first one is where the user can see the background
|
||||
The second mode allows the developer to assist the user and add a transparent overlay to the image, providing hints or additional information (like a link preview).
|
||||
The overlay could be made non-transparent by the application frontend and as long as the app is open (and in some cases) it could read QR codes in range of the camera lense.
|
||||
|
||||
|
||||
#### Out Of Scope
|
||||
|
||||
- Exploits in the operating system QR code parsing functionality
|
||||
|
||||
@@ -5,37 +5,37 @@
|
||||
import {
|
||||
invoke,
|
||||
requestPermissions as checkPermissions_,
|
||||
checkPermissions as requestPermissions_,
|
||||
} from "@tauri-apps/api/core";
|
||||
checkPermissions as requestPermissions_
|
||||
} from '@tauri-apps/api/core'
|
||||
|
||||
export type { PermissionState } from "@tauri-apps/api/core";
|
||||
export type { PermissionState } from '@tauri-apps/api/core'
|
||||
|
||||
export enum Format {
|
||||
QRCode = "QR_CODE",
|
||||
UPC_A = "UPC_A",
|
||||
UPC_E = "UPC_E",
|
||||
EAN8 = "EAN_8",
|
||||
EAN13 = "EAN_13",
|
||||
Code39 = "CODE_39",
|
||||
Code93 = "CODE_93",
|
||||
Code128 = "CODE_128",
|
||||
Codabar = "CODABAR",
|
||||
ITF = "ITF",
|
||||
Aztec = "AZTEC",
|
||||
DataMatrix = "DATA_MATRIX",
|
||||
PDF417 = "PDF_417",
|
||||
QRCode = 'QR_CODE',
|
||||
UPC_A = 'UPC_A',
|
||||
UPC_E = 'UPC_E',
|
||||
EAN8 = 'EAN_8',
|
||||
EAN13 = 'EAN_13',
|
||||
Code39 = 'CODE_39',
|
||||
Code93 = 'CODE_93',
|
||||
Code128 = 'CODE_128',
|
||||
Codabar = 'CODABAR',
|
||||
ITF = 'ITF',
|
||||
Aztec = 'AZTEC',
|
||||
DataMatrix = 'DATA_MATRIX',
|
||||
PDF417 = 'PDF_417'
|
||||
}
|
||||
|
||||
export interface ScanOptions {
|
||||
cameraDirection?: "back" | "front";
|
||||
formats?: Format[];
|
||||
windowed?: boolean;
|
||||
cameraDirection?: 'back' | 'front'
|
||||
formats?: Format[]
|
||||
windowed?: boolean
|
||||
}
|
||||
|
||||
export interface Scanned {
|
||||
content: string;
|
||||
format: Format;
|
||||
bounds: unknown;
|
||||
content: string
|
||||
format: Format
|
||||
bounds: unknown
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,14 +43,14 @@ export interface Scanned {
|
||||
* @param options
|
||||
*/
|
||||
export async function scan(options?: ScanOptions): Promise<Scanned> {
|
||||
return await invoke("plugin:barcode-scanner|scan", { ...options });
|
||||
return await invoke('plugin:barcode-scanner|scan', { ...options })
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel the current scan process.
|
||||
*/
|
||||
export async function cancel(): Promise<void> {
|
||||
await invoke("plugin:barcode-scanner|cancel");
|
||||
await invoke('plugin:barcode-scanner|cancel')
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -58,8 +58,8 @@ export async function cancel(): Promise<void> {
|
||||
*/
|
||||
export async function checkPermissions(): Promise<PermissionState> {
|
||||
return await checkPermissions_<{ camera: PermissionState }>(
|
||||
"barcode-scanner",
|
||||
).then((r) => r.camera);
|
||||
'barcode-scanner'
|
||||
).then((r) => r.camera)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,13 +67,13 @@ export async function checkPermissions(): Promise<PermissionState> {
|
||||
*/
|
||||
export async function requestPermissions(): Promise<PermissionState> {
|
||||
return await requestPermissions_<{ camera: PermissionState }>(
|
||||
"barcode-scanner",
|
||||
).then((r) => r.camera);
|
||||
'barcode-scanner'
|
||||
).then((r) => r.camera)
|
||||
}
|
||||
|
||||
/**
|
||||
* Open application settings. Useful if permission was denied and the user must manually enable it.
|
||||
*/
|
||||
export async function openAppSettings(): Promise<void> {
|
||||
await invoke("plugin:barcode-scanner|open_app_settings");
|
||||
await invoke('plugin:barcode-scanner|open_app_settings')
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
import { createConfig } from "../../shared/rollup.config.js";
|
||||
import { createConfig } from '../../shared/rollup.config.js'
|
||||
|
||||
export default createConfig();
|
||||
export default createConfig()
|
||||
|
||||
Reference in New Issue
Block a user