UNPKG

mind-elixir

Version:

Mind elixir is a free open source mind map core.

91 lines (90 loc) 2.64 kB
import { LEFT, RIGHT } from '../const'; import { type NodeObj } from '../types/index'; /** * Server-side compatible layout data structure */ export interface SSRLayoutNode { id: string; topic: string; direction?: typeof LEFT | typeof RIGHT; style?: { fontSize?: string; color?: string; background?: string; fontWeight?: string; }; children?: SSRLayoutNode[]; tags?: string[]; icons?: string[]; hyperLink?: string; expanded?: boolean; image?: { url: string; width: number; height: number; fit?: 'fill' | 'contain' | 'cover'; }; branchColor?: string; dangerouslySetInnerHTML?: string; note?: string; } /** * SSR Layout result structure */ export interface SSRLayoutResult { root: SSRLayoutNode; leftNodes: SSRLayoutNode[]; rightNodes: SSRLayoutNode[]; direction: number; } /** * SSR Layout options */ export interface SSRLayoutOptions { direction?: number; newTopicName?: string; } /** * Server-side compatible layout function for SSR * This function processes the mind map data structure without DOM manipulation * * @param nodeData - The root node data * @param options - Layout options including direction * @returns Structured layout data for server-side rendering */ export declare const layoutSSR: (nodeData: NodeObj, options?: SSRLayoutOptions) => SSRLayoutResult; /** * Generate HTML string for server-side rendering * This function creates the HTML structure that would be generated by the DOM-based layout * * @param layoutResult - The result from layoutSSR function * @param options - Additional rendering options * @returns HTML string for server-side rendering */ export declare const renderSSRHTML: (layoutResult: SSRLayoutResult, options?: { className?: string; }) => string; /** * Generate JSON data structure for client-side hydration * This can be used to pass the layout data to the client for hydration * * @param layoutResult - The result from layoutSSR function * @returns JSON-serializable data structure */ export declare const getSSRData: (layoutResult: SSRLayoutResult) => string; /** * Hydration data structure for client-side initialization */ export interface HydrationData { nodeData: NodeObj; layoutResult: SSRLayoutResult; options: { direction: number; [key: string]: any; }; timestamp: number; } /** * Generate complete hydration data including original nodeData */ export declare const getHydrationData: (nodeData: NodeObj, layoutResult: SSRLayoutResult, options?: any) => HydrationData;