@nanahoshi/mona-ui 0.44.0 → 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.
Files changed (59) hide show
  1. package/chat/package.json +4 -0
  2. package/docs/api/chat.json +1 -0
  3. package/docs/api/chat.md +212 -0
  4. package/docs/api/i18n.json +1 -1
  5. package/docs/api/i18n.md +34 -0
  6. package/docs/api/index.json +1 -1
  7. package/docs/api/locales.json +1 -1
  8. package/docs/api/locales.md +14 -14
  9. package/docs/chat.md +480 -0
  10. package/docs/manifest.json +1 -1
  11. package/fesm2022/nanahoshi-mona-ui-chat.mjs +1230 -0
  12. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +37 -0
  13. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +19 -0
  14. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +19 -0
  15. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +19 -0
  16. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +19 -0
  17. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +19 -0
  18. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +19 -0
  19. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +19 -0
  20. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +19 -0
  21. package/fesm2022/nanahoshi-mona-ui-locales-pl-pl.mjs +29 -0
  22. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +19 -0
  23. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +29 -0
  24. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +19 -0
  25. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +19 -0
  26. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +19 -0
  27. package/i18n/catalogs/en-US.messages.json +19 -0
  28. package/llms.txt +6 -1
  29. package/locales/ar-sa/ar-sa.messages.json +19 -0
  30. package/locales/de-de/de-de.messages.json +19 -0
  31. package/locales/es-es/es-es.messages.json +19 -0
  32. package/locales/fr-fr/fr-fr.messages.json +19 -0
  33. package/locales/id-id/id-id.messages.json +19 -0
  34. package/locales/it-it/it-it.messages.json +19 -0
  35. package/locales/ja-jp/ja-jp.messages.json +19 -0
  36. package/locales/ko-kr/ko-kr.messages.json +19 -0
  37. package/locales/pl-pl/pl-pl.messages.json +19 -0
  38. package/locales/pt-br/pt-br.messages.json +19 -0
  39. package/locales/ru-ru/ru-ru.messages.json +19 -0
  40. package/locales/tr-tr/tr-tr.messages.json +19 -0
  41. package/locales/zh-cn/zh-cn.messages.json +19 -0
  42. package/locales/zh-tw/zh-tw.messages.json +19 -0
  43. package/package.json +5 -1
  44. package/types/nanahoshi-mona-ui-chat.d.ts +424 -0
  45. package/types/nanahoshi-mona-ui-i18n.d.ts +43 -0
  46. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +19 -0
  47. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +19 -0
  48. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +19 -0
  49. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +19 -0
  50. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +19 -0
  51. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +19 -0
  52. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +19 -0
  53. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +19 -0
  54. package/types/nanahoshi-mona-ui-locales-pl-pl.d.ts +19 -0
  55. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +19 -0
  56. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +19 -0
  57. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +19 -0
  58. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +19 -0
  59. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +19 -0
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "拡大しました",
121
121
  "zoomedOut": "縮小しました"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "ファイルを添付",
125
+ "messageBox": "メッセージ",
126
+ "messages": "メッセージ",
127
+ "newMessage": "{name}:{text}",
128
+ "newMessages": "新しいメッセージ",
129
+ "noMessages": "まだメッセージはありません",
130
+ "notSent": "送信できませんでした",
131
+ "placeholder": "メッセージを入力",
132
+ "removeFile": "{name} を削除",
133
+ "retry": "再試行",
134
+ "send": "送信",
135
+ "sending": "送信中",
136
+ "stop": "停止",
137
+ "suggestions": "返信の候補",
138
+ "typing": "{count, plural, other {{names} が入力中です}}",
139
+ "typingMany": "{count, plural, other {# 人が入力中です}}",
140
+ "you": "あなた"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {項目を削除} other {{label}を削除}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "확대됨",
121
121
  "zoomedOut": "축소됨"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "파일 첨부",
