text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* eslint-disable @typescript-eslint/no-explicit-any */ import type { ComponentType, CSSProperties, HTMLAttributes, MouseEvent } from 'react'; import type { PanelPosition, XYPosition } from '@xyflow/system'; import type { Node } from '../../types'; export type GetMiniMapNodeAttribute<NodeType extends No...
fim
xyflow/xyflow
typescript
<|fim_suffix|>neProps) { return <ResizeControl {...props} variant={ResizeControlVariant.Line} />; } /** * To create your own resizing UI, you can use the `NodeResizeControl` component where you can pass children (such as icons). * @public * */ export const NodeResizeControl = memo(ResizeControl); <|fim_prefix|>i...
fim
xyflow/xyflow
typescript
<|fim_suffix|>sition) => ( <NodeResizeControl key={position} className={lineClassName} style={lineStyle} nodeId={nodeId} position={position} variant={ResizeControlVariant.Line} color={color} minWidth={minWidth} minHeight={...
fim
xyflow/xyflow
typescript
<|fim_suffix|>/types'; <|fim_prefix|>expo<|fim_middle|>rt { NodeResizer } from './NodeResizer'; export { NodeResizeControl } from './NodeResizeControl'; export * from '.<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_prefix|>import type { CSSProperties, ReactNode } from 'react'; import type { ControlPosition, ControlLinePosition, ResizeControlVariant, ResizeControlDirection, ShouldResize, OnResizeStart, OnResize, OnResizeEnd, } from '@xyflow/system'; /** * @expand */ export type NodeResizerProps = { /** ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback, CSSProperties } from 'react'; import cc from 'classcat'; import { shallow } from 'zustand/shallow'; import { Position, getNodeToolbarTransform, getInternalNodesBounds, NodeLookup } from '@xyflow/system'; import { InternalNode, ReactFlowState } from '../../types'; import { useStore }...
fim
xyflow/xyflow
typescript
<|fim_suffix|>tal({ children }: { children: ReactNode }) { const wrapperRef = useStore(selector); if (!wrapperRef) { return null; } return createPortal(children, wrapperRef); } <|fim_prefix|>import { ReactNode } from 'react'; import { createPortal } from 'react-dom'; import type { ReactFlowState } from '...
fim
xyflow/xyflow
typescript
<|fim_prefix|>export { NodeToolbar } from<|fim_suffix|>bar'; export type { NodeToolbarProps } from './types'; <|fim_middle|> './NodeTool<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_suffix|>Position.Top * @example Position.TopLeft, Position.TopRight, Position.BottomLeft, Position.BottomRight */ position?: Position; /** * The space between the node and the toolbar, measured in pixels. * @default 10 */ offset?: number; /** * Align the toolbar relative to the node. ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>'; <|fim_prefix|>export * from './Background'; export * from './Controls'; export * from './MiniMap'; export<|fim_middle|> * from './NodeResizer'; export * from './NodeToolbar'; export * from './EdgeToolbar<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { CSSProperties } from 'react'; import { useStore } from '../../hooks/useStore'; import type { ReactFlowState } from '../../types'; const style: CSSProperties = { display: 'none' }; const ariaLiveStyle: CSSProperties = { position: 'absolute', width: 1, height: 1, margin: -1, border: 0, ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>ttribution({ proOptions, position = 'bottom-right' }: AttributionProps) { if (proOptions?.hideAttribution) { return null; } return ( <Panel position={position} className="react-flow__attribution" data-message="Please only hide this attribution when you are subscribed to Re...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { createContext, ReactNode, useCallback, useC<|fim_suffix|> clothing. Processing * this queue is a relatively hot path so we'd like to avoid the overhead of * array methods where we can. */ let next = nodes; for (const payload of queueItems) { next = typeof payload === ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>ueItem<T>[]; reset: () => void; push: (item: QueueItem<T>) => void; }; <|fim_prefix|>export type QueueItem<T> = T[] | ((items: T[]) => T[]); export type Queue<T> = { get: () <|fim_middle|>=> Que<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState } from 'react'; import { useIsomorphicLayoutEffect } from '../../hooks/useIsomorphicLayoutEffect'; import { Queue, QueueItem } from './types'; /** * This hook returns a queue that can be used to batch updates. * * @param runQueue - a function that gets called when the queue is flush...
fim
xyflow/xyflow
typescript
<|fim_suffix|> if (CustomComponent) { return ( <CustomComponent connectionLineType={type} connectionLineStyle={style} fromNode={fromNode} fromHandle={fromHandle} fromX={from.x} fromY={from.y} toX={to.x} toY={to.y} fromPosition={fromPosi...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import type { ReactNode } from 'react'; import { createPortal } from 'react-dom'; import { useStore } from '../../hooks/useStore'; import type { ReactFlowState } from '../../types'; const selector = (s: ReactFlowState)<|fim_suffix|>s/edges/edge-label-renderer). * @public * * @example * ```jsx * imp...
fim
xyflow/xyflow
typescript
<|fim_prefix|>// Reconnectable edges have a anchors around their handles to reconnect the edge. import { XYHandle, type EdgePosition, type FinalConnectionState, type HandleType, type OnConnectStart, type Connection, } from '@xyflow/system'; import { EdgeAnchor } from '../Edges/EdgeAnchor'; import type { Ed...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState, useMemo, useRef, type KeyboardEvent, useCallback, JSX, memo } from 'react'; import cc from 'classcat'; import { shallow } from 'zustand/shallow'; import { getMarkerId, elementSelectionKeys, getEdgePosition, errorMessages, getElevatedEdgeZIndex, } from '@xyflow/system'; import...
fim
xyflow/xyflow
typescript
<|fim_suffix|>getY: null, sourcePosition: null, targetPosition: null, }; <|fim_prefix|>import type { EdgeTypes } fro<|fim_middle|>m '../../types'; import { BezierEdgeInternal, StraightEdgeInternal, StepEdgeInternal, SmoothStepEdgeInternal, SimpleBezierEdgeInternal, } from '../Edges'; export const builtin...
fim
xyflow/xyflow
typescript
<|fim_suffix|>urceX, * sourceY, * targetX, * targetY, * }); * * return <BaseEdge path={edgePath} {...props} />; *} *``` * * @remarks If you want to use an edge marker with the [`<BaseEdge />`](/api-reference/components/base-edge) component, * you can pass the `markerStart` or `markerEnd` props pas...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { memo } from 'react'; import { Position, getBezierPath } from '@xyflow/syst<|fim_suffix|>osition = Position.Top, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, pathOptions...
fim
xyflow/xyflow
typescript
<|fim_suffix|>ouseOut={onMouseOut} className={cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`])} cx={shiftX(centerX, radius, position)} cy={shiftY(centerY, radius, position)} r={radius} stroke="transparent" fill="transparent" /> ); } <|fim_prefix|>import type { Mous...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { memo, useState, useEffect, useRef } from 'react'; import cc from 'classcat'; import type { Rect } from '@xyflow/system'; import type { EdgeTextProps } from '../../types'; function EdgeTextComponent({ x, y, label, labelStyle, labelShowBg = true, labelBgStyle, labelBgPadding = [2, 4...
fim
xyflow/xyflow
typescript
<|fim_suffix|>etY, targetPosition = Position.Top, }: GetSimpleBezierPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number] { const [sourceControlX, sourceControlY] = getControl({ pos: sourcePosition, x1: sourceX, y1: sourceY, x2: targetX, y2: targetY, });...
fim
xyflow/xyflow
typescript
<|fim_suffix|>; <|fim_prefix|>import { memo } from 'react'; import { Position, getSmoothStepPath } from '@xyflow/system'; import { BaseEdge } from './BaseEdge'; import type { SmoothStepEdgeProps } from '../../types'; function createSmoothStepEdge(params: { isInternal: boolean }) { // eslint-disable-next-line react/...
fim
xyflow/xyflow
typescript
import { memo, useMemo } from 'react'; import { SmoothStepEdge } from './SmoothStepEdge'; import type { StepEdgeProps } from '../../types'; function createStepEdge(params: { isInternal: boolean }) { // eslint-disable-next-line react/display-name return memo(({ id, ...props }: StepEdgeProps) => { const _id = p...
fim
xyflow/xyflow
typescript
<|fim_suffix|> export { StraightEdge, StraightEdgeInternal }; <|fim_prefix|>import { memo } from 'react'; import { getStraightPath } from '@xyflow/system'; import { BaseEdge } from './BaseEdge'; import type { StraightEdgeProps } from '../../types'; function createStraightEdge(params: { isInternal: boolean }) { // ...
fim
xyflow/xyflow
typescript
/* * We distinguish between internal and exported edges * The internal edges are used directly like custom edges and always get an id, source and target props * If you import an edge from the library, the id is optional and source and target are not used at all */ export { SimpleBezierEdge, SimpleBezierEdgeInterna...
fim
xyflow/xyflow
typescript
<|fim_suffix|> { onMouseDown?.(event as ReactMouseEvent<HTMLDivElement>); } else { onTouchStart?.(event as ReactTouchEvent<HTMLDivElement>); } }; const onClick = (event: ReactMouseEvent) => { const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, ...
fim
xyflow/xyflow
typescript
import { type MouseEvent, type KeyboardEvent, memo } from 'react'; import cc from 'classcat'; import { shallow } from 'zustand/shallow'; import { elementSelectionKeys, errorMessages, getNodeDimensions, isInputDOMNode, nodeHasDimensions, getNodesInside, } from '@xyflow/system'; import { useStore, useStoreAp...
fim
xyflow/xyflow
typescript
import { useEffect, useRef } from 'react'; import type { InternalNode } from '../../types'; import { useStoreApi } from '../../hooks/useStore'; /** * Hook to handle the resize observation + internal updates for the passed node. * * @internal * @returns nodeRef - reference to the node element */ export function u...
fim
xyflow/xyflow
typescript
<|fim_suffix|>Node, }; export function getNodeInlineStyleDimensions<NodeType extends Node = Node>( node: InternalNode<NodeType> ): { width: number | string | undefined; height: number | string | undefined; } { if (node.internals.handleBounds === undefined) { return { width: node.width ?? node.initial...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Position } from '@xyflow/system'; import { Handle } from '../../components/Handle'; import type { BuiltInNode, NodeProps } from '../../types/nodes'; export function DefaultNode({ d<|fim_suffix|>={isConnectable} /> {data?.label} <Handle type="source" position={sourcePosition} isCon...
fim
xyflow/xyflow
typescript
<|fim_suffix|>urn null; } <|fim_prefix|>export f<|fim_middle|>unction GroupNode() { ret<|endoftext|>
fim
xyflow/xyflow
typescript
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<BuiltInNode>) { return ( <> {data?.label} <Hand...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { Position } from '@xyflow/system'; import { Handle } from '.<|fim_suffix|> ); } <|fim_middle|>./../components/Handle'; import type { BuiltInNode, NodeProps } from '../../types/nodes'; export function OutputNode({ data, isConnectable, targetPosition = Position.Top }: NodeProps<BuiltInNode>) { ...
fim
xyflow/xyflow
typescript
import type { RefObject } from 'react'; import type { StoreApi } from 'zustand'; import { errorMessages } from '@xyflow/system'; import type { ReactFlowState } from '../../types'; /* * this handler is called by * 1. the click handler when node is not draggable or selectNodesOnDrag = false * or * 2. the on drag st...
fim
xyflow/xyflow
typescript
<|fim_prefix|>/** * The nodes selection rectangle gets displayed when a user * made a selection with on or several nodes */ import { useRef, useEffect, type MouseEvent, type KeyboardEvent } from 'react'; import cc from 'classcat'; import { shallow } from 'zustand/shallow'; import { getInternalNodesBounds, isNumeric ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { HTMLAttributes, forwardRef } from 'react'; import cc from 'classcat'; import type { PanelPosition } from '@xyflow/system'; /** * @expand */ export type PanelProps = HTMLAttributes<HTMLDivElement> & { /** * The position of the panel. * @default "top-left" */ position?: PanelPositio...
fim
xyflow/xyflow
typescript
import { useState, type ReactNode } from 'react'; import { Provider } from '../../contexts/StoreContext'; import { createStore } from '../../store'; import { BatchProvider } from '../BatchProvider'; import type { Node, Edge, FitViewOptions } from '../../types'; import { CoordinateExtent, NodeOrigin, ZIndexMode } from ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>/* * This is a helper component for calling the onSelectionChange listener. * It will only be mounted if the user has passed an onSelectionChange listener * or is using the useOnSelectionChange hook. * @TODO: Now that we have the onNodesChange and on EdgesChange listeners, do we still need this compon...
fim
xyflow/xyflow
typescript
<|fim_suffix|>agThreshold', 'onBeforeDelete', 'debug', 'autoPanSpeed', 'ariaLabelConfig', 'zIndexMode', ] as const; type ReactFlowFieldsToTrack = (typeof reactFlowFieldsToTrack)[number]; type StoreUpdaterProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = Pick< ReactFlowProps<NodeType, Edge...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { shallow } from 'zustand/shallow'; import { useStore } from '../<|fim_suffix|>ionRect, }); export function UserSelection() { const { userSelectionActive, userSelectionRect } = useStore(selector, shallow); const isActive = userSelectionActive && userSelectionRect; if (!isActive) { retu...
fim
xyflow/xyflow
typescript
<|fim_suffix|> are rendered. This is useful when you want to render * your own components that are adhere to the same coordinate system as the nodes & edges * and are also affected by zooming and panning * @public * @example * * ```jsx *import React from 'react'; *import { ViewportPortal } from '@xyflow/react';...
fim
xyflow/xyflow
typescript
<|fim_suffix|>g className="react-flow__marker" aria-hidden="true"> <defs> {markers.map((marker: MarkerProps) => ( <Marker id={marker.id} key={marker.id} type={marker.type} color={marker.color} width={marker.width} height={ma...
fim
xyflow/xyflow
typescript
<|fim_suffix|> }: SymbolProps) => { const style = { strokeWidth, ...(color && { stroke: color, fill: color }), }; return ( <polyline className="arrowclosed" style={style} strokeLinecap="round" strokeLinejoin="round" points="-5,-4 0,0 -5,4 -5,-4" /> ); }; export co...
fim
xyflow/xyflow
typescript
import { memo, ReactNode } from 'react'; import { shallow } from 'zustand/shallow'; import { useStore } from '../../hooks/useStore'; import { useVisibleEdgeIds } from '../../hooks/useVisibleEdgeIds'; import MarkerDefinitions from './MarkerDefinitions'; import { GraphViewProps } from '../GraphView'; import EdgeWrapper ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { memo, type ReactNode } from 'react'; import { shallow } from 'zustand/shallow'; import { useStore } from '../../hooks/useStore'; import { useGlobalKeyHandler } from '../../hooks/useGlobalKeyHandler'; import { useKeyPress } from '../../hooks/useKeyPress'; import { GraphViewProps } from '../GraphV...
fim
xyflow/xyflow
typescript
<|fim_suffix|>onStart} onSelectionEnd={onSelectionEnd} multiSelectionKeyCode={multiSelectionKeyCode} panActivationKeyCode={panActivationKeyCode} zoomActivationKeyCode={zoomActivationKeyCode} elementsSelectable={elementsSelectable} zoomOnScroll={zoomOnScroll} zoomOnPinch={zoomOn...
fim
xyflow/xyflow
typescript
<|fim_suffix|>dKeys = new Set([...Object.keys(typesRef.current), ...Object.keys(nodeOrEdgeTypes)]); for (const key of usedKeys) { if (typesRef.current[key] !== nodeOrEdgeTypes[key]) { store.getState().onError?.('002', errorMessages['error002']()); break; } } types...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useEffect, useRef } from 'react'; import { errorMessages } from '@xyflow/system'; import { useStoreApi } from '../../hooks/useStore'; export function useSt<|fim_suffix|> && !(window.getComputedStyle(pane).zIndex === '1')) { store.getState().onError?.('013', errorMessages['error013']('...
fim
xyflow/xyflow
typescript
import { memo } from 'react'; import { shallow } from 'zustand/shallow'; import { useVisibleNodeIds } from '../../hooks/useVisibleNodeIds'; import { useStore } from '../../hooks/useStore'; import { containerStyle } from '../../styles/utils'; import { GraphViewProps } from '../GraphView'; import { useResizeObserver } f...
fim
xyflow/xyflow
typescript
<|fim_suffix|>MLDivElement, force: true, }); }); updateNodeInternals(updates); }); }); useEffect(() => { return () => { resizeObserver?.disconnect(); }; }, [resizeObserver]); return resizeObserver; } <|fim_prefix|>import { useEffect, useState } from 'react'; i...
fim
xyflow/xyflow
typescript
<|fim_suffix|>container.current; // if a child element has the 'nokey' class, we don't want to swallow the event and don't start a selection const isNoKeyEvent = !eventTargetIsContainer && !!(event.target as HTMLElement).closest('.nokey'); const isSelectionActive = (selectionOnDrag && eventTargetIsContainer...
fim
xyflow/xyflow
typescript
import { useContext, type ReactNode } from 'react'; import StoreContext from '../../contexts/StoreContext'; import { ReactFlowProvider } from '../../components/ReactFlowProvider'; import type { Node, Edge, FitViewOptions } from '../../types'; import { CoordinateExtent, NodeOrigin, ZIndexMode } from '@xyflow/system'; ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>lectNodesOnDrag={selectNodesOnDrag} nodeDragThreshold={nodeDragThreshold} connectionDragThreshold={connectionDragThreshold} onBeforeDelete={onBeforeDelete} debug={debug} ariaLabelConfig={ariaLabelConfig} zIndexMode={zIndexMode} /> ...
fim
xyflow/xyflow
typescript
<|fim_suffix|>t defaultViewport: Viewport = { x: 0, y: 0, zoom: 1 }; <|fim_prefix|>import { type NodeOrigin, Viewport } from '@xyflow/system'; expo<|fim_middle|>rt const defaultNodeOrigin: NodeOrigin = [0, 0]; export cons<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_suffix|> {children} </div> ); } <|fim_prefix|>import type { ReactNode } from 'react'; import { useStore } from '../../hooks/useStore'; import type { ReactFlowState } from '../../types'; const selector = (s: ReactFlowState) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`; ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>/* eslint-disable @typescript-eslint/no-explicit-any */ import { useCallback, useEffect, useRef } from 'react'; import { shallow } from 'zustand/shallow'; import { XYPanZoom, PanOnScrollMode, type Transform, type PanZoomInstance } from '@xyflow/system'; import { useKeyPress } from '../../hooks/useKeyPres...
fim
xyflow/xyflow
typescript
<|fim_suffix|> nodeId = useNodeId(); * * return <span>{nodeId}</span>; *} *``` */ export const useNodeId = (): string | null => { const nodeId = useContext(NodeIdContext); return nodeId; }; export default NodeIdContext; <|fim_prefix|>import { createContext, useContext } from 'react'; export const NodeIdCont...
fim
xyflow/xyflow
typescript
<|fim_suffix|>e<typeof createStore> | null>(null); export const Provider = StoreContext.Provider; export default StoreContext; <|fim_prefix|>import { createContext } from 'react'; import { createStore } from '../stor<|fim_middle|>e'; const StoreContext = createContext<ReturnTyp<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_prefix|>declare module '*.css' { const content:<|fim_suffix|>ent; export default svgUrl; export { svgComponent as ReactComponent }; } <|fim_middle|> { [className: string]: string }; export default content; } type SvgrComponent = React.FunctionComponent<React.SVGAttributes<SVGElement>>; declare module '*...
fim
xyflow/xyflow
typescript
<|fim_suffix|> return colorModeClass !== null ? colorModeClass : getMediaQuery()?.matches ? 'dark' : 'light'; } <|fim_prefix|>import { useEffect, useState } from 'react'; import type { ColorMode, ColorModeClass } from '@xyflow/system'; function getMediaQuery() { if (typeof window === 'undefined' || !window.matchMed...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { shallow } from 'zustand/shallow'; import { ConnectionState, pointToRendererPoint } from '@xyflow/system'; import { useStore } from './useStore'; import type { InternalNode, Node, ReactFlowStore } from '../types'; function storeSelector(s: ReactFlowStore) { return s.connection.inProgress ?...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useEffect, useRef, useState, type RefObject } from 'react'; import { XYDrag, type XYDragInstance } from '@xyflow/system'; import { handleNodeClick } from '../components/Nodes/utils'; import { useStoreApi } from './useStore'; type UseDragParams = { nodeRef: RefObject<HTMLDivElement>; disable...
fim
xyflow/xyflow
typescript
import { shallow } from 'zustand/shallow'; import { useStore } from '../hooks/useStore'; import type { Edge, ReactFlowState } from '../types'; const edgesSelector = (state: ReactFlowState) => state.edges; /** * This hook returns an array of the current edges. Components that use this hook * will re-render **whenev...
fim
xyflow/xyflow
typescript
<|fim_suffix|>essed) { const { edges, nodes } = store.getState(); deleteElements({ nodes: nodes.filter(selected), edges: edges.filter(selected) }); store.setState({ nodesSelectionActive: false }); } }, [deleteKeyPressed]); useEffect(() => { store.setState({ multiSelectionActive: multiSele...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useEffect, useMemo, useRef } from 'react'; import { Connection, HandleConnection, HandleType, areConnectionMapsEqual, handleConnectionChange, } from '@xyflow/system'; import { useStore } from './useStore'; import { useNodeId } from '../contexts/NodeIdContext'; type UseHandleConnection...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { <|fim_suffix|>-1'); * const absolutePosition = internalNode.internals.positionAbsolute; * * return ( * <div> * The absolute position of the node is at: * <p>x: {absolutePosition.x}</p> * <p>y: {absolutePosition.y}</p> * </div> * ); *} *``` */ export function us...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { us<|fim_suffix|>ok to prevent a warning when using react-flow in SSR export const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect; <|fim_middle|>eEffect, useLayoutEffect } from 'react'; // we need this ho<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_suffix|> null; /** * This hook lets you listen for specific key codes and tells you whether they are * currently pressed or not. * * @public * @param options - Options * * @example * ```tsx *import { useKeyPress } from '@xyflow/react'; * *export default function () { * const spacePressed = useKeyPre...
fim
xyflow/xyflow
typescript
<|fim_suffix|>nternals.positionAbsolute.x + xDiff, y: node.internals.positionAbsolute.y + yDiff, }; if (snapToGrid) { nextPosition = snapPosition(nextPosition, snapGrid); } const { position, positionAbsolute } = calculateNodePosition({ nodeId: node.id, nextPosit...
fim
xyflow/xyflow
typescript
<|fim_suffix|>s]); } <|fim_prefix|>import { useEffect, useMemo, useRef } from 'react'; import { areConnectionMapsEqual, errorMessages, handleConnectionChange, type NodeConnection, type UseNodeConnectionsParams, } from '@xyflow/system'; import { useStore } from './useStore'; import { useNodeId } from '../cont...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { shallow } from 'zustand/shallow'; import { useStore } from '../hooks/useStore'; import type { Node, ReactFlowState } from '../types'; const nodesSelector = (state: ReactFlowState) => state.nodes; /** * This hook returns an array of the current nodes. Components that use this hook * will re-r...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback } from 'react'; import { DistributivePick, shallowNodeData } from '@xyflow/system'; import { useStore } from '../hooks/useStore'; import type { Node } from '../types'; /** * This hook lets you subscribe to changes of a specific nodes `data` object. * * @public * @returns An obje...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useState, useCallback, type Dispatch, type SetStateAction } from 'react'; import { applyNodeChanges, applyEdgeChanges } from '../utils/changes'; import type { Node, Edge, OnNodesChange, OnEdgesChange } from '../types'; /** * This hook makes it easy to prototype a controlled flow where you mana...
fim
xyflow/xyflow
typescript
import { nodeHasDimensions } from '@xyflow/system'; import { useStore } from './useStore'; import type { ReactFlowState } from '../types'; export type UseNodesInitializedOptions = { /** @default false */ includeHiddenNodes?: boolean; }; const selector = (options: UseNodesInitializedOptions) => (s: ReactFlowState...
fim
xyflow/xyflow
typescript
<|fim_suffix|>eState(() => Symbol()); useEffect(() => { const { onEdgesChangeMiddlewareMap } = store.getState(); onEdgesChangeMiddlewareMap.set(symbol, fn); }, [fn]); useEffect(() => { const { onEdgesChangeMiddlewareMap } = store.getState(); return () => { onEdgesChangeMiddlewareMap.delete...
fim
xyflow/xyflow
typescript
import { useEffect, useRef } from 'react'; import { useReactFlow } from './useReactFlow'; import type { OnInit, Node, Edge } from '../types'; /** * Hook for calling onInit handler. * * @internal */ export function useOnInitHandler<NodeType extends Node = Node, EdgeType extends Edge = Edge>( onInit: OnInit<NodeT...
fim
xyflow/xyflow
typescript
import { useEffect, useState } from 'react'; import type { NodeChange } from '@xyflow/system'; import { useStoreApi } from './useStore'; import type { Edge, Node } from '../types'; /** * Registers a middleware function to transform node changes. * * @public * @param fn - Middleware function. Should be memoized wi...
fim
xyflow/xyflow
typescript
<|fim_suffix|>ectionChangeHandlers: nextOnSelectionChangeHandlers }); return () => { const nextHandlers = store.getState().onSelectionChangeHandlers.filter((fn) => fn !== onChange); store.setState({ onSelectionChangeHandlers: nextHandlers }); }; }, [onChange]); } <|fim_prefix|>import { useEffect ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useEffect } from 'react'; import type { OnViewportChange } from '@xyflow/system'; import { useStoreApi } from './useStore'; export type UseOnViewportChangeOptions = { /** Gets called when the viewport starts changing. */ onStart?: OnViewportChange; /** Gets called when the viewport change...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useMemo } from 'react'; import { EdgeRemoveChange, evaluateAbsolutePosition, getElementsToRemove, getNodesBounds, getOverlappingArea, isRectObject, NodeRemoveChange, nodeToRect, withResolvers, type Rect, } from '@xyflow/system'; import useViewportHelper from './useViewportHel...
fim
xyflow/xyflow
typescript
<|fim_suffix|>sizeObserver.unobserve(domNode.current); } }; } }, []); } <|fim_prefix|>import { useEffect, type MutableRefObject } from 'react'; import { errorMessages, getDimensions } from '@xyflow/system'; import { useStoreApi } from '../hooks/useStore'; /** * Hook for handling resize events. *...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useContext, useMemo } from 'react'; import { UseBoundStoreWithEqualityFn, useStoreWithEqualityFn as useZustandStore } from 'zustand/traditional'; import { StoreApi } from 'zustand'; import { errorMessages } from '@xyflow/system'; import StoreContext from '../contexts/StoreContext'; import type {...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback } from 'react'; import type { UpdateNodeInternals, InternalNodeUpdate } from '@xyflow/system'; import { useStoreApi } from '../hooks/useStore'; /** * When you programmatically add or remove handles to a node or update a node's * handle position, you need to let React Flow know abo...
fim
xyflow/xyflow
typescript
<|fim_suffix|>export function useViewport(): Viewport { const viewport = useStore(viewportSelector, shallow); return viewport; } <|fim_prefix|>import { shallow } from 'zustand/shallow<|fim_middle|>'; import type { Viewport } from '@xyflow/system'; import { useStore } from '../hooks/useStore'; import type { ReactF...
fim
xyflow/xyflow
typescript
<|fim_suffix|>on: options?.duration, ease: options?.ease, interpolate: options?.interpolate, }); return true; }, screenToFlowPosition: ( clientPosition: XYPosition, options: { snapToGrid?: boolean; snapGrid?: SnapGrid } = {} ) => { const { t...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useEffect } from 'react'; import type { Viewport } from '@xyflow/system'; import { useStore, useStoreApi } from './useStore'; import type { ReactFlowState } from '../types'; const select<|fim_suffix|> { if (viewport) { syncViewport?.(viewport); store.setState({ transform: [viewp...
fim
xyflow/xyflow
typescript
<|fim_suffix|> const targetNode = s.nodeLookup.get(edge.target); if ( sourceNode && targetNode && isEdgeVisible({ sourceNode, targetNode, width: s.width, height: s.height, transform: s...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { useCallback } from 'react'; import { shallow } from 'zustand/sh<|fim_suffix|> return onlyRenderVisible ? getNodesInside<Node>(s.nodeLookup, { x: 0, y: 0, width: s.width, height: s.height }, s.transform, true).map( (node) => node.id ) : Array.from(s.nodeLookup.keys()); }; /** *...
fim
xyflow/xyflow
typescript
<|fim_suffix|>Dimensions, type Rect, type Box, type Transform, type CoordinateExtent, type ColorMode, type ColorModeClass, type HandleType, type ShouldResize, type OnResizeStart, type OnResize, type OnResizeEnd, type ControlPosition, type ControlLinePosition, ResizeControlVariant, type Res...
fim
xyflow/xyflow
typescript
import { createWithEqualityFn } from 'zustand/traditional'; import { adoptUserNodes, updateAbsolutePositions, panBy as panBySystem, updateNodeInternals as updateNodeInternalsSystem, updateConnectionLookup, handleExpandParent, NodeChange, EdgeSelectionChange, NodeSelectionChange, ParentExpandChild, ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { infiniteExtent, ConnectionMode, adoptUserNodes, getViewportForBounds, Transform, updateConnectionLookup, createDevWarn, getInternalNodesBounds, NodeOrigin, initialConnection, CoordinateExtent, defaultAriaLabelConfig, ZIndexMode, } from '@xyflow/system'; const devWarn = ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import type { CSSProperties } from 'react'; export const containerStyle: CSSProperties = { position: 'absolute', wid<|fim_suffix|>h: '100%', height: '100%', top: 0, left: 0, }; <|fim_middle|>t<|endoftext|>
fim
xyflow/xyflow
typescript
<|fim_suffix|>set, holding this key will let you click and drag to draw a selection box around multiple * nodes and edges. Passing an array represents multiple keys that can be pressed. * * For example, `["Shift", "Meta"]` will allow you to draw a selection box when either key is * pressed. * @default 'S...
fim
xyflow/xyflow
typescript
<|fim_suffix|>** The x position of edge label */ labelX?: number; /** The y position of edge label */ labelY?: number; /** * The SVG path string that defines the edge. This should look something like * `'M 0 0 L 100 100'` for a simple line. The utility functions like `getSimpleBezierEdge` can ...
fim
xyflow/xyflow
typescript
<|fim_prefix|>import { ComponentType } from 'react'; import { FitViewParamsBase, FitViewOptionsBase, ZoomInOut, ZoomTo, SetViewport, GetZoom, GetViewport, SetCenter, FitBounds, XYPosition, OnBeforeDeleteBase, Connection, NodeChange, EdgeChange, SnapGrid, } from '@xyflow/system'; import ty...
fim
xyflow/xyflow
typescript
export * from './nodes'; export * from './edges'; export * from './component-props'; export * from './general'; export * from './store'; export * from './instance'; <|endoftext|>
fim
xyflow/xyflow
typescript