@reactflow/minimap
Advanced tools
Comparing version 11.5.4 to 11.6.0
@@ -9,6 +9,6 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime'; | ||
const MiniMapNode = ({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, onClick, }) => { | ||
const MiniMapNode = ({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, onClick, selected, }) => { | ||
const { background, backgroundColor } = style || {}; | ||
const fill = (color || background || backgroundColor); | ||
return (jsx("rect", { className: cc(['react-flow__minimap-node', className]), x: x, y: y, rx: borderRadius, ry: borderRadius, width: width, height: height, fill: fill, stroke: strokeColor, strokeWidth: strokeWidth, shapeRendering: shapeRendering, onClick: onClick ? (event) => onClick(event, id) : undefined })); | ||
return (jsx("rect", { className: cc(['react-flow__minimap-node', { selected }, className]), x: x, y: y, rx: borderRadius, ry: borderRadius, width: width, height: height, fill: fill, stroke: strokeColor, strokeWidth: strokeWidth, shapeRendering: shapeRendering, onClick: onClick ? (event) => onClick(event, id) : undefined })); | ||
}; | ||
@@ -33,3 +33,3 @@ MiniMapNode.displayName = 'MiniMapNode'; | ||
const { x, y } = getNodePositionWithOrigin(node, nodeOrigin).positionAbsolute; | ||
return (jsx(NodeComponent, { x: x, y: y, 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: onClick, id: node.id }, node.id)); | ||
return (jsx(NodeComponent, { x: x, y: y, width: node.width, height: node.height, style: node.style, selected: node.selected, className: nodeClassNameFunc(node), color: nodeColorFunc(node), borderRadius: nodeBorderRadius, strokeColor: nodeStrokeColorFunc(node), strokeWidth: nodeStrokeWidth, shapeRendering: shapeRendering, onClick: onClick, id: node.id }, node.id)); | ||
}) })); | ||
@@ -59,3 +59,3 @@ } | ||
// a component properly. | ||
nodeComponent, 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', inversePan = false, zoomStep = 10, }) { | ||
nodeComponent, 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', inversePan = false, zoomStep = 10, offsetScale = 5 }) { | ||
const store = useStoreApi(); | ||
@@ -71,3 +71,3 @@ const svg = useRef(null); | ||
const viewHeight = viewScale * elementHeight; | ||
const offset = 5 * viewScale; | ||
const offset = offsetScale * viewScale; | ||
const x = boundingRect.x - (viewWidth - boundingRect.width) / 2 - offset; | ||
@@ -74,0 +74,0 @@ const y = boundingRect.y - (viewHeight - boundingRect.height) / 2 - offset; |
/// <reference types="react" /> | ||
import type { MiniMapProps } from './types'; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, inversePan, zoomStep, }: MiniMapProps): JSX.Element; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, inversePan, zoomStep, offsetScale }: MiniMapProps): JSX.Element; | ||
declare namespace MiniMap { | ||
@@ -5,0 +5,0 @@ var displayName: string; |
/// <reference types="react" /> | ||
import type { MiniMapNodeProps } from './types'; | ||
declare const _default: import("react").MemoExoticComponent<{ | ||
({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, onClick, }: MiniMapNodeProps): JSX.Element; | ||
({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, onClick, selected, }: MiniMapNodeProps): JSX.Element; | ||
displayName: string; | ||
@@ -6,0 +6,0 @@ }>; |
@@ -22,2 +22,3 @@ import type { ComponentType, CSSProperties, HTMLAttributes, MouseEvent } from 'react'; | ||
zoomStep?: number; | ||
offsetScale?: number; | ||
}; | ||
@@ -39,2 +40,3 @@ export type MiniMapNodes = Pick<MiniMapProps, 'nodeColor' | 'nodeStrokeColor' | 'nodeClassName' | 'nodeBorderRadius' | 'nodeStrokeWidth' | 'nodeComponent'> & { | ||
strokeWidth: number; | ||
selected?: boolean; | ||
style?: CSSProperties; | ||
@@ -41,0 +43,0 @@ onClick?: (event: MouseEvent, id: string) => void; |
/// <reference types="react" /> | ||
import type { MiniMapProps } from './types'; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, inversePan, zoomStep, }: MiniMapProps): JSX.Element; | ||
declare function MiniMap({ style, className, nodeStrokeColor, nodeColor, nodeClassName, nodeBorderRadius, nodeStrokeWidth, nodeComponent, maskColor, maskStrokeColor, maskStrokeWidth, position, onClick, onNodeClick, pannable, zoomable, ariaLabel, inversePan, zoomStep, offsetScale }: MiniMapProps): JSX.Element; | ||
declare namespace MiniMap { | ||
@@ -5,0 +5,0 @@ var displayName: string; |
/// <reference types="react" /> | ||
import type { MiniMapNodeProps } from './types'; | ||
declare const _default: import("react").MemoExoticComponent<{ | ||
({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, onClick, }: MiniMapNodeProps): JSX.Element; | ||
({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, onClick, selected, }: MiniMapNodeProps): JSX.Element; | ||
displayName: string; | ||
@@ -6,0 +6,0 @@ }>; |
@@ -22,2 +22,3 @@ import type { ComponentType, CSSProperties, HTMLAttributes, MouseEvent } from 'react'; | ||
zoomStep?: number; | ||
offsetScale?: number; | ||
}; | ||
@@ -39,2 +40,3 @@ export type MiniMapNodes = Pick<MiniMapProps, 'nodeColor' | 'nodeStrokeColor' | 'nodeClassName' | 'nodeBorderRadius' | 'nodeStrokeWidth' | 'nodeComponent'> & { | ||
strokeWidth: number; | ||
selected?: boolean; | ||
style?: CSSProperties; | ||
@@ -41,0 +43,0 @@ onClick?: (event: MouseEvent, id: string) => void; |
{ | ||
"name": "@reactflow/minimap", | ||
"version": "11.5.4", | ||
"version": "11.6.0", | ||
"description": "Minimap component for React Flow.", | ||
@@ -18,4 +18,12 @@ "keywords": [ | ||
"main": "dist/umd/index.js", | ||
"module": "dist/esm/index.js", | ||
"module": "dist/esm/index.mjs", | ||
"types": "dist/esm/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/esm/index.d.ts", | ||
"import": "./dist/esm/index.mjs", | ||
"require": "./dist/umd/index.js" | ||
}, | ||
"./dist/style.css": "./dist/style.css" | ||
}, | ||
"sideEffects": [ | ||
@@ -34,3 +42,2 @@ "*.css" | ||
"dependencies": { | ||
"@reactflow/core": "11.7.4", | ||
"@types/d3-selection": "^3.0.3", | ||
@@ -41,3 +48,4 @@ "@types/d3-zoom": "^3.0.1", | ||
"d3-zoom": "^3.0.0", | ||
"zustand": "^4.3.1" | ||
"zustand": "^4.4.1", | ||
"@reactflow/core": "11.8.0" | ||
}, | ||
@@ -49,9 +57,9 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@reactflow/eslint-config": "0.0.0", | ||
"@reactflow/rollup-config": "0.0.0", | ||
"@reactflow/tsconfig": "0.0.0", | ||
"@types/node": "^18.7.16", | ||
"@types/react": ">=17", | ||
"react": "^18.2.0", | ||
"typescript": "^4.9.4" | ||
"typescript": "^4.9.4", | ||
"@reactflow/rollup-config": "0.0.0", | ||
"@reactflow/eslint-config": "0.0.0", | ||
"@reactflow/tsconfig": "0.0.0" | ||
}, | ||
@@ -58,0 +66,0 @@ "rollup": { |
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 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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
168841
27
942
+ Added@reactflow/core@11.8.0(transitive)
- Removed@reactflow/core@11.7.4(transitive)
Updated@reactflow/core@11.8.0
Updatedzustand@^4.4.1