vue-parley 4.6.0 → 4.7.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 (65) hide show
  1. package/README.md +5 -15
  2. package/dist/chat.css +55 -25
  3. package/dist/chunks/{Call-DR7geRXf.cjs → Call-3S9Gy7oj.cjs} +2 -2
  4. package/dist/chunks/{Call-DR7geRXf.cjs.map → Call-3S9Gy7oj.cjs.map} +1 -1
  5. package/dist/chunks/{Call-Dw6Sj4xm.mjs → Call-CnnA8BfZ.mjs} +2 -2
  6. package/dist/chunks/{Call-Dw6Sj4xm.mjs.map → Call-CnnA8BfZ.mjs.map} +1 -1
  7. package/dist/chunks/{index-Dg8cFrSc.cjs → index-BDGJSPbp.cjs} +466 -349
  8. package/dist/chunks/index-BDGJSPbp.cjs.map +1 -0
  9. package/dist/chunks/{index-BZyi4oPy.mjs → index-BSRFIpFg.mjs} +470 -353
  10. package/dist/chunks/index-BSRFIpFg.mjs.map +1 -0
  11. package/dist/chunks/{session-YNmwwo3T.mjs → session-Cw1fw6LP.mjs} +2 -14
  12. package/dist/chunks/session-Cw1fw6LP.mjs.map +1 -0
  13. package/dist/chunks/{session-CIPsDkm7.cjs → session-Dmg0EaKA.cjs} +2 -14
  14. package/dist/chunks/session-Dmg0EaKA.cjs.map +1 -0
  15. package/dist/index.cjs +1 -2
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.mjs +4 -5
  18. package/dist/types/app/components/chat/ChatBubble.vue.d.ts.map +1 -1
  19. package/dist/types/app/components/chat/ChatPageBar.vue.d.ts.map +1 -1
  20. package/dist/types/app/components/chat/chat-bubbles/BubbleMedia.vue.d.ts +2 -0
  21. package/dist/types/app/components/chat/chat-bubbles/BubbleMedia.vue.d.ts.map +1 -1
  22. package/dist/types/app/components/chat/chat-bubbles/UploadProgressOverlay.vue.d.ts +2 -0
  23. package/dist/types/app/components/chat/chat-bubbles/UploadProgressOverlay.vue.d.ts.map +1 -1
  24. package/dist/types/app/components/chat/chat-input/InputAttachement.vue.d.ts +6 -5
  25. package/dist/types/app/components/chat/chat-input/InputAttachement.vue.d.ts.map +1 -1
  26. package/dist/types/app/components/general/LoadingStatus.vue.d.ts +2 -0
  27. package/dist/types/app/components/general/LoadingStatus.vue.d.ts.map +1 -1
  28. package/dist/types/app/components/general/MediaImage.vue.d.ts +1 -1
  29. package/dist/types/app/components/general/MediaImage.vue.d.ts.map +1 -1
  30. package/dist/types/app/components/global/BIcon.vue.d.ts.map +1 -1
  31. package/dist/types/app/composables/call/media.d.ts +41 -11
  32. package/dist/types/app/composables/call/media.d.ts.map +1 -1
  33. package/dist/types/app/composables/call/session.d.ts +49 -16
  34. package/dist/types/app/composables/call/session.d.ts.map +1 -1
  35. package/dist/types/app/composables/call/signaling.d.ts +0 -2
  36. package/dist/types/app/composables/call/signaling.d.ts.map +1 -1
  37. package/dist/types/app/composables/chat/useChatRecording.d.ts +16 -4
  38. package/dist/types/app/composables/chat/useChatRecording.d.ts.map +1 -1
  39. package/dist/types/app/composables/useAttachmentPicker.d.ts +2 -2
  40. package/dist/types/app/composables/useAttachmentPicker.d.ts.map +1 -1
  41. package/dist/types/app/composables/useCall.d.ts +16 -4
  42. package/dist/types/app/composables/useCall.d.ts.map +1 -1
  43. package/dist/types/app/index.d.ts +0 -9
  44. package/dist/types/app/index.d.ts.map +1 -1
  45. package/dist/types/app/stores/callStore.d.ts +296 -101
  46. package/dist/types/app/stores/callStore.d.ts.map +1 -1
  47. package/dist/types/app/stores/chatStore.d.ts +1 -4
  48. package/dist/types/app/stores/chatStore.d.ts.map +1 -1
  49. package/dist/types/app/stores/mediaStore.d.ts +1 -4
  50. package/dist/types/app/stores/mediaStore.d.ts.map +1 -1
  51. package/dist/types/app/stores/messageStores.d.ts +5 -5
  52. package/dist/types/app/stores/messageStores.d.ts.map +1 -1
  53. package/dist/types/app/stores/profileStore.d.ts +1 -4
  54. package/dist/types/app/stores/profileStore.d.ts.map +1 -1
  55. package/dist/types/app/types/index.d.ts +0 -13
  56. package/dist/types/app/types/index.d.ts.map +1 -1
  57. package/dist/types/app/utils/compressVideo.d.ts +17 -0
  58. package/dist/types/app/utils/compressVideo.d.ts.map +1 -0
  59. package/dist/types/i18n/locales/index.d.ts +28 -8
  60. package/dist/types/i18n/locales/index.d.ts.map +1 -1
  61. package/package.json +2 -1
  62. package/dist/chunks/index-BZyi4oPy.mjs.map +0 -1
  63. package/dist/chunks/index-Dg8cFrSc.cjs.map +0 -1
  64. package/dist/chunks/session-CIPsDkm7.cjs.map +0 -1
  65. package/dist/chunks/session-YNmwwo3T.mjs.map +0 -1
