@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.
Files changed (144) hide show
  1. package/LICENSE +21 -0
  2. package/dist/chatleo/chatleo.esm.js +1 -0
  3. package/dist/chatleo/index.esm.js +1 -0
  4. package/dist/chatleo/p-43ada232.entry.js +1 -0
  5. package/dist/chatleo/p-4485e141.entry.js +1 -0
  6. package/dist/chatleo/p-BnCPdbII.js +1 -0
  7. package/dist/chatleo/p-C-l90Wre.js +1 -0
  8. package/dist/chatleo/p-DQuL1Twl.js +1 -0
  9. package/dist/chatleo/p-DmL518NK.js +3 -0
  10. package/dist/chatleo/p-aed60255.entry.js +1 -0
  11. package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
  12. package/dist/cjs/chatleo-avatar_13.cjs.entry.js +2986 -0
  13. package/dist/cjs/chatleo-call-adapter-B2OfC0VZ.js +35 -0
  14. package/dist/cjs/chatleo-chat-input.cjs.entry.js +67 -0
  15. package/dist/cjs/chatleo.cjs.js +25 -0
  16. package/dist/cjs/index-DkSDLR0y.js +56 -0
  17. package/dist/cjs/index-Dxw4YCA_.js +1741 -0
  18. package/dist/cjs/index.cjs.js +7 -0
  19. package/dist/cjs/loader.cjs.js +13 -0
  20. package/dist/cjs/my-component.cjs.entry.js +33 -0
  21. package/dist/collection/__mocks__/stencil-core.js +26 -0
  22. package/dist/collection/collection-manifest.json +27 -0
  23. package/dist/collection/components/chatleo-avatar/chatleo-avatar.css +40 -0
  24. package/dist/collection/components/chatleo-avatar/chatleo-avatar.js +116 -0
  25. package/dist/collection/components/chatleo-chat/chatleo-chat.css +108 -0
  26. package/dist/collection/components/chatleo-chat/chatleo-chat.js +459 -0
  27. package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.css +22 -0
  28. package/dist/collection/components/chatleo-chat-header/chatleo-chat-header.js +105 -0
  29. package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.css +84 -0
  30. package/dist/collection/components/chatleo-chat-input/chatleo-chat-input.js +141 -0
  31. package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.css +149 -0
  32. package/dist/collection/components/chatleo-chat-message/chatleo-chat-message.js +259 -0
  33. package/dist/collection/components/chatleo-component/chatleo-component.css +271 -0
  34. package/dist/collection/components/chatleo-component/chatleo-component.js +1366 -0
  35. package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.css +96 -0
  36. package/dist/collection/components/chatleo-new-message-selector/chatleo-new-message-selector.js +231 -0
  37. package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.css +352 -0
  38. package/dist/collection/components/chatleo-rich-input/chatleo-rich-input.js +976 -0
  39. package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.css +169 -0
  40. package/dist/collection/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.js +400 -0
  41. package/dist/collection/components/chatleo-room-list/chatleo-room-list.css +111 -0
  42. package/dist/collection/components/chatleo-room-list/chatleo-room-list.js +180 -0
  43. package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.css +110 -0
  44. package/dist/collection/components/chatleo-room-tile-component/chatleo-room-tile-component.js +241 -0
  45. package/dist/collection/components/chatleo-room-view/chatleo-room-view.css +93 -0
  46. package/dist/collection/components/chatleo-room-view/chatleo-room-view.js +593 -0
  47. package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.css +284 -0
  48. package/dist/collection/components/chatleo-tray-component/chatleo-tray-component.js +391 -0
  49. package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.css +56 -0
  50. package/dist/collection/components/chatleo-user-tile/chatleo-user-tile.js +149 -0
  51. package/dist/collection/components/my-component/my-component.css +4 -0
  52. package/dist/collection/components/my-component/my-component.js +95 -0
  53. package/dist/collection/index.js +10 -0
  54. package/dist/collection/utils/call-entry.js +34 -0
  55. package/dist/collection/utils/delivery.js +7 -0
  56. package/dist/collection/utils/utils.js +51 -0
  57. package/dist/components/chatleo-avatar.d.ts +11 -0
  58. package/dist/components/chatleo-avatar.js +1 -0
  59. package/dist/components/chatleo-chat-header.d.ts +11 -0
  60. package/dist/components/chatleo-chat-header.js +1 -0
  61. package/dist/components/chatleo-chat-input.d.ts +11 -0
  62. package/dist/components/chatleo-chat-input.js +1 -0
  63. package/dist/components/chatleo-chat-message.d.ts +11 -0
  64. package/dist/components/chatleo-chat-message.js +1 -0
  65. package/dist/components/chatleo-chat.d.ts +11 -0
  66. package/dist/components/chatleo-chat.js +1 -0
  67. package/dist/components/chatleo-component.d.ts +11 -0
  68. package/dist/components/chatleo-component.js +1 -0
  69. package/dist/components/chatleo-new-message-selector.d.ts +11 -0
  70. package/dist/components/chatleo-new-message-selector.js +1 -0
  71. package/dist/components/chatleo-rich-input.d.ts +11 -0
  72. package/dist/components/chatleo-rich-input.js +1 -0
  73. package/dist/components/chatleo-rich-message-renderer.d.ts +11 -0
  74. package/dist/components/chatleo-rich-message-renderer.js +1 -0
  75. package/dist/components/chatleo-room-list.d.ts +11 -0
  76. package/dist/components/chatleo-room-list.js +1 -0
  77. package/dist/components/chatleo-room-tile-component.d.ts +11 -0
  78. package/dist/components/chatleo-room-tile-component.js +1 -0
  79. package/dist/components/chatleo-room-view.d.ts +11 -0
  80. package/dist/components/chatleo-room-view.js +1 -0
  81. package/dist/components/chatleo-tray-component.d.ts +11 -0
  82. package/dist/components/chatleo-tray-component.js +1 -0
  83. package/dist/components/chatleo-user-tile.d.ts +11 -0
  84. package/dist/components/chatleo-user-tile.js +1 -0
  85. package/dist/components/index.d.ts +35 -0
  86. package/dist/components/index.js +1 -0
  87. package/dist/components/my-component.d.ts +11 -0
  88. package/dist/components/my-component.js +1 -0
  89. package/dist/components/p-8kvQ-Uh-.js +1 -0
  90. package/dist/components/p-B7cdqAgv.js +1 -0
  91. package/dist/components/p-BdiOcOYZ.js +1 -0
  92. package/dist/components/p-BlbDSb7D.js +1 -0
  93. package/dist/components/p-BnCPdbII.js +1 -0
  94. package/dist/components/p-C-v19aUJ.js +1 -0
  95. package/dist/components/p-C1mF0s8g.js +1 -0
  96. package/dist/components/p-CRtBdzP3.js +1 -0
  97. package/dist/components/p-CfayCm9O.js +1 -0
  98. package/dist/components/p-DGjAxoQy.js +1 -0
  99. package/dist/components/p-Exj_2-yI.js +1 -0
  100. package/dist/components/p-XlwGxsqT.js +1 -0
  101. package/dist/components/p-fjMaTJam.js +1 -0
  102. package/dist/components/p-xt4kzz3B.js +1 -0
  103. package/dist/esm/app-globals-DQuL1Twl.js +3 -0
  104. package/dist/esm/chatleo-avatar_13.entry.js +2972 -0
  105. package/dist/esm/chatleo-call-adapter-BnCPdbII.js +33 -0
  106. package/dist/esm/chatleo-chat-input.entry.js +65 -0
  107. package/dist/esm/chatleo.js +21 -0
  108. package/dist/esm/index-C-l90Wre.js +53 -0
  109. package/dist/esm/index-DmL518NK.js +1733 -0
  110. package/dist/esm/index.js +1 -0
  111. package/dist/esm/loader.js +11 -0
  112. package/dist/esm/my-component.entry.js +31 -0
  113. package/dist/index.cjs.js +1 -0
  114. package/dist/index.js +1 -0
  115. package/dist/types/__mocks__/stencil-core.d.ts +24 -0
  116. package/dist/types/components/chatleo-avatar/chatleo-avatar.d.ts +27 -0
  117. package/dist/types/components/chatleo-chat/chatleo-chat.d.ts +75 -0
  118. package/dist/types/components/chatleo-chat-header/chatleo-chat-header.d.ts +27 -0
  119. package/dist/types/components/chatleo-chat-input/chatleo-chat-input.d.ts +31 -0
  120. package/dist/types/components/chatleo-chat-message/chatleo-chat-message.d.ts +22 -0
  121. package/dist/types/components/chatleo-component/chatleo-component.d.ts +278 -0
  122. package/dist/types/components/chatleo-new-message-selector/chatleo-new-message-selector.d.ts +68 -0
  123. package/dist/types/components/chatleo-rich-input/chatleo-rich-input.d.ts +216 -0
  124. package/dist/types/components/chatleo-rich-message-renderer/chatleo-rich-message-renderer.d.ts +77 -0
  125. package/dist/types/components/chatleo-room-list/chatleo-room-list.d.ts +52 -0
  126. package/dist/types/components/chatleo-room-tile-component/chatleo-room-tile-component.d.ts +59 -0
  127. package/dist/types/components/chatleo-room-view/chatleo-room-view.d.ts +91 -0
  128. package/dist/types/components/chatleo-tray-component/chatleo-tray-component.d.ts +112 -0
  129. package/dist/types/components/chatleo-user-tile/chatleo-user-tile.d.ts +36 -0
  130. package/dist/types/components/my-component/my-component.d.ts +16 -0
  131. package/dist/types/components.d.ts +1593 -0
  132. package/dist/types/index.d.ts +12 -0
  133. package/dist/types/stencil-public-runtime.d.ts +1879 -0
  134. package/dist/types/utils/call-entry.d.ts +9 -0
  135. package/dist/types/utils/delivery.d.ts +7 -0
  136. package/dist/types/utils/utils.d.ts +24 -0
  137. package/loader/cdn.js +1 -0
  138. package/loader/index.cjs.js +1 -0
  139. package/loader/index.d.ts +24 -0
  140. package/loader/index.es2017.js +1 -0
  141. package/loader/index.js +2 -0
  142. package/package.json +70 -3
  143. package/readme.md +111 -0
  144. package/README.md +0 -3
