import { type ComputedRef, type Ref, type WritableComputedRef } from 'vue';
import type { Environment } from '../../vendor/cel-js/lib/index.js';
import { type LayoutSetValue, type PlacementValue, type SlotValue } from '../../share/layout.js';
import type { BreadcrumbCrumb, BreadcrumbParentSuffix } from './breadcrumb-extension.js';
import { type BlockValue, type PageConfigValue } from './schema.js';
import { type BlockEntry } from './utils/resolve.js';
export type PickerEntry = {
    type: string;
    compatibilityDate: string;
    name: string;
    icon: string;
};
export type StackEntry = {
    kind: 'layout';
} | {
    kind: 'block';
    blockId: string;
};
export type Breadcrumb = {
    kind: 'layout';
    label: string;
    index: number;
} | {
    kind: 'block';
    label: string;
    index: number;
    blockId: string;
} | {
    kind: 'sub';
    label: string;
    subIndex: number;
    clickable: boolean;
};
export interface SlotEditorOptions {
    configure?: (env: Environment) => void;
}
export interface SlotEditor {
    selectedBlockIds: Ref<string[]>;
    activeLayoutIndex: Ref<number>;
    blocks: ComputedRef<ReadonlyArray<BlockValue>>;
    layouts: {
        value: LayoutSetValue[];
    };
    pickerEntries: ComputedRef<PickerEntry[]>;
    addBlock: (entry: PickerEntry, options?: {
        silent?: boolean;
    }) => string;
    addBlocks: (blocks: ReadonlyArray<BlockValue>) => void;
    addBlocksWithPlacements: (blocks: ReadonlyArray<BlockValue>, placements: Readonly<Record<string, PlacementValue>>, target: {
        x: number;
        y: number;
    } | null) => void;
    removeBlock: (id: string) => void;
    removeBlocks: (ids: ReadonlyArray<string>) => void;
    updateBlock: (id: string, next: BlockValue) => void;
    setLayouts: (next: LayoutSetValue[]) => void;
    getBlockLabel: (b: BlockValue) => string;
    findBlockMeta: (type: string, compatibilityDate: string) => BlockEntry | undefined;
    configure: (env: Environment) => void;
}
export declare function useSlotEditor(slot: WritableComputedRef<SlotValue> | Ref<SlotValue>, options?: SlotEditorOptions): SlotEditor;
export interface SlotClipboardTarget {
    blocks: ComputedRef<ReadonlyArray<BlockValue>>;
    layouts: {
        value: LayoutSetValue[];
    };
    activeLayoutIndex: Ref<number>;
    addBlocks: (blocks: ReadonlyArray<BlockValue>) => void;
    addBlocksWithPlacements: (blocks: ReadonlyArray<BlockValue>, placements: Readonly<Record<string, PlacementValue>>, target: {
        x: number;
        y: number;
    } | null) => void;
}
export declare function useSlotClipboard(target: SlotClipboardTarget): {
    copy: (ids: string[]) => Promise<void>;
    paste: (anchor: {
        x: number;
        y: number;
    } | null) => Promise<void>;
};
export interface ConfigEditorState {
    draft: Ref<PageConfigValue>;
    stack: Ref<StackEntry[]>;
    selectedBlockIds: Ref<string[]>;
    activeLayoutIndex: Ref<number>;
    validationError: Ref<string | null>;
    addCrumb: () => BreadcrumbCrumb;
    addParentSuffix: () => BreadcrumbParentSuffix;
    isDirty: ComputedRef<boolean>;
    blocks: ComputedRef<ReadonlyArray<BlockValue>>;
    layouts: {
        value: LayoutSetValue[];
    };
    top: ComputedRef<StackEntry>;
    activeBlock: ComputedRef<BlockValue | null>;
    activeBlockEntry: ComputedRef<BlockEntry | null>;
    breadcrumbs: ComputedRef<Breadcrumb[]>;
    pickerEntries: ComputedRef<PickerEntry[]>;
    configure: (env: Environment) => void;
    goTo: (index: number) => void;
    goToSub: (subIndex: number) => void;
    popOne: () => void;
    pushBlock: (blockId: string) => void;
    addBlock: (entry: PickerEntry, options?: {
        silent?: boolean;
    }) => void;
    addBlocks: (blocks: ReadonlyArray<BlockValue>) => void;
    addBlocksWithPlacements: (blocks: ReadonlyArray<BlockValue>, placements: Readonly<Record<string, PlacementValue>>, target: {
        x: number;
        y: number;
    } | null) => void;
    removeBlock: (id: string) => void;
    removeBlocks: (ids: ReadonlyArray<string>) => void;
    updateActiveBlock: (next: BlockValue) => void;
    setLayouts: (next: LayoutSetValue[]) => void;
    getBlockLabel: (b: BlockValue) => string;
    findBlockMeta: (type: string, compatibilityDate: string) => BlockEntry | undefined;
    onDrillDown: (blockId: string) => void;
    confirm: () => void;
    dismiss: () => void;
    reset: () => void;
}
export interface UseConfigEditorOptions {
    configure?: (env: Environment) => void;
    /**
     * Called after a successful 确认 commits the draft to the outer model.
     * Hosts wire this to close the modal; legacy mode emits `close`.
     */
    onClose?: () => void;
}
export declare function useConfigEditor(model: Ref<PageConfigValue>, options?: UseConfigEditorOptions): ConfigEditorState;