125
+ "messageBox": "메시지",
126
+ "messages": "메시지",
127
+ "newMessage": "{name}: {text}",
128
+ "newMessages": "새 메시지",
129
+ "noMessages": "아직 메시지가 없습니다",
130
+ "notSent": "전송되지 않음",
131
+ "placeholder": "메시지 입력",
132
+ "removeFile": "{name} 제거",
133
+ "retry": "다시 시도",
134
+ "send": "보내기",
135
+ "sending": "보내는 중",
136
+ "stop": "중지",
137
+ "suggestions": "추천 답장",
138
+ "typing": "{count, plural, other {{names} 님이 입력 중입니다}}",
139
+ "typingMany": "{count, plural, other {#명이 입력 중입니다}}",
140
+ "you": "나"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {항목 삭제} other {{label} 삭제}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "Powiększono",
121
121
  "zoomedOut": "Pomniejszono"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "Załącz pliki",
125
+ "messageBox": "Wiadomość",
126
+ "messages": "Wiadomości",
127
+ "newMessage": "{name}: {text}",
128
+ "newMessages": "Nowe wiadomości",
129
+ "noMessages": "Brak wiadomości",
130
+ "notSent": "Nie wysłano",
131
+ "placeholder": "Wpisz wiadomość",
132
+ "removeFile": "Usuń {name}",
133
+ "retry": "Spróbuj ponownie",
134
+ "send": "Wyślij",
135
+ "sending": "Wysyłanie",
136
+ "stop": "Zatrzymaj",
137
+ "suggestions": "Sugerowane odpowiedzi",
138
+ "typing": "{count, plural, one {{names} pisze} few {{names} piszą} many {{names} piszą} other {{names} piszą}}",
139
+ "typingMany": "{count, plural, one {# osoba pisze} few {# osoby piszą} many {# osób pisze} other {# osoby piszą}}",
140
+ "you": "Ty"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {Usuń element} other {Usuń {label}}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "Ampliado",
121
121
  "zoomedOut": "Reduzido"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "Anexar arquivos",
125
+ "messageBox": "Mensagem",
126
+ "messages": "Mensagens",
127
+ "newMessage": "{name}: {text}",
128
+ "newMessages": "Novas mensagens",
129
+ "noMessages": "Nenhuma mensagem ainda",
130
+ "notSent": "Não enviada",
131
+ "placeholder": "Digite uma mensagem",
132
+ "removeFile": "Remover {name}",
133
+ "retry": "Tentar novamente",
134
+ "send": "Enviar",
135
+ "sending": "Enviando",
136
+ "stop": "Parar",
137
+ "suggestions": "Respostas sugeridas",
138
+ "typing": "{count, plural, =1 {{names} está digitando} other {{names} estão digitando}}",
139
+ "typingMany": "{count, plural, =1 {# pessoa está digitando} other {# pessoas estão digitando}}",
140
+ "you": "Você"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {Remover item} other {Remover {label}}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "Масштаб увеличен",
121
121
  "zoomedOut": "Масштаб уменьшен"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "Прикрепить файлы",
125
+ "messageBox": "Сообщение",
126
+ "messages": "Сообщения",
127
+ "newMessage": "{name}: {text}",
128
+ "newMessages": "Новые сообщения",
129
+ "noMessages": "Сообщений пока нет",
130
+ "notSent": "Не отправлено",
131
+ "placeholder": "Введите сообщение",
132
+ "removeFile": "Удалить {name}",
133
+ "retry": "Повторить",
134
+ "send": "Отправить",
135
+ "sending": "Отправка",
136
+ "stop": "Остановить",
137
+ "suggestions": "Предлагаемые ответы",
138
+ "typing": "{count, plural, one {{names} печатает} few {{names} печатают} many {{names} печатают} other {{names} печатают}}",
139
+ "typingMany": "{count, plural, one {# человек печатает} few {# человека печатают} many {# человек печатают} other {# человека печатают}}",
140
+ "you": "Вы"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {Удалить элемент} other {Удалить {label}}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "Yakınlaştırıldı",
121
121
  "zoomedOut": "Uzaklaştırıldı"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "Dosya ekle",
