chore(types): cleanup comments

This commit is contained in:
moklick
2024-01-16 18:09:54 +01:00
parent 897c9afdf6
commit 25576cd5d5
18 changed files with 178 additions and 162 deletions
+10 -10
View File
@@ -2,19 +2,19 @@ import { Position } from './utils';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type EdgeBase<EdgeData = any> = {
/** unique id of an edge */
/** Unique id of an edge */
id: string;
/** type of an edge defined in edgeTypes */
/** Type of an edge defined in edgeTypes */
type?: string;
/** id of source node */
/** Id of source node */
source: string;
/** id of target node */
/** Id of target node */
target: string;
/** id of source handle
/** Id of source handle
* only needed if there are multiple handles per node
*/
sourceHandle?: string | null;
/** id of target handle
/** Id of target handle
* only needed if there are multiple handles per node
*/
targetHandle?: string | null;
@@ -22,20 +22,20 @@ export type EdgeBase<EdgeData = any> = {
hidden?: boolean;
deletable?: boolean;
selectable?: boolean;
/** arbitrary data passed to an edge */
/** Arbitrary data passed to an edge */
data?: EdgeData;
selected?: boolean;
/** set the marker on the beginning of an edge
/** Set the marker on the beginning of an edge
* @example 'arrow', 'arrowclosed' or custom marker
*/
markerStart?: EdgeMarkerType;
/** set the marker on the end of an edge
/** Set the marker on the end of an edge
* @example 'arrow', 'arrowclosed' or custom marker
*/
markerEnd?: EdgeMarkerType;
zIndex?: number;
ariaLabel?: string;
/** padding around the edge where interaction is still possible */
/** Padding around the edge where interaction is still possible */
interactionWidth?: number;
};
+8 -8
View File
@@ -27,28 +27,28 @@ export type ConnectionHandle = {
};
export type HandleProps = {
/** type of the handle
/** Type of the handle
* @example HandleType.Source, HandleType.Target
*/
type: HandleType;
/** position of the handle
/** Position of the handle
* @example Position.TopLeft, Position.TopRight,
* Position.BottomLeft, Position.BottomRight
*/
position: Position;
/** should you be able to connect to/from this handle */
/** Should you be able to connect to/from this handle */
isConnectable?: boolean;
/** shoud you be able to connect from this handle */
/** Should you be able to connect from this handle */
isConnectableStart?: boolean;
/** should you be able to connect to this handle */
/** Should you be able to connect to this handle */
isConnectableEnd?: boolean;
/** callback called when connection is made */
/** Callback called when connection is made */
onConnect?: OnConnect;
/** callback if connection is valid
/** Callback if connection is valid
* @remarks connection becomes an edge if isValidConnection returns true
*/
isValidConnection?: IsValidConnection;
/** id of the handle
/** Id of the handle
* @remarks optional if there is only one handle of this type
*/
id?: string;
+12 -12
View File
@@ -10,27 +10,27 @@ import { Optional } from '../utils/types';
* @typeParam U - type of the node
*/
export type NodeBase<T = any, U extends string | undefined = string | undefined> = {
/** unique id of a node */
/** Unique id of a node */
id: string;
/** position of a node on the pane
/** Position of a node on the pane
* @example { x: 0, y: 0 }
*/
position: XYPosition;
/** arbitrary data passed to a node */
/** Arbitrary data passed to a node */
data: T;
/** type of node defined in nodeTypes */
/** Type of node defined in nodeTypes */
type?: U;
/** only relevant for default, source, target nodeType. controls source position
/** Only relevant for default, source, target nodeType. controls source position
* @example 'right', 'left', 'top', 'bottom'
*/
sourcePosition?: Position;
/** only relevant for default, source, target nodeType. controls target position
/** Only relevant for default, source, target nodeType. controls target position
* @example 'right', 'left', 'top', 'bottom'
*/
targetPosition?: Position;
hidden?: boolean;
selected?: boolean;
/** is node being dragged */
/** True, if node is being dragged */
dragging?: boolean;
draggable?: boolean;
selectable?: boolean;
@@ -39,16 +39,16 @@ export type NodeBase<T = any, U extends string | undefined = string | undefined>
dragHandle?: string;
width?: number | null;
height?: number | null;
/** parent node id, used for creating sub-flows */
/** Parent node id, used for creating sub-flows */
parentNode?: string;
zIndex?: number;
/** boundary a node can be moved in
/** Boundary a node can be moved in
* @example 'parent' or [[0, 0], [100, 100]]
*/
extent?: 'parent' | CoordinateExtent;
expandParent?: boolean;
ariaLabel?: string;
/** origin of the node relative to it's position
/** Origin of the node relative to it's position
* @example
* [0.5, 0.5] // centers the node
* [0, 0] // top left
@@ -62,7 +62,7 @@ export type NodeBase<T = any, U extends string | undefined = string | undefined>
positionAbsolute?: XYPosition;
};
// only used internally
// Only used internally
[internalsSymbol]?: {
z?: number;
handleBounds?: NodeHandleBounds;
@@ -82,7 +82,7 @@ export type NodeBase<T = any, U extends string | undefined = string | undefined>
* @param id - The id of the node.
*/
export type NodeProps<T = any> = {
/** id of the node */
/** Id of the node */
id: NodeBase['id'];
data: T;
dragHandle: NodeBase['dragHandle'];