13 KiB
@xyflow/svelte
0.1.8
useConnectionreturnsConnectionStatewithtoNodeandtoHandle- node origin is part of position absolute
- refactor connection handling
0.1.7
- revise selection usability (capture while dragging out of the flow)
- only prevent shift scrolling when selection is actually in progress
- use correct end handle position when drawing a connection lines
- determine correct end positions for connection lines
0.1.6
- fix node origin bug
0.1.5
- prevent zooming on mobile if zoomOnPinch is false
- add straight edge to path built-in-types
- abort drag when multiple touches are detected
- fix merge_styles error
0.1.4
- add
selectable,deletableanddraggableto node and edge props - add
parentIdto node props - add
on:edgemouseenterandon:edgemouseleaveevent handler - fix deselection of edges
- remove pointer events from panel when user selection is active
- fix viewport initialization with user viewport
- fix parent node lookup in
evaluateAbsolutePosition- thanks @lcsfort
0.1.3
- fix
NodeToolbarfor subflows
0.1.2
- export
InternalNodetype
0.1.1
- export
useInternalNodehook
0.1.0
This is a bigger update for Svelte Flow to keep up with the latest changes we made for React Flow and the Svelte5 rewrite. The biggest change is the separation of user nodes (type Node) and internal nodes (type InternalNode), which includes a renaming of the node.computed attribute to node.measured. In the previous versions, we stored internals in node[internalsSymbol]. This doesn't exist anymore, but we only add it to our internal nodes in node.internals..
⚠️ Breaking
- rename
node.computedtonode.measured- this attribute only includeswidthandheightand nopositionAbsoluteanymore. For this we added the helpersgetInternalNodeanduseInternalNode - rename
node.parentNodetonode.parentId
More updates:
- add
isValidConnectionfor<Handle />component - add
fitViewOptionsfor<Controls />component - add
getInternalNodetouseSvelteFlow - add
useInternalNodehook - don't reset nodes and edges when svelte flow unmounts - thanks @darabos
- fix node event types - thanks @RedPhoenixQ
- make handleId and isTarget reactive - thanks @darabos
- fix MiniMap interaction for touch devices
- fix pane: pinch zoom on windows
- fix nodes: return user node in node event handlers
0.0.41
- fix: re-observe nodes when not initialized
0.0.40
- add
orientation('horizontal' or 'vertical'),styleandclassprop forControlscomponent - allow multiple keys for
deleteKey,selectionKey,multiSelectionKey,panActivationKeyandzoomActivationKey - fix node observe / unobserve
- fix edge and node types
- active context menu releases pressed keys to reset selection
0.0.39
⚠️ Breaking changes
on:nodedragstart,on:nodedragandon:nodedragstopare also getting fired if a selection bix is being dragged. We renamed thenodeparam totargetNodeand set it tonullif a selection is being dragged.
Patch changes
- export
EdgeLabelcomponent - add "connectionindicator" class for
Handlecomponent - address a11y warnings
0.0.38
⚠️ Breaking changes
NodePropsgeneric is a node and not only node data.type $$Props = NodeProps<AppNode>
Patch changes
- unify
EdgeandNodetype handling - fix safari: prevent selection of viewport
0.0.37
⚠️ Breaking changes
useNodesDatanot only returns data objects but also the type and the id of the node- status class names for Handle components are slightly different. It's now "connectingfrom" and "connectingto" instead of "connecting"
Patch changes
- better cursor defaults for the pane, nodes and edges
- add
initialWidthandinitialHeightnode attributes for specifying initial dimensions for ssr - always re-measure nodes when new nodes get passed
- fix
NodeResizerwhen used in combination withnodeOrigin
0.0.36
Patch changes
- a better NodeResizer (child nodes do not move when parent node gets resized)
- fix
on:panecontextmenu - add
role="button"to<EdgeLabel />to prevent a11y warnings - don't delete node when input is focused and user presses Backspace + Ctrl (or any other mod key)
useHandleConnections: use context node id when no node id is passed- don't trigger drag start / end when node is not draggable
0.0.35
Minor changes
- add
getNode,getNodes,getEdgeandgetEdgestouseSvelteFlow - add
useInitialized/useNNodesInitializedhooks andoninithandler
Patch changes
- 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
getNodesBoundsand add second param for passing options
0.0.34
Minor changes
- add second option param to
screenToFlowPositionfor configuring ifsnapToGridshould be used - add slot to
Controls
Patch changes
- cleanup
ControlButtontypes - infer types for
getIncomers,getOutgoers,updateEdge,addEdgeandgetConnectedEdgesthanks @joeyballentine - refactor handles: prefix with flow id for handling nested flows
- add comments for types like
SvelteFlowPropsorNodefor a better developer experience
0.0.33
Bugfix
- fix
deleteElements - fix dragging when
draggable=false - add
ariaLabelprop for<Controls />
⚠️ Breaking
deleteElementsfunction now takes one object as an argument{ nodes: [], edges: [] }instead of two(nodes, edges)
0.0.32
Features
- add
NodeResizerandNodeResizeControlcomponents for resizing nodes
0.0.31
Bugfix
- fix edge rendering
0.0.30
Features
- add
onbeforedeletehandler to prevent/ manage deletions - TSDocs for hooks and some types
Patch changes
- new nodeDragThreshold default is 1
- refactor/simplify edge rendering
0.0.29
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 />.
Features
- add
useHandleConnectionshook for receiving connected node and handle ids for a specific handle - add
useNodesData(ids: string | string[])hook for receiving data from other nodes - export
updateNodeandupdateNodeDatafromuseSvelteFlowto update a node or the data object - add
onedgecreatefunction for passing a certain id or other attributes to a newly created edge
⚠️ Breaking
- replace
on:connect,on:connectstartandon:connectendwithonconnect,onconnectstartandonconnectend, no need to forwardon:connect..anymore
Fixes and minor changes
onconnectandondisconnectcallback work for<Handle />component- don't delete a node when user presses Backspace inside an input/textarea/.nokey element
bgColorprop 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
getIntersectingNodesbug when passingRect
0.0.28
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:selectionclickandon:selectioncontextmenuevent handlers - add
ondelete({ nodes, edges })handler - add
zoomActivationKeyprop - add
widthandheightprop to customNodePropstype - add
colorModeprop ('light' | 'dark' | 'system') - ⚠️ replace
xPosandyPoswithpositionAbsoluteprop to customNodePropstype - ⚠️
node.width/heightandnode.positionAbsolutecan now be found undernode.computed.width/height/positionAbsolute - ⚠️
node.width/heightis 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
0.0.27
- add
selectionOnDragprop - can be used to create figma-like controls in combination withpanOnDrag={false}/panOnDrag={[1, 2]}+panOnScroll={true} - ⚠️ rename
screenToFlowCoordinatetoscreenToFlowPosition - ⚠️ rename
flowToScreenCoordinatetoflowToScreenPosition - ⚠️ rename
getTransformForBoundstogetViewportForBounds(return{ x: number, y: number, zoom: number }instead of[number, number, number]) - ⚠️ rename
getRectOfNodestogetNodesBounds - simplify handle default styles, so that it's easier to override them
- added e2e tests
0.0.26
- fixes broken version on npm
0.0.25
- add
toObjecttouseSvelteFlowhook - export
BezierEdge,StepEdgeandSmoothStepEdgecomponents - handle window resize (Minimap updates its viewport)
- fix wrongly selected nodes
- fix connection line z-index
- fix broken edges (
interactionWidthwas missing)
0.0.24
- update node automatically when
type,sourcePositionortargetPositionoption changes - prevent dev tool warnings when using built-in node types
- updates
useSvelteFlowhook: - add node type "group"
- add
classprop for BaseEdge - add
idprop for Background - add
selectedprop for MiniMap Node - rename Controls prop
showInteractivetoshowLock
0.0.23
- updates
useSvelteFlowhook:- add
screenToFlowCoordinateandflowToScreenCoordinate - add
getConnectedEdges,getIncomersandgetOutgoers - add
deleteElements - add
fitBounds - add
getIntersectingNodesandisNodeIntersecting
- add
- add
useConnectionhook - add
useNodeshook - add
useEdgeshook - add
viewportprop (writable viewport) - fix selection style
- fix Background component with lines variant
0.0.22
- add
connectionLineslot for rendering a custom connection line - add
connectionLineStyleandconnectionLineContainerStyleprops - add
useConnectionhook - add
nodeDragThresholdprop - add
fitViewOptionsprop - add
defaultEdgeOptionsprop - add
on:edgecontextmenuevent handler prop - add
connectionModeprop - add
attributionPositionprop
0.0.21
- add
on:nodedragstart,on:nodedragandon:nodedragstop - add
on:nodecontextmenu
0.0.20
- [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:connectstartandon:connectendhandlers - fix default styles for
<Controls />component - fix
dragHandlenode option - expose
styleprop for minimap
0.0.19
- make it possible to change edge type dynamically
- fix
hiddenoption for nodes and edges - add
useUpdateNodeInternalshook
0.0.18
- add
nodesDraggableprop - minimap: add default background
0.0.17
- export
useStoreto access internals
0.0.16
- center edge label by default
0.0.15
- fix wrongly displayed connectionline
0.0.14
- export css correctly
0.0.13
- [breaking change] from now on it's necessary to import the styles like
@xyflow/svelte/styles/style.cssor@xyflow/svelte/styles/base.css. This makes it easier to work with tailwind or overwrite styles with regular CSS.
0.0.7 ... 0.0.12
- fix event handlers and rename from
on:node:clicktoon:nodeclick - add
panActivationKeyprop - elevate nodes by default when selected
- use css vars internally and let users overwrite them
0.0.6
- use svelte 4
0.0.5
this release fixes the path bug introduced in 0.0.4
0.0.4
this version is broken because of a wrong path in the package.json
0.0.3
- add
snapGridprop - add
onlyRenderVisibleElementsprop - cleanup some exports and types
0.0.2
- add
connectionRadius
0.0.1
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
nodesandedgesas writables - draggable, selectable and deletable nodes
- support for custom
nodeTypesandedgeTypes - basic viewport settings like
fitView,minZoomandmaxZoom - additional components:
<MiniMap />,<Controls />&<Background />