API for @retejs/lit-plugin package - Rete.js

API for @retejs/lit-plugin package

LitPlugin

index.tsx

React plugin. Renders nodes, connections and other elements using React.

ts
class LitPlugin<Schemes extends BaseSchemes, T extends unknown>
ParameterExtendsDescription
SchemesBaseSchemes
Tunknown

Extends Scope<Produces, Requires | T>

Emits connectionpath

Listens render unmount

addPreset

index.tsx

Adds a preset to the plugin.

ts
addPreset(preset: RenderPreset<Schemes, CanAssignEachTupleElemmentToAnyOf<T, UnionToTuple<K>> extends true ? K : "Cannot apply preset. Provided signals are not compatible">): void
ParameterTypeDescription
presetRenderPreset<Schemes, CanAssignEachTupleElemmentToAnyOf<T, UnionToTuple<K>> extends true ? K : "Cannot apply preset. Provided signals are not compatible">Preset that can render nodes, connections and other elements.

Returns void

Produces

index.tsx

Signals that can be emitted by the plugin

ts
type Produces<Schemes extends BaseSchemes> = {
  data: Object;
  type: "connectionpath";
};
ParameterExtendsDescription
SchemesBaseSchemes

Presets

presets/index.ts

Built-in presets, responsible for rendering different parts of the editor.

classic

presets/classic/index.tsx

setup

presets/classic/index.tsx

Classic preset for rendering nodes, connections, controls and sockets.

ts
setup(props: ClassicProps<Schemes, K>): RenderPreset<Schemes, K>
ParameterTypeDescription
propsClassicProps<Schemes, K>

Returns RenderPreset<Schemes, K>

contextMenu

presets/context-menu/index.ts

setup

presets/context-menu/index.ts

Preset for rendering context menu.

ts
setup(props: { delay: number }): RenderPreset<Schemes, K>
ParameterTypeDescription
props{ delay: number }

Returns RenderPreset<Schemes, K>

minimap

presets/minimap/index.ts

setup

presets/minimap/index.ts

Preset for rendering minimap.

ts
setup(props: { size: number }): RenderPreset<Schemes, K>
ParameterTypeDescription
props{ size: number }

Returns RenderPreset<Schemes, K>

reroute

presets/reroute/index.ts

setup

presets/reroute/index.ts

Preset for rendering pins.

ts
setup(props: Props): RenderPreset<Schemes, K>
ParameterTypeDescription
propsProps

Returns RenderPreset<Schemes, K>