125
+ "messageBox": "Mesaj",
126
+ "messages": "Mesajlar",
127
+ "newMessage": "{name}: {text}",
128
+ "newMessages": "Yeni mesajlar",
129
+ "noMessages": "Henüz mesaj yok",
130
+ "notSent": "Gönderilemedi",
131
+ "placeholder": "Bir mesaj yazın",
132
+ "removeFile": "{name} öğesini kaldır",
133
+ "retry": "Yeniden dene",
134
+ "send": "Gönder",
135
+ "sending": "Gönderiliyor",
136
+ "stop": "Durdur",
137
+ "suggestions": "Önerilen yanıtlar",
138
+ "typing": "{count, plural, other {{names} yazıyor}}",
139
+ "typingMany": "{count, plural, other {# kişi yazıyor}}",
140
+ "you": "Siz"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {Öğeyi kaldır} other {{label} öğesini kaldır}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "已放大",
121
121
  "zoomedOut": "已缩小"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "附加文件",
125
+ "messageBox": "消息",
126
+ "messages": "消息",
127
+ "newMessage": "{name}:{text}",
128
+ "newMessages": "新消息",
129
+ "noMessages": "还没有消息",
130
+ "notSent": "未发送",
131
+ "placeholder": "输入消息",
132
+ "removeFile": "移除 {name}",
133
+ "retry": "重试",
134
+ "send": "发送",
135
+ "sending": "正在发送",
136
+ "stop": "停止",
137
+ "suggestions": "建议回复",
138
+ "typing": "{count, plural, other {{names} 正在输入}}",
139
+ "typingMany": "{count, plural, other {# 人正在输入}}",
140
+ "you": "你"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {删除项目} other {删除{label}}}"
125
144
  },
@@ -120,6 +120,25 @@
120
120
  "zoomedIn": "已放大",
121
121
  "zoomedOut": "已縮小"
122
122
  },
123
+ "chat": {
124
+ "attachFiles": "附加檔案",
125
+ "messageBox": "訊息",
126
+ "messages": "訊息",
127
+ "newMessage": "{name}:{text}",
128
+ "newMessages": "新訊息",
129
+ "noMessages": "還沒有訊息",
130
+ "notSent": "未傳送",
131
+ "placeholder": "輸入訊息",
132
+ "removeFile": "移除 {name}",
133
+ "retry": "重試",
134
+ "send": "傳送",
135
+ "sending": "正在傳送",
136
+ "stop": "停止",
137
+ "suggestions": "建議回覆",
138
+ "typing": "{count, plural, other {{names} 正在輸入}}",
139
+ "typingMany": "{count, plural, other {# 人正在輸入}}",
140
+ "you": "你"
141
+ },
123
142
  "chip": {
124
143
  "removeLabel": "{label, select, undefined {移除項目} other {移除{label}}}"
125
144
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanahoshi/mona-ui",
3
- "version": "0.44.0",
3
+ "version": "0.45.0",
4
4
  "description": "A very light Angular UI framework",
5
5
  "author": "Nanahoshi",
6
6
  "repository": {
@@ -58,6 +58,10 @@
58
58
  "types": "./types/nanahoshi-mona-ui-chart.d.ts",
59
59
  "default": "./fesm2022/nanahoshi-mona-ui-chart.mjs"
60
60
  },
61
+ "./chat": {
62
+ "types": "./types/nanahoshi-mona-ui-chat.d.ts",
63
+ "default": "./fesm2022/nanahoshi-mona-ui-chat.mjs"
64
+ },
61
65
  "./check-box": {
62
66
  "types": "./types/nanahoshi-mona-ui-check-box.d.ts",
63
67
  "default": "./fesm2022/nanahoshi-mona-ui-check-box.mjs"
@@ -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 };