vue-parley 4.0.0 → 4.1.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 (59) hide show
  1. package/README.md +22 -1
  2. package/dist/chat.css +617 -14
  3. package/dist/chunks/{Call-Dwuyd-Ut.mjs → Call-9LZHOptu.mjs} +2 -2
  4. package/dist/chunks/{Call-Dwuyd-Ut.mjs.map → Call-9LZHOptu.mjs.map} +1 -1
  5. package/dist/chunks/{Call-CTIujxDi.cjs → Call-Cke0WQnu.cjs} +2 -2
  6. package/dist/chunks/{Call-CTIujxDi.cjs.map → Call-Cke0WQnu.cjs.map} +1 -1
  7. package/dist/chunks/{index-D50Yn7q4.cjs → index-B85RXr7I.cjs} +1185 -532
  8. package/dist/chunks/index-B85RXr7I.cjs.map +1 -0
  9. package/dist/chunks/{index-JU_JZkSC.mjs → index-C665OZSn.mjs} +1192 -539
  10. package/dist/chunks/index-C665OZSn.mjs.map +1 -0
  11. package/dist/chunks/{session-BOfkV8PJ.cjs → session-D025EMzU.cjs} +2 -2
  12. package/dist/chunks/{session-BOfkV8PJ.cjs.map → session-D025EMzU.cjs.map} +1 -1
  13. package/dist/chunks/{session-B3KIrj3_.mjs → session-DesCGje_.mjs} +2 -2
  14. package/dist/chunks/{session-B3KIrj3_.mjs.map → session-DesCGje_.mjs.map} +1 -1
  15. package/dist/fakes.cjs +26 -1
  16. package/dist/fakes.cjs.map +1 -1
  17. package/dist/fakes.mjs +26 -1
  18. package/dist/fakes.mjs.map +1 -1
  19. package/dist/index.cjs +2 -1
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.mjs +7 -6
  22. package/dist/types/app/components/chat/ChatBubble.vue.d.ts +40 -10
  23. package/dist/types/app/components/chat/ChatBubble.vue.d.ts.map +1 -1
  24. package/dist/types/app/components/chat/ChatInput.vue.d.ts +2 -2
  25. package/dist/types/app/components/chat/ChatInput.vue.d.ts.map +1 -1
  26. package/dist/types/app/components/chat/ChatView.vue.d.ts +6 -6
  27. package/dist/types/app/components/chat/chat-bubbles/{BubbleImages.vue.d.ts → BubbleMedia.vue.d.ts} +3 -3
  28. package/dist/types/app/components/chat/chat-bubbles/BubbleMedia.vue.d.ts.map +1 -0
  29. package/dist/types/app/components/chat/chat-bubbles/BubbleOptions.vue.d.ts +1 -0
  30. package/dist/types/app/components/chat/chat-bubbles/BubbleOptions.vue.d.ts.map +1 -1
  31. package/dist/types/app/components/chat/chat-bubbles/MediaViewer.vue.d.ts +43 -0
  32. package/dist/types/app/components/chat/chat-bubbles/MediaViewer.vue.d.ts.map +1 -0
  33. package/dist/types/app/components/chat/chat-bubbles/ReplyPreview.vue.d.ts.map +1 -1
  34. package/dist/types/app/components/chat/chat-bubbles/viewer/ViewerImage.vue.d.ts +17 -0
  35. package/dist/types/app/components/chat/chat-bubbles/viewer/ViewerImage.vue.d.ts.map +1 -0
  36. package/dist/types/app/components/chat/chat-bubbles/viewer/ViewerVideo.vue.d.ts +13 -0
  37. package/dist/types/app/components/chat/chat-bubbles/viewer/ViewerVideo.vue.d.ts.map +1 -0
  38. package/dist/types/app/components/chat/chat-input/InputAttachement.vue.d.ts.map +1 -1
  39. package/dist/types/app/components/general/MediaThumb.vue.d.ts +15 -0
  40. package/dist/types/app/components/general/MediaThumb.vue.d.ts.map +1 -0
  41. package/dist/types/app/composables/useAttachmentPicker.d.ts +9 -5
  42. package/dist/types/app/composables/useAttachmentPicker.d.ts.map +1 -1
  43. package/dist/types/app/index.d.ts +1 -0
  44. package/dist/types/app/index.d.ts.map +1 -1
  45. package/dist/types/app/stores/messageStores.d.ts +420 -0
  46. package/dist/types/app/stores/messageStores.d.ts.map +1 -1
  47. package/dist/types/app/types/index.d.ts +11 -0
  48. package/dist/types/app/types/index.d.ts.map +1 -1
  49. package/dist/types/app/utils/media.d.ts +8 -0
  50. package/dist/types/app/utils/media.d.ts.map +1 -0
  51. package/dist/types/fakes/data.d.ts.map +1 -1
  52. package/dist/types/i18n/locales/index.d.ts +76 -0
  53. package/dist/types/i18n/locales/index.d.ts.map +1 -1
  54. package/package.json +1 -1
  55. package/dist/chunks/index-D50Yn7q4.cjs.map +0 -1
  56. package/dist/chunks/index-JU_JZkSC.mjs.map +0 -1
  57. package/dist/types/app/components/chat/chat-bubbles/BubbleImages.vue.d.ts.map +0 -1
  58. package/dist/types/app/components/chat/chat-bubbles/ImageGroupDisplay.vue.d.ts +0 -14
  59. package/dist/types/app/components/chat/chat-bubbles/ImageGroupDisplay.vue.d.ts.map +0 -1
