Merge pull request #4446 from xyflow/fix/resizer-types

fix(resizer): export types
This commit is contained in:
Moritz Klack
2024-07-15 11:05:11 +02:00
committed by GitHub
4 changed files with 18 additions and 5 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@xyflow/react': patch
'@xyflow/svelte': patch
'@xyflow/system': patch
---
fix(resizer): export types
+3
View File
@@ -85,6 +85,9 @@ export {
type ControlPosition, type ControlPosition,
type ControlLinePosition, type ControlLinePosition,
type ResizeControlVariant, type ResizeControlVariant,
type ResizeParams,
type ResizeParamsWithDirection,
type ResizeDragEvent,
type NodeChange, type NodeChange,
type NodeDimensionChange, type NodeDimensionChange,
type NodePositionChange, type NodePositionChange,
+3
View File
@@ -105,6 +105,9 @@ export {
type ControlPosition, type ControlPosition,
type ControlLinePosition, type ControlLinePosition,
type ResizeControlVariant, type ResizeControlVariant,
type ResizeParams,
type ResizeParamsWithDirection,
type ResizeDragEvent,
type IsValidConnection type IsValidConnection
} from '@xyflow/system'; } from '@xyflow/system';
+5 -5
View File
@@ -1,13 +1,13 @@
import type { D3DragEvent, SubjectPosition } from 'd3-drag'; import type { D3DragEvent, SubjectPosition } from 'd3-drag';
export type XYResizerParams = { export type ResizeParams = {
x: number; x: number;
y: number; y: number;
width: number; width: number;
height: number; height: number;
}; };
export type XYResizerParamsWithDirection = XYResizerParams & { export type ResizeParamsWithDirection = ResizeParams & {
direction: number[]; direction: number[];
}; };
@@ -23,10 +23,10 @@ export enum ResizeControlVariant {
export const XY_RESIZER_HANDLE_POSITIONS: ControlPosition[] = ['top-left', 'top-right', 'bottom-left', 'bottom-right']; export const XY_RESIZER_HANDLE_POSITIONS: ControlPosition[] = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
export const XY_RESIZER_LINE_POSITIONS: ControlLinePosition[] = ['top', 'right', 'bottom', 'left']; export const XY_RESIZER_LINE_POSITIONS: ControlLinePosition[] = ['top', 'right', 'bottom', 'left'];
type OnResizeHandler<Params = XYResizerParams, Result = void> = (event: ResizeDragEvent, params: Params) => Result; type OnResizeHandler<Params = ResizeParams, Result = void> = (event: ResizeDragEvent, params: Params) => Result;
export type ResizeDragEvent = D3DragEvent<HTMLDivElement, null, SubjectPosition>; export type ResizeDragEvent = D3DragEvent<HTMLDivElement, null, SubjectPosition>;
export type ShouldResize = OnResizeHandler<XYResizerParamsWithDirection, boolean>; export type ShouldResize = OnResizeHandler<ResizeParamsWithDirection, boolean>;
export type OnResizeStart = OnResizeHandler; export type OnResizeStart = OnResizeHandler;
export type OnResize = OnResizeHandler<XYResizerParamsWithDirection>; export type OnResize = OnResizeHandler<ResizeParamsWithDirection>;
export type OnResizeEnd = OnResizeHandler; export type OnResizeEnd = OnResizeHandler;