added typedocs for plugins
This commit is contained in:
@@ -8,14 +8,27 @@ export enum BackgroundVariant {
|
|||||||
|
|
||||||
export type BackgroundProps = {
|
export type BackgroundProps = {
|
||||||
id?: string;
|
id?: string;
|
||||||
|
/** color of the pattern */
|
||||||
color?: string;
|
color?: string;
|
||||||
|
/** color of the background */
|
||||||
bgColor?: string;
|
bgColor?: string;
|
||||||
|
/** class applied to the container */
|
||||||
className?: string;
|
className?: string;
|
||||||
|
/** class applied to the pattern */
|
||||||
patternClassName?: string;
|
patternClassName?: string;
|
||||||
|
/** gap between repetitions of the pattern */
|
||||||
gap?: number | [number, number];
|
gap?: number | [number, number];
|
||||||
|
/** size of a single pattern element */
|
||||||
size?: number;
|
size?: number;
|
||||||
|
/** offset of the pattern */
|
||||||
offset?: number;
|
offset?: number;
|
||||||
|
/** line width of the Line pattern */
|
||||||
lineWidth?: number;
|
lineWidth?: number;
|
||||||
|
/** variant of the pattern
|
||||||
|
* @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross
|
||||||
|
* 'lines', 'dots', 'cross'
|
||||||
|
*/
|
||||||
variant?: BackgroundVariant;
|
variant?: BackgroundVariant;
|
||||||
|
/** style applied to the container */
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,17 +4,31 @@ import type { PanelPosition } from '@xyflow/system';
|
|||||||
import type { FitViewOptions } from '../../types';
|
import type { FitViewOptions } from '../../types';
|
||||||
|
|
||||||
export type ControlProps = {
|
export type ControlProps = {
|
||||||
|
/** show button for zoom in/out */
|
||||||
showZoom?: boolean;
|
showZoom?: boolean;
|
||||||
|
/** show button for fit view */
|
||||||
showFitView?: boolean;
|
showFitView?: boolean;
|
||||||
|
/** show button for toggling interactivity */
|
||||||
showInteractive?: boolean;
|
showInteractive?: boolean;
|
||||||
|
/** options being used when fit view button is clicked */
|
||||||
fitViewOptions?: FitViewOptions;
|
fitViewOptions?: FitViewOptions;
|
||||||
|
/** callback when zoom in button is clicked */
|
||||||
onZoomIn?: () => void;
|
onZoomIn?: () => void;
|
||||||
|
/** callback when zoom out button is clicked */
|
||||||
onZoomOut?: () => void;
|
onZoomOut?: () => void;
|
||||||
|
/** callback when fit view button is clicked */
|
||||||
onFitView?: () => void;
|
onFitView?: () => void;
|
||||||
|
/** callback when interactivity is toggled */
|
||||||
onInteractiveChange?: (interactiveStatus: boolean) => void;
|
onInteractiveChange?: (interactiveStatus: boolean) => void;
|
||||||
|
/** position of the controls on the pane
|
||||||
|
* @example PanelPosition.TopLeft, PanelPosition.TopRight,
|
||||||
|
* PanelPosition.BottomLeft, PanelPosition.BottomRight
|
||||||
|
*/
|
||||||
position?: PanelPosition;
|
position?: PanelPosition;
|
||||||
children?: ReactNode;
|
children?: ReactNode;
|
||||||
|
/** style applied to container */
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
|
/**className applied to container */
|
||||||
className?: string;
|
className?: string;
|
||||||
'aria-label'?: string;
|
'aria-label'?: string;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,23 +7,41 @@ import type { Node } from '../../types';
|
|||||||
export type GetMiniMapNodeAttribute<NodeType extends Node = Node> = (node: NodeType) => string;
|
export type GetMiniMapNodeAttribute<NodeType extends Node = Node> = (node: NodeType) => string;
|
||||||
|
|
||||||
export type MiniMapProps<NodeType extends Node = Node> = Omit<HTMLAttributes<SVGSVGElement>, 'onClick'> & {
|
export type MiniMapProps<NodeType extends Node = Node> = Omit<HTMLAttributes<SVGSVGElement>, 'onClick'> & {
|
||||||
|
/** color of nodes on minimap */
|
||||||
nodeColor?: string | GetMiniMapNodeAttribute<NodeType>;
|
nodeColor?: string | GetMiniMapNodeAttribute<NodeType>;
|
||||||
|
/** stroke color of nodes on minimap */
|
||||||
nodeStrokeColor?: string | GetMiniMapNodeAttribute<NodeType>;
|
nodeStrokeColor?: string | GetMiniMapNodeAttribute<NodeType>;
|
||||||
|
/** className applied to nodes on minimap */
|
||||||
nodeClassName?: string | GetMiniMapNodeAttribute<NodeType>;
|
nodeClassName?: string | GetMiniMapNodeAttribute<NodeType>;
|
||||||
|
/** boder radius of nodes on minimap */
|
||||||
nodeBorderRadius?: number;
|
nodeBorderRadius?: number;
|
||||||
|
/** stroke width of nodes on minimap */
|
||||||
nodeStrokeWidth?: number;
|
nodeStrokeWidth?: number;
|
||||||
|
/** component used to render nodes on minimap */
|
||||||
nodeComponent?: ComponentType<MiniMapNodeProps>;
|
nodeComponent?: ComponentType<MiniMapNodeProps>;
|
||||||
|
/** color of mask representing viewport */
|
||||||
maskColor?: string;
|
maskColor?: string;
|
||||||
|
/** stroke color of mask representing viewport */
|
||||||
maskStrokeColor?: string;
|
maskStrokeColor?: string;
|
||||||
|
/** stroke width of mask representing viewport */
|
||||||
maskStrokeWidth?: number;
|
maskStrokeWidth?: number;
|
||||||
|
/** position of minimap on pane
|
||||||
|
* @example PanelPosition.TopLeft, PanelPosition.TopRight,
|
||||||
|
* PanelPosition.BottomLeft, PanelPosition.BottomRight
|
||||||
|
*/
|
||||||
position?: PanelPosition;
|
position?: PanelPosition;
|
||||||
|
/** callback caled when minimap is clicked*/
|
||||||
onClick?: (event: MouseEvent, position: XYPosition) => void;
|
onClick?: (event: MouseEvent, position: XYPosition) => void;
|
||||||
|
/** callback called when node on minimap is clicked */
|
||||||
onNodeClick?: (event: MouseEvent, node: NodeType) => void;
|
onNodeClick?: (event: MouseEvent, node: NodeType) => void;
|
||||||
pannable?: boolean;
|
pannable?: boolean;
|
||||||
zoomable?: boolean;
|
zoomable?: boolean;
|
||||||
ariaLabel?: string | null;
|
ariaLabel?: string | null;
|
||||||
|
/** invert direction when panning the minimap viewport */
|
||||||
inversePan?: boolean;
|
inversePan?: boolean;
|
||||||
|
/** step size for zooming in/out on minimap */
|
||||||
zoomStep?: number;
|
zoomStep?: number;
|
||||||
|
/** offset the viewport on the minmap, acts like a padding */
|
||||||
offsetScale?: number;
|
offsetScale?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,39 @@ import type {
|
|||||||
} from '@xyflow/system';
|
} from '@xyflow/system';
|
||||||
|
|
||||||
export type NodeResizerProps = {
|
export type NodeResizerProps = {
|
||||||
|
/** id of the node it is resizing
|
||||||
|
* @remarks optional if used inside custom node
|
||||||
|
*/
|
||||||
nodeId?: string;
|
nodeId?: string;
|
||||||
|
/** color of the resize handle */
|
||||||
color?: string;
|
color?: string;
|
||||||
|
/** className applied to handle */
|
||||||
handleClassName?: string;
|
handleClassName?: string;
|
||||||
|
/** style applied to handle */
|
||||||
handleStyle?: CSSProperties;
|
handleStyle?: CSSProperties;
|
||||||
|
/** className applied to line */
|
||||||
lineClassName?: string;
|
lineClassName?: string;
|
||||||
|
/** style applied to line */
|
||||||
lineStyle?: CSSProperties;
|
lineStyle?: CSSProperties;
|
||||||
|
/** are the controls visible */
|
||||||
isVisible?: boolean;
|
isVisible?: boolean;
|
||||||
|
/** minimum width of node */
|
||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
|
/** minimum height of node */
|
||||||
minHeight?: number;
|
minHeight?: number;
|
||||||
|
/** maximum width of node */
|
||||||
maxWidth?: number;
|
maxWidth?: number;
|
||||||
|
/** maximum height of node */
|
||||||
maxHeight?: number;
|
maxHeight?: number;
|
||||||
|
/** keep aspect ratio when resizing */
|
||||||
keepAspectRatio?: boolean;
|
keepAspectRatio?: boolean;
|
||||||
|
/** callback to determine if node should resize */
|
||||||
shouldResize?: ShouldResize;
|
shouldResize?: ShouldResize;
|
||||||
|
/** callback called when resizing starts */
|
||||||
onResizeStart?: OnResizeStart;
|
onResizeStart?: OnResizeStart;
|
||||||
|
/** callback called when resizing */
|
||||||
onResize?: OnResize;
|
onResize?: OnResize;
|
||||||
|
/** callback called when resizing ends */
|
||||||
onResizeEnd?: OnResizeEnd;
|
onResizeEnd?: OnResizeEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,7 +60,14 @@ export type ResizeControlProps = Pick<
|
|||||||
| 'onResize'
|
| 'onResize'
|
||||||
| 'onResizeEnd'
|
| 'onResizeEnd'
|
||||||
> & {
|
> & {
|
||||||
|
/** position of the control
|
||||||
|
* @example ControlPosition.TopLeft, ControlPosition.TopRight,
|
||||||
|
* ControlPosition.BottomLeft, ControlPosition.BottomRight
|
||||||
|
*/
|
||||||
position?: ControlPosition;
|
position?: ControlPosition;
|
||||||
|
/** variant of the control
|
||||||
|
* @example ResizeControlVariant.Handle, ResizeControlVariant.Line
|
||||||
|
*/
|
||||||
variant?: ResizeControlVariant;
|
variant?: ResizeControlVariant;
|
||||||
className?: string;
|
className?: string;
|
||||||
style?: CSSProperties;
|
style?: CSSProperties;
|
||||||
|
|||||||
@@ -2,9 +2,18 @@ import type { HTMLAttributes } from 'react';
|
|||||||
import type { Position, Align } from '@xyflow/system';
|
import type { Position, Align } from '@xyflow/system';
|
||||||
|
|
||||||
export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
|
export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
|
||||||
|
/** id of the node, or array of ids the toolbar should be displayed at */
|
||||||
nodeId?: string | string[];
|
nodeId?: string | string[];
|
||||||
isVisible?: boolean;
|
isVisible?: boolean;
|
||||||
|
/** position of the toolbar relative to the node
|
||||||
|
* @example Position.TopLeft, Position.TopRight,
|
||||||
|
* Position.BottomLeft, Position.BottomRight
|
||||||
|
*/
|
||||||
position?: Position;
|
position?: Position;
|
||||||
|
/** offset the toolbar from the node */
|
||||||
offset?: number;
|
offset?: number;
|
||||||
|
/** align the toolbar relative to the node
|
||||||
|
* @example Align.Start, Align.Center, Align.End
|
||||||
|
*/
|
||||||
align?: Align;
|
align?: Align;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,12 +6,23 @@ export enum BackgroundVariant {
|
|||||||
|
|
||||||
export type BackgroundProps = {
|
export type BackgroundProps = {
|
||||||
id?: string;
|
id?: string;
|
||||||
|
/** color of the background */
|
||||||
bgColor?: string;
|
bgColor?: string;
|
||||||
|
/** color of the pattern */
|
||||||
patternColor?: string;
|
patternColor?: string;
|
||||||
|
/** class applied to the pattern */
|
||||||
patternClass?: string;
|
patternClass?: string;
|
||||||
|
/** class applied to the container */
|
||||||
class?: string;
|
class?: string;
|
||||||
|
/** gap between repetitions of the pattern */
|
||||||
gap?: number | [number, number];
|
gap?: number | [number, number];
|
||||||
|
/** size of a single pattern element */
|
||||||
size?: number;
|
size?: number;
|
||||||
|
/** line width of the Line pattern */
|
||||||
lineWidth?: number;
|
lineWidth?: number;
|
||||||
|
/** variant of the pattern
|
||||||
|
* @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross
|
||||||
|
* 'lines', 'dots', 'cross'
|
||||||
|
*/
|
||||||
variant?: BackgroundVariant;
|
variant?: BackgroundVariant;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
import type { PanelPosition } from '@xyflow/system';
|
import type { PanelPosition } from '@xyflow/system';
|
||||||
|
|
||||||
export type ControlsProps = {
|
export type ControlsProps = {
|
||||||
|
/** position of the controls on the pane
|
||||||
|
* @example PanelPosition.TopLeft, PanelPosition.TopRight,
|
||||||
|
* PanelPosition.BottomLeft, PanelPosition.BottomRight
|
||||||
|
*/
|
||||||
position?: PanelPosition;
|
position?: PanelPosition;
|
||||||
|
/** show button for zoom in/out */
|
||||||
showZoom?: boolean;
|
showZoom?: boolean;
|
||||||
|
/** show button for fit view */
|
||||||
showFitView?: boolean;
|
showFitView?: boolean;
|
||||||
|
/** show button for toggling interactivity */
|
||||||
showLock?: boolean;
|
showLock?: boolean;
|
||||||
buttonBgColor?: string;
|
buttonBgColor?: string;
|
||||||
buttonBgColorHover?: string;
|
buttonBgColorHover?: string;
|
||||||
|
|||||||
@@ -5,25 +5,45 @@ import type { Node } from '$lib/types';
|
|||||||
export type GetMiniMapNodeAttribute = (node: Node) => string;
|
export type GetMiniMapNodeAttribute = (node: Node) => string;
|
||||||
|
|
||||||
export type MiniMapProps = {
|
export type MiniMapProps = {
|
||||||
|
/** background color of minimap */
|
||||||
bgColor?: string;
|
bgColor?: string;
|
||||||
|
/** color of nodes on the minimap */
|
||||||
nodeColor?: string | GetMiniMapNodeAttribute;
|
nodeColor?: string | GetMiniMapNodeAttribute;
|
||||||
|
/** stroke color of nodes on the minimap */
|
||||||
nodeStrokeColor?: string | GetMiniMapNodeAttribute;
|
nodeStrokeColor?: string | GetMiniMapNodeAttribute;
|
||||||
|
/** class applied to nodes on the minimap */
|
||||||
nodeClass?: string | GetMiniMapNodeAttribute;
|
nodeClass?: string | GetMiniMapNodeAttribute;
|
||||||
|
/** border radius of nodes on the minimap */
|
||||||
nodeBorderRadius?: number;
|
nodeBorderRadius?: number;
|
||||||
|
/** stroke width of nodes on the minimap */
|
||||||
nodeStrokeWidth?: number;
|
nodeStrokeWidth?: number;
|
||||||
|
/** color of the mask representing viewport */
|
||||||
maskColor?: string;
|
maskColor?: string;
|
||||||
|
/** stroke color of the mask representing viewport */
|
||||||
maskStrokeColor?: string;
|
maskStrokeColor?: string;
|
||||||
|
/** stroke width of the mask representing viewport */
|
||||||
maskStrokeWidth?: number;
|
maskStrokeWidth?: number;
|
||||||
|
/** position of the minimap on the pane
|
||||||
|
* @example PanelPosition.TopLeft, PanelPosition.TopRight,
|
||||||
|
* PanelPosition.BottomLeft, PanelPosition.BottomRight
|
||||||
|
*/
|
||||||
position?: PanelPosition;
|
position?: PanelPosition;
|
||||||
|
/** class applied to container */
|
||||||
class?: string;
|
class?: string;
|
||||||
|
/** style applied to container */
|
||||||
style?: string;
|
style?: string;
|
||||||
|
/** aria-label applied to container */
|
||||||
ariaLabel?: string | null;
|
ariaLabel?: string | null;
|
||||||
|
/** width of minimap */
|
||||||
width?: number;
|
width?: number;
|
||||||
|
/** height of minimap */
|
||||||
height?: number;
|
height?: number;
|
||||||
// onClick?: (event: MouseEvent, position: XYPosition) => void;
|
// onClick?: (event: MouseEvent, position: XYPosition) => void;
|
||||||
// onNodeClick?: (event: MouseEvent, node: Node) => void;
|
// onNodeClick?: (event: MouseEvent, node: Node) => void;
|
||||||
pannable?: boolean;
|
pannable?: boolean;
|
||||||
zoomable?: boolean;
|
zoomable?: boolean;
|
||||||
|
/** invert the direction when panning the minimap viewport */
|
||||||
inversePan?: boolean;
|
inversePan?: boolean;
|
||||||
|
/** step size for zooming in/out */
|
||||||
zoomStep?: number;
|
zoomStep?: number;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,21 +8,39 @@ import type {
|
|||||||
} from '@xyflow/system';
|
} from '@xyflow/system';
|
||||||
|
|
||||||
export type NodeResizerProps = {
|
export type NodeResizerProps = {
|
||||||
|
/** id of the node it is resizing
|
||||||
|
* @remarks optional if used inside custom node
|
||||||
|
*/
|
||||||
nodeId?: string;
|
nodeId?: string;
|
||||||
|
/** color of the resize handle */
|
||||||
color?: string;
|
color?: string;
|
||||||
|
/** class applied to handle */
|
||||||
handleClass?: string;
|
handleClass?: string;
|
||||||
|
/** style applied to handle */
|
||||||
handleStyle?: string;
|
handleStyle?: string;
|
||||||
|
/** class applied to line */
|
||||||
lineClass?: string;
|
lineClass?: string;
|
||||||
|
/** style applied to line */
|
||||||
lineStyle?: string;
|
lineStyle?: string;
|
||||||
|
/** are the controls visible */
|
||||||
isVisible?: boolean;
|
isVisible?: boolean;
|
||||||
|
/** minimum width of node */
|
||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
|
/** minimum height of node */
|
||||||
minHeight?: number;
|
minHeight?: number;
|
||||||
|
/** maximum width of node */
|
||||||
maxWidth?: number;
|
maxWidth?: number;
|
||||||
|
/** maximum height of node */
|
||||||
maxHeight?: number;
|
maxHeight?: number;
|
||||||
|
/** keep aspect ratio when resizing */
|
||||||
keepAspectRatio?: boolean;
|
keepAspectRatio?: boolean;
|
||||||
|
/** callback to determine if node should resize */
|
||||||
shouldResize?: ShouldResize;
|
shouldResize?: ShouldResize;
|
||||||
|
/** callback called when resizing starts */
|
||||||
onResizeStart?: OnResizeStart;
|
onResizeStart?: OnResizeStart;
|
||||||
|
/** callback called when resizing */
|
||||||
onResize?: OnResize;
|
onResize?: OnResize;
|
||||||
|
/** callback called when resizing ends */
|
||||||
onResizeEnd?: OnResizeEnd;
|
onResizeEnd?: OnResizeEnd;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -40,7 +58,14 @@ export type ResizeControlProps = Pick<
|
|||||||
| 'onResize'
|
| 'onResize'
|
||||||
| 'onResizeEnd'
|
| 'onResizeEnd'
|
||||||
> & {
|
> & {
|
||||||
|
/** position of control
|
||||||
|
* @example ControlPosition.TopLeft, ControlPosition.TopRight,
|
||||||
|
* ControlPosition.BottomLeft, ControlPosition.BottomRight
|
||||||
|
*/
|
||||||
position?: ControlPosition;
|
position?: ControlPosition;
|
||||||
|
/** variant of control
|
||||||
|
* @example ResizeControlVariant.Handle, ResizeControlVariant.Line
|
||||||
|
*/
|
||||||
variant?: ResizeControlVariant;
|
variant?: ResizeControlVariant;
|
||||||
class?: string;
|
class?: string;
|
||||||
style?: string;
|
style?: string;
|
||||||
|
|||||||
@@ -1,9 +1,18 @@
|
|||||||
import type { Position, Align } from '@xyflow/system';
|
import type { Position, Align } from '@xyflow/system';
|
||||||
|
|
||||||
export type NodeToolbarProps = {
|
export type NodeToolbarProps = {
|
||||||
|
/** id of the node, or array of ids the toolbar should be displayed at */
|
||||||
nodeId?: string | string[];
|
nodeId?: string | string[];
|
||||||
|
/** position of the toolbar relative to the node
|
||||||
|
* @example Position.TopLeft, Position.TopRight,
|
||||||
|
* Position.BottomLeft, Position.BottomRight
|
||||||
|
*/
|
||||||
position?: Position;
|
position?: Position;
|
||||||
|
/** align the toolbar relative to the node
|
||||||
|
* @example Align.Start, Align.Center, Align.End
|
||||||
|
*/
|
||||||
align?: Align;
|
align?: Align;
|
||||||
|
/** offset the toolbar from the node */
|
||||||
offset?: number;
|
offset?: number;
|
||||||
isVisible?: boolean;
|
isVisible?: boolean;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user