/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/toolkit/proposedchangescollection * @publicApi */ import { type EmitterMixinConstructor } from "@ckeditor/ckeditor5-utils"; import { type DocumentChange, type ProposedChange, type ProposedChangeState } from "./proposedchange.js"; declare const ProposedChangesCollectionBase: EmitterMixinConstructor; /** * A set of proposed changes for one or multiple documents. Keeps and manages these changes' current state. * * The changes inside one set are logically related and can be thought as one "review". They are a result of one "processing cycle": one * set of changes, all proposed together at once, for one or multiple documents, to be reviewed and accepted or rejected. * * The proposed changes are given an index and are addressed by their index in the set. A change never leaves the set, and its index does * not change. An accepted or rejected change is still kept in the set at its original index, and can be rendered for preview purposes. * * Create the set from the proposed changes, then pass it to * {@link module:ai/toolkit/proposedchanges~ProposedChanges#createController create a controller}, which binds the set with related * editor instance(s) and optionally a view component. Read the set directly, but modify it through the controller API. * * The set is owned by the integrator and outlives the controller. It can be passed to a new controller, for example to keep * the review when the controller is re-created for a new editor instance. A set must be bound with one controller at a time. */ export declare class ProposedChangesCollection extends ProposedChangesCollectionBase { /** * @param changes The changes to review, in the order they should be reviewed in. A change may state its * {@link module:ai/toolkit/proposedchange~ProposedChange#state decision}, to restore a review. Defaults to `'pending'`. */ constructor(changes?: Array); /** * Returns the proposed changes. */ getChanges(): ReadonlyArray; /** * Returns the proposed change at `index`, or `undefined` when the set holds none there. * * @param index */ getChange(index: number): ProposedChange | undefined; /** * Whether the user can make an action (accept or reject) for the change at `index`. * * Actionable change must be in pending state (not accepted or rejected yet), it must yield actual change, it cannot be outdated * (the related content must not be removed), and the related document must be available. * * If the change affects a read-only content, it is still actionable. Such a change cannot be accepted, but it can be rejected. * * An actionable change that can still be accepted {@link #isWritable is writeable}. * * @param index */ isActionable(index: number): boolean; /** * Whether the change at `index` can be accepted by the user. * * It must {@link #isActionable be actionable} and affect content that is not read-only. * * @param index */ isWritable(index: number): boolean; /** * Whether there is any writable ("applicable") change in the collection. */ hasWritableChanges(): boolean; /** * The position of the nearest {@link #isActionable actionable} change in the given direction, or `null` when there is none. * * It is cyclic: "next" from the last change is the first one. `null` is returned only once there are no actionable changes in the set. * * @param index The index to step away from. * @param direction Which way to step. */ getActionableSibling(index: number, direction: "next" | "previous"): number | null; } /** * Fired whenever anything about a proposed change state changes. * * @eventName ~ProposedChangesCollection#changeUpdated */ export type ProposedChangeUpdatedEvent = { name: "changeUpdated"; args: [{ index: number; change: ProposedChange; }]; }; export {};