@tano.page/workbench 0.14.0 → 0.16.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 (248) hide show
  1. package/package.json +50 -16
  2. package/src/App.vue +82 -752
  3. package/src/appearance/appearance.ts +14 -4
  4. package/src/appearance/components/ThemePresetPreview.vue +52 -8
  5. package/src/appearance/interface-font.ts +99 -0
  6. package/src/appearance/theme.ts +26 -10
  7. package/src/appearance/use-interface-font.ts +30 -0
  8. package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
  9. package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
  10. package/src/assets/mail-provider-icons/gmail.svg +1 -0
  11. package/src/assets/mail-provider-icons/icloud.svg +12 -0
  12. package/src/assets/mail-provider-icons/netease-126.svg +5 -0
  13. package/src/assets/mail-provider-icons/netease-163.svg +5 -0
  14. package/src/assets/mail-provider-icons/qq.svg +9 -0
  15. package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
  16. package/src/assistant/agent-identities.ts +1 -97
  17. package/src/assistant/agent-task-context.ts +1 -54
  18. package/src/assistant/attachments.ts +1 -1
  19. package/src/assistant/completion.ts +1 -61
  20. package/src/assistant/components/AssistantChangeList.vue +98 -21
  21. package/src/assistant/components/AssistantPanel.vue +425 -8
  22. package/src/assistant/components/PluginToolProposalCard.vue +235 -0
  23. package/src/assistant/connection-actions.ts +237 -0
  24. package/src/assistant/document-mentions.ts +1 -33
  25. package/src/assistant/engine.ts +1 -532
  26. package/src/assistant/execution.ts +6 -33
  27. package/src/assistant/files.ts +5 -13
  28. package/src/assistant/hash.ts +1 -4
  29. package/src/assistant/inbox.ts +1 -148
  30. package/src/assistant/language.ts +10 -37
  31. package/src/assistant/mention-autocomplete.ts +69 -0
  32. package/src/assistant/plugin-bridge-builder.ts +146 -0
  33. package/src/assistant/prompts.ts +1 -58
  34. package/src/assistant/proposal-actions.ts +336 -0
  35. package/src/assistant/results.ts +20 -86
  36. package/src/assistant/store.ts +167 -327
  37. package/src/assistant/structures.ts +1 -155
  38. package/src/assistant/tasks.ts +8 -96
  39. package/src/assistant/tool-rules.ts +1 -7
  40. package/src/assistant/workspace-bridge.ts +1 -1
  41. package/src/composables/use-document-actions.ts +38 -20
  42. package/src/composables/use-file-tree-controller.ts +7 -12
  43. package/src/composables/use-workbench-help.ts +177 -0
  44. package/src/composables/use-workbench-history.ts +2 -4
  45. package/src/composables/use-workbench-lifecycle.ts +249 -0
  46. package/src/composables/use-workbench-modals.ts +6 -1
  47. package/src/composables/use-workbench-outline.ts +0 -5
  48. package/src/composables/use-workbench-settings.ts +185 -0
  49. package/src/composables/use-workbench-shortcuts.ts +40 -1021
  50. package/src/composables/use-workbench-views.ts +325 -0
  51. package/src/data-tables/data-tables.ts +1 -2
  52. package/src/documents/components/DocumentActionMenu.vue +279 -0
  53. package/src/documents/components/DocumentHistoryPanel.vue +3 -1
  54. package/src/documents/components/DocumentInspector.vue +168 -0
  55. package/src/documents/components/DocumentPane.vue +482 -0
  56. package/src/documents/description-merge.ts +1 -9
  57. package/src/features.ts +1 -0
  58. package/src/files/components/FileMetadataPanel.vue +49 -15
  59. package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
  60. package/src/fonts/Inter-Latin.woff2 +0 -0
  61. package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
  62. package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
  63. package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
  64. package/src/help/help-milestones.ts +3 -5
  65. package/src/i18n/locale-catalogs.ts +7 -6
  66. package/src/i18n/locale-registry.ts +8 -6
  67. package/src/i18n/locales/de-DE.json +371 -3
  68. package/src/i18n/locales/en-US.json +371 -2
  69. package/src/i18n/locales/es-ES.json +371 -3
  70. package/src/i18n/locales/ja-JP.json +370 -2
  71. package/src/i18n/locales/zh-TW.json +370 -2
  72. package/src/mail/components/MailAccountDialog.vue +450 -0
  73. package/src/mail/components/MailComposerDialog.vue +326 -0
  74. package/src/mail/components/MailProviderIcon.vue +30 -0
  75. package/src/mail/components/MailWorkspaceView.vue +821 -0
  76. package/src/mail/components/SidebarMail.vue +134 -0
  77. package/src/mail/mail-avatar.ts +17 -0
  78. package/src/mail/mail-bridge.ts +68 -0
  79. package/src/mail/mail-calendar.ts +208 -0
  80. package/src/mail/mail-markdown.ts +195 -0
  81. package/src/mail/types.ts +226 -0
  82. package/src/objects/components/ObjectDetailModal.vue +1001 -0
  83. package/src/objects/content-references.ts +6 -56
  84. package/src/objects/wiki-links.ts +1 -48
  85. package/src/objects/workspace-objects.ts +3 -4
  86. package/src/plan-sync/types.ts +6 -3
  87. package/src/plans/calendar-interaction.ts +194 -0
  88. package/src/plans/calendar.ts +65 -9
  89. package/src/plans/components/CalendarAgendaView.vue +165 -0
  90. package/src/plans/components/CalendarDayPopover.vue +172 -39
  91. package/src/plans/components/CalendarFilterBar.vue +128 -0
  92. package/src/plans/components/CalendarMonthView.vue +224 -0
  93. package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
  94. package/src/plans/components/CalendarTimelineView.vue +517 -0
  95. package/src/plans/components/CalendarTopbarControls.vue +101 -0
  96. package/src/plans/components/CalendarView.vue +264 -748
  97. package/src/plans/components/CalendarYearView.vue +138 -0
  98. package/src/plans/components/PlanArchiveDialog.vue +295 -0
  99. package/src/plans/components/PlanConnectionsDialog.vue +1 -1
  100. package/src/plans/components/PlanDateField.vue +6 -4
  101. package/src/plans/components/PlanDetailPanel.vue +227 -32
  102. package/src/plans/components/PlanEventList.vue +16 -4
  103. package/src/plans/components/SidebarPlan.vue +22 -15
  104. package/src/plans/components/TaskRepeatControls.vue +169 -30
  105. package/src/plans/components/calendar-shared.css +192 -0
  106. package/src/plans/composables/use-calendar-interactions.ts +396 -0
  107. package/src/plans/composables/use-calendar-scroll.ts +420 -0
  108. package/src/plans/local-reminders.ts +149 -0
  109. package/src/plans/personal-plans.ts +10 -1
  110. package/src/plans/plan-date.ts +8 -1
  111. package/src/plans/plan-migration.ts +95 -0
  112. package/src/plans/recurrence.ts +95 -0
  113. package/src/plans/task-repeat.ts +8 -8
  114. package/src/plans/timeline-layout.ts +92 -0
  115. package/src/plugins/assistant-bridge.ts +520 -0
  116. package/src/plugins/attachment-reader.ts +3 -1
  117. package/src/plugins/cache-storage.ts +42 -2
  118. package/src/plugins/components/PluginAutomations.vue +3 -3
  119. package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
  120. package/src/plugins/components/PluginChangeSummary.vue +16 -3
  121. package/src/plugins/components/PluginConnections.vue +1 -1
  122. package/src/plugins/components/PluginCustomView.vue +2 -2
  123. package/src/plugins/components/PluginDetailPage.vue +136 -57
  124. package/src/plugins/components/PluginDeveloperArea.vue +192 -0
  125. package/src/plugins/components/PluginDocumentSlot.vue +63 -0
  126. package/src/plugins/components/PluginExplorer.vue +21 -25
  127. package/src/plugins/components/PluginImportDialog.vue +410 -0
  128. package/src/plugins/components/PluginInstaller.vue +273 -288
  129. package/src/plugins/components/PluginListItem.vue +3 -0
  130. package/src/plugins/components/PluginMaintenance.vue +37 -34
  131. package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
  132. package/src/plugins/components/PluginRuntimePanel.vue +3 -3
  133. package/src/plugins/components/PluginSettingsForm.vue +112 -0
  134. package/src/plugins/components/PluginStatusBar.vue +161 -0
  135. package/src/plugins/components/PluginSurface.vue +18 -6
  136. package/src/plugins/components/PluginUiDialog.vue +452 -0
  137. package/src/plugins/components/PluginsTabPage.vue +61 -0
  138. package/src/plugins/components/plugin-center.css +5 -0
  139. package/src/plugins/data.ts +9 -86
  140. package/src/plugins/editor-plugin-adapters.ts +169 -0
  141. package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
  142. package/src/plugins/excalidraw/manifest.json +12 -1
  143. package/src/plugins/host.ts +662 -43
  144. package/src/plugins/native.ts +2 -10
  145. package/src/plugins/overlay-mapping.ts +125 -0
  146. package/src/plugins/packages.ts +73 -1
  147. package/src/plugins/plugin-data.ts +2 -3
  148. package/src/plugins/plugin-permissions.ts +57 -0
  149. package/src/plugins/plugin-rpc-router.ts +558 -0
  150. package/src/plugins/plugin-sdk.ts +1 -94
  151. package/src/plugins/plugin-ui-dialogs.ts +167 -0
  152. package/src/plugins/policy.ts +53 -3
  153. package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
  154. package/src/plugins/presentation-preview/manifest.json +2 -1
  155. package/src/plugins/queries.ts +1 -73
  156. package/src/plugins/sandbox.ts +15 -1
  157. package/src/plugins/use-plugin-actions.ts +67 -20
  158. package/src/plugins/user-plugins.ts +254 -0
  159. package/src/plugins/view-header.ts +2 -7
  160. package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
  161. package/src/plugins/word-preview/manifest.json +13 -1
  162. package/src/plugins/workbench.ts +175 -2
  163. package/src/plugins/worker.js +105 -8
  164. package/src/plugins/workspace-plugin-runtime.ts +23 -7
  165. package/src/plugins/workspace-plugins.ts +212 -21
  166. package/src/runtime.ts +103 -4
  167. package/src/settings/components/SettingsAppearancePage.vue +46 -0
  168. package/src/settings/components/SettingsDocumentsPage.vue +0 -1
  169. package/src/settings/components/SettingsPanel.vue +8 -3
  170. package/src/settings/components/WorkbenchSettings.vue +20 -7
  171. package/src/settings/components/settings-context.ts +1 -1
  172. package/src/settings/components/settings-search.ts +2 -3
  173. package/src/settings/settings-tab.ts +1 -0
  174. package/src/shell/command-palette.ts +3 -3
  175. package/src/shell/components/EditorToolbar.vue +8 -9
  176. package/src/shell/components/EditorTools.vue +1 -5
  177. package/src/shell/components/PaneTopbar.vue +393 -0
  178. package/src/shell/components/SelectionToolbar.vue +0 -2
  179. package/src/shell/components/SidebarNavigation.vue +22 -2
  180. package/src/shell/components/WorkbenchContextMenus.vue +58 -34
  181. package/src/shell/components/WorkbenchModals.vue +47 -62
  182. package/src/shell/components/WorkbenchPanes.vue +371 -1342
  183. package/src/shell/components/WorkbenchSidebar.vue +486 -0
  184. package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
  185. package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
  186. package/src/shell/pane-registry.ts +69 -0
  187. package/src/shell/use-surface-dismissal.ts +219 -0
  188. package/src/shell/use-workbench-commands.ts +599 -0
  189. package/src/shell/use-workbench-keybindings.ts +337 -0
  190. package/src/shell/use-workbench.ts +531 -1153
  191. package/src/shell/workbench-async-components.ts +14 -5
  192. package/src/shell/workbench-context.ts +30 -3
  193. package/src/stores/mail.ts +414 -0
  194. package/src/stores/plan-sync.ts +2 -1
  195. package/src/stores/plans.ts +2 -9
  196. package/src/stores/workspace-document-io.ts +807 -0
  197. package/src/stores/workspace-file-ops.ts +1 -1
  198. package/src/stores/workspace-knowledge.ts +2 -114
  199. package/src/stores/workspace-lifecycle.ts +459 -0
  200. package/src/stores/workspace-plugins-state.ts +254 -259
  201. package/src/stores/workspace-session.ts +287 -0
  202. package/src/stores/workspace-tabs-layout.ts +6 -44
  203. package/src/stores/workspace-types.ts +50 -0
  204. package/src/stores/workspace.ts +184 -1363
  205. package/src/styles/agent-diff-modals.css +0 -7
  206. package/src/styles/dark-theme.css +3 -3
  207. package/src/styles/inspector.css +0 -59
  208. package/src/styles/layout-themes.css +346 -0
  209. package/src/styles/mail.css +1568 -0
  210. package/src/styles/mobile.css +2 -2
  211. package/src/styles/recent-and-media.css +0 -17
  212. package/src/styles/theme-contract.css +3 -3
  213. package/src/styles/workbench-shell.css +110 -17
  214. package/src/styles/workspace-states.css +9 -33
  215. package/src/styles.css +0 -1
  216. package/src/tabs/components/DesktopTabs.vue +19 -14
  217. package/src/tabs/components/NewTabPicker.vue +10 -4
  218. package/src/tabs/tab-label.ts +0 -1
  219. package/src/windows/AuxiliaryWindows.vue +2 -2
  220. package/src/windows/use-window-event-bridge.ts +152 -0
  221. package/src/workspace/components/TemplateLibrary.vue +1 -1
  222. package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
  223. package/src/workspace/components/WorkspaceIconPicker.vue +30 -7
  224. package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
  225. package/src/workspace/workspace-comments.ts +11 -151
  226. package/src/workspace/workspace-welcome.ts +1 -1
  227. package/src/assistant/locales/de-DE.json +0 -126
  228. package/src/assistant/locales/en-US.json +0 -126
  229. package/src/assistant/locales/es-ES.json +0 -126
  230. package/src/assistant/locales/ja-JP.json +0 -126
  231. package/src/assistant/locales/zh-CN.json +0 -126
  232. package/src/assistant/locales/zh-TW.json +0 -126
  233. package/src/assistant/task-prompts.json +0 -39
  234. package/src/documents/components/FormulaMenu.vue +0 -50
  235. package/src/files/components/FileDatabasePage.vue +0 -152
  236. package/src/files/components/FolderHomeIcon.vue +0 -12
  237. package/src/objects/components/ObjectDatabasePage.vue +0 -100
  238. package/src/objects/components/ObjectPanel.vue +0 -554
  239. package/src/plans/components/PersonalPlanDialog.vue +0 -105
  240. package/src/shell/components/WorkspaceViewPage.vue +0 -127
  241. package/src/shell/components/WorkspaceViewTab.vue +0 -24
  242. package/src/styles/object-panel.css +0 -163
  243. package/src/workspace/components/GitInspectionPanel.vue +0 -35
  244. package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
  245. package/src/workspace/welcome-slogans.ts +0 -11
  246. package/src/workspace/workspace-git.ts +0 -35
  247. package/src/workspace/workspace-sync.ts +0 -46
  248. package/src/workspace/workspace-views.ts +0 -48
