1- import { memo } from "react" ;
2- import React from "react" ;
1+ import React , { memo } from "react" ;
32import { BaseEdge , Edge , EdgeProps , EdgeText , getBezierPath } from "@xyflow/react" ;
43
54import { nodeContentUtils } from "../nodes/NodeContent" ;
@@ -10,7 +9,13 @@ import { EdgeDefaultDataProps, edgeDefaultUtils } from "./EdgeDefault";
109/**
1110 * @deprecated (v26) use EdgeDefaultDataProps
1211 */
13- export type EdgeDefaultV12DataProps = Record < string , unknown > & EdgeDefaultDataProps ;
12+ export interface EdgeDefaultV12DataProps extends Record < string , unknown > , EdgeDefaultDataProps {
13+ /**
14+ * Set the marker used on the start or end of the edge.
15+ */
16+ markerAppearance ?: "arrow-closed" | "none" ;
17+ }
18+
1419/**
1520 * @deprecated (v26) use EdgeDefaultProps
1621 */
@@ -71,7 +76,19 @@ export const EdgeDefaultV12 = memo(
7176 />
7277 ) : null ) ;
7378
74- const appearance = "arrow-closed" ; // test
79+ const appearance = data . markerAppearance ?? "arrow-closed" ;
80+
81+ const marker =
82+ appearance !== "none"
83+ ? {
84+ markerStart : inversePath
85+ ? `url(#react-flow__marker--${ appearance } ${ intent ? `-${ intent } ` : "-none" } -reverse)`
86+ : undefined ,
87+ markerEnd : ! inversePath
88+ ? `url(#react-flow__marker--${ appearance } ${ intent ? `-${ intent } ` : "-none" } `
89+ : undefined ,
90+ }
91+ : { } ;
7592
7693 return (
7794 < g
@@ -107,16 +124,7 @@ export const EdgeDefaultV12 = memo(
107124 < BaseEdge
108125 id = { id }
109126 path = { edgePath }
110- markerStart = {
111- inversePath
112- ? `url(#react-flow__marker--${ appearance } ${ intent ? `-${ intent } ` : "-none" } -reverse)`
113- : undefined
114- }
115- markerEnd = {
116- ! inversePath
117- ? `url(#react-flow__marker--${ appearance } ${ intent ? `-${ intent } ` : "-none" } `
118- : undefined
119- }
127+ { ...marker }
120128 className = { edgeDefaultUtils . createEdgeDefaultClassName ( { strokeType } ) }
121129 interactionWidth = { pathGlowWidth }
122130 style = { {
0 commit comments