/** * @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/aireviewcore/ui/aireviewcorenavigationpanelview */ import { type DomOptimalPositionOptions, type Locale } from "@ckeditor/ckeditor5-utils"; import { BalloonPanelView, type BodyCollection } from "@ckeditor/ckeditor5-ui"; import type { AIReviewCheckResultChange } from "../model/aireviewcheckresultchange.js"; /** * Position of the selected change, as the panel counter displays it. */ export type AIReviewCoreNavigationPosition = { /** * One-based position among all the changes. */ index: number; /** * The number of all the changes. Same total the review progress bar counts against. */ total: number; /** * The number of changes left to review. Navigation only moves between those. */ pendingCount: number; }; type ViewportOffset = DomOptimalPositionOptions["viewportOffsetConfig"]; /** * Everything the panel needs to point itself at a change. */ export type AIReviewCoreNavigationPanelShowOptions = { change: AIReviewCheckResultChange; position: AIReviewCoreNavigationPosition; isAcceptButtonVisible: boolean; isSuggestButtonVisible: boolean; getTarget: () => HTMLElement | null; domEvent?: MouseEvent; limiter?: HTMLElement; viewportOffset?: ViewportOffset; }; /** * The panel floating next to the selected change. Stays on screen for the whole review and carries the * navigation between changes, the diff toggle and the actions resolving the selected change. */ export declare class AIReviewCoreNavigationPanelView extends BalloonPanelView { /** * One-based position of the change on display among all the changes. Displayed in the counter. * * @observable */ changeIndex: number; /** * The number of all the changes, the reviewed ones included. Displayed in the counter. * * @observable */ changesCount: number; /** * Whether more than one change is left to review. Navigation only moves between the changes left to * review, so with a single one left there is nowhere to go. * * @observable */ hasChangesToNavigate: boolean; /** * The counter text, built from {@link #changeIndex} and {@link #changesCount}. * * @observable */ counterLabel: string; /** * Whether the changes are displayed as a diff. * * @observable */ isDiffOn: boolean; /** * Whether at least one change has been reviewed. Pushed by the results view. The "Complete" dropdown * labels its items against it. * * @observable */ isAnyResultReviewed: boolean; /** * Whether any change is still left to review. Pushed by the results view. * * @observable */ hasPendingChanges: boolean; /** * Whether the review check ended with an error. Pushed by the results view. * * @observable */ isError: boolean; /** * Whether the check is done streaming its changes. Pushed by the results view. * * @observable */ isResultReady: boolean; /** * The status of the change on display. Anything but `pending` replaces the actions with the state pill, * as the change can no longer be resolved from here. * * @observable */ changeStatus: AIReviewCheckResultChange["status"]; constructor(locale: Locale, bodyCollection: BodyCollection); /** * The change on display, whether or not it is still the active one. */ get changeId(): string; /** * Points the panel at `change` without moving it. */ updateContent(options: AIReviewCoreNavigationPanelShowOptions): void; /** * Updates the counter only. Called as results stream in and as changes drop out of the review. */ updateChangePosition(position: AIReviewCoreNavigationPosition): void; /** * Follows the status of the change on display as it gets accepted, rejected or outdated. */ updateChangeState(id: string, status: AIReviewCheckResultChange["status"]): void; /** * Points the panel at `change` and pins it to the change's element in the content. */ showPanel(options: AIReviewCoreNavigationPanelShowOptions): void; /** * Takes the panel off screen and stops it from following the change it was pinned to. */ hidePanel(): void; /** * Whether the panel shows within the viewport. A panel whose change was scrolled out of view stays visible off screen so we need * to check its rects. */ isInViewport(): boolean; /** * @inheritDoc */ override destroy(): void; /** * A custom offset (in pixels) between the panel and the change it points at. */ static verticalOffset: number; } export type AIReviewCoreNavigateChangeEvent = { name: "navigateChange"; args: [{ direction: "previous" | "next"; }]; }; export type AIToggleDiffEvent = { name: "toggleDiff"; args: [{ /** * Whether the diff should be shown. */ on: boolean; /** * The change the panel was pointing at when the diff was toggled. The diff covers the whole * document for now, so no listener reads it yet; it is what a per-change toggle would need. */ changeId: string; }]; }; export {};