vue-parley 4.0.0

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 (202) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +276 -0
  3. package/dist/chat.css +3223 -0
  4. package/dist/chunks/Call-CTIujxDi.cjs +818 -0
  5. package/dist/chunks/Call-CTIujxDi.cjs.map +1 -0
  6. package/dist/chunks/Call-Dwuyd-Ut.mjs +818 -0
  7. package/dist/chunks/Call-Dwuyd-Ut.mjs.map +1 -0
  8. package/dist/chunks/index-D50Yn7q4.cjs +7031 -0
  9. package/dist/chunks/index-D50Yn7q4.cjs.map +1 -0
  10. package/dist/chunks/index-JU_JZkSC.mjs +7010 -0
  11. package/dist/chunks/index-JU_JZkSC.mjs.map +1 -0
  12. package/dist/chunks/session-B3KIrj3_.mjs +711 -0
  13. package/dist/chunks/session-B3KIrj3_.mjs.map +1 -0
  14. package/dist/chunks/session-BOfkV8PJ.cjs +711 -0
  15. package/dist/chunks/session-BOfkV8PJ.cjs.map +1 -0
  16. package/dist/fakes.cjs +335 -0
  17. package/dist/fakes.cjs.map +1 -0
  18. package/dist/fakes.mjs +335 -0
  19. package/dist/fakes.mjs.map +1 -0
  20. package/dist/index.cjs +24 -0
  21. package/dist/index.cjs.map +1 -0
  22. package/dist/index.mjs +24 -0
  23. package/dist/index.mjs.map +1 -0
  24. package/dist/types/app/components/ChatPage.vue.d.ts +60 -0
  25. package/dist/types/app/components/ChatPage.vue.d.ts.map +1 -0
  26. package/dist/types/app/components/call/Call.vue.d.ts +8 -0
  27. package/dist/types/app/components/call/Call.vue.d.ts.map +1 -0
  28. package/dist/types/app/components/chat/ChatBubble.vue.d.ts +64 -0
  29. package/dist/types/app/components/chat/ChatBubble.vue.d.ts.map +1 -0
  30. package/dist/types/app/components/chat/ChatInput.vue.d.ts +60 -0
  31. package/dist/types/app/components/chat/ChatInput.vue.d.ts.map +1 -0
  32. package/dist/types/app/components/chat/ChatMessages.vue.d.ts +45 -0
  33. package/dist/types/app/components/chat/ChatMessages.vue.d.ts.map +1 -0
  34. package/dist/types/app/components/chat/ChatPageBar.vue.d.ts +50 -0
  35. package/dist/types/app/components/chat/ChatPageBar.vue.d.ts.map +1 -0
  36. package/dist/types/app/components/chat/ChatProfileOverview.vue.d.ts +11 -0
  37. package/dist/types/app/components/chat/ChatProfileOverview.vue.d.ts.map +1 -0
  38. package/dist/types/app/components/chat/ChatView.vue.d.ts +244 -0
  39. package/dist/types/app/components/chat/ChatView.vue.d.ts.map +1 -0
  40. package/dist/types/app/components/chat/chat-bubbles/BubbleDivider.vue.d.ts +7 -0
  41. package/dist/types/app/components/chat/chat-bubbles/BubbleDivider.vue.d.ts.map +1 -0
  42. package/dist/types/app/components/chat/chat-bubbles/BubbleImages.vue.d.ts +13 -0
  43. package/dist/types/app/components/chat/chat-bubbles/BubbleImages.vue.d.ts.map +1 -0
  44. package/dist/types/app/components/chat/chat-bubbles/BubbleMeta.vue.d.ts +11 -0
  45. package/dist/types/app/components/chat/chat-bubbles/BubbleMeta.vue.d.ts.map +1 -0
  46. package/dist/types/app/components/chat/chat-bubbles/BubbleOptions.vue.d.ts +16 -0
  47. package/dist/types/app/components/chat/chat-bubbles/BubbleOptions.vue.d.ts.map +1 -0
  48. package/dist/types/app/components/chat/chat-bubbles/BubbleRequest.vue.d.ts +8 -0
  49. package/dist/types/app/components/chat/chat-bubbles/BubbleRequest.vue.d.ts.map +1 -0
  50. package/dist/types/app/components/chat/chat-bubbles/BubbleSelectionMark.vue.d.ts +7 -0
  51. package/dist/types/app/components/chat/chat-bubbles/BubbleSelectionMark.vue.d.ts.map +1 -0
  52. package/dist/types/app/components/chat/chat-bubbles/BubbleStatus.vue.d.ts +7 -0
  53. package/dist/types/app/components/chat/chat-bubbles/BubbleStatus.vue.d.ts.map +1 -0
  54. package/dist/types/app/components/chat/chat-bubbles/BubbleVideo.vue.d.ts +25 -0
  55. package/dist/types/app/components/chat/chat-bubbles/BubbleVideo.vue.d.ts.map +1 -0
  56. package/dist/types/app/components/chat/chat-bubbles/FileDisplay.vue.d.ts +13 -0
  57. package/dist/types/app/components/chat/chat-bubbles/FileDisplay.vue.d.ts.map +1 -0
  58. package/dist/types/app/components/chat/chat-bubbles/ImageGroupDisplay.vue.d.ts +14 -0
  59. package/dist/types/app/components/chat/chat-bubbles/ImageGroupDisplay.vue.d.ts.map +1 -0
  60. package/dist/types/app/components/chat/chat-bubbles/ReplyPreview.vue.d.ts +10 -0
  61. package/dist/types/app/components/chat/chat-bubbles/ReplyPreview.vue.d.ts.map +1 -0
  62. package/dist/types/app/components/chat/chat-bubbles/UploadProgressOverlay.vue.d.ts +10 -0
  63. package/dist/types/app/components/chat/chat-bubbles/UploadProgressOverlay.vue.d.ts.map +1 -0
  64. package/dist/types/app/components/chat/chat-bubbles/VoiceDisplay.vue.d.ts +12 -0
  65. package/dist/types/app/components/chat/chat-bubbles/VoiceDisplay.vue.d.ts.map +1 -0
  66. package/dist/types/app/components/chat/chat-input/AttachementFileDisplay.vue.d.ts +12 -0
  67. package/dist/types/app/components/chat/chat-input/AttachementFileDisplay.vue.d.ts.map +1 -0
  68. package/dist/types/app/components/chat/chat-input/InputActionBar.vue.d.ts +13 -0
  69. package/dist/types/app/components/chat/chat-input/InputActionBar.vue.d.ts.map +1 -0
  70. package/dist/types/app/components/chat/chat-input/InputAttachement.vue.d.ts +18 -0
  71. package/dist/types/app/components/chat/chat-input/InputAttachement.vue.d.ts.map +1 -0
  72. package/dist/types/app/components/chat/chat-input/PermissionPopup.vue.d.ts +8 -0
  73. package/dist/types/app/components/chat/chat-input/PermissionPopup.vue.d.ts.map +1 -0
  74. package/dist/types/app/components/chat/chat-input/RecordButton.vue.d.ts +27 -0
  75. package/dist/types/app/components/chat/chat-input/RecordButton.vue.d.ts.map +1 -0
  76. package/dist/types/app/components/chat/chat-input/RecordingStatus.vue.d.ts +12 -0
  77. package/dist/types/app/components/chat/chat-input/RecordingStatus.vue.d.ts.map +1 -0
  78. package/dist/types/app/components/chat/chat-input/VideoRecordDisplay.vue.d.ts +26 -0
  79. package/dist/types/app/components/chat/chat-input/VideoRecordDisplay.vue.d.ts.map +1 -0
  80. package/dist/types/app/components/chat/contact/ChatContactDisplay.vue.d.ts +8 -0
  81. package/dist/types/app/components/chat/contact/ChatContactDisplay.vue.d.ts.map +1 -0
  82. package/dist/types/app/components/chat/contact/ChatList.vue.d.ts +5 -0
  83. package/dist/types/app/components/chat/contact/ChatList.vue.d.ts.map +1 -0
  84. package/dist/types/app/components/chat/contact/ChatListSearch.vue.d.ts +16 -0
  85. package/dist/types/app/components/chat/contact/ChatListSearch.vue.d.ts.map +1 -0
  86. package/dist/types/app/components/chat/contact/ContactAvatar.vue.d.ts +10 -0
  87. package/dist/types/app/components/chat/contact/ContactAvatar.vue.d.ts.map +1 -0
  88. package/dist/types/app/components/chat/contact/ContactSkeleton.vue.d.ts +3 -0
  89. package/dist/types/app/components/chat/contact/ContactSkeleton.vue.d.ts.map +1 -0
  90. package/dist/types/app/components/chat/messages/FloatingDateHeader.vue.d.ts +9 -0
  91. package/dist/types/app/components/chat/messages/FloatingDateHeader.vue.d.ts.map +1 -0
  92. package/dist/types/app/components/chat/messages/MessagesSkeleton.vue.d.ts +8 -0
  93. package/dist/types/app/components/chat/messages/MessagesSkeleton.vue.d.ts.map +1 -0
  94. package/dist/types/app/components/chat/messages/ScrollToBottomButton.vue.d.ts +11 -0
  95. package/dist/types/app/components/chat/messages/ScrollToBottomButton.vue.d.ts.map +1 -0
  96. package/dist/types/app/components/chat/profile/FileDisplay.vue.d.ts +9 -0
  97. package/dist/types/app/components/chat/profile/FileDisplay.vue.d.ts.map +1 -0
  98. package/dist/types/app/components/general/ConfirmModal.vue.d.ts +21 -0
  99. package/dist/types/app/components/general/ConfirmModal.vue.d.ts.map +1 -0
  100. package/dist/types/app/components/general/FileFormatDisplay.vue.d.ts +16 -0
  101. package/dist/types/app/components/general/FileFormatDisplay.vue.d.ts.map +1 -0
  102. package/dist/types/app/components/general/IconButton.vue.d.ts +13 -0
  103. package/dist/types/app/components/general/IconButton.vue.d.ts.map +1 -0
  104. package/dist/types/app/components/general/LoadingStatus.vue.d.ts +16 -0
  105. package/dist/types/app/components/general/LoadingStatus.vue.d.ts.map +1 -0
  106. package/dist/types/app/components/general/MediaImage.vue.d.ts +30 -0
  107. package/dist/types/app/components/general/MediaImage.vue.d.ts.map +1 -0
  108. package/dist/types/app/components/general/NoDataDisplay.vue.d.ts +7 -0
  109. package/dist/types/app/components/general/NoDataDisplay.vue.d.ts.map +1 -0
  110. package/dist/types/app/components/general/ResponsiveDialog.vue.d.ts +28 -0
  111. package/dist/types/app/components/general/ResponsiveDialog.vue.d.ts.map +1 -0
  112. package/dist/types/app/components/general/SafeEmojiText.vue.d.ts +10 -0
  113. package/dist/types/app/components/general/SafeEmojiText.vue.d.ts.map +1 -0
  114. package/dist/types/app/components/global/BEmojiPicker.vue.d.ts +8 -0
  115. package/dist/types/app/components/global/BEmojiPicker.vue.d.ts.map +1 -0
  116. package/dist/types/app/components/global/BIcon.vue.d.ts +11 -0
  117. package/dist/types/app/components/global/BIcon.vue.d.ts.map +1 -0
  118. package/dist/types/app/components/global/BVirtualVerticalList.vue.d.ts +30 -0
  119. package/dist/types/app/components/global/BVirtualVerticalList.vue.d.ts.map +1 -0
  120. package/dist/types/app/composables/call/media.d.ts +204 -0
  121. package/dist/types/app/composables/call/media.d.ts.map +1 -0
  122. package/dist/types/app/composables/call/peer.d.ts +39 -0
  123. package/dist/types/app/composables/call/peer.d.ts.map +1 -0
  124. package/dist/types/app/composables/call/peers.d.ts +54 -0
  125. package/dist/types/app/composables/call/peers.d.ts.map +1 -0
  126. package/dist/types/app/composables/call/session.d.ts +284 -0
  127. package/dist/types/app/composables/call/session.d.ts.map +1 -0
  128. package/dist/types/app/composables/call/signaling.d.ts +36 -0
  129. package/dist/types/app/composables/call/signaling.d.ts.map +1 -0
  130. package/dist/types/app/composables/call/useCallUi.d.ts +27 -0
  131. package/dist/types/app/composables/call/useCallUi.d.ts.map +1 -0
  132. package/dist/types/app/composables/chat/useChatRecording.d.ts +75 -0
  133. package/dist/types/app/composables/chat/useChatRecording.d.ts.map +1 -0
  134. package/dist/types/app/composables/chat/useInputDraft.d.ts +14 -0
  135. package/dist/types/app/composables/chat/useInputDraft.d.ts.map +1 -0
  136. package/dist/types/app/composables/useAppPermissions.d.ts +25 -0
  137. package/dist/types/app/composables/useAppPermissions.d.ts.map +1 -0
  138. package/dist/types/app/composables/useAppToast.d.ts +13 -0
  139. package/dist/types/app/composables/useAppToast.d.ts.map +1 -0
  140. package/dist/types/app/composables/useAttachmentPicker.d.ts +18 -0
  141. package/dist/types/app/composables/useAttachmentPicker.d.ts.map +1 -0
  142. package/dist/types/app/composables/useCall.d.ts +91 -0
  143. package/dist/types/app/composables/useCall.d.ts.map +1 -0
  144. package/dist/types/app/composables/useChatMessageList.d.ts +18 -0
  145. package/dist/types/app/composables/useChatMessageList.d.ts.map +1 -0
  146. package/dist/types/app/composables/useDate.d.ts +7 -0
  147. package/dist/types/app/composables/useDate.d.ts.map +1 -0
  148. package/dist/types/app/composables/useDevice.d.ts +32 -0
  149. package/dist/types/app/composables/useDevice.d.ts.map +1 -0
  150. package/dist/types/app/composables/useFlippedVirtualScroll.d.ts +22 -0
  151. package/dist/types/app/composables/useFlippedVirtualScroll.d.ts.map +1 -0
  152. package/dist/types/app/composables/useHostI18n.d.ts +15 -0
  153. package/dist/types/app/composables/useHostI18n.d.ts.map +1 -0
  154. package/dist/types/app/composables/useLocalI18n.d.ts +5 -0
  155. package/dist/types/app/composables/useLocalI18n.d.ts.map +1 -0
  156. package/dist/types/app/composables/useLongPress.d.ts +6 -0
  157. package/dist/types/app/composables/useLongPress.d.ts.map +1 -0
  158. package/dist/types/app/composables/useRichTextEditor.d.ts +12 -0
  159. package/dist/types/app/composables/useRichTextEditor.d.ts.map +1 -0
  160. package/dist/types/app/directives/loading.d.ts +6 -0
  161. package/dist/types/app/directives/loading.d.ts.map +1 -0
  162. package/dist/types/app/index.d.ts +31 -0
  163. package/dist/types/app/index.d.ts.map +1 -0
  164. package/dist/types/app/plugin.d.ts +28 -0
  165. package/dist/types/app/plugin.d.ts.map +1 -0
  166. package/dist/types/app/provider/callProvider.d.ts +7 -0
  167. package/dist/types/app/provider/callProvider.d.ts.map +1 -0
  168. package/dist/types/app/stores/callStore.d.ts +1626 -0
  169. package/dist/types/app/stores/callStore.d.ts.map +1 -0
  170. package/dist/types/app/stores/chatStore.d.ts +126 -0
  171. package/dist/types/app/stores/chatStore.d.ts.map +1 -0
  172. package/dist/types/app/stores/mediaStore.d.ts +18 -0
  173. package/dist/types/app/stores/mediaStore.d.ts.map +1 -0
  174. package/dist/types/app/stores/messageStores.d.ts +2460 -0
  175. package/dist/types/app/stores/messageStores.d.ts.map +1 -0
  176. package/dist/types/app/stores/profileStore.d.ts +102 -0
  177. package/dist/types/app/stores/profileStore.d.ts.map +1 -0
  178. package/dist/types/app/types/components/chat-input.d.ts +4 -0
  179. package/dist/types/app/types/components/chat-input.d.ts.map +1 -0
  180. package/dist/types/app/types/components/menu-options.d.ts +7 -0
  181. package/dist/types/app/types/components/menu-options.d.ts.map +1 -0
  182. package/dist/types/app/types/components/modal.d.ts +17 -0
  183. package/dist/types/app/types/components/modal.d.ts.map +1 -0
  184. package/dist/types/app/types/index.d.ts +257 -0
  185. package/dist/types/app/types/index.d.ts.map +1 -0
  186. package/dist/types/app/utils/emojiParser.d.ts +5 -0
  187. package/dist/types/app/utils/emojiParser.d.ts.map +1 -0
  188. package/dist/types/app/utils/format.d.ts +4 -0
  189. package/dist/types/app/utils/format.d.ts.map +1 -0
  190. package/dist/types/fakes/backend.d.ts +25 -0
  191. package/dist/types/fakes/backend.d.ts.map +1 -0
  192. package/dist/types/fakes/call.d.ts +7 -0
  193. package/dist/types/fakes/call.d.ts.map +1 -0
  194. package/dist/types/fakes/data.d.ts +13 -0
  195. package/dist/types/fakes/data.d.ts.map +1 -0
  196. package/dist/types/fakes/index.d.ts +7 -0
  197. package/dist/types/fakes/index.d.ts.map +1 -0
  198. package/dist/types/fakes.d.ts +2 -0
  199. package/dist/types/i18n/locales/index.d.ts +3557 -0
  200. package/dist/types/i18n/locales/index.d.ts.map +1 -0
  201. package/dist/types/index.d.ts +2 -0
  202. package/package.json +98 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 yonus-a
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,276 @@
1
+ # vue-parley
2
+
3
+ A drop-in Vue 3 chat and video-call UI. You supply the backend through a few handler objects; the package brings the screens, the state (Pinia stores), the translations and the styles.
4
+
5
+ Formerly `@yonus_amire01/chat`. To switch, replace that name with `vue-parley` in `package.json` and in imports; nothing else changed.
6
+
7
+ - Contact list with search, filters and infinite scroll
8
+ - Virtualised message list with text, image, file, voice and video messages, replies, edits, deletes, drafts and retries on failed sends
9
+ - Voice and video calls with screen sharing over plain browser WebRTC
10
+ - English and Persian translations built in, with RTL layout for `fa` and `ar`
11
+ - Built from PrimeVue components, laid out with Tailwind; it takes its look from the host's PrimeVue theme
12
+ - Precompiled, scoped CSS: no Tailwind needed in the host, and no leaks into the host's styles
13
+
14
+ ## Contents
15
+
16
+ - [Installation](#installation)
17
+ - [Usage](#usage)
18
+ - [Plain Vue + Vite](#plain-vue--vite)
19
+ - [Nuxt 3 / 4](#nuxt-3--4)
20
+ - [Customising the page](#customising-the-page)
21
+ - [Calls outside the chat page](#calls-outside-the-chat-page)
22
+ - [Fake backend](#fake-backend)
23
+ - [What `createChat()` does](#what-createchat-does)
24
+ - [Exports](#exports)
25
+ - [Translations](#translations)
26
+ - [Styles](#styles)
27
+ - [Upgrading from 3.x](#upgrading-from-3x)
28
+ - [Upgrading from 2.x](#upgrading-from-2x)
29
+ - [Development](#development)
30
+ - [License](#license)
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ pnpm add vue-parley
36
+ # peer dependencies, if the app doesn't have them yet
37
+ pnpm add vue vue-i18n pinia @vueuse/core primevue@^4.5 @primeuix/themes@^1
38
+ ```
39
+
40
+ npm and yarn work the same way. Peer ranges: `vue` ^3.5, `pinia` 2.2+, 3 or 4, `vue-i18n` 9 to 11, `@vueuse/core` 11 to 14, `primevue` 4.5+ (4.x). PrimeVue 5 is not supported: it moved from MIT to a commercial licence that needs a key and does not allow redistribution inside a component library.
41
+
42
+ ## Usage
43
+
44
+ ### Plain Vue + Vite
45
+
46
+ Install the plugin once in `main.ts`. Pinia, vue-i18n (with `legacy: false`) and PrimeVue (styled mode, with any preset) must be installed before it.
47
+
48
+ ```ts
49
+ // main.ts
50
+ import { createApp } from 'vue';
51
+ import { createPinia } from 'pinia';
52
+ import { createI18n } from 'vue-i18n';
53
+ import PrimeVue from 'primevue/config';
54
+ import Aura from '@primeuix/themes/aura';
55
+ import { createChat } from 'vue-parley';
56
+ import 'vue-parley/style.css';
57
+ import App from './App.vue';
58
+
59
+ createApp(App)
60
+ .use(createPinia())
61
+ .use(createI18n({ legacy: false, locale: 'fa', fallbackLocale: 'en' }))
62
+ .use(PrimeVue, { theme: { preset: Aura, options: { darkModeSelector: '.dark' } } })
63
+ .use(
64
+ createChat({
65
+ chat: chatHandlers, // ChatHandlers: fetch/delete/end conversations
66
+ messages: messagesHandlers, // MessagesHandlers: fetch/send/edit/delete messages
67
+ media: mediaHandlers, // MediaHandlers: download files, file sizes
68
+ profile: profileHandlers, // optional: profile panel's media and files tabs
69
+ call: callHandlers, // optional: enables voice/video calls
70
+ user: { id: me.id, name: me.fullName },
71
+ }),
72
+ )
73
+ .mount('#app');
74
+ ```
75
+
76
+ Then render `<ChatPage />` anywhere:
77
+
78
+ ```vue
79
+ <script setup lang="ts">
80
+ import { ChatPage } from 'vue-parley';
81
+ </script>
82
+
83
+ <template>
84
+ <ChatPage />
85
+ </template>
86
+ ```
87
+
88
+ All handler interfaces (`ChatHandlers`, `MessagesHandlers`, `MediaHandlers`, `ProfileHandlers`, `CallHandlers`) are exported as types. For demos, playgrounds and tests there is an in-memory implementation of each; see [Fake backend](#fake-backend).
89
+
90
+ ### Nuxt 3 / 4
91
+
92
+ Create `app/plugins/chat.client.ts` (Pinia, i18n and PrimeVue come from `@pinia/nuxt`, `@nuxtjs/i18n` and `@primevue/nuxt-module`):
93
+
94
+ ```ts
95
+ import { createChat } from 'vue-parley';
96
+ import 'vue-parley/style.css';
97
+
98
+ export default defineNuxtPlugin((nuxtApp) => {
99
+ nuxtApp.vueApp.use(createChat({ chat, messages, media, call, user }));
100
+ });
101
+ ```
102
+
103
+ Render the chat inside `<ClientOnly>`: its handlers are only installed in the browser, and it needs browser APIs (IndexedDB, WebRTC, the camera and mic). Importing the package on the server is safe, and so is creating its stores from a plugin or middleware.
104
+
105
+ ### Customising the page
106
+
107
+ `<ChatPage />` has four slots:
108
+
109
+ | Slot | Where | Slot props |
110
+ | ------------------ | -------------------------------------------------- | ------------------------------- |
111
+ | `empty` | Replaces the "no conversation selected" placeholder | none |
112
+ | `header-actions` | Conversation header, beside the call button | `{ contact }` |
113
+ | `conversation-top` | Between the header and the messages | `{ conversationId, contact }` |
114
+ | `above-input` | Above the input, while the conversation is active | `{ conversationId, contact }` |
115
+
116
+ To build a different layout, use the exported building blocks instead: `ChatList`, `ChatConversation`, `ChatHeader`, `ChatMessages`, `ChatInput` and `ChatBubble`. They read the same stores, so they work together once `createChat()` is installed.
117
+
118
+ ### Calls outside the chat page
119
+
120
+ A call belongs to the call store, not to a component, so it keeps running when the chat page unmounts. To keep it **on screen** while the user navigates, render the call view once near the app root and turn off the chat page's own:
121
+
122
+ ```vue
123
+ <!-- App.vue -->
124
+ <RouterView />
125
+ <Call v-if="callStore.session" />
126
+
127
+ <!-- the chat route -->
128
+ <ChatPage :render-call="false" />
129
+ ```
130
+
131
+ `Call` is an async component, so apps that never call don't download it.
132
+
133
+ Calls use the browser's WebRTC API directly (no `simple-peer`, no Node polyfills). The signalling messages keep simple-peer's format, so tabs still on an older, simple-peer based release can call this one and back; `e2e/tests/interop.spec.ts` checks that.
134
+
135
+ Call handlers also accept `iceTransportPolicy` (default `"relay"`; `"all"` allows direct connections without TURN) and `debug` (logs signalling to the console).
136
+
137
+ ### Fake backend
138
+
139
+ `vue-parley/fakes` is an in-memory implementation of every handler, for demos, playgrounds and tests. It is a separate entry, so apps that don't import it don't ship it.
140
+
141
+ ```ts
142
+ import { createFakeBackend, createBroadcastCallHandlers, demoData } from 'vue-parley/fakes';
143
+
144
+ const backend = createFakeBackend(demoData('me'), { latency: 300 });
145
+
146
+ app.use(
147
+ createChat({
148
+ chat: backend.chat,
149
+ messages: backend.messages,
150
+ media: backend.media,
151
+ profile: backend.profile,
152
+ call: createBroadcastCallHandlers(),
153
+ user: { id: 'me', name: 'Me' },
154
+ }),
155
+ );
156
+ ```
157
+
158
+ - `demoData(userId, count?)` seeds conversations and messages (Persian text); `e2eData(userId)` is the smaller set the e2e tests use.
159
+ - `backend.state` makes the next send, edit or delete fail, to try the retry and error paths.
160
+ - `createBroadcastCallHandlers()` signals over a `BroadcastChannel`, so two tabs of the same browser can call each other with no server. Give the tabs different user ids.
161
+
162
+ Nothing is persisted, and calls never leave the browser: don't use it in production.
163
+
164
+ ## What `createChat()` does
165
+
166
+ - Checks that Pinia, vue-i18n and PrimeVue are installed, and installs PrimeVue's `ToastService` if the host hasn't. The chat's own toasts use the group `vue-parley`, rendered by `ChatConversation`, so they never show up in the host's `<Toast />`.
167
+ - Gives each store its handlers when that store is first created (via a Pinia plugin), whether a component, a Nuxt plugin or a route guard creates it.
168
+ - Sets the signed-in user on the profile store.
169
+ - Hands the call handlers to the call store. `provideCallHandlers()` in a component does the same, for handlers that only exist further down the tree.
170
+
171
+ Every component and directive the chat uses is imported by the component itself, so nothing else needs to be registered.
172
+
173
+ ## Exports
174
+
175
+ | Export | What it is |
176
+ | ------ | ---------- |
177
+ | `createChat(options)` | The Vue plugin. See [Usage](#usage). |
178
+ | `provideCallHandlers(handlers)` | Supplies call handlers from inside a component. |
179
+ | `ChatPage` | The whole chat: contact list, conversation and call view. |
180
+ | `Call` | The call view (async). |
181
+ | `ChatList`, `ChatConversation`, `ChatHeader`, `ChatMessages`, `ChatInput`, `ChatBubble` | Building blocks for custom layouts. |
182
+ | `BIcon`, `BEmojiPicker`, `BVirtualVerticalList` | A Phosphor icon by name, the emoji picker and the virtualised list the chat uses. Every other control is a PrimeVue component. |
183
+ | `useChatStore`, `useMessagesStore`, `useMediaStore`, `useProfileStore`, `useCallStore` | The Pinia stores. |
184
+ | Types | Handler interfaces, `Contact`, `Message`, `SignalData`, `ChatOptions`, `ChatUser` and the rest of `app/types`. |
185
+ | `vue-parley/fakes` | `createFakeBackend`, `createBroadcastCallHandlers`, `demoData`, `e2eData`: see [Fake backend](#fake-backend). |
186
+
187
+ Working with conversations the list page hasn't fetched (say, one opened from a link): add them with `chatStore.addContact(contact)` and change them with `chatStore.updateContact(id, changes)`. `chatStore.conversationStates` is a read-only view.
188
+
189
+ ## Translations
190
+
191
+ English (`en`) and Persian (`fa`) ship with the package and load automatically; the host only has to install vue-i18n and set `locale`. The layout switches to right-to-left when the locale starts with `fa` or `ar`.
192
+
193
+ ## Styles
194
+
195
+ Import the stylesheet once:
196
+
197
+ ```ts
198
+ import 'vue-parley/style.css';
199
+ ```
200
+
201
+ It holds the compiled Tailwind v4 theme and only the utilities the package uses, with every rule scoped to the `.vue-chat` root. The host needs no Tailwind of its own, and the chat's styles (including its reset) can't override the host's. Images and animations are bundled into the JavaScript, so there are no asset files to serve.
202
+
203
+ Controls (buttons, inputs, dialogs, menus, tabs, toasts, the image viewer) are PrimeVue components, so they follow the host's PrimeVue preset. The chat's own surfaces use CSS variables such as `--color-chat-primary`, `--color-chat-background` and `--color-chat-on-background` (see `app/assets/css/theme.css`); the accent, `--color-chat-primary`, is taken from the preset's primary colour. Message bubbles use `--color-chat-bubble` for the other side and `--color-chat-bubble-mine` for your own, which defaults to a tint of the accent. Adding the `dark` class to an ancestor switches the chat to its dark palette; set PrimeVue's `darkModeSelector` to `.dark` so both switch together.
204
+
205
+ The chat themes PrimeVue components through their props and design tokens; the few size and visibility tweaks it makes on them use important utilities, so it works whether or not the host puts PrimeVue in a CSS layer.
206
+
207
+ ## Upgrading from 3.x
208
+
209
+ The UI is now built from PrimeVue (4.x) and Tailwind, so:
210
+
211
+ - **PrimeVue is a peer dependency.** Install `primevue` 4.5+ and a theme, and `app.use(PrimeVue, { theme })` before `createChat()`; it throws otherwise. Hosts that already use PrimeVue need nothing more.
212
+ - **Removed exports.** `BButton`, `BInput`, `BSelect`, `BModal`, `BPopup`, `BMenu`, `BTab`, `BToast`, `BImage`, `BLabel`, `BCheckBox` and `BCarousel` are gone; use PrimeVue's `Button`, `InputText`, `Select`, `Dialog`, `Menu`/`Popover`, `Tabs`, `Toast`, `Image`, `Tag`, `Checkbox` and `Galleria`.
213
+ - **Look.** Controls take their colours, radii and focus rings from the host's PrimeVue preset, and the chat's accent colour follows the preset's primary colour.
214
+ - **Dependencies.** `vue3-lottie` is no longer used; loading spinners are PrimeVue's `ProgressSpinner`.
215
+
216
+ ## Upgrading from 2.x
217
+
218
+ 3.0 needs no new setup, but a few things behave differently:
219
+
220
+ - **Contacts.** `chatStore.conversationStates` is now a read-only view. Add a conversation no list page has fetched with `chatStore.addContact(contact)` and change one with `chatStore.updateContact(id, changes)`; writing to `conversationStates[...].data` warns in development and has no effect.
221
+ - **Calls.** The running call lives in `callStore.session`, not in the call view. `callStore.endCall()` now also tells the other side (publishes `hangup`) and releases camera and mic. The exported `Call` is an async component; render it while `callStore.session` is set.
222
+ - **WebRTC.** `simple-peer` is gone; calls use the browser API directly. Signalling messages keep the old format, so 2.x tabs and 3.0 tabs can call each other during a rollout. Hosts can drop `simple-peer` and `@types/simple-peer`; `SignalData` is exported by this package.
223
+ - **Styles.** `style.css` is compiled: hosts need no Tailwind of their own, and a Tailwind `@source` pointing at this package can go. Tailwind's reset applies only inside `.vue-chat`.
224
+ - **Registration.** Components import their own directives (`v-file-pick`, `v-image-pick`, `v-loading`) and components (`LottieAnimation`, `UploadProgressOverlay`). Host shims for them are no longer needed.
225
+ - **Package layout.** Dependencies are no longer bundled (they install with the package), and `dist/` has lazy `chunks/`.
226
+ - **Removed defaults.** `chatStore.currentUserBirthDate` defaults to `null`; it and `chosenRole` are deprecated.
227
+ - **Media cache.** The IndexedDB cache format changed and is cleared once; it is now capped at 200 MB.
228
+
229
+ The recommended setup is now `app.use(createChat({ ... }))` (see [Usage](#usage)); the per-store `setHandlers()` calls and `provideCallHandlers()` keep working.
230
+
231
+ ## Development
232
+
233
+ ```bash
234
+ pnpm install
235
+ pnpm build # dist/: ESM + CJS bundles, chat.css, lazy chunks/ and types/
236
+ pnpm dev # build in watch mode
237
+ pnpm typecheck # vue-tsc
238
+ pnpm demo # build, then serve the demo
239
+ pnpm demo:build # build the package and the demo
240
+ pnpm test:e2e # Playwright suite (test:e2e:ui for the UI runner)
241
+ ```
242
+
243
+ `prepublishOnly` runs `typecheck` and `build`, so a publish always ships a fresh `dist/`.
244
+
245
+ The demo (`demo/`, a workspace package that consumes the built `dist/`) runs on the fakes with a seeded Persian dataset. Open it in two tabs with different `?user=` values and start a call in both to try video calling.
246
+
247
+ `pnpm test:e2e` runs the Playwright suite in `e2e/`: every chat feature against the in-memory fakes, plus real two-tab video calls using Chromium's fake camera and mic. Tests also fail if a template uses a component or directive nobody registered.
248
+
249
+ On NixOS, use the Nix-built browsers (the nixpkgs `playwright-driver` version must match `@playwright/test`):
250
+
251
+ ```sh
252
+ export PLAYWRIGHT_BROWSERS_PATH=$(nix build --no-link --print-out-paths nixpkgs#playwright-driver.browsers)
253
+ ```
254
+
255
+ ### Layout
256
+
257
+ ```
258
+ app/
259
+ index.ts package entry: everything listed under Exports
260
+ plugin.ts createChat()
261
+ components/ ChatPage, chat/, call/, general/ (small PrimeVue compositions), global/ (BIcon and friends)
262
+ composables/ including call/: signalling, peers, media
263
+ stores/ Pinia stores
264
+ types/ handler interfaces and data types
265
+ assets/css/ theme tokens and base styles
266
+ i18n/locales/ en and fa translations
267
+ fakes/ in-memory backend and call handlers (published as `vue-parley/fakes`)
268
+ demo/ demo app (workspace package)
269
+ e2e/ Playwright tests and harness
270
+ ```
271
+
272
+ ## License
273
+
274
+ [MIT](LICENSE)
275
+
276
+ Repository: [github.com/yonus-a/vue-chat](https://github.com/yonus-a/vue-chat)