@vue-flow/core
1.4.1
Patch Changes
#425
da0a294
Thanks @bcakmakoglu! - Update deps#434
b24b9ef
Thanks @bcakmakoglu! - Fix improper if clause when checking for selection key code as bool#429
1fc60bf
Thanks @bcakmakoglu! - When Connection Mode isLoose
, use all handles as possible source handles for connection lines#433
d82cb67
Thanks @bcakmakoglu! - Add missingconnectionExists
utility export
1.4.0
Minor Changes
- #360
a11edae
Thanks @bcakmakoglu! - AddinteractionWidth
prop to edges. Sets radius of pointer interactivity for edges
1.3.3
Patch Changes
- #412
630434d
Thanks @bcakmakoglu! - Use node name as class name
1.3.2
Patch Changes
#407
2874cd9
Thanks @bcakmakoglu! - Prevent default edge options overwriting actual edge values#407
7908e02
Thanks @bcakmakoglu! - Fall back to default edge or node type if custom type cannot be resolved#389
6e0dd5b
Thanks @bcakmakoglu! - Place Vue Flow Container in it's own stacking context
1.3.1
Patch Changes
#402
d7ade98
Thanks @bcakmakoglu! - Useevent.composedPath
as event target when checking for input dom nodes#403
8930d2e
Thanks @bcakmakoglu! - Stop reset of user-selection rect on mouse leave event#398
43953c9
Thanks @bcakmakoglu! - Upgrade to vite 3
1.3.0
Minor Changes
#394
1403b65
Thanks @bcakmakoglu! - AddnodesInitialized
event hook#387
9530290
Thanks @bcakmakoglu! - Pass node intersections to node drag events (on single node drag)#387
a19b458
Thanks @bcakmakoglu! - Add intersection utils to help with checking if a node intersects with either other nodes or a given areaUsage
- You can either use the action
getIntersectingNodes
to find all nodes that intersect with a given node
const { onNodeDrag, getIntersectingNodes, getNodes } = useVueFlow() onNodeDrag(({ node }) => { const intersections = getIntersectingNodes(node).map((n) => n.id) getNodes.value.forEach((n) => { // highlight nodes that are intersecting with the dragged node n.class = intersections.includes(n.id) ? 'highlight' : '' }) })
- Node drag events will provide you with the intersecting nodes without having to call the action explicitly.
onNodeDrag(({ intersections }) => { getNodes.value.forEach((n) => { n.class = intersections?.some((i) => i.id === n.id) ? 'highlight' : '' }) })
- Or you can use the
isIntersecting
util to check if a node intersects with a given area
const { onNodeDrag, isNodeIntersecting } = useVueFlow() onNodeDrag(({ node }) => { // highlight the node if it is intersecting with the given area node.class = isNodeIntersecting(node, { x: 0, y: 0, width: 100, height: 100 }) ? 'highlight' : '' })
- You can either use the action
#396
03412ac
Thanks @bcakmakoglu! - Add zoomable and pannable to MiniMapUsage
- Set
zoomable
andpannable
totrue
inMiniMap
component to enable interactions with the MiniMap
<template> <VueFlow v-model="elements"> <MiniMap :zoomable="true" :pannable="true" /> </VueFlow> </template>
- Set
Patch Changes
#361
43ff2a4
Thanks @bcakmakoglu! - AddEdgeLabelRenderer
component exportUsage
- You can use the
EdgeLabelRenderer
component to render the label of an edge outside the SVG context of edges. - The
EdgeLabelRenderer
component is a component that handles teleporting your edge label into a HTML context - This is useful if you want to use HTML elements in your edge label, like buttons
<script lang="ts" setup> import type { EdgeProps, Position } from '@vue-flow/core' import { EdgeLabelRenderer, getBezierPath, useVueFlow } from '@vue-flow/core' import type { CSSProperties } from 'vue' interface CustomEdgeProps<T = any> extends EdgeProps<T> { id: string sourceX: number sourceY: number targetX: number targetY: number sourcePosition: Position targetPosition: Position data: T markerEnd: string style: CSSProperties } const props = defineProps<CustomEdgeProps>() const { removeEdges } = useVueFlow() const path = $computed(() => getBezierPath(props)) </script> <script lang="ts"> export default { inheritAttrs: false, } </script> <template> <path :id="id" :style="style" class="vue-flow__edge-path" :d="path[0]" :marker-end="markerEnd" /> <EdgeLabelRenderer> <div :style="{ pointerEvents: 'all', position: 'absolute', transform: `translate(-50%, -50%) translate(${path[1]}px,${path[2]}px)`, }" class="nodrag nopan" > <button class="edgebutton" @click="removeEdges([id])">×</button> </div> </EdgeLabelRenderer> </template> <style> .edgebutton { border-radius: 999px; cursor: pointer; } .edgebutton:hover { box-shadow: 0 0 0 2px pink, 0 0 0 4px #f05f75; } </style>
- You can use the
1.2.2
Patch Changes
#388
76ad5838
Thanks @bcakmakoglu! - Always set handle ids (using auto-generated id if none is passed)#388
ffe65636
Thanks @bcakmakoglu! - skip connectable for handles unrelated to connected edges#392
fcffd492
Thanks @bcakmakoglu! - Use all handles, regardless of type, when ConnectionMode isLoose
1.2.1
Patch Changes
#378
9089861c
Thanks @bcakmakoglu! - Disable user selection ifelementsSelectable
is false#378
9089861c
Thanks @bcakmakoglu! - Prevent node selection box from appearing before mouseup#380
2c3ea836
Thanks @bcakmakoglu! - Use shallowRef for node/edge data and event objects so they trigger a re-render on custom nodes/edges
1.2.0
Minor Changes
- #123
3105bd0
Thanks @bcakmakoglu! - Disable console warnings for production node-envs
1.1.4
Patch Changes
#353
8f95187
Thanks @bcakmakoglu! - Allow undefined as custom theme var value#349
61d2b88
Thanks @bcakmakoglu! - Node and Edge data and events to be definitely typed when passed as NodeProps or EdgeProps#352
bff576b
Thanks @bcakmakoglu! - Addoverflow: visible
to control btn svgs (fixes safari bug where svgs aren't showing up)#349
61d2b88
Thanks @bcakmakoglu! - Extend Elements/FlowElements generics to differentiate between Node and Edge data and custom events#349
61d2b88
Thanks @bcakmakoglu! - Add Generic to isNode and isEdge helpers#350
92a69a6
Thanks @bcakmakoglu! - Set nodes' dragging prop on drag start and end (fixes grabbing hand not showing on mousedown / not disappearing on mouseup)
1.1.3
Patch Changes
- #342
72c203e
Thanks @bcakmakoglu! - Fix edge text not calculating dimensions properly
1.1.2
Patch Changes
#337
12d9f79
Thanks @bcakmakoglu! - Add dragging class to nodes ondrag
instead ofdragStart
#341
d2ed19e
Thanks @bcakmakoglu! - Pass edge styles to edge path element949d19f
Thanks @bcakmakoglu! - Fix edge texts not properly aligning to center#333
8583e13
Thanks @bcakmakoglu! - Add missing dragging class to pane#336
1aaac25
Thanks @bcakmakoglu! - Elements not properly unselected when clicking node and edge afterwards
1.1.1
Patch Changes
#328
1e5a77d6
Thanks @bcakmakoglu! - Preventmouseup
handler from resettingstartHandle
before connections can be made when usingconnectOnClick
#328
18a812db
Thanks @bcakmakoglu! - Passingsingle
option breaksconnectable
check when no handle ids are set- Pass
connectable
to correct handle prop in default node types
- Pass
#328
a415353b
Thanks @bcakmakoglu! - Adddragging
class name to pane on drag
1.1.0
Minor Changes
#311
78f9ee1c
Thanks @bcakmakoglu! - # What's changed?- Add
HandleConnectable
type - Update
connectable
prop ofHandle
toHandleConnectable
type - Allow to specify if Handles are connectable
- any number of connections
- none
- single connection
- or a cb to determine whether the Handle is connectable
Example:
<script lang="ts" setup> import { Handle, HandleConnectable } from '@vue-flow/core' const handleConnectable: HandleConnectable = (node, connectedEdges) => { console.log(node, connectedEdges) return true } </script> <template> <!-- single connection --> <Handle type="target" position="left" connectable="single" /> <div>Custom Node</div> <!-- cb --> <Handle id="a" position="right" :connectable="handleConnectable" /> </template>
- Update
node.connectable
prop toHandleConnectable
For Example:
const nodes = ref([ { id: '1', position: { x: 0, y: 0 }, connectable: 'single', // each handle is only connectable once (default node for example) }, { id: '2', position: { x: 200, y: 0 }, connectable: (node, connectedEdges) => { return true // will allow any number of connections }, }, { id: '3', position: { x: 400, y: 0 }, connectable: true, // will allow any number of connections }, { id: '4', position: { x: 200, y: 0 }, connectable: false, // will disable handles }, ])
- Add
Patch Changes
#311
e175cf81
Thanks @bcakmakoglu! - # What's changed?- Add
vueflow
pkg that exports all features
<script setup> // `vueflow` pkg exports all features, i.e. core + additional components import { VueFlow, Background, MiniMap, Controls } from 'vueflow' </script> <template> <VueFlow> <Background /> <MiniMap /> <Controls /> </VueFlow> </template>
Chores
- Rename
core
pkg directory tocore
fromvue-flow
- Rename bundle outputs
- Add
#311
e1c28a26
Thanks @bcakmakoglu! - # 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:
<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:
<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>
- Simplify
#311
08ad1735
Thanks @bcakmakoglu! - # Bugfixes- Edges not returned by getter when
paneReady
event is triggered
- Edges not returned by getter when
1.0.0
Major Changes
#305
939bff50
Thanks @bcakmakoglu! - # What's changed?- Simplify edge path calculations
- remove
getEdgeCenter
andgetSimpleEdgeCenter
- remove
Breaking Changes
getEdgeCenter
has been removed- Edge center positions can now be accessed from
getBezierPath
orgetSmoothStepPath
functions
- Edge center positions can now be accessed from
Before:
import { getBezierPath, getEdgeCenter } from '@braks/vue-flow' // used to return the path string only const edgePath = computed(() => getBezierPath(pathParams)) // was necessary to get the centerX, centerY of an edge const centered = computed(() => getEdgeCenter(centerParams))
After:
import { getBezierPath } from '@vue-flow/core' // returns the path string and the center positions const [path, centerX, centerY] = computed(() => getBezierPath(pathParams))
- Simplify edge path calculations
#305
47d837aa
Thanks @bcakmakoglu! - # What's changed?- Change pkg scope from 'braks' to 'vue-flow'
- Add
@vue-flow/core
package - Add
@vue-flow/additional-components
package - Add
@vue-flow/pathfinding-edge
package - Add
@vue-flow/resize-rotate-node
package
- Add
Features
useNode
anduseEdge
composables- can be used to access current node/edge (or by id) and their respective element refs (if used inside the elements' context, i.e. a custom node/edge)
selectionKeyCode
astrue
- allows for figma style selection (i.e. create a selection rect without holding shift or any other key)
- Handles to trigger handle bounds calculation on mount
- if no handle bounds are found, a Handle will try to calculate its bounds on mount
- should remove the need for
updateNodeInternals
on dynamic handles
- Testing for various features using Cypress 10
Bugfixes
- Fix
removeSelectedEdges
andremoveSelectedNodes
actions not properly removing elements from store
Breaking Changes
@vue-flow/core
package is now required to use vue-flow@vue-flow/additional-components
package containsBackground
,MiniMap
andControls
components and related types- When switching to the new pkg scope, you need to change the import path.
Before:
import { VueFlow, Background, MiniMap, Controls } from '@braks/vue-flow'
After
import { VueFlow } from '@vue-flow/core' import { Background, MiniMap, Controls } from '@vue-flow/additional-components'
- Change pkg scope from 'braks' to 'vue-flow'