import {html, unsafeCSS} from "lit"; import {property, query} from "lit/decorators.js"; import ZincElement from "../../../../../internal/zinc-element"; import type {CSSResultGroup} from "lit"; import styles from './ai-panel.scss'; export default class AIPanelComponent extends ZincElement { static styles: CSSResultGroup = unsafeCSS(styles); @query('.prompt') promptInput!: HTMLTextAreaElement; @property({type: Boolean, reflect: true}) open = false; @property({type: Function}) refine?: (prompt: string) => void; @property({type: Function}) refineBuiltIn?: (e: Event) => void; public show() { this.open = true; } public hide() { this.open = false; } private handleTriggerKeyDown(event: KeyboardEvent) { if (event.key === 'Enter') { event.preventDefault(); const prompt = this.promptInput.value.trim() || ''; if (this.refine && prompt) { this.refine(prompt); this.promptInput.value = ''; this.promptInput.blur(); } } } render() { return html` Improve writing Shorten text Expand text Fix spelling / grammar `; } } AIPanelComponent.define('zn-ai-panel');