@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
@@ -5,18 +5,39 @@ const ResizeObserver = (window as Window & typeof globalThis).ResizeObserver;
5
5
  import { isNode } from '@tano/editor/dom-realm';
6
6
  import { vSurfaceMotion } from '@tano/editor/surface-motion';
7
7
  import { t, uiLocale } from '../../i18n/i18n';
8
- import { nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
9
- import { X } from 'lucide-vue-next';
10
- import { hasEventTime, isEventCompleted, localDayKey } from '../calendar';
11
- import { planKey, planSourceLabel } from '../personal-plans';
8
+ import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
9
+ import { Circle, CircleCheck, Flag, X } from 'lucide-vue-next';
10
+ import { isPlanCompletionLocked } from '@tano/protocol';
11
+ import { hasEventTime, isCheckableEvent, isEventCompleted, isEventOverdue, localDayKey } from '../calendar';
12
+ import type { CalendarDayEntry } from '../calendar';
13
+ import { planKey, planSourceLabel, sourcePlanKey } from '../personal-plans';
12
14
  import type { ObjectRecord } from '../../objects/workspace-objects';
13
15
 
14
- const props = defineProps<{ id: string; date: Date; anchor: HTMLElement; records: ObjectRecord[] }>();
15
- const emit = defineEmits<{ close: []; 'select-event': [id: string] }>();
16
+ const props = defineProps<{
17
+ id: string;
18
+ date: Date;
19
+ anchor: HTMLElement;
20
+ records: ObjectRecord[];
21
+ entries?: CalendarDayEntry[];
22
+ canEdit?: (record: ObjectRecord) => boolean;
23
+ pending?: readonly string[];
24
+ }>();
25
+ const emit = defineEmits<{
26
+ close: [];
27
+ 'select-event': [id: string];
28
+ 'toggle-complete': [record: ObjectRecord];
29
+ }>();
16
30
  const panel = ref<HTMLElement>();
17
31
  const position = ref({ left: '0px', top: '0px' });
18
32
  let resizeObserver: ResizeObserver | undefined;
19
33
 
34
+ const items = computed<CalendarDayEntry[]>(() =>
35
+ props.entries ?? props.records.map((record) => ({
36
+ record,
37
+ kind: hasEventTime(record) && record.object.properties.allDay !== true ? 'timed' : 'all-day',
38
+ })),
39
+ );
40
+
20
41
  function close(restoreFocus = false) {
21
42
  if (restoreFocus) props.anchor.focus({ preventScroll: true });
22
43
  emit('close');
@@ -62,9 +83,19 @@ async function focusPanel() {
62
83
  }
63
84
  function select(record: ObjectRecord) {
64
85
  close();
65
- emit('select-event', planKey(record));
86
+ emit('select-event', sourcePlanKey(record));
87
+ }
88
+ function canToggle(record: ObjectRecord) {
89
+ return (
90
+ isCheckableEvent(record) &&
91
+ !isPlanCompletionLocked(record.object) &&
92
+ props.canEdit?.(record) === true &&
93
+ !props.pending?.includes(planKey(record))
94
+ );
66
95
  }
67
- function eventTime(record: ObjectRecord) {
96
+ function eventTime(entry: CalendarDayEntry) {
97
+ if (entry.kind === 'due') return t('截止');
98
+ const { record } = entry;
68
99
  if (record.object.properties.allDay === true) return t('全天');
69
100
  if (!hasEventTime(record)) return t('当天');
70
101
  const format = (value: unknown) => {
@@ -81,10 +112,12 @@ onMounted(() => {
81
112
  document.addEventListener('pointerdown', dismiss);
82
113
  document.addEventListener('focusin', dismiss);
83
114
  window.addEventListener('resize', place);
84
- resizeObserver = new ResizeObserver(place);
85
- if (panel.value) resizeObserver.observe(panel.value);
86
- const calendar = props.anchor.closest('.calendar-view');
87
- if (calendar) resizeObserver.observe(calendar);
115
+ if (typeof ResizeObserver !== 'undefined') {
116
+ resizeObserver = new ResizeObserver(place);
117
+ if (panel.value) resizeObserver.observe(panel.value);
118
+ const calendar = props.anchor.closest('.calendar-view');
119
+ if (calendar) resizeObserver.observe(calendar);
120
+ }
88
121
  });
89
122
  onUnmounted(() => {
90
123
  document.removeEventListener('pointerdown', dismiss);
@@ -112,17 +145,50 @@ watch(() => props.date, focusPanel);
112
145
  <strong>{{ date.getDate() }}</strong>
113
146
  <div>
114
147
  <span>{{ date.toLocaleDateString(uiLocale, { month: 'short', weekday: 'short' }) }}</span>
115
- <small>{{ records.length ? t('{0} 项活动', [records.length]) : t('当天活动') }}</small>
148
+ <small>{{ items.length ? t('{0} 项活动', [items.length]) : t('当天活动') }}</small>
116
149
  </div>
117
150
  <button type="button" class="calendar-day-popover-close" :aria-label="t('关闭当天活动')" @click="close(true)">
118
151
  <X :size="17" aria-hidden="true" />
119
152
  </button>
120
153
  </header>
121
- <ul v-if="records.length" class="calendar-day-popover-events">
122
- <li v-for="record in records" :key="planKey(record)">
123
- <button type="button" :class="{ completed: isEventCompleted(record) }" @click="select(record)">
124
- <strong>{{ record.object.name }}</strong>
125
- <small><time>{{ eventTime(record) }}</time> · {{ planSourceLabel(record) }}{{ isEventCompleted(record) ? t(' · 已完成') : '' }}</small>
154
+ <ul v-if="items.length" class="calendar-day-popover-events">
155
+ <li
156
+ v-for="entry in items"
157
+ :key="`${planKey(entry.record)}:${entry.kind}`"
158
+ class="calendar-day-popover-row"
159
+ :class="{
160
+ completed: isEventCompleted(entry.record),
161
+ overdue: isEventOverdue(entry.record),
162
+ due: entry.kind === 'due',
163
+ }"
164
+ >
165
+ <button
166
+ v-if="isCheckableEvent(entry.record)"
167
+ type="button"
168
+ class="calendar-day-popover-check"
169
+ :aria-label="`${isEventCompleted(entry.record) ? t('标记未完成') : t('完成')}:${entry.record.object.name}`"
170
+ :disabled="!canToggle(entry.record)"
171
+ @click.stop="emit('toggle-complete', entry.record)"
172
+ >
173
+ <CircleCheck v-if="isEventCompleted(entry.record)" :size="15" aria-hidden="true" />
174
+ <Circle v-else :size="15" aria-hidden="true" />
175
+ </button>
176
+ <span
177
+ v-else
178
+ class="calendar-day-popover-marker"
179
+ :class="{ personal: entry.record.source?.scope === 'personal' }"
180
+ aria-hidden="true"
181
+ />
182
+ <button type="button" class="calendar-day-popover-item" @click="select(entry.record)">
183
+ <strong>
184
+ <Flag v-if="entry.kind === 'due'" :size="12" class="calendar-day-popover-flag" aria-hidden="true" />
185
+ {{ entry.record.object.name }}
186
+ </strong>
187
+ <small>
188
+ <time>{{ eventTime(entry) }}</time> · {{ planSourceLabel(entry.record) }}
189
+ <template v-if="isEventOverdue(entry.record)"> · {{ t('逾期') }}</template>
190
+ <template v-else-if="isEventCompleted(entry.record)">{{ t(' · 已完成') }}</template>
191
+ </small>
126
192
  </button>
127
193
  </li>
128
194
  </ul>
@@ -137,39 +203,106 @@ watch(() => props.date, focusPanel);
137
203
  z-index: 40;
138
204
  display: flex;
139
205
  flex-direction: column;
140
- width: 272px;
206
+ width: 292px;
141
207
  max-width: calc(100vw - 24px);
142
- max-height: min(380px, calc(100dvh - 24px));
143
- padding: 14px 12px 12px;
208
+ max-height: min(400px, calc(100dvh - 24px));
209
+ padding: 12px 8px 8px;
144
210
  border: 1px solid var(--line);
145
211
  border-radius: 12px;
146
212
  background: var(--paper);
147
213
  color: var(--text);
148
- box-shadow: 0 8px 28px #0002, 0 2px 6px #0001;
214
+ box-shadow: var(--overlay-shadow, 0 8px 28px #0002, 0 2px 6px #0001);
149
215
  outline: none;
150
216
  }
151
- .calendar-day-popover-heading { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 0 2px; }
152
- .calendar-day-popover-heading > strong { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: var(--green); font-size: 23px; line-height: 1; font-weight: 500; }
153
- .calendar-day-popover-heading > div { flex: 1; }
154
- .calendar-day-popover-heading span { display: block; font-size: 13px; }
155
- .calendar-day-popover-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
217
+ .calendar-day-popover-heading { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding: 0 4px 0 6px; }
218
+ .calendar-day-popover-heading > strong {
219
+ display: grid;
220
+ place-items: center;
221
+ flex-shrink: 0;
222
+ width: 38px;
223
+ height: 38px;
224
+ border-radius: 10px;
225
+ background: var(--surface);
226
+ box-shadow: inset 0 0 0 1px var(--line);
227
+ color: var(--text);
228
+ font-size: 19px;
229
+ line-height: 1;
230
+ font-weight: 600;
231
+ font-variant-numeric: tabular-nums;
232
+ }
233
+ .calendar-day-popover-heading > div { flex: 1; min-width: 0; }
234
+ .calendar-day-popover-heading span { display: block; font-size: 13px; font-weight: 500; }
235
+ .calendar-day-popover-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
156
236
  .calendar-day-popover-close {
157
237
  flex-shrink: 0;
158
238
  display: grid;
159
239
  place-items: center;
160
240
  width: 28px;
161
241
  height: 28px;
162
- border-radius: 6px;
163
- color: var(--text-secondary);
242
+ border-radius: 7px;
243
+ color: var(--muted);
244
+ }
245
+ .calendar-day-popover-close:hover { background: var(--hover); color: var(--text); }
246
+ .calendar-day-popover-empty { margin: 16px 6px 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
247
+ .calendar-day-popover-events {
248
+ min-height: 0;
249
+ overflow-y: auto;
250
+ overscroll-behavior: contain;
251
+ list-style: none;
252
+ margin: 10px 0 0;
253
+ padding: 8px 0 0;
254
+ border-top: 1px solid var(--line);
255
+ }
256
+ .calendar-day-popover-row {
257
+ display: flex;
258
+ align-items: flex-start;
259
+ gap: 4px;
260
+ padding: 0 4px;
261
+ border-radius: 8px;
262
+ transition: background-color var(--motion-quick) var(--ease-standard);
263
+ animation: tano-rise-in var(--motion-spring) var(--ease-spring-smooth) both;
264
+ }
265
+ .calendar-day-popover-row:nth-child(2) { animation-delay: 20ms; }
266
+ .calendar-day-popover-row:nth-child(3) { animation-delay: 40ms; }
267
+ .calendar-day-popover-row:nth-child(4) { animation-delay: 60ms; }
268
+ .calendar-day-popover-row:nth-child(n + 5) { animation-delay: 80ms; }
269
+ .calendar-day-popover-row + .calendar-day-popover-row { margin-top: 1px; }
270
+ .calendar-day-popover-row:hover,
271
+ .calendar-day-popover-row:focus-within { background: var(--hover); }
272
+ .calendar-day-popover-check,
273
+ .calendar-day-popover-marker {
274
+ flex: none;
275
+ display: grid;
276
+ place-items: center;
277
+ width: 24px;
278
+ height: 24px;
279
+ margin-top: 6px;
280
+ border-radius: 50%;
281
+ color: var(--muted);
282
+ }
283
+ .calendar-day-popover-marker::before {
284
+ content: '';
285
+ width: 7px;
286
+ height: 7px;
287
+ border-radius: 50%;
288
+ background: color-mix(in srgb, var(--text) 55%, var(--paper));
289
+ }
290
+ .calendar-day-popover-marker.personal::before { background: #3d6cc9; }
291
+ :root[data-theme='dark'] .calendar-day-popover-marker.personal::before { background: #86a6ea; }
292
+ .calendar-day-popover-check:hover:not(:disabled) { color: var(--text); background: color-mix(in srgb, var(--text) 8%, transparent); }
293
+ .calendar-day-popover-check:disabled { opacity: 0.45; cursor: not-allowed; }
294
+ .calendar-day-popover-row.completed .calendar-day-popover-check { color: var(--text-secondary); }
295
+ .calendar-day-popover-item { flex: 1; min-width: 0; padding: 7px 6px 7px 2px; border-radius: 6px; text-align: left; }
296
+ .calendar-day-popover-item:hover { color: inherit; }
297
+ .calendar-day-popover-item strong { display: flex; align-items: center; gap: 5px; color: var(--text); font-size: 13px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
298
+ .calendar-day-popover-flag { flex: none; color: #b7791f; }
299
+ .calendar-day-popover-item small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
300
+ .calendar-day-popover-item small time { font-variant-numeric: tabular-nums; }
301
+ .calendar-day-popover-row.completed .calendar-day-popover-item strong { color: var(--muted); text-decoration: line-through; }
302
+ .calendar-day-popover-row.overdue .calendar-day-popover-item small,
303
+ .calendar-day-popover-row.overdue .calendar-day-popover-flag { color: var(--danger, #c24141); }
304
+ button:focus-visible { outline: 2px solid var(--focus-ring, var(--green)); outline-offset: 1px; }
305
+ @media (prefers-reduced-motion: reduce) {
306
+ .calendar-day-popover-row { animation: none; }
164
307
  }
165
- .calendar-day-popover-close:hover { background: var(--hover); }
166
- .calendar-day-popover-empty { margin: 16px 4px 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }
167
- .calendar-day-popover-events { min-height: 0; overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 10px 0 0; padding: 2px; }
168
- .calendar-day-popover-events li + li { margin-top: 3px; }
169
- .calendar-day-popover-events button { width: 100%; padding: 8px; border-radius: 6px; text-align: left; }
170
- .calendar-day-popover-events button:hover { background: var(--hover); }
171
- .calendar-day-popover-events strong { display: block; color: var(--text); font-size: 13px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
172
- .calendar-day-popover-events small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
173
- .calendar-day-popover-events .completed strong { color: var(--muted); text-decoration: line-through; }
174
- button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
175
308
  </style>
@@ -0,0 +1,128 @@
1
+ <script setup lang="ts">
2
+ import { Search } from 'lucide-vue-next';
3
+ import { t } from '../../i18n/i18n';
4
+ import type { CalendarFilter } from '../calendar';
5
+
6
+ const filter = defineModel<CalendarFilter>({ required: true });
7
+ </script>
8
+
9
+ <template>
10
+ <div class="calendar-filter-bar" role="region" :aria-label="t('日历筛选')">
11
+ <div class="calendar-filter-kinds" role="group" :aria-label="t('筛选')">
12
+ <button
13
+ v-for="option in ([
14
+ { value: 'all', label: t('全部') },
15
+ { value: 'task', label: t('任务') },
16
+ { value: 'event', label: t('日程') },
17
+ ] as const)"
18
+ :key="option.value"
19
+ type="button"
20
+ :aria-pressed="filter.kind === option.value"
21
+ @click="filter.kind = option.value"
22
+ >{{ option.label }}</button>
23
+ </div>
24
+ <label class="calendar-filter-completed">
25
+ <input v-model="filter.showCompleted" type="checkbox" />
26
+ <span>{{ t('显示已完成') }}</span>
27
+ </label>
28
+ <label class="calendar-filter-search">
29
+ <Search :size="13" aria-hidden="true" />
30
+ <input
31
+ v-model="filter.query"
32
+ type="search"
33
+ :aria-label="t('搜索事项…')"
34
+ :placeholder="t('搜索事项…')"
35
+ maxlength="100"
36
+ />
37
+ </label>
38
+ </div>
39
+ </template>
40
+
41
+ <style scoped>
42
+ .calendar-filter-bar {
43
+ display: flex;
44
+ flex-wrap: wrap;
45
+ align-items: center;
46
+ gap: 12px;
47
+ padding: 8px 14px;
48
+ border-bottom: 1px solid var(--line);
49
+ background: var(--paper);
50
+ font-size: 12px;
51
+ }
52
+ .calendar-filter-kinds {
53
+ display: inline-flex;
54
+ gap: 2px;
55
+ padding: 2px;
56
+ border-radius: 7px;
57
+ background: var(--surface);
58
+ box-shadow: inset 0 0 0 1px var(--line);
59
+ }
60
+ .calendar-filter-kinds button {
61
+ min-height: 24px;
62
+ padding: 0 10px;
63
+ border-radius: 5px;
64
+ font-size: 12px;
65
+ color: var(--muted);
66
+ }
67
+ .calendar-filter-kinds button:hover { color: var(--text); background: color-mix(in srgb, var(--hover) 70%, transparent); }
68
+ .calendar-filter-kinds button[aria-pressed='true'] {
69
+ background: var(--paper);
70
+ color: var(--text);
71
+ font-weight: 500;
72
+ box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgb(15 15 15 / 0.08);
73
+ }
74
+ .calendar-filter-completed {
75
+ display: inline-flex;
76
+ align-items: center;
77
+ gap: 6px;
78
+ min-height: 28px;
79
+ padding: 0 8px 0 6px;
80
+ border-radius: 6px;
81
+ color: var(--text-secondary);
82
+ cursor: pointer;
83
+ user-select: none;
84
+ transition: background-color var(--motion-quick) var(--ease-standard), color var(--motion-quick) var(--ease-standard);
85
+ }
86
+ .calendar-filter-completed:hover { background: var(--hover); color: var(--text); }
87
+ .calendar-filter-search {
88
+ display: inline-flex;
89
+ align-items: center;
90
+ gap: 6px;
91
+ margin-left: auto;
92
+ min-height: 28px;
93
+ padding: 0 9px;
94
+ border: 1px solid var(--line);
95
+ border-radius: 7px;
96
+ background: var(--surface);
97
+ color: var(--muted);
98
+ cursor: text;
99
+ transition: border-color var(--motion-base) var(--ease-standard), background-color var(--motion-base) var(--ease-standard), box-shadow var(--motion-base) var(--ease-standard);
100
+ }
101
+ .calendar-filter-search:hover { border-color: var(--control-border); }
102
+ .calendar-filter-search:focus-within {
103
+ border-color: color-mix(in srgb, var(--text) 35%, var(--line));
104
+ background: var(--paper);
105
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 7%, transparent);
106
+ color: var(--text-secondary);
107
+ }
108
+ .calendar-filter-search input {
109
+ width: 140px;
110
+ border: 0;
111
+ padding: 0;
112
+ background: transparent;
113
+ color: var(--text);
114
+ font: inherit;
115
+ font-size: 12px;
116
+ outline: none;
117
+ transition: width var(--motion-spring) var(--ease-spring-smooth);
118
+ }
119
+ .calendar-filter-search input:focus,
120
+ .calendar-filter-search input:not(:placeholder-shown) { width: 200px; }
121
+ .calendar-filter-search input:focus-visible { outline: none; }
122
+ @media (max-width: 700px) {
123
+ .calendar-filter-bar { padding: 6px 10px; gap: 8px; }
124
+ .calendar-filter-search input,
125
+ .calendar-filter-search input:focus,
126
+ .calendar-filter-search input:not(:placeholder-shown) { width: 110px; }
127
+ }
128
+ </style>
@@ -0,0 +1,224 @@
1
+ <script setup lang="ts">
2
+ import { Circle, CircleCheck, Flag, Plus } from 'lucide-vue-next';
3
+ import { t, uiLocale } from '../../i18n/i18n';
4
+ import type { ObjectRecord } from '../../objects/workspace-objects';
5
+ import {
6
+ calendarDayEntries,
7
+ isCheckableEvent,
8
+ isEventCompleted,
9
+ localDayKey,
10
+ weekDays,
11
+ } from '../calendar';
12
+ import { planKey, sourcePlanKey } from '../personal-plans';
13
+ import type { PlanDateValue } from '../plan-date';
14
+ import type { CalendarInteractions } from '../composables/use-calendar-interactions';
15
+
16
+ const props = defineProps<{
17
+ scrollingWeeks: readonly Date[];
18
+ planned: readonly ObjectRecord[];
19
+ today: string;
20
+ weekdays: readonly string[];
21
+ canCreate: boolean;
22
+ dayPopoverKey?: string;
23
+ dayPopoverId: string;
24
+ interactions: CalendarInteractions;
25
+ }>();
26
+
27
+ const emit = defineEmits<{
28
+ 'select-date': [date: Date];
29
+ 'select-event': [id: string];
30
+ 'open-day-popover': [day: Date, event: MouseEvent];
31
+ 'open-quick-create': [planDate: PlanDateValue, checkable?: boolean];
32
+ }>();
33
+
34
+ const weekKey = localDayKey;
35
+
36
+ function monthShade(day: Date) {
37
+ return (day.getFullYear() * 12 + day.getMonth()) % 2 === 1;
38
+ }
39
+
40
+ function dayEntries(day: Date) {
41
+ return calendarDayEntries(props.planned, day);
42
+ }
43
+ </script>
44
+
45
+ <template>
46
+ <div class="calendar-month-view">
47
+ <div class="calendar-month-weekdays" aria-hidden="true">
48
+ <span v-for="name in weekdays" :key="name">{{ uiLocale === 'zh-CN' ? t('周') : '' }}{{ name }}</span>
49
+ </div>
50
+ <div
51
+ v-for="week in scrollingWeeks"
52
+ :key="weekKey(week)"
53
+ class="calendar-month-week"
54
+ :data-week="weekKey(week)"
55
+ >
56
+ <div
57
+ v-for="day in weekDays(week)"
58
+ :key="localDayKey(day)"
59
+ class="calendar-month-cell"
60
+ :class="{
61
+ shaded: monthShade(day),
62
+ 'is-drop-target': interactions.dropTarget.value?.zone === 'day' && interactions.dropTarget.value.dayKey === localDayKey(day),
63
+ }"
64
+ :data-day="localDayKey(day)"
65
+ @dblclick.self="emit('open-quick-create', { date: localDayKey(day), time: '', end: '' }, false)"
66
+ @dragover="interactions.onDayDragOver(day, $event)"
67
+ @dragleave="interactions.onDragLeave"
68
+ @drop.prevent="interactions.onDayDrop(day, $event)"
69
+ >
70
+ <div class="calendar-month-cell-header">
71
+ <button
72
+ v-if="canCreate"
73
+ type="button"
74
+ class="calendar-month-add"
75
+ :aria-label="t('为 {0} 添加事件', [localDayKey(day)])"
76
+ @click.stop="emit('open-quick-create', { date: localDayKey(day), time: '', end: '' }, false)"
77
+ ><Plus :size="12" aria-hidden="true" /></button>
78
+ <button
79
+ type="button"
80
+ class="calendar-month-date"
81
+ :class="{ today: localDayKey(day) === today, 'month-start': day.getDate() === 1 }"
82
+ :aria-label="t('{0},查看日视图', [localDayKey(day)])"
83
+ @click="emit('select-date', day)"
84
+ >{{ day.getDate() === 1 ? t('{0} 月 1 日', [day.getMonth() + 1]) : day.getDate() }}</button>
85
+ </div>
86
+ <div
87
+ v-for="entry in dayEntries(day).slice(0, 3)"
88
+ :key="`${planKey(entry.record)}:${entry.kind}`"
89
+ class="calendar-month-event"
90
+ :class="interactions.itemClasses(entry.record, entry.kind)"
91
+ :draggable="entry.kind !== 'due' && interactions.canDragRecord(entry.record)"
92
+ :data-tooltip="interactions.entryTooltip(entry)"
93
+ @dragstart="interactions.onEventDragStart(entry.record, $event)"
94
+ @dragend="interactions.onEventDragEnd"
95
+ >
96
+ <button
97
+ v-if="isCheckableEvent(entry.record)"
98
+ type="button"
99
+ class="calendar-inline-check"
100
+ :aria-label="`${isEventCompleted(entry.record) ? t('标记未完成') : t('完成')}:${entry.record.object.name}`"
101
+ :disabled="!interactions.canToggleComplete(entry.record)"
102
+ @click.stop="interactions.toggleComplete(entry.record)"
103
+ >
104
+ <CircleCheck v-if="isEventCompleted(entry.record)" :size="11" aria-hidden="true" />
105
+ <Circle v-else :size="11" aria-hidden="true" />
106
+ </button>
107
+ <Flag v-if="entry.kind === 'due'" :size="10" class="calendar-due-flag" aria-hidden="true" />
108
+ <button
109
+ type="button"
110
+ class="calendar-item-trigger"
111
+ @click="emit('select-event', sourcePlanKey(entry.record))"
112
+ ><time v-if="entry.kind === 'timed'" class="calendar-item-time">{{ interactions.entryTime(entry) }}</time>{{ entry.record.object.name }}</button>
113
+ </div>
114
+ <button
115
+ v-if="dayEntries(day).length > 3"
116
+ type="button"
117
+ class="calendar-month-more"
118
+ aria-haspopup="dialog"
119
+ :aria-expanded="localDayKey(day) === dayPopoverKey"
120
+ :aria-controls="localDayKey(day) === dayPopoverKey ? dayPopoverId : undefined"
121
+ @click="emit('open-day-popover', day, $event)"
122
+ >{{ t('另有 {0} 项', [dayEntries(day).length - 3]) }}</button>
123
+ </div>
124
+ </div>
125
+ </div>
126
+ </template>
127
+
128
+ <style scoped>
129
+ .calendar-month-view { min-width: 630px; }
130
+ .calendar-month-weekdays,
131
+ .calendar-month-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
132
+ .calendar-month-weekdays {
133
+ position: sticky;
134
+ top: 0;
135
+ z-index: 2;
136
+ background: var(--paper);
137
+ border-bottom: 1px solid var(--line);
138
+ }
139
+ .calendar-month-weekdays span {
140
+ padding: 11px 8px;
141
+ color: var(--muted);
142
+ font-size: 12px;
143
+ text-align: center;
144
+ }
145
+ .calendar-month-cell {
146
+ display: flex;
147
+ flex-direction: column;
148
+ gap: 2px;
149
+ min-height: 108px;
150
+ min-width: 0;
151
+ padding: 6px;
152
+ border-right: 1px solid var(--line);
153
+ border-bottom: 1px solid var(--line);
154
+ overflow: hidden;
155
+ transition: background-color var(--motion-quick) var(--ease-standard), box-shadow var(--motion-quick) var(--ease-standard);
156
+ }
157
+ .calendar-month-cell.shaded { background: color-mix(in srgb, var(--surface) 55%, var(--paper)); }
158
+ .calendar-month-cell-header {
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: flex-end;
162
+ gap: 4px;
163
+ margin-bottom: 3px;
164
+ }
165
+ .calendar-month-add {
166
+ display: grid;
167
+ place-items: center;
168
+ width: 22px;
169
+ height: 22px;
170
+ margin-right: auto;
171
+ border-radius: 6px;
172
+ color: var(--muted);
173
+ opacity: 0;
174
+ scale: 0.8;
175
+ transition:
176
+ opacity var(--motion-quick) var(--ease-standard),
177
+ scale var(--motion-spring) var(--ease-spring),
178
+ background-color var(--motion-quick) var(--ease-standard),
179
+ color var(--motion-quick) var(--ease-standard);
180
+ }
181
+ .calendar-month-cell:hover .calendar-month-add,
182
+ .calendar-month-add:focus-visible { opacity: 1; scale: 1; }
183
+ .calendar-month-add:hover { background: var(--hover); color: var(--text); }
184
+ .calendar-month-date {
185
+ display: grid;
186
+ place-items: center;
187
+ width: 26px;
188
+ height: 26px;
189
+ border-radius: 13px;
190
+ font-variant-numeric: tabular-nums;
191
+ margin: 0;
192
+ color: var(--text-secondary);
193
+ font-size: 12px;
194
+ }
195
+ .calendar-month-date.month-start { width: auto; min-width: 26px; padding: 0 8px; color: var(--text); font-weight: 600; }
196
+ .calendar-month-date:hover:not(.today) { background: var(--hover); color: var(--text); }
197
+ .calendar-month-date.today:hover { background: var(--green-fill-hover); color: var(--on-accent, white); }
198
+ .calendar-month-event { width: 100%; }
199
+ .calendar-month-event.is-timed:not(.is-due) { background: transparent; }
200
+ .calendar-month-event.is-timed:not(.is-due):not(:has(.calendar-inline-check))::before {
201
+ content: '';
202
+ flex: none;
203
+ width: 6px;
204
+ height: 6px;
205
+ margin-left: -2px;
206
+ border-radius: 50%;
207
+ background: color-mix(in srgb, var(--tone) 70%, var(--paper));
208
+ }
209
+ .calendar-month-event.is-timed:not(.is-due):hover,
210
+ .calendar-month-event.is-timed:not(.is-due):focus-within { background: color-mix(in srgb, var(--tone) 8%, var(--paper)); }
211
+ .calendar-month-more {
212
+ display: block;
213
+ width: 100%;
214
+ margin-top: 1px;
215
+ padding: 2px 6px;
216
+ border-radius: 5px;
217
+ color: var(--muted);
218
+ font-size: 11px;
219
+ font-weight: 500;
220
+ text-align: left;
221
+ }
222
+ .calendar-month-more:hover,
223
+ .calendar-month-more[aria-expanded='true'] { background: var(--hover); color: var(--text); }
224
+ </style>