Zum Hauptinhalt springen

MindElixir class

Home > mind-elixir > MindElixir

MindElixir class​

Signature:

declare class MindElixir<M = any>

Constructors​

Constructor

Modifiers

Description

(constructor)({ el, direction, rtl, editable, contextMenu, toolBar, keypress, mouseSelectionButton, selectionContainer, before, newTopicName, allowUndo, generateMainBranch, generateSubBranch, overflowHidden, compact, theme, alignment, scaleSensitivity, scaleMax, scaleMin, handleWheel, markdown, imageProxy, pasteHandler, mobileMultiSelect, })

Constructs a new instance of the MindElixir class

Properties​

Property

Modifiers

Type

Description

addChild

(el?: Topic<M> | undefined, node?: NodeObj<M> | undefined) => Promise<void>

alignment

Alignment

allowUndo

boolean

arrows

Arrow<M>[]

arrowSvg

SVGElement

before

Before

beginEdit

(el?: Topic<M> | undefined) => Promise<void>

bus

ReturnType<typeof createBus<EventMap>>

cancelFocus

() => void

changeCompact

(compact: boolean) => void

changeTheme

(theme: Theme<M>, shouldRefresh?: boolean) => void

clearHistory?

() => void

(Optional) Reset the undo/redo stack and update the internal baseline snapshot to the current diagram state. Call this after loading new data into an existing instance (e.g. after refresh()) to prevent users from undoing back into a previously loaded diagram.

Also called automatically by focusNode / cancelFocus: focus mode swaps the rendered document, so history from before the switch is not replayable.

Only available when allowUndo is true (the default).

clearSelection

() => void

compact

boolean

container

HTMLElement

contextMenu

boolean | ContextMenuOption

copyNodes

(tpcs: Topic<M>[], to: Topic<M>) => Promise<void>

createArrow

(from: Topic<M>, to: Topic<M>, options?: ArrowOptions) => void

createArrowFrom

(arrow: Omit<Arrow<M>, 'id'>) => void

createChildren

(wrappers: Wrapper[]) => Children

createParent

(nodeObj: NodeObj<M>) => { p: Parent; tpc: Topic<M>; }

createSummary

(options?: SummaryOptions) => void

createSummaryFrom

(summary: Omit<Summary, 'id'>) => void

createTopic

(nodeObj: NodeObj<M>) => Topic<M>

createWrapper

(nodeObj: NodeObj<M>, omitChildren?: boolean) => { grp: Wrapper; top: Parent; tpc: Topic<M>; }

currentArrow

ArrowSvg | null

currentNode

readonly

Topic<M> | null

currentNodes

Topic<M>[]

currentSummary

SummarySvg | null

DARK_THEME

static

readonly

Theme & { cssVar: ThemeCssVar; }

destroy

() => void

diffRefresh

(data: MindElixirData<M>) => boolean

Install a document like does, but apply only the difference — unchanged nodes keep their element, listeners and measured size, and the map is never re-laid-out from scratch. Installed by default; returns false (after falling back to refresh) for changes that cannot be expressed locally. See plugin/diffRefresh.

refresh itself is untouched — this is an additional entry point beside it, aimed at undo/redo and progressive (streaming) output.

direction

0 | 1 | 2 | 3

disableEdit

() => void

disposable

Array<() => void>

DOWN

static

readonly

(not declared)

dragged

Topic<M>[] | null

E

static

typeof findEle

MindElixir E

editable

boolean

editArrowLabel

(el: ArrowSvg) => void

editSummary

(el: SummarySvg) => void

editTopic

(el: Topic<M>) => void

el

HTMLElement

enableEdit

() => void

enableMobileMultiSelect

(enable: boolean) => void

expandNode

(el: Topic<M>, isExpand?: boolean, options?: ExpandNodeOptions) => void

expandNodeAll

(el: Topic<M>, isExpand?: boolean, options?: ExpandNodeOptions) => void

findEle

(id: string, el?: HTMLElement) => Topic<M>

focusNode

(el: Topic<M>) => void

generateMainBranch

(this: MindElixir<M>, params: MainLineParams) => string

generateNewObj

() => NodeObjExport<M>

generateSubBranch

(this: MindElixir<M>, params: SubLineParams) => string

getData

() => MindElixirData<M>

getDataString

() => string

getObjById

