API for rete-auto-arrange-plugin package - Rete.js

API for rete-auto-arrange-plugin package

AutoArrangePlugin

index.ts

Auto arrange plugin. Layouts the graph using elk.js

ts
class AutoArrangePlugin<Schemes extends ExpectedSchemes, T extends unknown>
ParameterExtendsDescription
SchemesExpectedSchemes
Tunknown

Extends Scope<never, BaseArea | T, Root>

addPreset

index.ts

Adds a preset to the plugin, which will be used to layout the node ports and customize the layout options

ts
addPreset(preset: Preset): void
ParameterTypeDescription
presetPresetPreset to add

Returns void

layout

index.ts

Method to layout the graph

ts
layout(props: { applier: Applier<Schemes, T>, options: LayoutOptions } & Partial<Context<Schemes>>): Promise<{ demonstration: string, result: ElkNode, source: string }>
ParameterTypeDescription
props{ applier: Applier<Schemes, T>, options: LayoutOptions } & Partial<Context<Schemes>>Options for the layout

Returns Promise<{ demonstration: string, result: ElkNode, source: string }> Debug information about the layout

ArrangeAppliers

appliers/index.ts

StandardApplier

appliers/list/standard.ts

Standard applier. Applies the layout to the nodes and their children immediately

ts
class StandardApplier<S extends ExpectedSchemes, K extends unknown>
ParameterExtendsDescription
SExpectedSchemes
Kunknown

Extended by TransitionApplier

Extends Applier<S, K>

TransitionApplier

appliers/list/transition/index.ts

Transition applier. Applies the layout to the nodes and their children with transition

ts
class TransitionApplier<S extends ExpectedSchemes, K extends unknown>
ParameterExtendsDescription
SExpectedSchemes
Kunknown

Extends StandardApplier<S, K>

constructor

appliers/list/transition/index.ts

ts
constructor(props: TransitionApplierProps): TransitionApplier<S, K>
ParameterTypeDescription
propsTransitionApplierPropsTransition applier props

Returns TransitionApplier<S, K>

TransitionApplierProps

appliers/list/transition/index.ts

Transition applier props

ts
type TransitionApplierProps = {
  duration: number;
  needsLayout: Function;
  onTick: Function;
  timingFunction: Function;
};

Presets

presets/index.ts

Built-in presets. Responsible for node port positioning.

classic

presets/classic/index.ts

setup

presets/classic/index.ts

Classic preset. Input ports are positioned on the left bottom side of the node, output ports are positioned on the right top side of the node.

ts
setup(props: { bottom: number, spacing: number, top: number }): Preset
ParameterTypeDescription
props{ bottom: number, spacing: number, top: number }

Returns Preset