refactor(react/svelte): cleanup types

This commit is contained in:
moklick
2023-02-28 18:16:51 +01:00
parent dda21e1fd2
commit 63bb2045f4
96 changed files with 899 additions and 847 deletions
+11 -9
View File
@@ -3,18 +3,9 @@ import { zoomIdentity } from 'd3-zoom';
import { clampPosition, getDimensions, fitView } 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';
@@ -22,6 +13,17 @@ import { applyNodeChanges, createSelectionChange, getSelectionChanges } from '..
import { getHandleBounds } from '../components/Nodes/utils';
import { createNodeInternals, updateAbsoluteNodePositions, updateNodesAndEdgesSelections } from './utils';
import initialState from './initialState';
import type {
ReactFlowState,
Node,
Edge,
NodeDimensionChange,
EdgeSelectionChange,
NodeSelectionChange,
NodePositionChange,
UnselectNodesAndEdgesParams,
NodeChange,
} from '../types';
const createRFStore = () =>
createStore<ReactFlowState>((set, get) => ({
+3 -6
View File
@@ -1,10 +1,7 @@
import { devWarn } from '@reactflow/utils';
import { ConnectionMode, type CoordinateExtent, type ReactFlowStore } from '@reactflow/system';
import { devWarn, infiniteExtent } from '@reactflow/utils';
import { ConnectionMode } from '@reactflow/system';
export const infiniteExtent: CoordinateExtent = [
[Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY],
[Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY],
];
import type { ReactFlowStore } from '../types';
const initialState: ReactFlowStore = {
rfId: '1',
+3 -11
View File
@@ -1,17 +1,9 @@
import type { StoreApi } from 'zustand';
import {
internalsSymbol,
type Edge,
type EdgeSelectionChange,
type Node,
type NodeInternals,
type NodeSelectionChange,
type ReactFlowState,
type XYZPosition,
type NodeOrigin,
} from '@reactflow/system';
import { internalsSymbol, type XYZPosition, type NodeOrigin } from '@reactflow/system';
import { isNumeric, getNodePositionWithOrigin } from '@reactflow/utils';
import type { Edge, EdgeSelectionChange, Node, NodeInternals, NodeSelectionChange, ReactFlowState } from '../types';
type ParentNodes = Record<string, boolean>;
function calculateXYZPosition(