text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>should('have.been.callCount', 1); cy.get('@onChangeSpy').should('have.been.callCount', 1); cy.get('@onEndSpy').should('have.been.callCount', 1); expect(getLatestViewport(onChangeSpy).zoom).to.be.lt(1); }); }); it('handles default viewport', () => { const defaultViewport = {...
fim
xyflow/xyflow
typescript
<|fim_suffix|>tViewport(onChangeSpy: any) { return onChangeSpy.lastCall.args[0] as unknown as Viewport; } <|fim_prefix|>import { ReactFlow, useViewport, Viewport } from '@xyflow/react'; describe('useViewport.cy.tsx', () => { it('handles drag', () => { const onChangeSpy = cy.spy().as('onChangeSpy'); cy.mou...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, EdgeProps } from '@xyflow/react'; import ControlledFlow from '../../support/ControlledFlow'; import * as simpleflow from '../../fixtures/simpleflow'; describe('<ReactFlow />: Basic Props', () => { describe('uses defaultNodes and defaultEdges', () => { beforeEach(() => { c...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { skipOn } from '@cypress/skip-test'; import { nodes, edges } from '../../fixtures/simpleflow'; import ControlledFlow from '../../support/ControlledFlow'; describe('<ReactFlow />: Event handlers', () => { describe('Node event handlers', () => { it('handles onInit', () => { const onIni...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, BaseEdge, EdgeLabelRenderer, EdgeProps, getSmoot<|fim_suffix|>ithin(() => { cy.get('.label').should('have.length', 1).should('contain.text', 'edge2'); }); }); }); }); <|fim_middle|>hStepPath, ReactFlowProvider } from '@xyflow/react'; import * as simpleflow from ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback, useState } from 'react'; import { OnNodesChange, Panel, ReactFlow, ReactFlowProps, applyNodeChanges, useReactFlow, Node } from '@xyflow/react'; const nodes = [ { id: '1', data: { label: 'Node 1' }, position: { x: 0, y: 0 }, style: { width: 100, height: 40 }, }, ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import React, { useCallback, useEffect, useLayoutEffect, useState } from 'react'; import { ReactFlow, ReactFlowProvider, useStoreApi, type Node, type Edge, type NodeTypes, type NodeProps } from '@xyflow/react'; import { edges as initialEdges } from '../../fixtures/simpleflow'; type CheckResult = { nodes...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFl<|fim_suffix|> node', () => { cy.get('.react-flow__node').first().click().should('have.class', 'selected'); cy.get('.react-flow__pane').click(); cy.get('.react-flow__node').first().should('not.have.class', 'selected'); }); it('drags a node', () => { const styleBeforeDr...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, ReactFlowProps, Viewport, useViewport, SnapGrid, CoordinateExtent, Node } from '@xyflow/react'; import ControlledFlow from '../../support/ControlledFlow'; import * as simpleflow from '../../fixtures/simpleflow'; const nodesOutsideOfView = [ { ...simpleflow.nodes[0], positio...
fim
xyflow/xyflow
typescript
import { adoptUserNodes, type NodeLookup, type ParentLookup } from '@xyflow/system'; import type { CoordinateExtent, Node, NodeOrigin } from '@xyflow/react'; describe('adoptUserNodes Testing', () => { it('builds node lookup', () => { const nodeLookup: NodeLookup = new Map(); const parentLookup: ParentLookup ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>nodeChanges: NodeChange[] = [ { type: 'dimensions', id: '1', dimensions: { width: newWidth, height: newHeight } }, ]; const nextNodes = applyNodeChanges(nodeChanges, nodes); expect(nodes[0].measured).to.be.undefined; expect(nextNodes[0].measured).to.be.deep.equal({ width: newWidth, ...
fim
xyflow/xyflow
typescript
<|fim_suffix|> position: { x: 200, y: 100 }, measured: { width: 100, height: 50 }, parentId: '1', }, { id: '3', data: { label: 'node' }, position: { x: 0, y: 200 }, measured: { width: 100, height: 50 }, parentId: '1', }, ]; adoptUse...
fim
xyflow/xyflow
typescript
<|fim_suffix|>> { it('tests isNode function', () => { expect(isNode(nodes[0])).to.be.true; expect(isNode(edges[0])).to.be.false; }); it('tests isEdge function', () => { expect(isEdge(edges[0])).to.be.true; expect(isEdge(nodes[0])).to.be.false; }); it('tests getOutgoers function', () => { ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>describe('Basic Flow Rendering', { testIsolation: false }, () => { before(() => { cy.visit('/'); }); it('renders a flow with three nodes', () => { cy.get('.react-flow__renderer'); cy.get('.react-flow-basic-example'); // check if className prop works cy.get('.react-flow__node').shoul...
fim
xyflow/xyflow
typescript
<|fim_prefix|>describe('Controls Testing', { testIsolation: false }, () => { before(() => { cy.visit('/'); }); it('renders the control panel', () => { cy.get('.react-flow__controls'); }); it('zooms in', () => { const styleBeforeZoom = Cypress.$('.react-flow__viewport').css('transform'); cy....
fim
xyflow/xyflow
typescript
<|fim_prefix|>describe('DragHandle Flow Rendering', { testIsolation: false }, () => { before(() => { cy.visit('/DragHandle'); }); it('render<|fim_suffix|>eact-flow__node:first'); const styleBeforeDrag = $nodeElement.css('transform'); cy.drag('.custom-drag-handle:first', { x: 500, y: 500 }).then(() =...
fim
xyflow/xyflow
typescript
<|fim_suffix|> it('adds two nodes', () => { cy.contains('add node').click(); cy.contains('add node').click(); }); it('connects nodes', () => { cy.get('.react-flow__node').first().find('.react-flow__handle.source').trigger('mousedown', { button: 0 }); cy.get('.react-flow__node') .last() ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>describe('Figma Flow UI', { testIsolation: false }, () => { before(() => { cy.visit('/figma'); }); it('renders <|fim_suffix|> cy.get('.react-flow__pane') .trigger('mousedown', 'center', { button: 2, view: win }) .trigger('mousemove', 'bottom', { force: true }) .wait(50)...
fim
xyflow/xyflow
typescript
<|fim_suffix|>eact-flow__minimap-node').should('not.exist'); }); it('toggles isHidden mode', () => { cy.get('.react-flow__ishidden').click(); }); it('renders initial flow', () => { cy.get('.react-flow__renderer'); cy.get('.react-flow__node').should('have.length', 4); cy.get('.react-flow__edge'...
fim
xyflow/xyflow
typescript
<|fim_suffix|>.get('.react-flow__zoomondbl').click(); }); it('zooms by double click', () => { cy.get('.react-flow__controls-zoomout').click(); const styleBeforeZoom = Cypress.$('.react-flow__viewport').css('transform'); cy.get('.react-flow__pane') .dblclick() .wait(50) .then(() => { ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>describe('Minimap Testing', { testIsolation: false }, () => { before(() => { cy.visit('/'); }); it('renders the mini map', () => { cy.get('.react-flow__minimap'); cy.get('.react-flow__minimap-mask'); }); it('has same number of nodes as the pane', () => { cy.get('.react-flow__mi...
fim
xyflow/xyflow
typescript
<|fim_suffix|>', data: { label: 'Node 2' }, position: { x: 200, y: 200 }, }, ]; export const edges: Edge[] = [ { id: 'e1', source: '1', target: '2', }, ]; <|fim_prefix|>import { Node, Edge } from <|fim_middle|>'@xyflow/react'; export const nodes: Node[] = [ { id: '1', data: { label...
fim
xyflow/xyflow
typescript
<|fim_suffix|> applyNodeChanges, applyEdgeChanges, Connection, addEdge, ReactFlowProps, } from '@xyflow/react'; function ControlledFlow({ addOnNodeChangeHandler = true, addOnEdgeChangeHandler = true, addOnConnectHandler = true, initialNodes = [], initialEdges = [], ...rest }: { initialNodes?: N...
fim
xyflow/xyflow
typescript
<|fim_prefix|>Cypress.Commands.add('drag', (selector, { x, y }) => cy.window().then((window) => { const elementToDrag = cy.get(selector as string); return elementToDrag.then(($el) => { const { left, top, width, height } = $el[0].getBoundingClientRect(); const centerX = left + width / 2; cons...
fim
xyflow/xyflow
typescript
<|fim_suffix|> isWithinViewport: () => Cypress.Chainable<JQuery<HTMLElement>>; isOutsideViewport: () => Cypress.Chainable<JQuery<HTMLElement>>; } } } Cypress.Commands.add('mount', mount); <|fim_prefix|>///<reference types="cypress" /> ///<reference types="@cypress/skip-test" /> ///<reference types="cy...
fim
xyflow/xyflow
typescript
<|fim_suffix|> configuration option. // // You can read more here: // https://on.cypress.io/configuration // *********************************************************** // Import commands.js using ES2015 syntax: import './commands'; import 'cypress-real-events/support'; const resizeObserverLoopErrRe = /^[^(ResizeObse...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { defineConfig } from 'cypress'; <|fim_suffix|> screenshotOnRunFailure: false, }, component: { devServer: { framework: 'react', bundler: 'vite', }, screenshotOnRunFailure: false, video: false, }, }); <|fim_middle|>export default defineConfig({ e2e: { base...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useEffect, useState } from 'react'; import { Outlet, useLocation, useNavigate } from 'react-router-dom'; import routes from './routes'; export default function Header() { const location = useLocation(); const navigate = useNavigate(); const pathParts = location.pathname.split('/')<|fim_s...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; import routes from './routes'; import GenericTestRoutes from '../generic-tests'; import Ba<|fim_suffix|>ute> <Route path="tests/generic/*" element={<GenericTestRoutes />} /> </Routes> </BrowserRouter> ); <|fim_middle|>...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import A11y from '../examples/A11y'; import Basic from '../examples/Basic'; import Backgrounds from '../examples/Backgrounds'; import BrokenNodes from '../examples/BrokenNodes'; import ColorMode from '../examples/ColorMode'; import ClickDistance from '../examples/ClickDistance'; import ControlledUncontrol...
fim
xyflow/xyflow
typescript
<|fim_suffix|>oundProps; controlsProps?: ControlProps; minimapProps?: MiniMapProps; } } <|fim_prefix|>import { BackgroundProps, ControlProps, Edge, MiniMapProps, Node, PanelProps, ReactFlowProps } from '@xyflow/react'; declare global { interface FlowConfig { flowProps?: Omit<ReactFlowProps, 'nodes' | '...
fim
xyflow/xyflow
typescript
<|fim_suffix|> > <Background variant={BackgroundVariant.Dots} /> <MiniMap /> <Controls /> <Panel position="top-right"> <div> <label htmlFor="focusPannable"> <input id="focusPannable" type="checkbox" checked={autoPanOnNodeF...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback, useRef } from 'react'; import { ReactFlow, useNodesState, useEdgesState, addEdge, useReactFlow, ReactFlowProvider, OnConnect, OnConnectStart, OnConnectEnd, Node, Edge, } from '@xyflow/react'; const initialNodes: Node[] = [ { id: '0', type: 'input', ...
fim
xyflow/xyflow
typescript
<|fim_suffix|> ))} </ReactFlow> </ReactFlowProvider> ); }; const Backgrounds: FC = () => ( <div className={styles.wrapper}> <Flow id="flow-a" bgProps={[{ variant: BackgroundVariant.Dots }]} /> <Flow id="flow-b" bgProps={[{ variant: BackgroundVariant.Lines, gap: [50, 50] }]} /> <Flow i...
fim
xyflow/xyflow
typescript
<|fim_suffix|>etEdges, deleteElements, updateNodeData, toObject, setViewport, fitView, } = useReactFlow(); const updatePos = () => { setNodes((nodes) => nodes.map((node) => { return { ...node, position: { x: Math.random() * 400, y: M...
fim
xyflow/xyflow
typescript
<|fim_suffix|>iaLabel: 'Input Node 1', }, { id: '2a', data: { label: 'Node 2' }, position: { x: 100, y: 100 }, className: 'light', ariaLabel: 'Default Node 2', }, { id: '3a', data: { label: 'Node 3' }, position: { x: 400, y: 100 }, className: 'light', }, { id: '4a', ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>show, })}> <div className={styles.progress} style={{ width: `${percentage}%`, }} /> Connection will be canceled in {remaining} seconds </div> ) }<|fim_prefix|>import cc from 'classcat'; import styles from './Timer.module.css'; interface Props { duration: number; re...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Edge, Node } from '@xyflow/react'; export const initialNodes: Node[] = [ { id: '1', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, className: 'light', }, { id: '2', data: { label: 'Node 2' }, position: { x: 100,<|fim_suffix|> }, ]; ex...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useRef, useState } from 'react'; const useCountdown = (callback: () => void) => { const interval = useRef<NodeJS.Timer>(); const [remaining, setRemaining] = useState(0); const start = (duration: number) => { setRemaining(duration); interval.current = setInterval(() => { <|fim_...
fim
xyflow/xyflow
typescript
import { ReactFlow, Background, MiniMap, addEdge, ReactFlowProvider, Connection, Edge, useNodesState, useEdgesState, OnConnectStart, OnConnectEnd, useStore, } from '@xyflow/react'; import useCountdown from './hooks/useCountdown'; import { initialEdges, initialNodes } from './data'; import Timer...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback, useState } from 'react'; import { ReactFlow, addEdge, Node, Connection, Edge, useNodesState, useEdgesState, Panel } from '@xyflow/react'; const initNodes: Node[] = [ { id: '1a', type: 'input', data: { label: 'Node 1' }, position: { x<|fim_suffix|>et: '3a' }, ]; co...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ChangeEventHandler, useCallback, useState } from 'react'; import { ReactFlow, addEdge, Node, useNodesState, useEdgesState, OnConnect, Edge, MiniMap, Background, Controls, Panel, ColorMode, Position, } from '@xyflow/react'; const nodeDefaults = { sourcePosition: Positi...
fim
xyflow/xyflow
typescript
<|fim_suffix|> nodes.map((node) => { return { ...node, position: { x: Math.random() * 400, y: Math.random() * 400, }, }; }) ); }; const updateEdgeColors = () => { instance.setEdges((edges) => edges.map((edge) => { ...
fim
xyflow/xyflow
typescript
import { useCallback, useState } from 'react'; import { ReactFlow, addEdge, Node, Connection, Edge, useNodesState, useEdgesState, Viewport, Panel, MiniMap, Background, ReactFlowProvider, useReactFlow, Controls, } from '@xyflow/react'; const initNodes: Node[] = [ { id: '1a', type: ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ConnectionLineComponentProps } from '@xyflow/react'; function ConnectionLine({ fromX, fromY, toX, toY, pointer }: ConnectionLineComponentProps) { console.log('pointer', pointer); return ( <> <path fill="none" stroke="#222" strokeWidth={1.5} c<|fim_su...
fim
xyflow/xyflow
typescript
<|fim_suffix|>Edges((eds) => addEdge(params, eds)), [setEdges]); return ( <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} connectionLineComponent={ConnectionLine} onConnect={onConnect} connectionDragThreshold={25} > ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { M<|fim_suffix|>p = (_: MouseEvent, node: Node) => console.log('drag stop', node); const CustomMiniMapNode = ({ x, y, width, height }: MiniMapNodeProps) => { return <circle cx={x} cy={y} r={Math.max(width, height) / 2} fill="#ffcc00" />; }; const CustomMiniMapNodeFlow = () => { const [nodes,...
fim
xyflow/xyflow
typescript
<|fim_suffix|> type="source" position={Position.Right} id="a" style={sourceHandleStyleA} isConnectable={isConnectable} onMouseDown={(e) => { console.log('You trigger mousedown event', e); }} /> <Handle type="source" position={Position.Right} id="b" ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState, useEffect, MouseEvent, ChangeEvent, useCallback, useRef } from 'react'; import { ReactFlow, MiniMap, Controls, addEdge, Node, Position, SnapGrid, useEdgesState, Background, OnNodeDrag, OnInit, applyNodeChanges, OnNodesChange, OnConnect, OnBeforeDelete, Bu...
fim
xyflow/xyflow
typescript
<|fim_suffix|> <Background variant={BackgroundVariant.Lines} /> </ReactFlow> ); }; export default function App() { return ( <ReactFlowProvider> <DefaultEdgeOverwrite /> </ReactFlowProvider> ); } <|fim_prefix|>import { ReactFlow, Node, Edge, ReactFlowProvider, Background, Backg...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, Node, ReactFlowProvider, Background, BackgroundVariant, NodeProps } from '@xyflow/react'; const initialNodes: Node[] = [ { id: '1', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, classNam<|fim_suffix|>unregistered', position: { x: 100, y: 100 }, class...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, useReactFlow, Node, Edge, ReactFlowProvider, Background, BackgroundVariant, Panel, } from '@xyflow/react'; const defaultNodes: Node[] = [ { id: '1', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, className: 'light', }, {...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, Node, ReactFlowProvider, Background, BackgroundVariant, NodeProps, Handle, Position, } from '@xyflow/react'; import './style.css'; const initialNodes: Node[] = [ { id: '1', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, }, { id: '2', ...
fim
xyflow/xyflow
typescript
import { useEffect, useRef, useState } from 'react'; import { NodeChange, OnNodesChange, useStore, useStoreApi } from '@xyflow/react'; type ChangeLoggerProps = { color?: string; limit?: number; }; type ChangeInfoProps = { change: NodeChange; }; function ChangeInfo({ change }: ChangeInfoProps) { const id = 'i...
fim
xyflow/xyflow
typescript
<|fim_suffix|>t) { return null; } return ( <div className="react-flow__devtools-nodeinfo" style={{ position: 'absolute', transform: `translate(${x}px, ${y + height}px)`, width: width * 2, }} > <div>id: {id}</div> <div>type: {type}</div> <div> ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState, type Dispatch, type SetStateAction, type ReactNode, HTMLAttributes } from 'react'; import { Panel, PanelPosition } from '@xyflow/react'; import NodeInspector from './NodeInspector'; import ChangeLogger from './ChangeLogger'; import './style.css'; export default function ReactFlowDevT...
fim
xyflow/xyflow
typescript
import { useCallback } from 'react'; import { ReactFlow, addEdge, Node, Connection, Edge, useNodesState, useEdgesState } from '@xyflow/react'; import DevTools from './DevTools'; const initNodes: Node[] = [ { id: '1a', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, }, { ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { memo, FC } from 'react'; import { Handle, Position, NodeProps, Connection, Edge } from '@xyflow/react'; cons<|fim_suffix|> height: 25, backgroundColor: 'teal', marginLeft: 5, borderRadius: '50%', }; const ColorSelectorNode: FC<NodeProps> = () => { return ( <> <Handle type="tar...
fim
xyflow/xyflow
typescript
<|fim_suffix|>tion: { x: 200, y: 200 }, data: {}, }, ]; const onNodeClick = (_: MouseEvent, node: Node) => console.log('click', node); const initialEdges: Edge[] = []; const DragHandleFlow = () => { const [nodes, , onNodesChange] = useNodesState(initialNodes); const [edges] = useEdgesState(initialEdges); ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>className="react-flow__node-input" onDragStart={(event: DragEvent) => onDragStart(event, 'input')} draggable> Input Node </div> <div className="react-flow__node-default" onDragStart={(event: DragEvent) => onDragStart(event, 'default')} draggable > ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState, DragEvent } from 'react'; import { ReactFlow, ReactFlowProvider, addEdge, ReactFlowInstance, Connection, Edge, Node, useNodesState, useEdgesState, Controls, NodeOrigin, } from '@xyflow/react'; import Sidebar from './Sidebar'; import styles from './dnd.module.css'...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ConnectionLineComponentProps, getStraightPath } from '@xyflow/react'; function CustomConnectionLine({ fromX, fromY, toX, toY, connectionLineStyle }: ConnectionLineComponentProps) { const [edgePath] = getStraightPath({ sourceX: fromX, <|fim_suffix|>.5} /> </g> ); } export default ...
fim
xyflow/xyflow
typescript
import { Handle, NodeProps, Position, useConnection } from '@xyflow/react'; export default function CustomNode({ id }: NodeProps) { const connection = useConnection(); const isTarget = connection.inProgress && connection.fromNode.id !== id; const label = isTarget ? 'Drop here' : 'Drag to connect'; return ( ...
fim
xyflow/xyflow
typescript
import { EdgeProps, getStraightPath, useInternalNode } from '@xyflow/react'; import { getEdgeParams } from './utils.js'; function FloatingEdge({ id, source, target, markerEnd, style }: EdgeProps) { const sourceNode = useInternalNode(source); const targetNode = useInternalNode(target); if (!sourceNode || !targe...
fim
xyflow/xyflow
typescript
<|fim_suffix|>tions} connectionLineComponent={CustomConnectionLine} connectionLineStyle={connectionLineStyle} /> ); }; export default EasyConnectExample; <|fim_prefix|>import { useCallback } from 'react'; import { ReactFlow, Node, Edge, addEdge, useNodesState, useEdgesState, MarkerType,...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Node, Position, MarkerType, XYPosition, InternalNode } from '@xyflow/react'; // this helper function returns the intersection point // of the line between the center of the intersectionNode and the target node function getNodeIntersection(intersectionNode: InternalNode, targetNode: InternalNode)...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { FC, MouseEvent } from 'react'; import { EdgeProps, getBezierPath, EdgeLabelRenderer, useStore } from '@xyflow/react'; const CustomEdge: FC<EdgeProps> = ({ id, source, target, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, }) => { const isConnected...
fim
xyflow/xyflow
typescript
<|fim_suffix|> background: 'white', border: '1px solid #555', padding: 5, zIndex: isConnectedNodeDragging ? 10 : 0, }} > {data.text} </div> </EdgeLabelRenderer> </> ); }; export default CustomEdge; <|fim_prefix|>import { FC } fr...
fim
xyflow/xyflow
typescript
<|fim_suffix|>ype: 'output', data: { label: 'Output 9' }, position: { x: 675, y: 500 }, }, ]; const initialEdges: Edge[] = [ { id: 'e1-2', source: '1', target: '2', label: 'bezier edge (default)', className: 'normal-edge', }, { id: 'e2-2a', source: '2', target: '2a', ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ReactFlow, Node, Position, MarkerType, BuiltInEdge } from '@xyflow/react'; const nodes: Node[] = [ // LTR { id: '1', position: { x: 50, y: -100 }, data: { label: 'Source' }, sourcePosition: Position.Right, targetPosition: Position.Right, style: { background: 'rgba(255...
fim
xyflow/xyflow
typescript
import { getBezierPath, BaseEdge, EdgeProps, useReactFlow, getStraightPath, getSmoothStepPath } from '@xyflow/react'; import { EdgeToolbar } from '@xyflow/react'; const getPath = (props: EdgeProps) => { switch (props.data!.type) { case 'smoothstep': return getSmoothStepPath(props); case 'straight': ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Background, BackgroundVariant, Controls, Edge, EdgeTypes, MiniMap, Node, Position, ReactFlow, } from '@xyflow/react'; import { CustomEdge } from './CustomEdge'; const edgeTypes: EdgeTypes = { custom: CustomEdge, }; const initialNodes: Node[] = [ { id: '1', data: {...
fim
xyflow/xyflow
typescript
<|fim_suffix|>eyCode = ['AltLeft+KeyD', 'Backspace']; const EdgeTypesFlow = () => { const [nodes, , onNodesChange] = useNodesState(initialNodes); const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); const onConnect = useCallback((params: Connection | Edge) => setEdges((eds) => addEdge(params, ed...
fim
xyflow/xyflow
typescript
<|fim_suffix|>eIndex < edgeTypes.length; edgeTypeIndex++) { const currEdgeType = edgeTypes[edgeTypeIndex]; for (let offsetIndex = 0; offsetIndex < offsets.length; offsetIndex++) { const currOffset = offsets[offsetIndex]; const style = { ...nodeStyle, background: nodeCol...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { FC } from 'react'; import { BaseEd<|fim_suffix|>, targetPosition, data, }) => { const [edgePath] = getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, }); return ( <> <BaseEdge path={edgePath} id={id} /> <text> ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { FC } from 'react'; import { EdgeProps, getBezierPath, EdgeText, BaseEdge } from '<|fim_suffix|>elX} y={labelY} label={data.text} labelStyle={{ fill: 'white' }} labelShowBg labelBgStyle={{ fill: 'red' }} labelBgPadding={[2, 4]} labelBgBorderR...
fim
xyflow/xyflow
typescript
import { FC } from 'react'; import { BaseEdge, EdgeProps, EdgeText, getSmoothStepPath } from '@xyflow/react'; import './CustomEdge3.css'; const CustomEdge: FC<EdgeProps> = ({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data, }) => { const [edgePath, labelX, labelY] = getSm...
fim
xyflow/xyflow
typescript
<|fim_suffix|>> </ReactFlow> </> ); }; export default EdgesFlow; <|fim_prefix|>import { MouseEvent, useCallback } from 'react'; import { ReactFlow, Controls, Background, MiniMap, addEdge, Connection, Edge, EdgeTypes, MarkerType, Node, useEdgesState, useNodesState, } from '@xyflow/re...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { MouseEvent, CSSProperties, useCallback } from 'react'; import { ReactFlow, Background, BackgroundVariant, Controls, addEdge, Node, Connection, Edge, useNodesState, useEdgesState, ReactFlowInstance, } from '@xyflow/react'; const onInit = (reactFlowInstance: ReactFlowInstanc...
fim
xyflow/xyflow
typescript
import { ReactFlow, Background, BackgroundVariant, Node, Edge, SelectionMode, Controls, Panel } from '@xyflow/react'; const MULTI_SELECT_KEY = ['Meta', 'Shift']; const initialNodes: Node[] = [ { id: '1', type: 'input', data: { label: 'Node 1' }, position: { x: 250, y: 5 }, className: 'light' }, { id: '2', data: {...
fim
xyflow/xyflow
typescript
<|fim_suffix|>oY, fromPosition, toPosition, fromNode }: ConnectionLineComponentProps) { if (!fromNode) { return null; } const targetNode = { id: 'connection-target', width: 1, height: 1, position: { x: toX, y: toY }, } as InternalNode; const { sx, sy } = getEdgeParams(fromNode, targetNod...
fim
xyflow/xyflow
typescript
import { CSSProperties } from 'react'; import { EdgeProps, useStore, getBezierPath } from '@xyflow/react'; import { getEdgeParams } from './utils'; function FloatingEdge({ id, source, target, style }: EdgeProps) { const { sourceNode, targetNode } = useStore((s) => { const sourceNode = s.nodeLookup.get(source); ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback } from 'react'; import { ReactFlow, Background, addEdge, ReactFlowInstance, EdgeTypes, Connection, useNodesState, useEdgesState, } from '@xyflow/react'; import styles from './style.module.css'; import FloatingConnectionLine from './FloatingConnectionLine'; import Fl...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Position, XYPosition, Node, Edge, InternalNode } from '@xyflow/react'; // this helper function returns the intersection point // of the line between the center of the intersectionNode and the target node function getNodeIntersection(intersectionNode: InternalNode, targetNode: InternalNode): XYPo...
fim
xyflow/xyflow
typescript
<|fim_suffix|>onst setHidden = (hidden: boolean) => (els: any[]) => els.map((e: any) => { return { ...e, hidden, }; }); const HiddenFlow = () => { const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes); const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges); c...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState, MouseEvent as ReactMouseEvent, WheelEvent } from 'react'; import { ReactFlow, addEdge, Node, Connection, Edge, PanOnScrollMode, Viewport, useNodesState, useEdgesState, Controls, MiniMap, } from '@xyflow/react'; const initialNodes: Node[] = [ { id: '1', t...
fim
xyflow/xyflow
typescript
<|fim_suffix|>turn ( <ReactFlow defaultNodes={initialNodes} defaultEdges={initialEdges} onNodeClick={onNodeClick} onNodeDragStop={onNodeDragStop} onNodeDrag={onNodeDrag} className="react-flow-basic-example" minZoom={0.2} maxZoom={4} defaultEdgeOptions={defaultEd...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback, MouseEvent } from 'react'; import { ReactFlow, MiniMap, Background, Controls, ReactFlowProvider, Node, Edge, useReactFlow, useNodesState, } from '@xyflow/react'; import './style.css'; const onNodeDragStop = (_: MouseEvent, node: Node) => console<|fim_suffix|>style...
fim
xyflow/xyflow
typescript
<|fim_suffix|>onnect={onConnect} nodeExtent={nodeExtent} onInit={() => onLayout('TB')} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} > <Controls /> <ReactFlowDevTools /> </ReactFlow> <Panel position="top-right"> <button onClick={() ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Node, Edge, XYPosition, MarkerType } from '@xyflow/react'; const position: XYPosition = { x: 0, y: 0 }; const nodes: Node[] = [ { id: '1', type: 'input', data: { label: 'input' }, position, }, { id: '2', data: { label: 'node 2' }, position, }, { id: '2a...
fim
xyflow/xyflow
typescript
<|fim_suffix|>.y, minY), maxY); change.item = item; } } return change; }); }, [minX, minY, maxX, maxY, isEnabled] ) ); return ( <div> <label style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer' }}> <inp...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback } from 'react'; import { ReactFlow, MiniMap, Background, BackgroundVariant, Controls, ReactFlowProvider, Edge, useReactFlow, Panel, useNodesState, useEdgesState, addEdge, Connection, } from '@xyflow/react'; import { initialNodes, initialEdges } from '../Cance...
fim
xyflow/xyflow
typescript
<|fim_suffix|>osition: 'absolute', left: 0, top: 0, justifyContent: 'space-around', height: '100%', }} > <Handle type="target" id="a" position={Position.Left} style={{ ...sourceHandleStyle, tran...
fim
xyflow/xyflow
typescript
<|fim_suffix|> position: { x: 0, y: i * 60 }, data: {}, }); } const initEdges: MyEdge[] = []; const CustomNodeFlow = () => { const [nodes, setNodes] = useState<MyNode[]>(initNodes); const onNodesChange: OnNodesChange<MyNode> = useCallback( (changes) => setNodes((nds) => { const nextNode...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { FC } from 'react'; import <|fim_suffix|>eturn ( <ReactFlowProvider> <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} id={id} > <Background /> <Mi...
fim
xyflow/xyflow
typescript
<|fim_suffix|>pdateNodes}>update nodes</button> <button onClick={multiUpdateEdges}>update edges</button> </Panel> </ReactFlow> ); }; export default () => ( <ReactFlowProvider> <CustomNodeFlow /> </ReactFlowProvider> ); <|fim_prefix|>import { useCallback }<|fim_middle|> from 'react'; import ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>ResizerNode); <|fim_prefix|>import { memo, FC } from 'react'; import { Handle, Position, NodeProps, NodeResizeControl, ResizeControlVariant } from '@xyflow/react'; const CustomResizerNode: FC<NodeProps> = ({ data }) => { return ( <> <NodeResizeControl variant={ResizeControlVariant.Han...
fim
xyflow/xyflow
typescript
<|fim_suffix|>turn ( <> <NodeResizeControl minWidth={data.minWidth ?? undefined} maxWidth={data.maxWidth ?? undefined} minHeight={data.minHeight ?? undefined} maxHeight={data.maxHeight ?? undefined} shouldResize={data.shouldResize ?? undefined} onResizeStart={da...
fim
xyflow/xyflow
typescript
<|fim_suffix|>e="source" position={Position.Right} /> </> ); }; export default memo(DefaultResizerNode); <|fim_prefix|>import { memo, FC } from 'react'; import { Handle, Position, NodeProps, NodeResizer, useKeyPress } from '@xyflow/react'; const DefaultResizerNode: FC<NodeProps> = ({ data, selected }) => { co...
fim
xyflow/xyflow
typescript
<|fim_suffix|>sition.Left} /> <div style={{ padding: 10 }}>{data.label}</div> <ViewportPortal> <div style={{ transform: `translate(${data.extent[0][0]}px, ${data.extent[0][1]}px)`, position: 'absolute', width: data.extent[1][0] - data.extent[0][0], ...
fim
xyflow/xyflow
typescript