refactor(node-wrapper): add separate folder

This commit is contained in:
moklick
2023-12-16 09:55:30 +01:00
parent b861b47783
commit 20c779f57d
4 changed files with 12 additions and 11 deletions

View File

@@ -8,7 +8,6 @@ import {
internalsSymbol,
isInputDOMNode,
NodeProps,
type XYPosition,
} from '@xyflow/system';
import { useStore, useStoreApi } from '../../hooks/useStore';
@@ -16,15 +15,9 @@ import { Provider } from '../../contexts/NodeIdContext';
import { ARIA_NODE_DESC_KEY } from '../A11yDescriptions';
import useDrag from '../../hooks/useDrag';
import useUpdateNodePositions from '../../hooks/useUpdateNodePositions';
import { handleNodeClick } from './utils';
import { handleNodeClick } from '../Nodes/utils';
import type { NodeWrapperProps } from '../../types';
export const arrowKeyDiffs: Record<string, XYPosition> = {
ArrowUp: { x: 0, y: -1 },
ArrowDown: { x: 0, y: 1 },
ArrowLeft: { x: -1, y: 0 },
ArrowRight: { x: 1, y: 0 },
};
import { arrowKeyDiffs } from './utils';
const NodeWrapper = ({
id,

View File

@@ -0,0 +1,8 @@
import { XYPosition } from '@xyflow/system';
export const arrowKeyDiffs: Record<string, XYPosition> = {
ArrowUp: { x: 0, y: -1 },
ArrowDown: { x: 0, y: 1 },
ArrowLeft: { x: -1, y: 0 },
ArrowRight: { x: 1, y: 0 },
};

View File

@@ -10,9 +10,9 @@ import { getNodesBounds } from '@xyflow/system';
import { useStore, useStoreApi } from '../../hooks/useStore';
import useDrag from '../../hooks/useDrag';
import { arrowKeyDiffs } from '../Nodes/wrapNode';
import useUpdateNodePositions from '../../hooks/useUpdateNodePositions';
import type { Node, ReactFlowState } from '../../types';
import { arrowKeyDiffs } from '../NodeWrapper/utils';
export type NodesSelectionProps = {
onSelectionContextMenu?: (event: MouseEvent, nodes: Node[]) => void;

View File

@@ -7,7 +7,7 @@ import { containerStyle } from '../../styles/utils';
import { GraphViewProps } from '../GraphView';
import type { ReactFlowState } from '../../types';
import useResizeObserver from './useResizeObserver';
import NodeWrapper from '../../components/Nodes/NodeWrapper';
import NodeWrapper from '../../components/NodeWrapper/NodeWrapper';
export type NodeRendererProps = Pick<
GraphViewProps,