import { Signal } from "@preact/signals-core";
import { Graph } from "../../../graph";
import { CoreComponent } from "../../../lib";
import { TComponentState } from "../../../lib/Component";
import { Layer, LayerContext, LayerProps } from "../../../services/Layer";
import { BlockState } from "../../../store/block/Block";
import { GroupState, TGroup, TGroupId } from "../../../store/group/Group";
import { TRect } from "../../../utils/types/shapes";
import { Group } from "./Group";
export type BlockGroupsProps<T extends TGroup = TGroup> = LayerProps & {
    mapBlockGroups?: (blocks: BlockState[]) => GroupState[];
    groupComponent?: typeof Group<T>;
    draggable?: boolean;
};
export type BlockGroupsContext = LayerContext & {
    canvas: HTMLCanvasElement;
    ctx: CanvasRenderingContext2D;
    root?: HTMLElement;
    ownerDocument: Document | HTMLElement;
    graph: Graph;
};
export type BlockGroupsState = TComponentState & {
    groups: GroupState[];
};
export declare class BlockGroups<P extends BlockGroupsProps = BlockGroupsProps> extends Layer<P, BlockGroupsContext, BlockGroupsState> {
    static withBlockGrouping({ groupingFn, mapToGroups, }: {
        groupingFn: (blocks: BlockState[]) => Record<string, BlockState[]>;
        mapToGroups: (key: string, params: {
            blocks: BlockState[];
            rect: TRect;
        }) => TGroup;
    }): typeof BlockGroups<BlockGroupsProps & {
        updateBlocksOnDrag?: boolean;
    }>;
    private unsubscribe;
    protected $groupsBlocksMap: Signal<Record<string, BlockState<import("../blocks/Block").TBlock>[]>>;
    protected $groupsSource: import("@preact/signals-core").ReadonlySignal<GroupState[]>;
    constructor(props: P);
    /**
     * Called after initialization and when the layer is reattached.
     * This is where we set up event subscriptions to ensure they work properly
     * after the layer is unmounted and reattached.
     */
    protected afterInit(): void;
    getParent(): CoreComponent | undefined;
    updateBlocks: (groupId: TGroupId, { diffX, diffY }: {
        diffX: number;
        diffY: number;
    }) => void;
    setGroups<T extends TGroup>(groups: T[]): void;
    updateGroups<T extends TGroup>(groups: T[]): void;
    protected unmountLayer(): void;
    protected unmount(): void;
    protected getGroupComponent(group: GroupState): {
        new (props: import("./Group").TGroupProps, parent: BlockGroups): Group<TGroup>;
        define(config: {
            style?: Partial<import("./Group").TGroupStyle>;
            geometry?: Partial<import("./Group").TGroupGeometry>;
        }): typeof Group;
        create<Props extends import("../../../lib/CoreComponent").CoreComponentProps, Context extends import("../../../lib/CoreComponent").CoreComponentContext>(this: Constructor<CoreComponent<Props, Context>>, props?: Props, options?: {
            readonly key?: string;
            readonly ref?: ((inst: any) => void) | string;
        }): import("../../../lib/CoreComponent").ComponentDescriptor<Props, Context>;
        mount<Props extends import("../../../lib/CoreComponent").CoreComponentProps, Context extends import("../../../lib/CoreComponent").CoreComponentContext>(Component: Constructor<CoreComponent<Props, Context>>, props?: Props): CoreComponent<Props, Context>;
        unmount(instance: any): void;
    };
    protected updateChildren(): import("../../../lib/CoreComponent").ComponentDescriptor<import("./Group").TGroupProps, import("../layers/graphLayer/GraphLayer").TGraphLayerContext>[];
    render(): void;
}
