UNPKG

@xyflow/svelte

Version:

Svelte Flow - A highly customizable Svelte library for building node-based editors, workflow systems, diagrams and more.

39 lines (38 loc) 1.61 kB
import type { Component } from 'svelte'; import type { ClassValue, HTMLAttributes, DOMAttributes } from 'svelte/elements'; import type { InternalNodeBase, NodeBase, NodeProps as NodePropsBase } from '@xyflow/system'; /** * The node data structure that gets used for internal nodes. * There are some data structures added under node.internal * that are needed for tracking some properties * @public */ export type InternalNode<NodeType extends Node = Node> = InternalNodeBase<NodeType>; /** * The node data structure that gets used for the nodes prop. * @public */ export type Node<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = NodeBase<NodeData, NodeType> & { class?: ClassValue; style?: string; focusable?: boolean; /** * The ARIA role attribute for the node element, used for accessibility. * @default "group" */ ariaRole?: HTMLAttributes<HTMLDivElement>['role']; /** * General escape hatch for adding custom attributes to the node's DOM element. */ domAttributes?: Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'style' | 'class' | 'draggable' | 'role' | 'aria-label' | 'dangerouslySetInnerHTML' | keyof DOMAttributes<HTMLDivElement>>; }; export type NodeProps<NodeType extends Node = Node> = NodePropsBase<NodeType> & { type: any; }; export type NodeTypes = Record<string, Component<NodeProps & { data: any; type: any; }>>; export type BuiltInNode = Node<{ label: string; }, 'input' | 'output' | 'default'> | Node<Record<string, never>, 'group'>;