/** * @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/aiballoon/ui/aiballoonview */ import { View, type ViewCollection } from "@ckeditor/ckeditor5-ui"; import { type Locale } from "@ckeditor/ckeditor5-utils"; import { type AIContentRenderingStrategy } from "../../aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.js"; import { type AISuggestionContentPartDefinition } from "../../aicore/utils/getsuggestionpartsfromreply.js"; import { type AIMiniToolbarConfig } from "../../aicore/ui/suggestioncontainer/aiminitoolbarview.js"; import { type AISuggestionActionName } from "../../aicore/utils/replyactions.js"; export declare const AI_BALLOON_VIEW_EVENT_NAMES: readonly ["applySuggestion", "insertSuggestion", "rejectSuggestion", "showNext", "showPrevious"]; export type AIBalloonViewConfig = { showApplyButton: boolean; showSuggestButton: boolean; availableActions: Array; showChangesButtonMode?: AIMiniToolbarConfig["showChanges"]; }; /** * The base class for all balloon views used by the `AIBalloon` plugin. * * It provides the content region, the disclaimer and the toolbars shared by every balloon. Anything that depends on how * a particular feature produces its suggestion stays in the subclass: the loading skeleton, the auto-scrolling during * streaming and the "Try again" action belong to the Quick Actions balloon only, because it generates the suggestion in * place, while the Chat balloon merely previews a suggestion that the chat feed has already streamed and rendered. */ export declare abstract class AIBalloonView extends View { /** * The children of the balloon view. */ children: ViewCollection; /** * Observable property that indicates whether the track changes is on. */ isTrackChangesOn: boolean; /** * Whether the target editor is read-only. Forwarded to the toolbar to disable the write actions (apply, suggest), * but not reject. * * @observable */ isTargetReadOnly: boolean; /** * @inheritDoc */ constructor(locale: Locale, config: AIBalloonViewConfig); /** * Shows a blocking error message and disables toolbar buttons. * This should be used for terminal errors where the interaction cannot continue (e.g., selection removed). * * @param message The error message to display */ showBlockingError(message: string): void; /** * Shows an error message in the balloon. * * @param message The error message to display */ showError(message: string): void; /** * Clears the content of the suggestion part displayed in the balloon. */ clearContent(): void; /** * Updates the content of the balloon. */ updateContent(options: { part: AISuggestionContentPartDefinition; renderingStrategy: AIContentRenderingStrategy; abortSignal?: AbortSignal; keepErrors?: boolean; }): Promise; /** * Sets {@link #width} so that this balloon's suggestion content follows the editable's width. */ abstract adjustWidthToEditable(domRoot: HTMLElement): void; }