feat(packages): add @reactflow/system and @reactflow/utils

This commit is contained in:
moklick
2023-02-16 21:54:09 +01:00
parent a12c893226
commit 3920fca670
90 changed files with 375 additions and 1152 deletions
+17 -17
View File
@@ -1,27 +1,27 @@
import { createStore } from 'zustand';
import { zoomIdentity } from 'd3-zoom';
import { internalsSymbol } from '@reactflow/system';
import { clampPosition, getDimensions } from '@reactflow/utils';
import {
internalsSymbol,
type ReactFlowState,
type Node,
type Edge,
type NodeDimensionUpdate,
type CoordinateExtent,
type NodeDimensionChange,
type EdgeSelectionChange,
type NodeSelectionChange,
type NodePositionChange,
type NodeDragItem,
type UnselectNodesAndEdgesParams,
type NodeChange,
type XYPosition,
} from '@reactflow/system';
import { clampPosition, getDimensions } from '../utils';
import { applyNodeChanges, createSelectionChange, getSelectionChanges } from '../utils/changes';
import { getHandleBounds } from '../components/Nodes/utils';
import { createNodeInternals, fitView, updateAbsoluteNodePositions, updateNodesAndEdgesSelections } from './utils';
import initialState from './initialState';
import type {
ReactFlowState,
Node,
Edge,
NodeDimensionUpdate,
CoordinateExtent,
NodeDimensionChange,
EdgeSelectionChange,
NodeSelectionChange,
NodePositionChange,
NodeDragItem,
UnselectNodesAndEdgesParams,
NodeChange,
XYPosition,
} from '../types';
const createRFStore = () =>
createStore<ReactFlowState>((set, get) => ({
+2 -3
View File
@@ -1,6 +1,5 @@
import { devWarn } from '../utils';
import { ConnectionMode } from '../types';
import type { CoordinateExtent, ReactFlowStore } from '../types';
import { devWarn } from '@reactflow/utils';
import { ConnectionMode, type CoordinateExtent, type ReactFlowStore } from '@reactflow/system';
export const infiniteExtent: CoordinateExtent = [
[Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
+19 -15
View File
@@ -1,20 +1,24 @@
import { zoomIdentity } from 'd3-zoom';
import type { StoreApi } from 'zustand';
import { internalsSymbol } from '@reactflow/system';
import { isNumeric } from '../utils';
import { getD3Transition, getRectOfNodes, getTransformForBounds, getNodePositionWithOrigin } from '../utils/graph';
import type {
Edge,
EdgeSelectionChange,
Node,
NodeInternals,
NodeSelectionChange,
ReactFlowState,
XYZPosition,
FitViewOptions,
NodeOrigin,
} from '../types';
import {
internalsSymbol,
type Edge,
type EdgeSelectionChange,
type Node,
type NodeInternals,
type NodeSelectionChange,
type ReactFlowState,
type XYZPosition,
type FitViewOptions,
type NodeOrigin,
} from '@reactflow/system';
import {
isNumeric,
getD3Transition,
getRectOfNodes,
getTransformForBounds,
getNodePositionWithOrigin,
} from '@reactflow/utils';
type ParentNodes = Record<string, boolean>;