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>
81 lines
1.6 KiB
Markdown
81 lines
1.6 KiB
Markdown
---
|
|
category: Sensors
|
|
---
|
|
|
|
# usePointerSwipe
|
|
|
|
Reactive swipe detection based on [PointerEvents](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent).
|
|
|
|
## Usage
|
|
|
|
```vue
|
|
<script setup lang="ts">
|
|
import { usePointerSwipe } from '@vueuse/core'
|
|
import { useTemplateRef } from 'vue'
|
|
|
|
const el = useTemplateRef('el')
|
|
const { isSwiping, direction } = usePointerSwipe(el)
|
|
</script>
|
|
|
|
<template>
|
|
<div ref="el">
|
|
Swipe here
|
|
</div>
|
|
</template>
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export interface UsePointerSwipeOptions {
|
|
/**
|
|
* @default 50
|
|
*/
|
|
threshold?: number
|
|
/**
|
|
* Callback on swipe start.
|
|
*/
|
|
onSwipeStart?: (e: PointerEvent) => void
|
|
/**
|
|
* Callback on swipe move.
|
|
*/
|
|
onSwipe?: (e: PointerEvent) => void
|
|
/**
|
|
* Callback on swipe end.
|
|
*/
|
|
onSwipeEnd?: (e: PointerEvent, direction: UseSwipeDirection) => void
|
|
/**
|
|
* Pointer types to listen to.
|
|
*
|
|
* @default ['mouse', 'touch', 'pen']
|
|
*/
|
|
pointerTypes?: PointerType[]
|
|
/**
|
|
* Disable text selection on swipe.
|
|
*
|
|
* @default false
|
|
*/
|
|
disableTextSelect?: boolean
|
|
}
|
|
export interface UsePointerSwipeReturn {
|
|
readonly isSwiping: ShallowRef<boolean>
|
|
direction: Readonly<ShallowRef<UseSwipeDirection>>
|
|
readonly posStart: Position
|
|
readonly posEnd: Position
|
|
distanceX: Readonly<ComputedRef<number>>
|
|
distanceY: Readonly<ComputedRef<number>>
|
|
stop: () => void
|
|
}
|
|
/**
|
|
* Reactive swipe detection based on PointerEvents.
|
|
*
|
|
* @see https://vueuse.org/usePointerSwipe
|
|
* @param target
|
|
* @param options
|
|
*/
|
|
export declare function usePointerSwipe(
|
|
target: MaybeRefOrGetter<HTMLElement | null | undefined>,
|
|
options?: UsePointerSwipeOptions,
|
|
): UsePointerSwipeReturn
|
|
```
|