package/README.md CHANGED
@@ -21,7 +21,6 @@ Formerly `@yonus_amire01/chat`. To switch, replace that name with `vue-parley` i
21
21
  - [Photos and videos](#photos-and-videos)
22
22
  - [Read receipts](#read-receipts)
23
23
  - [Calls outside the chat page](#calls-outside-the-chat-page)
24
- - [Joining a call in progress](#joining-a-call-in-progress)
25
24
  - [Fake backend](#fake-backend)
26
25
  - [What `createChat()` does](#what-createchat-does)
27
26
  - [Exports](#exports)
@@ -120,7 +119,8 @@ To build a different layout, use the exported building blocks instead: `ChatList
120
119
 
121
120
  ### Photos and videos
122
121
 
123
- "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
+ The attachment menu offers Photo, Video and File. Photos and videos (and "Add more" mixes the two) go out as one message of type `image` holding the whole album, up to 10 items, in the order they were picked:
123
+
124
124
 
125
125
  ```ts
126
126
  {
@@ -135,8 +135,11 @@ To build a different layout, use the exported building blocks instead: `ChatList
135
135
 
136
136
  `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.
137
137
 
138
+ Videos are always compressed in the browser before they are handed to `sendMessage`: re-encoded with WebCodecs (through [mediabunny](https://mediabunny.dev), loaded on first use) to MP4 at most 1280 px on the long side and 30 fps. Send closes the dialog at once; the message's bubble shows "Compressing… N%", then "Uploading… N%" from your `onProgress`. Albums compress one after another. A video under 1 MB, one the browser can't encode, or one that would lose a track or shrink by less than 10% goes out as picked. In the message `sendMessage` receives, a compressed video's `media` url is a `blob:` url of its own holding the `video/mp4` copy (the bubble keeps showing the picked original); read it during `sendMessage`, as it is released once the send succeeds, and kept for a retry when it fails. "File" sends anything as is, videos included.
139
+
138
140
  A round video note recorded in the chat is different: it is `type: "video"` with `videoUrl`, and plays in its bubble.
139
141
 
142
+
140
143
  ### Read receipts
141
144
 
142
145
  Your own messages show one tick when sent and two once someone has read them (`isRead`). With a `fetchReaders` handler, the message menu also says **who** read one of your messages: the reader and when in a one-to-one chat, or "Seen by N" opening the list of readers in a group.
@@ -175,18 +178,6 @@ Calls use the browser's WebRTC API directly (no `simple-peer`, no Node polyfills
175
178
 
176
179
  Call handlers also accept `iceTransportPolicy` (default `"relay"`; `"all"` allows direct connections without TURN) and `debug` (logs signalling to the console).
177
180
 
178
- ### Joining a call in progress
179
-
180
- When others are in a call on a conversation, its header shows **Join** in place of the call buttons. It joins with the camera on only if the call was started as a video call. Everyone in a call publishes a `presence` message when they join and every 15 seconds after. A call counts as running until its last participant hangs up or goes 45 seconds without being heard from. A closed tab sends no hangup, so that timeout is what ends its call.
181
-
182
- The call's own subscriber only hears the conversation it is on, so the host has to pass along what it hears on all of them. Hand every call message (`signal`, `join`, `track_type`, `call`, `hangup`, `presence`) from every conversation's channel to the store:
183
-
184
- ```ts
185
- callStore.observeCall(message, conversationId);
186
- ```
187
-
188
- `conversationId` can be left out for messages that carry `payload.channel`. Messages from the signed-in user are ignored. A host that never calls `observeCall` keeps the start-call buttons.
189
-
190
181
  ### Fake backend
191
182
 
192
183
  `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.
@@ -235,7 +226,6 @@ Every component and directive the chat uses is imported by the component itself,
235
226
  | `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. |
236
227
  | `useChatStore`, `useMessagesStore`, `useMediaStore`, `useProfileStore`, `useCallStore` | The Pinia stores. |
237
228
  | `messageMedia(message)` | A message's photo and video album: its `media`, or its `imageUrl` as photos. |
238
- | `resetChat()` | Forgets everything the chat loaded for the signed-in user (conversations, threads, drafts, shared media, the downloaded-file cache) and ends a running call. Call it on sign-out or an account switch, before the next user's chat mounts; the handlers stay. Each store also has its own `reset()` (`clearCache()` on the media store). |
239
229
  | Types | Handler interfaces, `Contact`, `Message`, `MediaItem`, `SignalData`, `ChatOptions`, `ChatUser` and the rest of `app/types`. |
240
230
  | `vue-parley/fakes` | `createFakeBackend`, `createBroadcastCallHandlers`, `demoData`, `e2eData`: see [Fake backend](#fake-backend). |
241
231
 
package/dist/chat.css CHANGED
@@ -203,7 +203,9 @@
203
203
  --color-chat-surface: var(--color-surface-variant);
204
204
  --color-chat-surface-3: var(--color-surface-variant-3);
205
205
  --color-chat-on-background: var(--color-on-surface);
206
+ --color-chat-on-surface: var(--color-on-surface-variant);
206
207
  --color-chat-primary: var(--color-primary);
208
+ --color-chat-secondary: var(--color-secondary-600);
207
209
  --color-chat-outline-variant: var(--color-outline-variant);
208
210
  --color-chat-warning: var(--color-warning);
209
211
  --color-chat-error: var(--color-error);
@@ -802,11 +804,6 @@
802
804
  aspect-ratio: var(--aspect-video);
803
805
  }
804
806
 
805
- :where(.vue-chat, .vue-chat *).size-2 {
806
- width: calc(var(--spacing) * 2);
807
- height: calc(var(--spacing) * 2);
808
- }
809
-
810
807
  :where(.vue-chat, .vue-chat *).size-2\.5 {
811
808
  width: calc(var(--spacing) * 2.5);
812
809
  height: calc(var(--spacing) * 2.5);
@@ -1087,10 +1084,6 @@
1087
1084
  min-height: calc(var(--spacing) * 9);
1088
1085
  }
1089
1086
 
1090
- :where(.vue-chat, .vue-chat *).min-h-10 {
1091
- min-height: calc(var(--spacing) * 10);
1092
- }
1093
-
1094
1087
  :where(.vue-chat, .vue-chat *).min-h-11 {
1095
1088
  min-height: calc(var(--spacing) * 11);
1096
1089
  }
@@ -1187,6 +1180,10 @@
1187
1180
  width: calc(var(--spacing) * 60.5);
1188
1181
  }
1189
1182
 
1183
+ :where(.vue-chat, .vue-chat *).w-64 {
1184
+ width: calc(var(--spacing) * 64);
1185
+ }
1186
+
1190
1187
  :where(.vue-chat, .vue-chat *).w-70 {
1191
1188
  width: calc(var(--spacing) * 70);
1192
1189
  }
@@ -1239,6 +1236,10 @@
1239
1236
  max-width: 60%;
1240
1237
  }
1241
1238
 
1239
+ :where(.vue-chat, .vue-chat *).max-w-\[calc\(100vw-2rem\)\] {
1240
+ max-width: calc(100vw - 2rem);
1241
+ }
1242
+
1242
1243
  :where(.vue-chat, .vue-chat *).max-w-dvw {
1243
1244
  max-width: 100dvw;
1244
1245
  }
@@ -1492,6 +1493,10 @@
1492
1493
  justify-content: flex-start;
1493
1494
  }
1494
1495
 
1496
+ :where(.vue-chat, .vue-chat *).justify-start\! {
1497
+ justify-content: flex-start !important;
1498
+ }
1499
+
1495
1500
  :where(.vue-chat, .vue-chat *).gap-0\.5\! {
1496
1501
  gap: calc(var(--spacing) * .5) !important;
1497
1502
  }
@@ -1524,10 +1529,6 @@
1524
1529
  column-gap: calc(var(--spacing) * 2);
1525
1530
  }
1526
1531
 
1527
- :where(.vue-chat, .vue-chat *).gap-x-2\! {
1528
- column-gap: calc(var(--spacing) * 2) !important;
1529
- }
1530
-
1531
1532
  :where(.vue-chat, .vue-chat *).gap-x-2\.5 {
1532
1533
  column-gap: calc(var(--spacing) * 2.5);
1533
1534
  }
@@ -1989,6 +1990,26 @@
1989
1990
  }
1990
1991
  }
1991
1992
 
1993
+ :where(.vue-chat, .vue-chat *).bg-chat-primary\/12 {
1994
+ background-color: var(--color-chat-primary);
1995
+ }
1996
+
1997
+ @supports (color: color-mix(in lab, red, red)) {
1998
+ :where(.vue-chat, .vue-chat *).bg-chat-primary\/12 {
1999
+ background-color: color-mix(in oklab, var(--color-chat-primary) 12%, transparent);
2000
+ }
2001
+ }
2002
+
2003
+ :where(.vue-chat, .vue-chat *).bg-chat-secondary\/14 {
2004
+ background-color: #2ac48424;
2005
+ }
2006
+
2007
+ @supports (color: color-mix(in lab, red, red)) {
2008
+ :where(.vue-chat, .vue-chat *).bg-chat-secondary\/14 {
2009
+ background-color: color-mix(in oklab, var(--color-chat-secondary) 14%, transparent);
2010
+ }
2011
+ }
2012
+
1992
2013
  :where(.vue-chat, .vue-chat *).bg-chat-success\/10 {
1993
2014
  background-color: #2ac4841a;
1994
2015
  }
@@ -2003,6 +2024,10 @@
2003
2024
  background-color: var(--color-chat-surface);
2004
2025
  }
2005
2026
 
2027
+ :where(.vue-chat, .vue-chat *).bg-chat-surface-3 {
2028
+ background-color: var(--color-chat-surface-3);
2029
+ }
2030
+
2006
2031
  :where(.vue-chat, .vue-chat *).bg-chat-surface\/0 {
2007
2032
  background-color: #0000;
2008
2033
  }
@@ -2033,10 +2058,6 @@
2033
2058
  }
2034
2059
  }
2035
2060
 
2036
- :where(.vue-chat, .vue-chat *).bg-current {
2037
- background-color: currentColor;
2038
- }
2039
-
2040
2061
  :where(.vue-chat, .vue-chat *).bg-error {
2041
2062
  background-color: var(--color-error);
2042
2063
  }
@@ -2416,10 +2437,6 @@
2416
2437
  padding-inline: calc(var(--spacing) * 3.5);
2417
2438
  }
