From 58ede7355e24c7ef30e08d7a6d09cfd712e8f60d Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Sun, 18 Dec 2022 21:06:02 +0100 Subject: [PATCH] feat(core,edges): add `pathOptions` to edge types Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- packages/core/src/types/edge.ts | 55 ++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/packages/core/src/types/edge.ts b/packages/core/src/types/edge.ts index 7cdc7634..0ab54872 100644 --- a/packages/core/src/types/edge.ts +++ b/packages/core/src/types/edge.ts @@ -45,7 +45,20 @@ export type EdgeMarkerType = string | MarkerType | EdgeMarker export type EdgeUpdatable = boolean | 'target' | 'source' -export interface Edge = any> { +export interface EdgeLabelOptions { + /** Label styles (CSSProperties) */ + labelStyle?: CSSProperties + /** Show label bg */ + labelShowBg?: boolean + /** Label Bg styles (CSSProperties) */ + labelBgStyle?: CSSProperties + /** Label Bg padding */ + labelBgPadding?: [number, number] + /** Label Bg border radius */ + labelBgBorderRadius?: number +} + +interface DefaultEdge = any> extends EdgeLabelOptions { /** Unique edge id */ id: string /** An edge label */ @@ -60,16 +73,6 @@ export interface Edge> } +export interface SmoothStepPathOptions { + offset?: number + borderRadius?: number +} + +type SmoothStepEdgeType = any> = DefaultEdge< + Data, + CustomEvents +> & { + type: 'smoothstep' + pathOptions?: SmoothStepPathOptions +} + +export interface BezierPathOptions { + curvature?: number +} + +type BezierEdgeType = any> = DefaultEdge< + Data, + CustomEvents +> & { + type: 'default' + pathOptions?: BezierPathOptions +} + +export type Edge = any> = + | DefaultEdge + | SmoothStepEdgeType + | BezierEdgeType + export type DefaultEdgeOptions = Omit export interface EdgePositions {