LiveFlow.Types (LiveFlow v0.4.0)

Copy Markdown View Source

Type definitions for LiveFlow.

This module contains all the base types used throughout the LiveFlow library.

Summary

Types

Background pattern type

Bounding box with min/max coordinates

Connection mode for edges

2D coordinate point

Dimensions of an element

Edge marker configuration

Type of edge path rendering

Extent constraint for node movement

Type of handle (source emits connections, target receives)

Unique identifier for nodes and edges

Marker type for edge endpoints

Node type identifier

Position of a handle on a node

Rectangle with position and dimensions

Functions

Checks if a position is horizontal (left or right).

Returns the opposite position.

Checks if a position is vertical (top or bottom).

Types

background_pattern()

@type background_pattern() :: :dots | :lines | :cross | nil

Background pattern type

bounds()

@type bounds() :: %{min: coordinate(), max: coordinate()}

Bounding box with min/max coordinates

connection_mode()

@type connection_mode() :: :strict | :loose

Connection mode for edges

coordinate()

@type coordinate() :: %{x: number(), y: number()}

2D coordinate point

dimensions()

@type dimensions() :: %{width: number(), height: number()}

Dimensions of an element

edge_marker()

@type edge_marker() :: %{
  optional(:type) => marker_type(),
  optional(:color) => String.t(),
  optional(:width) => number(),
  optional(:height) => number(),
  optional(:stroke_width) => number()
}

Edge marker configuration

edge_type()

@type edge_type() :: :bezier | :straight | :step | :smoothstep | atom()

Type of edge path rendering

extent()

@type extent() :: :parent | bounds() | nil

Extent constraint for node movement

handle_type()

@type handle_type() :: :source | :target

Type of handle (source emits connections, target receives)

id()

@type id() :: String.t()

Unique identifier for nodes and edges

marker_type()

@type marker_type() ::
  :arrow
  | :arrow_closed
  | :circle
  | :circle_filled
  | :diamond
  | :diamond_filled
  | :none
  | atom()

Marker type for edge endpoints

node_type()

@type node_type() :: :default | :input | :output | atom()

Node type identifier

position()

@type position() :: :top | :bottom | :left | :right

Position of a handle on a node

rect()

@type rect() :: %{x: number(), y: number(), width: number(), height: number()}

Rectangle with position and dimensions

Functions

horizontal?(arg1)

@spec horizontal?(position()) :: boolean()

Checks if a position is horizontal (left or right).

opposite_position(atom)

@spec opposite_position(position()) :: position()

Returns the opposite position.

Examples

iex> LiveFlow.Types.opposite_position(:top)
:bottom

iex> LiveFlow.Types.opposite_position(:left)
:right

vertical?(arg1)

@spec vertical?(position()) :: boolean()

Checks if a position is vertical (top or bottom).