2418
2439
 
2419
- :where(.vue-chat, .vue-chat *).px-3\.5\! {
2420
- padding-inline: calc(var(--spacing) * 3.5) !important;
2421
- }
2422
-
2423
2440
  :where(.vue-chat, .vue-chat *).px-4 {
2424
2441
  padding-inline: calc(var(--spacing) * 4);
2425
2442
  }
@@ -2452,6 +2469,10 @@
2452
2469
  padding-block: calc(var(--spacing) * 1.5);
2453
2470
  }
2454
2471
 
2472
+ :where(.vue-chat, .vue-chat *).py-1\.5\! {
2473
+ padding-block: calc(var(--spacing) * 1.5) !important;
2474
+ }
2475
+
2455
2476
  :where(.vue-chat, .vue-chat *).py-2 {
2456
2477
  padding-block: calc(var(--spacing) * 2);
2457
2478
  }
@@ -2668,6 +2689,11 @@
2668
2689
  font-size: 12px !important;
2669
2690
  }
2670
2691
 
2692
+ :where(.vue-chat, .vue-chat *).leading-4 {
2693
+ --tw-leading: calc(var(--spacing) * 4);
2694
+ line-height: calc(var(--spacing) * 4);
2695
+ }
2696
+
2671
2697
  :where(.vue-chat, .vue-chat *).leading-5 {
2672
2698
  --tw-leading: calc(var(--spacing) * 5);
2673
2699
  line-height: calc(var(--spacing) * 5);
@@ -2786,6 +2812,10 @@
2786
2812
  }
