UNPKG

@plait/graph-viz

Version:
115 lines (107 loc) 4.57 kB
import { Options } from 'roughjs/bin/core'; import { GeneratorExtraData, RenderComponentRef } from '@plait/common'; import { Point, PlaitBoard, PlaitElement } from '@plait/core'; import * as _plait_graph_viz from '@plait/graph-viz'; declare const DEFAULT_EDGE_STYLES: Options; declare const DEFAULT_NODE_SIZE = 30; declare const DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER = 1.2; declare const DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER = 1.5; declare const DEFAULT_NODE_LABEL_MARGIN_TOP = 4; declare const DEFAULT_NODE_LABEL_FONT_SIZE = 12; declare const DEFAULT_NODE_LABEL_WIDTH = 72; declare const DEFAULT_NODE_LABEL_HEIGHT = 22; declare const DEFAULT_NODE_LABEL_STYLE = "user-select:none;max-width:72px;text-align:center;line-height:22px;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"; declare const NODE_LABEL_CLASS_NAME = "force-atlas-node-label"; declare const SECOND_DEPTH_NODE_ALPHA = 0.5; declare const SECOND_DEPTH_LINE_ALPHA = 0.5; declare const ACTIVE_BACKGROUND_NODE_ALPHA = 0.1; declare const NODE_ICON_CLASS_NAME = "force-atlas-node-icon"; declare const ACTIVE_NODE_ICON_CLASS_NAME = "force-atlas-node-icon-active"; declare const NODE_ICON_FONT_SIZE = 16; declare const ACTIVE_NODE_ICON_FONT_SIZE = 18; declare const DEFAULT_NODE_BACKGROUND_COLOR = "#9c9cfb"; declare const DEFAULT_NODE_ICON_COLOR = "#fff"; declare const DEFAULT_NODE_STYLES: Options; declare const DEFAULT_NODE_SCALING_RATIO = 20; declare const DEFAULT_LINE_STYLES: { color: { 0: string; 1: string; 2: string; }; opacity: { 0: number; 1: number; 2: number; }; }; declare const DEFAULT_EDGE_PARTICLE_SIZE = 4; declare enum EdgeDirection { IN = 0, OUT = 1, NONE = 2 } interface NodeStyles { stroke?: string; strokeWidth?: number; fill?: string; fillStyle?: string; activeStroke?: string; activeFill?: string; borderRadius?: number; hoverStroke?: string; } interface EdgeGeneratorData extends GeneratorExtraData { startPoint: Point; endPoint: Point; isSourceActive: boolean; isTargetActive: boolean; direction: EdgeDirection; isTargetSelf?: boolean; } interface NodeGeneratorData extends GeneratorExtraData { isActive: boolean; opacity: number; } interface NodeIconItem { name: string; fontSize?: number; color?: string; } declare const withForceAtlas: (board: PlaitBoard) => PlaitBoard & _plait_graph_viz.ForceAtlasNodeIconBoard; interface ForceAtlasNodeElement extends PlaitElement { label: string; icon: string | NodeIconItem; size?: number; isActive?: boolean; } interface ForceAtlasEdgeElement extends PlaitElement { source: string; target: string; } interface ForceAtlasElement extends PlaitElement { children: (ForceAtlasNodeElement | ForceAtlasEdgeElement)[]; } declare const ForceAtlasElement: { isForceAtlas: (value: any) => boolean; isForceAtlasNodeElement: (value: any) => value is ForceAtlasNodeElement; isForceAtlasEdgeElement: (value: any) => value is ForceAtlasEdgeElement; }; interface ForceAtlasNodeIconBoard { renderNodeIcon: (container: Element | DocumentFragment, props: NodeIconProps) => RenderComponentRef<NodeIconProps>; } declare const withNodeIcon: <T extends PlaitBoard = PlaitBoard>(board: T) => T & ForceAtlasNodeIconBoard; interface NodeIconProps { board: PlaitBoard; iconItem: NodeIconItem; element: ForceAtlasNodeElement; } declare abstract class ForceAtlasNodeIconBaseComponent { iconItem: NodeIconItem; board: PlaitBoard; element: ForceAtlasNodeElement; abstract nativeElement(): HTMLElement; initialize(): void; } export { ACTIVE_BACKGROUND_NODE_ALPHA, ACTIVE_NODE_ICON_CLASS_NAME, ACTIVE_NODE_ICON_FONT_SIZE, DEFAULT_ACTIVE_NODE_SIZE_MULTIPLIER, DEFAULT_ACTIVE_WAVE_NODE_SIZE_MULTIPLIER, DEFAULT_EDGE_PARTICLE_SIZE, DEFAULT_EDGE_STYLES, DEFAULT_LINE_STYLES, DEFAULT_NODE_BACKGROUND_COLOR, DEFAULT_NODE_ICON_COLOR, DEFAULT_NODE_LABEL_FONT_SIZE, DEFAULT_NODE_LABEL_HEIGHT, DEFAULT_NODE_LABEL_MARGIN_TOP, DEFAULT_NODE_LABEL_STYLE, DEFAULT_NODE_LABEL_WIDTH, DEFAULT_NODE_SCALING_RATIO, DEFAULT_NODE_SIZE, DEFAULT_NODE_STYLES, EdgeDirection, ForceAtlasElement, ForceAtlasNodeIconBaseComponent, NODE_ICON_CLASS_NAME, NODE_ICON_FONT_SIZE, NODE_LABEL_CLASS_NAME, SECOND_DEPTH_LINE_ALPHA, SECOND_DEPTH_NODE_ALPHA, withForceAtlas, withNodeIcon }; export type { EdgeGeneratorData, ForceAtlasEdgeElement, ForceAtlasNodeElement, ForceAtlasNodeIconBoard, NodeGeneratorData, NodeIconItem, NodeIconProps, NodeStyles };