mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-06-06 13:53:54 +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:
@@ -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')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user