@xyflow/svelte
Advanced tools
Comparing version 0.0.26 to 0.0.27
export type PaneProps = { | ||
panOnDrag?: boolean | number[]; | ||
selectionOnDrag?: boolean; | ||
}; |
@@ -40,2 +40,3 @@ import type { DOMAttributes } from 'svelte/elements'; | ||
panOnDrag?: boolean | number[]; | ||
selectionOnDrag?: boolean; | ||
onlyRenderVisibleElements?: boolean; | ||
@@ -42,0 +43,0 @@ autoPanOnConnect?: boolean; |
@@ -28,4 +28,4 @@ import { type Writable } from 'svelte/store'; | ||
}; | ||
screenToFlowCoordinate: (position: XYPosition) => XYPosition; | ||
flowToScreenCoordinate: (position: XYPosition) => XYPosition; | ||
screenToFlowPosition: (position: XYPosition) => XYPosition; | ||
flowToScreenPosition: (position: XYPosition) => XYPosition; | ||
viewport: Writable<Viewport>; | ||
@@ -32,0 +32,0 @@ getConnectedEdges: (id: string | (Node | { |
import { get } from 'svelte/store'; | ||
import { getIncomersBase, getOutgoersBase, getOverlappingArea, isRectObject, nodeToRect, pointToRendererPoint, getTransformForBounds, getElementsToRemove, rendererPointToPoint } from '@xyflow/system'; | ||
import { getIncomersBase, getOutgoersBase, getOverlappingArea, isRectObject, nodeToRect, pointToRendererPoint, getViewportForBounds, getElementsToRemove, rendererPointToPoint } from '@xyflow/system'; | ||
import { useStore } from '../store'; | ||
@@ -41,8 +41,4 @@ export function useSvelteFlow() { | ||
fitBounds: (bounds, options) => { | ||
const [x, y, zoom] = getTransformForBounds(bounds, get(width), get(height), get(minZoom), get(maxZoom), options?.padding ?? 0.1); | ||
get(panZoom)?.setViewport({ | ||
x, | ||
y, | ||
zoom | ||
}, { duration: options?.duration }); | ||
const viewport = getViewportForBounds(bounds, get(width), get(height), get(minZoom), get(maxZoom), options?.padding ?? 0.1); | ||
get(panZoom)?.setViewport(viewport, { duration: options?.duration }); | ||
}, | ||
@@ -93,28 +89,28 @@ getIntersectingNodes: (nodeOrRect, partially = true, nodesToIntersect) => { | ||
}, | ||
screenToFlowCoordinate: (position) => { | ||
screenToFlowPosition: (position) => { | ||
const _domNode = get(domNode); | ||
if (_domNode) { | ||
const _snapGrid = get(snapGrid); | ||
const { x, y, zoom } = get(viewport); | ||
const { x: domX, y: domY } = _domNode.getBoundingClientRect(); | ||
const correctedPosition = { | ||
x: position.x - domX, | ||
y: position.y - domY | ||
}; | ||
return pointToRendererPoint(correctedPosition, [x, y, zoom], _snapGrid !== null, _snapGrid || [1, 1]); | ||
if (!_domNode) { | ||
return position; | ||
} | ||
return { x: 0, y: 0 }; | ||
const _snapGrid = get(snapGrid); | ||
const { x, y, zoom } = get(viewport); | ||
const { x: domX, y: domY } = _domNode.getBoundingClientRect(); | ||
const correctedPosition = { | ||
x: position.x - domX, | ||
y: position.y - domY | ||
}; | ||
return pointToRendererPoint(correctedPosition, [x, y, zoom], _snapGrid !== null, _snapGrid || [1, 1]); | ||
}, | ||
flowToScreenCoordinate: (position) => { | ||
flowToScreenPosition: (position) => { | ||
const _domNode = get(domNode); | ||
if (_domNode) { | ||
const { x, y, zoom } = get(viewport); | ||
const { x: domX, y: domY } = _domNode.getBoundingClientRect(); | ||
const rendererPosition = rendererPointToPoint(position, [x, y, zoom]); | ||
return { | ||
x: rendererPosition.x + domX, | ||
y: rendererPosition.y + domY | ||
}; | ||
if (!_domNode) { | ||
return position; | ||
} | ||
return { x: 0, y: 0 }; | ||
const { x, y, zoom } = get(viewport); | ||
const { x: domX, y: domY } = _domNode.getBoundingClientRect(); | ||
const rendererPosition = rendererPointToPoint(position, [x, y, zoom]); | ||
return { | ||
x: rendererPosition.x + domX, | ||
y: rendererPosition.y + domY | ||
}; | ||
}, | ||
@@ -121,0 +117,0 @@ getConnectedEdges: (node) => { |
@@ -23,2 +23,2 @@ export { SvelteFlow } from './container/SvelteFlow'; | ||
export { type SmoothStepPathOptions, type BezierPathOptions, ConnectionLineType, type EdgeMarker, type EdgeMarkerType, MarkerType, type OnMove, type OnMoveStart, type OnMoveEnd, type Connection, type ConnectionStatus, ConnectionMode, type OnConnectStartParams, type OnConnectStart, type OnConnect, type OnConnectEnd, type IsValidConnection, type Viewport, type SnapGrid, PanOnScrollMode, type ViewportHelperFunctionOptions, type SetCenterOptions, type FitBoundsOptions, type PanelPosition, type ProOptions, SelectionMode, type SelectionRect, type OnError, type NodeProps, type NodeOrigin, type OnNodeDrag, type OnSelectionDrag, Position, type XYPosition, type XYZPosition, type Dimensions, type Rect, type Box, type Transform, type CoordinateExtent } from '@xyflow/system'; | ||
export { type GetBezierPathParams, getBezierEdgeCenter, getBezierPath, getEdgeCenter, type GetSmoothStepPathParams, getSmoothStepPath, type GetStraightPathParams, getStraightPath, getTransformForBounds, getRectOfNodes } from '@xyflow/system'; | ||
export { type GetBezierPathParams, getBezierEdgeCenter, getBezierPath, getEdgeCenter, type GetSmoothStepPathParams, getSmoothStepPath, type GetStraightPathParams, getStraightPath, getViewportForBounds, getNodesBounds } from '@xyflow/system'; |
@@ -27,2 +27,2 @@ // main component | ||
// system utils | ||
export { getBezierEdgeCenter, getBezierPath, getEdgeCenter, getSmoothStepPath, getStraightPath, getTransformForBounds, getRectOfNodes } from '@xyflow/system'; | ||
export { getBezierEdgeCenter, getBezierPath, getEdgeCenter, getSmoothStepPath, getStraightPath, getViewportForBounds, getNodesBounds } from '@xyflow/system'; |
export { default as MiniMap } from './Minimap.svelte'; | ||
export * from './types'; |
export { default as MiniMap } from './Minimap.svelte'; | ||
export * from './types'; |
import { readable, writable } from 'svelte/store'; | ||
import { infiniteExtent, SelectionMode, ConnectionMode, ConnectionLineType, devWarn, updateNodes, getRectOfNodes, getTransformForBounds } from '@xyflow/system'; | ||
import { infiniteExtent, SelectionMode, ConnectionMode, ConnectionLineType, devWarn, updateNodes, getNodesBounds, getViewportForBounds } from '@xyflow/system'; | ||
import DefaultNode from '../components/nodes/DefaultNode.svelte'; | ||
@@ -34,5 +34,4 @@ import InputNode from '../components/nodes/InputNode.svelte'; | ||
})); | ||
const bounds = getRectOfNodes(nodesWithDimensions, [0, 0]); | ||
const transform = getTransformForBounds(bounds, width, height, 0.5, 2, 0.1); | ||
viewport = { x: transform[0], y: transform[1], zoom: transform[2] }; | ||
const bounds = getNodesBounds(nodesWithDimensions, [0, 0]); | ||
viewport = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1); | ||
} | ||
@@ -39,0 +38,0 @@ return { |
{ | ||
"name": "@xyflow/svelte", | ||
"version": "0.0.26", | ||
"version": "0.0.27", | ||
"description": "Svelte Flow - A highly customizable Svelte library for building node-based editors, workflow systems, diagrams and more.", | ||
@@ -35,3 +35,3 @@ "keywords": [ | ||
"classcat": "^5.0.4", | ||
"@xyflow/system": "0.0.9" | ||
"@xyflow/system": "0.0.10" | ||
}, | ||
@@ -38,0 +38,0 @@ "devDependencies": { |
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 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 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
201447
3362
+ Added@xyflow/system@0.0.10(transitive)
- Removed@xyflow/system@0.0.9(transitive)
Updated@xyflow/system@0.0.10