text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>Handle type="source" position={Position.Bottom} />
</>
);
};
export default memo(HorizontalResizerNode);
<|fim_prefix|>import { memo, FC } from 'react';
import { Handle, Position, NodeProps, NodeResizeControl } from '@xyflow/react';
const HorizontalResizerNode: FC<NodeProps> = ({ data }) => {
re... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> );
}
export default ResizeIcon;
<|fim_prefix|>function ResizeIcon() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="8"
height="8"
viewBox="0 0 24 24"
strokeWidth="2"
stroke="currentColor"
fill="none"
strokeLinecap="round"
strokeLinejo... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>;
};
export default memo(CustomNode);
<|fim_prefix|>import { memo, FC } from 'react';
import { Handle, Position, NodeProps, NodeResizeControl } from '@xyflow/react';
const CustomNode: FC<NodeProps> = ({ id, data }) => {
return (
<>
<NodeResizeControl
minWidth={data.minWidth ?? undefi... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useCallback, useState } from 'react';
import {
ReactFlow,
Controls,
addEdge,
Connection,
useNodesState,
useEdgesState,
Panel,
Node,
Edge,
CoordinateExtent,
} from '@xyflow/react';
import DefaultResizer from './DefaultResizer';
import CustomResizer from './CustomResizer';
impo... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { Node, ReactFlow, useNodesState } from '@xyflow/react';
import '@xyflow/react/dist/style.css';
import { useRef } from 'react';
export default function App() {
const [nodes, setNodes, onNodesChange] = useNodesState<Node>([
{
id: '0',
position: { x: 0, y: 0 },
data: { label... | fim | xyflow/xyflow | typescript |
import { memo, FC } from 'react';
import { Handle, Position, NodeProps, NodeToolbar } from '@xyflow/react';
const CustomNode: FC<NodeProps> = ({ id, data }) => {
return (
<>
<NodeToolbar isVisible={data.toolbarVisible} position={data.toolbarPosition} align={data.toolbarAlign}>
<button>delete</butto... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>tate) =>
state.nodes.filter((node) => node.selected).map((node) => node.id);
export default function SelectedNodesToolbar() {
const selectedNodeIds = useStore(selectedNodesSelector);
const isVisible = selectedNodeIds.length > 1;
return (
<NodeToolbar nodeId={selectedNodeIds} isVisible={isVis... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import {
ReactFlow,
MiniMap,
Background,
BackgroundVariant,
Controls,
Node,
Edge,
NodeTypes,<|fim_suffix|>ple"
minZoom={0.2}
maxZoom={4}
fitView
defaultEdgeOptions={defaultEdgeOptions}
nodeTypes={nodeTypes}
nodeOrigin={nodeOrigin}
>
<Background... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { CSSProperties, useCallback } from 'react';
import { ReactFlow, addEdge, Node, Position, Connection, Edge, useNodesState, useEdgesState } from '@xyflow/react';
const initialNodes: Node[] = [
{
id: '1',
sourcePosition: Position.Right,
type: 'input',
data: { label: 'Input' },
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useState, CSSProperties, FC, useCallback } from 'react';
import {
ReactFlow,
addEdge,
Node,
Position,
Connection,
Edge,
NodeProps,
NodeTypes,
useNodesState,
useEdgesState,
} from '@xyflow/react';
const initialNodes: Node[] = [
{
id: '1',
sourcePosition: Position.Rig... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> onSelectionChange={onSelectionChange}
onMoveStart={onMoveStart}
onMoveEnd={onMoveEnd}
onInit={onInit}
connectionLineStyle={connectionLineStyle}
snapToGrid={true}
snapGrid={snapGrid}
onEdgeContextMenu={onEdgeContextMenu}
onEdgeMouseEnter={onEdgeMouseEnter}... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useReactFlow, useStore } from '@xyflow/react';
import styles from './provider.module.css';
const Sidebar = () => {
co<|fim_suffix|>} - x: ${n.position.x.toFixed(2)}, y: ${n.position.y.toFixed(2)}`)
);
const transform = useStore((store) => store.transform);
const selectAll = () => {
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>etEdges]);
return (
<div className={styles.providerflow}>
<ReactFlowProvider>
<Sidebar />
<div className={styles.wrapper}>
<ReactFlow
nodes={nodes}
edges={edges}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChang... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useState, useCallback, MouseEvent as ReactMouseEvent } from 'react';
import {
ReactFlow,
Controls,
reconnectEdge,
addEdge,
applyNodeChanges,
applyEdgeChanges,
Connection,
Edge,
Node,
NodeChange,
EdgeChange,
HandleType,
} from '@xyflow/react';
const initialNodes: Node[] = ... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { ReactFlow } from '@xyflow/react';
import { useDispatch, useSelector, Provider } from 'react-redux';
import { onNodesChange, onEdgesChange, setSelectedNodesAndEdges, store } from './state';
const OverviewFlow = () => {
const dispatch = useDispatch();
const nodes = useSelector((state) => sta... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>arget: '2', label: 'this is an edge label' },
{ id: 'e1-3', source: '1', target: '3' },
{
id: 'e3-4',
source: '3',
target: '4',
animated: true,
label: 'animated edge',
},
{
id: 'e4-5',
source: '4',
target: '5',
label: 'edge with arrow head',
markerEnd: {
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { createSlice, configureStore } from '@reduxjs/toolkit';
i<|fim_suffix|>port const store = configureStore({
reducer: {
myApplication: MyApplicationSlice.reducer,
},
});
<|fim_middle|>mport { applyNodeChanges, applyEdgeChanges } from '@xyflow/react';
import { nodes, edges } from './initial-e... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import React, { memo, useCallback, Dispatch, FC } from 'react';
import { useReactFlow, Edge, Node, ReactFlowJsonObject } from '@xyflow/react';
import localforage from 'localforage';
import styles from './save.module.css';
localforage.config({
name: 'react-flow',
storeName: 'flows',
});
const flowKe... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>des={nodes}
edges={edges}
onNodesChange={onNodesChange}
onEdgesChange={onEdgesChange}
onConnect={onConnect}
>
<Controls setNodes={setNodes} setEdges={setEdges} />
</ReactFlow>
</ReactFlowProvider>
);
};
export default SaveRestore;
<|fim_prefix|>im... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useCallback } from 'react';
import {
ReactFlow,
MiniMap,
Background,
BackgroundVariant,
Controls,
ReactFlowProvider,
Node,
Edge,
useReactFlow,
Panel,
} from '@xyflow/react';
const a = { id: 'a', data: { label: 'A' }, position: { x: 250, y: 5 } };
const b = { id: 'b', data: { ... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useState, useCallback, useRef, useEffect } from 'react';
import {
ReactFlow,
Edge,
Node,
NodeChange,
applyNodeChanges,
Connection,
addEdge,
applyEdgeChanges,
EdgeChange,
Controls,
Background,
Panel,
ReactFlowProvider,
useReactFlow,
} from '@xyflow/react';
import { get... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>type Frame = {
duration: number;
stage: string;
};
/**
* Measures and outputs the duration of every frame that happens between the
* instance is created and `endRecording()` is called.
*
* Usage:
*
* ```ts
* const recorder = new FrameRecorder();
*
* // Do some performance-intensive stuff
*
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> };
initialNodes.push(node);
if (recentNodeId && nodeId <= xElements * yElements) {
initialEdges.push({
id: `${x}-${y}`,
source: recentNodeId.toString(),
target: nodeId.toString(),
});
}
recentNodeId = nodeId;
nodeId++;
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import React, { memo, FC, CSSProperties } from 'react';
import { Handle, NodeProps, Position, useInternalNode } from '@xyflow/react';
const i<|fim_suffix|>tSize: 11 };
const idStyle: CSSProperties = {
fontSize: 10,
color: '#888899',
position: 'absolute',
top: 2,
left: 2,
};
const DebugNode: F... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>updateNodeInternals</button>
</Panel>
</ReactFlow>
);
};
export default () => (
<ReactFlowProvider nodeExtent={nodeExtent}>
<Subflow />
</ReactFlowProvider>
);
<|fim_prefix|>import { useState, MouseEvent, useCallback } from 'react';
import {
ReactFlow,
addEdge,
Node,
Edge,
R... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>[] = [
{ id: 'e1-2', source: '1a', target: '2a', ariaLabel: undefined },
{ id: 'e1-3', source: '1a', target: '3a' },
];
const nodesB: Node[] = [
{
id: 'inputb',
type: 'input',
data: { label: 'Input' },
position: { x: 300, y: 5 },
className: 'light',
ariaLabel: 'Input Node',
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>= useCallback(() => console.log('connect end'), []);
const onClickConnectStart = useCallback(() => console.log('click connect start'), []);
const onClickConnectEnd = useCallback(() => console.log('click connect end'), []);
return (
<ReactFlow
nodes={nodes}
edges={edges}
onConn... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>Right} />
<Handle type="source" id="top" position={Position.Top} />
<Handle type="source" id="bottom" position={Position.Bottom} />
</div>
);
};
export default memo(CustomNode);
<|fim_prefix|>import { memo, FC, CSSProperties } from 're<|fim_middle|>act';
import { Handle, Position, NodeP... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { MouseEvent, useCallback } from 'react';
import {
ReactFlow,
useReactFlow,
NodeTypes,
addEdge,
ReactFlowProvider,
Node,
Connection,
Edge,
ConnectionLineType,
ConnectionMode,
reconnectEdge,
useNodesState,
useEdgesState,
} from '@xyflow/react';
import CustomNode <|fim_suff... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useEffect, useState } from 'react';
import { ReactFlow, Node, Edge, useNodesState, useEdgesState, ReactFlowProvider, useReactFlow } from '@xyflow/react';
import styles from './updatenode.module.css';
const initialNodes: Node[] = [
{ id: '1', data: { label: '-' }, position: { x: 100, y: 100 } ... | fim | xyflow/xyflow | typescript |
import { useCallback, useEffect } from 'react';
import {
ReactFlow,
Background,
MiniMap,
Node,
addEdge,
ReactFlowProvider,
Edge,
useNodesState,
useEdgesState,
OnConnect,
useConnection,
} from '@xyflow/react';
const initialNodes: Node[] = [
{
id: '1',
type: 'input',
data: { label: 'N... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useKeyPress } from '@xyflow/react';
import { useEffect } from 'react';
const UseKeyPressComponen<|fim_suffix|>;
useEffect(() => {
console.log({ metaPressed });
}, [metaPressed]);
return <div />;
};
export default UseKeyPressComponent;
<|fim_middle|>t = () => {
const metaPressed = ... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { memo, FC, useEffect, useCallback } from 'react';
import { Handle, Position, NodeProps, useNodeCon<|fim_suffix|>f', padding: 10, fontSize: 12, borderRadius: 10 }}>
<CustomHandle nodeId={id} type="target" position={Position.Left} id="t1" style={{ top: 10 }} />
<CustomHandle nodeId={id} ... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { memo, FC, useEffect, useCallback } from 'react';
import { Handle, Position, NodeProps, useNodeConnections, Connection, HandleProps } from '@xyflow/react';
function CustomHandle({ nodeId, ...handleProps }: HandleProps & { nodeId: string }) {
const onConnect = useCallback(
(connections: Conn... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ypes = {
multi: MultiHandleNode,
single: SingleHandleNode,
};
const initNodes = [
{
id: '1',
type: 'single',
data: {},
position: { x: 0, y: 0 },
},
{
id: '2',
type: 'single',
data: {},
position: { x: 200, y: -100 },
},
{
id: '3',
type: 'single',
d... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ze: 12, borderRadius: 10 }}>
<Handle type="target" position={Position.Left} />
<div>incoming texts: {textNodes.map(({ data }, i) => <div key={i}>{data.text}</div>) || 'none'}</div>
</div>
);
}
export default memo(ResultNode);
<|fim_prefix|>import { memo } from 'react';
import {<|fim_mid... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> />
</div>
<Handle type="source" position={Position.Right} />
</div>
);
}
export default memo(TextNode);
<|fim_prefix|>import { memo, useState } from 'react';
import { Position, NodeProps, Handle, useReactFlow } from '@xyflow/react';
import type { TextNode } from '.';
function T... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { memo, useEffect } from 'react';
import { Position, NodeProps, useReactFlow, Handle, useNodeConnections, useNodesData } from <|fim_suffix|>desData = useNodesData<MyNode>(connections[0]?.source);
useEffect(() => {
const text = nodesData?.type === 'text' ? nodesData?.data.text.toUpperCase() :... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>'2',
target: '3b',
},
];
const CustomNodeFlow = () => {
const [nodes, , onNodesChange] = useNodesState(initNodes);
const [edges, setEdges, onEdgesChange] = useEdgesState(initEdges);
const onConnect = useCallback((connection: Connection) => setEdges((eds) => addEdge(connection, eds)), [setEdg... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useCallback, useEffect } from 'react';
import {
ReactFlow,
Background,
MiniMap,
Node,
addEdge,
ReactFlowProvider,
Edge,
useNodesState,
useEdgesState,
OnConnect,
use<|fim_suffix|>n (
<ReactFlow
nodes={nodes}
edges={edges}
onNodesChange={onNodesChange}
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>iv>
);
};
export default memo(CustomNode);
<|fim_prefix|>import { useState, memo, FC, useMemo, CS<|fim_middle|>SProperties } from 'react';
import { Handle, Position, NodeProps, useUpdateNodeInternals } from '@xyflow/react';
const nodeStyles: CSSProperties = { padding: 10, border: '1px solid #ddd' };
... | fim | xyflow/xyflow | typescript |
import { useCallback, useState } from 'react';
import {
ReactFlow,
addEdge,
ReactFlowProvider,
Node,
Connection,
Edge,
useNodesState,
useEdgesState,
useOnSelectionChange,
OnSelectionChangeParams,
Panel,
} from '@xyflow/react';
const initialNodes: Node[] = [
{
id: '1',
type: 'default',
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useCallback, MouseEvent, useEffect, useRef } from 'react';
import {
ReactFlow,
Background,
MiniMap,
Node,
addEdge,
useReactFlow,
ReactFlowProvider,
Connection,
Edge,
useNodesState,
useEdgesState,
Panel,
} from '@xyflow/react';
const initialNodes: Node[] = [
{
id: '1... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>e="target" position={Position.Left} />
<div>output handle count: {handleCount}</div>
<button
onClick={() => {
setHandleCount((c) => c + 1);
updateNodeInternals([id]);
}}
>
add handle
</button>
{handles}
</div>
);
};
export de... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useCallback, MouseEvent } from 'react';
import {
ReactFlow,
NodeTypes,
addEdge,
useReactFlow,
ReactFlowProvider,
Node,
Connection,
Edge,
Position,
useNodesState,
useEdgesState,
} from '@xyflow/react';
import CustomNode fro<|fim_suffix|>},
position: { x: 250, y: 5 },
}... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { ReactFlowState, useStore } from '@xyflow/react';
import { shallow } from 'zustand/shallow';
import styles from './validation.module.css';
const selector = (state: ReactFlowState) => ({
connectionPosition: state.connectionPosition,
connectionStatus: state.connectionStatus,
connectionStartN... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>s}
onConnectStart={onConnectStart}
onConnectEnd={onConnectEnd}
onReconnect={onReconnect}
isValidConnection={isValidConnection}
onBeforeDelete={onBeforeDelete}
fitView
>
<ConnectionStatus />
</ReactFlow>
);
};
export default ValidationFlow;
<|fim_prefix|... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { ChangeEventHandler, useCallback, useState } from 'react';
import {
ReactFlow,
addEdge,
Node,
useNodesState,
useEdgesState,
OnConnect,
Edge,
MiniMap,
Background,
Controls,
Position,
ZIndexMode,
Panel,
} from '@xyflow/react';
const nodeDefaults = {
sourcePosition: Posit... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useState, useCallback } from 'react';
import <|fim_suffix|>>}
{flowConfig.backgroundProps && <Background {...flowConfig.backgroundProps} />}
</ReactFlow>
</div>
);
};
<|fim_middle|>{
ReactFlow,
applyNodeChanges,
applyEdgeChanges,
addEdge,
OnNodesChange,
OnEdgesChan... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> {
id: '11',
data: { label: '11' },
position: { x: 100, y: 500 },
},
{
id: '12',
data: { label: '12' },
position: { x: 100, y: 600 },
width: 200,
height: 100,
},
{
id: '12-a',
parentId: '12',
d... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useLocation } from 'react-router-dom';
import Flow from './Flow';
const flowConfigs = import.meta.glob<FlowConfig>('./**/*.ts', { eager: true, import: 'default' });
export default () => {
const location = useLocation();
const path = `.${location.pathname.rep<|fim_suffix|>flowConfig={flowCo... | fim | xyflow/xyflow | typescript |
<|fim_suffix|><Handle type="target" position={Position.Left} />
<Handle type="source" position={Position.Right} />
</>
);
};
export default memo(CustomNode);
<|fim_prefix|>import { memo, FC } from 'react';
import { Handle, Position, NodeProps, NodeToolbar } from '@xyflow/<|fim_middle|>react';
const Custom... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { Position, type Node } from '@xyflow/react';
i<|fim_suffix|>ode-start-top',
},
],
},
} satisfies FlowConfig;
<|fim_middle|>mport ToolbarNode from './components/ToolbarNode';
const positions = ['top', 'right', 'bottom', 'left'];
const alignments = ['start', 'center', 'end'];
const nod... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> <div
className="drag-handle custom-drag-handle"
style={{
display: 'inline-block',
width: '25px',
height: '25px',
backgroundColor: 'green',
}}
/>
</div>
);
};
<|fim_prefix|>export default () => {
return (
<div
classNa... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import DragHandleNode from './components/DragHandleNode';
export default {
flowProps: {
fitView: true,
deleteKeyCode: 'd',
multiSelectionKeyCode: 's',
nodeTypes: {
DragHandleNode,
},
nodeDragThreshold: 0,
nodes: [
{
id: 'Node-1',
data: { label: 'N... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export default {<|fim_suffix|>position: { x: -100, y: 100 },
},
{
id: '3',
data: { label: '3' },
position: { x: 100, y: 100 },
},
],
edges: [
{
id: 'first-edge',
source: '1',
target: '2',
},
{
id: 'second-e... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>second-edge',
source: '1',
target: '3',
},
],
},
} satisfies FlowConfig;
<|fim_prefix|>export default {
flowProps: {
panOnScroll: true,
defaultViewport: { x: 1.23, y: 9.87, zoom: 1.234 },
autoPanOnConnect: false,
autoPanOnNodeDrag: false,
nodes: [
{
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|> </StrictMode>
);
<|fim_prefix|>import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App/index';
import '@xyflow/react/dist/style.css';
import './index.css';
createRoot(document.getElementById('root') as HTMLElement).render(
<|fim_middle|> <StrictMode>
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>>
<|fim_prefix|>/// <reference typ<|fim_middle|>es="vite/client" /<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConf<|fim_suffix|>root
allow: ['../..'],
},
},
});
<|fim_middle|>ig({
plugins: [react()],
server: {
fs: {
// Allow serving files from one level up to... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import prettier from 'eslint-config-prettier';
import { fileURLToPath } from 'node:url';
import { includeIgnoreFile } from '@eslint/compat';
import js from '@eslint/js';
import svelte from 'eslint-plugin-svelte';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import ts from '... | fim | xyflow/xyflow | javascript |
<|fim_prefix|>// See https://kit.svelte.dev/docs/types#app
<|fim_suffix|>
flowProps?: Omit<SvelteFlowProps, 'nodes' | 'edges'> & { nodes: Node[]; edges: Edge[] };
panelProps?: PanelProps;
backgroundProps?: BackgroundProps;
controlsProps?: ControlsProps;
minimapProps?: MiniMapProps;
}
}
export {};
<|fim_midd... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>
<|fim_prefix|>export { default<|fim_middle|> as Header } from './Header.svelte';<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { MarkerType } from '@xyflow/svelte';
export default {
flowProps: {
fitView: true,
multiSelectionKey: ['Meta', 's'],
deleteKey: 'd',
nodes: [
{
id: '1',
data: { label: '1' },
position: { x: 0, y: 0 },
type: 'input'
},
{
id: '2',
data: { label: '2' },
p... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>orEach((position, posIndex) => {
alignments.forEach((align, alignIndex) => {
const id = `node-${align}-${position}`;
nodes.push({
id,
type: 'ToolbarNode',
data: {
label: `toolbar ${position} ${align}`,
toolbarPosition: position as Position,
toolbarAlign: align,
toolbarVisible... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import DragHandleNode from './components/DragHandleNode.svelte';
export default {
flowProps: {
fitView: true,
nodeDragThreshold: 0,
autoPanOnConnect: false,
autoPanOnNodeDrag: false,
deleteKey: 'd',
nodeTypes: {
DragHandleNode
},
nodes: [
{
id: 'Node-1',
data: { label: 'Nod... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export default {
flowProps: {
zoomOnScroll: false,
// zoomActivationKey: 'Space',
// panOnDrag: false,
// panOnScroll: false,
panActivationKey: 'Space',
fitView: true,
nodes: [
{
id: '1',
data: { label: '1' },
position: { x: 0, y: 0 },
type: 'input'
},
{
<|fim_su... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export default {
flowProps: {
minZoom: 0.25,
maxZoom: 4,
fitView: true,
nodes: [
{
id: '1',
data: { label: '1' },
position: { x: 0, y: 0 },
<|fim_suffix|>'input'
},
{
id: '2',
data: { label: '2' },
position: { x: -100, y: 100 }
},
{
id: '3',
data: ... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export default {
flowProps: {
panOnScroll<|fim_suffix|> id: '2',
data: { label: '2' },
position: { x: -100, y: 100 }
},
{
id: '3',
data: { label: '3' },
position: { x: 100, y: 100 }
}
],
edges: [
{
id: 'first-edge',
source: '1',
target: '2'
},
{
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>w');
}
}
<|fim_prefix|>import { redirect } from '@sveltejs/kit';
/** @type {imp<|fim_middle|>ort('./$types').LayoutServerLoad} */
export function load({ route }) {
if (route.id === '/') {
throw redirect(307, '/examples/overvie<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|>der = false;
<|fim_prefix|>export const ssr = false;
export const prere<|fim_middle|>n<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|> position
},
{
id: '5',
data: { label: 'node 5' },
position
},
{
id: '6',
type: 'output',
data: { label: 'output' },
position
},
{ id: '7', type: 'output', data: { label: 'output' }, position }
];
export const initialEdges: Edge[] = [
{ id: 'e12', source: '1', target: '2', type: edge... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>t.entries(files).reduce(
(filesCleanAcc: { [key: string]: string }, [filename, file]) => {
if (filename === './+page.svelte') {
filesCleanAcc['App.svelte'] = file;
} else {
filesCleanAcc[filename.replace('./', '')] = file;
}
return filesCleanAcc;
},
{}
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>
<|fim_prefix|>import type { Node, Edge } from '@xyflow/svelte';
export const initialNodes: Node[] = [
{
id: '1',
data: { label: 'Node 1' },
position: { x: 0, y: 0 },
style: 'width: 200px; height: 100px;'
},
{
id: '2',
data: { label: 'Node<|fim_middle|> 2' },
position: { x: 0, y: 150 },
... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>{
return keepAspectRatio;
},
set keepAspectRatio(value: boolean) {
keepAspectRatio = value;
}
};
}
export const store = createStore();
<|fim_prefix|>function createStore() {
let keepAspectRati<|fim_middle|>o = $state(false);
return {
get keepAspectRatio() <|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import {
type Node,
type CoordinateExtent,
type ShouldResize,
type OnResizeStart,
type OnResize,
type OnResizeEnd
} from '@xyflow/svelte';
expo<|fim_suffix|>sVisible?: boolean;
extent?: CoordinateExtent;
}>;
<|fim_middle|>rt type ResizeNode = Node<{
minWidth?: number;
maxWidth?: number;
minHeig... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ests/${params.topic}/${params.example}.ts`];
if (!flowConfig) {
throw error(404, 'Not found');
}
return {
flowConfig
};
}
<|fim_prefix|>import { error } from '@sveltejs/kit';
const flowConfigs = import.meta.glob<FlowConfig>('/src/generic-tests/**/*.ts', {
eager: true,
import: 'default'
});
/... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult http<|fim_suffix|> {
$components: './src/components'
}
}
};
export default config;
<|fim_middle|>s://kit.svelte.de... | fim | xyflow/xyflow | javascript |
<|fim_suffix|>
}
});
<|fim_prefix|>import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineCo<|fim_middle|>nfig({
plugins: [sveltekit()],
build: {
sourcemap: true,
minify: false
},
server: {
fs: {
// Allow serving files from one level up to the project ro... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>eslint-config'],
};
<|fim_prefix|>module.exports = {
root: true,
extends:<|fim_middle|> ['@xyflow/<|endoftext|> | fim | xyflow/xyflow | javascript |
<|fim_prefix|>import { CSSProperties, memo, useRef } from 'react';
import cc from 'classcat';
import { shallow } from 'zustand/shallow';
import { useStore } from '../../hooks/useStore';
import { DotPattern, LinePattern } from './Patterns';
import { containerStyle } from '../../styles/utils<|fim_suffix|>[number, number... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ssName])}
/>
);
}
type DotPatternProps = {
radius: number;
className?: string;
};
export function DotPattern({ radius, className }: DotPatternProps) {
return (
<circle cx={radius} cy={radius} r={radius} className={cc(['react-flow__background-pattern', 'dots', className])} />
);
}
<|fim... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export { Background } from './Background';
export { Background<|fim_suffix|>s';
<|fim_middle|>Variant, type BackgroundProps } from './type<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { CSSProperties } from 'react';
/**
* The three variants are exported as an enum for convenience. You can either import
* the enum and use it like `BackgroundVariant.Lines` or you can use the raw string
* value directly.
* @public
*/
export enum BackgroundVariant {
Lines = 'lines',
Dots =... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>(
<button type="button" className={cc(['react-flow__controls-button', className])} {...rest}>
{children}
</button>
);
}
<|fim_prefix|>import cc from 'classcat';
import type { ControlButtonProps } from './types';
/**
* You can add buttons to the control panel by using the `<ControlButton... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { memo } from 'react';
import <|fim_suffix|>ig['controls.zoomIn.ariaLabel']}
disabled={maxZoomReached}
>
<PlusIcon />
</ControlButton>
<ControlButton
onClick={onZoomOutHandler}
className="react-flow__controls-zoomout"
... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export function FitViewIcon() {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 30">
<path d="M3.692 4.63c0-.<|fim_suffix|>v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.9... | fim | xyflow/xyflow | typescript |
export function LockIcon() {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32">
<path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 ... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>mlns="http://www.w3.org/2000/svg" viewBox="0 0 32 5">
<path d="M0 0h32v4.2H0z" />
</svg>
);
}
<|fim_prefix|>export fu<|fim_middle|>nction MinusIcon() {
return (
<svg x<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|>2 32">
<path d="M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z" />
</svg>
);
}
<|fim_prefix|>export function PlusIcon() {
return (
<svg xmlns="http://www.w3.org/2<|fim_middle|>000/svg" viewBox="0 0 3<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|>3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z" />
</svg>
);
}
<|fim_prefix|>export function UnlockIcon() {
return (
<svg ... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>trolButtonProps } from './types';
<|fim_prefix|>export { Controls } from './Controls';
export { ControlBu<|fim_middle|>tton } from './ControlButton';
export type { ControlProps, Con<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_suffix|>ical';
};
/**
* @expand
*/
export type ControlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
<|fim_prefix|>import type { ButtonHTMLAttributes, ReactNode } from 'react';
import type { PanelPosition } from '@xyflow/system';
import type { FitViewOptions } from '../../types';
/**
* @expand
*/
e... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import { useCallback } from 'react';
import cc from 'classcat';
import { shallow } from 'zustand/shallow';
import { getEdgeToolbarTransform } from '@xyflow/system';
import { EdgeLabelRenderer } from '../../components/EdgeLabelRender<|fim_suffix|>eact";
*
* export function CustomEdge({ id, data, ...prop... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>export { Ed<|fim_suffix|>port type { EdgeToolbarProps } from './types';
<|fim_middle|>geToolbar } from './EdgeToolbar';
ex<|endoftext|> | fim | xyflow/xyflow | typescript |
<|fim_prefix|>import type { HTMLAttributes, ReactNode } from 'react';
import type { EdgeToolbarBaseProps } from '@xyflow/system';
/**
* @inline
*/
export type EdgeToolbarPro<|fim_suffix|>ched to an edge.
*/
edgeId: string;
children?: ReactNode;
};
<|fim_middle|>ps = EdgeToolbarBaseProps &
HTMLAttrib... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { memo, useEffect, useRef, type MouseEvent, useCallback, CSSProperties } from 'react';
import cc from 'classcat';
import { shallow } from 'zustand/shall<|fim_suffix|>efault function Flow()... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>}
rx={borderRadius}
ry={borderRadius}
width={width}
height={height}
style={{
fill,
stroke: strokeColor,
strokeWidth,
}}
shapeRendering={shapeRendering}
onClick={onClick ? (event) => onClick(event, id) : undefined}
/>
);
}
expor... | fim | xyflow/xyflow | typescript |
<|fim_prefix|>/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { ComponentType, memo } from 'react';
import { getNodeDimensions, nodeHasDimensions } from '@xyflow/system';
import { shallow } from 'zustand/shallow';
import { useStore } from '../../hoo... | fim | xyflow/xyflow | typescript |
<|fim_suffix|>m './MiniMap';
export { MiniMapNode } from './MiniMapNode';
export * from './types';
<|fim_prefix|>export { MiniMap <|fim_middle|>} fro<|endoftext|> | fim | xyflow/xyflow | typescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.