refactor(node-wrapper): add separate folder
This commit is contained in:
+2
-9
@@ -8,7 +8,6 @@ import {
|
|||||||
internalsSymbol,
|
internalsSymbol,
|
||||||
isInputDOMNode,
|
isInputDOMNode,
|
||||||
NodeProps,
|
NodeProps,
|
||||||
type XYPosition,
|
|
||||||
} from '@xyflow/system';
|
} from '@xyflow/system';
|
||||||
|
|
||||||
import { useStore, useStoreApi } from '../../hooks/useStore';
|
import { useStore, useStoreApi } from '../../hooks/useStore';
|
||||||
@@ -16,15 +15,9 @@ import { Provider } from '../../contexts/NodeIdContext';
|
|||||||
import { ARIA_NODE_DESC_KEY } from '../A11yDescriptions';
|
import { ARIA_NODE_DESC_KEY } from '../A11yDescriptions';
|
||||||
import useDrag from '../../hooks/useDrag';
|
import useDrag from '../../hooks/useDrag';
|
||||||
import useUpdateNodePositions from '../../hooks/useUpdateNodePositions';
|
import useUpdateNodePositions from '../../hooks/useUpdateNodePositions';
|
||||||
import { handleNodeClick } from './utils';
|
import { handleNodeClick } from '../Nodes/utils';
|
||||||
import type { NodeWrapperProps } from '../../types';
|
import type { NodeWrapperProps } from '../../types';
|
||||||
|
import { arrowKeyDiffs } from './utils';
|
||||||
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 },
|
|
||||||
};
|
|
||||||
|
|
||||||
const NodeWrapper = ({
|
const NodeWrapper = ({
|
||||||
id,
|
id,
|
||||||
@@ -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 },
|
||||||
|
};
|
||||||
@@ -10,9 +10,9 @@ import { getNodesBounds } from '@xyflow/system';
|
|||||||
|
|
||||||
import { useStore, useStoreApi } from '../../hooks/useStore';
|
import { useStore, useStoreApi } from '../../hooks/useStore';
|
||||||
import useDrag from '../../hooks/useDrag';
|
import useDrag from '../../hooks/useDrag';
|
||||||
import { arrowKeyDiffs } from '../Nodes/wrapNode';
|
|
||||||
import useUpdateNodePositions from '../../hooks/useUpdateNodePositions';
|
import useUpdateNodePositions from '../../hooks/useUpdateNodePositions';
|
||||||
import type { Node, ReactFlowState } from '../../types';
|
import type { Node, ReactFlowState } from '../../types';
|
||||||
|
import { arrowKeyDiffs } from '../NodeWrapper/utils';
|
||||||
|
|
||||||
export type NodesSelectionProps = {
|
export type NodesSelectionProps = {
|
||||||
onSelectionContextMenu?: (event: MouseEvent, nodes: Node[]) => void;
|
onSelectionContextMenu?: (event: MouseEvent, nodes: Node[]) => void;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { containerStyle } from '../../styles/utils';
|
|||||||
import { GraphViewProps } from '../GraphView';
|
import { GraphViewProps } from '../GraphView';
|
||||||
import type { ReactFlowState } from '../../types';
|
import type { ReactFlowState } from '../../types';
|
||||||
import useResizeObserver from './useResizeObserver';
|
import useResizeObserver from './useResizeObserver';
|
||||||
import NodeWrapper from '../../components/Nodes/NodeWrapper';
|
import NodeWrapper from '../../components/NodeWrapper/NodeWrapper';
|
||||||
|
|
||||||
export type NodeRendererProps = Pick<
|
export type NodeRendererProps = Pick<
|
||||||
GraphViewProps,
|
GraphViewProps,
|
||||||
|
|||||||
Reference in New Issue
Block a user