- add
getNode
,getNodes
,getEdge
andgetEdges
touseSvelteFlow
- add
useInitialized
/useNNodesInitialized
hooks andoninit
handler
- selection box is not interrupted by selectionKey being let go
- Edge label has a default background and is clickable
- do not use fallback handle if a specific id is being used
- use correct id for
<Handle />
data-id attribute - fix
getNodesBounds
and add second param for passing options
- add second option param to
screenToFlowPosition
for configuring ifsnapToGrid
should be used - add slot to
Controls
- cleanup
ControlButton
types - infer types for
getIncomers
,getOutgoers
,updateEdge
,addEdge
andgetConnectedEdges
thanks @joeyballentine - refactor handles: prefix with flow id for handling nested flows
- add comments for types like
SvelteFlowProps
orNode
for a better developer experience
- fix
deleteElements
- fix dragging when
draggable=false
- add
ariaLabel
prop for<Controls />
deleteElements
function now takes one object as an argument{ nodes: [], edges: [] }
instead of two(nodes, edges)
- add
NodeResizer
andNodeResizeControl
components for resizing nodes
- fix edge rendering
- add
onbeforedelete
handler to prevent/ manage deletions - TSDocs for hooks and some types
- new nodeDragThreshold default is 1
- refactor/simplify edge rendering
Another huge update for Svelte Flow 🙏 Handling data flows will be way easier with the new hooks and functions. You can now subscribe to connected nodes, receive data and update nodes more easily. We fix a big issue about the <Handle />
component. No more on:connect
that only worked for target <Handle />
components but onconnect
and ondisconnect
that works for every <Handle />
.
- add
useHandleConnections
hook for receiving connected node and handle ids for a specific handle - add
useNodesData(ids: string | string[])
hook for receiving data from other nodes - export
updateNode
andupdateNodeData
fromuseSvelteFlow
to update a node or the data object - add
onedgecreate
function for passing a certain id or other attributes to a newly created edge
- replace
on:connect
,on:connectstart
andon:connectend
withonconnect
,onconnectstart
andonconnectend
, no need to forwardon:connect..
anymore
onconnect
andondisconnect
callback work for<Handle />
component- don't delete a node when user presses Backspace inside an input/textarea/.nokey element
bgColor
prop for Background didn't work- prefix css vars with "xy-"
- don't update nodes and edges on pane click if not necessary
- cleaner types for exported edges
- fix
getIntersectingNodes
bug when passingRect
This is a huge update! We added a new <NodeToolbar />
component and a new colorMode
('light' | 'dark' | 'system') prop for toggling dark/light mode.
There are also some breaking changes again (sorry!) but we are very close to the final API for Svelte Flow 1.0.0. The biggest change is that we group node attriubutes (width
, height
, positionAbsolute
) that are added by the library under node.computed
. This makes it easier to understand, that this stuff comes from the library itself. node.width
and node.height
is still an optional node option and can be used to set certain dimensions for SSR or on the client.
- add
<NodeToolbar />
component - add
on:selectionclick
andon:selectioncontextmenu
event handlers - add
ondelete({ nodes, edges })
handler - add
zoomActivationKey
prop - add
width
andheight
prop to customNodeProps
type - add
colorMode
prop ('light' | 'dark' | 'system') ⚠️ replacexPos
andyPos
withpositionAbsolute
prop to customNodeProps
type⚠️ node.width/height
andnode.positionAbsolute
can now be found undernode.computed.width/height/positionAbsolute
⚠️ node.width/height
is still optional an can be used for forcing certain dimensions and SSR- refactor keys: you can now disable keys by setting them to
null
(e.g.selectionKey={null}
) - performance optimization with internal node lookup
- add
selectionOnDrag
prop - can be used to create figma-like controls in combination withpanOnDrag={false}
/panOnDrag={[1, 2]}
+panOnScroll={true}
⚠️ renamescreenToFlowCoordinate
toscreenToFlowPosition
⚠️ renameflowToScreenCoordinate
toflowToScreenPosition
⚠️ renamegetTransformForBounds
togetViewportForBounds
(return{ x: number, y: number, zoom: number }
instead of[number, number, number]
)⚠️ renamegetRectOfNodes
togetNodesBounds
- simplify handle default styles, so that it's easier to override them
- added e2e tests
- fixes broken version on npm
- add
toObject
touseSvelteFlow
hook - export
BezierEdge
,StepEdge
andSmoothStepEdge
components - handle window resize (Minimap updates its viewport)
- fix wrongly selected nodes
- fix connection line z-index
- fix broken edges (
interactionWidth
was missing)
- update node automatically when
type
,sourcePosition
ortargetPosition
option changes - prevent dev tool warnings when using built-in node types
- updates
useSvelteFlow
hook: - add node type "group"
- add
class
prop for BaseEdge - add
id
prop for Background - add
selected
prop for MiniMap Node - rename Controls prop
showInteractive
toshowLock
- updates
useSvelteFlow
hook:- add
screenToFlowCoordinate
andflowToScreenCoordinate
- add
getConnectedEdges
,getIncomers
andgetOutgoers
- add
deleteElements
- add
fitBounds
- add
getIntersectingNodes
andisNodeIntersecting
- add
- add
useConnection
hook - add
useNodes
hook - add
useEdges
hook - add
viewport
prop (writable viewport) - fix selection style
- fix Background component with lines variant
- add
connectionLine
slot for rendering a custom connection line - add
connectionLineStyle
andconnectionLineContainerStyle
props - add
useConnection
hook - add
nodeDragThreshold
prop - add
fitViewOptions
prop - add
defaultEdgeOptions
prop - add
on:edgecontextmenu
event handler prop - add
connectionMode
prop - add
attributionPosition
prop
- add
on:nodedragstart
,on:nodedrag
andon:nodedragstop
- add
on:nodecontextmenu
- [breaking change] use same convention for all custom events: Always pass the original event if possible and additional data
- before:
on:nodeclick: CustomEvent<Node>
- after:
on:nodeclick: CustomEvent<{event: MouseEvent, node: Node}>
- before:
- fix
on:connectstart
andon:connectend
handlers - fix default styles for
<Controls />
component - fix
dragHandle
node option - expose
style
prop for minimap
- make it possible to change edge type dynamically
- fix
hidden
option for nodes and edges - add
useUpdateNodeInternals
hook
- add
nodesDraggable
prop - minimap: add default background
- export
useStore
to access internals
- center edge label by default
- fix wrongly displayed connectionline
- export css correctly
- [breaking change] from now on it's necessary to import the styles like
@xyflow/svelte/styles/style.css
or@xyflow/svelte/styles/base.css
. This makes it easier to work with tailwind or overwrite styles with regular CSS.
- fix event handlers and rename from
on:node:click
toon:nodeclick
- add
panActivationKey
prop - elevate nodes by default when selected
- use css vars internally and let users overwrite them
- use svelte 4
this release fixes the path bug introduced in 0.0.4
this version is broken because of a wrong path in the package.json
- add
snapGrid
prop - add
onlyRenderVisibleElements
prop - cleanup some exports and types
- add
connectionRadius
Svelte Flow alpha is here 🔥 You can expect some changes until we reach 1.0.0 but we try to stick as close as possible to the React Flow API. There are no docs yet, but we are working on it! For now the easiest way is to use the autocomplete of your IDE, lookup the props in the SvelteFlow component or check out the React Flow docs.
This very first release comes with lots of features already:
- pass
nodes
andedges
as writables - draggable, selectable and deletable nodes
- support for custom
nodeTypes
andedgeTypes
- basic viewport settings like
fitView
,minZoom
andmaxZoom
- additional components:
<MiniMap />
,<Controls />
&<Background />