@gravity-ui/graph
Version:
Modern graph editor component
43 lines (42 loc) • 1.72 kB
TypeScript
import { TConnectionColors } from "../../graphConfig";
import { ESelectionStrategy } from "../../utils/types/types";
import { TBlockId } from "../block/Block";
import { ConnectionsStore } from "./ConnectionList";
export declare const IS_CONNECTION_TYPE: "Connection";
export type TConnectionId = string | number | symbol;
export type TConnection = {
id?: TConnectionId;
sourceBlockId: TBlockId;
targetBlockId: TBlockId;
sourceAnchorId?: string;
targetAnchorId?: string;
label?: string;
styles?: Partial<TConnectionColors> & {
dashes?: number[];
};
dashed?: boolean;
selected?: boolean;
};
export declare class ConnectionState<T extends TConnection = TConnection> {
store: ConnectionsStore;
$state: import("@preact/signals-core").Signal<T>;
get id(): TConnectionId;
get sourceBlockId(): TBlockId;
get sourceAnchorId(): string;
get targetBlockId(): TBlockId;
get targetAnchorId(): string;
readonly $sourceBlock: import("@preact/signals-core").ReadonlySignal<import("../block/Block").BlockState<import("../..").TBlock>>;
readonly $targetBlock: import("@preact/signals-core").ReadonlySignal<import("../block/Block").BlockState<import("../..").TBlock>>;
$geometry: import("@preact/signals-core").ReadonlySignal<{
x: number;
y: number;
width: number;
height: number;
}[]>;
static getConnectionId(connection: TConnection): TConnectionId;
constructor(store: ConnectionsStore, connectionState: T);
isSelected(): boolean;
setSelection(selected: boolean, strategy?: ESelectionStrategy): void;
asTConnection(): TConnection;
updateConnection(connection: Partial<TConnection>): void;
}