(id: string, data: NodeObj<M>) => NodeObj<M> | null

handleWheel

true | ((e: WheelEvent) => void)

historyStack?

HistoryStack

(Optional) Shared undo/redo journal, created by the operation-history plugin during init (when allowUndo is enabled). Pass it to another document — e.g. an Outliner — so both interleave on ONE undo/redo timeline. Available after init resolves.

imageProxy?

(url: string) => string

(Optional)

init

(data: MindElixirData<M>) => Promise<Error | undefined>

initDown

() => void

initLeft

() => void

initRight

() => void

initSide

() => void

insertParent

(el?: Topic<M> | undefined, node?: NodeObj<M> | undefined) => Promise<void>

insertSibling

(type: 'before' | 'after', el?: Topic<M> | undefined, node?: NodeObj<M> | undefined) => Promise<void>

install

(plugin: (instance: MindElixir<M>) => void) => void

isFocusMode

boolean

keypress

boolean | KeypressOptions

labelContainer

HTMLElement

layout

() => void

LEFT

static

readonly

(not declared)

line1

SVGElement

line2

SVGElement

lines

SVGElement

linkController

SVGElement

linkDiv

(mainNode?: Wrapper) => void

map

HTMLElement

markdown?

(markdown: string, obj: NodeObj<M> | Arrow<M> | Summary) => string

(Optional)

meta?

Record<string, any>

(Optional)

mobileMultiSelect

boolean

mouseSelectionButton

0 | 2

move

(dx: number, dy: number, smooth?: boolean) => boolean

moveDownNode

(el?: Topic<M> | undefined) => Promise<void>

moveNodesAfter

(from: Topic<M>[], to: Topic<M>) => Promise<void>

moveNodesBefore

(from: Topic<M>[], to: Topic<M>) => Promise<void>

moveNodesIn

(from: Topic<M>[], to: Topic<M>) => Promise<void>

moveUpNode

(el?: Topic<M> | undefined) => Promise<void>

new

static

<M_1 = unknown>(topic: string) => MindElixirData<M_1>

new MindElixir

newTopicName

string

nodeData

NodeObj<M>

nodeDataBackup

NodeObj<M>

nodes

HTMLElement

overflowHidden

boolean

P2

HTMLElement

P3

HTMLElement

panHelper

ReturnType<typeof createPanHelper>

pasteHandler

(e: ClipboardEvent) => void

ptState?

number

(Optional)

redo

() => void

refresh

(data?: MindElixirData<M>) => void

removeArrow

(linkSvg?: ArrowSvg) => void

removeNodes

(tpcs: Topic<M>[]) => Promise<void>

removeSummary

(id: string) => void

renderArrow

() => void

renderSummary

() => void

reshapeArrow

(arrow: Arrow<M>, patchData: Partial<Arrow<M>>) => void

reshapeNode

(tpc: Topic<M>, patchData: Partial<NodeObj<M>>) => Promise<void>

RIGHT

static

readonly

(not declared)

rmSubline

(tpc: Topic<M>) => Promise<void>

root

HTMLElement

rtl

boolean

scale

(scaleVal: number, offset?: { x: number; y: number; }) => void

scaleFit

() => void

scaleMax

number

scaleMin

number

scaleSensitivity

number

scaleVal

number

scrollIntoView

(el: HTMLElement, forceCenter?: boolean) => void

selectArrow

(link: ArrowSvg) => void

selection

SelectionArea

selectionContainer

string | HTMLElement

selectNode

(tpc: Topic<M>, isNewNode?: boolean, e?: MouseEvent) => void

selectNodes

(tpcs: Topic<M>[]) => void

selectSummary

(el: SummarySvg) => void

setNodeTopic

(el: Topic<M>, topic: string) => Promise<void>

SIDE

static

readonly

(not declared)

spacePressed

boolean

stringifyData

(data: object) => string

summaries

Summary[]

summarySvg

SVGElement

tempDirection

0 | 1 | 2 | 3 | null

theme

ResolvedTheme<M>

THEME

static

readonly

Theme & { cssVar: ThemeCssVar; }

tidyArrow

() => void

toCenter

() => void

toolBar

boolean

undo

() => void

unselectArrow

() => void

unselectNodes

(tpcs: Topic<M>[]) => void

unselectSummary

() => void

version

static

string

MindElixir