Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
76 lines
1.5 KiB
Markdown
76 lines
1.5 KiB
Markdown
---
|
|
category: Sensors
|
|
---
|
|
|
|
# useSwipe
|
|
|
|
Reactive swipe detection based on [`TouchEvents`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent).
|
|
|
|
## Usage
|
|
|
|
```vue
|
|
<script setup lang="ts">
|
|
import { useSwipe } from '@vueuse/core'
|
|
import { useTemplateRef } from 'vue'
|
|
|
|
const el = useTemplateRef('el')
|
|
const { isSwiping, direction } = useSwipe(el)
|
|
</script>
|
|
|
|
<template>
|
|
<div ref="el">
|
|
Swipe here
|
|
</div>
|
|
</template>
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export type UseSwipeDirection = "up" | "down" | "left" | "right" | "none"
|
|
export interface UseSwipeOptions extends ConfigurableWindow {
|
|
/**
|
|
* Register events as passive
|
|
*
|
|
* @default true
|
|
*/
|
|
passive?: boolean
|
|
/**
|
|
* @default 50
|
|
*/
|
|
threshold?: number
|
|
/**
|
|
* Callback on swipe start
|
|
*/
|
|
onSwipeStart?: (e: TouchEvent) => void
|
|
/**
|
|
* Callback on swipe moves
|
|
*/
|
|
onSwipe?: (e: TouchEvent) => void
|
|
/**
|
|
* Callback on swipe ends
|
|
*/
|
|
onSwipeEnd?: (e: TouchEvent, direction: UseSwipeDirection) => void
|
|
}
|
|
export interface UseSwipeReturn {
|
|
isSwiping: ShallowRef<boolean>
|
|
direction: ComputedRef<UseSwipeDirection>
|
|
coordsStart: Readonly<Position>
|
|
coordsEnd: Readonly<Position>
|
|
lengthX: ComputedRef<number>
|
|
lengthY: ComputedRef<number>
|
|
stop: () => void
|
|
}
|
|
/**
|
|
* Reactive swipe detection.
|
|
*
|
|
* @see https://vueuse.org/useSwipe
|
|
* @param target
|
|
* @param options
|
|
*/
|
|
export declare function useSwipe(
|
|
target: MaybeRefOrGetter<EventTarget | null | undefined>,
|
|
options?: UseSwipeOptions,
|
|
): UseSwipeReturn
|
|
```
|