nuxt-parley 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/README.md +204 -0
- package/dist/module.d.mts +44 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +107 -0
- package/dist/runtime/config.d.ts +9 -0
- package/dist/runtime/config.js +3 -0
- package/dist/runtime/install.d.ts +4 -0
- package/dist/runtime/install.js +5 -0
- package/dist/runtime/parley.d.ts +1 -0
- package/dist/runtime/parley.js +20 -0
- package/dist/runtime/plugins/i18n.d.ts +3 -0
- package/dist/runtime/plugins/i18n.js +11 -0
- package/dist/types.d.mts +7 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 nuxt-parley contributors
|
|
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,204 @@
|
|
|
1
|
+
# nuxt-parley
|
|
2
|
+
|
|
3
|
+
Nuxt module for `vue-parley`: a drop-in chat and video-call UI. You write one file with your backend handlers; the module wires up Pinia, i18n, the styles, the components and the auto-imports.
|
|
4
|
+
|
|
5
|
+
- `<ChatPage />` and the chat's building blocks, registered as client-only components
|
|
6
|
+
- The Pinia stores (`useChatStore`, `useCallStore`, ...) auto-imported
|
|
7
|
+
- Pinia installed for you (`@pinia/nuxt`)
|
|
8
|
+
- Works with `@nuxtjs/i18n` (the chat follows its locale), or installs vue-i18n itself when the app has none
|
|
9
|
+
- English and Persian built in, with RTL layout for `fa` and `ar`
|
|
10
|
+
- Controls are PrimeVue components, themed by the app's own PrimeVue preset
|
|
11
|
+
- Scoped, precompiled CSS: no Tailwind needed, no leaks into the app's styles
|
|
12
|
+
|
|
13
|
+
## Contents
|
|
14
|
+
|
|
15
|
+
- [Setup](#setup)
|
|
16
|
+
- [The config file](#the-config-file)
|
|
17
|
+
- [Components](#components)
|
|
18
|
+
- [Auto-imports](#auto-imports)
|
|
19
|
+
- [Options](#options)
|
|
20
|
+
- [Internationalisation](#internationalisation)
|
|
21
|
+
- [Types](#types)
|
|
22
|
+
- [Development](#development)
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pnpm add nuxt-parley primevue@^4.5 @primevue/nuxt-module@^4.5 @primeuix/themes@^1
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
// nuxt.config.ts
|
|
32
|
+
import Aura from '@primeuix/themes/aura'
|
|
33
|
+
|
|
34
|
+
export default defineNuxtConfig({
|
|
35
|
+
modules: ['nuxt-parley', '@primevue/nuxt-module'],
|
|
36
|
+
primevue: {
|
|
37
|
+
options: { theme: { preset: Aura, options: { darkModeSelector: '.dark' } } },
|
|
38
|
+
},
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
vue-parley's buttons, dialogs, menus and the rest are PrimeVue components, so the app provides PrimeVue (4.x) and its theme; an app that already uses PrimeVue keeps its own setup. The module does not install it: it only checks, and warns at build time when `@primevue/nuxt-module` is missing. Installing PrimeVue from a plugin of your own instead works too, with `parley.config: false` and `createChat()` called after it. PrimeVue 5 is not supported (it is no longer MIT-licensed).
|
|
43
|
+
|
|
44
|
+
Then create `app/parley.config.ts` (see below) and render the chat:
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<template>
|
|
48
|
+
<ChatPage />
|
|
49
|
+
</template>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Requires Nuxt 4.
|
|
53
|
+
|
|
54
|
+
## The config file
|
|
55
|
+
|
|
56
|
+
`app/parley.config.ts` returns what the chat needs from your app: the backend handlers and the signed-in user. It runs once, in the browser, from a Nuxt plugin, so composables such as `useRuntimeConfig()` work inside it, and it may be `async`.
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
// app/parley.config.ts
|
|
60
|
+
export default defineParleyConfig(async (nuxtApp) => {
|
|
61
|
+
const api = useApi() // your own
|
|
62
|
+
const me = await api.me()
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
chat: {
|
|
66
|
+
/* ChatHandlers: fetch, delete, end conversations */
|
|
67
|
+
},
|
|
68
|
+
messages: {
|
|
69
|
+
/* MessagesHandlers: fetch, send, edit, delete messages */
|
|
70
|
+
},
|
|
71
|
+
media: {
|
|
72
|
+
/* MediaHandlers: download files, file sizes */
|
|
73
|
+
},
|
|
74
|
+
profile: {
|
|
75
|
+
/* optional, ProfileHandlers: the profile panel's media and files tabs */
|
|
76
|
+
},
|
|
77
|
+
call: {
|
|
78
|
+
/* optional, CallHandlers: enables voice and video calls */
|
|
79
|
+
},
|
|
80
|
+
user: { id: me.id, name: me.fullName },
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The handler interfaces are documented in vue-parley's README and exported as types from this module. Creating or deleting the file restarts the dev server; editing it hot-reloads.
|
|
86
|
+
|
|
87
|
+
To install the chat yourself instead, set `parley: { config: false }` and call `createChat()` from your own client plugin.
|
|
88
|
+
|
|
89
|
+
### Trying it without a backend
|
|
90
|
+
|
|
91
|
+
vue-parley ships an in-memory backend for demos and playgrounds. Install `vue-parley` next to this module to import it:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { createBroadcastCallHandlers, createFakeBackend, demoData } from 'vue-parley/fakes'
|
|
95
|
+
|
|
96
|
+
export default defineParleyConfig(() => {
|
|
97
|
+
const backend = createFakeBackend(demoData('me'), { latency: 300 })
|
|
98
|
+
return {
|
|
99
|
+
chat: backend.chat,
|
|
100
|
+
messages: backend.messages,
|
|
101
|
+
media: backend.media,
|
|
102
|
+
profile: backend.profile,
|
|
103
|
+
call: createBroadcastCallHandlers(),
|
|
104
|
+
user: { id: 'me', name: 'Me' },
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
See [`playground/app/parley.config.ts`](playground/app/parley.config.ts) for the full version.
|
|
110
|
+
|
|
111
|
+
## Components
|
|
112
|
+
|
|
113
|
+
All client-only: the server renders a placeholder, so no `<ClientOnly>` is needed.
|
|
114
|
+
|
|
115
|
+
| Component | What it is |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| `<ChatPage>` | The whole chat: contact list, conversation and call view. Slots: `empty`, `header-actions`, `conversation-top`, `above-input`. |
|
|
118
|
+
| `<ChatCall>` | The call view (vue-parley's `Call`). Render it near the app root, with `<ChatPage :render-call="false" />`, to keep a call on screen while the user navigates. |
|
|
119
|
+
| `<ChatList>`, `<ChatConversation>`, `<ChatHeader>`, `<ChatMessages>`, `<ChatInput>`, `<ChatBubble>` | Building blocks for a custom layout. |
|
|
120
|
+
|
|
121
|
+
With `primitives: true`, `BIcon` (a Phosphor icon by name), `BEmojiPicker` and `BVirtualVerticalList` are registered too. The chat's controls are PrimeVue components; use PrimeVue's own `Button`, `Dialog` and so on in your pages. `prefix` prefixes every name.
|
|
122
|
+
|
|
123
|
+
## Auto-imports
|
|
124
|
+
|
|
125
|
+
| Name | What it is |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `useChatStore`, `useMessagesStore`, `useMediaStore`, `useProfileStore`, `useCallStore` | vue-parley's Pinia stores. Usable anywhere, including plugins and middleware. |
|
|
128
|
+
| `provideCallHandlers(handlers)` | Supplies call handlers from inside a component. |
|
|
129
|
+
| `defineParleyConfig(fn)` | Typed helper for `app/parley.config.ts`. |
|
|
130
|
+
|
|
131
|
+
The stores get their handlers from the config file. Used on the server, they exist but have no handlers.
|
|
132
|
+
|
|
133
|
+
## Options
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
export default defineNuxtConfig({
|
|
137
|
+
modules: ['nuxt-parley'],
|
|
138
|
+
parley: {
|
|
139
|
+
config: 'parley.config', // relative to srcDir; false to install the chat yourself
|
|
140
|
+
css: true, // add vue-parley's stylesheet
|
|
141
|
+
prefix: '', // 'Parley' registers <ParleyChatPage>
|
|
142
|
+
primitives: false, // also register BIcon, BEmojiPicker, BVirtualVerticalList
|
|
143
|
+
locale: 'en', // only without @nuxtjs/i18n
|
|
144
|
+
fallbackLocale: 'en', // only without @nuxtjs/i18n
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Internationalisation
|
|
150
|
+
|
|
151
|
+
- **With `@nuxtjs/i18n`**, the chat uses its vue-i18n instance and follows its locale; `setLocale('fa')` switches the chat to Persian and right-to-left. The chat's own strings come with vue-parley, so there is nothing to add to your locale files.
|
|
152
|
+
- **Without it**, the module installs vue-i18n for the chat, with `parley.locale`. The runtime config key `public.parley.locale` (env `NUXT_PUBLIC_PARLEY_LOCALE`) overrides it.
|
|
153
|
+
|
|
154
|
+
## Types
|
|
155
|
+
|
|
156
|
+
The module re-exports vue-parley's types:
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
import type { ChatHandlers, Contact, Message } from 'nuxt-parley'
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pnpm install
|
|
166
|
+
pnpm dev:prepare # stub the module and generate types
|
|
167
|
+
pnpm dev # playground at http://localhost:3000
|
|
168
|
+
pnpm dev:build # build the playground
|
|
169
|
+
pnpm test # vitest: builds the fixtures in test/fixtures and checks the rendered pages
|
|
170
|
+
pnpm lint
|
|
171
|
+
pnpm typecheck
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The playground (`playground/`) runs on vue-parley's in-memory backend with `@nuxtjs/i18n` (Persian and English), PrimeVue (Aura with vue-parley's teal, in `playground/app/theme.ts`) and Tailwind for its own layout. Open it in two tabs with different `?user=` values (the header has a link), open the same conversation in both and start a call to try video calling.
|
|
175
|
+
|
|
176
|
+
### Developing against a local vue-parley
|
|
177
|
+
|
|
178
|
+
The module depends on the published `vue-parley` (`^4.0.0`) from npm. To change both together, link the checkout next to this one by adding an override to `package.json` and running `pnpm install`:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
"pnpm": { "overrides": { "vue-parley": "link:../vue-parley" } }
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Overrides only apply when installing this repository; the published module still depends on the registry version.
|
|
185
|
+
|
|
186
|
+
With both repositories side by side:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# in ../vue-parley: rebuild dist/ on every change
|
|
190
|
+
pnpm dev
|
|
191
|
+
|
|
192
|
+
# here
|
|
193
|
+
pnpm dev
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Each rebuild of vue-parley reloads the playground; no reinstall needed.
|
|
197
|
+
|
|
198
|
+
A linked package resolves its imports from its own `node_modules`, which has its own Vue, Pinia, vue-i18n and PrimeVue (vue-parley's dev dependencies). Two copies of Pinia in one app means two sets of stores, and a second PrimeVue never sees the app's theme, so `playground/nuxt.config.ts` dedupes `vue`, `pinia`, `vue-i18n`, `@vueuse/core` and `primevue` to this project's copies (in Vite, and through tsconfig `paths` for the typechecker), and allows Vite to serve files from `../vue-parley`. That is also why `vue` and `primevue` are dev dependencies here: dedupe resolves from this project.
|
|
199
|
+
|
|
200
|
+
To go back to the published version, remove the override and run `pnpm install` again.
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
export { ParleyConfig } from '../dist/runtime/config.js';
|
|
3
|
+
export { CallHandlers, CallKind, CallMessage, CallMessageSchema, CallPublishOptions, ChatFilter, ChatHandlers, ChatOptions, ChatUser, Contact, ContactsPage, Credential, ExtendedMessage, FetchContactsParams, FetchMessagesParams, FetchProfileAttachmentsParams, MediaDownloadOptions, MediaHandlers, Message, MessageType, MessagesHandlers, ProfileAttachmentsPage, ProfileHandlers, SendMessageOptions, SignalData, TurnConfig, UploadProgressEvent } from 'vue-parley';
|
|
4
|
+
|
|
5
|
+
interface ModuleOptions {
|
|
6
|
+
/**
|
|
7
|
+
* File, relative to the app's `srcDir` (`app/` in Nuxt 4), whose default export is
|
|
8
|
+
* `defineParleyConfig(...)`: the backend handlers and the signed-in user. `false` leaves
|
|
9
|
+
* installing the chat to you: call `createChat()` from your own plugin.
|
|
10
|
+
* @default 'parley.config'
|
|
11
|
+
*/
|
|
12
|
+
config: string | false;
|
|
13
|
+
/**
|
|
14
|
+
* Add vue-parley's stylesheet. It is precompiled and scoped to the chat, so the app needs no
|
|
15
|
+
* Tailwind and its own styles are left alone.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
css: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Prefix for the registered components: `'Parley'` registers `<ParleyChatPage>`.
|
|
21
|
+
* @default ''
|
|
22
|
+
*/
|
|
23
|
+
prefix: string;
|
|
24
|
+
/**
|
|
25
|
+
* Also register the helpers vue-parley exports besides the chat itself: `BIcon` (a Phosphor
|
|
26
|
+
* icon by name), `BEmojiPicker` and `BVirtualVerticalList`. Its controls are PrimeVue
|
|
27
|
+
* components, which come from the app's own PrimeVue setup.
|
|
28
|
+
* @default false
|
|
29
|
+
*/
|
|
30
|
+
primitives: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Locale for the chat when the app has no `@nuxtjs/i18n`; the module then installs vue-i18n
|
|
33
|
+
* itself. With `@nuxtjs/i18n`, the chat follows its locale and this is ignored.
|
|
34
|
+
* @default 'en'
|
|
35
|
+
*/
|
|
36
|
+
locale: string;
|
|
37
|
+
/** @default 'en' */
|
|
38
|
+
fallbackLocale: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
42
|
+
|
|
43
|
+
export { _default as default };
|
|
44
|
+
export type { ModuleOptions };
|
package/dist/module.json
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { defineNuxtModule, useLogger, createResolver, addComponent, addImports, findPath, hasNuxtModule, addPlugin, addPluginTemplate } from '@nuxt/kit';
|
|
3
|
+
|
|
4
|
+
const MODULE_NAME = "nuxt-parley";
|
|
5
|
+
const COMPONENTS = {
|
|
6
|
+
ChatPage: "ChatPage",
|
|
7
|
+
ChatList: "ChatList",
|
|
8
|
+
ChatConversation: "ChatConversation",
|
|
9
|
+
ChatHeader: "ChatHeader",
|
|
10
|
+
ChatMessages: "ChatMessages",
|
|
11
|
+
ChatInput: "ChatInput",
|
|
12
|
+
ChatBubble: "ChatBubble",
|
|
13
|
+
ChatCall: "Call"
|
|
14
|
+
};
|
|
15
|
+
const PRIMITIVES = ["BEmojiPicker", "BIcon", "BVirtualVerticalList"];
|
|
16
|
+
const COMPOSABLES = [
|
|
17
|
+
"useChatStore",
|
|
18
|
+
"useMessagesStore",
|
|
19
|
+
"useMediaStore",
|
|
20
|
+
"useProfileStore",
|
|
21
|
+
"useCallStore",
|
|
22
|
+
"provideCallHandlers"
|
|
23
|
+
];
|
|
24
|
+
const module$1 = defineNuxtModule({
|
|
25
|
+
meta: {
|
|
26
|
+
name: MODULE_NAME,
|
|
27
|
+
configKey: "parley",
|
|
28
|
+
compatibility: { nuxt: ">=4.0.0" }
|
|
29
|
+
},
|
|
30
|
+
moduleDependencies: {
|
|
31
|
+
"@pinia/nuxt": {}
|
|
32
|
+
},
|
|
33
|
+
defaults: {
|
|
34
|
+
config: "parley.config",
|
|
35
|
+
css: true,
|
|
36
|
+
prefix: "",
|
|
37
|
+
primitives: false,
|
|
38
|
+
locale: "en",
|
|
39
|
+
fallbackLocale: "en"
|
|
40
|
+
},
|
|
41
|
+
async setup(options, nuxt) {
|
|
42
|
+
const logger = useLogger(MODULE_NAME);
|
|
43
|
+
const { resolve } = createResolver(import.meta.url);
|
|
44
|
+
const parley = resolve("./runtime/parley");
|
|
45
|
+
if (options.css) {
|
|
46
|
+
nuxt.options.css.push(createRequire(import.meta.url).resolve("vue-parley/style.css"));
|
|
47
|
+
}
|
|
48
|
+
const names = [
|
|
49
|
+
...Object.entries(COMPONENTS),
|
|
50
|
+
...options.primitives ? PRIMITIVES.map((name) => [name, name]) : []
|
|
51
|
+
];
|
|
52
|
+
for (const [name, exportName] of names) {
|
|
53
|
+
addComponent({ name: `${options.prefix}${name}`, export: exportName, filePath: parley, mode: "client" });
|
|
54
|
+
}
|
|
55
|
+
addImports([
|
|
56
|
+
...COMPOSABLES.map((name) => ({ name, from: parley })),
|
|
57
|
+
{ name: "defineParleyConfig", from: resolve("./runtime/config") }
|
|
58
|
+
]);
|
|
59
|
+
nuxt.options.runtimeConfig.public.parley = {
|
|
60
|
+
locale: options.locale,
|
|
61
|
+
fallbackLocale: options.fallbackLocale
|
|
62
|
+
};
|
|
63
|
+
const configPath = options.config ? await findPath(createResolver(nuxt.options.srcDir).resolve(options.config)) : null;
|
|
64
|
+
if (options.config && !configPath && !nuxt.options._prepare) {
|
|
65
|
+
logger.warn(
|
|
66
|
+
`No \`${options.config}\` in ${nuxt.options.srcDir}, so the chat has no backend. Create it with \`export default defineParleyConfig(...)\`, or set \`parley.config: false\` and call \`createChat()\` from your own plugin.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (options.config) {
|
|
70
|
+
const config = options.config;
|
|
71
|
+
nuxt.hook("builder:watch", async (event, path) => {
|
|
72
|
+
if ((event === "add" || event === "unlink") && path.replace(/\.[cm]?[jt]s$/, "").endsWith(config)) {
|
|
73
|
+
await nuxt.callHook("restart");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
nuxt.hook("modules:done", () => {
|
|
78
|
+
const hasI18n = hasNuxtModule("@nuxtjs/i18n", nuxt);
|
|
79
|
+
if (!hasI18n) {
|
|
80
|
+
addPlugin({ src: resolve("./runtime/plugins/i18n"), mode: "client" });
|
|
81
|
+
}
|
|
82
|
+
if (options.config && !hasNuxtModule("@primevue/nuxt-module", nuxt) && !nuxt.options._prepare) {
|
|
83
|
+
logger.warn(
|
|
84
|
+
"vue-parley needs PrimeVue 4. Add `@primevue/nuxt-module` with a theme preset, or install PrimeVue from a plugin of your own and set `parley.config: false`, calling `createChat()` after it."
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
addPluginTemplate({
|
|
88
|
+
filename: "parley.client.mjs",
|
|
89
|
+
mode: "client",
|
|
90
|
+
getContents: () => [
|
|
91
|
+
`import { defineNuxtPlugin } from '#app'`,
|
|
92
|
+
`import { installParley } from ${JSON.stringify(resolve("./runtime/install"))}`,
|
|
93
|
+
configPath ? `import config from ${JSON.stringify(configPath)}` : "const config = null",
|
|
94
|
+
"",
|
|
95
|
+
"export default defineNuxtPlugin({",
|
|
96
|
+
` name: 'parley',`,
|
|
97
|
+
` dependsOn: ${JSON.stringify(["pinia", hasI18n ? "i18n:plugin" : "parley:i18n"])},`,
|
|
98
|
+
" setup: nuxtApp => installParley(nuxtApp, config),",
|
|
99
|
+
"})",
|
|
100
|
+
""
|
|
101
|
+
].join("\n")
|
|
102
|
+
}, { append: true });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export { module$1 as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NuxtApp } from '#app';
|
|
2
|
+
import type { ChatOptions } from 'vue-parley';
|
|
3
|
+
/**
|
|
4
|
+
* Returns what `createChat()` needs: the backend handlers and the signed-in user. Runs once, in
|
|
5
|
+
* the browser, inside a Nuxt plugin, so composables such as `useRuntimeConfig()` work here.
|
|
6
|
+
*/
|
|
7
|
+
export type ParleyConfig = (nuxtApp: NuxtApp) => ChatOptions | Promise<ChatOptions>;
|
|
8
|
+
/** Typed identity helper for `app/parley.config.ts`. Auto-imported. */
|
|
9
|
+
export declare function defineParleyConfig(config: ParleyConfig): ParleyConfig;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NuxtApp } from '#app';
|
|
2
|
+
import type { ParleyConfig } from './config.js';
|
|
3
|
+
/** Called by the generated `parley` plugin once Pinia and vue-i18n are installed. */
|
|
4
|
+
export declare function installParley(nuxtApp: NuxtApp, config: ParleyConfig | null): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Call, ChatBubble, ChatConversation, ChatHeader, ChatInput, ChatList, ChatMessages, ChatPage, BEmojiPicker, BIcon, BVirtualVerticalList, createChat, provideCallHandlers, useCallStore, useChatStore, useMediaStore, useMessagesStore, useProfileStore, } from 'vue-parley';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export {
|
|
2
|
+
Call,
|
|
3
|
+
ChatBubble,
|
|
4
|
+
ChatConversation,
|
|
5
|
+
ChatHeader,
|
|
6
|
+
ChatInput,
|
|
7
|
+
ChatList,
|
|
8
|
+
ChatMessages,
|
|
9
|
+
ChatPage,
|
|
10
|
+
BEmojiPicker,
|
|
11
|
+
BIcon,
|
|
12
|
+
BVirtualVerticalList,
|
|
13
|
+
createChat,
|
|
14
|
+
provideCallHandlers,
|
|
15
|
+
useCallStore,
|
|
16
|
+
useChatStore,
|
|
17
|
+
useMediaStore,
|
|
18
|
+
useMessagesStore,
|
|
19
|
+
useProfileStore
|
|
20
|
+
} from "vue-parley";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createI18n } from "vue-i18n";
|
|
2
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
3
|
+
const createLooseI18n = createI18n;
|
|
4
|
+
const plugin = defineNuxtPlugin({
|
|
5
|
+
name: "parley:i18n",
|
|
6
|
+
setup(nuxtApp) {
|
|
7
|
+
const { locale, fallbackLocale } = useRuntimeConfig().public.parley;
|
|
8
|
+
nuxtApp.vueApp.use(createLooseI18n({ legacy: false, locale, fallbackLocale, messages: {} }));
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
export default plugin;
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type ParleyConfig } from '../dist/runtime/config.js'
|
|
2
|
+
|
|
3
|
+
export { type CallHandlers, type CallKind, type CallMessage, type CallMessageSchema, type CallPublishOptions, type ChatFilter, type ChatHandlers, type ChatOptions, type ChatUser, type Contact, type ContactsPage, type Credential, type ExtendedMessage, type FetchContactsParams, type FetchMessagesParams, type FetchProfileAttachmentsParams, type MediaDownloadOptions, type MediaHandlers, type Message, type MessageType, type MessagesHandlers, type ProfileAttachmentsPage, type ProfileHandlers, type SendMessageOptions, type SignalData, type TurnConfig, type UploadProgressEvent } from 'vue-parley'
|
|
4
|
+
|
|
5
|
+
export { default } from './module.mjs'
|
|
6
|
+
|
|
7
|
+
export { type ModuleOptions } from './module.mjs'
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nuxt-parley",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Nuxt module for vue-parley: a drop-in chat and video-call UI, wired into Pinia and i18n for you.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "SaeedP11 <saeed_abdi.p11@outlook.com>",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"nuxt",
|
|
10
|
+
"nuxt-module",
|
|
11
|
+
"chat",
|
|
12
|
+
"messaging",
|
|
13
|
+
"webrtc",
|
|
14
|
+
"video-call",
|
|
15
|
+
"vue-parley",
|
|
16
|
+
"primevue"
|
|
17
|
+
],
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/types.d.mts",
|
|
21
|
+
"import": "./dist/module.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"main": "./dist/module.mjs",
|
|
25
|
+
"typesVersions": {
|
|
26
|
+
"*": {
|
|
27
|
+
".": [
|
|
28
|
+
"./dist/types.d.mts"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@nuxt/kit": "^4.5.2",
|
|
37
|
+
"@pinia/nuxt": "^1.0.2",
|
|
38
|
+
"@vueuse/core": "^14.2.1",
|
|
39
|
+
"pinia": "^4.0.3",
|
|
40
|
+
"vue-i18n": "^11.4.5",
|
|
41
|
+
"vue-parley": "^4.0.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"primevue": "^4.5.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@nuxt/devtools": "^3.4.2",
|
|
48
|
+
"@nuxt/eslint-config": "^1.17.0",
|
|
49
|
+
"@nuxt/module-builder": "^1.0.3",
|
|
50
|
+
"@nuxt/schema": "^4.5.2",
|
|
51
|
+
"@nuxt/test-utils": "^4.3.2",
|
|
52
|
+
"@nuxtjs/i18n": "^10.6.0",
|
|
53
|
+
"@primeuix/themes": "^1.2.5",
|
|
54
|
+
"@primevue/nuxt-module": "^4.5.5",
|
|
55
|
+
"@tailwindcss/vite": "4.3.2",
|
|
56
|
+
"@types/node": "^22.10.0",
|
|
57
|
+
"eslint": "^10.10.0",
|
|
58
|
+
"nuxt": "^4.5.2",
|
|
59
|
+
"primevue": "^4.5.5",
|
|
60
|
+
"tailwindcss": "4.3.2",
|
|
61
|
+
"typescript": "^5.9.3",
|
|
62
|
+
"vitest": "^5.0.1",
|
|
63
|
+
"vue": "^3.5.43",
|
|
64
|
+
"vue-tsc": "^3.3.11"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"dev": "nuxi dev playground",
|
|
68
|
+
"dev:build": "nuxi build playground",
|
|
69
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
70
|
+
"lint": "eslint .",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"test:watch": "vitest watch",
|
|
73
|
+
"typecheck": "vue-tsc --noEmit && nuxi typecheck playground"
|
|
74
|
+
}
|
|
75
|
+
}
|