feat(curve): deduplicate curve factory type

Signed-off-by: andrmaz <60042277+andrmaz@users.noreply.github.com>
This commit is contained in:
andrmaz
2022-10-09 11:13:23 +02:00
parent 3d3a2962c4
commit 46ee5188e9
5 changed files with 5 additions and 21 deletions
+1 -5
View File
@@ -203,9 +203,6 @@ export type CreateButtonProps = {
title: string;
} & Partial<Pick<LinkProps_3, 'to'>>;
// @public
type Curve = 'curveStepBefore' | 'curveMonotoneX';
// @public (undocumented)
export type CustomProviderClassKey = 'form' | 'button';
@@ -242,7 +239,7 @@ export interface DependencyGraphProps<NodeData, EdgeData>
acyclicer?: 'greedy';
// Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver
align?: Alignment;
curve?: Curve;
curve?: 'curveStepBefore' | 'curveMonotoneX';
defs?: SVGDefsElement | SVGDefsElement[];
// Warning: (ae-unresolved-link) The @link reference could not be resolved: This type of declaration is not supported yet by the resolver
direction?: Direction;
@@ -273,7 +270,6 @@ declare namespace DependencyGraphTypes {
DependencyNode,
RenderNodeProps,
RenderNodeFunction,
Curve,
Direction,
Alignment,
Ranker,
@@ -30,7 +30,6 @@ import {
RenderNodeFunction,
RenderLabelFunction,
LabelPosition,
Curve,
} from './types';
import { Node } from './Node';
import { Edge, GraphEdge } from './Edge';
@@ -170,7 +169,7 @@ export interface DependencyGraphProps<NodeData, EdgeData>
*
* Default: 'curveMonotoneX'
*/
curve?: Curve;
curve?: 'curveStepBefore' | 'curveMonotoneX';
}
const WORKSPACE_ID = 'workspace';
@@ -17,11 +17,11 @@
import React from 'react';
import { render } from '@testing-library/react';
import { Edge } from './Edge';
import { Curve, RenderLabelProps } from './types';
import { RenderLabelProps } from './types';
const fromNode = 'node';
const toNode = 'other-node';
const curve: Curve = 'curveMonotoneX';
const curve: 'curveStepBefore' | 'curveMonotoneX' = 'curveMonotoneX';
const edge = {
points: [
@@ -24,7 +24,6 @@ import {
RenderLabelFunction,
DependencyEdge,
LabelPosition,
Curve,
} from './types';
import { EDGE_TEST_ID, LABEL_TEST_ID } from './constants';
import { DefaultLabel } from './DefaultLabel';
@@ -71,7 +70,7 @@ export type EdgeComponentProps<T = unknown> = {
id: dagre.Edge,
edge: DependencyEdge<T>,
) => dagre.graphlib.Graph<{}>;
curve: Curve;
curve: 'curveStepBefore' | 'curveMonotoneX';
};
const renderDefault = (props: RenderLabelProps<unknown>) => (
@@ -75,16 +75,6 @@ export type RenderNodeFunction<T = {}> = (
props: RenderNodeProps<T>,
) => React.ReactNode;
/**
* Graph curve factory
*
* @public
*
* @see {@link @types/d3-shape/index.d.ts#curveMonotoneX}
* @see {@link @types/d3-shape/index.d.ts#curveStepBefore}
*/
export type Curve = 'curveStepBefore' | 'curveMonotoneX';
/**
* Graph direction
*