2787
2813
  }
2788
2814
 
2815
+ :where(.vue-chat, .vue-chat *).text-chat-on-surface {
2816
+ color: var(--color-chat-on-surface);
2817
+ }
2818
+
2789
2819
  :where(.vue-chat, .vue-chat *).text-chat-primary {
2790
2820
  color: var(--color-chat-primary);
2791
2821
  }
@@ -2794,6 +2824,10 @@
2794
2824
  color: var(--color-chat-primary) !important;
2795
2825
  }
2796
2826
 
2827
+ :where(.vue-chat, .vue-chat *).text-chat-secondary {
2828
+ color: var(--color-chat-secondary);
2829
+ }
2830
+
2797
2831
  :where(.vue-chat, .vue-chat *).text-chat-success {
2798
2832
  color: var(--color-chat-success);
2799
2833
  }
@@ -2885,10 +2919,6 @@
2885
2919
  opacity: .6;
2886
2920
  }
2887
2921
 
2888
- :where(.vue-chat, .vue-chat *).opacity-75 {
2889
- opacity: .75;
2890
- }
2891
-
2892
2922
  :where(.vue-chat, .vue-chat *).opacity-100 {
2893
2923
  opacity: 1;
2894
2924
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("vue");
4
- const index = require("./index-Dg8cFrSc.cjs");
4
+ const index = require("./index-BDGJSPbp.cjs");
5
5
  const core = require("@vueuse/core");
6
6
  const Avatar = require("primevue/avatar");
7
7
  const Button = require("primevue/button");
@@ -1152,4 +1152,4 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
1152
1152
  }
1153
1153
  });
1154
1154
  exports.default = _sfc_main;
1155
- //# sourceMappingURL=Call-DR7geRXf.cjs.map
1155
+ //# sourceMappingURL=Call-3S9Gy7oj.cjs.map