Skip to content

Commit

Permalink
chore: add changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
bcakmakoglu committed Oct 10, 2022
1 parent 13fed0a commit e1c28a2
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .changeset/six-dogs-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
'@vue-flow/core': patch
---

# What's changed?

- Simplify `useHandle` usage
- Pass props to the composable as possible refs
- Still returns onClick & onMouseDown handlers but only expects mouse event now

Before:
```vue
<script lang="ts" setup>
import { useHandle, NodeId } from '@vue-flow/core'
const nodeId = inject(NodeId)
const handleId = 'my-handle'
const type = 'source'
const isValidConnection = () => true
const { onMouseDown } = useHandle()
const onMouseDownHandler = (event: MouseEvent) => {
onMouseDown(event, handleId, nodeId, type === 'target', isValidConnection, undefined)
}
</script>
<template>
<div @mousedown="onMouseDownHandler" />
</template>
```

After:
```vue
<script lang="ts" setup>
import { useHandle, useNode } from '@vue-flow/core'
const { nodeId } = useNode()
const handleId = 'my-handle'
const type = 'source'
const isValidConnection = () => true
const { onMouseDown } = useHandle({
nodeId,
handleId,
isValidConnection,
type,
})
</script>
<template>
<div @mousedown="onMouseDown" />
</template>
```

0 comments on commit e1c28a2

Please sign in to comment.