Refactor(types): unify node and edge handling (#3978)
* refactor(types): unify node and edge type behaviour * chore(changelogs): update * chore(examples): cleanup
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
import { Position, type NodeProps } from '@xyflow/system';
|
||||
import { Position } from '@xyflow/system';
|
||||
|
||||
import { Handle } from '../../components/Handle';
|
||||
import type { BuiltInNode, NodeProps } from '../../types/nodes';
|
||||
|
||||
export function DefaultNode({
|
||||
data,
|
||||
isConnectable,
|
||||
targetPosition = Position.Top,
|
||||
sourcePosition = Position.Bottom,
|
||||
}: NodeProps) {
|
||||
}: NodeProps<BuiltInNode>) {
|
||||
return (
|
||||
<>
|
||||
<Handle type="target" position={targetPosition} isConnectable={isConnectable} />
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Position, type NodeProps } from '@xyflow/system';
|
||||
import { Position } from '@xyflow/system';
|
||||
|
||||
import { Handle } from '../../components/Handle';
|
||||
import type { BuiltInNode, NodeProps } from '../../types/nodes';
|
||||
|
||||
export function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }: NodeProps) {
|
||||
export function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }: NodeProps<BuiltInNode>) {
|
||||
return (
|
||||
<>
|
||||
{data?.label}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Position, type NodeProps } from '@xyflow/system';
|
||||
import { Position } from '@xyflow/system';
|
||||
|
||||
import { Handle } from '../../components/Handle';
|
||||
import type { BuiltInNode, NodeProps } from '../../types/nodes';
|
||||
|
||||
export function OutputNode({ data, isConnectable, targetPosition = Position.Top }: NodeProps) {
|
||||
export function OutputNode({ data, isConnectable, targetPosition = Position.Top }: NodeProps<BuiltInNode>) {
|
||||
return (
|
||||
<>
|
||||
<Handle type="target" position={targetPosition} isConnectable={isConnectable} />
|
||||
|
||||
Reference in New Issue
Block a user