import { CommandFunction, Handler, PlainExtension, ProsemirrorAttributes, ProsemirrorPlugin, Shape, StateUpdateLifecycleProps, Static, Transaction } from '@remirror/core';
import { Step } from '@remirror/pm/transform';
/**
 * The collaboration extension adds collaborative functionality to your editor.
 *
 * Once a central server is created the collaboration extension is good.
 */
export declare class CollaborationExtension extends PlainExtension<CollaborationOptions> {
    get name(): "collaboration";
    private _debounceGetSendableSteps?;
    private get debounceGetSendableSteps();
    /**
     * Send a collaboration update.
     */
    sendCollaborationUpdate(attributes: CollaborationAttributes): CommandFunction;
    cancelSendableSteps(): CommandFunction;
    flushSendableSteps(): CommandFunction;
    createExternalPlugins(): ProsemirrorPlugin[];
    onStateUpdate(props: StateUpdateLifecycleProps): void;
    onDestroy(): void;
    /**
     * This passes the sendable steps into the `onSendableReceived` handler defined in the
     * options when there is something to send.
     */
    private getSendableSteps;
}
export interface Sendable {
    version: number;
    steps: readonly Step[];
    clientID: number | string;
    origins: readonly Transaction[];
}
export interface JSONSendable extends Omit<Sendable, 'steps' | 'origins'> {
    steps: Shape[];
}
export interface OnSendableReceivedProps {
    /**
     * The raw sendable generated by the prosemirror-collab library.
     */
    sendable: Sendable;
    /**
     * A sendable which can be sent to a server
     */
    jsonSendable: JSONSendable;
}
export interface CollaborationOptions {
    /**
     * The document version.
     *
     * @defaultValue 0
     */
    version?: Static<number>;
    /**
     * The unique ID of the client connecting to the server.
     */
    clientID: Static<number | string>;
    /**
     * The debounce time in milliseconds
     *
     * @defaultValue 250
     */
    debounceMs?: Static<number>;
    /**
     * Called when an an editor transaction occurs and there are changes ready to
     * be sent to the server.
     *
     * @remarks
     *
     * The callback will receive the `jsonSendable` which can be sent to the
     * server as it is. If you need more control then the `sendable` property can
     * be used to shape the data the way you require.
     *
     * Since this method is called for everyTransaction that updates the
     * jsonSendable value it is automatically debounced for you.
     *
     * @param props - the sendable and jsonSendable properties which can be sent
     * to your backend
     */
    onSendableReceived: Handler<(props: OnSendableReceivedProps) => void>;
}
export interface StepWithClientId extends Step {
    clientID: number | string;
}
export type CollaborationAttributes = ProsemirrorAttributes<{
    /**
     * The steps to confirm, combined with the clientID of the user who created the change
     */
    steps: StepWithClientId[];
    /**
     * The version of the document that these steps were added to.
     */
    version: number;
}>;
declare global {
    namespace Remirror {
        interface AllExtensions {
            collaboration: CollaborationExtension;
        }
    }
}
