@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
@@ -1,10 +1,34 @@
1
- import { ObjectTypeRegistry, objectTypeRegistry, parseObjectPlugin, parsePluginManifest, parsePluginSettings, parsePluginPolicy, canonicalPluginJson } from '@tano/protocol';
2
- import type { PluginManifest, PluginMode, PluginPackage, Workspace, WorkspaceAdapter, WorkspacePluginRule } from '@tano/protocol';
3
- import { canManageWorkspacePlugins, loadPluginPolicy, savePluginRule } from './policy';
1
+ import {
2
+ ObjectTypeRegistry,
3
+ objectTypeRegistry,
4
+ parseObjectPlugin,
5
+ parsePluginManifest,
6
+ parsePluginPackage,
7
+ parsePluginPathScopes,
8
+ parsePluginSettings,
9
+ parsePluginPolicy,
10
+ canonicalPluginJson,
11
+ externalizeHeavyIconAssets,
12
+ hasRasterIconAssets,
13
+ hydratePluginPackageAssets,
14
+ } from '@tano/protocol';
15
+ import type { PluginManifest, PluginMode, PluginPackage, Workspace, WorkspaceAdapter, WorkspacePersonalPluginPolicy, WorkspacePluginRule } from '@tano/protocol';
16
+ import { canManageWorkspacePlugins, loadPluginPolicy, savePluginRule, saveWorkspacePersonalPluginPolicy } from './policy';
4
17
  import type { PluginPolicySnapshot } from './policy';
5
18
  import { PluginPackageCache, type PluginPackageRepository } from './packages';
6
19
  import { systemPlugin } from './system';
20
+ import {
21
+ installUserPlugin,
22
+ readUserPlugins,
23
+ resolveUserPlugins,
24
+ setUserPluginEnabled,
25
+ setUserPluginGlobalAuthorization,
26
+ setUserPluginSettings,
27
+ uninstallUserPlugin,
28
+ type PluginInstallScope,
29
+ } from './user-plugins';
7
30
 
31
+ export type { PluginInstallScope } from './user-plugins';
8
32
  export const retiredSystemPlugin = (id: string) => id === 'git-inspector';
9
33
  const retiredMessage = 'Git 功能已内置,请从工作区菜单打开“Git 与同步”,无需安装或授权插件';
10
34
 