package/README.md CHANGED
@@ -18,6 +18,7 @@ Formerly `@yonus_amire01/chat`. To switch, replace that name with `vue-parley` i
18
18
  - [Plain Vue + Vite](#plain-vue--vite)
19
19
  - [Nuxt 3 / 4](#nuxt-3--4)
20
20
  - [Customising the page](#customising-the-page)
21
+ - [Photos and videos](#photos-and-videos)
21
22
  - [Calls outside the chat page](#calls-outside-the-chat-page)
22
23
  - [Fake backend](#fake-backend)
23
24
  - [What `createChat()` does](#what-createchat-does)
@@ -115,6 +116,25 @@ Render the chat inside `<ClientOnly>`: its handlers are only installed in the br
115
116
 
116
117
  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
 
119
+ ### Photos and videos
120
+
121
+ "Photo or video" in the attachment menu sends one message of type `image` holding the whole album, up to 10 items, in the order they were picked:
122
+
123
+ ```ts
124
+ {
125
+ type: "image",
126
+ media: [
127
+ { url: "blob:…", kind: "image" },
128
+ { url: "blob:…", kind: "video" },
129
+ ],
130
+ imageUrl: ["blob:…"], // the photos only
131
+ }
132
+ ```
133
+
134
+ `sendMessage` should upload every `media` item and return, and later fetch, the message with `media` pointing at the stored files. Hosts that only handle photos can keep reading and returning `imageUrl`: the bubble and viewer fall back to it, but videos in the album are then lost. `messageMedia(message)` gives a message's album either way. Tapping an item opens the full-screen viewer, where photos zoom and pan and videos play with their own controls.
135
+
136
+ A round video note recorded in the chat is different: it is `type: "video"` with `videoUrl`, and plays in its bubble.
137
+
118
138
  ### Calls outside the chat page
119
139
 
120
140
  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:
@@ -181,7 +201,8 @@ Every component and directive the chat uses is imported by the component itself,
181
201
  | `ChatList`, `ChatConversation`, `ChatHeader`, `ChatMessages`, `ChatInput`, `ChatBubble` | Building blocks for custom layouts. |
182
202
  | `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
203
  | `useChatStore`, `useMessagesStore`, `useMediaStore`, `useProfileStore`, `useCallStore` | The Pinia stores. |
184
- | Types | Handler interfaces, `Contact`, `Message`, `SignalData`, `ChatOptions`, `ChatUser` and the rest of `app/types`. |
204
+ | `messageMedia(message)` | A message's photo and video album: its `media`, or its `imageUrl` as photos. |
205
+ | Types | Handler interfaces, `Contact`, `Message`, `MediaItem`, `SignalData`, `ChatOptions`, `ChatUser` and the rest of `app/types`. |
185
206
  | `vue-parley/fakes` | `createFakeBackend`, `createBroadcastCallHandlers`, `demoData`, `e2eData`: see [Fake backend](#fake-backend). |
186
207
 
187
208
  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.