@convokitapp/vue-ui 0.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.
- package/LICENSE +21 -0
- package/PARITY.md +33 -0
- package/README.md +87 -0
- package/dist/index.cjs +1405 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.css +476 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.cts +1613 -0
- package/dist/index.d.ts +1613 -0
- package/dist/index.js +1409 -0
- package/dist/index.js.map +1 -0
- package/package.json +93 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ConvoKit
|
|
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/PARITY.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Vue UI parity
|
|
2
|
+
|
|
3
|
+
This package mirrors the current `convokit_flutter_ui` and React UI baselines
|
|
4
|
+
while using Vue-native composition patterns.
|
|
5
|
+
|
|
6
|
+
| Capability | Flutter UI | React UI | Vue UI |
|
|
7
|
+
| --- | --- | --- | --- |
|
|
8
|
+
| SDK-backed conversation list | `ConvoKitConversationList` | `ConversationList` | `ConversationList` |
|
|
9
|
+
| Controlled conversation list | `ConvoKitConversationListView` | `ConversationListView` | `ConversationListView` |
|
|
10
|
+
| SDK-backed conversation | `ConvoKitConversation` | `Conversation` | `Conversation` |
|
|
11
|
+
| Controlled conversation | `ConvoKitConversationView` | `ConversationView` | `ConversationView` |
|
|
12
|
+
| Controlled message list | `ConvoKitMessageListView` | `MessageListView` | `MessageListView` |
|
|
13
|
+
| Replaceable SDK boundary | `ConvoKitUiClient` | `ConvoKitUiClient` | `ConvoKitUiClient` |
|
|
14
|
+
| Conversation state | Controller | `useConversation` | `useConversation` |
|
|
15
|
+
| Conversation-list state | Controller | `useConversationList` | `useConversationList` |
|
|
16
|
+
| Offset pagination and de-duplication | Yes | Yes | Yes |
|
|
17
|
+
| Search, archived, participant, predicate, sort filters | Yes | Yes | Yes |
|
|
18
|
+
| Realtime messages, typing, reads | Yes | Yes | Yes |
|
|
19
|
+
| Read markers and reader resolution | Yes | Yes | Yes |
|
|
20
|
+
| Mark read on load/receive | Yes | Yes | Yes |
|
|
21
|
+
| Typing idle timeout | Yes | Yes | Yes |
|
|
22
|
+
| Image, file, location, contact rendering | Yes | Yes | Yes |
|
|
23
|
+
| Row/header/message/media/receipt/composer replacements | Builders | Render props | Named slots |
|
|
24
|
+
| Empty/loading/error replacements | Builders | Render props | Named slots |
|
|
25
|
+
| Theme tokens | Theme extension | CSS variables/provider | CSS variables/provider |
|
|
26
|
+
| Compact presentation | Custom builders | `density="compact"` | `density="compact"` |
|
|
27
|
+
| Host-owned attachment opening | Callback | Callback | Callback/event |
|
|
28
|
+
| Accessibility primitives | Material semantics | Native semantics + Radix Avatar | Native semantics + Reka UI Avatar |
|
|
29
|
+
|
|
30
|
+
Vue also exposes controlled/uncontrolled composer text through `v-model`,
|
|
31
|
+
per-part `classNames` and `styles`, `unstyled` mode, native root attributes,
|
|
32
|
+
image loading policy, time formatting, scroll behavior controls, callback props,
|
|
33
|
+
and exposed composable controllers.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# ConvoKit Vue UI
|
|
2
|
+
|
|
3
|
+
Production-ready Vue 3 chat surfaces powered by
|
|
4
|
+
[`@convokitapp/sdk`](https://www.npmjs.com/package/@convokitapp/sdk). The
|
|
5
|
+
components ship accessible defaults, realtime state, media and read receipts,
|
|
6
|
+
while named slots, CSS variables, and controlled views keep the host app in
|
|
7
|
+
control.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @convokitapp/sdk @convokitapp/vue-ui vue
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## SDK-backed conversation
|
|
16
|
+
|
|
17
|
+
Connect a browser-safe ConvoKit client, adapt it once, then render a room:
|
|
18
|
+
|
|
19
|
+
```vue
|
|
20
|
+
<script setup lang="ts">
|
|
21
|
+
import { ConvoKitClient } from '@convokitapp/sdk'
|
|
22
|
+
import { Conversation, createConvoKitUiClient } from '@convokitapp/vue-ui'
|
|
23
|
+
import '@convokitapp/vue-ui/styles.css'
|
|
24
|
+
|
|
25
|
+
const sdk = new ConvoKitClient({
|
|
26
|
+
backendUrl: import.meta.env.VITE_CONVOKIT_BACKEND_URL,
|
|
27
|
+
clientId: import.meta.env.VITE_CONVOKIT_CLIENT_ID,
|
|
28
|
+
tokenProvider: async (appUserId) => {
|
|
29
|
+
const response = await fetch(import.meta.env.VITE_CONVOKIT_TOKEN_ENDPOINT, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: { 'Content-Type': 'application/json' },
|
|
32
|
+
body: JSON.stringify({ appUserId }),
|
|
33
|
+
})
|
|
34
|
+
return (await response.json()).token
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
await sdk.connectUser('maya')
|
|
39
|
+
const client = createConvoKitUiClient(sdk)
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<Conversation :client="client" conversation-id="room-123" />
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The client secret belongs only in your token backend. Never put it in Vue,
|
|
48
|
+
Vite environment variables, or a shipped browser bundle.
|
|
49
|
+
|
|
50
|
+
## Controlled components and slots
|
|
51
|
+
|
|
52
|
+
`ConversationListView`, `MessageListView`, and `ConversationView` accept host
|
|
53
|
+
state directly. Every important surface has a named slot:
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<ConversationView v-model="draft" v-bind="conversationProps">
|
|
57
|
+
<template #header="{ conversation }">
|
|
58
|
+
<SupportHeader :title="conversation.displayTitle" />
|
|
59
|
+
</template>
|
|
60
|
+
<template #message="{ message, isCurrentUser, readerIds }">
|
|
61
|
+
<SupportBubble :message="message" :mine="isCurrentUser" :read-by="readerIds" />
|
|
62
|
+
</template>
|
|
63
|
+
<template #composer="{ value, setValue, send }">
|
|
64
|
+
<BrandComposer :model-value="value" @update:model-value="setValue" @send="send" />
|
|
65
|
+
</template>
|
|
66
|
+
</ConversationView>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Available slots include `conversation-item`, `separator`, `header`, `message`,
|
|
70
|
+
`media`, `read-receipt`, `composer`, `typing-indicator`, `loading`, `empty`,
|
|
71
|
+
`error`, `load-more`, `loading-older`, and `message-error`.
|
|
72
|
+
|
|
73
|
+
## Composables
|
|
74
|
+
|
|
75
|
+
Use `useConversationList` and `useConversation` when you want ConvoKit's
|
|
76
|
+
pagination, de-duplication, realtime, typing, and read state without the
|
|
77
|
+
default UI. Both return readonly Vue refs plus actions and a `dispose()` method.
|
|
78
|
+
|
|
79
|
+
## Appearance
|
|
80
|
+
|
|
81
|
+
Wrap any subtree with `ConvoKitThemeProvider`, set `density="compact"`, or use
|
|
82
|
+
the per-part `classNames` and `styles` maps. `unstyled` removes package classes
|
|
83
|
+
from the configurable parts for a fully host-owned presentation.
|
|
84
|
+
|
|
85
|
+
See the [Vue UI documentation](https://convokit.app/docs/vue-ui), the
|
|
86
|
+
[public examples and screenshots](https://github.com/ConvoKitApp/ConvoKit-Vue-UI-Examples),
|
|
87
|
+
and [the parity matrix](./PARITY.md).
|