@tano.page/workbench 0.14.0 → 0.15.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 (177) hide show
  1. package/package.json +21 -8
  2. package/src/App.vue +76 -17
  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/components/AssistantChangeList.vue +98 -21
  17. package/src/assistant/components/AssistantPanel.vue +424 -7
  18. package/src/assistant/components/PluginToolProposalCard.vue +235 -0
  19. package/src/assistant/engine.ts +56 -3
  20. package/src/assistant/files.ts +5 -13
  21. package/src/assistant/inbox.ts +1 -148
  22. package/src/assistant/locales/de-DE.json +4 -1
  23. package/src/assistant/locales/en-US.json +4 -1
  24. package/src/assistant/locales/es-ES.json +4 -1
  25. package/src/assistant/locales/ja-JP.json +4 -1
  26. package/src/assistant/locales/zh-CN.json +4 -1
  27. package/src/assistant/locales/zh-TW.json +4 -1
  28. package/src/assistant/mention-autocomplete.ts +69 -0
  29. package/src/assistant/prompts.ts +7 -0
  30. package/src/assistant/results.ts +20 -86
  31. package/src/assistant/store.ts +319 -12
  32. package/src/assistant/structures.ts +7 -5
  33. package/src/assistant/tasks.ts +3 -5
  34. package/src/assistant/workspace-bridge.ts +1 -1
  35. package/src/composables/use-document-actions.ts +38 -20
  36. package/src/composables/use-file-tree-controller.ts +7 -12
  37. package/src/composables/use-workbench-history.ts +2 -4
  38. package/src/composables/use-workbench-modals.ts +6 -1
  39. package/src/composables/use-workbench-outline.ts +0 -5
  40. package/src/composables/use-workbench-shortcuts.ts +26 -22
  41. package/src/data-tables/data-tables.ts +1 -2
  42. package/src/documents/components/DocumentHistoryPanel.vue +3 -1
  43. package/src/features.ts +1 -0
  44. package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
  45. package/src/fonts/Inter-Latin.woff2 +0 -0
  46. package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
  47. package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
  48. package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
  49. package/src/help/help-milestones.ts +3 -5
  50. package/src/i18n/locales/de-DE.json +349 -3
  51. package/src/i18n/locales/en-US.json +349 -2
  52. package/src/i18n/locales/es-ES.json +349 -3
  53. package/src/i18n/locales/ja-JP.json +348 -2
  54. package/src/i18n/locales/zh-TW.json +348 -2
  55. package/src/mail/components/MailAccountDialog.vue +449 -0
  56. package/src/mail/components/MailComposerDialog.vue +325 -0
  57. package/src/mail/components/MailProviderIcon.vue +30 -0
  58. package/src/mail/components/MailWorkspaceView.vue +820 -0
  59. package/src/mail/components/SidebarMail.vue +133 -0
  60. package/src/mail/mail-avatar.ts +17 -0
  61. package/src/mail/mail-bridge.ts +68 -0
  62. package/src/mail/mail-calendar.ts +208 -0
  63. package/src/mail/mail-markdown.ts +195 -0
  64. package/src/mail/types.ts +226 -0
  65. package/src/objects/components/ObjectDetailModal.vue +1001 -0
  66. package/src/objects/workspace-objects.ts +1 -1
  67. package/src/plan-sync/types.ts +6 -3
  68. package/src/plans/calendar-interaction.ts +194 -0
  69. package/src/plans/calendar.ts +63 -7
  70. package/src/plans/components/CalendarDayPopover.vue +172 -39
  71. package/src/plans/components/CalendarView.vue +1736 -276
  72. package/src/plans/components/PlanArchiveDialog.vue +295 -0
  73. package/src/plans/components/PlanDateField.vue +6 -4
  74. package/src/plans/components/PlanDetailPanel.vue +227 -32
  75. package/src/plans/components/PlanEventList.vue +16 -4
  76. package/src/plans/components/SidebarPlan.vue +22 -15
  77. package/src/plans/components/TaskRepeatControls.vue +169 -30
  78. package/src/plans/local-reminders.ts +149 -0
  79. package/src/plans/personal-plans.ts +10 -1
  80. package/src/plans/plan-date.ts +8 -1
  81. package/src/plans/plan-migration.ts +95 -0
  82. package/src/plans/recurrence.ts +95 -0
  83. package/src/plans/task-repeat.ts +8 -8
  84. package/src/plans/timeline-layout.ts +92 -0
  85. package/src/plugins/assistant-bridge.ts +520 -0
  86. package/src/plugins/attachment-reader.ts +3 -1
  87. package/src/plugins/cache-storage.ts +42 -2
  88. package/src/plugins/components/PluginAutomations.vue +3 -3
  89. package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
  90. package/src/plugins/components/PluginChangeSummary.vue +16 -3
  91. package/src/plugins/components/PluginConnections.vue +1 -1
  92. package/src/plugins/components/PluginCustomView.vue +2 -2
  93. package/src/plugins/components/PluginDetailPage.vue +129 -54
  94. package/src/plugins/components/PluginDocumentSlot.vue +63 -0
  95. package/src/plugins/components/PluginExplorer.vue +15 -21
  96. package/src/plugins/components/PluginImportDialog.vue +410 -0
  97. package/src/plugins/components/PluginInstaller.vue +39 -145
  98. package/src/plugins/components/PluginListItem.vue +3 -0
  99. package/src/plugins/components/PluginMaintenance.vue +21 -6
  100. package/src/plugins/components/PluginRuntimePanel.vue +3 -3
  101. package/src/plugins/components/PluginSettingsForm.vue +111 -0
  102. package/src/plugins/components/PluginStatusBar.vue +161 -0
  103. package/src/plugins/components/PluginSurface.vue +18 -6
  104. package/src/plugins/components/PluginUiDialog.vue +452 -0
  105. package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
  106. package/src/plugins/excalidraw/manifest.json +12 -1
  107. package/src/plugins/host.ts +662 -43
  108. package/src/plugins/native.ts +2 -10
  109. package/src/plugins/overlay-mapping.ts +125 -0
  110. package/src/plugins/packages.ts +73 -1
  111. package/src/plugins/plugin-permissions.ts +57 -0
  112. package/src/plugins/plugin-sdk.ts +174 -8
  113. package/src/plugins/policy.ts +53 -3
  114. package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
  115. package/src/plugins/presentation-preview/manifest.json +2 -1
  116. package/src/plugins/queries.ts +3 -1
  117. package/src/plugins/sandbox.ts +15 -1
  118. package/src/plugins/use-plugin-actions.ts +67 -20
  119. package/src/plugins/user-plugins.ts +254 -0
  120. package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
  121. package/src/plugins/word-preview/manifest.json +13 -1
  122. package/src/plugins/workbench.ts +175 -2
  123. package/src/plugins/worker.js +105 -8
  124. package/src/plugins/workspace-plugin-runtime.ts +23 -7
  125. package/src/plugins/workspace-plugins.ts +212 -21
  126. package/src/runtime.ts +101 -3
  127. package/src/settings/components/SettingsAppearancePage.vue +46 -0
  128. package/src/settings/components/SettingsDocumentsPage.vue +0 -1
  129. package/src/settings/components/settings-search.ts +2 -3
  130. package/src/shell/components/SidebarNavigation.vue +22 -2
  131. package/src/shell/components/WorkbenchContextMenus.vue +21 -8
  132. package/src/shell/components/WorkbenchModals.vue +27 -46
  133. package/src/shell/components/WorkbenchPanes.vue +267 -84
  134. package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
  135. package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
  136. package/src/shell/use-workbench.ts +116 -145
  137. package/src/shell/workbench-async-components.ts +14 -5
  138. package/src/stores/mail.ts +414 -0
  139. package/src/stores/plan-sync.ts +2 -1
  140. package/src/stores/plans.ts +2 -9
  141. package/src/stores/workspace-knowledge.ts +1 -113
  142. package/src/stores/workspace-plugins-state.ts +537 -14
  143. package/src/stores/workspace-tabs-layout.ts +5 -43
  144. package/src/stores/workspace.ts +69 -66
  145. package/src/styles/agent-diff-modals.css +0 -7
  146. package/src/styles/dark-theme.css +3 -3
  147. package/src/styles/inspector.css +0 -59
  148. package/src/styles/layout-themes.css +346 -0
  149. package/src/styles/mail.css +1568 -0
  150. package/src/styles/mobile.css +2 -2
  151. package/src/styles/recent-and-media.css +0 -17
  152. package/src/styles/theme-contract.css +3 -3
  153. package/src/styles/workbench-shell.css +110 -17
  154. package/src/styles/workspace-states.css +9 -33
  155. package/src/styles.css +1 -1
  156. package/src/tabs/components/DesktopTabs.vue +0 -3
  157. package/src/tabs/components/NewTabPicker.vue +10 -4
  158. package/src/tabs/tab-label.ts +0 -1
  159. package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
  160. package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
  161. package/src/workspace/workspace-comments.ts +11 -151
  162. package/src/workspace/workspace-welcome.ts +1 -1
  163. package/src/documents/components/FormulaMenu.vue +0 -50
  164. package/src/files/components/FileDatabasePage.vue +0 -152
  165. package/src/files/components/FolderHomeIcon.vue +0 -12
  166. package/src/objects/components/ObjectDatabasePage.vue +0 -100
  167. package/src/objects/components/ObjectPanel.vue +0 -554
  168. package/src/plans/components/PersonalPlanDialog.vue +0 -105
  169. package/src/shell/components/WorkspaceViewPage.vue +0 -127
  170. package/src/shell/components/WorkspaceViewTab.vue +0 -24
  171. package/src/styles/object-panel.css +0 -163
  172. package/src/workspace/components/GitInspectionPanel.vue +0 -35
  173. package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
  174. package/src/workspace/welcome-slogans.ts +0 -11
  175. package/src/workspace/workspace-git.ts +0 -35
  176. package/src/workspace/workspace-sync.ts +0 -46
  177. package/src/workspace/workspace-views.ts +0 -48
