/** * Web Component wrapper for AIMessage (hand-crafted WC adapter). * Custom element: * * Fixes the auto-generated wrapper where `avatar` was typed as 'string' * but the React component expects AvatarProps (an object). * * @generated by scripts/generate-wc-components.ts * DO NOT EDIT MANUALLY */ import React from 'react'; import { AIMessage } from '../components'; import { asArray, BaseCompoundWC, camelToKebab, dispatchEvent, installPropAccessors, type PropDefs, registerWC, } from './_shared'; const PROP_DEFS: PropDefs = { content: 'string', senderName: 'string', timestamp: 'string', avatar: 'json', isAgent: 'boolean', compact: 'boolean', isTyping: 'boolean', markdown: 'boolean', attachments: 'json', reactions: 'json', showActions: 'boolean', thumbsUpActive: 'boolean', thumbsDownActive: 'boolean', }; class AIMessageWC extends BaseCompoundWC { get propDefs() { return PROP_DEFS; } static get observedAttributes() { return Object.keys(PROP_DEFS).map(camelToKebab); } protected _renderReact(): React.ReactElement { const props = this._readAllProps(); return React.createElement(AIMessage, { type: (props.type as 'sent' | 'received') ?? 'received', content: props.content as string | undefined, senderName: props.senderName as string | undefined, timestamp: props.timestamp as string | undefined, avatar: props.avatar as Record | undefined, isAgent: (props.isAgent as boolean) ?? false, compact: (props.compact as boolean) ?? false, isTyping: (props.isTyping as boolean) ?? false, markdown: (props.markdown as boolean) ?? false, attachments: asArray(props.attachments), reactions: asArray(props.reactions), showActions: (props.showActions as boolean) ?? false, thumbsUpActive: (props.thumbsUpActive as boolean) ?? false, thumbsDownActive: (props.thumbsDownActive as boolean) ?? false, onThumbsUp: () => dispatchEvent(this, 'thumbs-up'), onThumbsDown: () => dispatchEvent(this, 'thumbs-down'), onCopy: () => dispatchEvent(this, 'copy'), onShowList: () => dispatchEvent(this, 'show-list'), onInteraction: (event: unknown) => dispatchEvent(this, 'interaction', event), onReactionClick: (emoji: string) => dispatchEvent(this, 'reaction-click', emoji), onAttachmentClick: (attachment: unknown) => dispatchEvent(this, 'attachment-click', attachment), }); } } // Add 'type' to prop accessors manually since it's from VariantProps const FULL_PROP_DEFS: PropDefs = { ...PROP_DEFS, type: 'string' }; installPropAccessors(AIMessageWC, FULL_PROP_DEFS); registerWC('hf-ai-message', AIMessageWC); export { AIMessageWC }; export default AIMessageWC;