@@ -126,50 +126,180 @@ export type IgcChatOptions = {
126126 */
127127 stopTypingDelay ?: number ;
128128
129+ /**
130+ * A boolean flag that, when `true`, enables a **quick and dirty workaround** for styling
131+ * components rendered within the Shadow DOM, from custom message renderers, by allowing them
132+ * to inherit styles from the document's root. This can be useful for developers who prefer not to handle
133+ * Shadow DOM encapsulation, but it is **not the recommended approach**.
134+ *
135+ * It is highly advised to use standard Web Component styling methods first, in this order:
136+ *
137+ * 1. **CSS Variables and Parts API**: Use the exposed `::part` API with custom CSS variables to style
138+ * your content in your custom renderers.
139+ *
140+ * 2. **`link` elements**: For larger style sheets, link them directly within the Shadow DOM to maintain
141+ * encapsulation.
142+ *
143+ * 3. **Inline `<style>` tags**: Use these for small, self-contained styles within a template.
144+ *
145+ * This property should be used as a **last resort** as it can lead to **style leakage**, where
146+ * global styles unexpectedly bleed into the component, breaking encapsulation and causing
147+ * unpredictable visual issues.
148+ *
149+ * **WARNING**: This is a once time shot. Changing this property in runtime won't reflect
150+ * its value.
151+ */
152+ adoptRootStyles ?: boolean ;
153+
154+ /**
155+ * An object containing a collection of custom renderers for different parts of the chat UI.
156+ */
129157 renderers ?: ChatRenderers ;
130158} ;
131159
160+ /**
161+ * Represents a user's reaction to a specific chat message.
162+ */
132163export interface IgcChatMessageReaction {
164+ /**
165+ * The chat message that the reaction is associated with.
166+ */
133167 message : IgcChatMessage ;
168+ /**
169+ * The string representation of the reaction, such as an emoji or a string;
170+ */
134171 reaction : string ;
135172}
136173
174+ /**
175+ * A collection of optional rendering functions that allow for custom UI rendering.
176+ * Each property is a function that takes a context object and returns a template result.
177+ */
137178export interface ChatRenderers {
179+ /**
180+ * Custom renderer for a single chat message attachment.
181+ */
138182 attachment ?: ChatTemplateRenderer < ChatAttachmentRenderContext > ;
183+ /**
184+ * Custom renderer for the content of an attachment.
185+ */
139186 attachmentContent ?: ChatTemplateRenderer < ChatAttachmentRenderContext > ;
187+ /**
188+ * Custom renderer for the header of an attachment.
189+ */
140190 attachmentHeader ?: ChatTemplateRenderer < ChatAttachmentRenderContext > ;
191+ /**
192+ * Custom renderer for the file upload button in the input area.
193+ */
141194 fileUploadButton ?: ChatTemplateRenderer < ChatRenderContext > ;
195+ /**
196+ * Custom renderer for the main chat input field.
197+ */
142198 input ?: ChatTemplateRenderer < ChatInputRenderContext > ;
199+ /**
200+ * Custom renderer for the actions container within the input area.
201+ */
143202 inputActions ?: ChatTemplateRenderer < ChatRenderContext > ;
203+ /**
204+ * Custom renderer for the actions at the end of the input area.
205+ */
144206 inputActionsEnd ?: ChatTemplateRenderer < ChatRenderContext > ;
207+ /**
208+ * Custom renderer for the actions at the start of the input area.
209+ */
145210 inputActionsStart ?: ChatTemplateRenderer < ChatRenderContext > ;
211+ /**
212+ * Custom renderer for the attachment previews within the input field.
213+ */
146214 inputAttachments ?: ChatTemplateRenderer < ChatInputRenderContext > ;
215+ /**
216+ * Custom renderer for an entire chat message bubble.
217+ */
147218 message ?: ChatTemplateRenderer < ChatMessageRenderContext > ;
219+ /**
220+ * Custom renderer for message-specific actions (e.g., reply or delete buttons).
221+ */
148222 messageActions ?: ChatTemplateRenderer < ChatMessageRenderContext > ;
223+ /**
224+ * Custom renderer for the attachments associated with a message.
225+ */
149226 messageAttachments ?: ChatTemplateRenderer < ChatMessageRenderContext > ;
227+ /**
228+ * Custom renderer for the main text and content of a message.
229+ */
150230 messageContent ?: ChatTemplateRenderer < ChatMessageRenderContext > ;
231+ /**
232+ * Custom renderer for the header of a message, including sender and timestamp.
233+ */
151234 messageHeader ?: ChatTemplateRenderer < ChatMessageRenderContext > ;
235+ /**
236+ * Custom renderer for the "is typing" indicator.
237+ */
152238 typingIndicator ?: ChatTemplateRenderer < ChatRenderContext > ;
239+ /**
240+ * Custom renderer for the message send button.
241+ */
153242 sendButton ?: ChatTemplateRenderer < ChatRenderContext > ;
243+ /**
244+ * Custom renderer for the prefix text shown before suggestions.
245+ */
154246 suggestionPrefix ?: ChatTemplateRenderer < ChatRenderContext > ;
155247}
156248
249+ /**
250+ * A generic type for a function that serves as a custom renderer.
251+ * It takes a context object of type T and returns a template result.
252+ */
157253export type ChatTemplateRenderer < T > = ( ctx : T ) => unknown ;
254+
255+ /**
256+ * A string literal type defining the two possible positions for chat suggestions.
257+ */
158258export type ChatSuggestionsPosition = 'below-input' | 'below-messages' ;
159259
260+ /**
261+ * The base context object passed to custom renderer functions, containing the chat component instance.
262+ */
160263export interface ChatRenderContext {
264+ /**
265+ * The instance of the IgcChatComponent.
266+ */
161267 instance : IgcChatComponent ;
162268}
163269
270+ /**
271+ * The context object for renderers that deal with the chat input area.
272+ * It extends the base context with input-specific properties.
273+ */
164274export interface ChatInputRenderContext extends ChatRenderContext {
275+ /**
276+ * The list of attachments currently in the input area.
277+ */
165278 attachments : IgcChatMessageAttachment [ ] ;
279+ /**
280+ * The current value of the input field.
281+ */
166282 value : string ;
167283}
168284
285+ /**
286+ * The context object for renderers that deal with a specific chat message.
287+ * It extends the base context with the message data.
288+ */
169289export interface ChatMessageRenderContext extends ChatRenderContext {
290+ /**
291+ * The specific chat message being rendered.
292+ */
170293 message : IgcChatMessage ;
171294}
172295
296+ /**
297+ * The context object for renderers that deal with a specific attachment within a message.
298+ * It extends the message context with the attachment data.
299+ */
173300export interface ChatAttachmentRenderContext extends ChatMessageRenderContext {
301+ /**
302+ * The specific attachment being rendered.
303+ */
174304 attachment : IgcChatMessageAttachment ;
175305}
0 commit comments