UNPKG

jsmind

Version:

jsMind is a pure javascript library for mindmap, it base on html5 canvas. jsMind was released under BSD license, you can embed it in any project, if only you observe the license.

101 lines (100 loc) 2.76 kB
/** * Mind data format handlers. * @type {{ * node_tree: { example:NodeTreeFormat, get_mind:(src:NodeTreeFormat)=>Mind, get_data:(mind:Mind)=>NodeTreeFormat }, * node_array: { example:NodeArrayFormat, get_mind:(src:NodeArrayFormat)=>Mind, get_data:(mind:Mind)=>NodeArrayFormat }, * freemind: { example:{meta:MindMapMeta,format:'freemind',data:string}, get_mind:(src:{meta?:MindMapMeta,format:'freemind',data:string})=>Mind, get_data:(mind:Mind)=>{meta:MindMapMeta,format:'freemind',data:string} }, * text: { example:{meta:MindMapMeta,format:'text',data:string}, get_mind:(src:{meta?:MindMapMeta,format:'text',data:string})=>Mind, get_data:(mind:Mind)=>{meta:MindMapMeta,format:'text',data:string} } * }} */ export const format: { node_tree: { example: NodeTreeFormat; get_mind: (src: NodeTreeFormat) => Mind; get_data: (mind: Mind) => NodeTreeFormat; }; node_array: { example: NodeArrayFormat; get_mind: (src: NodeArrayFormat) => Mind; get_data: (mind: Mind) => NodeArrayFormat; }; freemind: { example: { meta: MindMapMeta; format: "freemind"; data: string; }; get_mind: (src: { meta?: MindMapMeta; format: "freemind"; data: string; }) => Mind; get_data: (mind: Mind) => { meta: MindMapMeta; format: "freemind"; data: string; }; }; text: { example: { meta: MindMapMeta; format: "text"; data: string; }; get_mind: (src: { meta?: MindMapMeta; format: "text"; data: string; }) => Mind; get_data: (mind: Mind) => { meta: MindMapMeta; format: "text"; data: string; }; }; }; export type MindMapMeta = { name: string; author: string; version: string; }; /** * Node tree data item */ export type NodeTreeData = { id: string; topic: string; data?: Record<string, any>; direction?: (number | string); expanded?: boolean; children?: NodeTreeData[]; }; /** * Node tree formatted payload */ export type NodeTreeFormat = { meta?: MindMapMeta; format: "node_tree"; data: NodeTreeData; }; /** * Node array data item */ export type NodeArrayItem = { id: string; topic: string; parentid?: string; data?: Record<string, any>; direction?: (number | string); expanded?: boolean; isroot?: boolean; }; /** * Node array formatted payload */ export type NodeArrayFormat = { meta?: MindMapMeta; format: "node_array"; data: NodeArrayItem[]; }; import { Mind } from './jsmind.mind.js';