add hw2
This commit is contained in:
53
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.d.ts
generated
vendored
Normal file
53
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import cytoscape from 'cytoscape';
|
||||
import type { LayoutData, Node, Edge } from '../../types.js';
|
||||
import type { PositionedNode, PositionedEdge } from './types.js';
|
||||
/**
|
||||
* Declare module augmentation for cytoscape edge types
|
||||
*/
|
||||
declare module 'cytoscape' {
|
||||
interface EdgeSingular {
|
||||
_private: {
|
||||
bodyBounds: unknown;
|
||||
rscratch: {
|
||||
startX: number;
|
||||
startY: number;
|
||||
midX: number;
|
||||
midY: number;
|
||||
endX: number;
|
||||
endY: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add nodes to cytoscape instance from provided node array
|
||||
* This function processes only the nodes provided in the data structure
|
||||
* @param nodes - Array of nodes to add
|
||||
* @param cy - The cytoscape instance
|
||||
*/
|
||||
export declare function addNodes(nodes: Node[], cy: cytoscape.Core): void;
|
||||
/**
|
||||
* Add edges to cytoscape instance from provided edge array
|
||||
* This function processes only the edges provided in the data structure
|
||||
* @param edges - Array of edges to add
|
||||
* @param cy - The cytoscape instance
|
||||
*/
|
||||
export declare function addEdges(edges: Edge[], cy: cytoscape.Core): void;
|
||||
/**
|
||||
* Create and configure cytoscape instance
|
||||
* @param data - Layout data containing nodes and edges
|
||||
* @returns Promise resolving to configured cytoscape instance
|
||||
*/
|
||||
export declare function createCytoscapeInstance(data: LayoutData): Promise<cytoscape.Core>;
|
||||
/**
|
||||
* Extract positioned nodes from cytoscape instance
|
||||
* @param cy - The cytoscape instance after layout
|
||||
* @returns Array of positioned nodes
|
||||
*/
|
||||
export declare function extractPositionedNodes(cy: cytoscape.Core): PositionedNode[];
|
||||
/**
|
||||
* Extract positioned edges from cytoscape instance
|
||||
* @param cy - The cytoscape instance after layout
|
||||
* @returns Array of positioned edges
|
||||
*/
|
||||
export declare function extractPositionedEdges(cy: cytoscape.Core): PositionedEdge[];
|
||||
1
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.test.d.ts
generated
vendored
Normal file
1
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/cytoscape-setup.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
22
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/index.d.ts
generated
vendored
Normal file
22
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Cose-Bilkent Layout Algorithm for Generic Diagrams
|
||||
*
|
||||
* This module provides a layout algorithm implementation using Cytoscape
|
||||
* with the cose-bilkent algorithm for positioning nodes and edges.
|
||||
*
|
||||
* The algorithm follows the unified rendering pattern and can be used
|
||||
* by any diagram type that provides compatible LayoutData.
|
||||
*/
|
||||
/**
|
||||
* Render function for the cose-bilkent layout algorithm
|
||||
*
|
||||
* This function follows the unified rendering pattern used by all layout algorithms.
|
||||
* It takes LayoutData, inserts nodes into DOM, runs the cose-bilkent layout algorithm,
|
||||
* and renders the positioned elements to the SVG.
|
||||
*
|
||||
* @param layoutData - Layout data containing nodes, edges, and configuration
|
||||
* @param svg - SVG element to render to
|
||||
* @param helpers - Internal helper functions for rendering
|
||||
* @param options - Rendering options
|
||||
*/
|
||||
export declare const render: (data4Layout: import("../../types.js").LayoutData, svg: import("../../../mermaid.js").SVG, { insertCluster, insertEdge, insertEdgeLabel, insertMarkers, insertNode, log, positionEdgeLabel, }: import("../../../internals.js").InternalHelpers, { algorithm: _algorithm }: import("../../render.js").RenderOptions) => Promise<void>;
|
||||
20
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.d.ts
generated
vendored
Normal file
20
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { MermaidConfig } from '../../../config.type.js';
|
||||
import type { LayoutData } from '../../types.js';
|
||||
import type { LayoutResult } from './types.js';
|
||||
/**
|
||||
* Execute the cose-bilkent layout algorithm on generic layout data
|
||||
*
|
||||
* This function takes layout data and uses Cytoscape with the cose-bilkent
|
||||
* algorithm to calculate optimal node positions and edge paths.
|
||||
*
|
||||
* @param data - The layout data containing nodes, edges, and configuration
|
||||
* @param config - Mermaid configuration object
|
||||
* @returns Promise resolving to layout result with positioned nodes and edges
|
||||
*/
|
||||
export declare function executeCoseBilkentLayout(data: LayoutData, _config: MermaidConfig): Promise<LayoutResult>;
|
||||
/**
|
||||
* Validate layout data structure
|
||||
* @param data - The data to validate
|
||||
* @returns True if data is valid, throws error otherwise
|
||||
*/
|
||||
export declare function validateLayoutData(data: LayoutData): boolean;
|
||||
1
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.test.d.ts
generated
vendored
Normal file
1
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/layout.test.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
10
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/render.d.ts
generated
vendored
Normal file
10
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/render.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { InternalHelpers, LayoutData, RenderOptions, SVG } from 'mermaid';
|
||||
/**
|
||||
* Render function for cose-bilkent layout algorithm
|
||||
*
|
||||
* This follows the same pattern as ELK and dagre renderers:
|
||||
* 1. Insert nodes into DOM to get their actual dimensions
|
||||
* 2. Run the layout algorithm to calculate positions
|
||||
* 3. Position the nodes and edges based on layout results
|
||||
*/
|
||||
export declare const render: (data4Layout: LayoutData, svg: SVG, { insertCluster, insertEdge, insertEdgeLabel, insertMarkers, insertNode, log, positionEdgeLabel, }: InternalHelpers, { algorithm: _algorithm }: RenderOptions) => Promise<void>;
|
||||
40
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/types.d.ts
generated
vendored
Normal file
40
node_modules/mermaid/dist/rendering-util/layout-algorithms/cose-bilkent/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Positioned node after layout calculation
|
||||
*/
|
||||
export interface PositionedNode {
|
||||
id: string;
|
||||
x: number;
|
||||
y: number;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Positioned edge after layout calculation
|
||||
*/
|
||||
export interface PositionedEdge {
|
||||
id: string;
|
||||
source: string;
|
||||
target: string;
|
||||
startX: number;
|
||||
startY: number;
|
||||
midX: number;
|
||||
midY: number;
|
||||
endX: number;
|
||||
endY: number;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
/**
|
||||
* Result of layout algorithm execution
|
||||
*/
|
||||
export interface LayoutResult {
|
||||
nodes: PositionedNode[];
|
||||
edges: PositionedEdge[];
|
||||
}
|
||||
/**
|
||||
* Cytoscape layout configuration
|
||||
*/
|
||||
export interface CytoscapeLayoutConfig {
|
||||
name: 'cose-bilkent';
|
||||
quality: 'proof';
|
||||
styleEnabled: boolean;
|
||||
animate: boolean;
|
||||
}
|
||||
1
node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/index.d.ts
generated
vendored
Normal file
1
node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export function render(data4Layout: any, svg: any): Promise<void>;
|
||||
8
node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/mermaid-graphlib.d.ts
generated
vendored
Normal file
8
node_modules/mermaid/dist/rendering-util/layout-algorithms/dagre/mermaid-graphlib.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export let clusterDb: Map<any, any>;
|
||||
export function clear(): void;
|
||||
export function extractDescendants(id: any, graph: any): any[];
|
||||
export function validate(graph: any): boolean;
|
||||
export function findNonClusterChild(id: any, graph: any, clusterId: any): any;
|
||||
export function adjustClustersAndEdges(graph: any, depth: any): void;
|
||||
export function extractor(graph: any, depth: any): void;
|
||||
export function sortNodesByHierarchy(graph: any): any;
|
||||
Reference in New Issue
Block a user