@@ -13,6 +37,16 @@ export const PLUGINS_TAB_ID = 'view:plugins';
13
37
  export interface InstalledObjectPlugin {
14
38
  /** Product-owned registration; never copied from untrusted package metadata. */
15
39
  system?: boolean;
40
+ /** Where the active plugin installation originates. */
41
+ scope?: PluginInstallScope;
42
+ /** True when a workspace rule shadows a user-scoped plugin with the same ID. */
43
+ shadowedUserPlugin?: boolean;
44
+ /** True when a user-scoped v2 plugin has exact-version authorization across owned workspaces. */
45
+ globallyAuthorized?: boolean;
46
+ /** Effective team workspace policy applied to user-scoped executable plugins. */
47
+ personalCodePolicy?: WorkspacePersonalPluginPolicy;
48
+ /** Effective directory prefix allowlist restricting document/attachment access. */
49
+ pathScopes?: string[];
16
50
  manifest: PluginManifest;
17
51
  enabled: boolean;
18
52
  rule?: WorkspacePluginRule;
@@ -20,9 +54,19 @@ export interface InstalledObjectPlugin {
20
54
  }
21
55
  const keyFor = (workspace: string) => `tano.object-plugins.v1.${encodeURIComponent(workspace)}`;
22
56
  export type PluginChange =
23
- { install: PluginManifest; package?: PluginPackage; sourceUrl?: string } | { id: string; enabled: boolean } | { uninstall: string }
57
+ | {
58
+ install: PluginManifest;
59
+ package?: PluginPackage;
60
+ binaryAssets?: Record<string, Uint8Array>;
61
+ sourceUrl?: string;
62
+ scope?: 'workspace' | 'user';
63
+ }
64
+ | { id: string; enabled: boolean; scope?: 'workspace' | 'user' }
65
+ | { uninstall: string; scope?: 'workspace' | 'user' }
24
66
  | { id: string; forgetVersion: string }
25
- | { id: string; mode: PluginMode; settings: Record<string, unknown>; sourceUrl?: string };
67
+ | { id: string; mode: PluginMode; settings: Record<string, unknown>; sourceUrl?: string; pathScopes?: string[] }
68
+ | { id: string; settings: Record<string, unknown>; pathScopes?: string[]; scope: 'user' }
69
+ | { personalCodePlugins: WorkspacePersonalPluginPolicy };
26
70
 
27
71
  /** Portable administrator rules and device/account-scoped activation and authorization. */
28
72
  export class WorkspacePluginHost {
@@ -97,6 +141,7 @@ export class WorkspacePluginHost {
97
141
  return plugins;
98
142
  }
99
143
  async change(workspace: string, change: PluginChange) {
144
+ if ('personalCodePlugins' in change) throw new Error('仅共享工作区支持配置个人代码插件策略');
100
145
  const id = 'install' in change ? change.install.id : 'uninstall' in change ? change.uninstall : change.id;
101
146
  if (this.systemIds.includes(id)) throw new Error('系统插件随应用更新,不能导入替换或卸载');
102
147
  if (retiredSystemPlugin(id) && !('uninstall' in change)) throw new Error(retiredMessage);
@@ -142,28 +187,117 @@ export class WorkspacePluginHost {
142
187
  preferences[id] = { ...preferences[id], ...value };
143
188
  this.storage.setItem(`tano.plugin-preferences.v1.${encodeURIComponent(this.principal)}.${encodeURIComponent(workspace)}`, JSON.stringify(preferences));
144
189
  }
145
- authorize(workspace: string, id: string, integrity: string | undefined, expectedAuthorization?: string) {
190
+ userPluginIntegrities(): Set<string> {
191
+ try {
192
+ return new Set(readUserPlugins(this.storage, this.principal).map((row) => row.integrity));
193
+ } catch {
194
+ return new Set();
195
+ }
196
+ }
197
+ authorize(
198
+ workspace: string,
199
+ id: string,
200
+ integrity: string | undefined,
201
+ expectedAuthorization?: string,
202
+ options?: { allWorkspaces?: boolean },
203
+ ) {
146
204
  if (this.systemIds.includes(id)) throw new Error('系统插件无需单独授权,请使用启用或停用');
147
205
  if (workspace !== this.workspaceId) throw new Error('工作区已切换');
148
206
  const rule = this.shared?.policy.plugins.find(row => row.manifest.id === id);
149
- if (!rule || (integrity && rule.integrity !== integrity)) throw new Error('插件版本已变化,请重新查看权限');
207
+ if (rule) {
208
+ if (integrity && rule.integrity !== integrity) throw new Error('插件版本已变化,请重新查看权限');
209
+ if (expectedAuthorization !== undefined && this.preferences(workspace)[id]?.integrity !== expectedAuthorization)
210
+ throw new Error('原版本授权已撤销或变化,开发会话已停止');
211
+ this.setPreference(workspace, id, { integrity: integrity ?? '' });
212
+ return;
213
+ }
214
+ const userRecord = readUserPlugins(this.storage, this.principal).find(row => row.id === id);
215
+ if (!userRecord || (integrity && userRecord.integrity !== integrity))
216
+ throw new Error('插件版本已变化,请重新查看权限');
150
217
  if (expectedAuthorization !== undefined && this.preferences(workspace)[id]?.integrity !== expectedAuthorization)
151
218
  throw new Error('原版本授权已撤销或变化,开发会话已停止');
152
219
  this.setPreference(workspace, id, { integrity: integrity ?? '' });
220
+ if (!integrity) setUserPluginGlobalAuthorization(id, undefined, this.storage, this.principal);
221
+ else if (options?.allWorkspaces) setUserPluginGlobalAuthorization(id, integrity, this.storage, this.principal);
222
+ }
223
+ personalCodePluginPolicy(): WorkspacePersonalPluginPolicy {
224
+ return this.shared?.policy.personalCodePlugins ?? 'allow';
153
225
  }
154
- async loadWorkspace(adapter: WorkspaceAdapter, workspace: Workspace) {
226
+ async loadWorkspace(adapter: WorkspaceAdapter, workspace: Workspace, repository?: PluginPackageRepository) {
155
227
  const shared = await loadPluginPolicy(adapter, workspace);
156
228
  this.workspaceId = workspace.id;
157
229
  this.shared = shared;
230
+ const personalPolicy = shared.policy.personalCodePlugins ?? 'allow';
158
231
  const preferences = this.preferences(workspace.id);
159
- const plugins: InstalledObjectPlugin[] = shared.snapshot ? shared.policy.plugins.filter(rule => !retiredSystemPlugin(rule.manifest.id) && !this.systemIds.includes(rule.manifest.id)).map(rule => ({ manifest: rule.manifest, rule,
160
- enabled: rule.mode === 'required' || (rule.mode !== 'disabled' && (preferences[rule.manifest.id]?.enabled ?? rule.mode === 'recommended')),
161
- authorized: rule.manifest.manifestVersion === 1 || preferences[rule.manifest.id]?.integrity === rule.integrity,
162
- })) : this.read(workspace.id).filter(item => !retiredSystemPlugin(item.manifest.id) && !this.systemIds.includes(item.manifest.id));
232
+ const cache = new PluginPackageCache(this.storage);
233
+ const plugins: InstalledObjectPlugin[] = shared.snapshot
234
+ ? await Promise.all(
235
+ shared.policy.plugins
236
+ .filter(rule => !retiredSystemPlugin(rule.manifest.id) && !this.systemIds.includes(rule.manifest.id))
237
+ .map(async rule => {
238
+ let manifest = rule.manifest;
239
+ if (rule.manifest.appearance?.iconRefs?.length && rule.integrity) {
240
+ const pkg = await cache.resolve(workspace.id, rule, AbortSignal.timeout(15000), repository).catch(() => null);
241
+ if (pkg) manifest = hydratePluginPackageAssets(rule.manifest, pkg);
242
+ }
243
+ return {
244
+ manifest,
245
+ scope: 'workspace' as const,
246
+ rule,
247
+ ...(rule.pathScopes?.length ? { pathScopes: [...rule.pathScopes] } : {}),
248
+ enabled: rule.mode === 'required' || (rule.mode !== 'disabled' && (preferences[rule.manifest.id]?.enabled ?? rule.mode === 'recommended')),
249
+ authorized: rule.manifest.manifestVersion === 1 || preferences[rule.manifest.id]?.integrity === rule.integrity,
250
+ };
251
+ }),
252
+ )
253
+ : this.read(workspace.id)
254
+ .filter(item => !retiredSystemPlugin(item.manifest.id) && !this.systemIds.includes(item.manifest.id))
255
+ .map(item => ({ ...item, scope: 'workspace' as const }));
256
+ const workspaceById = new Map(plugins.map(item => [item.manifest.id, item]));
257
+ const canUseGlobalAuth = canManageWorkspacePlugins(adapter, workspace) && personalPolicy === 'allow';
258
+ for (const { record, pkg } of await resolveUserPlugins(this.storage, this.principal)) {
259
+ if (retiredSystemPlugin(record.id) || this.systemIds.includes(record.id)) continue;
260
+ const shadowed = workspaceById.get(record.id);
261
+ if (shadowed) {
262
+ // Workspace rules (including mode: 'disabled') always take precedence over user-scope plugins.
263
+ shadowed.shadowedUserPlugin = true;
264
+ continue;
265
+ }
266
+ const hydratedManifest = hydratePluginPackageAssets(pkg.manifest, pkg);
267
+ const isCode = pkg.manifest.manifestVersion === 2;
268
+ const globallyAuthorized = isCode && record.authorizedIntegrity === record.integrity;
269
+ const authorized =
270
+ !isCode ||
271
+ (personalPolicy !== 'block' &&
272
+ (preferences[record.id]?.integrity === record.integrity || (canUseGlobalAuth && globallyAuthorized)));
273
+ plugins.push({
274
+ manifest: hydratedManifest,
275
+ scope: 'user',
276
+ enabled: record.enabled,
277
+ authorized,
278
+ globallyAuthorized,
279
+ ...(isCode ? { personalCodePolicy: personalPolicy } : {}),
280
+ ...(record.pathScopes?.length ? { pathScopes: [...record.pathScopes] } : {}),
281
+ rule: {
282
+ manifest: pkg.manifest,
283
+ integrity: record.integrity,
284
+ mode: 'optional',
285
+ settings: record.settings,
286
+ ...(record.pathScopes?.length ? { pathScopes: [...record.pathScopes] } : {}),
287
+ ...(record.sourceUrl ? { sourceUrl: record.sourceUrl } : {}),
288
+ },
289
+ });
290
+ }
163
291
  for (const id of this.systemIds) {
164
292
  const { pkg, integrity } = await systemPlugin(id);
165
- plugins.push({ manifest: pkg.manifest, system: true, enabled: preferences[id]?.enabled ?? true, authorized: true,
166
- rule: { manifest: pkg.manifest, integrity, mode: 'recommended', settings: {} } });
293
+ plugins.push({
294
+ manifest: pkg.manifest,
295
+ system: true,
296
+ scope: 'system',
297
+ enabled: preferences[id]?.enabled ?? true,
298
+ authorized: true,
299
+ rule: { manifest: pkg.manifest, integrity, mode: 'recommended', settings: {} },
300
+ });
167
301
  }
168
302
  this.validate(plugins);
169
303
  this.apply(plugins);
@@ -172,6 +306,12 @@ export class WorkspacePluginHost {
172
306
  async changeWorkspace(adapter: WorkspaceAdapter, workspace: Workspace, change: PluginChange,
173
307
  assertCurrent: () => void, repository?: PluginPackageRepository) {
174
308
  if (this.workspaceId !== workspace.id || !this.shared) throw new Error('请先载入工作区插件规则');
309
+ if ('personalCodePlugins' in change) {
310
+ if (!canManageWorkspacePlugins(adapter, workspace)) throw new Error('仅工作区管理员可以修改插件规则');
311
+ assertCurrent();
312
+ this.shared = await saveWorkspacePersonalPluginPolicy(adapter, this.shared, change.personalCodePlugins, assertCurrent);
313
+ return;
314
+ }
175
315
  const id = 'install' in change ? change.install.id : 'uninstall' in change ? change.uninstall : change.id;
176
316
  if (this.systemIds.includes(id)) {
177
317
  assertCurrent();
@@ -180,6 +320,34 @@ export class WorkspacePluginHost {
180
320
  }
181
321
  if (retiredSystemPlugin(id) && !('uninstall' in change)) throw new Error(retiredMessage);
182
322
  const rule = this.shared.policy.plugins.find(row => row.manifest.id === id);
323
+ const hasWorkspaceRecord = !!rule || (!this.shared.snapshot && this.read(workspace.id).some(row => row.manifest.id === id));
324
+ const hasUserRecord = readUserPlugins(this.storage, this.principal).some(row => row.id === id);
325
+ if ('install' in change && change.scope === 'user') {
326
+ assertCurrent();
327
+ await installUserPlugin(change.install, change.package, {
328
+ storage: this.storage,
329
+ principal: this.principal,
330
+ sourceUrl: change.sourceUrl,
331
+ binaryAssets: change.binaryAssets,
332
+ });
333
+ assertCurrent();
334
+ return;
335
+ }
336
+ if ('settings' in change && !('mode' in change) && change.scope === 'user') {
337
+ assertCurrent();
338
+ setUserPluginSettings(id, change.settings, this.storage, this.principal, change.pathScopes);
339
+ return;
340
+ }
341
+ if ('enabled' in change && (change.scope === 'user' || (change.scope === undefined && !hasWorkspaceRecord && hasUserRecord))) {
342
+ assertCurrent();
343
+ setUserPluginEnabled(id, change.enabled, this.storage, this.principal);
344
+ return;
345
+ }
346
+ if ('uninstall' in change && (change.scope === 'user' || (change.scope === undefined && !hasWorkspaceRecord && hasUserRecord))) {
347
+ assertCurrent();
348
+ uninstallUserPlugin(id, this.storage, this.principal);
349
+ return;
350
+ }
183
351
  if ('enabled' in change && this.shared.snapshot) {
184
352
  if (!rule) throw new Error('插件已被卸载,请刷新后重试');
185
353
  if (rule.mode === 'required' || rule.mode === 'disabled') throw new Error('此插件由工作区管理员统一控制');
@@ -189,17 +357,33 @@ export class WorkspacePluginHost {
189
357
  if (!canManageWorkspacePlugins(adapter, workspace)) throw new Error('仅工作区管理员可以修改插件规则');
190
358
  let desired: WorkspacePluginRule | null = null;
191
359
  if ('install' in change) {
192
- const manifest = parsePluginManifest(change.install);
360
+ let manifest = parsePluginManifest(change.install);
193
361
  let integrity: string | undefined;
194
- if (manifest.manifestVersion === 2) {
195
- if (!change.package || canonicalPluginJson(change.package.manifest) !== canonicalPluginJson(manifest)) throw new Error('请导入包含此版本脚本的插件包');
362
+ let sourceUrl = change.sourceUrl;
363
+ if (manifest.manifestVersion === 2 || manifest.appearance?.iconRefs?.length || hasRasterIconAssets(manifest)) {
364
+ const inputPkg =
365
+ change.package && canonicalPluginJson(change.package.manifest) === canonicalPluginJson(manifest)
366
+ ? parsePluginPackage(JSON.stringify(change.package))
367
+ : manifest.manifestVersion === 1 && !manifest.appearance?.iconRefs?.length
368
+ ? parsePluginPackage(JSON.stringify({ packageVersion: 1, manifest }))
369
+ : (() => {
370
+ throw new Error(
371
+ manifest.manifestVersion === 2
372
+ ? '请导入包含此版本脚本的插件包'
373
+ : '请导入包含此版本图标资产的完整插件包',
374
+ );
375
+ })();
376
+ const normalizedPkg = externalizeHeavyIconAssets(inputPkg);
377
+ if (canonicalPluginJson(normalizedPkg) !== canonicalPluginJson(inputPkg)) sourceUrl = undefined;
378
+ manifest = normalizedPkg.manifest;
196
379
  const cache = new PluginPackageCache(this.storage);
197
- integrity = await cache.put(change.package);
380
+ integrity = await cache.put(normalizedPkg, change.binaryAssets);
198
381
  assertCurrent();
199
- if (repository) await repository.publish(workspace.id, integrity, canonicalPluginJson(change.package));
382
+ if (repository) await repository.publish(workspace.id, integrity, canonicalPluginJson(normalizedPkg));
200
383
  }
201
384
  desired = { manifest, mode: rule?.mode ?? 'recommended', settings: rule?.settings ?? {},
202
- ...(integrity ? { integrity } : {}), ...(change.sourceUrl ? { sourceUrl: change.sourceUrl } : {}) };
385
+ ...(rule?.pathScopes?.length ? { pathScopes: rule.pathScopes } : {}),
386
+ ...(integrity ? { integrity } : {}), ...(sourceUrl ? { sourceUrl } : {}) };
203
387
  if (rule) {
204
388
  const same = rule.integrity === integrity && canonicalPluginJson(rule.manifest) === canonicalPluginJson(manifest);
205
389
  const previous = { manifest: rule.manifest, ...(rule.integrity ? { integrity: rule.integrity } : {}), ...(rule.sourceUrl ? { sourceUrl: rule.sourceUrl } : {}), recordedAt: new Date().toISOString() };
@@ -212,7 +396,14 @@ export class WorkspacePluginHost {
212
396
  desired = { ...rule, history: rule.history.filter(version => version.integrity !== change.forgetVersion) };
213
397
  } else if ('mode' in change) {
214
398
  if (!rule) throw new Error('插件已被卸载,请刷新后重试');
215
- desired = { ...rule, mode: change.mode, settings: parsePluginSettings(change.settings), sourceUrl: change.sourceUrl || undefined };
399
+ const nextScopes = change.pathScopes === undefined ? rule.pathScopes : parsePluginPathScopes(change.pathScopes);
400
+ desired = {
401
+ ...rule,
402
+ mode: change.mode,
403
+ settings: parsePluginSettings(change.settings),
404
+ sourceUrl: change.sourceUrl || undefined,
405
+ ...(nextScopes?.length ? { pathScopes: nextScopes } : { pathScopes: undefined }),
406
+ };
216
407
  } else if ('enabled' in change) {
217
408
  const legacy = this.read(workspace.id).find(row => row.manifest.id === id);
218
409
  if (!legacy) throw new Error('插件已被卸载');
package/src/runtime.ts CHANGED
@@ -72,6 +72,85 @@ export interface WorkbenchObjectDetailsProps {
72
72
  object: WorkspaceObject;
73
73
  disabled: boolean;
74
74
  }
75
+ export interface WorkbenchPinnedCommand {
76
+ id: string;
77
+ label: string;
78
+ command: string;
79
+ description?: string;
80
+ }
81
+ export interface WorkbenchOverlaySnapshot {
82
+ readonly safeMode: boolean;
83
+ readonly hiddenSidebarItems?: readonly string[];
84
+ readonly sidebarOrder?: readonly string[];
85
+ readonly pinnedCommands?: readonly WorkbenchPinnedCommand[];
86
+ readonly homeTabViewKey?: string;
87
+ readonly newTabViewKey?: string;
88
+ }
89
+ export interface WorkbenchOverlayExtension {
90
+ readonly snapshot: WorkbenchOverlaySnapshot;
91
+ setSafeMode(enabled: boolean): void;
92
+ syncContext?(workspaceId: string, activeDocumentPath?: string): void;
93
+ dispose?(): void;
94
+ }
95
+ export interface WorkbenchAssistantToolExecutionContext {
96
+ workspaceId: string;
97
+ workspacePath: string;
98
+ runId: string;
99
+ activeDocumentId?: string;
100
+ signal: AbortSignal;
101
+ }
102
+ export type WorkbenchAssistantToolExecutionResult =
103
+ | { kind: 'result'; data: unknown }
104
+ | { kind: 'proposal'; proposal: import('@tano/protocol').AssistantProposal };
105
+ export interface WorkbenchAssistantStarter {
106
+ id: string;
107
+ label: string;
108
+ prompt: string;
109
+ icon?: Component;
110
+ requiresActiveDocument?: boolean;
111
+ }
112
+ export interface WorkbenchAssistantCapabilityNote {
113
+ id: string;
114
+ label: string;
115
+ detail?: string;
116
+ tone?: 'default' | 'warning';
117
+ }
118
+ export interface WorkbenchAssistantProposalCardDescriptor {
119
+ component: Component;
120
+ kindLabel?: string;
121
+ applyLabel?: string;
122
+ defaultOpen?: boolean;
123
+ hideDefaultDiff?: boolean;
124
+ hideDefaultActions?: boolean;
125
+ }
126
+ export interface WorkbenchAssistantExtension {
127
+ listTools(context: {
128
+ workspaceReadOnly: boolean;
129
+ inline: boolean;
130
+ background: boolean;
131
+ }): NonNullable<import('@tano/protocol').AssistantRequest['tools']>;
132
+ toolLabel?(name: string): string | undefined;
133
+ promptHints?(context: { workspaceReadOnly: boolean }): string[];
134
+ executeTool(
135
+ name: string,
136
+ args: Record<string, unknown>,
137
+ context: WorkbenchAssistantToolExecutionContext,
138
+ ): Promise<WorkbenchAssistantToolExecutionResult | undefined>;
139
+ applyProposal?(
140
+ proposal: import('@tano/protocol').AssistantProposal,
141
+ parsedArgs: Record<string, unknown>,
142
+ ): Promise<{ before?: string; after: string; hash: string; fileId: string; undoSnapshot?: string } | undefined>;
143
+ canUndoProposal?(proposal: import('@tano/protocol').AssistantProposal): boolean;
144
+ undoProposal?(proposal: import('@tano/protocol').AssistantProposal): Promise<boolean>;
145
+ proposalCard?(
146
+ proposal: import('@tano/protocol').AssistantProposal,
147
+ ): WorkbenchAssistantProposalCardDescriptor | undefined;
148
+ starters?(context: { demo: boolean }): readonly WorkbenchAssistantStarter[];
149
+ capabilitySummary?(context: {
150
+ workspaceReadOnly: boolean;
151
+ safeMode: boolean;
152
+ }): readonly WorkbenchAssistantCapabilityNote[];
153
+ }
75
154
  export interface WorkbenchExtensions {
76
155
  commands?: import('./shell/command-palette').WorkbenchCommand[];
77
156
  editing: EditingSession;
@@ -79,16 +158,20 @@ export interface WorkbenchExtensions {
79
158
  documentStatus?(id: string): DocumentSyncStatus | undefined;
80
159
  /**
81
160
  * workspace-menu-layout can wrap built-in workspace actions through its default slot.
82
- * plugin-publishing receives WorkbenchActions in the plugin center's My submissions view.
161
+ * plugin-customize receives WorkbenchActions in the plugin center's user-facing customization tab.
162
+ * plugin-forge receives WorkbenchActions + { canPublish, developerMode } inside the Developer Area.
163
+ * plugin-publishing receives WorkbenchActions inside the Developer Area's submissions view.
83
164
  */
84
165
  regions: Record<string, Component>;
85
166
  views?: readonly WorkbenchView[];
167
+ /** Optional product-owned workbench overlay hook (Safe Mode, sidebar overrides, home/new tab views). */
168
+ overlay?: WorkbenchOverlayExtension;
169
+ /** Optional product-owned assistant tools, prompt hints, and proposal appliers. */
170
+ assistant?: WorkbenchAssistantExtension;
86
171
  /** Receives WorkbenchObjectDetailsProps for a saved workspace object. */
87
172
  objectDetails?: Component;
88
173
  commentAuthor?: () => CommentAuthor;
89
174
  settingsPages?: SettingsPage[];
90
- /** Optional cloud backend configuration; system owns the common entry point. */
91
- sync?: { readonly enabled: boolean; open(): void; disconnect(): Promise<void> };
92
175
  historyView?: Component;
93
176
  readonly historyEnabled?: boolean;
94
177
  refresh(): Promise<unknown>;
@@ -111,6 +194,10 @@ export interface WorkbenchRuntime {
111
194
  accountImports?: ImportAccountHost;
112
195
  native: boolean;
113
196
  mobile: boolean;
197
+ /** Optional stateless overlay hook available before workspace store initialization. */
198
+ overlay?: WorkbenchOverlayExtension;
199
+ /** Optional stateless assistant extension hook available before workspace store initialization. */
200
+ assistantExtension?: WorkbenchAssistantExtension;
114
201
  extensions?: () => WorkbenchExtensions;
115
202
  }
116
203
 
@@ -119,6 +206,10 @@ export interface WorkbenchRuntime {
119
206
  export const CLOUD_EXTENSION_API_VERSION = 1 as const;
120
207
  export interface CloudExtension {
121
208
  readonly apiVersion: typeof CLOUD_EXTENSION_API_VERSION;
209
+ /** Optional stateless overlay hook resolved without instantiating workspace-bound extensions. */
210
+ readonly overlay?: WorkbenchOverlayExtension;
211
+ /** Optional stateless assistant extension hook resolved without instantiating workspace-bound extensions. */
212
+ readonly assistant?: WorkbenchAssistantExtension;
122
213
  createWorkbenchExtensions(pinia: Pinia): WorkbenchExtensions;
123
214
  }
124
215
 
@@ -132,16 +223,24 @@ export function configureWorkbench(pinia: Pinia, runtime: WorkbenchRuntime) {
132
223
  }
133
224
  export function configureWorkbenchWithCloudExtension(
134
225
  pinia: Pinia,
135
- runtime: Omit<WorkbenchRuntime, 'extensions'>,
226
+ runtime: Omit<WorkbenchRuntime, 'extensions' | 'overlay' | 'assistantExtension'>,
136
227
  cloud: CloudExtension,
137
228
  ) {
138
229
  if (cloud.apiVersion !== CLOUD_EXTENSION_API_VERSION)
139
230
  throw new Error(`不支持的云扩展接口版本:${cloud.apiVersion}`);
140
231
  return configureWorkbench(pinia, {
141
232
  ...runtime,
233
+ ...(cloud.overlay ? { overlay: cloud.overlay } : {}),
234
+ ...(cloud.assistant ? { assistantExtension: cloud.assistant } : {}),
142
235
  extensions: () => cloud.createWorkbenchExtensions(pinia),
143
236
  });
144
237
  }
238
+ export function resolveOverlayExtension(runtime: WorkbenchRuntime): WorkbenchOverlayExtension | undefined {
239
+ return runtime.overlay ?? runtime.extensions?.().overlay;
240
+ }
241
+ export function resolveAssistantExtension(runtime: WorkbenchRuntime): WorkbenchAssistantExtension | undefined {
242
+ return runtime.assistantExtension ?? runtime.extensions?.().assistant;
243
+ }
145
244
  export function useWorkbenchRuntime(): WorkbenchRuntime {
146
245
  const pinia = getActivePinia();
147
246
  const runtime = pinia && runtimes.get(pinia);
@@ -9,6 +9,8 @@ import { uiLocaleOptions } from '../../i18n/locale';
9
9
  import { settingHint } from '../setting-examples';
10
10
  import type { ThemePreference } from '../../appearance/theme';
11
11
  import { useEditorFontFamily } from '../../appearance/use-editor-font';
12
+ import { type InterfaceFontChoice } from '../../appearance/interface-font';
13
+ import { useInterfaceFont } from '../../appearance/use-interface-font';
12
14
  import GlassWallpaperSetting from '../../appearance/components/GlassWallpaperSetting.vue';
13
15
  import ThemePresetPicker from '../../appearance/components/ThemePresetPicker.vue';
14
16
  import { settingsPanelContextKey } from './settings-context';
@@ -93,6 +95,14 @@ function customFontInput(event: Event, target: FontTarget = 'unified') {
93
95
  });
94
96
  }
95
97
 
98
+ const { preference: interfaceFont, update: updateInterfaceFont } = useInterfaceFont();
99
+ function interfaceFontInput(event: Event) {
100
+ const input = event.target as HTMLInputElement;
101
+ const value = sanitizeCustomFontName(input.value);
102
+ if (input.value !== value) input.value = value;
103
+ updateInterfaceFont({ customName: value });
104
+ }
105
+
96
106
  type MotionOptionKey =
97
107
  | 'smoothCaret'
98
108
  | 'typingMotion'
@@ -237,6 +247,42 @@ const { preferences: helpPreferences, setEnabled: setHelpEnabled } = useHelpPref
237
247
  </div>
238
248
  </section>
239
249
 
250
+ <section class="settings-section" :aria-label="t('界面字体')">
251
+ <h3>{{ t('界面字体') }}</h3>
252
+ <div class="settings-card">
253
+ <div class="settings-row" data-settings-key="appearance-interface-font">
254
+ <div>
255
+ <strong>{{ t('界面字体') }}</strong>
256
+ <p>{{ t('用于侧栏、标签、菜单和对话框,不影响文档正文。仅保存在当前设备。') }}</p>
257
+ </div>
258
+ <select
259
+ :value="interfaceFont.choice"
260
+ :aria-label="t('界面字体')"
261
+ @change="updateInterfaceFont({ choice: ($event.target as HTMLSelectElement).value as InterfaceFontChoice })"
262
+ >
263
+ <option value="builtin">{{ t('内置(Inter + 思源黑体)') }}</option>
264
+ <option value="system">{{ t('系统字体') }}</option>
265
+ <option value="custom">{{ t('自定义字体') }}</option>
266
+ </select>
267
+ </div>
268
+ <div v-if="interfaceFont.choice === 'custom'" class="settings-row settings-custom-font-row" data-settings-key="appearance-interface-custom-font">
269
+ <div>
270
+ <strong>{{ t('界面字体名称') }}</strong>
271
+ <p>{{ t('输入本机字体名称;未安装时会回退到系统字体。') }}</p>
272
+ </div>
273
+ <input
274
+ :value="interfaceFont.customName"
275
+ type="text"
276
+ maxlength="80"
277
+ autocomplete="off"
278
+ :aria-label="t('自定义界面字体名称')"
279
+ :placeholder="t('例如:HarmonyOS Sans SC')"
280
+ @input="interfaceFontInput"
281
+ />
282
+ </div>
283
+ </div>
284
+ </section>
285
+
240
286
  <section class="settings-section" data-settings-key="appearance-custom-font" :aria-label="t('编辑字体与字号')">
241
287
  <h3>{{ t('编辑字体与字号') }}</h3>
242
288
  <div class="settings-card settings-font-card">
@@ -78,7 +78,6 @@ const mathSyntaxDescription = computed(
78
78
  </button>
79
79
  </div>
80
80
  </div>
81
- <p class="settings-local-note">{{ t('Kanban 与数据库块尚未实现;相关源码会保留。') }}</p>
82
81
  </section>
83
82
 
84
83
  <section class="settings-section" :aria-label="t('Markdown 语法')">
@@ -97,8 +97,12 @@ const displayModeDescription = computed(() =>
97
97
  ? '当前配色主题仅支持深色。'
98
98
  : '选择浅色、深色或跟随系统,偏好在工作区间共用。',
99
99
  );
100
- const showDeveloperMode = computed(() => props.native && !props.mobile);
101
- const developerModeDescription = '开启后,右键单击顶部标签栏的空白处,即可打开调试窗口。';
100
+ const showDeveloperMode = computed(() => !props.mobile);
101
+ const developerModeDescription = computed(() =>
102
+ props.native
103
+ ? '开启后,可在插件中心访问开发者区(导入、工坊、调试与投稿),也可右键顶部标签栏空白处打开调试窗口。'
104
+ : '开启后,可在插件中心访问开发者区(导入插件、工坊、开发监听、运行日志与投稿)。',
105
+ );
102
106
  const rules = computed(() => props.capabilities ?? defaultCapabilities);
103
107
  const splitFonts = computed(
104
108
  () =>
@@ -189,7 +193,7 @@ const settingSearchEntries = computed<SettingSearchEntry[]>(() =>
189
193
  frostActive: frostActive.value,
190
194
  splitFontsEnabled: splitFonts.value.enabled,
191
195
  showDeveloperMode: showDeveloperMode.value,
192
- developerModeDescription,
196
+ developerModeDescription: developerModeDescription.value,
193
197
  }),
194
198
  );
195
199
  const availableExtraPages = computed(() =>
@@ -398,6 +402,7 @@ function keydown(event: KeyboardEvent) {
398
402
  <section
399
403
  ref="settingsDialog"
400
404
  class="settings-dialog workbench-modal-surface"
405
+ :class="{ 'settings-tabbed-dialog': tabbed }"
401
406
  tabindex="-1"
402
407
  :role="tabbed ? 'region' : 'dialog'"
403
408
  :aria-modal="!windowed && !tabbed ? true : undefined"
@@ -1,16 +1,29 @@
1
1
  <script setup lang="ts">
2
2
  import { inject, toRefs } from 'vue';
3
+ import { mobile } from '../../platform/platform';
3
4
  import { SettingsPanel } from '../../shell/workbench-async-components';
4
- import { workbenchContextKey } from '../../shell/workbench-context';
5
+ import {
6
+ workbenchDocumentsKey,
7
+ workbenchModalsKey,
8
+ workbenchPrefsKey,
9
+ workbenchShellKey,
10
+ } from '../../shell/workbench-context';
5
11
  import { useWindowContext } from '../../windows/context';
12
+ import { native } from '../../workspace/adapter';
6
13
  defineProps<{ tabbed?: boolean; windowed?: boolean }>();
7
- const context = inject(workbenchContextKey);
8
- if (!context) throw new Error('Workbench context is required');
14
+ const shell = inject(workbenchShellKey);
15
+ const prefs = inject(workbenchPrefsKey);
16
+ const documents = inject(workbenchDocumentsKey);
17
+ const modals = inject(workbenchModalsKey);
18
+ if (!shell || !prefs || !documents || !modals) throw new Error('Workbench context is required');
9
19
  const windowContext = useWindowContext();
10
- const { native, mobile, workspace, shortcuts, store, tabsEnabled, extensions, updates, editorPreferences, showPageTitle, showDocumentProperties, showOutline, outlineOnLeft, active, openingSettingsWindow, openSettingsTab, openSettingsInNewWindow, settingsPage, workspaceExporting, workspaceExportError, workspaceDeletionError, deleteWorkspace, exportWorkspace, defaultSource, theme, appearance, appearanceController, visualFontChoice, customFontName, splitFontSettings, revealMarkdown, toolbarMode, showDocumentDiscussion, visualFontSize, sourceFontSize, appVersion, documentationBaseUrl, assistant, settingsAction, settingsContext } = toRefs(context);
20
+ const { workspace, store, extensions, updates, active, appVersion, documentationBaseUrl, assistant } = toRefs(shell);
21
+ const { shortcuts, tabsEnabled, editorPreferences, showPageTitle, showDocumentProperties, defaultSource, theme, appearance, appearanceController, visualFontChoice, customFontName, splitFontSettings, revealMarkdown, toolbarMode, showDocumentDiscussion, visualFontSize, sourceFontSize } = toRefs(prefs);
22
+ const { showOutline, outlineOnLeft } = toRefs(documents);
23
+ const { openingSettingsWindow, openSettingsTab, openSettingsInNewWindow, settingsPage, workspaceExporting, workspaceExportError, workspaceDeletionError, deleteWorkspace, exportWorkspace, settingsAction, settingsContext } = toRefs(modals);
11
24
  function closeSettings() {
12
- if (windowContext.id === 'settings') void context!.auxiliaryWindows.close('settings');
13
- else context!.settingsPanel = false;
25
+ if (windowContext.id === 'settings') void shell!.auxiliaryWindows.close('settings');
26
+ else modals!.settingsPanel = false;
14
27
  }
15
28
  </script>
16
29
  <template>
@@ -45,7 +58,7 @@ function closeSettings() {
45
58
  :mode="store.isDemo ? 'demo' : store.isWeb ? 'web' : 'local'"
46
59
  :native="native"
47
60
  :mobile="mobile"
48
- v-model:developer-mode="context.developerMode"
61
+ v-model:developer-mode="prefs.developerMode"
49
62
  :default-source="defaultSource"
50
63
  :theme="theme"
51
64
  :appearance="appearance"
@@ -81,7 +81,7 @@ export interface SettingsPanelContext {
81
81
  displayMode: ComputedRef<ThemePreference>;
82
82
  displayModeDescription: ComputedRef<string>;
83
83
  showDeveloperMode: ComputedRef<boolean>;
84
- developerModeDescription: string;
84
+ developerModeDescription: ComputedRef<string>;
85
85
  splitFonts: ComputedRef<SplitFontSettings>;
86
86
  emitUpdateDeveloperMode: (value: boolean) => void;
87
87
  emitUpdateDefaultSource: (value: boolean) => void;