refactor(svelte/edges): simplify

This commit is contained in:
moklick
2023-11-30 10:41:18 +01:00
parent 8f43160236
commit 6825b486ec
25 changed files with 176 additions and 150 deletions
@@ -1,11 +1,11 @@
import { memo, useMemo } from 'react';
import { SmoothStepEdge } from './SmoothStepEdge';
import type { SmoothStepEdgeProps } from '../../types';
import type { StepEdgeProps } from '../../types';
function createStepEdge(params: { isInternal: boolean }) {
// eslint-disable-next-line react/display-name
return memo(({ id, ...props }: SmoothStepEdgeProps) => {
return memo(({ id, ...props }: StepEdgeProps) => {
const _id = params.isInternal ? undefined : id;
return (
@@ -1,3 +1,7 @@
// We distinguish between internal and exported edges
// The internal edges are used directly like custom edges and always get an id, source and target props
// If you import an edge from the library, the id is optional and source and target are not used at all
export { SimpleBezierEdge, SimpleBezierEdgeInternal } from './SimpleBezierEdge';
export { SmoothStepEdge, SmoothStepEdgeInternal } from './SmoothStepEdge';
export { StepEdge, StepEdgeInternal } from './StepEdge';