@reactflow/minimap
Advanced tools
Comparing version 11.1.0 to 11.2.0
@@ -30,4 +30,5 @@ import { jsx, jsxs } from 'react/jsx-runtime'; | ||
viewBB, | ||
boundingRect: nodes.length > 0 ? getBoundsOfRects(getRectOfNodes(nodes), viewBB) : viewBB, | ||
boundingRect: nodes.length > 0 ? getBoundsOfRects(getRectOfNodes(nodes, s.nodeOrigin), viewBB) : viewBB, | ||
rfId: s.rfId, | ||
nodeOrigin: s.nodeOrigin, | ||
}; | ||
@@ -37,6 +38,6 @@ }; | ||
const ARIA_LABEL_KEY = 'react-flow__minimap-desc'; | ||
function MiniMap({ style, className, nodeStrokeColor = 'transparent', nodeColor = '#e2e2e2', nodeClassName = '', nodeBorderRadius = 5, nodeStrokeWidth = 2, maskColor = 'rgb(240, 240, 240, 0.6)', position = 'bottom-right', onClick, onNodeClick, pannable = false, zoomable = false, }) { | ||
function MiniMap({ style, className, nodeStrokeColor = 'transparent', nodeColor = '#e2e2e2', nodeClassName = '', nodeBorderRadius = 5, nodeStrokeWidth = 2, maskColor = 'rgb(240, 240, 240, 0.6)', maskStrokeColor = 'none', maskStrokeWidth = 1, position = 'bottom-right', onClick, onNodeClick, pannable = false, zoomable = false, ariaLabel = 'React Flow mini map', }) { | ||
const store = useStoreApi(); | ||
const svg = useRef(null); | ||
const { boundingRect, viewBB, nodes, rfId } = useStore(selector, shallow); | ||
const { boundingRect, viewBB, nodes, rfId, nodeOrigin } = useStore(selector, shallow); | ||
const elementWidth = style?.width ?? defaultWidth; | ||
@@ -111,6 +112,4 @@ const elementHeight = style?.height ?? defaultHeight; | ||
: undefined; | ||
return (jsx(Panel, { position: position, style: style, className: cc(['react-flow__minimap', className]), children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y} ${width} ${height}`, role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [jsx("title", { id: labelledBy, children: "React Flow mini map" }), nodes.map((node) => { | ||
return (jsx(MiniMapNode$1, { x: node.positionAbsolute?.x ?? 0, y: node.positionAbsolute?.y ?? 0, width: node.width, height: node.height, style: node.style, className: nodeClassNameFunc(node), color: nodeColorFunc(node), borderRadius: nodeBorderRadius, strokeColor: nodeStrokeColorFunc(node), strokeWidth: nodeStrokeWidth, shapeRendering: shapeRendering, onClick: onSvgNodeClick, id: node.id }, node.id)); | ||
}), jsx("path", { className: "react-flow__minimap-mask", d: `M${x - offset},${y - offset}h${width + offset * 2}v${height + offset * 2}h${-width - offset * 2}z | ||
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fill: maskColor, fillRule: "evenodd" })] }) })); | ||
return (jsx(Panel, { position: position, style: style, className: cc(['react-flow__minimap', className]), children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y} ${width} ${height}`, role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [ariaLabel && jsx("title", { id: labelledBy, children: ariaLabel }), nodes.map((node) => (jsx(MiniMapNode$1, { x: (node.positionAbsolute?.x ?? 0) - nodeOrigin[0] * (node.width ?? 0), y: (node.positionAbsolute?.y ?? 0) - nodeOrigin[1] * (node.height ?? 0), width: node.width, height: node.height, style: node.style, className: nodeClassNameFunc(node), color: nodeColorFunc(node), borderRadius: nodeBorderRadius, strokeColor: nodeStrokeColorFunc(node), strokeWidth: nodeStrokeWidth, shapeRendering: shapeRendering, onClick: onSvgNodeClick, id: node.id }, node.id))), jsx("path", { className: "react-flow__minimap-mask", d: `M${x - offset},${y - offset}h${width + offset * 2}v${height + offset * 2}h${-width - offset * 2}z | ||
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fill: maskColor, fillRule: "evenodd", stroke: maskStrokeColor, strokeWidth: maskStrokeWidth })] }) })); | ||
} | ||
@@ -117,0 +116,0 @@ MiniMap.displayName = 'MiniMap'; |
/// <reference types="react" /> | ||
import type { MiniMapProps } from './types'; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, maskColor, position, onClick, onNodeClick, pannable, zoomable, }: MiniMapProps): JSX.Element; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, }: MiniMapProps): JSX.Element; | ||
declare namespace MiniMap { | ||
@@ -5,0 +5,0 @@ var displayName: string; |
@@ -11,2 +11,4 @@ import type { HTMLAttributes, MouseEvent } from 'react'; | ||
maskColor?: string; | ||
maskStrokeColor?: string; | ||
maskStrokeWidth?: number; | ||
position?: PanelPosition; | ||
@@ -17,3 +19,4 @@ onClick?: (event: MouseEvent, position: XYPosition) => void; | ||
zoomable?: boolean; | ||
ariaLabel?: string | null; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
/// <reference types="react" /> | ||
import type { MiniMapProps } from './types'; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, maskColor, position, onClick, onNodeClick, pannable, zoomable, }: MiniMapProps): JSX.Element; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, }: MiniMapProps): JSX.Element; | ||
declare namespace MiniMap { | ||
@@ -5,0 +5,0 @@ var displayName: string; |
@@ -11,2 +11,4 @@ import type { HTMLAttributes, MouseEvent } from 'react'; | ||
maskColor?: string; | ||
maskStrokeColor?: string; | ||
maskStrokeWidth?: number; | ||
position?: PanelPosition; | ||
@@ -17,3 +19,4 @@ onClick?: (event: MouseEvent, position: XYPosition) => void; | ||
zoomable?: boolean; | ||
ariaLabel?: string | null; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@reactflow/minimap", | ||
"version": "11.1.0", | ||
"version": "11.2.0", | ||
"description": "Minimap component for React Flow.", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"@babel/runtime": "^7.18.9", | ||
"@reactflow/core": "11.2.0", | ||
"@reactflow/core": "11.3.0", | ||
"@types/d3-selection": "^3.0.3", | ||
@@ -37,0 +37,0 @@ "@types/d3-zoom": "^3.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149649
730
+ Added@reactflow/core@11.3.0(transitive)
- Removed@reactflow/core@11.2.0(transitive)
Updated@reactflow/core@11.3.0