import { DockSide } from '../../../../../Types/DockSide'; import { CustomElement } from '../../../../Abstracts/CustomElement'; import type { ChatElement } from '../../ChatElement'; import type { IChatTool } from '../Interfaces/IChatTool'; declare const ChatToolBaseElement_base: import("../../../../../../Index").ControlBehaviorReturn; /** * Chat Tool Base Element - The foundational base class for all chat tool components. * * @description * ChatToolBaseElement provides the core infrastructure for extensible chat tools that can be * attached to ChatElement instances. It defines the contract for tool execution, attachment * lifecycle, and docking behavior. Tools can be positioned on the left or right side of the * chat interface and can be enabled/disabled dynamically. This abstract class manages the * attachment state and provides protected access to the parent ChatElement for subclasses. * Concrete chat tools (e.g., file upload, emoji picker, voice recorder) extend this base * class to implement specific functionality via the execute() method. * * @remarks * The attach() method follows a single-attachment pattern - once attached to a ChatElement, * subsequent attach() calls are ignored. Tools inherit disabled state management from the * Disableable behavior and must implement the abstract execute() method to define their * specific functionality. * * @name ChatToolBaseElement * @category Abstract Elements * * @fires connected {ConnectedEvent} - Emitted when the element is connected to the DOM * @fires disconnected {DisconnectedEvent} - Emitted when the element is disconnected from the DOM * @fires changed {PropertyChangedEvent} - Emitted when any attribute changes before update * * @example * Extending ChatToolBaseElement for a file upload tool: * ```typescript * export class FileUploadToolElement extends ChatToolBaseElement { * public execute(args: { files: FileList }): boolean { * if (!this.chatElement || this.disabled) return false; * * this.chatElement.addAttachments(Array.from(args.files)); * return true; * } * * protected override render() { * return html``; * } * } * ``` * * @example * Using chat tools in HTML: * ```html * * * * * ``` * * @example * Programmatically attaching and executing a tool: * ```typescript * const tool = document.createElement('file-upload-tool'); * const chat = document.querySelector('mosaik-chat'); * * tool.attach(chat); * tool.execute({ files: inputElement.files }); * ``` * * @example * Accessing parent chat from tool implementation: * ```typescript * protected sendMessage(content: string): void { * if (this.chatElement) { * this.chatElement.addMessage({ content, role: 'user' }); * } * } * ``` * * @abstract * @public */ export declare abstract class ChatToolBaseElement extends ChatToolBaseElement_base implements IChatTool { private _isAttached; private _chatElement?; private _dock; /** * @public */ constructor(); /** * Gets or sets the `dock` property. * * @public * @attr */ get dock(): Extract; set dock(value: Extract); /** * Gets the chat element associated with this tool. * * @protected * @readonly */ protected get chatElement(): ChatElement | undefined; /** * Executes the chat tool with the given arguments. * * @public * @abstract * @param args The arguments to execute the tool with. * @returns True if the execution was successful, false otherwise. */ abstract execute(args: unknown): boolean; /** * Attaches the tool to the specified chat element. * * @public * @param chat The chat element to attach to. */ attach(chat: ChatElement): void; } export {}; //# sourceMappingURL=ChatToolBaseElement.d.ts.map