@@ -0,0 +1,180 @@
1
+ import { h } from "@stencil/core";
2
+ /**
3
+ * @component ChatleoRoomList
4
+ * @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.
5
+ * @property {ChatRoom[]} rooms - An array of `ChatRoom` objects to be displayed in the list.
6
+ * @property {ChatStore} chatStore - An instance of the `ChatStore` class, which is used to get user presence information.
7
+ * @property {string} selectedRoomId - The ID of the currently selected room.
8
+ */
9
+ export class ChatleoRoomList {
10
+ /**
11
+ * An array of `ChatRoom` objects to be displayed in the list.
12
+ */
13
+ rooms = [];
14
+ /**
15
+ * An instance of the `ChatStore` class, which is used to get user presence information.
16
+ */
17
+ chatStore;
18
+ /**
19
+ * The ID of the currently selected room.
20
+ */
21
+ selectedRoomId;
22
+ _version = 0;
23
+ /** Whether the new-message user selector is shown instead of the room list. */
24
+ isNewChatOpen = false;
25
+ /**
26
+ * @function onChatStoreChange
27
+ * @description A Stencil watcher that is called when the `chatStore` prop changes. It attaches a listener to the `presenceChanged` event on the new store to trigger a re-render when a user's presence status changes.
28
+ * @param {ChatStore} chatStore - The new `ChatStore` instance.
29
+ * @param {ChatStore} _oldValue - The previous `ChatStore` instance.
30
+ */
31
+ onChatStoreChange(chatStore, _oldValue) {
32
+ if (chatStore) {
33
+ chatStore.addEventListener('presenceChanged', this.onPresenceChange.bind(this));
34
+ chatStore.addEventListener('roomReadCountChanged', () => { this._version++; });
35
+ chatStore.addEventListener('callChanged', () => { this._version++; });
36
+ }
37
+ }
38
+ /**
39
+ * @function onPresenceChange
40
+ * @description This event handler is called when a user's presence status changes. It increments a version counter to force a re-render of the component, ensuring that the online status of users in the room list is updated.
41
+ */
42
+ onPresenceChange() {
43
+ console.debug('onPresenceChange');
44
+ this._version++;
45
+ }
46
+ toggleNewChat = (event) => {
47
+ event.preventDefault();
48
+ this.isNewChatOpen = !this.isNewChatOpen;
49
+ };
50
+ closeNewChat = () => {
51
+ this.isNewChatOpen = false;
52
+ };
53
+ /**
54
+ * Starting a direct message is handled by `chatleo-component`. Close the selector
55
+ * once a user has been picked, whether or not the room opens in this view.
56
+ */
57
+ onUserSelected() {
58
+ this.isNewChatOpen = false;
59
+ }
60
+ renderHeader() {
61
+ return (h("div", { class: "room-list-header" }, h("span", { class: "room-list-title" }, "Nachrichten"), h("button", { class: "new-chat-btn", type: "button", title: "Neue Nachricht", "aria-label": "Neue Nachricht", onClick: this.toggleNewChat }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, h("path", { d: "M8 3V13", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" }), h("path", { d: "M3 8H13", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round" })))));
62
+ }
63
+ /**
64
+ * @function render
65
+ * @description The render method for the `ChatleoRoomList` component. It maps over the `rooms` array and renders a `chatleo-room-tile-component` for each room, passing the necessary props. When the new-message action is active it renders the user selector instead.
66
+ * @returns {any} A VNode representing the component's UI.
67
+ */
68
+ render() {
69
+ return (h("div", { key: '089d5a42173af13d39cb150ff87af731239d481a', class: "room-list-container" }, this.renderHeader(), this.isNewChatOpen ? (h("chatleo-new-message-selector", { chatStore: this.chatStore, onDoClose: this.closeNewChat })) : (h("div", { class: "room-list" }, this.rooms?.map(room => {
70
+ const online = room.participantIdsWithoutSelf?.filter((id) => this.chatStore?.isOnline(id)) ?? [];
71
+ const isActive = this.selectedRoomId === room.id;
72
+ return (h("div", { style: { padding: '6px 4px' }, class: isActive ? 'active' : '' }, h("chatleo-room-tile-component", { room: room, chatStore: this.chatStore, onlineUserIds: online, lastMessage: undefined, timestamp: undefined, unreadCount: room.unreadCount, isActive: isActive })));
73
+ }), !this.rooms?.length && (h("div", { class: "room-list-empty" }, h("p", null, "Noch keine Unterhaltungen"), h("button", { class: "empty-new-chat-btn", type: "button", onClick: this.toggleNewChat }, "Neue Nachricht")))))));
74
+ }
75
+ static get is() { return "chatleo-room-list"; }
76
+ static get encapsulation() { return "shadow"; }
77
+ static get originalStyleUrls() {
78
+ return {
79
+ "$": ["chatleo-room-list.css"]
80
+ };
81
+ }
82
+ static get styleUrls() {
83
+ return {
84
+ "$": ["chatleo-room-list.css"]
85
+ };
86
+ }
87
+ static get properties() {
88
+ return {
89
+ "rooms": {
90
+ "type": "unknown",
91
+ "mutable": false,
92
+ "complexType": {
93
+ "original": "ChatRoom[]",
94
+ "resolved": "ChatRoom[]",
95
+ "references": {
96
+ "ChatRoom": {
97
+ "location": "import",
98
+ "path": "@chat-leo/chatleolib",
99
+ "id": "../chatleolib/dist/ChatRoom.d.ts::ChatRoom",
100
+ "referenceLocation": "ChatRoom"
101
+ }
102
+ }
103
+ },
104
+ "required": false,
105
+ "optional": false,
106
+ "docs": {
107
+ "tags": [],
108
+ "text": "An array of `ChatRoom` objects to be displayed in the list."
109
+ },
110
+ "getter": false,
111
+ "setter": false,
112
+ "defaultValue": "[]"
113
+ },
114
+ "chatStore": {
115
+ "type": "unknown",
116
+ "mutable": false,
117
+ "complexType": {
118
+ "original": "ChatStore",
119
+ "resolved": "ChatStore",
120
+ "references": {
121
+ "ChatStore": {
122
+ "location": "import",
123
+ "path": "@chat-leo/chatleolib",
124
+ "id": "../chatleolib/dist/ChatStore.d.ts::ChatStore",
125
+ "referenceLocation": "ChatStore"
126
+ }
127
+ }
128
+ },
129
+ "required": false,
130
+ "optional": true,
131
+ "docs": {
132
+ "tags": [],
133
+ "text": "An instance of the `ChatStore` class, which is used to get user presence information."
134
+ },
135
+ "getter": false,
136
+ "setter": false
137
+ },
138
+ "selectedRoomId": {
139
+ "type": "string",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "string",
143
+ "resolved": "string",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": true,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": "The ID of the currently selected room."
151
+ },
152
+ "getter": false,
153
+ "setter": false,
154
+ "reflect": false,
155
+ "attribute": "selected-room-id"
156
+ }
157
+ };
158
+ }
159
+ static get states() {
160
+ return {
161
+ "_version": {},
162
+ "isNewChatOpen": {}
163
+ };
164
+ }
165
+ static get watchers() {
166
+ return [{
167
+ "propName": "chatStore",
168
+ "methodName": "onChatStoreChange"
169
+ }];
170
+ }
171
+ static get listeners() {
172
+ return [{
173
+ "name": "userSelected",
174
+ "method": "onUserSelected",
175
+ "target": undefined,
176
+ "capture": false,
177
+ "passive": false
178
+ }];
179
+ }
180
+ }
@@ -0,0 +1,110 @@
1
+ :host {
2
+ /* Component-specific variables */
3
+ --room-name-size: 16px;
4
+ --timestamp-size: 12px;
5
+ --message-size: 14px;
6
+ --unread-size: 12px;
7
+ --room-name-weight: 600;
8
+ --unread-weight: 600;
9
+ --room-margin: 4px;
10
+ --room-spacing: 8px;
11
+ --unread-padding: 2px 8px;
12
+ --unread-radius: 10px;
13
+ --unread-min-width: 20px;
14
+ display: block;
15
+ }
16
+
17
+ .room-tile {
18
+ display: flex;
19
+ align-items: center;
20
+ cursor: pointer;
21
+ transition: background-color var(--transition-duration) ease;
22
+ }
23
+
24
+ .room-tile.active {
25
+ background-color: var(--bg-secondary, #f0f0f0);
26
+ }
27
+
28
+ .room-content {
29
+ padding-left: var(--room-spacing);
30
+ flex: 1;
31
+ min-width: 0;
32
+ }
33
+
34
+ .room-header {
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: space-between;
38
+ margin-bottom: var(--room-margin);
39
+ }
40
+
41
+ .room-name {
42
+ font-size: var(--room-name-size);
43
+ font-weight: var(--room-name-weight);
44
+ margin: 0;
45
+ color: var(--text-primary);
46
+ overflow: hidden;
47
+ text-overflow: ellipsis;
48
+ white-space: nowrap;
49
+ }
50
+
51
+ .timestamp {
52
+ font-size: var(--timestamp-size);
53
+ color: var(--text-secondary);
54
+ flex-shrink: 0;
55
+ margin-left: var(--room-spacing);
56
+ }
57
+
58
+ .room-footer {
59
+ display: flex;
60
+ align-items: center;
61
+ justify-content: space-between;
62
+ }
63
+
64
+ .last-message {
65
+ font-size: var(--message-size);
66
+ color: var(--text-secondary);
67
+ margin: 0;
68
+ overflow: hidden;
69
+ text-overflow: ellipsis;
70
+ white-space: nowrap;
71
+ flex: 1;
72
+ }
73
+
74
+ .read-only-badge {
75
+ font-size: var(--timestamp-size);
76
+ color: var(--text-secondary);
77
+ flex-shrink: 0;
78
+ margin-left: var(--room-spacing);
79
+ }
80
+
81
+ .unread-count {
82
+ background-color: var(--accent-color);
83
+ color: white;
84
+
85
+ font-size: 0.7rem;
86
+ line-height: 1;
87
+ text-align: center;
88
+
89
+ display: flex;
90
+ justify-content: center;
91
+ align-items: center;
92
+
93
+ width: 1rem;
94
+ height: 1rem;
95
+ border-radius: 50%;
96
+ overflow: hidden;
97
+
98
+ flex-shrink: 0;
99
+ }
100
+
101
+ .call-marker {
102
+ margin-left: 6px;
103
+ padding: 1px 6px;
104
+ border-radius: 999px;
105
+ background: #1b8a3a;
106
+ color: #fff;
107
+ font-size: 10px;
108
+ font-weight: 700;
109
+ text-transform: uppercase;
110
+ }
@@ -0,0 +1,241 @@
1
+ import { h } from "@stencil/core";
2
+ /**
3
+ * @component ChatLeoRoomTileComponent
4
+ * @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.
5
+ * @property {ChatRoom} room - The `ChatRoom` object containing the data for the room to be displayed.
6
+ * @property {ChatStore} chatStore - An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
7
+ * @property {string[]} onlineUserIds - An array of user IDs for the participants in the room who are currently online.
8
+ * @property {string} lastMessage - The content of the last message sent in the room.
9
+ * @property {string} timestamp - The timestamp of the last message.
10
+ * @property {number} unreadCount - The number of unread messages in the room.
11
+ * @property {boolean} isActive - Indicates whether this room is currently selected/active.
12
+ * @fires roomClicked - This event is emitted when the user clicks on the room tile. The event detail contains the ID of the clicked room.
13
+ */
14
+ export class ChatLeoRoomTileComponent {
15
+ /**
16
+ * The `ChatRoom` object containing the data for the room to be displayed.
17
+ */
18
+ room;
19
+ /**
20
+ * An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs.
21
+ */
22
+ chatStore;
23
+ /**
24
+ * An array of user IDs for the participants in the room who are currently online.
25
+ */
26
+ onlineUserIds;
27
+ /**
28
+ * The content of the last message sent in the room.
29
+ */
30
+ lastMessage;
31
+ /**
32
+ * The timestamp of the last message.
33
+ */
34
+ timestamp;
35
+ /**
36
+ * The number of unread messages in the room.
37
+ */
38
+ unreadCount;
39
+ /**
40
+ * Indicates whether this room is currently selected/active.
41
+ */
42
+ isActive = false;
43
+ roomClicked;
44
+ /**
45
+ * @function onClick
46
+ * @description This method is called when the room tile is clicked. It emits the `roomClicked` event with the room's ID.
47
+ */
48
+ onClick() {
49
+ console.log('Room clicked', this.room.id);
50
+ this.roomClicked.emit({ id: this.room.id });
51
+ }
52
+ /**
53
+ * @function render
54
+ * @description The render method for the `ChatLeoRoomTileComponent`. It constructs the UI for the room tile, including the avatar, room name, last message, timestamp, and unread count.
55
+ * @returns {any} A VNode representing the component's UI.
56
+ */
57
+ render() {
58
+ /* TODO: this only works for DM rooms right no */
59
+ const isOnline = this.onlineUserIds.includes(this.room.participantIdsWithoutSelf[0]);
60
+ const otherUserAvatarUrl = this.chatStore?.users.find(u => u.id === this.room.participantIdsWithoutSelf[0])?.profile_picture_url;
61
+ const tileClass = this.isActive ? 'room-tile active' : 'room-tile';
62
+ const call = this.chatStore?.activeCall(this.room.id);
63
+ return (h("div", { key: '2f667c91928a5dc65554d2204372b322b0e43272', class: tileClass, onClick: () => this.onClick() }, h("chatleo-avatar", { key: '2b072a48103fad1cfe23a0eec2c18645572e8071', name: this.room.name, url: otherUserAvatarUrl, isOnline: isOnline }), h("div", { key: 'bfb0d3b61dbd0bc816b8c0c578e04c622214a3ad', class: "room-content" }, h("div", { key: '2ce0fda6bcd7af24a8bb823f7ba75329449239cf', class: "room-header" }, h("h3", { key: 'fa5ed3dd1401c147f2996bc93bed06d8f096a521', class: "room-name" }, this.room.name), h("span", { key: '308d082b266a01fad292839ae69c4edd0a21d1bb', class: "timestamp" }, this.timestamp ?? "")), h("div", { key: 'f7b3206df5b8f9870ff358f693d4600fb21302d4', class: "room-footer" }, h("p", { key: 'a69f70a6b237b7e0c1f5776627f7ffd3ed16685d', class: "last-message" }, call ? 'Call in progress' : (this.lastMessage ?? " ")), call && h("span", { key: '03e324140c78c3bce371fd14725eca835596a600', class: "call-marker", title: "Call in progress" }, "Call"), this.room.isReadOnly ? (h("span", { class: "read-only-badge" }, "Read only")) : (this.unreadCount > 0 && (h("span", { class: "unread-count" }, this.unreadCount)))))));
64
+ }
65
+ static get is() { return "chatleo-room-tile-component"; }
66
+ static get encapsulation() { return "shadow"; }
67
+ static get originalStyleUrls() {
68
+ return {
69
+ "$": ["chatleo-room-tile-component.css"]
70
+ };
71
+ }
72
+ static get styleUrls() {
73
+ return {
74
+ "$": ["chatleo-room-tile-component.css"]
75
+ };
76
+ }
77
+ static get properties() {
78
+ return {
79
+ "room": {
80
+ "type": "unknown",
81
+ "mutable": false,
82
+ "complexType": {
83
+ "original": "ChatRoom",
84
+ "resolved": "ChatRoom",
85
+ "references": {
86
+ "ChatRoom": {
87
+ "location": "import",
88
+ "path": "@chat-leo/chatleolib",
89
+ "id": "../chatleolib/dist/ChatRoom.d.ts::ChatRoom",
90
+ "referenceLocation": "ChatRoom"
91
+ }
92
+ }
93
+ },
94
+ "required": false,
95
+ "optional": false,
96
+ "docs": {
97
+ "tags": [],
98
+ "text": "The `ChatRoom` object containing the data for the room to be displayed."
99
+ },
100
+ "getter": false,
101
+ "setter": false
102
+ },
103
+ "chatStore": {
104
+ "type": "unknown",
105
+ "mutable": false,
106
+ "complexType": {
107
+ "original": "ChatStore",
108
+ "resolved": "ChatStore",
109
+ "references": {
110
+ "ChatStore": {
111
+ "location": "import",
112
+ "path": "@chat-leo/chatleolib",
113
+ "id": "../chatleolib/dist/ChatStore.d.ts::ChatStore",
114
+ "referenceLocation": "ChatStore"
115
+ }
116
+ }
117
+ },
118
+ "required": false,
119
+ "optional": true,
120
+ "docs": {
121
+ "tags": [],
122
+ "text": "An instance of the `ChatStore` class, used to retrieve user information, such as avatar URLs."
123
+ },
124
+ "getter": false,
125
+ "setter": false
126
+ },
127
+ "onlineUserIds": {
128
+ "type": "unknown",
129
+ "mutable": false,
130
+ "complexType": {
131
+ "original": "string[]",
132
+ "resolved": "string[]",
133
+ "references": {}
134
+ },
135
+ "required": false,
136
+ "optional": false,
137
+ "docs": {
138
+ "tags": [],
139
+ "text": "An array of user IDs for the participants in the room who are currently online."
140
+ },
141
+ "getter": false,
142
+ "setter": false
143
+ },
144
+ "lastMessage": {
145
+ "type": "string",
146
+ "mutable": false,
147
+ "complexType": {
148
+ "original": "string",
149
+ "resolved": "string",
150
+ "references": {}
151
+ },
152
+ "required": false,
153
+ "optional": false,
154
+ "docs": {
155
+ "tags": [],
156
+ "text": "The content of the last message sent in the room."
157
+ },
158
+ "getter": false,
159
+ "setter": false,
160
+ "reflect": false,
161
+ "attribute": "last-message"
162
+ },
163
+ "timestamp": {
164
+ "type": "string",
165
+ "mutable": false,
166
+ "complexType": {
167
+ "original": "string",
168
+ "resolved": "string",
169
+ "references": {}
170
+ },
171
+ "required": false,
172
+ "optional": false,
173
+ "docs": {
174
+ "tags": [],
175
+ "text": "The timestamp of the last message."
176
+ },
177
+ "getter": false,
178
+ "setter": false,
179
+ "reflect": false,
180
+ "attribute": "timestamp"
181
+ },
182
+ "unreadCount": {
183
+ "type": "number",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "number",
187
+ "resolved": "number",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "The number of unread messages in the room."
195
+ },
196
+ "getter": false,
197
+ "setter": false,
198
+ "reflect": false,
199
+ "attribute": "unread-count"
200
+ },
201
+ "isActive": {
202
+ "type": "boolean",
203
+ "mutable": false,
204
+ "complexType": {
205
+ "original": "boolean",
206
+ "resolved": "boolean",
207
+ "references": {}
208
+ },
209
+ "required": false,
210
+ "optional": false,
211
+ "docs": {
212
+ "tags": [],
213
+ "text": "Indicates whether this room is currently selected/active."
214
+ },
215
+ "getter": false,
216
+ "setter": false,
217
+ "reflect": false,
218
+ "attribute": "is-active",
219
+ "defaultValue": "false"
220
+ }
221
+ };
222
+ }
223
+ static get events() {
224
+ return [{
225
+ "method": "roomClicked",
226
+ "name": "roomClicked",
227
+ "bubbles": true,
228
+ "cancelable": true,
229
+ "composed": true,
230
+ "docs": {
231
+ "tags": [],
232
+ "text": ""
233
+ },
234
+ "complexType": {
235
+ "original": "{id: string}",
236
+ "resolved": "{ id: string; }",
237
+ "references": {}
238
+ }
239
+ }];
240
+ }
241
+ }
@@ -0,0 +1,93 @@
1
+
2
+
3
+ :host {
4
+ display: flex;
5
+ flex-direction: column;
6
+ max-height: 100%;
7
+ min-height: 0;
8
+ overflow: hidden;
9
+ }
10
+
11
+ .chat-container-chat {
12
+ display: flex;
13
+ flex-direction: column;
14
+ height: 100%;
15
+ width: 100%;
16
+ font-family: var(--font-primary), sans-serif;
17
+ min-height: 0; /* critical to allow middle child to scroll */
18
+ overflow: hidden; /* only the messages area should scroll */
19
+ }
20
+
21
+ /* Keep header visible, non-scrolling */
22
+ chatleo-chat-header {
23
+ flex: 0 0 auto;
24
+ display: block;
25
+ }
26
+
27
+ .chat-container-header-container {
28
+ flex: 0 0 auto;
29
+ border-bottom: 1px solid var(--border-light);
30
+ }
31
+
32
+ .rich-input-container-wrapper {
33
+ flex: 0 0 auto;
34
+ padding-top: 2px;
35
+ }
36
+
37
+ .messages-container {
38
+ display: block;
39
+ flex: 1 1 auto; /* consume remaining space */
40
+ min-height: 0; /* required for flex children to allow scrolling */
41
+ overflow-y: auto; /* scroll only here */
42
+ overflow-x: hidden;
43
+ padding-right: 12px;
44
+ overscroll-behavior: contain;
45
+ scrollbar-gutter: stable;
46
+ max-width: 100%;
47
+ border-bottom: 1px solid var(--border-light); /* the border above the input */
48
+ }
49
+
50
+ .message-group {
51
+ display: flex;
52
+ flex-direction: column;
53
+ gap: 16px;
54
+ }
55
+
56
+ .date-separator {
57
+ text-align: center;
58
+ font-family: var(--font-primary), sans-serif;
59
+ font-weight: 400;
60
+ font-size: 12px;
61
+ line-height: 1.65;
62
+ color: var(--text-secondary);
63
+ }
64
+
65
+ .call-bar {
66
+ display: flex;
67
+ align-items: center;
68
+ justify-content: flex-end;
69
+ gap: 8px;
70
+ padding: 6px 16px;
71
+ border-bottom: 1px solid var(--border-light);
72
+ }
73
+
74
+ .call-banner {
75
+ margin-right: auto;
76
+ font-size: 12px;
77
+ color: var(--text-secondary);
78
+ }
79
+
80
+ .call-button {
81
+ border: 1px solid var(--accent-color, #4a86e8);
82
+ background: transparent;
83
+ color: var(--accent-color, #4a86e8);
84
+ border-radius: var(--border-radius, 6px);
85
+ padding: 4px 10px;
86
+ font: inherit;
87
+ font-size: 12px;
88
+ cursor: pointer;
89
+ }
90
+
91
+ .call-button:hover {
92
+ background: color-mix(in srgb, var(--accent-color, #4a86e8) 10%, transparent);
93
+ }