@@ -0,0 +1,449 @@
1
+ <script setup lang="ts">
2
+ import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
3
+ import {
4
+ AlertTriangle,
5
+ CheckCircle2,
6
+ ChevronLeft,
7
+ ChevronRight,
8
+ ShieldCheck,
9
+ Trash2,
10
+ X,
11
+ } from 'lucide-vue-next';
12
+ import { t } from '../../i18n/i18n';
13
+ import { useMailStore } from '../../stores/mail';
14
+ import type { AppendSentPolicy, MailAccountInput, MailPreset, TlsMode } from '../types';
15
+ import MailProviderIcon from './MailProviderIcon.vue';
16
+
17
+ const mail = useMailStore();
18
+
19
+ function close() {
20
+ if (testing.value || saving.value) return;
21
+ mail.accountDialogOpen = false;
22
+ }
23
+
24
+ function onKeydown(event: KeyboardEvent) {
25
+ if (!mail.accountDialogOpen || event.key !== 'Escape' || mail.composerOpen) return;
26
+ event.stopPropagation();
27
+ close();
28
+ }
29
+ onMounted(() => window.addEventListener('keydown', onKeydown, true));
30
+ onBeforeUnmount(() => window.removeEventListener('keydown', onKeydown, true));
31
+
32
+ const selectedPresetId = ref('qq');
33
+ const label = ref('QQ 邮箱');
34
+ const email = ref('');
35
+ const displayName = ref('');
36
+ const username = ref('');
37
+ const password = ref('');
38
+ const imapHost = ref('imap.qq.com');
39
+ const imapPort = ref(993);
40
+ const imapTls = ref<TlsMode>('tls');
41
+ const smtpHost = ref('smtp.qq.com');
42
+ const smtpPort = ref(465);
43
+ const smtpTls = ref<TlsMode>('tls');
44
+ const appendSent = ref<AppendSentPolicy>('never');
45
+ const sendImapId = ref(false);
46
+
47
+ const testing = ref(false);
48
+ const saving = ref(false);
49
+ const clearingCache = ref(false);
50
+ const error = ref('');
51
+ const statusMessage = ref('');
52
+
53
+ /** 'pick' = accounts + provider list, 'form' = credentials for one provider. */
54
+ const step = ref<'pick' | 'form'>('pick');
55
+ const emailInput = ref<HTMLInputElement>();
56
+ const isCustom = computed(() => selectedPresetId.value === 'custom');
57
+
58
+ async function pickProvider(presetId: string) {
59
+ applyPreset(presetId);
60
+ step.value = 'form';
61
+ await nextTick();
62
+ emailInput.value?.focus();
63
+ }
64
+
65
+ function backToPick() {
66
+ if (testing.value || saving.value) return;
67
+ step.value = 'pick';
68
+ error.value = '';
69
+ statusMessage.value = '';
70
+ }
71
+
72
+ const currentPreset = computed<MailPreset | undefined>(() =>
73
+ mail.presets.find((item) => item.id === selectedPresetId.value),
74
+ );
75
+
76
+ function applyPreset(presetId: string) {
77
+ selectedPresetId.value = presetId;
78
+ const preset = mail.presets.find((item) => item.id === presetId);
79
+ if (!preset) return;
80
+ label.value = preset.name;
81
+ imapHost.value = preset.imapHost;
82
+ imapPort.value = preset.imapPort;
83
+ imapTls.value = preset.imapTls;
84
+ smtpHost.value = preset.smtpHost;
85
+ smtpPort.value = preset.smtpPort;
86
+ smtpTls.value = preset.smtpTls;
87
+ appendSent.value = preset.appendSent;
88
+ sendImapId.value = preset.sendImapId;
89
+ error.value = '';
90
+ statusMessage.value = '';
91
+ }
92
+
93
+ watch(
94
+ () => mail.accountDialogOpen,
95
+ async (open) => {
96
+ if (!open) return;
97
+ await mail.init();
98
+ const requested = mail.accountDialogPreset;
99
+ mail.accountDialogPreset = '';
100
+ error.value = '';
101
+ statusMessage.value = '';
102
+ if (requested && mail.presets.some((item) => item.id === requested)) {
103
+ await pickProvider(requested);
104
+ } else {
105
+ step.value = 'pick';
106
+ }
107
+ },
108
+ { immediate: true },
109
+ );
110
+
111
+ function buildInput(): MailAccountInput {
112
+ return {
113
+ provider: selectedPresetId.value,
114
+ label: label.value.trim(),
115
+ email: email.value.trim(),
116
+ displayName: displayName.value.trim() || email.value.trim(),
117
+ imapHost: imapHost.value.trim(),
118
+ imapPort: Number(imapPort.value),
119
+ imapTls: imapTls.value,
120
+ smtpHost: smtpHost.value.trim(),
121
+ smtpPort: Number(smtpPort.value),
122
+ smtpTls: smtpTls.value,
123
+ appendSent: appendSent.value,
124
+ sendImapId: sendImapId.value,
125
+ };
126
+ }
127
+
128
+ async function testConnection() {
129
+ testing.value = true;
130
+ error.value = '';
131
+ statusMessage.value = '';
132
+ try {
133
+ const res = await mail.testAccount(buildInput(), {
134
+ username: username.value.trim() || email.value.trim(),
135
+ password: password.value,
136
+ });
137
+ statusMessage.value = res.message;
138
+ } catch (err) {
139
+ error.value = err instanceof Error ? err.message : String(err);
140
+ } finally {
141
+ testing.value = false;
142
+ }
143
+ }
144
+
145
+ async function submitAccount() {
146
+ saving.value = true;
147
+ error.value = '';
148
+ statusMessage.value = '';
149
+ try {
150
+ const saved = await mail.saveAccount(buildInput(), {
151
+ username: username.value.trim() || email.value.trim(),
152
+ password: password.value,
153
+ });
154
+ password.value = '';
155
+ statusMessage.value = t('账号已保存,正在首次同步文件夹与近期邮件…');
156
+ try {
157
+ await mail.syncAccount(saved.id);
158
+ email.value = '';
159
+ displayName.value = '';
160
+ username.value = '';
161
+ step.value = 'pick';
162
+ statusMessage.value = t('账号已连接并完成首次同步。');
163
+ } catch (syncErr) {
164
+ error.value =
165
+ syncErr instanceof Error
166
+ ? `${t('账号已保存,但首次同步失败:')}${syncErr.message}`
167
+ : String(syncErr);
168
+ }
169
+ } catch (err) {
170
+ error.value = err instanceof Error ? err.message : String(err);
171
+ } finally {
172
+ saving.value = false;
173
+ }
174
+ }
175
+
176
+ async function removeAccount(accountId: string) {
177
+ error.value = '';
178
+ try {
179
+ await mail.removeAccount(accountId);
180
+ statusMessage.value = t('已移除邮箱账号并清理本机凭据与缓存。');
181
+ } catch (err) {
182
+ error.value = err instanceof Error ? err.message : String(err);
183
+ }
184
+ }
185
+
186
+ async function clearCache() {
187
+ clearingCache.value = true;
188
+ try {
189
+ await mail.clearCache();
190
+ statusMessage.value = t('已清空本地邮件正文与附件缓存。');
191
+ } catch (err) {
192
+ error.value = err instanceof Error ? err.message : String(err);
193
+ } finally {
194
+ clearingCache.value = false;
195
+ }
196
+ }
197
+
198
+ function formatBytes(bytes: number): string {
199
+ if (bytes < 1024) return `${bytes} B`;
200
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
201
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
202
+ }
203
+ </script>
204
+
205
+ <template>
206
+ <Transition name="mail-modal">
207
+ <div
208
+ v-if="mail.accountDialogOpen"
209
+ class="mail-modal-backdrop"
210
+ @mousedown.self="close"
211
+ >
212
+ <section
213
+ class="mail-modal mail-account-modal"
214
+ role="dialog"
215
+ aria-modal="true"
216
+ :aria-label="t('邮箱账号管理')"
217
+ >
218
+ <!-- Step 1: connected accounts + choose a provider -->
219
+ <template v-if="step === 'pick'">
220
+ <header class="mail-modal-header compact">
221
+ <h2>{{ mail.accounts.length ? t('邮箱账号') : t('添加新邮箱') }}</h2>
222
+ <button
223
+ type="button"
224
+ class="icon-button"
225
+ :aria-label="t('关闭')"
226
+ :data-tooltip="t('关闭')"
227
+ @click="close"
228
+ >
229
+ <X :size="16" />
230
+ </button>
231
+ </header>
232
+
233
+ <div class="mail-modal-body">
234
+ <Transition name="mail-notice" mode="out-in">
235
+ <p v-if="error" key="err" class="mail-alert error" role="alert">
236
+ <AlertTriangle :size="14" /> <span>{{ error }}</span>
237
+ </p>
238
+ <p v-else-if="statusMessage" key="ok" class="mail-alert success" role="status">
239
+ <CheckCircle2 :size="14" /> <span>{{ statusMessage }}</span>
240
+ </p>
241
+ </Transition>
242
+
243
+ <section v-if="mail.accounts.length" class="mail-modal-section">
244
+ <ul class="mail-saved-accounts">
245
+ <li v-for="acc in mail.accounts" :key="acc.id" class="mail-saved-account-row">
246
+ <MailProviderIcon :provider="acc.provider" />
247
+ <div class="mail-saved-account-text">
248
+ <strong>{{ acc.label }}</strong>
249
+ <span>{{ acc.email }}</span>
250
+ </div>
251
+ <button
252
+ type="button"
253
+ class="icon-button danger"
254
+ :aria-label="t('移除')"
255
+ :data-tooltip="t('移除')"
256
+ @click="removeAccount(acc.id)"
257
+ >
258
+ <Trash2 :size="15" />
259
+ </button>
260
+ </li>
261
+ </ul>
262
+ <p v-if="mail.cacheStats" class="mail-cache-line">
263
+ <span>
264
+ {{
265
+ t('本机缓存:{0} 封邮件 · 正文 {1} · 附件 {2}', [
266
+ mail.cacheStats.messageCount,
267
+ formatBytes(mail.cacheStats.cachedBodyBytes),
268
+ formatBytes(mail.cacheStats.cachedAttachmentBytes),
269
+ ])
270
+ }}
271
+ </span>
272
+ <button
273
+ type="button"
274
+ class="mail-link-btn"
275
+ :disabled="clearingCache"
276
+ @click="clearCache"
277
+ >
278
+ {{ clearingCache ? t('正在清理…') : t('清空正文与附件缓存') }}
279
+ </button>
280
+ </p>
281
+ </section>
282
+
283
+ <section class="mail-modal-section">
284
+ <h3 v-if="mail.accounts.length">{{ t('添加新邮箱') }}</h3>
285
+ <div class="mail-provider-grid">
286
+ <button
287
+ v-for="preset in mail.presets"
288
+ :key="preset.id"
289
+ type="button"
290
+ class="mail-provider"
291
+ :title="preset.name"
292
+ @click="pickProvider(preset.id)"
293
+ >
294
+ <MailProviderIcon :provider="preset.id" />
295
+ <span class="mail-provider-name">{{ preset.name }}</span>
296
+ <ChevronRight :size="15" class="mail-provider-chevron" />
297
+ </button>
298
+ </div>
299
+ </section>
300
+ </div>
301
+ </template>
302
+
303
+ <!-- Step 2: only what this provider needs -->
304
+ <template v-else>
305
+ <header class="mail-modal-header compact">
306
+ <div class="mail-form-title">
307
+ <button
308
+ type="button"
309
+ class="icon-button"
310
+ :disabled="testing || saving"
311
+ :aria-label="t('返回')"
312
+ :data-tooltip="t('返回')"
313
+ @click="backToPick"
314
+ >
315
+ <ChevronLeft :size="16" />
316
+ </button>
317
+ <MailProviderIcon :provider="selectedPresetId" />
318
+ <h2>{{ currentPreset?.name ?? label }}</h2>
319
+ </div>
320
+ <button
321
+ type="button"
322
+ class="icon-button"
323
+ :aria-label="t('关闭')"
324
+ :data-tooltip="t('关闭')"
325
+ @click="close"
326
+ >
327
+ <X :size="16" />
328
+ </button>
329
+ </header>
330
+
331
+ <form class="mail-modal-body mail-account-form" @submit.prevent="submitAccount">
332
+ <p v-if="currentPreset?.authHint" class="mail-auth-hint">{{ currentPreset.authHint }}</p>
333
+
334
+ <label class="mail-field">
335
+ <span>{{ t('邮箱地址') }}</span>
336
+ <input
337
+ ref="emailInput"
338
+ v-model="email"
339
+ type="email"
340
+ autocomplete="email"
341
+ placeholder="name@example.com"
342
+ />
343
+ </label>
344
+ <label class="mail-field">
345
+ <span>{{ t('授权码 / App 专用密码') }}</span>
346
+ <input v-model="password" type="password" autocomplete="off" />
347
+ </label>
348
+
349
+ <!-- A custom server cannot work without hosts: keep them in view. -->
350
+ <div v-if="isCustom" class="mail-form-grid">
351
+ <label class="mail-field">
352
+ <span>IMAP {{ t('服务器') }}</span>
353
+ <input v-model="imapHost" type="text" placeholder="imap.example.com" />
354
+ </label>
355
+ <label class="mail-field">
356
+ <span>SMTP {{ t('服务器') }}</span>
357
+ <input v-model="smtpHost" type="text" placeholder="smtp.example.com" />
358
+ </label>
359
+ </div>
360
+
361
+ <details class="mail-advanced">
362
+ <summary>
363
+ <ChevronRight :size="14" class="mail-advanced-chevron" />
364
+ {{ t('更多设置') }}
365
+ </summary>
366
+ <div class="mail-form-grid">
367
+ <label class="mail-field">
368
+ <span>{{ t('连接名称') }}</span>
369
+ <input v-model="label" type="text" />
370
+ </label>
371
+ <label class="mail-field">
372
+ <span>{{ t('发件人显示名(可选)') }}</span>
373
+ <input v-model="displayName" type="text" />
374
+ </label>
375
+ <label class="mail-field mail-form-full">
376
+ <span>{{ t('登录用户名(留空同邮箱)') }}</span>
377
+ <input v-model="username" type="text" />
378
+ </label>
379
+ <label v-if="!isCustom" class="mail-field">
380
+ <span>IMAP {{ t('服务器') }}</span>
381
+ <input v-model="imapHost" type="text" />
382
+ </label>
383
+ <label class="mail-field">
384
+ <span>IMAP {{ t('端口与加密') }}</span>
385
+ <div class="mail-inline-pair">
386
+ <input v-model.number="imapPort" type="number" min="1" max="65535" />
387
+ <select v-model="imapTls">
388
+ <option value="tls">TLS (993)</option>
389
+ <option value="starttls">STARTTLS (143)</option>
390
+ </select>
391
+ </div>
392
+ </label>
393
+ <label v-if="!isCustom" class="mail-field">
394
+ <span>SMTP {{ t('服务器') }}</span>
395
+ <input v-model="smtpHost" type="text" />
396
+ </label>
397
+ <label class="mail-field">
398
+ <span>SMTP {{ t('端口与加密') }}</span>
399
+ <div class="mail-inline-pair">
400
+ <input v-model.number="smtpPort" type="number" min="1" max="65535" />
401
+ <select v-model="smtpTls">
402
+ <option value="tls">TLS (465)</option>
403
+ <option value="starttls">STARTTLS (587)</option>
404
+ </select>
405
+ </div>
406
+ </label>
407
+ </div>
408
+ </details>
409
+
410
+ <Transition name="mail-notice" mode="out-in">
411
+ <p v-if="error" key="err" class="mail-alert error" role="alert">
412
+ <AlertTriangle :size="14" /> <span>{{ error }}</span>
413
+ </p>
414
+ <p v-else-if="statusMessage" key="ok" class="mail-alert success" role="status">
415
+ <CheckCircle2 :size="14" /> <span>{{ statusMessage }}</span>
416
+ </p>
417
+ </Transition>
418
+ <button type="submit" hidden />
419
+ </form>
420
+
421
+ <footer class="mail-modal-footer">
422
+ <p class="mail-footer-note">
423
+ <ShieldCheck :size="13" />
424
+ <span>{{ t('授权码仅保存在本机系统凭据库') }}</span>
425
+ </p>
426
+ <button
427
+ type="button"
428
+ class="mail-btn-ghost"
429
+ :disabled="testing || saving"
430
+ @click="testConnection"
431
+ >
432
+ <span v-if="testing" class="mail-btn-spinner" aria-hidden="true" />
433
+ {{ testing ? t('正在测试…') : t('测试连接') }}
434
+ </button>
435
+ <button
436
+ type="button"
437
+ class="mail-btn-primary"
438
+ :disabled="testing || saving"
439
+ @click="submitAccount"
440
+ >
441
+ <span v-if="saving" class="mail-btn-spinner" aria-hidden="true" />
442
+ {{ saving ? t('正在保存…') : t('保存并同步') }}
443
+ </button>
444
+ </footer>
445
+ </template>
446
+ </section>
447
+ </div>
448
+ </Transition>
449
+ </template>