Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useDrauu.md
1---2category: '@Integrations'3---45# useDrauu67Reactive instance for [drauu](https://github.com/antfu/drauu).89## Install1011```bash12npm i drauu@^013```1415## Usage1617```vue18<script setup lang="ts">19import { toRefs } from '@vueuse/core'20import { useDrauu } from '@vueuse/integrations/useDrauu'21import { useTemplateRef } from 'vue'2223const target = useTemplateRef('target')24const { undo, redo, canUndo, canRedo, brush } = useDrauu(target)25const { color, size } = toRefs(brush)26</script>2728<template>29<svg ref="target" />30</template>31```3233## Type Declarations3435```ts36export type UseDrauuOptions = Omit<Options, "el">37export interface UseDrauuReturn {38drauuInstance: Ref<Drauu | undefined>39load: (svg: string) => void40dump: () => string | undefined41clear: () => void42cancel: () => void43undo: () => boolean | undefined44redo: () => boolean | undefined45canUndo: ShallowRef<boolean>46canRedo: ShallowRef<boolean>47brush: Ref<Brush>48onChanged: EventHookOn49onCommitted: EventHookOn50onStart: EventHookOn51onEnd: EventHookOn52onCanceled: EventHookOn53}54/**55* Reactive drauu56*57* @see https://vueuse.org/useDrauu58* @param target The target svg element59* @param options Drauu Options60*/61export declare function useDrauu(62target: MaybeComputedElementRef,63options?: UseDrauuOptions,64): UseDrauuReturn65```66