snapshot of https://github.com/tauri-apps/plugins-workspace.git (v2, 2026-09-23; blobs > 131072B omitted)
Some checks failed
integration tests / run-integration-tests (windows-latest) (push) Has been cancelled
Test Rust / test (push) Has been cancelled
test plugins e2e (mobile) / ios (push) Has been cancelled
test plugins e2e / test (map[name:Windows os:windows-latest]) (push) Has been cancelled
test plugins e2e / test (map[name:macOS os:macos-latest]) (push) Has been cancelled
integration tests / run-integration-tests (macos-latest) (push) Has been cancelled
version or publish / version-or-publish (push) Failing after 0s
integration tests / run-integration-tests (ubuntu-22.04) (push) Failing after 0s
Lint JavaScript / eslint (push) Failing after 0s
Sync / sync-to-mirrors (push) Failing after 0s
test plugins e2e (mobile) / android (push) Failing after 0s
test plugins e2e / test (map[name:Linux os:ubuntu-latest]) (push) Failing after 0s
Test Rust / changes (push) Failing after 0s
Lint Rust / changes (push) Failing after 0s
Lint Rust / clippy (push) Has been skipped
Audit Rust / audit-rust (push) Failing after 1s
Audit JavaScript / audit-js (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-23 17:17:10 +05:00
commit 9ad64ec987
1469 changed files with 115067 additions and 0 deletions

View File

@@ -0,0 +1,154 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
// @ts-nocheck
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
/** user-defined commands **/
export const commands = {
async vibrate(duration: number): Promise<Result<null, Error>> {
try {
return {
status: 'ok',
data: await TAURI_INVOKE('plugin:haptics|vibrate', { duration })
}
} catch (e) {
if (e instanceof Error) throw e
else return { status: 'error', error: e as any }
}
},
async impactFeedback(
style: ImpactFeedbackStyle
): Promise<Result<null, Error>> {
try {
return {
status: 'ok',
data: await TAURI_INVOKE('plugin:haptics|impact_feedback', { style })
}
} catch (e) {
if (e instanceof Error) throw e
else return { status: 'error', error: e as any }
}
},
async notificationFeedback(
type: NotificationFeedbackType
): Promise<Result<null, Error>> {
try {
return {
status: 'ok',
data: await TAURI_INVOKE('plugin:haptics|notification_feedback', {
type
})
}
} catch (e) {
if (e instanceof Error) throw e
else return { status: 'error', error: e as any }
}
},
async selectionFeedback(): Promise<Result<null, Error>> {
try {
return {
status: 'ok',
data: await TAURI_INVOKE('plugin:haptics|selection_feedback')
}
} catch (e) {
if (e instanceof Error) throw e
else return { status: 'error', error: e as any }
}
}
}
/** user-defined events **/
/* export const events = __makeEvents__<{
randomNumber: RandomNumber;
}>({
randomNumber: "plugin:haptics:random-number",
}); */
/** user-defined statics **/
/** user-defined types **/
export type Error = never
/**
* The style of an impact-feedback haptic.
*
* On iOS this maps directly to a `UIImpactFeedbackGenerator.FeedbackStyle` case. On Android,
* which has no equivalent system API, each style instead plays a distinct vibration waveform of
* increasing intensity. Has no effect on desktop platforms. Defaults to `Medium`.
*/
export type ImpactFeedbackStyle =
| 'light'
| 'medium'
| 'heavy'
| 'soft'
| 'rigid'
/**
* The type of notification feedback, indicating the outcome of a task or action.
*
* On iOS this maps directly to a `UINotificationFeedbackGenerator.FeedbackType` case. On
* Android, which has no equivalent system API, each type instead plays a distinct vibration
* waveform. Has no effect on desktop platforms. Defaults to `Success`.
*/
export type NotificationFeedbackType = 'success' | 'warning' | 'error'
//export type RandomNumber = number;
/** tauri-specta globals **/
import { invoke as TAURI_INVOKE } from '@tauri-apps/api/core'
import * as TAURI_API_EVENT from '@tauri-apps/api/event'
import { type WebviewWindow as __WebviewWindow__ } from '@tauri-apps/api/webviewWindow'
type __EventObj__<T> = {
listen: (
cb: TAURI_API_EVENT.EventCallback<T>
) => ReturnType<typeof TAURI_API_EVENT.listen<T>>
once: (
cb: TAURI_API_EVENT.EventCallback<T>
) => ReturnType<typeof TAURI_API_EVENT.once<T>>
emit: T extends null
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
: (payload: T) => ReturnType<typeof TAURI_API_EVENT.emit>
}
export type Result<T, E> =
| { status: 'ok'; data: T }
| { status: 'error'; error: E }
function __makeEvents__<T extends Record<string, any>>(
mappings: Record<keyof T, string>
) {
return new Proxy(
{} as unknown as {
[K in keyof T]: __EventObj__<T[K]> & {
(handle: __WebviewWindow__): __EventObj__<T[K]>
}
},
{
get: (_, event) => {
const name = mappings[event as keyof T]
return new Proxy((() => {}) as any, {
apply: (_, __, [window]: [__WebviewWindow__]) => ({
listen: (arg: any) => window.listen(name, arg),
once: (arg: any) => window.once(name, arg),
emit: (arg: any) => window.emit(name, arg)
}),
get: (_, command: keyof __EventObj__<any>) => {
switch (command) {
case 'listen':
return (arg: any) => TAURI_API_EVENT.listen(name, arg)
case 'once':
return (arg: any) => TAURI_API_EVENT.once(name, arg)
case 'emit':
return (arg: any) => TAURI_API_EVENT.emit(name, arg)
}
}
})
}
}
)
}

View File

@@ -0,0 +1,104 @@
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
/**
* Trigger haptic feedback on Android and iOS.
*
* @module
*/
import { commands } from './bindings'
import type {
ImpactFeedbackStyle,
NotificationFeedbackType,
Result,
Error
} from './bindings'
/**
* Triggers a vibration for `duration` milliseconds.
*
* Has no effect on desktop platforms.
*
* @example
* ```typescript
* import { vibrate } from '@tauri-apps/plugin-haptics'
* await vibrate(300)
* ```
*
* @param duration Duration of the vibration, in milliseconds.
* @returns A promise resolving to the {@link Result} of the operation.
* @since 2.0.0
*/
export async function vibrate(duration: number): Promise<Result<null, Error>> {
return commands.vibrate(duration)
}
/**
* Triggers an impact-feedback haptic, indicating a collision between user interface elements.
*
* On iOS this maps to a `UIImpactFeedbackGenerator` of the given style. On Android, which has
* no equivalent system API, each style plays a distinct vibration waveform. Has no effect on
* desktop platforms.
*
* @example
* ```typescript
* import { impactFeedback } from '@tauri-apps/plugin-haptics'
* await impactFeedback('medium')
* ```
*
* @param style The style of the impact.
* @returns A promise resolving to the {@link Result} of the operation.
* @since 2.0.0
*/
export async function impactFeedback(
style: ImpactFeedbackStyle
): Promise<Result<null, Error>> {
return commands.impactFeedback(style)
}
/**
* Triggers a notification-feedback haptic, indicating the outcome of a task or action.
*
* On iOS this maps to a `UINotificationFeedbackGenerator` of the given type. On Android, which
* has no equivalent system API, each type plays a distinct vibration waveform. Has no effect on
* desktop platforms.
*
* @example
* ```typescript
* import { notificationFeedback } from '@tauri-apps/plugin-haptics'
* await notificationFeedback('success')
* ```
*
* @param type The outcome to convey.
* @returns A promise resolving to the {@link Result} of the operation.
* @since 2.0.0
*/
export async function notificationFeedback(
type: NotificationFeedbackType
): Promise<Result<null, Error>> {
return commands.notificationFeedback(type)
}
/**
* Triggers a haptic indicating that a selection changed, e.g. the value of a picker control.
*
* Has no effect on desktop platforms.
*
* @example
* ```typescript
* import { selectionFeedback } from '@tauri-apps/plugin-haptics'
* await selectionFeedback()
* ```
*
* @returns A promise resolving to the {@link Result} of the operation.
* @since 2.0.0
*/
export async function selectionFeedback(): Promise<Result<null, Error>> {
return commands.selectionFeedback()
}
export { ImpactFeedbackStyle, NotificationFeedbackType } from './bindings'
// export { events };