@chat-leo/chatleo 0.0.0-stage → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/chatleo/chatleo.esm.js +1 -0
- package/dist/chatleo/index.esm.js +1 -0
- package/dist/chatleo/p-43ada232.entry.js +1 -0
- package/dist/chatleo/p-4485e141.entry.js +1 -0
- package/dist/chatleo/p-BnCPdbII.js +1 -0
- package/dist/chatleo/p-C-l90Wre.js +1 -0
- package/dist/chatleo/p-DQuL1Twl.js +1 -0
- package/dist/chatleo/p-DmL518NK.js +3 -0
- package/dist/chatleo/p-aed60255.entry.js +1 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/chatleo-avatar_13.cjs.entry.js +2986 -0
- package/dist/cjs/chatleo-call-adapter-B2OfC0VZ.js +35 -0
- package/dist/cjs/chatleo-chat-input.cjs.entry.js +67 -0
- package/dist/cjs/chatleo.cjs.js +25 -0
- package/dist/cjs/index-DkSDLR0y.js +56 -0
- package/dist/cjs/index-Dxw4YCA_.js +1741 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/my-component.cjs.entry.js +33 -0
- package/dist/collection/__mocks__/stencil-core.js +26 -0
- package/dist/collection/collection-manifest.json +27 -0
- package/dist/collection/components/chatleo-avatar/chatleo-avatar.css +40 -0
- package/dist/collection/components/chatleo-avatar/chatleo-avatar.js +116 -0
- package/dist/collection/components/chatleo-chat/chatleo-chat.css +108 -0
- package/dist/collection/components/chatleo-chat/chatleo-chat.js +459 -0
- package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.css +22 -0
- package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.js +105 -0
- package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.css +84 -0
- package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.js +141 -0
- package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.css +149 -0
- package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.js +259 -0
- package/dist/collection/components/chatleo-component/chatleo-component.css +271 -0
- package/dist/collection/components/chatleo-component/chatleo-component.js +1366 -0
- package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.css +96 -0
- package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.js +231 -0
- package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.css +352 -0
- package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.js +976 -0
- package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.css +169 -0
- package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.js +400 -0
- package/dist/collection/components/chatleo-room-list/chatleo-room-list.css +111 -0
- package/dist/collection/components/chatleo-room-list/chatleo-room-list.js +180 -0
- package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.css +110 -0
- package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.js +241 -0
- package/dist/collection/components/chatleo-room-view/chatleo-room-view.css +93 -0
- package/dist/collection/components/chatleo-room-view/chatleo-room-view.js +593 -0
- package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.css +284 -0
- package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.js +391 -0
- package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.css +56 -0
- package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.js +149 -0
- package/dist/collection/components/my-component/my-component.css +4 -0
- package/dist/collection/components/my-component/my-component.js +95 -0
- package/dist/collection/index.js +10 -0
- package/dist/collection/utils/call-entry.js +34 -0
- package/dist/collection/utils/delivery.js +7 -0
- package/dist/collection/utils/utils.js +51 -0
- package/dist/components/chatleo-avatar.d.ts +11 -0
- package/dist/components/chatleo-avatar.js +1 -0
- package/dist/components/chatleo-chat-header.d.ts +11 -0
- package/dist/components/chatleo-chat-header.js +1 -0
- package/dist/components/chatleo-chat-input.d.ts +11 -0
- package/dist/components/chatleo-chat-input.js +1 -0
- package/dist/components/chatleo-chat-message.d.ts +11 -0
- package/dist/components/chatleo-chat-message.js +1 -0
- package/dist/components/chatleo-chat.d.ts +11 -0
- package/dist/components/chatleo-chat.js +1 -0
- package/dist/components/chatleo-component.d.ts +11 -0
- package/dist/components/chatleo-component.js +1 -0
- package/dist/components/chatleo-new-message-selector.d.ts +11 -0
- package/dist/components/chatleo-new-message-selector.js +1 -0
- package/dist/components/chatleo-rich-input.d.ts +11 -0
- package/dist/components/chatleo-rich-input.js +1 -0
- package/dist/components/chatleo-rich-message-renderer.d.ts +11 -0
- package/dist/components/chatleo-rich-message-renderer.js +1 -0
- package/dist/components/chatleo-room-list.d.ts +11 -0
- package/dist/components/chatleo-room-list.js +1 -0
- package/dist/components/chatleo-room-tile-component.d.ts +11 -0
- package/dist/components/chatleo-room-tile-component.js +1 -0
- package/dist/components/chatleo-room-view.d.ts +11 -0
- package/dist/components/chatleo-room-view.js +1 -0
- package/dist/components/chatleo-tray-component.d.ts +11 -0
- package/dist/components/chatleo-tray-component.js +1 -0
- package/dist/components/chatleo-user-tile.d.ts +11 -0
- package/dist/components/chatleo-user-tile.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/my-component.d.ts +11 -0
- package/dist/components/my-component.js +1 -0
- package/dist/components/p-8kvQ-Uh-.js +1 -0
- package/dist/components/p-B7cdqAgv.js +1 -0
- package/dist/components/p-BdiOcOYZ.js +1 -0
- package/dist/components/p-BlbDSb7D.js +1 -0
- package/dist/components/p-BnCPdbII.js +1 -0
- package/dist/components/p-C-v19aUJ.js +1 -0
- package/dist/components/p-C1mF0s8g.js +1 -0
- package/dist/components/p-CRtBdzP3.js +1 -0
- package/dist/components/p-CfayCm9O.js +1 -0
- package/dist/components/p-DGjAxoQy.js +1 -0
- package/dist/components/p-Exj_2-yI.js +1 -0
- package/dist/components/p-XlwGxsqT.js +1 -0
- package/dist/components/p-fjMaTJam.js +1 -0
- package/dist/components/p-xt4kzz3B.js +1 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/chatleo-avatar_13.entry.js +2972 -0
- package/dist/esm/chatleo-call-adapter-BnCPdbII.js +33 -0
- package/dist/esm/chatleo-chat-input.entry.js +65 -0
- package/dist/esm/chatleo.js +21 -0
- package/dist/esm/index-C-l90Wre.js +53 -0
- package/dist/esm/index-DmL518NK.js +1733 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/my-component.entry.js +31 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/__mocks__/stencil-core.d.ts +24 -0
- package/dist/types/components/chatleo-avatar/chatleo-avatar.d.ts +27 -0
- package/dist/types/components/chatleo-chat/chatleo-chat.d.ts +75 -0
- package/dist/types/components/chatleo-chat-header/chatleo-chat-header.d.ts +27 -0
- package/dist/types/components/chatleo-chat-input/chatleo-chat-input.d.ts +31 -0
- package/dist/types/components/chatleo-chat-message/chatleo-chat-message.d.ts +22 -0
- package/dist/types/components/chatleo-component/chatleo-component.d.ts +278 -0
- package/dist/types/components/chatleo-new-message-selector/chatleo-new-message-selector.d.ts +68 -0
- package/dist/types/components/chatleo-rich-input/chatleo-rich-input.d.ts +216 -0
- package/dist/types/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.d.ts +77 -0
- package/dist/types/components/chatleo-room-list/chatleo-room-list.d.ts +52 -0
- package/dist/types/components/chatleo-room-tile-component/chatleo-room-tile-component.d.ts +59 -0
- package/dist/types/components/chatleo-room-view/chatleo-room-view.d.ts +91 -0
- package/dist/types/components/chatleo-tray-component/chatleo-tray-component.d.ts +112 -0
- package/dist/types/components/chatleo-user-tile/chatleo-user-tile.d.ts +36 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components.d.ts +1593 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/stencil-public-runtime.d.ts +1879 -0
- package/dist/types/utils/call-entry.d.ts +9 -0
- package/dist/types/utils/delivery.d.ts +7 -0
- package/dist/types/utils/utils.d.ts +24 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +70 -3
- package/readme.md +111 -0
- package/README.md +0 -3
|
@@ -0,0 +1,1593 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/**
|
|
4
|
+
* This is an autogenerated file created by the Stencil compiler.
|
|
5
|
+
* It contains typing information for all components that exist in this project.
|
|
6
|
+
*/
|
|
7
|
+
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
|
+
import { AttachmentDownloadInfo, ChatLeoLib, ChatLeoMessage, ChatMessageSent, ChatRoom, ChatStore, ConnectionStatus, RichInputContent, StructuredMessageContent, UserProfile } from "@chat-leo/chatleolib";
|
|
9
|
+
export { AttachmentDownloadInfo, ChatLeoLib, ChatLeoMessage, ChatMessageSent, ChatRoom, ChatStore, ConnectionStatus, RichInputContent, StructuredMessageContent, UserProfile } from "@chat-leo/chatleolib";
|
|
10
|
+
export namespace Components {
|
|
11
|
+
/**
|
|
12
|
+
* @component ChatleoAvatar
|
|
13
|
+
* @description This component is responsible for rendering a user's avatar. It can display an image from a URL if one is provided. If no URL is given, it generates a colorful SVG avatar with the user's initials. It also displays a status indicator showing whether the user is online or offline.
|
|
14
|
+
* @property {string} name - The full name of the user. This is used to generate the initials for the SVG fallback avatar.
|
|
15
|
+
* @property {string} url - The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
|
|
16
|
+
* @property {boolean} isOnline - A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
|
|
17
|
+
*/
|
|
18
|
+
interface ChatleoAvatar {
|
|
19
|
+
/**
|
|
20
|
+
* A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
"isOnline": boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The full name of the user, which is used to generate the initials for the SVG fallback avatar.
|
|
26
|
+
*/
|
|
27
|
+
"name": string;
|
|
28
|
+
/**
|
|
29
|
+
* The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
|
|
30
|
+
*/
|
|
31
|
+
"url": string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @component ChatleoChat
|
|
35
|
+
* @description This is the main component for the chat interface. It orchestrates the different parts of the chat, including the room list, chat header, message display, and input area. It listens for events from child components to handle message sending and room selection.
|
|
36
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
37
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
38
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
39
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
40
|
+
*/
|
|
41
|
+
interface ChatleoChat {
|
|
42
|
+
"addFiles": (files: File[]) => Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Calls are available and enabled for this host.
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
"callsAvailable": boolean;
|
|
48
|
+
/**
|
|
49
|
+
* An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
50
|
+
*/
|
|
51
|
+
"chatStore"?: ChatStore;
|
|
52
|
+
/**
|
|
53
|
+
* Returns to the room list (device back / app back button).
|
|
54
|
+
*/
|
|
55
|
+
"closeRoom": () => Promise<void>;
|
|
56
|
+
"focusComposer": () => Promise<void>;
|
|
57
|
+
"getDraft": () => Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* This client is currently in the room's call.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
"inCall": boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Indicates the current user's online status.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
"isOnline": boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Opens a room regardless of the current pane, and shows the conversation on a phone.
|
|
70
|
+
*/
|
|
71
|
+
"openRoom": (roomId: string) => Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* If `true`, the component will display a loading state instead of the message list.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
"pending"?: boolean;
|
|
77
|
+
"setDraft": (text: string) => Promise<void>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @component ChatleoChatHeader
|
|
81
|
+
* @description This component displays the header for a chat window. It includes the user's avatar, name, and online status. It is a simple presentational component that receives all its data via props.
|
|
82
|
+
* @property {string} name - The name of the user to be displayed in the header.
|
|
83
|
+
* @property {string} avatar - The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
|
|
84
|
+
* @property {boolean} isOnline - A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
|
|
85
|
+
*/
|
|
86
|
+
interface ChatleoChatHeader {
|
|
87
|
+
/**
|
|
88
|
+
* The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
|
|
89
|
+
*/
|
|
90
|
+
"avatar": string;
|
|
91
|
+
/**
|
|
92
|
+
* A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
|
|
93
|
+
* @default false
|
|
94
|
+
*/
|
|
95
|
+
"isOnline": boolean;
|
|
96
|
+
/**
|
|
97
|
+
* The name of the user to be displayed in the header.
|
|
98
|
+
* @default ""
|
|
99
|
+
*/
|
|
100
|
+
"name": string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @component ChatleoChatInput
|
|
104
|
+
* @description This component provides a simple text input for sending chat messages. It includes a text field, an emoji button, and action buttons for attaching files and sending the message. It can be configured to send messages on `Enter` or `Cmd/Ctrl+Enter`.
|
|
105
|
+
* @property {boolean} disabled - When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
106
|
+
* @property {boolean} sendOnModifierEnter - If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
107
|
+
* @fires messageInputSent - This event is emitted when the user sends a message. The event detail contains the trimmed text of the message.
|
|
108
|
+
*/
|
|
109
|
+
interface ChatleoChatInput {
|
|
110
|
+
/**
|
|
111
|
+
* When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
112
|
+
* @default false
|
|
113
|
+
*/
|
|
114
|
+
"disabled": boolean;
|
|
115
|
+
/**
|
|
116
|
+
* If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
117
|
+
* @default false
|
|
118
|
+
*/
|
|
119
|
+
"sendOnModifierEnter": boolean;
|
|
120
|
+
}
|
|
121
|
+
interface ChatleoChatMessage {
|
|
122
|
+
/**
|
|
123
|
+
* @default false
|
|
124
|
+
*/
|
|
125
|
+
"isOwnMessage": boolean;
|
|
126
|
+
/**
|
|
127
|
+
* @default 'en-US'
|
|
128
|
+
*/
|
|
129
|
+
"locale": string;
|
|
130
|
+
"message": ChatLeoMessage;
|
|
131
|
+
/**
|
|
132
|
+
* @default undefined
|
|
133
|
+
*/
|
|
134
|
+
"sender": UserProfile | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* @default false
|
|
137
|
+
*/
|
|
138
|
+
"senderIsOnline": boolean;
|
|
139
|
+
/**
|
|
140
|
+
* @default {}
|
|
141
|
+
*/
|
|
142
|
+
"translations": Record<string, string>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @component ChatLeoComponent
|
|
146
|
+
* @description This is the root component for the ChatLeo application. It serves as the main entry point and orchestrates the overall functionality. It can be configured to render either a full-page chat client or a tray-based widget. It also handles the connection to the `ChatLeoLib` and manages the application's lifecycle.
|
|
147
|
+
* @property {string} username - The username of the user, which can be used for authentication.
|
|
148
|
+
* @property {string} ticket - An authentication ticket used to establish a connection with the chat service.
|
|
149
|
+
* @property {boolean} useTray - If `true`, the component will render as a tray-based chat widget.
|
|
150
|
+
* @property {boolean} useMain - If `true`, the component will render as a full-page chat application.
|
|
151
|
+
* @property {ChatLeoLib} chatLeoLib - An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
|
|
152
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state.
|
|
153
|
+
*/
|
|
154
|
+
interface ChatleoComponent {
|
|
155
|
+
/**
|
|
156
|
+
* Adds shared files to the composer of the open room.
|
|
157
|
+
*/
|
|
158
|
+
"addFiles": (files: File[]) => Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* `auto` shows call controls when the server advertises calls; `off` disables the call UI.
|
|
161
|
+
* @default 'auto'
|
|
162
|
+
*/
|
|
163
|
+
"calls": 'auto' | 'off';
|
|
164
|
+
/**
|
|
165
|
+
* An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
|
|
166
|
+
*/
|
|
167
|
+
"chatLeoLib"?: ChatLeoLib;
|
|
168
|
+
/**
|
|
169
|
+
* An instance of the `ChatStore` class, which manages the application's state.
|
|
170
|
+
*/
|
|
171
|
+
"chatStore"?: ChatStore;
|
|
172
|
+
/**
|
|
173
|
+
* @function closeRoom
|
|
174
|
+
* @description Returns to the room list (used for the device back action and deep links that could not be opened).
|
|
175
|
+
*/
|
|
176
|
+
"closeRoom": () => Promise<void>;
|
|
177
|
+
/**
|
|
178
|
+
* Focuses the composer (share text, deep link).
|
|
179
|
+
*/
|
|
180
|
+
"focusComposer": () => Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* The currently open room, or `null` on the room list.
|
|
183
|
+
*/
|
|
184
|
+
"getActiveRoomId": () => Promise<string | null>;
|
|
185
|
+
/**
|
|
186
|
+
* @function getConnectionStatus
|
|
187
|
+
* @description Returns the current connection and session status of the chat component. Embedding applications should call this method on `window` focus events (or any other relevant trigger) to determine whether the user's session is still valid and whether the page needs to be reloaded.
|
|
188
|
+
* @returns - `isConnected` – `true` when the underlying WebSocket is currently connected. - `isSessionExpired` – `true` when the token refresh has permanently failed (HTTP 401/403 from the refresh endpoint, or too many transient errors). When this is `true` the user must reload the page to restore the session.
|
|
189
|
+
* @example const chatEl = document.querySelector('chatleo-component'); // Check on every tab-focus whether a reload is needed window.addEventListener('focus', async () => { const { isSessionExpired } = await chatEl.getConnectionStatus(); if (isSessionExpired) { window.location.reload(); } });
|
|
190
|
+
*/
|
|
191
|
+
"getConnectionStatus": () => Promise<{ isConnected: boolean; isSessionExpired: boolean; connectionStatus: ConnectionStatus; }>;
|
|
192
|
+
/**
|
|
193
|
+
* Unsent composer text (used to preserve a draft across an app update).
|
|
194
|
+
*/
|
|
195
|
+
"getDraft": () => Promise<string>;
|
|
196
|
+
/**
|
|
197
|
+
* @function openDirectMessageWithUser
|
|
198
|
+
* @description This method allows programmatically opening a direct message conversation with a specific user. It will either find an existing DM room or create a new one.
|
|
199
|
+
* @param userId - The ID of the user to start a direct message with.
|
|
200
|
+
* @param use_external_id
|
|
201
|
+
*/
|
|
202
|
+
"openDirectMessageWithUser": (userId: string, use_external_id?: boolean) => Promise<void>;
|
|
203
|
+
/**
|
|
204
|
+
* @function openNewChatDraft
|
|
205
|
+
* @description This method programmatically opens the new chat draft view in the tray, allowing the user to start a new conversation.
|
|
206
|
+
*/
|
|
207
|
+
"openNewChatDraft": () => Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* @function openRoom
|
|
210
|
+
* @description This method provides a public API to programmatically open a specific chat room in the tray view. It calls the `openChatPanel` method on the `chatleo-tray-component` element.
|
|
211
|
+
* @param roomId - The ID of the room to be opened.
|
|
212
|
+
*/
|
|
213
|
+
"openRoom": (roomId: string) => Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* `manual` shows a notification control; `prompt` also shows an in-page explanation; `off` hides it.
|
|
216
|
+
* @default 'manual'
|
|
217
|
+
*/
|
|
218
|
+
"push": 'off' | 'manual' | 'prompt';
|
|
219
|
+
/**
|
|
220
|
+
* Path of the push service worker served by the host.
|
|
221
|
+
*/
|
|
222
|
+
"pushSwPath"?: string;
|
|
223
|
+
/**
|
|
224
|
+
* The ID of the room to display when using room view mode.
|
|
225
|
+
*/
|
|
226
|
+
"roomId"?: string;
|
|
227
|
+
"serverUrl"?: string;
|
|
228
|
+
/**
|
|
229
|
+
* Restores unsent composer text.
|
|
230
|
+
*/
|
|
231
|
+
"setDraft": (text: string) => Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* An authentication ticket used to establish a connection with the chat service.
|
|
234
|
+
*/
|
|
235
|
+
"ticket": string;
|
|
236
|
+
/**
|
|
237
|
+
* Real-time protocol: `socketio` (default), `v2` (ChatLeo Protocol v2) or `auto` (use v2 when the server's `/.well-known/chatleo` offers it, otherwise Socket.IO). Overrides `ChatLeoLib.transport`.
|
|
238
|
+
*/
|
|
239
|
+
"transport"?: 'auto' | 'socketio' | 'v2';
|
|
240
|
+
/**
|
|
241
|
+
* If `true`, the component will render as a full-page chat application.
|
|
242
|
+
* @default false
|
|
243
|
+
*/
|
|
244
|
+
"useMain": boolean;
|
|
245
|
+
/**
|
|
246
|
+
* If `true`, the component will render as a single room view without the room list.
|
|
247
|
+
* @default false
|
|
248
|
+
*/
|
|
249
|
+
"useRoomView": boolean;
|
|
250
|
+
/**
|
|
251
|
+
* If `true`, the component will render as a tray-based chat widget.
|
|
252
|
+
*/
|
|
253
|
+
"useTray": boolean;
|
|
254
|
+
/**
|
|
255
|
+
* The username of the user, which can be used for authentication.
|
|
256
|
+
*/
|
|
257
|
+
"username": string;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* @component ChatLeoNewMessageSelector
|
|
261
|
+
* @description This component provides a UI for starting a new conversation. It displays a list of users that can be filtered by name. When a user is selected, it fires an event to notify the parent component.
|
|
262
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to access the list of users and their presence information.
|
|
263
|
+
* @property {string} placeholder - The placeholder text to be displayed in the search input field.
|
|
264
|
+
* @fires userSelected - This event is emitted when a user is selected from the list. The event detail contains the `UserProfile` of the selected user.
|
|
265
|
+
* @fires doClose - This event is emitted when the user clicks the close button.
|
|
266
|
+
*/
|
|
267
|
+
interface ChatleoNewMessageSelector {
|
|
268
|
+
/**
|
|
269
|
+
* An instance of the `ChatStore` class, used to access the list of users and their presence information.
|
|
270
|
+
*/
|
|
271
|
+
"chatStore"?: ChatStore;
|
|
272
|
+
/**
|
|
273
|
+
* The placeholder text to be displayed in the search input field.
|
|
274
|
+
* @default "Suche"
|
|
275
|
+
*/
|
|
276
|
+
"placeholder": string;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* ChatleoRichInput
|
|
280
|
+
* A Stencil-based rich text input component that supports:
|
|
281
|
+
* - Free text entry in a contenteditable div
|
|
282
|
+
* - Drag-and-drop and file picker attachments (single or multiple)
|
|
283
|
+
* - Inline, non-editable attachment blocks with thumbnails for images
|
|
284
|
+
* Component produces two payload formats:
|
|
285
|
+
* - Legacy RichInputContent: { text: string, attachments: FileAttachment[] }
|
|
286
|
+
* - StructuredMessageContent: blocks[] + generated html for richer, future-proof messaging
|
|
287
|
+
* Core data flow:
|
|
288
|
+
* - User types or adds files → editor DOM updates
|
|
289
|
+
* - handleInput/handleFiles/drag handlers → emitContentChange/extractContent
|
|
290
|
+
* - Send via Enter key or send button → handleSendMessage
|
|
291
|
+
* - Builds both legacy and structured payloads via extractContent and extractStructuredContent
|
|
292
|
+
* - Emits messageSend (primary)
|
|
293
|
+
*/
|
|
294
|
+
interface ChatleoRichInput {
|
|
295
|
+
/**
|
|
296
|
+
* A comma-separated string of MIME types or file extensions that the file input should accept. This is passed to the `accept` attribute of the hidden file input element.
|
|
297
|
+
* @default 'image/*,.pdf,.doc,.docx,.txt'
|
|
298
|
+
*/
|
|
299
|
+
"acceptFiles": string;
|
|
300
|
+
/**
|
|
301
|
+
* Adds files to the composer as attachment blocks (used by the share target).
|
|
302
|
+
*/
|
|
303
|
+
"addFiles": (files: File[]) => Promise<void>;
|
|
304
|
+
/**
|
|
305
|
+
* If `true`, the editor and all associated buttons will be disabled, preventing user interaction.
|
|
306
|
+
* @default false
|
|
307
|
+
*/
|
|
308
|
+
"disabled": boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Focuses the editor and puts the caret at the end.
|
|
311
|
+
*/
|
|
312
|
+
"focusEditor": () => Promise<void>;
|
|
313
|
+
/**
|
|
314
|
+
* Current plain text of the composer.
|
|
315
|
+
*/
|
|
316
|
+
"getText": () => Promise<string>;
|
|
317
|
+
/**
|
|
318
|
+
* A CSS string that defines the maximum height of the editor area before it starts scrolling.
|
|
319
|
+
* @default '200px'
|
|
320
|
+
*/
|
|
321
|
+
"maxHeight": string;
|
|
322
|
+
/**
|
|
323
|
+
* The placeholder text that appears in the editor when it is empty.
|
|
324
|
+
* @default 'Write a message...'
|
|
325
|
+
*/
|
|
326
|
+
"placeholder": string;
|
|
327
|
+
/**
|
|
328
|
+
* Replaces the composer content with `text` (used to restore a draft after an update).
|
|
329
|
+
*/
|
|
330
|
+
"setText": (text: string) => Promise<void>;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* @component ChatleoRichMessageRenderer
|
|
334
|
+
* @description This component is responsible for rendering structured message content, which can include text and attachments. It takes a `StructuredMessageContent` object and renders it as a series of blocks.
|
|
335
|
+
* @property {StructuredMessageContent} content - The structured message content object to be rendered. This object contains an array of blocks, each of which can be a text or attachment block.
|
|
336
|
+
* @property {Record<string, AttachmentDownloadInfo>} downloadUrls - A map where keys are attachment IDs and values are objects containing download information for those attachments, such as the download URL.
|
|
337
|
+
* @property {'left' | 'right'} alignment - This property determines the text alignment of the message content. It can be either `'left'` or `'right'`.
|
|
338
|
+
*/
|
|
339
|
+
interface ChatleoRichMessageRenderer {
|
|
340
|
+
/**
|
|
341
|
+
* This property determines the text alignment of the message content. It can be either `'left'` or `'right'`.
|
|
342
|
+
* @default 'left'
|
|
343
|
+
*/
|
|
344
|
+
"alignment": 'left' | 'right';
|
|
345
|
+
/**
|
|
346
|
+
* The structured message content object to be rendered. This object contains an array of blocks, each of which can be a text or attachment block.
|
|
347
|
+
*/
|
|
348
|
+
"content": StructuredMessageContent;
|
|
349
|
+
/**
|
|
350
|
+
* A map where keys are attachment IDs and values are objects containing download information for those attachments, such as the download URL.
|
|
351
|
+
* @default {}
|
|
352
|
+
*/
|
|
353
|
+
"downloadUrls": Record<string, AttachmentDownloadInfo>;
|
|
354
|
+
/**
|
|
355
|
+
* Optional translations overriding the default UI strings (e.g. `unsupported_content`).
|
|
356
|
+
* @default {}
|
|
357
|
+
*/
|
|
358
|
+
"translations": Record<string, string>;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* @component ChatleoRoomList
|
|
362
|
+
* @description This component is responsible for displaying a list of chat rooms. It takes an array of `ChatRoom` objects and renders them as a list of `chatleo-room-tile-component` instances. It also offers a "new message" action that opens a user selector to start a direct message.
|
|
363
|
+
* @property {ChatRoom[]} rooms - An array of `ChatRoom` objects to be displayed in the list.
|
|
364
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which is used to get user presence information.
|
|
365
|
+
* @property {string} selectedRoomId - The ID of the currently selected room.
|
|
366
|
+
*/
|
|
367
|
+
interface ChatleoRoomList {
|
|
368
|
+
/**
|
|
369
|
+
* An instance of the `ChatStore` class, which is used to get user presence information.
|
|
370
|
+
*/
|
|
371
|
+
"chatStore"?: ChatStore;
|
|
372
|
+
/**
|
|
373
|
+
* An array of `ChatRoom` objects to be displayed in the list.
|
|
374
|
+
* @default []
|
|
375
|
+
*/
|
|
376
|
+
"rooms": ChatRoom[];
|
|
377
|
+
/**
|
|
378
|
+
* The ID of the currently selected room.
|
|
379
|
+
*/
|
|
380
|
+
"selectedRoomId"?: string;
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* @component ChatLeoRoomTileComponent
|
|
384
|
+
* @description This component displays a single chat room in a list. It shows the room's avatar, name, the last message, a timestamp, and a count of unread messages. Clicking on the tile fires an event to select the room.
|
|
385
|
+
* @property {ChatRoom} room - The `ChatRoom` object containing the data for the room to be displayed.
|
|
386
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
|
|
387
|
+
* @property {string[]} onlineUserIds - An array of user IDs for the participants in the room who are currently online.
|
|
388
|
+
* @property {string} lastMessage - The content of the last message sent in the room.
|
|
389
|
+
* @property {string} timestamp - The timestamp of the last message.
|
|
390
|
+
* @property {number} unreadCount - The number of unread messages in the room.
|
|
391
|
+
* @property {boolean} isActive - Indicates whether this room is currently selected/active.
|
|
392
|
+
* @fires roomClicked - This event is emitted when the user clicks on the room tile. The event detail contains the ID of the clicked room.
|
|
393
|
+
*/
|
|
394
|
+
interface ChatleoRoomTileComponent {
|
|
395
|
+
/**
|
|
396
|
+
* An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
|
|
397
|
+
*/
|
|
398
|
+
"chatStore"?: ChatStore;
|
|
399
|
+
/**
|
|
400
|
+
* Indicates whether this room is currently selected/active.
|
|
401
|
+
* @default false
|
|
402
|
+
*/
|
|
403
|
+
"isActive": boolean;
|
|
404
|
+
/**
|
|
405
|
+
* The content of the last message sent in the room.
|
|
406
|
+
*/
|
|
407
|
+
"lastMessage": string;
|
|
408
|
+
/**
|
|
409
|
+
* An array of user IDs for the participants in the room who are currently online.
|
|
410
|
+
*/
|
|
411
|
+
"onlineUserIds": string[];
|
|
412
|
+
/**
|
|
413
|
+
* The `ChatRoom` object containing the data for the room to be displayed.
|
|
414
|
+
*/
|
|
415
|
+
"room": ChatRoom;
|
|
416
|
+
/**
|
|
417
|
+
* The timestamp of the last message.
|
|
418
|
+
*/
|
|
419
|
+
"timestamp": string;
|
|
420
|
+
/**
|
|
421
|
+
* The number of unread messages in the room.
|
|
422
|
+
*/
|
|
423
|
+
"unreadCount": number;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* @component ChatleoRoomView
|
|
427
|
+
* @description This component displays a single chat room view without the room list. It shows the chat header, message display, and input area for a specific room. It communicates directly with the ChatStore to load and display messages.
|
|
428
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
429
|
+
* @property {string} roomId - The ID of the room to display. When this changes, the component will load messages for the new room.
|
|
430
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
431
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
432
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
433
|
+
*/
|
|
434
|
+
interface ChatleoRoomView {
|
|
435
|
+
"addFiles": (files: File[]) => Promise<void>;
|
|
436
|
+
/**
|
|
437
|
+
* True when the server advertises calls and the host did not disable them.
|
|
438
|
+
* @default false
|
|
439
|
+
*/
|
|
440
|
+
"callsAvailable": boolean;
|
|
441
|
+
/**
|
|
442
|
+
* An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
443
|
+
*/
|
|
444
|
+
"chatStore"?: ChatStore;
|
|
445
|
+
"focusComposer": () => Promise<void>;
|
|
446
|
+
"getDraft": () => Promise<string>;
|
|
447
|
+
/**
|
|
448
|
+
* True while this client is in the room's call (keeps the banner from showing).
|
|
449
|
+
* @default false
|
|
450
|
+
*/
|
|
451
|
+
"inCall": boolean;
|
|
452
|
+
/**
|
|
453
|
+
* Indicates the current user's online status.
|
|
454
|
+
* @default false
|
|
455
|
+
*/
|
|
456
|
+
"isOnline": boolean;
|
|
457
|
+
/**
|
|
458
|
+
* If `true`, the component will display a loading state instead of the message list.
|
|
459
|
+
* @default false
|
|
460
|
+
*/
|
|
461
|
+
"pending"?: boolean;
|
|
462
|
+
/**
|
|
463
|
+
* The ID of the room to display.
|
|
464
|
+
*/
|
|
465
|
+
"roomId"?: string;
|
|
466
|
+
"setDraft": (text: string) => Promise<void>;
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* @component ChatLeoTrayComponent
|
|
470
|
+
* @description This component implements a chat tray that can be opened and closed. It contains a list of chat rooms and can open a message panel for a selected room or a user selector to start a new chat.
|
|
471
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which provides the state for the chat application.
|
|
472
|
+
* @fires newChatClicked - This event is emitted when the user clicks the "new chat" button.
|
|
473
|
+
* @fires messageChatSent - This event is emitted when a message is sent from the chat panel.
|
|
474
|
+
*/
|
|
475
|
+
interface ChatleoTrayComponent {
|
|
476
|
+
/**
|
|
477
|
+
* An instance of the `ChatStore` class, which provides the state for the chat application.
|
|
478
|
+
*/
|
|
479
|
+
"chatStore"?: ChatStore;
|
|
480
|
+
/**
|
|
481
|
+
* @function openChatPanel
|
|
482
|
+
* @description This method programmatically opens the message panel for a specific room.
|
|
483
|
+
* @param roomId - The ID of the room to open.
|
|
484
|
+
* @param pending - If `true`, the panel will be opened in a pending state.
|
|
485
|
+
*/
|
|
486
|
+
"openChatPanel": (roomId?: string, pending?: boolean) => Promise<void>;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* @component ChatleoUserTile
|
|
490
|
+
* @description This component displays a tile for a single user, showing their avatar, name, and online status. It is typically used in a list of users.
|
|
491
|
+
* @property {UserProfile} profile - The `UserProfile` object for the user to be displayed. This includes the user's name and avatar URL.
|
|
492
|
+
* @property {boolean} isOnline - A boolean indicating whether the user is currently online.
|
|
493
|
+
* @property {string} lastSeen - A string indicating when the user was last seen online. This is displayed if the user is not currently online.
|
|
494
|
+
* @fires userClicked - This event is emitted when the user tile is clicked. The event detail contains the `UserProfile` of the clicked user.
|
|
495
|
+
*/
|
|
496
|
+
interface ChatleoUserTile {
|
|
497
|
+
/**
|
|
498
|
+
* A boolean indicating whether the user is currently online.
|
|
499
|
+
* @default false
|
|
500
|
+
*/
|
|
501
|
+
"isOnline": boolean;
|
|
502
|
+
/**
|
|
503
|
+
* A string indicating when the user was last seen online. This is displayed if the user is not currently online.
|
|
504
|
+
*/
|
|
505
|
+
"lastSeen"?: string;
|
|
506
|
+
/**
|
|
507
|
+
* The `UserProfile` object for the user to be displayed. This includes the user's name and avatar URL.
|
|
508
|
+
*/
|
|
509
|
+
"profile"?: UserProfile;
|
|
510
|
+
}
|
|
511
|
+
interface MyComponent {
|
|
512
|
+
/**
|
|
513
|
+
* The first name
|
|
514
|
+
*/
|
|
515
|
+
"first": string;
|
|
516
|
+
/**
|
|
517
|
+
* The last name
|
|
518
|
+
*/
|
|
519
|
+
"last": string;
|
|
520
|
+
/**
|
|
521
|
+
* The middle name
|
|
522
|
+
*/
|
|
523
|
+
"middle": string;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
export interface ChatleoChatCustomEvent<T> extends CustomEvent<T> {
|
|
527
|
+
detail: T;
|
|
528
|
+
target: HTMLChatleoChatElement;
|
|
529
|
+
}
|
|
530
|
+
export interface ChatleoChatInputCustomEvent<T> extends CustomEvent<T> {
|
|
531
|
+
detail: T;
|
|
532
|
+
target: HTMLChatleoChatInputElement;
|
|
533
|
+
}
|
|
534
|
+
export interface ChatleoChatMessageCustomEvent<T> extends CustomEvent<T> {
|
|
535
|
+
detail: T;
|
|
536
|
+
target: HTMLChatleoChatMessageElement;
|
|
537
|
+
}
|
|
538
|
+
export interface ChatleoComponentCustomEvent<T> extends CustomEvent<T> {
|
|
539
|
+
detail: T;
|
|
540
|
+
target: HTMLChatleoComponentElement;
|
|
541
|
+
}
|
|
542
|
+
export interface ChatleoNewMessageSelectorCustomEvent<T> extends CustomEvent<T> {
|
|
543
|
+
detail: T;
|
|
544
|
+
target: HTMLChatleoNewMessageSelectorElement;
|
|
545
|
+
}
|
|
546
|
+
export interface ChatleoRichInputCustomEvent<T> extends CustomEvent<T> {
|
|
547
|
+
detail: T;
|
|
548
|
+
target: HTMLChatleoRichInputElement;
|
|
549
|
+
}
|
|
550
|
+
export interface ChatleoRoomTileComponentCustomEvent<T> extends CustomEvent<T> {
|
|
551
|
+
detail: T;
|
|
552
|
+
target: HTMLChatleoRoomTileComponentElement;
|
|
553
|
+
}
|
|
554
|
+
export interface ChatleoRoomViewCustomEvent<T> extends CustomEvent<T> {
|
|
555
|
+
detail: T;
|
|
556
|
+
target: HTMLChatleoRoomViewElement;
|
|
557
|
+
}
|
|
558
|
+
export interface ChatleoTrayComponentCustomEvent<T> extends CustomEvent<T> {
|
|
559
|
+
detail: T;
|
|
560
|
+
target: HTMLChatleoTrayComponentElement;
|
|
561
|
+
}
|
|
562
|
+
export interface ChatleoUserTileCustomEvent<T> extends CustomEvent<T> {
|
|
563
|
+
detail: T;
|
|
564
|
+
target: HTMLChatleoUserTileElement;
|
|
565
|
+
}
|
|
566
|
+
declare global {
|
|
567
|
+
/**
|
|
568
|
+
* @component ChatleoAvatar
|
|
569
|
+
* @description This component is responsible for rendering a user's avatar. It can display an image from a URL if one is provided. If no URL is given, it generates a colorful SVG avatar with the user's initials. It also displays a status indicator showing whether the user is online or offline.
|
|
570
|
+
* @property {string} name - The full name of the user. This is used to generate the initials for the SVG fallback avatar.
|
|
571
|
+
* @property {string} url - The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
|
|
572
|
+
* @property {boolean} isOnline - A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
|
|
573
|
+
*/
|
|
574
|
+
interface HTMLChatleoAvatarElement extends Components.ChatleoAvatar, HTMLStencilElement {
|
|
575
|
+
}
|
|
576
|
+
var HTMLChatleoAvatarElement: {
|
|
577
|
+
prototype: HTMLChatleoAvatarElement;
|
|
578
|
+
new (): HTMLChatleoAvatarElement;
|
|
579
|
+
};
|
|
580
|
+
interface HTMLChatleoChatElementEventMap {
|
|
581
|
+
"messageChatSent": ChatMessageSent;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* @component ChatleoChat
|
|
585
|
+
* @description This is the main component for the chat interface. It orchestrates the different parts of the chat, including the room list, chat header, message display, and input area. It listens for events from child components to handle message sending and room selection.
|
|
586
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
587
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
588
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
589
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
590
|
+
*/
|
|
591
|
+
interface HTMLChatleoChatElement extends Components.ChatleoChat, HTMLStencilElement {
|
|
592
|
+
addEventListener<K extends keyof HTMLChatleoChatElementEventMap>(type: K, listener: (this: HTMLChatleoChatElement, ev: ChatleoChatCustomEvent<HTMLChatleoChatElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
593
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
594
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
595
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
596
|
+
removeEventListener<K extends keyof HTMLChatleoChatElementEventMap>(type: K, listener: (this: HTMLChatleoChatElement, ev: ChatleoChatCustomEvent<HTMLChatleoChatElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
597
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
598
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
599
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
600
|
+
}
|
|
601
|
+
var HTMLChatleoChatElement: {
|
|
602
|
+
prototype: HTMLChatleoChatElement;
|
|
603
|
+
new (): HTMLChatleoChatElement;
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* @component ChatleoChatHeader
|
|
607
|
+
* @description This component displays the header for a chat window. It includes the user's avatar, name, and online status. It is a simple presentational component that receives all its data via props.
|
|
608
|
+
* @property {string} name - The name of the user to be displayed in the header.
|
|
609
|
+
* @property {string} avatar - The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
|
|
610
|
+
* @property {boolean} isOnline - A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
|
|
611
|
+
*/
|
|
612
|
+
interface HTMLChatleoChatHeaderElement extends Components.ChatleoChatHeader, HTMLStencilElement {
|
|
613
|
+
}
|
|
614
|
+
var HTMLChatleoChatHeaderElement: {
|
|
615
|
+
prototype: HTMLChatleoChatHeaderElement;
|
|
616
|
+
new (): HTMLChatleoChatHeaderElement;
|
|
617
|
+
};
|
|
618
|
+
interface HTMLChatleoChatInputElementEventMap {
|
|
619
|
+
"messageInputSent": string;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* @component ChatleoChatInput
|
|
623
|
+
* @description This component provides a simple text input for sending chat messages. It includes a text field, an emoji button, and action buttons for attaching files and sending the message. It can be configured to send messages on `Enter` or `Cmd/Ctrl+Enter`.
|
|
624
|
+
* @property {boolean} disabled - When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
625
|
+
* @property {boolean} sendOnModifierEnter - If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
626
|
+
* @fires messageInputSent - This event is emitted when the user sends a message. The event detail contains the trimmed text of the message.
|
|
627
|
+
*/
|
|
628
|
+
interface HTMLChatleoChatInputElement extends Components.ChatleoChatInput, HTMLStencilElement {
|
|
629
|
+
addEventListener<K extends keyof HTMLChatleoChatInputElementEventMap>(type: K, listener: (this: HTMLChatleoChatInputElement, ev: ChatleoChatInputCustomEvent<HTMLChatleoChatInputElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
630
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
631
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
632
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
633
|
+
removeEventListener<K extends keyof HTMLChatleoChatInputElementEventMap>(type: K, listener: (this: HTMLChatleoChatInputElement, ev: ChatleoChatInputCustomEvent<HTMLChatleoChatInputElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
634
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
635
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
636
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
637
|
+
}
|
|
638
|
+
var HTMLChatleoChatInputElement: {
|
|
639
|
+
prototype: HTMLChatleoChatInputElement;
|
|
640
|
+
new (): HTMLChatleoChatInputElement;
|
|
641
|
+
};
|
|
642
|
+
interface HTMLChatleoChatMessageElementEventMap {
|
|
643
|
+
"messageRetry": string;
|
|
644
|
+
"messageDiscard": string;
|
|
645
|
+
}
|
|
646
|
+
interface HTMLChatleoChatMessageElement extends Components.ChatleoChatMessage, HTMLStencilElement {
|
|
647
|
+
addEventListener<K extends keyof HTMLChatleoChatMessageElementEventMap>(type: K, listener: (this: HTMLChatleoChatMessageElement, ev: ChatleoChatMessageCustomEvent<HTMLChatleoChatMessageElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
648
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
649
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
650
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
651
|
+
removeEventListener<K extends keyof HTMLChatleoChatMessageElementEventMap>(type: K, listener: (this: HTMLChatleoChatMessageElement, ev: ChatleoChatMessageCustomEvent<HTMLChatleoChatMessageElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
652
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
653
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
654
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
655
|
+
}
|
|
656
|
+
var HTMLChatleoChatMessageElement: {
|
|
657
|
+
prototype: HTMLChatleoChatMessageElement;
|
|
658
|
+
new (): HTMLChatleoChatMessageElement;
|
|
659
|
+
};
|
|
660
|
+
interface HTMLChatleoComponentElementEventMap {
|
|
661
|
+
"activeRoomChange": { roomId: string | null };
|
|
662
|
+
"unreadTotalChange": { count: number };
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* @component ChatLeoComponent
|
|
666
|
+
* @description This is the root component for the ChatLeo application. It serves as the main entry point and orchestrates the overall functionality. It can be configured to render either a full-page chat client or a tray-based widget. It also handles the connection to the `ChatLeoLib` and manages the application's lifecycle.
|
|
667
|
+
* @property {string} username - The username of the user, which can be used for authentication.
|
|
668
|
+
* @property {string} ticket - An authentication ticket used to establish a connection with the chat service.
|
|
669
|
+
* @property {boolean} useTray - If `true`, the component will render as a tray-based chat widget.
|
|
670
|
+
* @property {boolean} useMain - If `true`, the component will render as a full-page chat application.
|
|
671
|
+
* @property {ChatLeoLib} chatLeoLib - An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
|
|
672
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state.
|
|
673
|
+
*/
|
|
674
|
+
interface HTMLChatleoComponentElement extends Components.ChatleoComponent, HTMLStencilElement {
|
|
675
|
+
addEventListener<K extends keyof HTMLChatleoComponentElementEventMap>(type: K, listener: (this: HTMLChatleoComponentElement, ev: ChatleoComponentCustomEvent<HTMLChatleoComponentElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
676
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
677
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
678
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
679
|
+
removeEventListener<K extends keyof HTMLChatleoComponentElementEventMap>(type: K, listener: (this: HTMLChatleoComponentElement, ev: ChatleoComponentCustomEvent<HTMLChatleoComponentElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
680
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
681
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
682
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
683
|
+
}
|
|
684
|
+
var HTMLChatleoComponentElement: {
|
|
685
|
+
prototype: HTMLChatleoComponentElement;
|
|
686
|
+
new (): HTMLChatleoComponentElement;
|
|
687
|
+
};
|
|
688
|
+
interface HTMLChatleoNewMessageSelectorElementEventMap {
|
|
689
|
+
"userSelected": UserProfile;
|
|
690
|
+
"doClose": void;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* @component ChatLeoNewMessageSelector
|
|
694
|
+
* @description This component provides a UI for starting a new conversation. It displays a list of users that can be filtered by name. When a user is selected, it fires an event to notify the parent component.
|
|
695
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to access the list of users and their presence information.
|
|
696
|
+
* @property {string} placeholder - The placeholder text to be displayed in the search input field.
|
|
697
|
+
* @fires userSelected - This event is emitted when a user is selected from the list. The event detail contains the `UserProfile` of the selected user.
|
|
698
|
+
* @fires doClose - This event is emitted when the user clicks the close button.
|
|
699
|
+
*/
|
|
700
|
+
interface HTMLChatleoNewMessageSelectorElement extends Components.ChatleoNewMessageSelector, HTMLStencilElement {
|
|
701
|
+
addEventListener<K extends keyof HTMLChatleoNewMessageSelectorElementEventMap>(type: K, listener: (this: HTMLChatleoNewMessageSelectorElement, ev: ChatleoNewMessageSelectorCustomEvent<HTMLChatleoNewMessageSelectorElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
702
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
703
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
704
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
705
|
+
removeEventListener<K extends keyof HTMLChatleoNewMessageSelectorElementEventMap>(type: K, listener: (this: HTMLChatleoNewMessageSelectorElement, ev: ChatleoNewMessageSelectorCustomEvent<HTMLChatleoNewMessageSelectorElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
706
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
707
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
708
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
709
|
+
}
|
|
710
|
+
var HTMLChatleoNewMessageSelectorElement: {
|
|
711
|
+
prototype: HTMLChatleoNewMessageSelectorElement;
|
|
712
|
+
new (): HTMLChatleoNewMessageSelectorElement;
|
|
713
|
+
};
|
|
714
|
+
interface HTMLChatleoRichInputElementEventMap {
|
|
715
|
+
"contentChange": RichInputContent;
|
|
716
|
+
"messageSend": StructuredMessageContent;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* ChatleoRichInput
|
|
720
|
+
* A Stencil-based rich text input component that supports:
|
|
721
|
+
* - Free text entry in a contenteditable div
|
|
722
|
+
* - Drag-and-drop and file picker attachments (single or multiple)
|
|
723
|
+
* - Inline, non-editable attachment blocks with thumbnails for images
|
|
724
|
+
* Component produces two payload formats:
|
|
725
|
+
* - Legacy RichInputContent: { text: string, attachments: FileAttachment[] }
|
|
726
|
+
* - StructuredMessageContent: blocks[] + generated html for richer, future-proof messaging
|
|
727
|
+
* Core data flow:
|
|
728
|
+
* - User types or adds files → editor DOM updates
|
|
729
|
+
* - handleInput/handleFiles/drag handlers → emitContentChange/extractContent
|
|
730
|
+
* - Send via Enter key or send button → handleSendMessage
|
|
731
|
+
* - Builds both legacy and structured payloads via extractContent and extractStructuredContent
|
|
732
|
+
* - Emits messageSend (primary)
|
|
733
|
+
*/
|
|
734
|
+
interface HTMLChatleoRichInputElement extends Components.ChatleoRichInput, HTMLStencilElement {
|
|
735
|
+
addEventListener<K extends keyof HTMLChatleoRichInputElementEventMap>(type: K, listener: (this: HTMLChatleoRichInputElement, ev: ChatleoRichInputCustomEvent<HTMLChatleoRichInputElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
736
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
737
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
738
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
739
|
+
removeEventListener<K extends keyof HTMLChatleoRichInputElementEventMap>(type: K, listener: (this: HTMLChatleoRichInputElement, ev: ChatleoRichInputCustomEvent<HTMLChatleoRichInputElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
740
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
741
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
742
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
743
|
+
}
|
|
744
|
+
var HTMLChatleoRichInputElement: {
|
|
745
|
+
prototype: HTMLChatleoRichInputElement;
|
|
746
|
+
new (): HTMLChatleoRichInputElement;
|
|
747
|
+
};
|
|
748
|
+
/**
|
|
749
|
+
* @component ChatleoRichMessageRenderer
|
|
750
|
+
* @description This component is responsible for rendering structured message content, which can include text and attachments. It takes a `StructuredMessageContent` object and renders it as a series of blocks.
|
|
751
|
+
* @property {StructuredMessageContent} content - The structured message content object to be rendered. This object contains an array of blocks, each of which can be a text or attachment block.
|
|
752
|
+
* @property {Record<string, AttachmentDownloadInfo>} downloadUrls - A map where keys are attachment IDs and values are objects containing download information for those attachments, such as the download URL.
|
|
753
|
+
* @property {'left' | 'right'} alignment - This property determines the text alignment of the message content. It can be either `'left'` or `'right'`.
|
|
754
|
+
*/
|
|
755
|
+
interface HTMLChatleoRichMessageRendererElement extends Components.ChatleoRichMessageRenderer, HTMLStencilElement {
|
|
756
|
+
}
|
|
757
|
+
var HTMLChatleoRichMessageRendererElement: {
|
|
758
|
+
prototype: HTMLChatleoRichMessageRendererElement;
|
|
759
|
+
new (): HTMLChatleoRichMessageRendererElement;
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* @component ChatleoRoomList
|
|
763
|
+
* @description This component is responsible for displaying a list of chat rooms. It takes an array of `ChatRoom` objects and renders them as a list of `chatleo-room-tile-component` instances. It also offers a "new message" action that opens a user selector to start a direct message.
|
|
764
|
+
* @property {ChatRoom[]} rooms - An array of `ChatRoom` objects to be displayed in the list.
|
|
765
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which is used to get user presence information.
|
|
766
|
+
* @property {string} selectedRoomId - The ID of the currently selected room.
|
|
767
|
+
*/
|
|
768
|
+
interface HTMLChatleoRoomListElement extends Components.ChatleoRoomList, HTMLStencilElement {
|
|
769
|
+
}
|
|
770
|
+
var HTMLChatleoRoomListElement: {
|
|
771
|
+
prototype: HTMLChatleoRoomListElement;
|
|
772
|
+
new (): HTMLChatleoRoomListElement;
|
|
773
|
+
};
|
|
774
|
+
interface HTMLChatleoRoomTileComponentElementEventMap {
|
|
775
|
+
"roomClicked": {id: string};
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* @component ChatLeoRoomTileComponent
|
|
779
|
+
* @description This component displays a single chat room in a list. It shows the room's avatar, name, the last message, a timestamp, and a count of unread messages. Clicking on the tile fires an event to select the room.
|
|
780
|
+
* @property {ChatRoom} room - The `ChatRoom` object containing the data for the room to be displayed.
|
|
781
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
|
|
782
|
+
* @property {string[]} onlineUserIds - An array of user IDs for the participants in the room who are currently online.
|
|
783
|
+
* @property {string} lastMessage - The content of the last message sent in the room.
|
|
784
|
+
* @property {string} timestamp - The timestamp of the last message.
|
|
785
|
+
* @property {number} unreadCount - The number of unread messages in the room.
|
|
786
|
+
* @property {boolean} isActive - Indicates whether this room is currently selected/active.
|
|
787
|
+
* @fires roomClicked - This event is emitted when the user clicks on the room tile. The event detail contains the ID of the clicked room.
|
|
788
|
+
*/
|
|
789
|
+
interface HTMLChatleoRoomTileComponentElement extends Components.ChatleoRoomTileComponent, HTMLStencilElement {
|
|
790
|
+
addEventListener<K extends keyof HTMLChatleoRoomTileComponentElementEventMap>(type: K, listener: (this: HTMLChatleoRoomTileComponentElement, ev: ChatleoRoomTileComponentCustomEvent<HTMLChatleoRoomTileComponentElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
791
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
792
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
793
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
794
|
+
removeEventListener<K extends keyof HTMLChatleoRoomTileComponentElementEventMap>(type: K, listener: (this: HTMLChatleoRoomTileComponentElement, ev: ChatleoRoomTileComponentCustomEvent<HTMLChatleoRoomTileComponentElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
795
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
796
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
797
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
798
|
+
}
|
|
799
|
+
var HTMLChatleoRoomTileComponentElement: {
|
|
800
|
+
prototype: HTMLChatleoRoomTileComponentElement;
|
|
801
|
+
new (): HTMLChatleoRoomTileComponentElement;
|
|
802
|
+
};
|
|
803
|
+
interface HTMLChatleoRoomViewElementEventMap {
|
|
804
|
+
"callRequested": { roomId: string; callId?: string };
|
|
805
|
+
"messageChatSent": ChatMessageSent;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* @component ChatleoRoomView
|
|
809
|
+
* @description This component displays a single chat room view without the room list. It shows the chat header, message display, and input area for a specific room. It communicates directly with the ChatStore to load and display messages.
|
|
810
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
811
|
+
* @property {string} roomId - The ID of the room to display. When this changes, the component will load messages for the new room.
|
|
812
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
813
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
814
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
815
|
+
*/
|
|
816
|
+
interface HTMLChatleoRoomViewElement extends Components.ChatleoRoomView, HTMLStencilElement {
|
|
817
|
+
addEventListener<K extends keyof HTMLChatleoRoomViewElementEventMap>(type: K, listener: (this: HTMLChatleoRoomViewElement, ev: ChatleoRoomViewCustomEvent<HTMLChatleoRoomViewElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
818
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
819
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
820
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
821
|
+
removeEventListener<K extends keyof HTMLChatleoRoomViewElementEventMap>(type: K, listener: (this: HTMLChatleoRoomViewElement, ev: ChatleoRoomViewCustomEvent<HTMLChatleoRoomViewElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
822
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
823
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
824
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
825
|
+
}
|
|
826
|
+
var HTMLChatleoRoomViewElement: {
|
|
827
|
+
prototype: HTMLChatleoRoomViewElement;
|
|
828
|
+
new (): HTMLChatleoRoomViewElement;
|
|
829
|
+
};
|
|
830
|
+
interface HTMLChatleoTrayComponentElementEventMap {
|
|
831
|
+
"newChatClicked": string;
|
|
832
|
+
"messageChatSent": ChatMessageSent;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* @component ChatLeoTrayComponent
|
|
836
|
+
* @description This component implements a chat tray that can be opened and closed. It contains a list of chat rooms and can open a message panel for a selected room or a user selector to start a new chat.
|
|
837
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which provides the state for the chat application.
|
|
838
|
+
* @fires newChatClicked - This event is emitted when the user clicks the "new chat" button.
|
|
839
|
+
* @fires messageChatSent - This event is emitted when a message is sent from the chat panel.
|
|
840
|
+
*/
|
|
841
|
+
interface HTMLChatleoTrayComponentElement extends Components.ChatleoTrayComponent, HTMLStencilElement {
|
|
842
|
+
addEventListener<K extends keyof HTMLChatleoTrayComponentElementEventMap>(type: K, listener: (this: HTMLChatleoTrayComponentElement, ev: ChatleoTrayComponentCustomEvent<HTMLChatleoTrayComponentElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
843
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
844
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
845
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
846
|
+
removeEventListener<K extends keyof HTMLChatleoTrayComponentElementEventMap>(type: K, listener: (this: HTMLChatleoTrayComponentElement, ev: ChatleoTrayComponentCustomEvent<HTMLChatleoTrayComponentElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
847
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
848
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
849
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
850
|
+
}
|
|
851
|
+
var HTMLChatleoTrayComponentElement: {
|
|
852
|
+
prototype: HTMLChatleoTrayComponentElement;
|
|
853
|
+
new (): HTMLChatleoTrayComponentElement;
|
|
854
|
+
};
|
|
855
|
+
interface HTMLChatleoUserTileElementEventMap {
|
|
856
|
+
"userClicked": UserProfile;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* @component ChatleoUserTile
|
|
860
|
+
* @description This component displays a tile for a single user, showing their avatar, name, and online status. It is typically used in a list of users.
|
|
861
|
+
* @property {UserProfile} profile - The `UserProfile` object for the user to be displayed. This includes the user's name and avatar URL.
|
|
862
|
+
* @property {boolean} isOnline - A boolean indicating whether the user is currently online.
|
|
863
|
+
* @property {string} lastSeen - A string indicating when the user was last seen online. This is displayed if the user is not currently online.
|
|
864
|
+
* @fires userClicked - This event is emitted when the user tile is clicked. The event detail contains the `UserProfile` of the clicked user.
|
|
865
|
+
*/
|
|
866
|
+
interface HTMLChatleoUserTileElement extends Components.ChatleoUserTile, HTMLStencilElement {
|
|
867
|
+
addEventListener<K extends keyof HTMLChatleoUserTileElementEventMap>(type: K, listener: (this: HTMLChatleoUserTileElement, ev: ChatleoUserTileCustomEvent<HTMLChatleoUserTileElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
868
|
+
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
869
|
+
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
|
|
870
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
871
|
+
removeEventListener<K extends keyof HTMLChatleoUserTileElementEventMap>(type: K, listener: (this: HTMLChatleoUserTileElement, ev: ChatleoUserTileCustomEvent<HTMLChatleoUserTileElementEventMap[K]>) => any, options?: boolean | EventListenerOptions): void;
|
|
872
|
+
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
873
|
+
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
|
|
874
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
875
|
+
}
|
|
876
|
+
var HTMLChatleoUserTileElement: {
|
|
877
|
+
prototype: HTMLChatleoUserTileElement;
|
|
878
|
+
new (): HTMLChatleoUserTileElement;
|
|
879
|
+
};
|
|
880
|
+
interface HTMLMyComponentElement extends Components.MyComponent, HTMLStencilElement {
|
|
881
|
+
}
|
|
882
|
+
var HTMLMyComponentElement: {
|
|
883
|
+
prototype: HTMLMyComponentElement;
|
|
884
|
+
new (): HTMLMyComponentElement;
|
|
885
|
+
};
|
|
886
|
+
interface HTMLElementTagNameMap {
|
|
887
|
+
"chatleo-avatar": HTMLChatleoAvatarElement;
|
|
888
|
+
"chatleo-chat": HTMLChatleoChatElement;
|
|
889
|
+
"chatleo-chat-header": HTMLChatleoChatHeaderElement;
|
|
890
|
+
"chatleo-chat-input": HTMLChatleoChatInputElement;
|
|
891
|
+
"chatleo-chat-message": HTMLChatleoChatMessageElement;
|
|
892
|
+
"chatleo-component": HTMLChatleoComponentElement;
|
|
893
|
+
"chatleo-new-message-selector": HTMLChatleoNewMessageSelectorElement;
|
|
894
|
+
"chatleo-rich-input": HTMLChatleoRichInputElement;
|
|
895
|
+
"chatleo-rich-message-renderer": HTMLChatleoRichMessageRendererElement;
|
|
896
|
+
"chatleo-room-list": HTMLChatleoRoomListElement;
|
|
897
|
+
"chatleo-room-tile-component": HTMLChatleoRoomTileComponentElement;
|
|
898
|
+
"chatleo-room-view": HTMLChatleoRoomViewElement;
|
|
899
|
+
"chatleo-tray-component": HTMLChatleoTrayComponentElement;
|
|
900
|
+
"chatleo-user-tile": HTMLChatleoUserTileElement;
|
|
901
|
+
"my-component": HTMLMyComponentElement;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
declare namespace LocalJSX {
|
|
905
|
+
/**
|
|
906
|
+
* @component ChatleoAvatar
|
|
907
|
+
* @description This component is responsible for rendering a user's avatar. It can display an image from a URL if one is provided. If no URL is given, it generates a colorful SVG avatar with the user's initials. It also displays a status indicator showing whether the user is online or offline.
|
|
908
|
+
* @property {string} name - The full name of the user. This is used to generate the initials for the SVG fallback avatar.
|
|
909
|
+
* @property {string} url - The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
|
|
910
|
+
* @property {boolean} isOnline - A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
|
|
911
|
+
*/
|
|
912
|
+
interface ChatleoAvatar {
|
|
913
|
+
/**
|
|
914
|
+
* A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
|
|
915
|
+
* @default false
|
|
916
|
+
*/
|
|
917
|
+
"isOnline"?: boolean;
|
|
918
|
+
/**
|
|
919
|
+
* The full name of the user, which is used to generate the initials for the SVG fallback avatar.
|
|
920
|
+
*/
|
|
921
|
+
"name"?: string;
|
|
922
|
+
/**
|
|
923
|
+
* The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
|
|
924
|
+
*/
|
|
925
|
+
"url"?: string;
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* @component ChatleoChat
|
|
929
|
+
* @description This is the main component for the chat interface. It orchestrates the different parts of the chat, including the room list, chat header, message display, and input area. It listens for events from child components to handle message sending and room selection.
|
|
930
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
931
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
932
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
933
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
934
|
+
*/
|
|
935
|
+
interface ChatleoChat {
|
|
936
|
+
/**
|
|
937
|
+
* Calls are available and enabled for this host.
|
|
938
|
+
* @default false
|
|
939
|
+
*/
|
|
940
|
+
"callsAvailable"?: boolean;
|
|
941
|
+
/**
|
|
942
|
+
* An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
943
|
+
*/
|
|
944
|
+
"chatStore"?: ChatStore;
|
|
945
|
+
/**
|
|
946
|
+
* This client is currently in the room's call.
|
|
947
|
+
* @default false
|
|
948
|
+
*/
|
|
949
|
+
"inCall"?: boolean;
|
|
950
|
+
/**
|
|
951
|
+
* Indicates the current user's online status.
|
|
952
|
+
* @default false
|
|
953
|
+
*/
|
|
954
|
+
"isOnline"?: boolean;
|
|
955
|
+
"onMessageChatSent"?: (event: ChatleoChatCustomEvent<ChatMessageSent>) => void;
|
|
956
|
+
/**
|
|
957
|
+
* If `true`, the component will display a loading state instead of the message list.
|
|
958
|
+
* @default false
|
|
959
|
+
*/
|
|
960
|
+
"pending"?: boolean;
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* @component ChatleoChatHeader
|
|
964
|
+
* @description This component displays the header for a chat window. It includes the user's avatar, name, and online status. It is a simple presentational component that receives all its data via props.
|
|
965
|
+
* @property {string} name - The name of the user to be displayed in the header.
|
|
966
|
+
* @property {string} avatar - The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
|
|
967
|
+
* @property {boolean} isOnline - A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
|
|
968
|
+
*/
|
|
969
|
+
interface ChatleoChatHeader {
|
|
970
|
+
/**
|
|
971
|
+
* The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
|
|
972
|
+
*/
|
|
973
|
+
"avatar"?: string;
|
|
974
|
+
/**
|
|
975
|
+
* A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
|
|
976
|
+
* @default false
|
|
977
|
+
*/
|
|
978
|
+
"isOnline"?: boolean;
|
|
979
|
+
/**
|
|
980
|
+
* The name of the user to be displayed in the header.
|
|
981
|
+
* @default ""
|
|
982
|
+
*/
|
|
983
|
+
"name"?: string;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* @component ChatleoChatInput
|
|
987
|
+
* @description This component provides a simple text input for sending chat messages. It includes a text field, an emoji button, and action buttons for attaching files and sending the message. It can be configured to send messages on `Enter` or `Cmd/Ctrl+Enter`.
|
|
988
|
+
* @property {boolean} disabled - When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
989
|
+
* @property {boolean} sendOnModifierEnter - If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
990
|
+
* @fires messageInputSent - This event is emitted when the user sends a message. The event detail contains the trimmed text of the message.
|
|
991
|
+
*/
|
|
992
|
+
interface ChatleoChatInput {
|
|
993
|
+
/**
|
|
994
|
+
* When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
995
|
+
* @default false
|
|
996
|
+
*/
|
|
997
|
+
"disabled"?: boolean;
|
|
998
|
+
"onMessageInputSent"?: (event: ChatleoChatInputCustomEvent<string>) => void;
|
|
999
|
+
/**
|
|
1000
|
+
* If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
1001
|
+
* @default false
|
|
1002
|
+
*/
|
|
1003
|
+
"sendOnModifierEnter"?: boolean;
|
|
1004
|
+
}
|
|
1005
|
+
interface ChatleoChatMessage {
|
|
1006
|
+
/**
|
|
1007
|
+
* @default false
|
|
1008
|
+
*/
|
|
1009
|
+
"isOwnMessage"?: boolean;
|
|
1010
|
+
/**
|
|
1011
|
+
* @default 'en-US'
|
|
1012
|
+
*/
|
|
1013
|
+
"locale"?: string;
|
|
1014
|
+
"message"?: ChatLeoMessage;
|
|
1015
|
+
/**
|
|
1016
|
+
* Emitted when the user discards a failed/pending message (detail: `client_id`).
|
|
1017
|
+
*/
|
|
1018
|
+
"onMessageDiscard"?: (event: ChatleoChatMessageCustomEvent<string>) => void;
|
|
1019
|
+
/**
|
|
1020
|
+
* Emitted when the user asks to resend a failed message (detail: `client_id`).
|
|
1021
|
+
*/
|
|
1022
|
+
"onMessageRetry"?: (event: ChatleoChatMessageCustomEvent<string>) => void;
|
|
1023
|
+
/**
|
|
1024
|
+
* @default undefined
|
|
1025
|
+
*/
|
|
1026
|
+
"sender"?: UserProfile | undefined;
|
|
1027
|
+
/**
|
|
1028
|
+
* @default false
|
|
1029
|
+
*/
|
|
1030
|
+
"senderIsOnline"?: boolean;
|
|
1031
|
+
/**
|
|
1032
|
+
* @default {}
|
|
1033
|
+
*/
|
|
1034
|
+
"translations"?: Record<string, string>;
|
|
1035
|
+
}
|
|
1036
|
+
/**
|
|
1037
|
+
* @component ChatLeoComponent
|
|
1038
|
+
* @description This is the root component for the ChatLeo application. It serves as the main entry point and orchestrates the overall functionality. It can be configured to render either a full-page chat client or a tray-based widget. It also handles the connection to the `ChatLeoLib` and manages the application's lifecycle.
|
|
1039
|
+
* @property {string} username - The username of the user, which can be used for authentication.
|
|
1040
|
+
* @property {string} ticket - An authentication ticket used to establish a connection with the chat service.
|
|
1041
|
+
* @property {boolean} useTray - If `true`, the component will render as a tray-based chat widget.
|
|
1042
|
+
* @property {boolean} useMain - If `true`, the component will render as a full-page chat application.
|
|
1043
|
+
* @property {ChatLeoLib} chatLeoLib - An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
|
|
1044
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state.
|
|
1045
|
+
*/
|
|
1046
|
+
interface ChatleoComponent {
|
|
1047
|
+
/**
|
|
1048
|
+
* `auto` shows call controls when the server advertises calls; `off` disables the call UI.
|
|
1049
|
+
* @default 'auto'
|
|
1050
|
+
*/
|
|
1051
|
+
"calls"?: 'auto' | 'off';
|
|
1052
|
+
/**
|
|
1053
|
+
* An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
|
|
1054
|
+
*/
|
|
1055
|
+
"chatLeoLib"?: ChatLeoLib;
|
|
1056
|
+
/**
|
|
1057
|
+
* An instance of the `ChatStore` class, which manages the application's state.
|
|
1058
|
+
*/
|
|
1059
|
+
"chatStore"?: ChatStore;
|
|
1060
|
+
/**
|
|
1061
|
+
* Fires when the open conversation changes, so a host can drive navigation/history.
|
|
1062
|
+
*/
|
|
1063
|
+
"onActiveRoomChange"?: (event: ChatleoComponentCustomEvent<{ roomId: string | null }>) => void;
|
|
1064
|
+
/**
|
|
1065
|
+
* Fires when the total unread count changes (app badge, title, ...).
|
|
1066
|
+
*/
|
|
1067
|
+
"onUnreadTotalChange"?: (event: ChatleoComponentCustomEvent<{ count: number }>) => void;
|
|
1068
|
+
/**
|
|
1069
|
+
* `manual` shows a notification control; `prompt` also shows an in-page explanation; `off` hides it.
|
|
1070
|
+
* @default 'manual'
|
|
1071
|
+
*/
|
|
1072
|
+
"push"?: 'off' | 'manual' | 'prompt';
|
|
1073
|
+
/**
|
|
1074
|
+
* Path of the push service worker served by the host.
|
|
1075
|
+
*/
|
|
1076
|
+
"pushSwPath"?: string;
|
|
1077
|
+
/**
|
|
1078
|
+
* The ID of the room to display when using room view mode.
|
|
1079
|
+
*/
|
|
1080
|
+
"roomId"?: string;
|
|
1081
|
+
"serverUrl"?: string;
|
|
1082
|
+
/**
|
|
1083
|
+
* An authentication ticket used to establish a connection with the chat service.
|
|
1084
|
+
*/
|
|
1085
|
+
"ticket"?: string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Real-time protocol: `socketio` (default), `v2` (ChatLeo Protocol v2) or `auto` (use v2 when the server's `/.well-known/chatleo` offers it, otherwise Socket.IO). Overrides `ChatLeoLib.transport`.
|
|
1088
|
+
*/
|
|
1089
|
+
"transport"?: 'auto' | 'socketio' | 'v2';
|
|
1090
|
+
/**
|
|
1091
|
+
* If `true`, the component will render as a full-page chat application.
|
|
1092
|
+
* @default false
|
|
1093
|
+
*/
|
|
1094
|
+
"useMain"?: boolean;
|
|
1095
|
+
/**
|
|
1096
|
+
* If `true`, the component will render as a single room view without the room list.
|
|
1097
|
+
* @default false
|
|
1098
|
+
*/
|
|
1099
|
+
"useRoomView"?: boolean;
|
|
1100
|
+
/**
|
|
1101
|
+
* If `true`, the component will render as a tray-based chat widget.
|
|
1102
|
+
*/
|
|
1103
|
+
"useTray"?: boolean;
|
|
1104
|
+
/**
|
|
1105
|
+
* The username of the user, which can be used for authentication.
|
|
1106
|
+
*/
|
|
1107
|
+
"username"?: string;
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* @component ChatLeoNewMessageSelector
|
|
1111
|
+
* @description This component provides a UI for starting a new conversation. It displays a list of users that can be filtered by name. When a user is selected, it fires an event to notify the parent component.
|
|
1112
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to access the list of users and their presence information.
|
|
1113
|
+
* @property {string} placeholder - The placeholder text to be displayed in the search input field.
|
|
1114
|
+
* @fires userSelected - This event is emitted when a user is selected from the list. The event detail contains the `UserProfile` of the selected user.
|
|
1115
|
+
* @fires doClose - This event is emitted when the user clicks the close button.
|
|
1116
|
+
*/
|
|
1117
|
+
interface ChatleoNewMessageSelector {
|
|
1118
|
+
/**
|
|
1119
|
+
* An instance of the `ChatStore` class, used to access the list of users and their presence information.
|
|
1120
|
+
*/
|
|
1121
|
+
"chatStore"?: ChatStore;
|
|
1122
|
+
"onDoClose"?: (event: ChatleoNewMessageSelectorCustomEvent<void>) => void;
|
|
1123
|
+
"onUserSelected"?: (event: ChatleoNewMessageSelectorCustomEvent<UserProfile>) => void;
|
|
1124
|
+
/**
|
|
1125
|
+
* The placeholder text to be displayed in the search input field.
|
|
1126
|
+
* @default "Suche"
|
|
1127
|
+
*/
|
|
1128
|
+
"placeholder"?: string;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* ChatleoRichInput
|
|
1132
|
+
* A Stencil-based rich text input component that supports:
|
|
1133
|
+
* - Free text entry in a contenteditable div
|
|
1134
|
+
* - Drag-and-drop and file picker attachments (single or multiple)
|
|
1135
|
+
* - Inline, non-editable attachment blocks with thumbnails for images
|
|
1136
|
+
* Component produces two payload formats:
|
|
1137
|
+
* - Legacy RichInputContent: { text: string, attachments: FileAttachment[] }
|
|
1138
|
+
* - StructuredMessageContent: blocks[] + generated html for richer, future-proof messaging
|
|
1139
|
+
* Core data flow:
|
|
1140
|
+
* - User types or adds files → editor DOM updates
|
|
1141
|
+
* - handleInput/handleFiles/drag handlers → emitContentChange/extractContent
|
|
1142
|
+
* - Send via Enter key or send button → handleSendMessage
|
|
1143
|
+
* - Builds both legacy and structured payloads via extractContent and extractStructuredContent
|
|
1144
|
+
* - Emits messageSend (primary)
|
|
1145
|
+
*/
|
|
1146
|
+
interface ChatleoRichInput {
|
|
1147
|
+
/**
|
|
1148
|
+
* A comma-separated string of MIME types or file extensions that the file input should accept. This is passed to the `accept` attribute of the hidden file input element.
|
|
1149
|
+
* @default 'image/*,.pdf,.doc,.docx,.txt'
|
|
1150
|
+
*/
|
|
1151
|
+
"acceptFiles"?: string;
|
|
1152
|
+
/**
|
|
1153
|
+
* If `true`, the editor and all associated buttons will be disabled, preventing user interaction.
|
|
1154
|
+
* @default false
|
|
1155
|
+
*/
|
|
1156
|
+
"disabled"?: boolean;
|
|
1157
|
+
/**
|
|
1158
|
+
* A CSS string that defines the maximum height of the editor area before it starts scrolling.
|
|
1159
|
+
* @default '200px'
|
|
1160
|
+
*/
|
|
1161
|
+
"maxHeight"?: string;
|
|
1162
|
+
/**
|
|
1163
|
+
* Fires whenever the legacy content snapshot changes (typing, attachments).
|
|
1164
|
+
*/
|
|
1165
|
+
"onContentChange"?: (event: ChatleoRichInputCustomEvent<RichInputContent>) => void;
|
|
1166
|
+
/**
|
|
1167
|
+
* Primary event emitted on send with structured content blocks and generated HTML.
|
|
1168
|
+
*/
|
|
1169
|
+
"onMessageSend"?: (event: ChatleoRichInputCustomEvent<StructuredMessageContent>) => void;
|
|
1170
|
+
/**
|
|
1171
|
+
* The placeholder text that appears in the editor when it is empty.
|
|
1172
|
+
* @default 'Write a message...'
|
|
1173
|
+
*/
|
|
1174
|
+
"placeholder"?: string;
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* @component ChatleoRichMessageRenderer
|
|
1178
|
+
* @description This component is responsible for rendering structured message content, which can include text and attachments. It takes a `StructuredMessageContent` object and renders it as a series of blocks.
|
|
1179
|
+
* @property {StructuredMessageContent} content - The structured message content object to be rendered. This object contains an array of blocks, each of which can be a text or attachment block.
|
|
1180
|
+
* @property {Record<string, AttachmentDownloadInfo>} downloadUrls - A map where keys are attachment IDs and values are objects containing download information for those attachments, such as the download URL.
|
|
1181
|
+
* @property {'left' | 'right'} alignment - This property determines the text alignment of the message content. It can be either `'left'` or `'right'`.
|
|
1182
|
+
*/
|
|
1183
|
+
interface ChatleoRichMessageRenderer {
|
|
1184
|
+
/**
|
|
1185
|
+
* This property determines the text alignment of the message content. It can be either `'left'` or `'right'`.
|
|
1186
|
+
* @default 'left'
|
|
1187
|
+
*/
|
|
1188
|
+
"alignment"?: 'left' | 'right';
|
|
1189
|
+
/**
|
|
1190
|
+
* The structured message content object to be rendered. This object contains an array of blocks, each of which can be a text or attachment block.
|
|
1191
|
+
*/
|
|
1192
|
+
"content"?: StructuredMessageContent;
|
|
1193
|
+
/**
|
|
1194
|
+
* A map where keys are attachment IDs and values are objects containing download information for those attachments, such as the download URL.
|
|
1195
|
+
* @default {}
|
|
1196
|
+
*/
|
|
1197
|
+
"downloadUrls"?: Record<string, AttachmentDownloadInfo>;
|
|
1198
|
+
/**
|
|
1199
|
+
* Optional translations overriding the default UI strings (e.g. `unsupported_content`).
|
|
1200
|
+
* @default {}
|
|
1201
|
+
*/
|
|
1202
|
+
"translations"?: Record<string, string>;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* @component ChatleoRoomList
|
|
1206
|
+
* @description This component is responsible for displaying a list of chat rooms. It takes an array of `ChatRoom` objects and renders them as a list of `chatleo-room-tile-component` instances. It also offers a "new message" action that opens a user selector to start a direct message.
|
|
1207
|
+
* @property {ChatRoom[]} rooms - An array of `ChatRoom` objects to be displayed in the list.
|
|
1208
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which is used to get user presence information.
|
|
1209
|
+
* @property {string} selectedRoomId - The ID of the currently selected room.
|
|
1210
|
+
*/
|
|
1211
|
+
interface ChatleoRoomList {
|
|
1212
|
+
/**
|
|
1213
|
+
* An instance of the `ChatStore` class, which is used to get user presence information.
|
|
1214
|
+
*/
|
|
1215
|
+
"chatStore"?: ChatStore;
|
|
1216
|
+
/**
|
|
1217
|
+
* An array of `ChatRoom` objects to be displayed in the list.
|
|
1218
|
+
* @default []
|
|
1219
|
+
*/
|
|
1220
|
+
"rooms"?: ChatRoom[];
|
|
1221
|
+
/**
|
|
1222
|
+
* The ID of the currently selected room.
|
|
1223
|
+
*/
|
|
1224
|
+
"selectedRoomId"?: string;
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* @component ChatLeoRoomTileComponent
|
|
1228
|
+
* @description This component displays a single chat room in a list. It shows the room's avatar, name, the last message, a timestamp, and a count of unread messages. Clicking on the tile fires an event to select the room.
|
|
1229
|
+
* @property {ChatRoom} room - The `ChatRoom` object containing the data for the room to be displayed.
|
|
1230
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
|
|
1231
|
+
* @property {string[]} onlineUserIds - An array of user IDs for the participants in the room who are currently online.
|
|
1232
|
+
* @property {string} lastMessage - The content of the last message sent in the room.
|
|
1233
|
+
* @property {string} timestamp - The timestamp of the last message.
|
|
1234
|
+
* @property {number} unreadCount - The number of unread messages in the room.
|
|
1235
|
+
* @property {boolean} isActive - Indicates whether this room is currently selected/active.
|
|
1236
|
+
* @fires roomClicked - This event is emitted when the user clicks on the room tile. The event detail contains the ID of the clicked room.
|
|
1237
|
+
*/
|
|
1238
|
+
interface ChatleoRoomTileComponent {
|
|
1239
|
+
/**
|
|
1240
|
+
* An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
|
|
1241
|
+
*/
|
|
1242
|
+
"chatStore"?: ChatStore;
|
|
1243
|
+
/**
|
|
1244
|
+
* Indicates whether this room is currently selected/active.
|
|
1245
|
+
* @default false
|
|
1246
|
+
*/
|
|
1247
|
+
"isActive"?: boolean;
|
|
1248
|
+
/**
|
|
1249
|
+
* The content of the last message sent in the room.
|
|
1250
|
+
*/
|
|
1251
|
+
"lastMessage"?: string;
|
|
1252
|
+
"onRoomClicked"?: (event: ChatleoRoomTileComponentCustomEvent<{id: string}>) => void;
|
|
1253
|
+
/**
|
|
1254
|
+
* An array of user IDs for the participants in the room who are currently online.
|
|
1255
|
+
*/
|
|
1256
|
+
"onlineUserIds"?: string[];
|
|
1257
|
+
/**
|
|
1258
|
+
* The `ChatRoom` object containing the data for the room to be displayed.
|
|
1259
|
+
*/
|
|
1260
|
+
"room"?: ChatRoom;
|
|
1261
|
+
/**
|
|
1262
|
+
* The timestamp of the last message.
|
|
1263
|
+
*/
|
|
1264
|
+
"timestamp"?: string;
|
|
1265
|
+
/**
|
|
1266
|
+
* The number of unread messages in the room.
|
|
1267
|
+
*/
|
|
1268
|
+
"unreadCount"?: number;
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* @component ChatleoRoomView
|
|
1272
|
+
* @description This component displays a single chat room view without the room list. It shows the chat header, message display, and input area for a specific room. It communicates directly with the ChatStore to load and display messages.
|
|
1273
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
1274
|
+
* @property {string} roomId - The ID of the room to display. When this changes, the component will load messages for the new room.
|
|
1275
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
1276
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
1277
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
1278
|
+
*/
|
|
1279
|
+
interface ChatleoRoomView {
|
|
1280
|
+
/**
|
|
1281
|
+
* True when the server advertises calls and the host did not disable them.
|
|
1282
|
+
* @default false
|
|
1283
|
+
*/
|
|
1284
|
+
"callsAvailable"?: boolean;
|
|
1285
|
+
/**
|
|
1286
|
+
* An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
1287
|
+
*/
|
|
1288
|
+
"chatStore"?: ChatStore;
|
|
1289
|
+
/**
|
|
1290
|
+
* True while this client is in the room's call (keeps the banner from showing).
|
|
1291
|
+
* @default false
|
|
1292
|
+
*/
|
|
1293
|
+
"inCall"?: boolean;
|
|
1294
|
+
/**
|
|
1295
|
+
* Indicates the current user's online status.
|
|
1296
|
+
* @default false
|
|
1297
|
+
*/
|
|
1298
|
+
"isOnline"?: boolean;
|
|
1299
|
+
"onCallRequested"?: (event: ChatleoRoomViewCustomEvent<{ roomId: string; callId?: string }>) => void;
|
|
1300
|
+
"onMessageChatSent"?: (event: ChatleoRoomViewCustomEvent<ChatMessageSent>) => void;
|
|
1301
|
+
/**
|
|
1302
|
+
* If `true`, the component will display a loading state instead of the message list.
|
|
1303
|
+
* @default false
|
|
1304
|
+
*/
|
|
1305
|
+
"pending"?: boolean;
|
|
1306
|
+
/**
|
|
1307
|
+
* The ID of the room to display.
|
|
1308
|
+
*/
|
|
1309
|
+
"roomId"?: string;
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* @component ChatLeoTrayComponent
|
|
1313
|
+
* @description This component implements a chat tray that can be opened and closed. It contains a list of chat rooms and can open a message panel for a selected room or a user selector to start a new chat.
|
|
1314
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which provides the state for the chat application.
|
|
1315
|
+
* @fires newChatClicked - This event is emitted when the user clicks the "new chat" button.
|
|
1316
|
+
* @fires messageChatSent - This event is emitted when a message is sent from the chat panel.
|
|
1317
|
+
*/
|
|
1318
|
+
interface ChatleoTrayComponent {
|
|
1319
|
+
/**
|
|
1320
|
+
* An instance of the `ChatStore` class, which provides the state for the chat application.
|
|
1321
|
+
*/
|
|
1322
|
+
"chatStore"?: ChatStore;
|
|
1323
|
+
"onMessageChatSent"?: (event: ChatleoTrayComponentCustomEvent<ChatMessageSent>) => void;
|
|
1324
|
+
"onNewChatClicked"?: (event: ChatleoTrayComponentCustomEvent<string>) => void;
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* @component ChatleoUserTile
|
|
1328
|
+
* @description This component displays a tile for a single user, showing their avatar, name, and online status. It is typically used in a list of users.
|
|
1329
|
+
* @property {UserProfile} profile - The `UserProfile` object for the user to be displayed. This includes the user's name and avatar URL.
|
|
1330
|
+
* @property {boolean} isOnline - A boolean indicating whether the user is currently online.
|
|
1331
|
+
* @property {string} lastSeen - A string indicating when the user was last seen online. This is displayed if the user is not currently online.
|
|
1332
|
+
* @fires userClicked - This event is emitted when the user tile is clicked. The event detail contains the `UserProfile` of the clicked user.
|
|
1333
|
+
*/
|
|
1334
|
+
interface ChatleoUserTile {
|
|
1335
|
+
/**
|
|
1336
|
+
* A boolean indicating whether the user is currently online.
|
|
1337
|
+
* @default false
|
|
1338
|
+
*/
|
|
1339
|
+
"isOnline"?: boolean;
|
|
1340
|
+
/**
|
|
1341
|
+
* A string indicating when the user was last seen online. This is displayed if the user is not currently online.
|
|
1342
|
+
*/
|
|
1343
|
+
"lastSeen"?: string;
|
|
1344
|
+
"onUserClicked"?: (event: ChatleoUserTileCustomEvent<UserProfile>) => void;
|
|
1345
|
+
/**
|
|
1346
|
+
* The `UserProfile` object for the user to be displayed. This includes the user's name and avatar URL.
|
|
1347
|
+
*/
|
|
1348
|
+
"profile"?: UserProfile;
|
|
1349
|
+
}
|
|
1350
|
+
interface MyComponent {
|
|
1351
|
+
/**
|
|
1352
|
+
* The first name
|
|
1353
|
+
*/
|
|
1354
|
+
"first"?: string;
|
|
1355
|
+
/**
|
|
1356
|
+
* The last name
|
|
1357
|
+
*/
|
|
1358
|
+
"last"?: string;
|
|
1359
|
+
/**
|
|
1360
|
+
* The middle name
|
|
1361
|
+
*/
|
|
1362
|
+
"middle"?: string;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
interface ChatleoAvatarAttributes {
|
|
1366
|
+
"name": string;
|
|
1367
|
+
"url": string;
|
|
1368
|
+
"isOnline": boolean;
|
|
1369
|
+
}
|
|
1370
|
+
interface ChatleoChatAttributes {
|
|
1371
|
+
"isOnline": boolean;
|
|
1372
|
+
"pending": boolean;
|
|
1373
|
+
"callsAvailable": boolean;
|
|
1374
|
+
"inCall": boolean;
|
|
1375
|
+
}
|
|
1376
|
+
interface ChatleoChatHeaderAttributes {
|
|
1377
|
+
"name": string;
|
|
1378
|
+
"avatar": string;
|
|
1379
|
+
"isOnline": boolean;
|
|
1380
|
+
}
|
|
1381
|
+
interface ChatleoChatInputAttributes {
|
|
1382
|
+
"disabled": boolean;
|
|
1383
|
+
"sendOnModifierEnter": boolean;
|
|
1384
|
+
}
|
|
1385
|
+
interface ChatleoChatMessageAttributes {
|
|
1386
|
+
"senderIsOnline": boolean;
|
|
1387
|
+
"isOwnMessage": boolean;
|
|
1388
|
+
"locale": string;
|
|
1389
|
+
}
|
|
1390
|
+
interface ChatleoComponentAttributes {
|
|
1391
|
+
"username": string;
|
|
1392
|
+
"ticket": string;
|
|
1393
|
+
"useTray": boolean;
|
|
1394
|
+
"useMain": boolean;
|
|
1395
|
+
"useRoomView": boolean;
|
|
1396
|
+
"roomId": string;
|
|
1397
|
+
"serverUrl": string;
|
|
1398
|
+
"transport": 'auto' | 'socketio' | 'v2';
|
|
1399
|
+
"calls": 'auto' | 'off';
|
|
1400
|
+
"push": 'off' | 'manual' | 'prompt';
|
|
1401
|
+
"pushSwPath": string;
|
|
1402
|
+
}
|
|
1403
|
+
interface ChatleoNewMessageSelectorAttributes {
|
|
1404
|
+
"placeholder": string;
|
|
1405
|
+
}
|
|
1406
|
+
interface ChatleoRichInputAttributes {
|
|
1407
|
+
"disabled": boolean;
|
|
1408
|
+
"placeholder": string;
|
|
1409
|
+
"maxHeight": string;
|
|
1410
|
+
"acceptFiles": string;
|
|
1411
|
+
}
|
|
1412
|
+
interface ChatleoRichMessageRendererAttributes {
|
|
1413
|
+
"alignment": 'left' | 'right';
|
|
1414
|
+
}
|
|
1415
|
+
interface ChatleoRoomListAttributes {
|
|
1416
|
+
"selectedRoomId": string;
|
|
1417
|
+
}
|
|
1418
|
+
interface ChatleoRoomTileComponentAttributes {
|
|
1419
|
+
"lastMessage": string;
|
|
1420
|
+
"timestamp": string;
|
|
1421
|
+
"unreadCount": number;
|
|
1422
|
+
"isActive": boolean;
|
|
1423
|
+
}
|
|
1424
|
+
interface ChatleoRoomViewAttributes {
|
|
1425
|
+
"roomId": string;
|
|
1426
|
+
"isOnline": boolean;
|
|
1427
|
+
"pending": boolean;
|
|
1428
|
+
"callsAvailable": boolean;
|
|
1429
|
+
"inCall": boolean;
|
|
1430
|
+
}
|
|
1431
|
+
interface ChatleoUserTileAttributes {
|
|
1432
|
+
"isOnline": boolean;
|
|
1433
|
+
"lastSeen": string;
|
|
1434
|
+
}
|
|
1435
|
+
interface MyComponentAttributes {
|
|
1436
|
+
"first": string;
|
|
1437
|
+
"middle": string;
|
|
1438
|
+
"last": string;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
interface IntrinsicElements {
|
|
1442
|
+
"chatleo-avatar": Omit<ChatleoAvatar, keyof ChatleoAvatarAttributes> & { [K in keyof ChatleoAvatar & keyof ChatleoAvatarAttributes]?: ChatleoAvatar[K] } & { [K in keyof ChatleoAvatar & keyof ChatleoAvatarAttributes as `attr:${K}`]?: ChatleoAvatarAttributes[K] } & { [K in keyof ChatleoAvatar & keyof ChatleoAvatarAttributes as `prop:${K}`]?: ChatleoAvatar[K] };
|
|
1443
|
+
"chatleo-chat": Omit<ChatleoChat, keyof ChatleoChatAttributes> & { [K in keyof ChatleoChat & keyof ChatleoChatAttributes]?: ChatleoChat[K] } & { [K in keyof ChatleoChat & keyof ChatleoChatAttributes as `attr:${K}`]?: ChatleoChatAttributes[K] } & { [K in keyof ChatleoChat & keyof ChatleoChatAttributes as `prop:${K}`]?: ChatleoChat[K] };
|
|
1444
|
+
"chatleo-chat-header": Omit<ChatleoChatHeader, keyof ChatleoChatHeaderAttributes> & { [K in keyof ChatleoChatHeader & keyof ChatleoChatHeaderAttributes]?: ChatleoChatHeader[K] } & { [K in keyof ChatleoChatHeader & keyof ChatleoChatHeaderAttributes as `attr:${K}`]?: ChatleoChatHeaderAttributes[K] } & { [K in keyof ChatleoChatHeader & keyof ChatleoChatHeaderAttributes as `prop:${K}`]?: ChatleoChatHeader[K] };
|
|
1445
|
+
"chatleo-chat-input": Omit<ChatleoChatInput, keyof ChatleoChatInputAttributes> & { [K in keyof ChatleoChatInput & keyof ChatleoChatInputAttributes]?: ChatleoChatInput[K] } & { [K in keyof ChatleoChatInput & keyof ChatleoChatInputAttributes as `attr:${K}`]?: ChatleoChatInputAttributes[K] } & { [K in keyof ChatleoChatInput & keyof ChatleoChatInputAttributes as `prop:${K}`]?: ChatleoChatInput[K] };
|
|
1446
|
+
"chatleo-chat-message": Omit<ChatleoChatMessage, keyof ChatleoChatMessageAttributes> & { [K in keyof ChatleoChatMessage & keyof ChatleoChatMessageAttributes]?: ChatleoChatMessage[K] } & { [K in keyof ChatleoChatMessage & keyof ChatleoChatMessageAttributes as `attr:${K}`]?: ChatleoChatMessageAttributes[K] } & { [K in keyof ChatleoChatMessage & keyof ChatleoChatMessageAttributes as `prop:${K}`]?: ChatleoChatMessage[K] };
|
|
1447
|
+
"chatleo-component": Omit<ChatleoComponent, keyof ChatleoComponentAttributes> & { [K in keyof ChatleoComponent & keyof ChatleoComponentAttributes]?: ChatleoComponent[K] } & { [K in keyof ChatleoComponent & keyof ChatleoComponentAttributes as `attr:${K}`]?: ChatleoComponentAttributes[K] } & { [K in keyof ChatleoComponent & keyof ChatleoComponentAttributes as `prop:${K}`]?: ChatleoComponent[K] };
|
|
1448
|
+
"chatleo-new-message-selector": Omit<ChatleoNewMessageSelector, keyof ChatleoNewMessageSelectorAttributes> & { [K in keyof ChatleoNewMessageSelector & keyof ChatleoNewMessageSelectorAttributes]?: ChatleoNewMessageSelector[K] } & { [K in keyof ChatleoNewMessageSelector & keyof ChatleoNewMessageSelectorAttributes as `attr:${K}`]?: ChatleoNewMessageSelectorAttributes[K] } & { [K in keyof ChatleoNewMessageSelector & keyof ChatleoNewMessageSelectorAttributes as `prop:${K}`]?: ChatleoNewMessageSelector[K] };
|
|
1449
|
+
"chatleo-rich-input": Omit<ChatleoRichInput, keyof ChatleoRichInputAttributes> & { [K in keyof ChatleoRichInput & keyof ChatleoRichInputAttributes]?: ChatleoRichInput[K] } & { [K in keyof ChatleoRichInput & keyof ChatleoRichInputAttributes as `attr:${K}`]?: ChatleoRichInputAttributes[K] } & { [K in keyof ChatleoRichInput & keyof ChatleoRichInputAttributes as `prop:${K}`]?: ChatleoRichInput[K] };
|
|
1450
|
+
"chatleo-rich-message-renderer": Omit<ChatleoRichMessageRenderer, keyof ChatleoRichMessageRendererAttributes> & { [K in keyof ChatleoRichMessageRenderer & keyof ChatleoRichMessageRendererAttributes]?: ChatleoRichMessageRenderer[K] } & { [K in keyof ChatleoRichMessageRenderer & keyof ChatleoRichMessageRendererAttributes as `attr:${K}`]?: ChatleoRichMessageRendererAttributes[K] } & { [K in keyof ChatleoRichMessageRenderer & keyof ChatleoRichMessageRendererAttributes as `prop:${K}`]?: ChatleoRichMessageRenderer[K] };
|
|
1451
|
+
"chatleo-room-list": Omit<ChatleoRoomList, keyof ChatleoRoomListAttributes> & { [K in keyof ChatleoRoomList & keyof ChatleoRoomListAttributes]?: ChatleoRoomList[K] } & { [K in keyof ChatleoRoomList & keyof ChatleoRoomListAttributes as `attr:${K}`]?: ChatleoRoomListAttributes[K] } & { [K in keyof ChatleoRoomList & keyof ChatleoRoomListAttributes as `prop:${K}`]?: ChatleoRoomList[K] };
|
|
1452
|
+
"chatleo-room-tile-component": Omit<ChatleoRoomTileComponent, keyof ChatleoRoomTileComponentAttributes> & { [K in keyof ChatleoRoomTileComponent & keyof ChatleoRoomTileComponentAttributes]?: ChatleoRoomTileComponent[K] } & { [K in keyof ChatleoRoomTileComponent & keyof ChatleoRoomTileComponentAttributes as `attr:${K}`]?: ChatleoRoomTileComponentAttributes[K] } & { [K in keyof ChatleoRoomTileComponent & keyof ChatleoRoomTileComponentAttributes as `prop:${K}`]?: ChatleoRoomTileComponent[K] };
|
|
1453
|
+
"chatleo-room-view": Omit<ChatleoRoomView, keyof ChatleoRoomViewAttributes> & { [K in keyof ChatleoRoomView & keyof ChatleoRoomViewAttributes]?: ChatleoRoomView[K] } & { [K in keyof ChatleoRoomView & keyof ChatleoRoomViewAttributes as `attr:${K}`]?: ChatleoRoomViewAttributes[K] } & { [K in keyof ChatleoRoomView & keyof ChatleoRoomViewAttributes as `prop:${K}`]?: ChatleoRoomView[K] };
|
|
1454
|
+
"chatleo-tray-component": ChatleoTrayComponent;
|
|
1455
|
+
"chatleo-user-tile": Omit<ChatleoUserTile, keyof ChatleoUserTileAttributes> & { [K in keyof ChatleoUserTile & keyof ChatleoUserTileAttributes]?: ChatleoUserTile[K] } & { [K in keyof ChatleoUserTile & keyof ChatleoUserTileAttributes as `attr:${K}`]?: ChatleoUserTileAttributes[K] } & { [K in keyof ChatleoUserTile & keyof ChatleoUserTileAttributes as `prop:${K}`]?: ChatleoUserTile[K] };
|
|
1456
|
+
"my-component": Omit<MyComponent, keyof MyComponentAttributes> & { [K in keyof MyComponent & keyof MyComponentAttributes]?: MyComponent[K] } & { [K in keyof MyComponent & keyof MyComponentAttributes as `attr:${K}`]?: MyComponentAttributes[K] } & { [K in keyof MyComponent & keyof MyComponentAttributes as `prop:${K}`]?: MyComponent[K] };
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
export { LocalJSX as JSX };
|
|
1460
|
+
declare module "@stencil/core" {
|
|
1461
|
+
export namespace JSX {
|
|
1462
|
+
interface IntrinsicElements {
|
|
1463
|
+
/**
|
|
1464
|
+
* @component ChatleoAvatar
|
|
1465
|
+
* @description This component is responsible for rendering a user's avatar. It can display an image from a URL if one is provided. If no URL is given, it generates a colorful SVG avatar with the user's initials. It also displays a status indicator showing whether the user is online or offline.
|
|
1466
|
+
* @property {string} name - The full name of the user. This is used to generate the initials for the SVG fallback avatar.
|
|
1467
|
+
* @property {string} url - The URL for the user's avatar image. If this is not provided, the component will render a generated SVG avatar.
|
|
1468
|
+
* @property {boolean} isOnline - A boolean that determines the color of the status indicator. `true` for online (green), `false` for offline (gray).
|
|
1469
|
+
*/
|
|
1470
|
+
"chatleo-avatar": LocalJSX.IntrinsicElements["chatleo-avatar"] & JSXBase.HTMLAttributes<HTMLChatleoAvatarElement>;
|
|
1471
|
+
/**
|
|
1472
|
+
* @component ChatleoChat
|
|
1473
|
+
* @description This is the main component for the chat interface. It orchestrates the different parts of the chat, including the room list, chat header, message display, and input area. It listens for events from child components to handle message sending and room selection.
|
|
1474
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
1475
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
1476
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
1477
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
1478
|
+
*/
|
|
1479
|
+
"chatleo-chat": LocalJSX.IntrinsicElements["chatleo-chat"] & JSXBase.HTMLAttributes<HTMLChatleoChatElement>;
|
|
1480
|
+
/**
|
|
1481
|
+
* @component ChatleoChatHeader
|
|
1482
|
+
* @description This component displays the header for a chat window. It includes the user's avatar, name, and online status. It is a simple presentational component that receives all its data via props.
|
|
1483
|
+
* @property {string} name - The name of the user to be displayed in the header.
|
|
1484
|
+
* @property {string} avatar - The URL of the user's avatar image. This is passed to the `chatleo-avatar` component.
|
|
1485
|
+
* @property {boolean} isOnline - A boolean indicating the user's online status, which is also passed to the `chatleo-avatar` component to show a status indicator.
|
|
1486
|
+
*/
|
|
1487
|
+
"chatleo-chat-header": LocalJSX.IntrinsicElements["chatleo-chat-header"] & JSXBase.HTMLAttributes<HTMLChatleoChatHeaderElement>;
|
|
1488
|
+
/**
|
|
1489
|
+
* @component ChatleoChatInput
|
|
1490
|
+
* @description This component provides a simple text input for sending chat messages. It includes a text field, an emoji button, and action buttons for attaching files and sending the message. It can be configured to send messages on `Enter` or `Cmd/Ctrl+Enter`.
|
|
1491
|
+
* @property {boolean} disabled - When `true`, the input field and all buttons are disabled, preventing user interaction.
|
|
1492
|
+
* @property {boolean} sendOnModifierEnter - If `true`, the message will be sent when the user presses `Cmd+Enter` (on Mac) or `Ctrl+Enter` (on other systems). If `false`, the message is sent on `Enter` alone.
|
|
1493
|
+
* @fires messageInputSent - This event is emitted when the user sends a message. The event detail contains the trimmed text of the message.
|
|
1494
|
+
*/
|
|
1495
|
+
"chatleo-chat-input": LocalJSX.IntrinsicElements["chatleo-chat-input"] & JSXBase.HTMLAttributes<HTMLChatleoChatInputElement>;
|
|
1496
|
+
"chatleo-chat-message": LocalJSX.IntrinsicElements["chatleo-chat-message"] & JSXBase.HTMLAttributes<HTMLChatleoChatMessageElement>;
|
|
1497
|
+
/**
|
|
1498
|
+
* @component ChatLeoComponent
|
|
1499
|
+
* @description This is the root component for the ChatLeo application. It serves as the main entry point and orchestrates the overall functionality. It can be configured to render either a full-page chat client or a tray-based widget. It also handles the connection to the `ChatLeoLib` and manages the application's lifecycle.
|
|
1500
|
+
* @property {string} username - The username of the user, which can be used for authentication.
|
|
1501
|
+
* @property {string} ticket - An authentication ticket used to establish a connection with the chat service.
|
|
1502
|
+
* @property {boolean} useTray - If `true`, the component will render as a tray-based chat widget.
|
|
1503
|
+
* @property {boolean} useMain - If `true`, the component will render as a full-page chat application.
|
|
1504
|
+
* @property {ChatLeoLib} chatLeoLib - An instance of the `ChatLeoLib` class, which provides the core chat functionalities.
|
|
1505
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state.
|
|
1506
|
+
*/
|
|
1507
|
+
"chatleo-component": LocalJSX.IntrinsicElements["chatleo-component"] & JSXBase.HTMLAttributes<HTMLChatleoComponentElement>;
|
|
1508
|
+
/**
|
|
1509
|
+
* @component ChatLeoNewMessageSelector
|
|
1510
|
+
* @description This component provides a UI for starting a new conversation. It displays a list of users that can be filtered by name. When a user is selected, it fires an event to notify the parent component.
|
|
1511
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to access the list of users and their presence information.
|
|
1512
|
+
* @property {string} placeholder - The placeholder text to be displayed in the search input field.
|
|
1513
|
+
* @fires userSelected - This event is emitted when a user is selected from the list. The event detail contains the `UserProfile` of the selected user.
|
|
1514
|
+
* @fires doClose - This event is emitted when the user clicks the close button.
|
|
1515
|
+
*/
|
|
1516
|
+
"chatleo-new-message-selector": LocalJSX.IntrinsicElements["chatleo-new-message-selector"] & JSXBase.HTMLAttributes<HTMLChatleoNewMessageSelectorElement>;
|
|
1517
|
+
/**
|
|
1518
|
+
* ChatleoRichInput
|
|
1519
|
+
* A Stencil-based rich text input component that supports:
|
|
1520
|
+
* - Free text entry in a contenteditable div
|
|
1521
|
+
* - Drag-and-drop and file picker attachments (single or multiple)
|
|
1522
|
+
* - Inline, non-editable attachment blocks with thumbnails for images
|
|
1523
|
+
* Component produces two payload formats:
|
|
1524
|
+
* - Legacy RichInputContent: { text: string, attachments: FileAttachment[] }
|
|
1525
|
+
* - StructuredMessageContent: blocks[] + generated html for richer, future-proof messaging
|
|
1526
|
+
* Core data flow:
|
|
1527
|
+
* - User types or adds files → editor DOM updates
|
|
1528
|
+
* - handleInput/handleFiles/drag handlers → emitContentChange/extractContent
|
|
1529
|
+
* - Send via Enter key or send button → handleSendMessage
|
|
1530
|
+
* - Builds both legacy and structured payloads via extractContent and extractStructuredContent
|
|
1531
|
+
* - Emits messageSend (primary)
|
|
1532
|
+
*/
|
|
1533
|
+
"chatleo-rich-input": LocalJSX.IntrinsicElements["chatleo-rich-input"] & JSXBase.HTMLAttributes<HTMLChatleoRichInputElement>;
|
|
1534
|
+
/**
|
|
1535
|
+
* @component ChatleoRichMessageRenderer
|
|
1536
|
+
* @description This component is responsible for rendering structured message content, which can include text and attachments. It takes a `StructuredMessageContent` object and renders it as a series of blocks.
|
|
1537
|
+
* @property {StructuredMessageContent} content - The structured message content object to be rendered. This object contains an array of blocks, each of which can be a text or attachment block.
|
|
1538
|
+
* @property {Record<string, AttachmentDownloadInfo>} downloadUrls - A map where keys are attachment IDs and values are objects containing download information for those attachments, such as the download URL.
|
|
1539
|
+
* @property {'left' | 'right'} alignment - This property determines the text alignment of the message content. It can be either `'left'` or `'right'`.
|
|
1540
|
+
*/
|
|
1541
|
+
"chatleo-rich-message-renderer": LocalJSX.IntrinsicElements["chatleo-rich-message-renderer"] & JSXBase.HTMLAttributes<HTMLChatleoRichMessageRendererElement>;
|
|
1542
|
+
/**
|
|
1543
|
+
* @component ChatleoRoomList
|
|
1544
|
+
* @description This component is responsible for displaying a list of chat rooms. It takes an array of `ChatRoom` objects and renders them as a list of `chatleo-room-tile-component` instances. It also offers a "new message" action that opens a user selector to start a direct message.
|
|
1545
|
+
* @property {ChatRoom[]} rooms - An array of `ChatRoom` objects to be displayed in the list.
|
|
1546
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which is used to get user presence information.
|
|
1547
|
+
* @property {string} selectedRoomId - The ID of the currently selected room.
|
|
1548
|
+
*/
|
|
1549
|
+
"chatleo-room-list": LocalJSX.IntrinsicElements["chatleo-room-list"] & JSXBase.HTMLAttributes<HTMLChatleoRoomListElement>;
|
|
1550
|
+
/**
|
|
1551
|
+
* @component ChatLeoRoomTileComponent
|
|
1552
|
+
* @description This component displays a single chat room in a list. It shows the room's avatar, name, the last message, a timestamp, and a count of unread messages. Clicking on the tile fires an event to select the room.
|
|
1553
|
+
* @property {ChatRoom} room - The `ChatRoom` object containing the data for the room to be displayed.
|
|
1554
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
|
|
1555
|
+
* @property {string[]} onlineUserIds - An array of user IDs for the participants in the room who are currently online.
|
|
1556
|
+
* @property {string} lastMessage - The content of the last message sent in the room.
|
|
1557
|
+
* @property {string} timestamp - The timestamp of the last message.
|
|
1558
|
+
* @property {number} unreadCount - The number of unread messages in the room.
|
|
1559
|
+
* @property {boolean} isActive - Indicates whether this room is currently selected/active.
|
|
1560
|
+
* @fires roomClicked - This event is emitted when the user clicks on the room tile. The event detail contains the ID of the clicked room.
|
|
1561
|
+
*/
|
|
1562
|
+
"chatleo-room-tile-component": LocalJSX.IntrinsicElements["chatleo-room-tile-component"] & JSXBase.HTMLAttributes<HTMLChatleoRoomTileComponentElement>;
|
|
1563
|
+
/**
|
|
1564
|
+
* @component ChatleoRoomView
|
|
1565
|
+
* @description This component displays a single chat room view without the room list. It shows the chat header, message display, and input area for a specific room. It communicates directly with the ChatStore to load and display messages.
|
|
1566
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which manages the application's state, including rooms, messages, and user profiles.
|
|
1567
|
+
* @property {string} roomId - The ID of the room to display. When this changes, the component will load messages for the new room.
|
|
1568
|
+
* @property {boolean} isOnline - Indicates the current user's online status.
|
|
1569
|
+
* @property {boolean} pending - If `true`, the component will display a loading state instead of the message list.
|
|
1570
|
+
* @fires messageChatSent - This event is emitted when a user sends a message. The event detail contains the message payload, including the room ID, content, and sender information.
|
|
1571
|
+
*/
|
|
1572
|
+
"chatleo-room-view": LocalJSX.IntrinsicElements["chatleo-room-view"] & JSXBase.HTMLAttributes<HTMLChatleoRoomViewElement>;
|
|
1573
|
+
/**
|
|
1574
|
+
* @component ChatLeoTrayComponent
|
|
1575
|
+
* @description This component implements a chat tray that can be opened and closed. It contains a list of chat rooms and can open a message panel for a selected room or a user selector to start a new chat.
|
|
1576
|
+
* @property {ChatStore} chatStore - An instance of the `ChatStore` class, which provides the state for the chat application.
|
|
1577
|
+
* @fires newChatClicked - This event is emitted when the user clicks the "new chat" button.
|
|
1578
|
+
* @fires messageChatSent - This event is emitted when a message is sent from the chat panel.
|
|
1579
|
+
*/
|
|
1580
|
+
"chatleo-tray-component": LocalJSX.IntrinsicElements["chatleo-tray-component"] & JSXBase.HTMLAttributes<HTMLChatleoTrayComponentElement>;
|
|
1581
|
+
/**
|
|
1582
|
+
* @component ChatleoUserTile
|
|
1583
|
+
* @description This component displays a tile for a single user, showing their avatar, name, and online status. It is typically used in a list of users.
|
|
1584
|
+
* @property {UserProfile} profile - The `UserProfile` object for the user to be displayed. This includes the user's name and avatar URL.
|
|
1585
|
+
* @property {boolean} isOnline - A boolean indicating whether the user is currently online.
|
|
1586
|
+
* @property {string} lastSeen - A string indicating when the user was last seen online. This is displayed if the user is not currently online.
|
|
1587
|
+
* @fires userClicked - This event is emitted when the user tile is clicked. The event detail contains the `UserProfile` of the clicked user.
|
|
1588
|
+
*/
|
|
1589
|
+
"chatleo-user-tile": LocalJSX.IntrinsicElements["chatleo-user-tile"] & JSXBase.HTMLAttributes<HTMLChatleoUserTileElement>;
|
|
1590
|
+
"my-component": LocalJSX.IntrinsicElements["my-component"] & JSXBase.HTMLAttributes<HTMLMyComponentElement>;
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}
|