@nanahoshi/mona-ui 0.43.1 → 0.45.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/chat/package.json +4 -0
- package/docs/api/chat.json +1 -0
- package/docs/api/chat.md +212 -0
- package/docs/api/i18n.json +1 -1
- package/docs/api/i18n.md +34 -0
- package/docs/api/index.json +1 -1
- package/docs/api/locales.json +1 -1
- package/docs/api/locales.md +14 -14
- package/docs/api/timeline.json +1 -0
- package/docs/api/timeline.md +188 -0
- package/docs/chat.md +480 -0
- package/docs/manifest.json +1 -1
- package/docs/timeline.md +482 -0
- package/fesm2022/nanahoshi-mona-ui-chat.mjs +1230 -0
- package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +1 -6
- package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +37 -0
- package/fesm2022/nanahoshi-mona-ui-internal.mjs +6 -1
- package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +29 -0
- package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +19 -0
- package/fesm2022/nanahoshi-mona-ui-timeline.mjs +1028 -0
- package/i18n/catalogs/en-US.messages.json +19 -0
- package/llms.txt +8 -1
- package/locales/ar-sa/ar-sa.messages.json +19 -0
- package/locales/de-de/de-de.messages.json +19 -0
- package/locales/es-es/es-es.messages.json +19 -0
- package/locales/fr-fr/fr-fr.messages.json +19 -0
- package/locales/id-id/id-id.messages.json +19 -0
- package/locales/it-it/it-it.messages.json +19 -0
- package/locales/ja-jp/ja-jp.messages.json +19 -0
- package/locales/ko-kr/ko-kr.messages.json +19 -0
- package/locales/pl-pl/pl-pl.messages.json +19 -0
- package/locales/pt-br/pt-br.messages.json +19 -0
- package/locales/ru-ru/ru-ru.messages.json +19 -0
- package/locales/tr-tr/tr-tr.messages.json +19 -0
- package/locales/zh-cn/zh-cn.messages.json +19 -0
- package/locales/zh-tw/zh-tw.messages.json +19 -0
- package/package.json +9 -1
- package/timeline/package.json +4 -0
- package/types/nanahoshi-mona-ui-chat.d.ts +424 -0
- package/types/nanahoshi-mona-ui-i18n.d.ts +43 -0
- package/types/nanahoshi-mona-ui-internal.d.ts +4 -0
- package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-de-de.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-es-es.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-id-id.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-it-it.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +19 -0
- package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +19 -0
- package/types/nanahoshi-mona-ui-timeline.d.ts +338 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ElementRef, TemplateRef } from "@angular/core";
|
|
3
|
+
import { MonaChatMessages } from "@nanahoshi/mona-ui/i18n";
|
|
4
|
+
/** Someone taking part in a chat: the user, or someone they're talking to, a person or an assistant. */
|
|
5
|
+
interface ChatUser {
|
|
6
|
+
/** A picture of them, shown beside their messages. Without one, their initials are. */
|
|
7
|
+
readonly avatarUrl?: string;
|
|
8
|
+
/** What tells them apart: two messages whose authors have the same `id` are from the same person. */
|
|
9
|
+
readonly id: unknown;
|
|
10
|
+
/** Their name, shown above their messages and read with each one. */
|
|
11
|
+
readonly name: string;
|
|
12
|
+
}
|
|
13
|
+
/** A file sent with a message. */
|
|
14
|
+
interface ChatAttachment {
|
|
15
|
+
/** The file's name. */
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/** The file's size in bytes, shown after its name. */
|
|
18
|
+
readonly size?: number;
|
|
19
|
+
/** The file's media type, such as `"image/png"`. An image with a `url` shows as a picture. */
|
|
20
|
+
readonly type?: string;
|
|
21
|
+
/** Where to get the file. With it, the file's name is a link to it. */
|
|
22
|
+
readonly url?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Where a message of the user's stands: `"sending"`, shown faded with "Sending" under it, `"sent"`, or `"failed"`,
|
|
26
|
+
* with "Not sent" and a Retry button under it.
|
|
27
|
+
*/
|
|
28
|
+
type ChatMessageStatus = "failed" | "sending" | "sent";
|
|
29
|
+
/** A message in a chat. */
|
|
30
|
+
interface ChatMessage {
|
|
31
|
+
/** Files sent with the message, listed under its text. */
|
|
32
|
+
readonly attachments?: readonly ChatAttachment[];
|
|
33
|
+
/** Who sent it. A message whose author has the user's `id` is the user's own. */
|
|
34
|
+
readonly author: ChatUser;
|
|
35
|
+
/**
|
|
36
|
+
* What identifies the message, so one that's replaced with a copy, as a reply streaming in is, stays the same
|
|
37
|
+
* message: it keeps its place, and is announced once. Without it, a message is its own identity.
|
|
38
|
+
*/
|
|
39
|
+
readonly id?: unknown;
|
|
40
|
+
/** Where a message of the user's stands. A message without one has been sent. */
|
|
41
|
+
readonly status?: ChatMessageStatus;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the message's text is still coming in, as a reply from an assistant streams. It shows a caret at the end,
|
|
44
|
+
* and is announced when it's done. While a message streams, the Send button stops it.
|
|
45
|
+
*/
|
|
46
|
+
readonly streaming?: boolean;
|
|
47
|
+
/** What it says. Line breaks show as written. */
|
|
48
|
+
readonly text?: string;
|
|
49
|
+
/** When it was sent, shown under the last message of a run and used to put the day above the first. */
|
|
50
|
+
readonly timestamp?: Date;
|
|
51
|
+
}
|
|
52
|
+
/** A message as the chat shows it. */
|
|
53
|
+
interface ChatEntry {
|
|
54
|
+
readonly attachments: readonly ChatAttachment[];
|
|
55
|
+
/** What identifies the message: its `id`, or the message itself without one. */
|
|
56
|
+
readonly key: unknown;
|
|
57
|
+
readonly message: ChatMessage;
|
|
58
|
+
readonly mine: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** Messages from one author in a row, sent close together. */
|
|
61
|
+
interface ChatRun {
|
|
62
|
+
readonly author: ChatUser;
|
|
63
|
+
/** The `datetime` of the last message's time, or `null` when it has none. */
|
|
64
|
+
readonly dateTime: string | null;
|
|
65
|
+
readonly entries: readonly ChatEntry[];
|
|
66
|
+
readonly key: unknown;
|
|
67
|
+
readonly mine: boolean;
|
|
68
|
+
/** The last message's time, as the run shows it under its messages. */
|
|
69
|
+
readonly timeText: string;
|
|
70
|
+
}
|
|
71
|
+
/** The runs of messages sent on one day, under the day's label. */
|
|
72
|
+
interface ChatDay {
|
|
73
|
+
/** The day as a date, `"2026-11-20"`, or `null` for messages before any with a time. */
|
|
74
|
+
readonly dateTime: string | null;
|
|
75
|
+
readonly key: string;
|
|
76
|
+
/** "Today", "Yesterday", or the date. Empty for messages before any with a time. */
|
|
77
|
+
readonly label: string;
|
|
78
|
+
readonly runs: readonly ChatRun[];
|
|
79
|
+
}
|
|
80
|
+
/** What the user sends: their message's text, trimmed, and the files they attached to it. */
|
|
81
|
+
interface ChatSendEvent {
|
|
82
|
+
/** The files attached to the message, in the order they were picked. */
|
|
83
|
+
readonly files: readonly File[];
|
|
84
|
+
/** The message's text, trimmed. It's empty for a message of files alone. */
|
|
85
|
+
readonly text: string;
|
|
86
|
+
}
|
|
87
|
+
/** The context of a `monaChatMessageTemplate`: the message, as `let-message`. */
|
|
88
|
+
interface ChatMessageTemplateContext {
|
|
89
|
+
/** The message (`let-message`). */
|
|
90
|
+
readonly $implicit: ChatMessage;
|
|
91
|
+
/** Whether it's the user's own message (`let-mine="mine"`). */
|
|
92
|
+
readonly mine: boolean;
|
|
93
|
+
}
|
|
94
|
+
/** The context of a `monaChatAttachmentTemplate`: the file, as `let-attachment`. */
|
|
95
|
+
interface ChatAttachmentTemplateContext {
|
|
96
|
+
/** The file (`let-attachment`). */
|
|
97
|
+
readonly $implicit: ChatAttachment;
|
|
98
|
+
/** The message it was sent with (`let-message="message"`). */
|
|
99
|
+
readonly message: ChatMessage;
|
|
100
|
+
/** Whether it's on the user's own message (`let-mine="mine"`). */
|
|
101
|
+
readonly mine: boolean;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The chat's message box: a text area that grows with its text, Enter to send and Shift+Enter for a new line, the
|
|
105
|
+
* files attached to the message, and the Send button, which stops a reply while one streams in.
|
|
106
|
+
* @hidden The chat's own part.
|
|
107
|
+
*/
|
|
108
|
+
declare class ChatComposerComponent {
|
|
109
|
+
#private;
|
|
110
|
+
protected readonly canSend: import("@angular/core").Signal<boolean>;
|
|
111
|
+
protected readonly composerClass = "flex flex-col gap-2 p-3";
|
|
112
|
+
protected readonly fieldClass = "\n flex items-end gap-1 rounded-xl p-1\n \n [background-color:var(--mona-effect-control-background-color,var(--color-input-background))]\n \n [background-image:var(--mona-effect-control-background-image,none)]\n [backdrop-filter:var(--mona-effect-control-backdrop-filter,none)]\n [-webkit-backdrop-filter:var(--mona-effect-control-backdrop-filter,none)]\n\n\n border border-input-border shadow-(--shadow-control)\n transition-[color,box-shadow,border] duration-(--mona-motion-standard) ease-in-out\n focus-within:border-focus-indicator focus-within:ring-2 focus-within:ring-focus-indicator/35\n data-[disabled]:cursor-not-allowed data-[disabled]:border-disabled-border data-[disabled]:bg-disabled-background\n data-[disabled]:shadow-none\n";
|
|
113
|
+
protected readonly fileClass = "\n flex max-w-full min-w-0 items-center gap-1.5 rounded-md border border-border bg-surface-muted\n py-0.5 ps-2 pe-0.5 text-xs\n";
|
|
114
|
+
protected readonly fileNameClass = "min-w-0 truncate";
|
|
115
|
+
protected readonly files: import("@angular/core").WritableSignal<readonly File[]>;
|
|
116
|
+
protected readonly filesClass = "m-0 flex list-none flex-wrap gap-2 p-0";
|
|
117
|
+
protected readonly messages: import("@angular/core").Signal<import("@nanahoshi/mona-ui/i18n").MonaChatMessages>;
|
|
118
|
+
protected readonly placeholderText: import("@angular/core").Signal<string>;
|
|
119
|
+
protected readonly textAreaClass = "\n max-h-60 min-h-8 min-w-0 flex-1 resize-none border-0 bg-transparent px-2 py-1.5 text-sm text-foreground\n outline-none focus-visible:outline-hidden placeholder:text-muted-foreground\n disabled:cursor-not-allowed disabled:text-disabled-foreground\n";
|
|
120
|
+
protected readonly textAreaRef: import("@angular/core").Signal<ElementRef<HTMLTextAreaElement>>;
|
|
121
|
+
readonly accept: import("@angular/core").InputSignal<string>;
|
|
122
|
+
readonly allowFiles: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
123
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
124
|
+
readonly draft: import("@angular/core").ModelSignal<string>;
|
|
125
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
126
|
+
readonly send: import("@angular/core").OutputEmitterRef<ChatSendEvent>;
|
|
127
|
+
readonly stop: import("@angular/core").OutputEmitterRef<void>;
|
|
128
|
+
readonly streaming: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
129
|
+
constructor();
|
|
130
|
+
focus(): void;
|
|
131
|
+
protected fileSize(file: File): string;
|
|
132
|
+
protected onFilesPicked(picker: HTMLInputElement): void;
|
|
133
|
+
protected onInput(textArea: HTMLTextAreaElement): void;
|
|
134
|
+
/** Enter sends, unless it picks a word in an input method's composition. Shift+Enter starts a new line. */
|
|
135
|
+
protected onKeydown(event: KeyboardEvent): void;
|
|
136
|
+
protected removeFile(file: File): void;
|
|
137
|
+
protected submit(): void;
|
|
138
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatComposerComponent, never>;
|
|
139
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatComposerComponent, "mona-chat-composer", never, {
|
|
140
|
+
"accept": {
|
|
141
|
+
"alias": "accept";
|
|
142
|
+
"required": false;
|
|
143
|
+
"isSignal": true;
|
|
144
|
+
};
|
|
145
|
+
"allowFiles": {
|
|
146
|
+
"alias": "allowFiles";
|
|
147
|
+
"required": false;
|
|
148
|
+
"isSignal": true;
|
|
149
|
+
};
|
|
150
|
+
"disabled": {
|
|
151
|
+
"alias": "disabled";
|
|
152
|
+
"required": false;
|
|
153
|
+
"isSignal": true;
|
|
154
|
+
};
|
|
155
|
+
"draft": {
|
|
156
|
+
"alias": "draft";
|
|
157
|
+
"required": false;
|
|
158
|
+
"isSignal": true;
|
|
159
|
+
};
|
|
160
|
+
"placeholder": {
|
|
161
|
+
"alias": "placeholder";
|
|
162
|
+
"required": false;
|
|
163
|
+
"isSignal": true;
|
|
164
|
+
};
|
|
165
|
+
"streaming": {
|
|
166
|
+
"alias": "streaming";
|
|
167
|
+
"required": false;
|
|
168
|
+
"isSignal": true;
|
|
169
|
+
};
|
|
170
|
+
}, {
|
|
171
|
+
"draft": "draftChange";
|
|
172
|
+
"send": "send";
|
|
173
|
+
"stop": "stop";
|
|
174
|
+
}, never, never, true, never>;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @description
|
|
178
|
+
* A conversation: its messages, by day, with the user's at the end and others' at the start beside their avatar, and a
|
|
179
|
+
* message box below them. Enter sends a message, Shift+Enter starts a new line, and files can go with it. The chat
|
|
180
|
+
* emits what the user sends through `send`, and shows what you give it in `messages`, so add the message there.
|
|
181
|
+
*
|
|
182
|
+
* It keeps to the newest message while the user is reading there, and offers a button to the new ones when they've
|
|
183
|
+
* scrolled up. Messages from others are announced as they arrive, and a reply that streams in once it's done. While
|
|
184
|
+
* one streams, the Send button stops it. Suggested replies sit above the message box, and who's typing below the
|
|
185
|
+
* messages.
|
|
186
|
+
*/
|
|
187
|
+
export declare class ChatComponent {
|
|
188
|
+
#private;
|
|
189
|
+
protected readonly attachmentClass = "flex min-w-0 flex-col gap-1";
|
|
190
|
+
protected readonly attachmentImageClass = "block max-h-48 max-w-full rounded-lg object-cover";
|
|
191
|
+
protected readonly attachmentRowClass = "flex min-w-0 items-center gap-1.5";
|
|
192
|
+
protected readonly attachmentSizeClass = "shrink-0 text-xs opacity-80";
|
|
193
|
+
protected readonly attachmentTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
194
|
+
protected readonly attachmentsClass = "m-0 mt-2 flex list-none flex-col gap-1.5 p-0 first:mt-0";
|
|
195
|
+
protected readonly authorClass = "px-1 text-xs font-medium text-muted-foreground";
|
|
196
|
+
protected readonly avatarClass = "mt-5 shrink-0";
|
|
197
|
+
protected readonly baseClass: import("@angular/core").Signal<string>;
|
|
198
|
+
protected readonly caretClass = "\n ms-0.5 inline-block h-[1em] w-[0.45em] translate-y-[0.15em] rounded-[1px] bg-current\n animate-pulse motion-reduce:animate-none forced-color-adjust-none forced-colors:bg-[CanvasText]\n";
|
|
199
|
+
protected readonly composerRef: import("@angular/core").Signal<ChatComposerComponent>;
|
|
200
|
+
protected readonly dayClass = "flex flex-col gap-4";
|
|
201
|
+
protected readonly dayLabelClass = "\n flex items-center gap-3 text-xs font-medium text-muted-foreground\n before:h-px before:flex-1 before:bg-border after:h-px after:flex-1 after:bg-border\n forced-colors:before:bg-[GrayText] forced-colors:after:bg-[GrayText]\n";
|
|
202
|
+
protected readonly days: import("@angular/core").Signal<ChatDay[]>;
|
|
203
|
+
protected readonly emptyClass = "m-auto max-w-full text-center text-sm text-muted-foreground";
|
|
204
|
+
protected readonly emptyTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
205
|
+
protected readonly failedClass = "flex items-center gap-2 px-1 text-xs text-error";
|
|
206
|
+
protected readonly labels: import("@angular/core").Signal<import("@nanahoshi/mona-ui/i18n").MonaChatMessages>;
|
|
207
|
+
protected readonly logClass = "\n flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto overscroll-contain p-4\n focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus-indicator\n";
|
|
208
|
+
protected readonly logFrameClass = "relative flex min-h-0 flex-1 flex-col";
|
|
209
|
+
protected readonly logLabel: import("@angular/core").Signal<string>;
|
|
210
|
+
protected readonly logRef: import("@angular/core").Signal<ElementRef<HTMLElement>>;
|
|
211
|
+
protected readonly messageTemplate: import("@angular/core").Signal<TemplateRef<any> | undefined>;
|
|
212
|
+
protected readonly newMessagesClass = "absolute inset-x-0 bottom-3 mx-auto w-fit shadow-(--shadow-raised)";
|
|
213
|
+
protected readonly statusClass = "flex items-center gap-2 px-1 text-xs text-muted-foreground";
|
|
214
|
+
/** Whether a reply is streaming in, which turns the Send button into Stop and hides the suggested replies. */
|
|
215
|
+
protected readonly streaming: import("@angular/core").Signal<boolean>;
|
|
216
|
+
protected readonly suggestionsClass = "flex flex-wrap gap-2 px-4 pt-1";
|
|
217
|
+
protected readonly textClass = "m-0 whitespace-pre-wrap";
|
|
218
|
+
protected readonly timeClass = "px-1 text-xs text-muted-foreground";
|
|
219
|
+
protected readonly typingClass = "flex min-h-5 items-center gap-2 px-4 text-xs text-muted-foreground";
|
|
220
|
+
protected readonly typingDotsClass = "\n flex items-center gap-0.5\n [&>span]:size-1 [&>span]:rounded-full [&>span]:bg-current\n [&>span]:animate-bounce motion-reduce:[&>span]:animate-none\n [&>span:nth-child(2)]:[animation-delay:150ms] [&>span:nth-child(3)]:[animation-delay:300ms]\n forced-color-adjust-none forced-colors:[&>span]:bg-[CanvasText]\n";
|
|
221
|
+
/** Who's typing, by name for up to three people, joined in the locale's way, or how many for more. */
|
|
222
|
+
protected readonly typingText: import("@angular/core").Signal<string>;
|
|
223
|
+
/** Whether messages arrived while the user was reading earlier ones. */
|
|
224
|
+
protected readonly unseen: import("@angular/core").WritableSignal<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* @description The file types the file picker offers, as its `accept` attribute takes them, such as
|
|
227
|
+
* `"image/*,.pdf"`. Every type when empty.
|
|
228
|
+
* @default ""
|
|
229
|
+
*/
|
|
230
|
+
readonly accept: import("@angular/core").InputSignal<string>;
|
|
231
|
+
/**
|
|
232
|
+
* @description Shows a button that attaches files to the message, through the file picker. The files go out with
|
|
233
|
+
* the message in `send`; upload them, and give the message its `attachments`.
|
|
234
|
+
* @default false
|
|
235
|
+
*/
|
|
236
|
+
readonly allowFiles: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
237
|
+
/**
|
|
238
|
+
* @description The chat's name, such as "Support chat", which names its list of messages. "Messages" when empty.
|
|
239
|
+
* @default ""
|
|
240
|
+
*/
|
|
241
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
242
|
+
/**
|
|
243
|
+
* @description Disables the message box, its buttons and the suggested replies, such as while the chat is offline.
|
|
244
|
+
* The messages can still be read and scrolled.
|
|
245
|
+
* @default false
|
|
246
|
+
*/
|
|
247
|
+
readonly disabled: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
248
|
+
/**
|
|
249
|
+
* @description The text in the message box. Bind it two-way, `[(draft)]`, to keep a draft per conversation, or to
|
|
250
|
+
* tell others the user is typing.
|
|
251
|
+
* @default ""
|
|
252
|
+
*/
|
|
253
|
+
readonly draft: import("@angular/core").ModelSignal<string>;
|
|
254
|
+
/**
|
|
255
|
+
* @description The messages, oldest first. Give each an `id`, so one replaced with a copy, as a reply streaming in
|
|
256
|
+
* is, stays the same message.
|
|
257
|
+
* @default []
|
|
258
|
+
*/
|
|
259
|
+
readonly messages: import("@angular/core").InputSignal<Iterable<ChatMessage>>;
|
|
260
|
+
/**
|
|
261
|
+
* @description The message box's placeholder. "Type a message" in the locale when empty.
|
|
262
|
+
* @default ""
|
|
263
|
+
*/
|
|
264
|
+
readonly placeholder: import("@angular/core").InputSignal<string>;
|
|
265
|
+
/**
|
|
266
|
+
* @description Emitted with a message of the user's that couldn't be sent, when they press its Retry button. Send
|
|
267
|
+
* it again, and set its `status`.
|
|
268
|
+
*/
|
|
269
|
+
readonly retry: import("@angular/core").OutputEmitterRef<ChatMessage>;
|
|
270
|
+
/**
|
|
271
|
+
* @description Emitted with what the user sends: a message's text, trimmed, and its files, or a suggested reply
|
|
272
|
+
* they press. Add the message to `messages` to show it.
|
|
273
|
+
*/
|
|
274
|
+
readonly send: import("@angular/core").OutputEmitterRef<ChatSendEvent>;
|
|
275
|
+
/**
|
|
276
|
+
* @description Emitted when the user presses Stop while a reply streams in. Stop it, and set its `streaming` to
|
|
277
|
+
* `false`.
|
|
278
|
+
*/
|
|
279
|
+
readonly stop: import("@angular/core").OutputEmitterRef<void>;
|
|
280
|
+
/**
|
|
281
|
+
* @description Replies the user can send with a press, shown above the message box while no reply is streaming
|
|
282
|
+
* in. Pressing one emits `send` with its text.
|
|
283
|
+
* @default []
|
|
284
|
+
*/
|
|
285
|
+
readonly suggestions: import("@angular/core").InputSignal<readonly string[]>;
|
|
286
|
+
/**
|
|
287
|
+
* @description How the time under each run of messages is formatted, in the locale.
|
|
288
|
+
* @default { hour: "numeric", minute: "2-digit" }
|
|
289
|
+
*/
|
|
290
|
+
readonly timeFormat: import("@angular/core").InputSignal<Intl.DateTimeFormatOptions>;
|
|
291
|
+
/**
|
|
292
|
+
* @description The people typing, shown below the messages: "Ana is typing", or how many for more than three.
|
|
293
|
+
* @default []
|
|
294
|
+
*/
|
|
295
|
+
readonly typing: import("@angular/core").InputSignal<readonly ChatUser[]>;
|
|
296
|
+
/**
|
|
297
|
+
* @description The user: messages whose author has their `id` are theirs, shown at the end without a name.
|
|
298
|
+
*/
|
|
299
|
+
readonly user: import("@angular/core").InputSignal<ChatUser>;
|
|
300
|
+
/**
|
|
301
|
+
* @description Additional CSS classes merged onto the host element via `tailwind-merge`, such as a height: the chat
|
|
302
|
+
* is 32rem tall by default.
|
|
303
|
+
* @default ""
|
|
304
|
+
*/
|
|
305
|
+
readonly userClass: import("@angular/core").InputSignal<string>;
|
|
306
|
+
constructor();
|
|
307
|
+
/** Moves focus to the message box. */
|
|
308
|
+
focus(): void;
|
|
309
|
+
protected attachmentContext(attachment: ChatAttachment, entry: ChatEntry): ChatAttachmentTemplateContext;
|
|
310
|
+
protected attachmentLinkClass(mine: boolean): string;
|
|
311
|
+
protected bubbleClass(entry: ChatEntry): string;
|
|
312
|
+
protected fileSize(size: number): string;
|
|
313
|
+
/** The first letters of the first two words of a name, for an avatar without a picture. */
|
|
314
|
+
protected initials(name: string): string;
|
|
315
|
+
protected isImage(attachment: ChatAttachment): boolean;
|
|
316
|
+
protected messageContext(entry: ChatEntry): ChatMessageTemplateContext;
|
|
317
|
+
/** A picture that loads makes the messages taller; the newest stays in view. */
|
|
318
|
+
protected onMediaLoad(): void;
|
|
319
|
+
protected onRetry(message: ChatMessage): void;
|
|
320
|
+
protected onScroll(): void;
|
|
321
|
+
protected onSend(event: ChatSendEvent): void;
|
|
322
|
+
protected onSuggestion(text: string): void;
|
|
323
|
+
protected runBodyClass(mine: boolean): string;
|
|
324
|
+
protected runClass(mine: boolean): string;
|
|
325
|
+
protected showNewMessages(): void;
|
|
326
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatComponent, never>;
|
|
327
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChatComponent, "mona-chat", never, {
|
|
328
|
+
"accept": {
|
|
329
|
+
"alias": "accept";
|
|
330
|
+
"required": false;
|
|
331
|
+
"isSignal": true;
|
|
332
|
+
};
|
|
333
|
+
"allowFiles": {
|
|
334
|
+
"alias": "allowFiles";
|
|
335
|
+
"required": false;
|
|
336
|
+
"isSignal": true;
|
|
337
|
+
};
|
|
338
|
+
"ariaLabel": {
|
|
339
|
+
"alias": "aria-label";
|
|
340
|
+
"required": false;
|
|
341
|
+
"isSignal": true;
|
|
342
|
+
};
|
|
343
|
+
"disabled": {
|
|
344
|
+
"alias": "disabled";
|
|
345
|
+
"required": false;
|
|
346
|
+
"isSignal": true;
|
|
347
|
+
};
|
|
348
|
+
"draft": {
|
|
349
|
+
"alias": "draft";
|
|
350
|
+
"required": false;
|
|
351
|
+
"isSignal": true;
|
|
352
|
+
};
|
|
353
|
+
"messages": {
|
|
354
|
+
"alias": "messages";
|
|
355
|
+
"required": false;
|
|
356
|
+
"isSignal": true;
|
|
357
|
+
};
|
|
358
|
+
"placeholder": {
|
|
359
|
+
"alias": "placeholder";
|
|
360
|
+
"required": false;
|
|
361
|
+
"isSignal": true;
|
|
362
|
+
};
|
|
363
|
+
"suggestions": {
|
|
364
|
+
"alias": "suggestions";
|
|
365
|
+
"required": false;
|
|
366
|
+
"isSignal": true;
|
|
367
|
+
};
|
|
368
|
+
"timeFormat": {
|
|
369
|
+
"alias": "timeFormat";
|
|
370
|
+
"required": false;
|
|
371
|
+
"isSignal": true;
|
|
372
|
+
};
|
|
373
|
+
"typing": {
|
|
374
|
+
"alias": "typing";
|
|
375
|
+
"required": false;
|
|
376
|
+
"isSignal": true;
|
|
377
|
+
};
|
|
378
|
+
"user": {
|
|
379
|
+
"alias": "user";
|
|
380
|
+
"required": true;
|
|
381
|
+
"isSignal": true;
|
|
382
|
+
};
|
|
383
|
+
"userClass": {
|
|
384
|
+
"alias": "class";
|
|
385
|
+
"required": false;
|
|
386
|
+
"isSignal": true;
|
|
387
|
+
};
|
|
388
|
+
}, {
|
|
389
|
+
"draft": "draftChange";
|
|
390
|
+
"retry": "retry";
|
|
391
|
+
"send": "send";
|
|
392
|
+
"stop": "stop";
|
|
393
|
+
}, ["attachmentTemplate", "emptyTemplate", "messageTemplate"], never, true, never>;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Template for each file sent with a message, in place of its picture, name and size, such as a preview of a document.
|
|
397
|
+
* The file is the template's implicit value (`let-attachment`), with its message (`let-message="message"`) and whether
|
|
398
|
+
* that's the user's own (`let-mine="mine"`).
|
|
399
|
+
*/
|
|
400
|
+
export declare class ChatAttachmentTemplateDirective {
|
|
401
|
+
static ngTemplateContextGuard(_directive: ChatAttachmentTemplateDirective, _context: unknown): _context is ChatAttachmentTemplateContext;
|
|
402
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatAttachmentTemplateDirective, never>;
|
|
403
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ChatAttachmentTemplateDirective, "ng-template[monaChatAttachmentTemplate]", never, {}, {}, never, never, true, never>;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Template for a chat with no messages, in place of "No messages yet", such as a greeting from an assistant. It sits in
|
|
407
|
+
* the middle of the messages' space; the suggested replies stay below it.
|
|
408
|
+
*/
|
|
409
|
+
export declare class ChatEmptyTemplateDirective {
|
|
410
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatEmptyTemplateDirective, never>;
|
|
411
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ChatEmptyTemplateDirective, "ng-template[monaChatEmptyTemplate]", never, {}, {}, never, never, true, never>;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Template for each message's content, inside its bubble, in place of its text, such as text rendered from Markdown.
|
|
415
|
+
* The message is the template's implicit value (`let-message`), with whether it's the user's own (`let-mine="mine"`).
|
|
416
|
+
* The files sent with it, its status and the caret of a message that's streaming stay where they are.
|
|
417
|
+
*/
|
|
418
|
+
export declare class ChatMessageTemplateDirective {
|
|
419
|
+
static ngTemplateContextGuard(_directive: ChatMessageTemplateDirective, _context: unknown): _context is ChatMessageTemplateContext;
|
|
420
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChatMessageTemplateDirective, never>;
|
|
421
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ChatMessageTemplateDirective, "ng-template[monaChatMessageTemplate]", never, {}, {}, never, never, true, never>;
|
|
422
|
+
}
|
|
423
|
+
export declare const CHAT_DEFAULT_MESSAGES: MonaChatMessages;
|
|
424
|
+
export type { ChatAttachment, ChatAttachmentTemplateContext, ChatMessage, ChatMessageStatus, ChatMessageTemplateContext, ChatSendEvent, ChatUser };
|
|
@@ -220,6 +220,48 @@ export interface MonaChartMessages {
|
|
|
220
220
|
/** Announced when the keyboard zooms the viewport out. */
|
|
221
221
|
readonly zoomedOut: string;
|
|
222
222
|
}
|
|
223
|
+
export interface MonaChatMessages {
|
|
224
|
+
/** Names the button that opens the file picker to attach files to a message. */
|
|
225
|
+
readonly attachFiles: string;
|
|
226
|
+
/** Names the message box. */
|
|
227
|
+
readonly messageBox: string;
|
|
228
|
+
/** Names the list of messages, when the chat has no name of its own. */
|
|
229
|
+
readonly messages: string;
|
|
230
|
+
/**
|
|
231
|
+
* Announces a message from someone else as it arrives, or once it has finished streaming: who sent it and what it
|
|
232
|
+
* says ("Ana: See you at six").
|
|
233
|
+
*/
|
|
234
|
+
newMessage(name: string, text: string): string;
|
|
235
|
+
/** Labels the button that scrolls to messages that arrived while the user was reading earlier ones. */
|
|
236
|
+
readonly newMessages: string;
|
|
237
|
+
/** Shown in a chat with no messages. */
|
|
238
|
+
readonly noMessages: string;
|
|
239
|
+
/** Shown under a message of the user's that couldn't be sent. */
|
|
240
|
+
readonly notSent: string;
|
|
241
|
+
/** The message box's placeholder. */
|
|
242
|
+
readonly placeholder: string;
|
|
243
|
+
/** Names the button that removes a file waiting to be sent ("Remove photo.jpg"). */
|
|
244
|
+
removeFile(name: string): string;
|
|
245
|
+
/** Labels the button that sends a message that couldn't be sent again. */
|
|
246
|
+
readonly retry: string;
|
|
247
|
+
/** Names the button that sends the message. */
|
|
248
|
+
readonly send: string;
|
|
249
|
+
/** Shown under a message of the user's that's being sent. */
|
|
250
|
+
readonly sending: string;
|
|
251
|
+
/** Names the button that stops a reply that's streaming in. */
|
|
252
|
+
readonly stop: string;
|
|
253
|
+
/** Names the group of suggested replies. */
|
|
254
|
+
readonly suggestions: string;
|
|
255
|
+
/**
|
|
256
|
+
* Says who's typing, their names joined in the locale's way ("Ana is typing", "Ana and Ben are typing"), for up to
|
|
257
|
+
* three people.
|
|
258
|
+
*/
|
|
259
|
+
typing(names: string, count: number): string;
|
|
260
|
+
/** Says how many people are typing, for more than three ("4 people are typing"). */
|
|
261
|
+
typingMany(count: number): string;
|
|
262
|
+
/** Names the user's own messages to assistive technology, where others' messages have their author's name. */
|
|
263
|
+
readonly you: string;
|
|
264
|
+
}
|
|
223
265
|
export interface MonaChipMessages {
|
|
224
266
|
removeLabel(label?: string): string;
|
|
225
267
|
}
|
|
@@ -1021,6 +1063,7 @@ export interface MonaLocaleMessages {
|
|
|
1021
1063
|
calendar: MonaCalendarMessages;
|
|
1022
1064
|
card: MonaCardMessages;
|
|
1023
1065
|
chart: MonaChartMessages;
|
|
1066
|
+
chat: MonaChatMessages;
|
|
1024
1067
|
chip: MonaChipMessages;
|
|
1025
1068
|
colorGradient: MonaColorGradientMessages;
|
|
1026
1069
|
colorPalette: MonaColorPaletteMessages;
|
|
@@ -197,6 +197,10 @@ export declare function focusCanReturn(document: Document, ...containers: Readon
|
|
|
197
197
|
* selector matches nothing).
|
|
198
198
|
*/
|
|
199
199
|
export declare function focusElement(host: HTMLElement, element: HTMLElement | ElementRef<HTMLElement> | string): HTMLElement | null;
|
|
200
|
+
/**
|
|
201
|
+
* Transforms a `headingLevel` input: a level from 1 to 6, `null` for no heading at all, and 3 for anything else.
|
|
202
|
+
*/
|
|
203
|
+
export declare function toHeadingLevel(value: unknown): number | null;
|
|
200
204
|
export interface InertOutsideOptions {
|
|
201
205
|
/** Elements that manage themselves, or have to stay usable beside the modal. */
|
|
202
206
|
readonly keep?: (element: Element) => boolean;
|
|
@@ -123,6 +123,25 @@ export declare const MONA_AR_SA_LOCALE: {
|
|
|
123
123
|
zoomedIn: string;
|
|
124
124
|
zoomedOut: string;
|
|
125
125
|
};
|
|
126
|
+
chat: {
|
|
127
|
+
attachFiles: string;
|
|
128
|
+
messageBox: string;
|
|
129
|
+
messages: string;
|
|
130
|
+
newMessage: (name: string, text: string) => string;
|
|
131
|
+
newMessages: string;
|
|
132
|
+
noMessages: string;
|
|
133
|
+
notSent: string;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
removeFile: (name: string) => string;
|
|
136
|
+
retry: string;
|
|
137
|
+
send: string;
|
|
138
|
+
sending: string;
|
|
139
|
+
stop: string;
|
|
140
|
+
suggestions: string;
|
|
141
|
+
typing: (names: string, _count: number) => string;
|
|
142
|
+
typingMany: (count: number) => string;
|
|
143
|
+
you: string;
|
|
144
|
+
};
|
|
126
145
|
chip: {
|
|
127
146
|
removeLabel: (label?: string) => string;
|
|
128
147
|
};
|
|
@@ -123,6 +123,25 @@ export declare const MONA_DE_DE_LOCALE: {
|
|
|
123
123
|
zoomedIn: string;
|
|
124
124
|
zoomedOut: string;
|
|
125
125
|
};
|
|
126
|
+
chat: {
|
|
127
|
+
attachFiles: string;
|
|
128
|
+
messageBox: string;
|
|
129
|
+
messages: string;
|
|
130
|
+
newMessage: (name: string, text: string) => string;
|
|
131
|
+
newMessages: string;
|
|
132
|
+
noMessages: string;
|
|
133
|
+
notSent: string;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
removeFile: (name: string) => string;
|
|
136
|
+
retry: string;
|
|
137
|
+
send: string;
|
|
138
|
+
sending: string;
|
|
139
|
+
stop: string;
|
|
140
|
+
suggestions: string;
|
|
141
|
+
typing: (names: string, count: number) => string;
|
|
142
|
+
typingMany: (count: number) => string;
|
|
143
|
+
you: string;
|
|
144
|
+
};
|
|
126
145
|
chip: {
|
|
127
146
|
removeLabel: (label?: string) => string;
|
|
128
147
|
};
|
|
@@ -123,6 +123,25 @@ export declare const MONA_ES_ES_LOCALE: {
|
|
|
123
123
|
zoomedIn: string;
|
|
124
124
|
zoomedOut: string;
|
|
125
125
|
};
|
|
126
|
+
chat: {
|
|
127
|
+
attachFiles: string;
|
|
128
|
+
messageBox: string;
|
|
129
|
+
messages: string;
|
|
130
|
+
newMessage: (name: string, text: string) => string;
|
|
131
|
+
newMessages: string;
|
|
132
|
+
noMessages: string;
|
|
133
|
+
notSent: string;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
removeFile: (name: string) => string;
|
|
136
|
+
retry: string;
|
|
137
|
+
send: string;
|
|
138
|
+
sending: string;
|
|
139
|
+
stop: string;
|
|
140
|
+
suggestions: string;
|
|
141
|
+
typing: (names: string, count: number) => string;
|
|
142
|
+
typingMany: (count: number) => string;
|
|
143
|
+
you: string;
|
|
144
|
+
};
|
|
126
145
|
chip: {
|
|
127
146
|
removeLabel: (label?: string) => string;
|
|
128
147
|
};
|
|
@@ -123,6 +123,25 @@ export declare const MONA_FR_FR_LOCALE: {
|
|
|
123
123
|
zoomedIn: string;
|
|
124
124
|
zoomedOut: string;
|
|
125
125
|
};
|
|
126
|
+
chat: {
|
|
127
|
+
attachFiles: string;
|
|
128
|
+
messageBox: string;
|
|
129
|
+
messages: string;
|
|
130
|
+
newMessage: (name: string, text: string) => string;
|
|
131
|
+
newMessages: string;
|
|
132
|
+
noMessages: string;
|
|
133
|
+
notSent: string;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
removeFile: (name: string) => string;
|
|
136
|
+
retry: string;
|
|
137
|
+
send: string;
|
|
138
|
+
sending: string;
|
|
139
|
+
stop: string;
|
|
140
|
+
suggestions: string;
|
|
141
|
+
typing: (names: string, count: number) => string;
|
|
142
|
+
typingMany: (count: number) => string;
|
|
143
|
+
you: string;
|
|
144
|
+
};
|
|
126
145
|
chip: {
|
|
127
146
|
removeLabel: (label?: string) => string;
|
|
128
147
|
};
|
|
@@ -123,6 +123,25 @@ export declare const MONA_ID_ID_LOCALE: {
|
|
|
123
123
|
zoomedIn: string;
|
|
124
124
|
zoomedOut: string;
|
|
125
125
|
};
|
|
126
|
+
chat: {
|
|
127
|
+
attachFiles: string;
|
|
128
|
+
messageBox: string;
|
|
129
|
+
messages: string;
|
|
130
|
+
newMessage: (name: string, text: string) => string;
|
|
131
|
+
newMessages: string;
|
|
132
|
+
noMessages: string;
|
|
133
|
+
notSent: string;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
removeFile: (name: string) => string;
|
|
136
|
+
retry: string;
|
|
137
|
+
send: string;
|
|
138
|
+
sending: string;
|
|
139
|
+
stop: string;
|
|
140
|
+
suggestions: string;
|
|
141
|
+
typing: (names: string, _count: number) => string;
|
|
142
|
+
typingMany: (count: number) => string;
|
|
143
|
+
you: string;
|
|
144
|
+
};
|
|
126
145
|
chip: {
|
|
127
146
|
removeLabel: (label?: string) => string;
|
|
128
147
|
};
|
|
@@ -123,6 +123,25 @@ export declare const MONA_IT_IT_LOCALE: {
|
|
|
123
123
|
zoomedIn: string;
|
|
124
124
|
zoomedOut: string;
|
|
125
125
|
};
|
|
126
|
+
chat: {
|
|
127
|
+
attachFiles: string;
|
|
128
|
+
messageBox: string;
|
|
129
|
+
messages: string;
|
|
130
|
+
newMessage: (name: string, text: string) => string;
|
|
131
|
+
newMessages: string;
|
|
132
|
+
noMessages: string;
|
|
133
|
+
notSent: string;
|
|
134
|
+
placeholder: string;
|
|
135
|
+
removeFile: (name: string) => string;
|
|
136
|
+
retry: string;
|
|
137
|
+
send: string;
|
|
138
|
+
sending: string;
|
|
139
|
+
stop: string;
|
|
140
|
+
suggestions: string;
|
|
141
|
+
typing: (names: string, count: number) => string;
|
|
142
|
+
typingMany: (count: number) => string;
|
|
143
|
+
you: string;
|
|
144
|
+
};
|
|
126
145
|
chip: {
|
|
127
146
|
removeLabel: (label?: string) => string;
|
|
128
147
|
};
|