import { IBadgesStyle, IEdgeStyle, INodeStyle, IStyleRule, OgmaEdgeShape, OgmaNodeShape, TextOptions } from '@linkurious/rest-client'; import { LKOgma, NodeAttributes, StyleRule as LKStyleRule, StyleType } from '../..'; export interface StylesConfig { nodeColorStyleRules: Array; nodeIconStyleRules: Array; nodeSizeStyleRules: Array; nodeShapeStyleRules?: Array; edgeColorStyleRules: Array; edgeWidthStyleRules: Array; edgeShapeStyleRules?: Array; } export declare const DEFAULT_OGMA_FONT = "'roboto', sans-serif"; export declare const CLEAR_FONT_COLOR = "#FFF"; export declare const FILTER_OPACITY = 0.2; export declare const BADGE_COLOR = "#3F3D5F"; export declare class StylesViz { private _ogma; private _exportClass; private _nodeDefaultStylesRules; private _nodeDefaultHaloRules; private _edgeDefaultStylesRules; private _edgeDefaultHaloRules; private _nodeAttributes; private _edgeAttributes; private _ogmaNodeColor; private _ogmaNodeIcon; private _ogmaNodeSize; private _ogmaNodeShape; private _ogmaEdgeColor; private _ogmaEdgeWidth; private _ogmaEdgeShape; private _defaultConfiguration; private _pinnedIndicatorRule?; private _badgesStyle?; constructor(ogma: LKOgma, configuration: { node: { nodeRadius?: number; shape?: OgmaNodeShape; text?: TextOptions & { nodePosition?: 'right' | 'left' | 'top' | 'bottom' | 'center'; }; }; edge: { edgeWidth?: number; shape?: OgmaEdgeShape; text?: TextOptions; }; baseUrl?: string; }); get nodeAttributes(): NodeAttributes; get nodeFont(): string | undefined; /** * Set nodes default styles based on the configuration */ setNodesDefaultStyles(): void; /** * Set edges default styles based on the configuration */ setEdgesDefaultStyles(): void; /** * Set nodes default styles based on the configuration */ setNodesDefaultHalo(): void; /** * Set edges default styles based on the configuration */ setEdgesDefaultHalo(): void; /** * Return the default node radius set in configuration or 5 * * @returns {number} */ private defaultNodeRadius; /** * Return the default edge width set in configuration or 1 * * @returns {number} */ private defaultEdgeWidth; /** * Check if a style property exists in the default styles object */ private defaultStylesHas; /** * Set styles for the class "filtered" */ setFilterClass(): void; /** * Set the class for exported nodes and edges */ setExportClass(textWrappingLength?: boolean): void; /** * Set the badge style */ initBadges(badges?: IBadgesStyle): Promise; /** * Refresh the hidden neighbors counter badge class (used in expand) */ refreshCounterBadgeClass(): void; /** * Used in other repos to refresh the pin badge style rule * LKE-13639: we are using a style rule instead of an Ogma class to get the right size of the nodes when calling _findPinBadgeScale */ refreshPinBadgeStyleRule(): Promise; /** * set text overlap to true or false * * @param {boolean} overlap */ toggleTextOverlap(overlap?: boolean): void; /** * refresh nodes and edge rules * */ refreshRules(): void; /** * Create / refresh an ogma rule for node colors */ refreshNodeColors(colorStyleRules: Array>): void; /** * Return an array of StyleRules with only the style that need to be applied */ getStyleRule(state: Array>, styleType: StyleType): LKStyleRule[]; initNodeColors(nodeRules: Array>): void; initNodesIcons(nodeRules: Array>): void; initNodesSizes(nodeRules: Array>): void; initNodesShapes(nodeRules: Array>): void; initEdgesWidth(edgeRules: Array>): void; initEdgesShape(edgeRules: Array>): void; initEdgesColor(edgeRules: Array>): void; /** * Create / refresh an ogma rule for node icons * * @param {Array} iconStyleRules */ refreshNodeIcons(iconStyleRules: Array>): void; /** * Create / refresh an ogma rule for node sizes * * @param {Array} sizeStyleRules */ refreshNodeSize(sizeStyleRules: Array>): void; /** * Create / refresh an ogma rule for node images * * @param {Array} shapeStyleRules */ refreshNodeShape(shapeStyleRules: Array>): void; /** * Create / refresh an ogma rule for edge colors */ refreshEdgeColors(colorStyleRules: Array>): void; /** * Create / refresh an ogma rule for edge width * * @param {Array} widthStyleRules */ refreshEdgeWidth(widthStyleRules: Array>): void; /** * Create / refresh an ogma rule for edge width * * @param {Array} shapeStyleRules */ refreshEdgeShape(shapeStyleRules: Array>): void; /** * Calculate the scale of the pin badge related to the node radius * This is useful when dealing wih huge nodes, and we don't want the badge to be big * If the node is small enough, the badge will be 0.46 of the node radius * Else it will be 5 / radius */ private _findPinBadgeScale; /** * Get node radius * This is a workaround for an ogma issue where the radius of virtual nodes is always set to 5.x * The issue is still present in Ogma 5.2 */ private _getNodeRadius; /** * Helper to get the counter badge attribute */ private _getCounterBadge; /** * Helper to get the pin badge attribute */ private _getPinBadge; }