@vue-flow/core
2.0.0
Major Changes
#689
127dfcc1Thanks @bcakmakoglu! - Remove experimental features flag#694
9fae40fbThanks @bcakmakoglu! - Update handle styles and avoid using fixed pixel positions to offset handle position and instead use transform to align handles
1.15.2
Patch Changes
#716
1685827dThanks @bcakmakoglu! - Fix umd pkg names and use the correct vue flow core umd pkg name in plugins#713
95b51a0eThanks @bcakmakoglu! - Prevent undefined being passed to updateNodeInternals#712
76256439Thanks @bcakmakoglu! - Fix resize-observer throwing when node el doesn't exist but effect is run#707
e8c383ffThanks @bcakmakoglu! - Fix nodes not using zIndex option#716
1685827dThanks @bcakmakoglu! - Prevent writingprocess.into umd buildenv #714
1fa4ee1bThanks @bcakmakoglu! - Wait until viewport helper is initialized before triggering viewport functions and pane ready event
1.15.1
Patch Changes
#704
b3462f2Thanks @bcakmakoglu! - Remove export ofSelectionPaneas the component doesn't exist anymore#703
0838d2cThanks @bcakmakoglu! - Downgrade auto imports. Fixes broken type imports.
1.15.0
Minor Changes
#684
a788cc0Thanks @bcakmakoglu! - Add option to enable/disable replacing edge id whenupdateEdgeaction is used#699
c1a7995Thanks @bcakmakoglu! - Omit internal properties when usingtoObject
Patch Changes
#667
231271aThanks @bcakmakoglu! - Prevent layout shift on initial render by hiding viewport until initial nodes have width/height#667
89198bdThanks @bcakmakoglu! - Remove Promises from viewport helper functions, will not await viewport anymore but instead return no-op functions if called too early#695
616e795Thanks @bcakmakoglu! - Use snapGrid values to clamp initial node positions
1.14.3
Patch Changes
#671
c47bc5ceThanks @bcakmakoglu! - Fit view on init is now triggered as soon as node dimensions are updated for the first time#682
b08cb4d4Thanks @bcakmakoglu! - Add compat mode to components to avoid breaking when used with @vue/compat03edd46cThanks @bcakmakoglu! - Allow depr. connectionLineType to be null03edd46cThanks @bcakmakoglu! - Add missing straight type to connection line options#680
70ae3410Thanks @bcakmakoglu! - Fix connections for handles that are bigger than the specified connection radius#680
70ae3410Thanks @bcakmakoglu! - Always emit edge update event03edd46cThanks @bcakmakoglu! - Fix connection line not rendering properly when destructuring slot props#681
d73995aaThanks @bcakmakoglu! - Setuser-select: nonefor edge labels#668
d39c63e5Thanks @bcakmakoglu! - Avoid re-rendering edges that have been deleted
1.14.2
Patch Changes
#663
05a3e26eThanks @bcakmakoglu! - Avoid triggering edge update when mouse button is not left#658
b8ad4458Thanks @bcakmakoglu! - WhenincludeHiddenNodesis false, exclude hidden nodes when using fitView#660
0dbabfc5Thanks @bcakmakoglu! - Use default values when defaultViewport vals are missing
1.14.1
Patch Changes
#655
3d958dfeThanks @bcakmakoglu! - Check if prev closest handle exists in pointer up handler#656
b3796a66Thanks @bcakmakoglu! - Store connectionStatus when using connection actions
1.14.0
Minor Changes
#654
99909f16Thanks @bcakmakoglu! - AddVueFlowErrorclass which is used when throwing#649
47bc8280Thanks @bcakmakoglu! - AddconnectionStatusto connection lines, which can be used to check if the connection line is used on a valid handle.
Patch Changes
#650
aaf46dc2Thanks @bcakmakoglu! - Addvalidandconnectingclass names instead ofvue-flow__handle-validandvue-flow__handle-connecting(old class names kept for backwards compatibility but will be removed in the future)#653
64e9dc3cThanks @bcakmakoglu! - Draw connection lines to opposite position#651
c0d172beThanks @bcakmakoglu! - When a node is not draggable, avoid dragging it when using a selection box#650
aaf46dc2Thanks @bcakmakoglu! - Fix ios connection error
1.13.2
Patch Changes
- #643
210b702bThanks @bcakmakoglu! - Properly access default edge options ref when passing options to theconnectevent
1.13.1
Patch Changes
- #641
f5eaa4ccThanks @bcakmakoglu! - Pass missing valid connection function params
1.13.0
Minor Changes
#639
ad2b09f1Thanks @bcakmakoglu! - Allow settingGraphNodeorGraphEdgetype with a generic type#629
c7cfcec7Thanks @bcakmakoglu! - AddconnectionRadiusoption to global options and handle props. You can use this option to set the radius at which a connection line will snap to the closest available handle.#613
7abd0bfdThanks @bcakmakoglu! - Export edge center utilsgetSimpleEdgeCenter&getBezierEdgeCenterfrom core#634
b59dd6a7Thanks @bcakmakoglu! - Add autopan options. Pans viewport on node drag and/or when drawing a connection line.Usage
useVueFlow({ autoPanOnNodeDrag: true, autoPanOnConnect: true, });<VueFlow v-model="elements" :autoPanOnNodeDrag="true" :autoPanOnConnect="true" />#636
e1628ec6Thanks @bcakmakoglu! - ExportisGraphNodeandisGraphEdgetypeguards
Patch Changes
- #634
b59dd6a7Thanks @bcakmakoglu! - Throw warning if viewport dimensions are 0
1.12.7
Patch Changes
- #627
19360c52Thanks @bcakmakoglu! - Hide node selection box when no selected nodes exist
1.12.6
Patch Changes
#624
0bddb524Thanks @bcakmakoglu! - Add warning when trying to duplicate an element or remove an element that does not exist#626
449a3f2aThanks @bcakmakoglu! - Removeextentoption fromsetNodes&addNodesaction. Extent should be passed to a node or set with the global option.#626
449a3f2aThanks @bcakmakoglu! - Use computed var to get current node inuseDrag. Fixes issue where overwriting a node breaks drag handler.
1.12.5
Patch Changes
#622
512eb176Thanks @bcakmakoglu! - If node extent is set to parent, wait until node is initialized to clamp position#622
512eb176Thanks @bcakmakoglu! - Regroup edges when nodes change and elevate edges on select is active#622
d79e2a42Thanks @bcakmakoglu! - Wait for parent node to be initialized before applying an initial expansion of the parent node#622
73de601fThanks @bcakmakoglu! - Pass initialized nodes in theonNodesInitializedhook
1.12.4
Patch Changes
#619
3d482b77Thanks @bcakmakoglu! - Use timeout when clamping positions after nodes' extent has changed#618
f1975ea7Thanks @bcakmakoglu! - Do not trigger ctx menu event on viewport when dragging with right mouse button
1.12.3
Patch Changes
#616
b16e3564Thanks @bcakmakoglu! - Upgrade to vite 4 & update deps#615
d8fe5432Thanks @bcakmakoglu! - Support key combinations for keycodes. Combinations can be passed using an array of keycodes and concatenated with a plus sign. For example:['A+B']will trigger when A and B are pressed at the same time.#614
580de340Thanks @bcakmakoglu! - Keep user selection on right click
1.12.2
Patch Changes
#610
01040099Thanks @bcakmakoglu! - Always handle keyup events, instead of cancelling when focusing an input dom node#611
8dbdcae2Thanks @bcakmakoglu! - Check if position is a number when updating, instead of checking if the value is truthy. Fixes 0 values not being used when updating.
1.12.1
Patch Changes
#607
45851080Thanks @bcakmakoglu! - Place default slot content outside of viewport element#605
e670f465Thanks @bcakmakoglu! - Let keydown event bubble up from node wrapper instead of preventing default
1.12.0
Minor Changes
- #600
072fd911Thanks @bcakmakoglu! - AddzIndexoption to nodes and edges. Allows defining stacking order of elements.
1.11.1
Patch Changes
- #597
749175b9Thanks @bcakmakoglu! - Addfocusandfocus-visiblestyles to avoid browser specific styles on default nodes
1.11.0
Minor Changes
- #595
0c784a2Thanks @bcakmakoglu! - Adddeletableoption to nodes and edges. If set to false it will prevent nodes and edges to be removed whenremoveNodesorremoveEdgesis triggered
Patch Changes
#593
da65c54Thanks @bcakmakoglu! - Prevent elements that have selectable disabled from being selected#590
89d2415Thanks @bcakmakoglu! - Skip updating positions whenupdateNodeInternalsis triggered - it will only update node dimensions (which can trigger a position update)#590
72f9f1aThanks @bcakmakoglu! - Use flush timingprefor NodeWrapper watchers
1.10.3
Patch Changes
- #586
c0f31a2Thanks @bcakmakoglu! - Check if element is still in state before attempting removal when applying removal changes
1.10.2
Patch Changes
#584
17cd5bcThanks @bcakmakoglu! - Set initial node position correctly after applying node extent#583
0c25796Thanks @bcakmakoglu! - Fix type exports using path alias instead of relative paths, which causes types to not be inferred on user-side
1.10.1
Patch Changes
- #581
ea5c35eThanks @bcakmakoglu! - Re-calculate position when node extent changes
1.10.0
Minor Changes
#579
b8d3241Thanks @bcakmakoglu! - Allow settingpaddingoption fornode.extent: 'parent'Padding can be a
number[]containing a maximum of 4 values. The values are applied in the same order as CSS padding: top, right, bottom, left. You can omit values at the end of the array, so[10, 20]is equivalent to[10, 20, 10, 20]etc.Usage
const nodes = ref([ { id: "4", label: "Node 4", position: { x: 320, y: 200 }, style: { backgroundColor: "rgba(255, 0, 0, 0.7)", width: "300px", height: "300px", }, }, { id: "4a", label: "Node 4a", position: { x: 15, y: 65 }, class: "light", extent: { range: "parent", // apply 10 px padding to all four sides padding: [10], }, parentNode: "4", }, ]);
Patch Changes
- #578
c0d9018Thanks @bcakmakoglu! - Allow omitting width and height style properties for parent nodes when usingexpandParenton child nodes
1.9.4
Patch Changes
#574
1160d3dThanks @bcakmakoglu! - Fix props being undefined on first render of custom node and edge components#574
1160d3dThanks @bcakmakoglu! - Removenodesproperty fromConnectionLineProps- usegetNodesinside the component instead ⚠️
1.9.3
Patch Changes
5402c0eThanks @bcakmakoglu! - Use correct aria live class names for vue-flow
1.9.2
Patch Changes
- #566
b324a06Thanks @bcakmakoglu! - Fix edge component prop types
1.9.1
Patch Changes
- #561
2979febThanks @bcakmakoglu! - Fix slots type regression
1.9.0
Minor Changes
#557
c7897a1Thanks @bcakmakoglu! - Allow customizing the controls of the viewport and the selection box.Props
selectionKeyCode: You can now set this toMaybeRef<boolean>to enable a selection box without extra button press (need to set:pan-on-drag="false"or:pan-on-drag="[2]"[RightClick]).panOnDrag: Can now be a boolean or a number[], this allows you to configure every mouse button as a drag button. [1, 2] would mean that you can drag via middle and right mouse button.panActivationKeyCode: Key code (or KeyFilter) for activating dragging (useful when using selectionOnDrag).selectionMode: You can choose if the selection box needs to contain a node fully (SelectionMode.Full) or partially (SelectionMode.Partial) to select.
Events
onSelectionStart: Emitted when the selection box is started.onSelectionEnd: Emitted when the selection box is ended.onViewportChangeStart: Emitted when viewport change has started.onViewportChange: Emitted when viewport is changed.onViewportChangeEnd: Emitted when viewport change has ended.
Patch Changes
#558
bac9893Thanks @bcakmakoglu! - ⚠️ Deprecate options API utilsaddEdgeandupdateEdge. These utils will be removed soon!Resolve deprecation warnings
Instead of using these utils, use
addEdgesandupdateEdgefound on the VueFlow store instance. You receive a store instance by using either a template-ref or listening to theonPaneReadyevent.Example
<script> import { VueFlow } from "@vue-flow/core"; export default defineComponent({ name: "OptionsAPIExample", components: { VueFlow }, data() { return { vueFlow: null, instance: null, elements: [ { id: "1", type: "input", label: "Node 1", position: { x: 250, y: 5 }, class: "light", }, { id: "2", label: "Node 2", position: { x: 100, y: 100 }, class: "light", }, { id: "3", label: "Node 3", position: { x: 400, y: 100 }, class: "light", }, { id: "4", label: "Node 4", position: { x: 400, y: 200 }, class: "light", }, { id: "e1-2", source: "1", target: "2", animated: true }, { id: "e1-3", source: "1", target: "3" }, ], }; }, methods: { // You can listen to `onPaneReady` to get the instance onPaneReady(instance) { instance.fitView(); this.instance = instance; }, onConnect(params) { // either use the instance you have saved in `onPaneReady` this.instance?.addEdges([params]); // or use the template-ref this.$refs.vueFlow?.addEdges([params]); }, }, }); </script> <template> <VueFlow v-model="elements" ref="vueFlow" class="vue-flow-basic-example" :default-zoom="1.5" :min-zoom="0.2" :max-zoom="4" :zoom-on-scroll="false" @connect="onConnect" @pane-ready="onPaneReady" /> </template>#557
c7897a1Thanks @bcakmakoglu! - Add a11y support to selection box
1.8.0
Minor Changes
#544
cf46cc8Thanks @bcakmakoglu! - Add keyboard controls to node wrapper (a11y)#554
9e7f65aThanks @bcakmakoglu! - MergedefaultZoom&defaultPositionintodefaultViewportobject#544
2341b9bThanks @bcakmakoglu! - AdddisableKeyboardA11yoption to VueFlow props and store options#544
2341b9bThanks @bcakmakoglu! - Addfocusableoption to edge types#544
2341b9bThanks @bcakmakoglu! - AddariaLabeloption to edge type#544
2341b9bThanks @bcakmakoglu! - AddedgesFocusableoption to store#544
cf46cc8Thanks @bcakmakoglu! - AddnodesFocusableoption to VueFlow props and store options#544
2341b9bThanks @bcakmakoglu! - AddpathOptionsto Bezier and Smoothstep edge types
Patch Changes
#544
cf46cc8Thanks @bcakmakoglu! - AddariaLabeloption to node type#554
545ab07Thanks @bcakmakoglu! - Clamp invalid zoom values#556
699d786Thanks @bcakmakoglu! - PreventexpandParentoption from changing parent nodes position while expanding#553
cd4e056Thanks @bcakmakoglu! - Renameviewpanetoviewport->ViewpaneTransformnowViewportTransform#544
cf46cc8Thanks @bcakmakoglu! - Addfocusableoption to node type#544
2341b9bThanks @bcakmakoglu! - AddvueFlowIdtogetMarkerIdto uniquely identify markers across multiple vue flow instances#544
2341b9bThanks @bcakmakoglu! - UpdateEdgeRefinjection type toSVGElement
A11y
This release brings A11y support to Vue Flow. All nodes and edges can now receive a focusable and ariaLabel prop, which can be used to enhance A11y experience. You can also enable focusable globally by using nodesFocusable or edgesFocusable. Additionally, nodes can be moved using keyboard controls (Arrow-Keys).
Props
disableKeyboardA11y: Use this prop to disable Keyboard controls on the graph.defaultViewport: The olddefaultZoomanddefaultPositionprops have been merged into a single object calleddefaultViewport.nodesFocusable: Globally enable that nodes can be focused.edgesFocusable: Globally enable that edges can be focused.
Elements
focusable: Enable focusing for a single node/edge by setting this option.ariaLabel: Specify an aria label for a node/edge
1.7.2
Patch Changes
#547
ccf10ffThanks @bcakmakoglu! - Make label coords (x,y) optional in BaseEdge#551
2f187a0Thanks @bcakmakoglu! - Fix input field focus inside nodes preventing selection rect to be created#550
b734d08Thanks @bcakmakoglu! - AddelevateNodesOnSelectoption to enable/disable increasing z-index of selected nodes#548
011f0edThanks @bcakmakoglu! - Re-group edges by z-index on edge selection changes
1.7.1
Patch Changes
#545
54c93b9Thanks @bcakmakoglu! - Remove immediate watch of VueFlow props and set prop values via state initalizer#545
54c93b9Thanks @bcakmakoglu! - Only trigger store watcher immediate when elements were set, otherwise wait for changes in store to overwrite model-value
1.7.0
Minor Changes
- #539
85d5a64dThanks @bcakmakoglu! - AddgetNodesInitializedgetter to store
Patch Changes
#539
85d5a64dThanks @bcakmakoglu! - MakesourceHandleandtargetHandleoptional properties forConnectiontype#542
530f286cThanks @bcakmakoglu! - Move watcher timing topreand sync immediately
1.6.4
Patch Changes
#536
fc231becThanks @bcakmakoglu! - Fix watcher not triggered when passing an empty array#537
4ec39fb0Thanks @bcakmakoglu! - Fix node resizer resizing not updating handle bounds
1.6.3
Patch Changes
#534
f0f7e7e4Thanks @bcakmakoglu! - Add missing edge class to edge wrapper#534
02c945e8Thanks @bcakmakoglu! - Pass attributes to edge components (i.e. style and class forwarded to BaseEdge)#532
cd778715Thanks @bcakmakoglu! - Usevue-flow__handlein handle bounds selector to avoid selecting elements with thesourceortargetclass names that aren't handles
1.6.2
Patch Changes
#529
92fe1022Thanks @bcakmakoglu! - Fix store watcher not being triggered whenaddNodesoraddEdgesis called#530
262bc42bThanks @bcakmakoglu! - Remove forced update on resize observer trigger of updateNodeDimensions
1.6.1
Patch Changes
#525
eae81603Thanks @bcakmakoglu! - Addinitializedprop toGraphNode#525
eae81603Thanks @bcakmakoglu! - Fix Handle component adding duplicate handlebounds when node is not properly initialized#526
00a9795aThanks @bcakmakoglu! - Remove console log
1.6.0
Minor Changes
#498
1739797cThanks @bcakmakoglu! - AdduseGetPointerPositioncomposable#519
306cd3daThanks @bcakmakoglu! - Move Panel component to core package
Patch Changes
#498
1739797cThanks @bcakmakoglu! - Makedraggingflag optional in position change type#498
1739797cThanks @bcakmakoglu! - Make dimensions optional in dimensions change type#521
f50644ffThanks @bcakmakoglu! - Remove Controls component styles from default theme#498
1739797cThanks @bcakmakoglu! - Adddragging,selectedandresizingflags toGraphNodetype#498
1739797cThanks @bcakmakoglu! - Allow multiple changes to be applied to element at once#519
e5829e8dThanks @bcakmakoglu! - Remove minimap styles from core package default-theme
1.5.11
Patch Changes
#517
440186d2Thanks @bcakmakoglu! - Add missingdraggingprop toGraphNodetype#515
639245b1Thanks @bcakmakoglu! - Remove console log from watcher
1.5.10
Patch Changes
1a4a2a62Thanks @bcakmakoglu! - Add missing dragging flag (release failed)
1.5.9
Patch Changes
ac8c2573Thanks @bcakmakoglu! - Add missing dragging flag to nodes
1.5.8
Patch Changes
#509
5b748a66Thanks @bcakmakoglu! - Fix handle prop connectable always falling back to true, even when explicitly set to false#511
88b0e34cThanks @bcakmakoglu! - Prevent store watcher from being stopped on cleanup of model watcher
1.5.7
Patch Changes
#501
ccff5b8bThanks @bcakmakoglu! - Fix watcher not triggering with theonMountedhook#506
7abc3956Thanks @bcakmakoglu! - Child nodes not properly using parent dimensions when extent is set toparent
1.5.6
Patch Changes
#497
50e59604Thanks @bcakmakoglu! - Separate store and model watchers from each other and allow them to be triggered after init#496
1ca8c2a9Thanks @bcakmakoglu! - Make nodes and edges deeply reactive objects, so that data changes can trigger v-model changes as well
1.5.5
Patch Changes
#494
50a24e4Thanks @bcakmakoglu! - Apply translateExtent on pan#492
715a070Thanks @bcakmakoglu! - Properly calculate node extent on drag#491
47ad11dThanks @bcakmakoglu! - Set dragging flag only if a position change happened
1.5.4
Patch Changes
#486
912da4dThanks @bcakmakoglu! - Prevent valid connections on same node and same handle#485
7ba6215Thanks @bcakmakoglu! - Allow middle mouse pan over edges#481
aed0845Thanks @bcakmakoglu! - AddHandleConnectableFunctype#483
9326c58Thanks @bcakmakoglu! - Remove barrel files and use auto-imports instead (internal change)#479
c673b04Thanks @bcakmakoglu! - TypemarkerEndandmarkerStartinEdgeProps
1.5.3
Patch Changes
- #474
9568794Thanks @bcakmakoglu! - Fix untyped connection line, node and edge slots props by patching type definition after build
1.5.2
Patch Changes
#466
051dcc4Thanks @bcakmakoglu! - usereactiveinstead ofshallowReactivefor nested node/edge properties#462
7dfceb2Thanks @bcakmakoglu! - Fix model watcher overwriting empty state when setting elementonMountedhook#465
c56ee5aThanks @bcakmakoglu! - Allownullas key-code
1.5.1
Patch Changes
#459
649bdb9Thanks @bcakmakoglu! - Add nullish check for node/edge events object to prevent err if undefined#454
fc15fa3Thanks @bcakmakoglu! - Update model-value regardless of element arr length
1.5.0
Minor Changes
#435
1cca3d0Thanks @bcakmakoglu! - Addconnectingclass toSelectionPanewhen connecting#451
6047b90Thanks @bcakmakoglu! - Support touch for creating connections#449
686b351Thanks @bcakmakoglu! - Add experimental support for nested Vue Flow components; Align edges by adding parent flow zoom scale. Connections not supported.
Patch Changes
#452
5303f10Thanks @bcakmakoglu! - Fix parent expand not working for top/left drag#449
686b351Thanks @bcakmakoglu! - AddexperimentalFeaturesflag to store
1.4.2
Patch Changes
#439
817884eThanks @bcakmakoglu! - Elevate selected nodes zIndex by 1000 instead to 1000#448
3a09339Thanks @bcakmakoglu! - Elevate child nodes by zIndex +1#447
06fc9f2Thanks @bcakmakoglu! - Fix initial node extent not applied
1.4.1
Patch Changes
#425
da0a294Thanks @bcakmakoglu! - Update deps#434
b24b9efThanks @bcakmakoglu! - Fix improper if clause when checking for selection key code as bool#429
1fc60bfThanks @bcakmakoglu! - When Connection Mode isLoose, use all handles as possible source handles for connection lines#433
d82cb67Thanks @bcakmakoglu! - Add missingconnectionExistsutility export
1.4.0
Minor Changes
- #360
a11edaeThanks @bcakmakoglu! - AddinteractionWidthprop to edges. Sets radius of pointer interactivity for edges
1.3.3
Patch Changes
- #412
630434dThanks @bcakmakoglu! - Use node name as class name
1.3.2
Patch Changes
#407
2874cd9Thanks @bcakmakoglu! - Prevent default edge options overwriting actual edge values#407
7908e02Thanks @bcakmakoglu! - Fall back to default edge or node type if custom type cannot be resolved#389
6e0dd5bThanks @bcakmakoglu! - Place Vue Flow Container in it's own stacking context
1.3.1
Patch Changes
#402
d7ade98Thanks @bcakmakoglu! - Useevent.composedPathas event target when checking for input dom nodes#403
8930d2eThanks @bcakmakoglu! - Stop reset of user-selection rect on mouse leave event#398
43953c9Thanks @bcakmakoglu! - Upgrade to vite 3
1.3.0
Minor Changes
#394
1403b65Thanks @bcakmakoglu! - AddnodesInitializedevent hook#387
9530290Thanks @bcakmakoglu! - Pass node intersections to node drag events (on single node drag)#387
a19b458Thanks @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
getIntersectingNodesto 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
isIntersectingutil 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
03412acThanks @bcakmakoglu! - Add zoomable and pannable to MiniMapUsage
- Set
zoomableandpannabletotrueinMiniMapcomponent to enable interactions with the MiniMap
<template> <VueFlow v-model="elements"> <MiniMap :zoomable="true" :pannable="true" /> </VueFlow> </template>- Set
Patch Changes
#361
43ff2a4Thanks @bcakmakoglu! - AddEdgeLabelRenderercomponent exportUsage
- You can use the
EdgeLabelRenderercomponent to render the label of an edge outside the SVG context of edges. - The
EdgeLabelRenderercomponent 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
76ad5838Thanks @bcakmakoglu! - Always set handle ids (using auto-generated id if none is passed)#388
ffe65636Thanks @bcakmakoglu! - skip connectable for handles unrelated to connected edges#392
fcffd492Thanks @bcakmakoglu! - Use all handles, regardless of type, when ConnectionMode isLoose
1.2.1
Patch Changes
#378
9089861cThanks @bcakmakoglu! - Disable user selection ifelementsSelectableis false#378
9089861cThanks @bcakmakoglu! - Prevent node selection box from appearing before mouseup#380
2c3ea836Thanks @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
3105bd0Thanks @bcakmakoglu! - Disable console warnings for production node-envs
1.1.4
Patch Changes
#353
8f95187Thanks @bcakmakoglu! - Allow undefined as custom theme var value#349
61d2b88Thanks @bcakmakoglu! - Node and Edge data and events to be definitely typed when passed as NodeProps or EdgeProps#352
bff576bThanks @bcakmakoglu! - Addoverflow: visibleto control btn svgs (fixes safari bug where svgs aren't showing up)#349
61d2b88Thanks @bcakmakoglu! - Extend Elements/FlowElements generics to differentiate between Node and Edge data and custom events#349
61d2b88Thanks @bcakmakoglu! - Add Generic to isNode and isEdge helpers#350
92a69a6Thanks @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
72c203eThanks @bcakmakoglu! - Fix edge text not calculating dimensions properly
1.1.2
Patch Changes
#337
12d9f79Thanks @bcakmakoglu! - Add dragging class to nodes ondraginstead ofdragStart#341
d2ed19eThanks @bcakmakoglu! - Pass edge styles to edge path element949d19fThanks @bcakmakoglu! - Fix edge texts not properly aligning to center#333
8583e13Thanks @bcakmakoglu! - Add missing dragging class to pane#336
1aaac25Thanks @bcakmakoglu! - Elements not properly unselected when clicking node and edge afterwards
1.1.1
Patch Changes
#328
1e5a77d6Thanks @bcakmakoglu! - Preventmouseuphandler from resettingstartHandlebefore connections can be made when usingconnectOnClick#328
18a812dbThanks @bcakmakoglu! - Passingsingleoption breaksconnectablecheck when no handle ids are set- Pass
connectableto correct handle prop in default node types
- Pass
#328
a415353bThanks @bcakmakoglu! - Adddraggingclass name to pane on drag
1.1.0
Minor Changes
#311
78f9ee1cThanks @bcakmakoglu! - # What's changed?- Add
HandleConnectabletype - Update
connectableprop ofHandletoHandleConnectabletype - 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.connectableprop 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
e175cf81Thanks @bcakmakoglu! - # What's changed?- Add
vueflowpkg 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
corepkg directory tocorefromvue-flow - Rename bundle outputs
- Add
#311
e1c28a26Thanks @bcakmakoglu! - # What's changed?- Simplify
useHandleusage - 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
08ad1735Thanks @bcakmakoglu! - # Bugfixes- Edges not returned by getter when
paneReadyevent is triggered
- Edges not returned by getter when
1.0.0
Major Changes
#305
939bff50Thanks @bcakmakoglu! - # What's changed?- Simplify edge path calculations
- remove
getEdgeCenterandgetSimpleEdgeCenter
- remove
Breaking Changes
getEdgeCenterhas been removed- Edge center positions can now be accessed from
getBezierPathorgetSmoothStepPathfunctions
- 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
47d837aaThanks @bcakmakoglu! - # What's changed?- Change pkg scope from 'braks' to 'vue-flow'
- Add
@vue-flow/corepackage - Add
@vue-flow/additional-componentspackage - Add
@vue-flow/pathfinding-edgepackage - Add
@vue-flow/resize-rotate-nodepackage
- Add
Features
useNodeanduseEdgecomposables- 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)
selectionKeyCodeastrue- 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
updateNodeInternalson dynamic handles
- Testing for various features using Cypress 10
Bugfixes
- Fix
removeSelectedEdgesandremoveSelectedNodesactions not properly removing elements from store
Breaking Changes
@vue-flow/corepackage is now required to use vue-flow@vue-flow/additional-componentspackage containsBackground,MiniMapandControlscomponents 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'