API for rete-react-plugin package - Rete.js

API for rete-react-plugin package

ReactPlugin

src/index.tsx

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

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

Extends Scope<Produces, Requires | T>

Emits connectionpath

Listens render unmount

addPreset

src/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

src/index.tsx

Signals that can be emitted by the plugin

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

Presets

src/presets/index.ts

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

classic

src/presets/classic/index.tsx

setup

src/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

src/presets/context-menu/index.tsx

setup

src/presets/context-menu/index.tsx

Preset for rendering context menu.

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

Returns RenderPreset<Schemes, K>

minimap

src/presets/minimap/index.tsx

setup

src/presets/minimap/index.tsx

Preset for rendering minimap.

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

Returns RenderPreset<Schemes, K>

reroute

src/presets/reroute-pins/index.tsx

setup

src/presets/reroute-pins/index.tsx

Preset for rendering pins.

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

Returns RenderPreset<Schemes, K>

Props

src/index.tsx

Plugin props

ts
type Props = { createRoot: Function };

RefComponent

src/ref-component.tsx

Component for rendering various elements embedded in the React.js component tree.

ts
RefComponent(__namedParameters: Props): Element
ParameterTypeDescription
__namedParametersProps

Returns Element