@@ -0,0 +1,326 @@
1
+ <script setup lang="ts">
2
+ import '../../styles/mail.css';
3
+ import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
4
+ import { AlertTriangle, Paperclip, Send, X } from 'lucide-vue-next';
5
+ import { t } from '../../i18n/i18n';
6
+ import { useMailStore } from '../../stores/mail';
7
+ import { markdownToEmailHtml } from '../mail-markdown';
8
+ import type { MailSendAttachment } from '../types';
9
+
10
+ const mail = useMailStore();
11
+
12
+ const accountId = ref('');
13
+ const toText = ref('');
14
+ const ccText = ref('');
15
+ const bccText = ref('');
16
+ const showCcBcc = ref(false);
17
+ const subject = ref('');
18
+ const markdownBody = ref('');
19
+ const attachments = ref<MailSendAttachment[]>([]);
20
+ const sending = ref(false);
21
+ const savingDraft = ref(false);
22
+ const error = ref('');
23
+ const fileInput = ref<HTMLInputElement>();
24
+
25
+ watch(
26
+ () => [mail.composerOpen, mail.composeSeed] as const,
27
+ ([open, seed]) => {
28
+ if (!open) return;
29
+ accountId.value = seed?.accountId || mail.accounts[0]?.id || '';
30
+ toText.value = (seed?.to ?? []).join(', ');
31
+ ccText.value = (seed?.cc ?? []).join(', ');
32
+ bccText.value = '';
33
+ showCcBcc.value = Boolean(seed?.cc?.length);
34
+ subject.value = seed?.subject ?? '';
35
+ markdownBody.value = seed?.markdownBody ?? '';
36
+ attachments.value = [...(seed?.attachments ?? [])];
37
+ error.value = '';
38
+ },
39
+ { immediate: true },
40
+ );
41
+
42
+ function parseAddressInput(raw: string): string[] {
43
+ return raw
44
+ .split(/[,;\n]+/)
45
+ .map((item) => item.trim())
46
+ .filter(Boolean);
47
+ }
48
+
49
+ async function onPickFiles(event: Event) {
50
+ await addFiles(Array.from((event.target as HTMLInputElement).files ?? []));
51
+ (event.target as HTMLInputElement).value = '';
52
+ }
53
+
54
+ const dragOver = ref(false);
55
+ async function onDrop(event: DragEvent) {
56
+ dragOver.value = false;
57
+ const files = Array.from(event.dataTransfer?.files ?? []);
58
+ if (files.length) await addFiles(files);
59
+ }
60
+
61
+ async function addFiles(files: File[]) {
62
+ for (const file of files) {
63
+ if (file.size > 25 * 1024 * 1024) {
64
+ error.value = t('单个附件不能超过 25 MiB:{0}', [file.name]);
65
+ continue;
66
+ }
67
+ const buffer = await file.arrayBuffer();
68
+ const bytes = new Uint8Array(buffer);
69
+ let binary = '';
70
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]!);
71
+ attachments.value.push({
72
+ filename: file.name,
73
+ contentType: file.type || 'application/octet-stream',
74
+ bytesBase64: btoa(binary),
75
+ });
76
+ }
77
+ }
78
+
79
+ function close() {
80
+ if (sending.value) return;
81
+ mail.closeComposer();
82
+ }
83
+
84
+ function onKeydown(event: KeyboardEvent) {
85
+ if (!mail.composerOpen) return;
86
+ if (event.key === 'Escape') {
87
+ event.stopPropagation();
88
+ close();
89
+ } else if (event.key === 'Enter' && (event.ctrlKey || event.metaKey) && !sending.value) {
90
+ event.preventDefault();
91
+ void send();
92
+ }
93
+ }
94
+ onMounted(() => window.addEventListener('keydown', onKeydown, true));
95
+ onBeforeUnmount(() => window.removeEventListener('keydown', onKeydown, true));
96
+
97
+ // Land the caret where the user would type first: recipients, else the body.
98
+ const toInput = ref<HTMLInputElement>();
99
+ const bodyInput = ref<HTMLTextAreaElement>();
100
+ watch(
101
+ () => mail.composerOpen,
102
+ async (open) => {
103
+ if (!open) return;
104
+ await nextTick();
105
+ if (!toText.value) toInput.value?.focus();
106
+ else {
107
+ bodyInput.value?.focus();
108
+ bodyInput.value?.setSelectionRange(0, 0);
109
+ }
110
+ },
111
+ { immediate: true },
112
+ );
113
+
114
+ function formatAttachmentSize(base64: string): string {
115
+ const bytes = Math.floor((base64.length * 3) / 4);
116
+ if (bytes < 1024) return `${bytes} B`;
117
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
118
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
119
+ }
120
+
121
+ function removeAttachment(index: number) {
122
+ attachments.value.splice(index, 1);
123
+ }
124
+
125
+ async function saveLocalDraft() {
126
+ if (!accountId.value) return;
127
+ savingDraft.value = true;
128
+ error.value = '';
129
+ try {
130
+ await mail.saveDraft({
131
+ id: '',
132
+ accountId: accountId.value,
133
+ to: parseAddressInput(toText.value),
134
+ cc: parseAddressInput(ccText.value),
135
+ bcc: parseAddressInput(bccText.value),
136
+ subject: subject.value,
137
+ markdownBody: markdownBody.value,
138
+ inReplyTo: mail.composeSeed?.inReplyTo ?? null,
139
+ references: mail.composeSeed?.references ?? [],
140
+ updatedAt: 0,
141
+ });
142
+ mail.closeComposer();
143
+ } catch (err) {
144
+ error.value = err instanceof Error ? err.message : String(err);
145
+ } finally {
146
+ savingDraft.value = false;
147
+ }
148
+ }
149
+
150
+ async function send() {
151
+ if (!accountId.value) {
152
+ error.value = t('请先选择发件邮箱');
153
+ return;
154
+ }
155
+ const to = parseAddressInput(toText.value);
156
+ const cc = parseAddressInput(ccText.value);
157
+ const bcc = parseAddressInput(bccText.value);
158
+ if (!to.length && !cc.length && !bcc.length) {
159
+ error.value = t('请至少填写一位收件人');
160
+ return;
161
+ }
162
+ sending.value = true;
163
+ error.value = '';
164
+ try {
165
+ await mail.sendMail({
166
+ accountId: accountId.value,
167
+ to,
168
+ cc,
169
+ bcc,
170
+ subject: subject.value.trim() || t('(无主题)'),
171
+ textBody: markdownBody.value,
172
+ htmlBody: markdownToEmailHtml(markdownBody.value),
173
+ inReplyTo: mail.composeSeed?.inReplyTo ?? undefined,
174
+ references: mail.composeSeed?.references,
175
+ attachments: attachments.value,
176
+ });
177
+ mail.closeComposer();
178
+ } catch (err) {
179
+ error.value = err instanceof Error ? err.message : String(err);
180
+ } finally {
181
+ sending.value = false;
182
+ }
183
+ }
184
+ </script>
185
+
186
+ <template>
187
+ <Transition name="mail-modal">
188
+ <div
189
+ v-if="mail.composerOpen"
190
+ class="mail-modal-backdrop"
191
+ @mousedown.self="close"
192
+ >
193
+ <section
194
+ class="mail-modal mail-composer-modal"
195
+ :class="{ 'drag-over': dragOver }"
196
+ role="dialog"
197
+ aria-modal="true"
198
+ :aria-label="t('撰写邮件')"
199
+ @dragover.prevent="dragOver = true"
200
+ @dragleave.self="dragOver = false"
201
+ @drop.prevent="onDrop"
202
+ >
203
+ <header class="mail-modal-header compact">
204
+ <h2>{{ subject.trim() || t('撰写邮件') }}</h2>
205
+ <button
206
+ type="button"
207
+ class="icon-button"
208
+ :disabled="sending"
209
+ :aria-label="t('关闭')"
210
+ :data-tooltip="t('关闭')"
211
+ @click="close"
212
+ >
213
+ <X :size="16" />
214
+ </button>
215
+ </header>
216
+
217
+ <div class="mail-composer-fields">
218
+ <label v-if="mail.accounts.length > 1" class="mail-composer-row">
219
+ <span>{{ t('发件人') }}</span>
220
+ <select v-model="accountId">
221
+ <option v-for="acc in mail.accounts" :key="acc.id" :value="acc.id">
222
+ {{ acc.label }} &lt;{{ acc.email }}&gt;
223
+ </option>
224
+ </select>
225
+ </label>
226
+
227
+ <label class="mail-composer-row">
228
+ <span>{{ t('收件人') }}</span>
229
+ <input
230
+ ref="toInput"
231
+ v-model="toText"
232
+ type="text"
233
+ :placeholder="t('多个地址用逗号分隔,例如 alice@example.com')"
234
+ />
235
+ <button
236
+ v-if="!showCcBcc"
237
+ type="button"
238
+ class="mail-link-btn"
239
+ @click="showCcBcc = true"
240
+ >
241
+ {{ t('抄送/密送') }}
242
+ </button>
243
+ </label>
244
+
245
+ <template v-if="showCcBcc">
246
+ <label class="mail-composer-row">
247
+ <span>{{ t('抄送') }}</span>
248
+ <input v-model="ccText" type="text" placeholder="cc@example.com" />
249
+ </label>
250
+ <label class="mail-composer-row">
251
+ <span>{{ t('密送') }}</span>
252
+ <input v-model="bccText" type="text" placeholder="bcc@example.com" />
253
+ </label>
254
+ </template>
255
+
256
+ <label class="mail-composer-row">
257
+ <span>{{ t('主题') }}</span>
258
+ <input v-model="subject" type="text" class="mail-composer-subject" :placeholder="t('输入邮件主题')" />
259
+ </label>
260
+ </div>
261
+
262
+ <textarea
263
+ ref="bodyInput"
264
+ v-model="markdownBody"
265
+ class="mail-composer-editor"
266
+ :placeholder="t('支持 Markdown 语法,发送时将自动生成纯文本与干净的 HTML 双版本正文…')"
267
+ />
268
+
269
+ <TransitionGroup
270
+ v-if="attachments.length"
271
+ tag="div"
272
+ name="mail-chip"
273
+ class="mail-composer-attachments"
274
+ >
275
+ <span v-for="(att, idx) in attachments" :key="`${att.filename}-${idx}`" class="mail-att-chip">
276
+ <Paperclip :size="13" />
277
+ <span class="mail-att-name">{{ att.filename }}</span>
278
+ <small>{{ formatAttachmentSize(att.bytesBase64) }}</small>
279
+ <button type="button" :aria-label="t('移除')" @click="removeAttachment(idx)">
280
+ <X :size="12" />
281
+ </button>
282
+ </span>
283
+ </TransitionGroup>
284
+
285
+ <Transition name="mail-notice">
286
+ <p v-if="error" class="mail-alert error mail-composer-error" role="alert">
287
+ <AlertTriangle :size="14" /> <span>{{ error }}</span>
288
+ </p>
289
+ </Transition>
290
+
291
+ <footer class="mail-composer-footer">
292
+ <input ref="fileInput" type="file" multiple hidden @change="onPickFiles" />
293
+ <button
294
+ type="button"
295
+ class="icon-button"
296
+ :disabled="sending"
297
+ :aria-label="t('添加附件')"
298
+ :data-tooltip="t('添加附件')"
299
+ @click="fileInput?.click()"
300
+ >
301
+ <Paperclip :size="16" />
302
+ </button>
303
+ <span class="mail-composer-hint">Ctrl + Enter</span>
304
+ <button
305
+ type="button"
306
+ class="mail-btn-ghost"
307
+ :disabled="sending || savingDraft"
308
+ @click="saveLocalDraft"
309
+ >
310
+ {{ t('存为本机草稿') }}
311
+ </button>
312
+ <button
313
+ type="button"
314
+ class="mail-btn-primary"
315
+ :disabled="sending"
316
+ @click="send"
317
+ >
318
+ <span v-if="sending" class="mail-btn-spinner" aria-hidden="true" />
319
+ <Send v-else :size="14" />
320
+ {{ sending ? t('正在发送…') : t('发送邮件') }}
321
+ </button>
322
+ </footer>
323
+ </section>
324
+ </div>
325
+ </Transition>
326
+ </template>
@@ -0,0 +1,30 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+ import { Settings2 } from 'lucide-vue-next';
4
+ import aliyunMail from '../../assets/mail-provider-icons/aliyun-mail.svg';
5
+ import gmail from '../../assets/mail-provider-icons/gmail.svg';
6
+ import icloud from '../../assets/mail-provider-icons/icloud.svg';
7
+ import netease126 from '../../assets/mail-provider-icons/netease-126.svg';
8
+ import netease163 from '../../assets/mail-provider-icons/netease-163.svg';
9
+ import qq from '../../assets/mail-provider-icons/qq.svg';
10
+ import tencentExmail from '../../assets/mail-provider-icons/tencent-exmail.svg';
11
+
12
+ const props = defineProps<{ provider: string }>();
13
+ const icons = new Map([
14
+ ['aliyun-mail', aliyunMail],
15
+ ['gmail', gmail],
16
+ ['icloud', icloud],
17
+ ['netease-126', netease126],
18
+ ['netease-163', netease163],
19
+ ['qq', qq],
20
+ ['tencent-exmail', tencentExmail],
21
+ ]);
22
+ const icon = computed(() => icons.get(props.provider));
23
+ </script>
24
+
25
+ <template>
26
+ <span class="mail-provider-icon" :class="{ generic: !icon }" aria-hidden="true">
27
+ <img v-if="icon" :src="icon" alt="" />
28
+ <Settings2 v-else :size="15" />
29
+ </span>
30
+ </template>