import type { BaseHitTestResult, BaseViewProjection, Rect, Viewport, ViewType } from '@univerjs/core';
import type { ICanvasColorService } from '@univerjs/engine-render';
import type { BaseVirtualRecordReason } from '../services/base-ui-state.service';
import type { CanvasDrawCommand, IBaseCanvas2DContext, IBaseCanvasHitRegion } from './canvas-draw-command';
export interface IBaseRenderContext {
    unitId: string;
    tableId: string;
    viewId: string;
    canvasColorService?: ICanvasColorService;
    interactionColors?: IBaseCanvasInteractionColors;
    darkMode?: boolean;
    viewport?: Viewport;
    canvas?: HTMLCanvasElement;
    activeRecordId?: string | null;
    collapsedGroupPaths?: ReadonlySet<string>;
    gridFillPreview?: IBaseGridFillPreviewState | null;
    gridColumnResizeDragX?: number | null;
    gridFreezeDragX?: number | null;
    gridFreezeHoverY?: number | null;
    gridFieldDrag?: IBaseGridFieldDragState | null;
    gridHoverAddField?: boolean;
    gridHoverAddRecordRow?: IBaseGridAddRecordHoverState | null;
    gridHoverFieldId?: string | null;
    gridHoverFieldMenuFieldId?: string | null;
    gridHoverFieldDescriptionFieldId?: string | null;
    gridHoverCellRecordId?: string | null;
    gridHoverCellFieldId?: string | null;
    gridHoverLinkActionRecordId?: string | null;
    gridHoverLinkActionFieldId?: string | null;
    gridHoverOpenRecordId?: string | null;
    gridSelectOptionRemoveHover?: IBaseGridSelectOptionRemoveHoverState | null;
    gridAttachmentDropTarget?: IBaseGridAttachmentDropTargetState | null;
    gridHoverRowHeaderRecordId?: string | null;
    gridHoverRecordId?: string | null;
    gridVirtualRows?: IBaseGridVirtualRowState[];
    gridOpenRecordId?: string | null;
    gridOpenRecordLabel?: string;
    gridCloseRecordLabel?: string;
    gridAddRecordLabel?: string;
    gridRecordLabel?: string;
    gridRecordCountLabel?: string;
    gridCalculateLabel?: string;
    gridAttachmentDropLabel?: string;
    calendarTodayLabel?: string;
    calendarDayLabel?: string;
    calendarWeekLabel?: string;
    calendarMonthLabel?: string;
    calendarMoreLabel?: (count: number) => string;
    ganttFieldsLabel?: string;
    ganttTodayLabel?: string;
    ganttWeekLabel?: string;
    ganttMonthLabel?: string;
    ganttQuarterLabel?: string;
    ganttYearLabel?: string;
    gridRatingHover?: IBaseGridRatingHoverState | null;
    gridRowDrag?: IBaseGridRowDragState | null;
    kanbanColumnScroll?: Record<string, number>;
    kanbanLaneScrollbarVisibleKeys?: ReadonlySet<string>;
    kanbanLaneScrollbarHoverKey?: string | null;
    kanbanLaneScrollbarDraggingKey?: string | null;
    kanbanCardDrag?: IBaseKanbanCardDragState | null;
    kanbanHoverRecordId?: string | null;
    kanbanHoverAddRecordGroupKey?: string | null;
    kanbanHoverAddGroup?: boolean;
    kanbanAddRecordLabel?: string;
    kanbanMoveRecordLabel?: string;
    gridRowHeight?: number;
    gridFieldIndicators?: Record<string, BaseGridFieldIndicator[]>;
    gridStatLabels?: Record<string, string>;
    gridSelection?: IBaseGridSelectionState | null;
    gridSearchMatches?: IBaseGridSearchMatchState[];
    gridSearchActiveMatch?: IBaseGridSearchMatchState | null;
    conditionalColoringRules?: IBaseConditionalColorRule[];
    summaryBarHovered?: boolean;
    scrollX?: number;
    scrollY?: number;
    ganttLeftPaneScrollX?: number;
    overscanRows?: number;
    scrollbar?: IBaseCanvasScrollbarState | null;
    kanbanSearchRecordIds?: string[];
    kanbanSearchActiveRecordId?: string | null;
    galleryHoverRecordId?: string | null;
    galleryCardDrag?: IBaseGalleryCardDragState | null;
    gallerySearchRecordIds?: string[];
    gallerySearchActiveRecordId?: string | null;
    calendarAnchorDate?: number;
    calendarSearchRecordIds?: string[];
    calendarSearchActiveRecordId?: string | null;
    calendarAllDayScrollY?: number;
    calendarHover?: IBaseCalendarHoverState | null;
    calendarEventDrag?: IBaseCalendarEventDragState | null;
    calendarKeyboardFocus?: IBaseCalendarKeyboardFocusState | null;
    ganttSearchRecordIds?: string[];
    ganttSearchActiveRecordId?: string | null;
    ganttHover?: IBaseGanttHoverState | null;
    ganttBarDrag?: IBaseGanttBarDragState | null;
}
export interface IBaseCanvasInteractionColors {
    primary: string;
    primaryHover: string;
    primarySoft: string;
    primarySofter: string;
    primaryStrongSoft: string;
    primaryDragSoft: string;
    primaryBorder: string;
    primaryBorderHover: string;
    primaryBorderSoft: string;
    fieldFilterIndicator: string;
    fieldSortIndicator: string;
    onPrimary: string;
}
export declare const BASE_CANVAS_INTERACTION_COLORS: {
    readonly primary: "base-canvas-interaction:primary";
    readonly primaryHover: "base-canvas-interaction:primaryHover";
    readonly primarySoft: "base-canvas-interaction:primarySoft";
    readonly primarySofter: "base-canvas-interaction:primarySofter";
    readonly primaryStrongSoft: "base-canvas-interaction:primaryStrongSoft";
    readonly primaryDragSoft: "base-canvas-interaction:primaryDragSoft";
    readonly primaryBorder: "base-canvas-interaction:primaryBorder";
    readonly primaryBorderHover: "base-canvas-interaction:primaryBorderHover";
    readonly primaryBorderSoft: "base-canvas-interaction:primaryBorderSoft";
    readonly fieldFilterIndicator: "base-canvas-interaction:fieldFilterIndicator";
    readonly fieldSortIndicator: "base-canvas-interaction:fieldSortIndicator";
    readonly onPrimary: "base-canvas-interaction:onPrimary";
};
export type BaseCanvasLayerRole = 'background' | 'structure' | 'content' | 'interaction' | 'overlay';
export interface IBaseCanvasRenderLayer {
    role: BaseCanvasLayerRole;
    commands: CanvasDrawCommand[];
    hitRegions?: IBaseCanvasHitRegion[];
}
export interface IBaseCanvasLayeredRenderState {
    layers: IBaseCanvasRenderLayer[];
    commands: CanvasDrawCommand[];
    hitRegions: IBaseCanvasHitRegion[];
}
export declare const BASE_CANVAS_LAYER_ORDER: BaseCanvasLayerRole[];
export type BaseCanvasScrollbarAxis = 'x' | 'y';
export interface IBaseCanvasScrollbarState {
    visible: boolean;
    hoverAxis?: BaseCanvasScrollbarAxis | null;
    draggingAxis?: BaseCanvasScrollbarAxis | null;
}
export interface IBaseCalendarHoverState {
    type: string;
    recordId?: string | null;
    mode?: 'day' | 'week' | 'month' | null;
    direction?: 'prev' | 'next' | null;
    dateMs?: number | null;
    edge?: 'start' | 'end' | null;
}
export interface IBaseCalendarEventDragState {
    viewId: string;
    recordId: string;
    rect: Rect;
    rects?: Rect[];
    color: string;
    title: string;
    edge?: 'start' | 'end';
}
export interface IBaseCalendarKeyboardFocusState {
    viewId: string;
    start: number;
    end: number;
    mode: 'timed' | 'allDay' | 'month';
}
export interface IBaseGanttHoverState {
    type: string;
    recordId?: string | null;
    scale?: 'week' | 'month' | 'quarter' | 'year' | null;
    direction?: 'prev' | 'next' | null;
    start?: number | null;
    end?: number | null;
}
export interface IBaseGanttBarDragState {
    viewId: string;
    recordId: string;
    edge?: 'start' | 'end';
    x: number;
    y: number;
    start: number;
    end: number;
}
export type BaseGridFieldIndicator = 'filter' | 'sort';
export type BaseConditionalColorTarget = 'cell' | 'row' | 'column';
export type BaseConditionalColorOperator = 'is' | 'isNot' | 'contains' | 'notContains' | 'isEmpty' | 'isNotEmpty' | 'greaterThan' | 'lessThan' | 'before' | 'after';
export type BaseConditionalDateMode = 'exact' | 'today' | 'tomorrow' | 'yesterday' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'past7' | 'next7' | 'past30' | 'next30';
export interface IBaseConditionalColorRule {
    id: string;
    color: string;
    target: BaseConditionalColorTarget;
    fieldId: string;
    operator: BaseConditionalColorOperator;
    operand?: unknown;
    dateMode?: BaseConditionalDateMode;
}
export interface IBaseGridSelectionState {
    viewId: string;
    mode: 'cell' | 'row' | 'column';
    anchorRecordId: string;
    focusRecordId: string;
    anchorFieldId: string;
    focusFieldId: string;
    selectedRecordIds?: string[];
    showBorder?: boolean;
}
export interface IBaseGridSearchMatchState {
    recordId: string;
    fieldId: string;
}
export interface IBaseGridFillPreviewState {
    viewId: string;
    targetRecordId?: string;
}
export interface IBaseGridRatingHoverState {
    viewId: string;
    recordId: string;
    fieldId: string;
    value: number;
    x: number;
    y: number;
}
export interface IBaseGridAddRecordHoverState {
    viewId: string;
    y: number;
}
export interface IBaseGridSelectOptionRemoveHoverState {
    viewId: string;
    recordId: string;
    fieldId: string;
    optionValue: string;
}
export interface IBaseGridRowDragState {
    viewId: string;
    recordId: string;
    targetRecordId?: string;
    before?: boolean;
}
export interface IBaseKanbanCardDragState {
    viewId: string;
    recordId: string;
    sourceGroupKey: string;
    targetGroupKey?: string;
    x: number;
    y: number;
}
export interface IBaseGalleryCardDragState {
    viewId: string;
    recordId: string;
    x: number;
    y: number;
    targetRecordId?: string | null;
    before?: boolean;
}
export interface IBaseGridAttachmentDropTargetState {
    viewId: string;
    recordId: string;
    fieldId: string;
    fileName?: string;
}
export interface IBaseGridVirtualRowState {
    viewId: string;
    recordId: string;
    values: Record<string, unknown>;
    actualLogicalY?: number;
    logicalY: number;
    rowNumber: number;
    surfaceX: number;
    surfaceWidth: number;
    reason: BaseVirtualRecordReason;
    warningLabel: string;
}
export interface IBaseGridFieldDragState {
    viewId: string;
    fieldId: string;
    targetFieldId?: string;
    before?: boolean;
}
export declare abstract class BaseViewRenderController<TProjection extends BaseViewProjection = BaseViewProjection> {
    abstract readonly viewType: ViewType | 'invalid';
    abstract mount(ctx: IBaseRenderContext): void;
    abstract unmount(): void;
    abstract updateProjection(projection: TProjection): void;
    abstract hitTest(x: number, y: number): BaseHitTestResult | null;
    abstract invalidate(region?: Rect): void;
}
export declare class NoopBaseViewRenderController<TProjection extends BaseViewProjection = BaseViewProjection> extends BaseViewRenderController<TProjection> {
    readonly viewType: ViewType | 'invalid';
    private _projection;
    private _context;
    constructor(viewType: ViewType | 'invalid');
    mount(ctx: IBaseRenderContext): void;
    unmount(): void;
    updateProjection(projection: TProjection): void;
    getProjection(): TProjection | null;
    hitTest(x: number, y: number): BaseHitTestResult;
    invalidate(): void;
}
export declare abstract class CanvasBaseViewRenderController<TProjection extends BaseViewProjection = BaseViewProjection> extends BaseViewRenderController<TProjection> {
    readonly viewType: ViewType | 'invalid';
    private _projection;
    private _context;
    private _layers;
    private _commands;
    private _hitRegions;
    private _canvas;
    constructor(viewType: ViewType | 'invalid');
    mount(ctx: IBaseRenderContext): void;
    unmount(): void;
    updateProjection(projection: TProjection): void;
    invalidate(): void;
    attachCanvas(canvas: HTMLCanvasElement): void;
    getProjection(): TProjection | null;
    getDrawCommands(): CanvasDrawCommand[];
    getRenderLayers(): IBaseCanvasRenderLayer[];
    getHitRegions(): IBaseCanvasHitRegion[];
    paint(ctx?: IBaseCanvas2DContext): void;
    hitTest(x: number, y: number): BaseHitTestResult;
    protected get context(): IBaseRenderContext | null;
    protected get viewport(): Viewport;
    protected abstract buildRenderLayers(projection: TProjection): IBaseCanvasRenderLayer[];
    private _rebuild;
}
export declare function createBaseCanvasLayer(role: BaseCanvasLayerRole): IBaseCanvasRenderLayer;
export declare function createBaseCanvasLayersFromCommands(commands: CanvasDrawCommand[], hitRegions?: IBaseCanvasHitRegion[]): IBaseCanvasRenderLayer[];
