Merge branch 'main' into v11
This commit is contained in:
+1
-1
@@ -2,4 +2,4 @@ nodeLinker: node-modules
|
|||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
|
||||||
spec: "@yarnpkg/plugin-workspace-tools"
|
spec: '@yarnpkg/plugin-workspace-tools'
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ import ColorSelectorNode from './ColorSelectorNode';
|
|||||||
|
|
||||||
const onInit = (reactFlowInstance: ReactFlowInstance) => {
|
const onInit = (reactFlowInstance: ReactFlowInstance) => {
|
||||||
console.log('flow loaded:', reactFlowInstance);
|
console.log('flow loaded:', reactFlowInstance);
|
||||||
reactFlowInstance.fitView();
|
|
||||||
};
|
};
|
||||||
const onNodeDragStop = (_: MouseEvent, node: Node) =>
|
|
||||||
console.log('drag stop', node);
|
const onNodeDragStop = (_: MouseEvent, node: Node) => console.log('drag stop', node);
|
||||||
const onNodeClick = (_: MouseEvent, node: Node) => console.log('click', node);
|
const onNodeClick = (_: MouseEvent, node: Node) => console.log('click', node);
|
||||||
|
|
||||||
const initBgColor = '#1A192B';
|
const initBgColor = '#1A192B';
|
||||||
|
|||||||
@@ -1,19 +1,4 @@
|
|||||||
.react-flow__edge {
|
.react-flow__edge {
|
||||||
&.selected,
|
|
||||||
&:focus,
|
|
||||||
&:focus-visible {
|
|
||||||
outline: none;
|
|
||||||
|
|
||||||
.react-flow__edge-path {
|
|
||||||
stroke: #555;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&.animated path {
|
|
||||||
stroke-dasharray: 5;
|
|
||||||
animation: dashdraw 0.5s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.updating {
|
&.updating {
|
||||||
.react-flow__edge-path {
|
.react-flow__edge-path {
|
||||||
stroke: #777;
|
stroke: #777;
|
||||||
@@ -21,20 +6,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.react-flow__edge-path {
|
|
||||||
stroke: #b1b1b7;
|
|
||||||
stroke-width: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.react-flow__edge-text {
|
.react-flow__edge-text {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.react-flow__connection-path {
|
|
||||||
stroke: #b1b1b7;
|
|
||||||
stroke-width: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.react-flow__node-default,
|
.react-flow__node-default,
|
||||||
.react-flow__node-input,
|
.react-flow__node-input,
|
||||||
.react-flow__node-output,
|
.react-flow__node-output,
|
||||||
@@ -52,6 +27,7 @@
|
|||||||
&.selected,
|
&.selected,
|
||||||
&:focus,
|
&:focus,
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
|
border: none;
|
||||||
box-shadow: 0 0 0 0.5px #1a192b;
|
box-shadow: 0 0 0 0.5px #1a192b;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
@@ -72,8 +48,9 @@
|
|||||||
&.selected,
|
&.selected,
|
||||||
&:focus,
|
&:focus,
|
||||||
&:focus-visible {
|
&:focus-visible {
|
||||||
outline: none;
|
border: none;
|
||||||
box-shadow: 0 0 0 0.5px #1a192b;
|
box-shadow: 0 0 0 0.5px #1a192b;
|
||||||
|
outline: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,6 +153,7 @@ export function handleMouseDown({
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (connection.source !== connection.target && elementBelow) {
|
if (connection.source !== connection.target && elementBelow) {
|
||||||
|
resetRecentHandle(recentHoveredHandle);
|
||||||
recentHoveredHandle = elementBelow;
|
recentHoveredHandle = elementBelow;
|
||||||
elementBelow.classList.add('react-flow__handle-connecting');
|
elementBelow.classList.add('react-flow__handle-connecting');
|
||||||
elementBelow.classList.toggle('react-flow__handle-valid', isValid);
|
elementBelow.classList.toggle('react-flow__handle-valid', isValid);
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ const FlowRenderer = ({
|
|||||||
zoomOnDoubleClick,
|
zoomOnDoubleClick,
|
||||||
panOnDrag,
|
panOnDrag,
|
||||||
defaultViewport,
|
defaultViewport,
|
||||||
|
translateExtent,
|
||||||
|
minZoom,
|
||||||
|
maxZoom,
|
||||||
preventScrolling,
|
preventScrolling,
|
||||||
onSelectionContextMenu,
|
onSelectionContextMenu,
|
||||||
noWheelClassName,
|
noWheelClassName,
|
||||||
@@ -90,6 +93,9 @@ const FlowRenderer = ({
|
|||||||
zoomOnDoubleClick={zoomOnDoubleClick}
|
zoomOnDoubleClick={zoomOnDoubleClick}
|
||||||
panOnDrag={panOnDrag}
|
panOnDrag={panOnDrag}
|
||||||
defaultViewport={defaultViewport}
|
defaultViewport={defaultViewport}
|
||||||
|
translateExtent={translateExtent}
|
||||||
|
minZoom={minZoom}
|
||||||
|
maxZoom={maxZoom}
|
||||||
zoomActivationKeyCode={zoomActivationKeyCode}
|
zoomActivationKeyCode={zoomActivationKeyCode}
|
||||||
preventScrolling={preventScrolling}
|
preventScrolling={preventScrolling}
|
||||||
noWheelClassName={noWheelClassName}
|
noWheelClassName={noWheelClassName}
|
||||||
|
|||||||
@@ -5,7 +5,15 @@ import NodeRenderer from '../NodeRenderer';
|
|||||||
import EdgeRenderer from '../EdgeRenderer';
|
import EdgeRenderer from '../EdgeRenderer';
|
||||||
import ViewportWrapper from '../Viewport';
|
import ViewportWrapper from '../Viewport';
|
||||||
import useOnInitHandler from '../../hooks/useOnInitHandler';
|
import useOnInitHandler from '../../hooks/useOnInitHandler';
|
||||||
import { NodeTypesWrapped, EdgeTypesWrapped, ConnectionLineType, KeyCode, ReactFlowProps, Viewport } from '../../types';
|
import {
|
||||||
|
NodeTypesWrapped,
|
||||||
|
EdgeTypesWrapped,
|
||||||
|
ConnectionLineType,
|
||||||
|
KeyCode,
|
||||||
|
ReactFlowProps,
|
||||||
|
Viewport,
|
||||||
|
CoordinateExtent,
|
||||||
|
} from '../../types';
|
||||||
|
|
||||||
export interface GraphViewProps
|
export interface GraphViewProps
|
||||||
extends Omit<ReactFlowProps, 'onSelectionChange' | 'nodes' | 'edges' | 'nodeTypes' | 'edgeTypes'> {
|
extends Omit<ReactFlowProps, 'onSelectionChange' | 'nodes' | 'edges' | 'nodeTypes' | 'edgeTypes'> {
|
||||||
@@ -16,6 +24,9 @@ export interface GraphViewProps
|
|||||||
multiSelectionKeyCode: KeyCode | null;
|
multiSelectionKeyCode: KeyCode | null;
|
||||||
connectionLineType: ConnectionLineType;
|
connectionLineType: ConnectionLineType;
|
||||||
onlyRenderVisibleElements: boolean;
|
onlyRenderVisibleElements: boolean;
|
||||||
|
translateExtent: CoordinateExtent;
|
||||||
|
minZoom: number;
|
||||||
|
maxZoom: number;
|
||||||
defaultMarkerColor: string;
|
defaultMarkerColor: string;
|
||||||
selectNodesOnDrag: boolean;
|
selectNodesOnDrag: boolean;
|
||||||
noDragClassName: string;
|
noDragClassName: string;
|
||||||
@@ -54,6 +65,9 @@ const GraphView = ({
|
|||||||
elementsSelectable,
|
elementsSelectable,
|
||||||
selectNodesOnDrag,
|
selectNodesOnDrag,
|
||||||
defaultViewport,
|
defaultViewport,
|
||||||
|
translateExtent,
|
||||||
|
minZoom,
|
||||||
|
maxZoom,
|
||||||
preventScrolling,
|
preventScrolling,
|
||||||
defaultMarkerColor,
|
defaultMarkerColor,
|
||||||
zoomOnScroll,
|
zoomOnScroll,
|
||||||
@@ -110,6 +124,9 @@ const GraphView = ({
|
|||||||
panOnScrollMode={panOnScrollMode}
|
panOnScrollMode={panOnScrollMode}
|
||||||
panOnDrag={panOnDrag}
|
panOnDrag={panOnDrag}
|
||||||
defaultViewport={defaultViewport}
|
defaultViewport={defaultViewport}
|
||||||
|
translateExtent={translateExtent}
|
||||||
|
minZoom={minZoom}
|
||||||
|
maxZoom={maxZoom}
|
||||||
onSelectionContextMenu={onSelectionContextMenu}
|
onSelectionContextMenu={onSelectionContextMenu}
|
||||||
preventScrolling={preventScrolling}
|
preventScrolling={preventScrolling}
|
||||||
noDragClassName={noDragClassName}
|
noDragClassName={noDragClassName}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ const NodeRenderer = (props: NodeRendererProps) => {
|
|||||||
nodeElement: entry.target as HTMLDivElement,
|
nodeElement: entry.target as HTMLDivElement,
|
||||||
forceUpdate: true,
|
forceUpdate: true,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
updateNodeDimensions(updates);
|
updateNodeDimensions(updates);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import { createNodeTypes } from '../NodeRenderer/utils';
|
|||||||
import { useNodeOrEdgeTypes } from './utils';
|
import { useNodeOrEdgeTypes } from './utils';
|
||||||
import Wrapper from './Wrapper';
|
import Wrapper from './Wrapper';
|
||||||
import A11yDescriptions from '../../components/A11yDescriptions';
|
import A11yDescriptions from '../../components/A11yDescriptions';
|
||||||
|
import { infiniteExtent } from '../../store/initialState';
|
||||||
|
|
||||||
const defaultNodeTypes: NodeTypes = {
|
const defaultNodeTypes: NodeTypes = {
|
||||||
input: InputNode,
|
input: InputNode,
|
||||||
@@ -108,10 +109,10 @@ const ReactFlow = forwardRef<ReactFlowRefType, ReactFlowProps>(
|
|||||||
nodesDraggable,
|
nodesDraggable,
|
||||||
nodesConnectable,
|
nodesConnectable,
|
||||||
elementsSelectable,
|
elementsSelectable,
|
||||||
minZoom,
|
|
||||||
maxZoom,
|
|
||||||
defaultViewport = initDefaultViewport,
|
defaultViewport = initDefaultViewport,
|
||||||
translateExtent,
|
minZoom = 0.5,
|
||||||
|
maxZoom = 2,
|
||||||
|
translateExtent = infiniteExtent,
|
||||||
preventScrolling = true,
|
preventScrolling = true,
|
||||||
nodeExtent,
|
nodeExtent,
|
||||||
defaultMarkerColor = '#b1b1b7',
|
defaultMarkerColor = '#b1b1b7',
|
||||||
@@ -188,6 +189,9 @@ const ReactFlow = forwardRef<ReactFlowRefType, ReactFlowProps>(
|
|||||||
onlyRenderVisibleElements={onlyRenderVisibleElements}
|
onlyRenderVisibleElements={onlyRenderVisibleElements}
|
||||||
selectNodesOnDrag={selectNodesOnDrag}
|
selectNodesOnDrag={selectNodesOnDrag}
|
||||||
defaultViewport={defaultViewport}
|
defaultViewport={defaultViewport}
|
||||||
|
translateExtent={translateExtent}
|
||||||
|
minZoom={minZoom}
|
||||||
|
maxZoom={maxZoom}
|
||||||
preventScrolling={preventScrolling}
|
preventScrolling={preventScrolling}
|
||||||
zoomOnScroll={zoomOnScroll}
|
zoomOnScroll={zoomOnScroll}
|
||||||
zoomOnPinch={zoomOnPinch}
|
zoomOnPinch={zoomOnPinch}
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ const ZoomPane = ({
|
|||||||
elementsSelectable,
|
elementsSelectable,
|
||||||
panOnDrag = true,
|
panOnDrag = true,
|
||||||
defaultViewport,
|
defaultViewport,
|
||||||
|
translateExtent,
|
||||||
|
minZoom,
|
||||||
|
maxZoom,
|
||||||
zoomActivationKeyCode,
|
zoomActivationKeyCode,
|
||||||
preventScrolling = true,
|
preventScrolling = true,
|
||||||
children,
|
children,
|
||||||
@@ -64,7 +67,6 @@ const ZoomPane = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (zoomPane.current) {
|
if (zoomPane.current) {
|
||||||
const { minZoom, maxZoom, translateExtent } = store.getState();
|
|
||||||
const d3ZoomInstance = zoom().scaleExtent([minZoom, maxZoom]).translateExtent(translateExtent);
|
const d3ZoomInstance = zoom().scaleExtent([minZoom, maxZoom]).translateExtent(translateExtent);
|
||||||
const selection = select(zoomPane.current as Element).call(d3ZoomInstance);
|
const selection = select(zoomPane.current as Element).call(d3ZoomInstance);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user