@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.
- package/package.json +50 -16
- package/src/App.vue +82 -752
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/agent-identities.ts +1 -97
- package/src/assistant/agent-task-context.ts +1 -54
- package/src/assistant/attachments.ts +1 -1
- package/src/assistant/completion.ts +1 -61
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +425 -8
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/connection-actions.ts +237 -0
- package/src/assistant/document-mentions.ts +1 -33
- package/src/assistant/engine.ts +1 -532
- package/src/assistant/execution.ts +6 -33
- package/src/assistant/files.ts +5 -13
- package/src/assistant/hash.ts +1 -4
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/language.ts +10 -37
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/plugin-bridge-builder.ts +146 -0
- package/src/assistant/prompts.ts +1 -58
- package/src/assistant/proposal-actions.ts +336 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +167 -327
- package/src/assistant/structures.ts +1 -155
- package/src/assistant/tasks.ts +8 -96
- package/src/assistant/tool-rules.ts +1 -7
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-help.ts +177 -0
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-lifecycle.ts +249 -0
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-settings.ts +185 -0
- package/src/composables/use-workbench-shortcuts.ts +40 -1021
- package/src/composables/use-workbench-views.ts +325 -0
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentActionMenu.vue +279 -0
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/documents/components/DocumentInspector.vue +168 -0
- package/src/documents/components/DocumentPane.vue +482 -0
- package/src/documents/description-merge.ts +1 -9
- package/src/features.ts +1 -0
- package/src/files/components/FileMetadataPanel.vue +49 -15
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locale-catalogs.ts +7 -6
- package/src/i18n/locale-registry.ts +8 -6
- package/src/i18n/locales/de-DE.json +371 -3
- package/src/i18n/locales/en-US.json +371 -2
- package/src/i18n/locales/es-ES.json +371 -3
- package/src/i18n/locales/ja-JP.json +370 -2
- package/src/i18n/locales/zh-TW.json +370 -2
- package/src/mail/components/MailAccountDialog.vue +450 -0
- package/src/mail/components/MailComposerDialog.vue +326 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +821 -0
- package/src/mail/components/SidebarMail.vue +134 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/content-references.ts +6 -56
- package/src/objects/wiki-links.ts +1 -48
- package/src/objects/workspace-objects.ts +3 -4
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +65 -9
- package/src/plans/components/CalendarAgendaView.vue +165 -0
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarFilterBar.vue +128 -0
- package/src/plans/components/CalendarMonthView.vue +224 -0
- package/src/plans/components/CalendarQuickCreateDialog.vue +269 -0
- package/src/plans/components/CalendarTimelineView.vue +517 -0
- package/src/plans/components/CalendarTopbarControls.vue +101 -0
- package/src/plans/components/CalendarView.vue +264 -748
- package/src/plans/components/CalendarYearView.vue +138 -0
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanConnectionsDialog.vue +1 -1
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/components/calendar-shared.css +192 -0
- package/src/plans/composables/use-calendar-interactions.ts +396 -0
- package/src/plans/composables/use-calendar-scroll.ts +420 -0
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +136 -57
- package/src/plugins/components/PluginDeveloperArea.vue +192 -0
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +21 -25
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +273 -288
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +37 -34
- package/src/plugins/components/PluginRepositoryStorage.vue +4 -2
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +112 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/components/PluginsTabPage.vue +61 -0
- package/src/plugins/components/plugin-center.css +5 -0
- package/src/plugins/data.ts +9 -86
- package/src/plugins/editor-plugin-adapters.ts +169 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-data.ts +2 -3
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-rpc-router.ts +558 -0
- package/src/plugins/plugin-sdk.ts +1 -94
- package/src/plugins/plugin-ui-dialogs.ts +167 -0
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +1 -73
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/view-header.ts +2 -7
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +103 -4
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/SettingsPanel.vue +8 -3
- package/src/settings/components/WorkbenchSettings.vue +20 -7
- package/src/settings/components/settings-context.ts +1 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/settings/settings-tab.ts +1 -0
- package/src/shell/command-palette.ts +3 -3
- package/src/shell/components/EditorToolbar.vue +8 -9
- package/src/shell/components/EditorTools.vue +1 -5
- package/src/shell/components/PaneTopbar.vue +393 -0
- package/src/shell/components/SelectionToolbar.vue +0 -2
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +58 -34
- package/src/shell/components/WorkbenchModals.vue +47 -62
- package/src/shell/components/WorkbenchPanes.vue +371 -1342
- package/src/shell/components/WorkbenchSidebar.vue +486 -0
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/pane-registry.ts +69 -0
- package/src/shell/use-surface-dismissal.ts +219 -0
- package/src/shell/use-workbench-commands.ts +599 -0
- package/src/shell/use-workbench-keybindings.ts +337 -0
- package/src/shell/use-workbench.ts +531 -1153
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/shell/workbench-context.ts +30 -3
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-document-io.ts +807 -0
- package/src/stores/workspace-file-ops.ts +1 -1
- package/src/stores/workspace-knowledge.ts +2 -114
- package/src/stores/workspace-lifecycle.ts +459 -0
- package/src/stores/workspace-plugins-state.ts +254 -259
- package/src/stores/workspace-session.ts +287 -0
- package/src/stores/workspace-tabs-layout.ts +6 -44
- package/src/stores/workspace-types.ts +50 -0
- package/src/stores/workspace.ts +184 -1363
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +0 -1
- package/src/tabs/components/DesktopTabs.vue +19 -14
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/windows/AuxiliaryWindows.vue +2 -2
- package/src/windows/use-window-event-bridge.ts +152 -0
- package/src/workspace/components/TemplateLibrary.vue +1 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +30 -7
- package/src/workspace/components/WorkspacePickerMenu.vue +317 -0
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/assistant/locales/de-DE.json +0 -126
- package/src/assistant/locales/en-US.json +0 -126
- package/src/assistant/locales/es-ES.json +0 -126
- package/src/assistant/locales/ja-JP.json +0 -126
- package/src/assistant/locales/zh-CN.json +0 -126
- package/src/assistant/locales/zh-TW.json +0 -126
- package/src/assistant/task-prompts.json +0 -39
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import LoadingSkeleton from '../../shell/components/LoadingSkeleton.vue';
|
|
3
3
|
import { retiredSystemPlugin } from '../workspace-plugins';
|
|
4
|
+
import { userScopeUnsupportedReason } from '../user-plugins';
|
|
4
5
|
import { uiLocale, t } from '../../i18n/i18n';
|
|
5
6
|
import { computed, onScopeDispose, ref, watch } from 'vue';
|
|
6
|
-
import { canonicalPluginJson, comparePluginVersions, type PluginCatalogRelease, type PluginReleaseCatalog } from '@tano/protocol';
|
|
7
|
+
import { canonicalPluginJson, checkPluginCompatibility, comparePluginVersions, type PluginCatalogRelease, type PluginReleaseCatalog } from '@tano/protocol';
|
|
7
8
|
import { useWorkspaceStore } from '../../stores/workspace';
|
|
8
9
|
import PluginDialog from './PluginDialog.vue';
|
|
9
10
|
import PluginChangeSummary from './PluginChangeSummary.vue';
|
|
11
|
+
import { pluginPermissionLabels as labels } from '../plugin-permissions';
|
|
10
12
|
|
|
11
13
|
const store = useWorkspaceStore();
|
|
12
14
|
const catalog = ref<PluginReleaseCatalog>();
|
|
@@ -15,6 +17,7 @@ const selectedId = ref('');
|
|
|
15
17
|
const selectedHash = ref('');
|
|
16
18
|
const loading = ref(false);
|
|
17
19
|
const installing = ref(false);
|
|
20
|
+
const installScope = ref<'workspace' | 'user'>('workspace');
|
|
18
21
|
const error = ref('');
|
|
19
22
|
const status = ref('');
|
|
20
23
|
const visibleLimit = ref(24);
|
|
@@ -31,6 +34,10 @@ const latest = computed(() => {
|
|
|
31
34
|
});
|
|
32
35
|
const versions = computed(() => sorted(releases.value.filter(item => item.manifest.id === selectedId.value)));
|
|
33
36
|
const selected = computed(() => versions.value.find(item => item.integrity === selectedHash.value));
|
|
37
|
+
const userScopeReason = computed(() => (selected.value ? userScopeUnsupportedReason(selected.value.manifest) : undefined));
|
|
38
|
+
const selectedCompat = computed(() =>
|
|
39
|
+
selected.value ? checkPluginCompatibility(selected.value.manifest, store.pluginHostEnvironment) : { compatible: true },
|
|
40
|
+
);
|
|
34
41
|
const installed = computed(() => store.installedPlugins.find(item => item.manifest.id === selectedId.value));
|
|
35
42
|
function isInstalled(release: PluginCatalogRelease) {
|
|
36
43
|
return store.installedPlugins.some(item => item.manifest.id === release.manifest.id && (item.rule?.integrity === release.integrity ||
|
|
@@ -41,9 +48,8 @@ const downgrading = computed(() => selected.value && installed.value && compareP
|
|
|
41
48
|
const selectedPublisher = computed(() => catalog.value?.publishers.find(item => item.id === selected.value?.publisher));
|
|
42
49
|
const permissions = computed(() => selected.value?.manifest.manifestVersion === 2 ? selected.value.manifest.permissions : []);
|
|
43
50
|
const addedPermissions = computed(() => permissions.value.filter(permission => installed.value?.manifest.manifestVersion !== 2 || !installed.value.manifest.permissions.includes(permission)));
|
|
44
|
-
const labels: Record<string, string> = { get 'documents.read'() { return t('读取与打开文档'); }, get 'documents.write'() { return t('创建与修改文档'); }, get 'objects.read'() { return t('读取对象'); }, get 'objects.write'() { return t('创建与修改对象'); }, get 'relations.read'() { return t('读取关系'); }, get 'relations.write'() { return t('修改关系'); }, get storage() { return t('保存插件本机状态'); }, get network() { return t('访问指定网络来源'); }, get connections() { return t('使用单独授权的服务凭据'); }, get native() { return t('调用指定本机能力'); }, get ui() { return t('运行自定义界面'); } };
|
|
45
51
|
function publisher(release: PluginCatalogRelease) { return catalog.value?.publishers.find(item => item.id === release.publisher)?.name ?? release.publisher; }
|
|
46
|
-
function details(release: PluginCatalogRelease) { selectedId.value = release.manifest.id; selectedHash.value = release.integrity; error.value = ''; status.value = ''; }
|
|
52
|
+
function details(release: PluginCatalogRelease) { selectedId.value = release.manifest.id; selectedHash.value = release.integrity; installScope.value = 'workspace'; error.value = ''; status.value = ''; }
|
|
47
53
|
async function refresh() {
|
|
48
54
|
const current = ++sequence;
|
|
49
55
|
const signal = controller.signal;
|
|
@@ -62,7 +68,7 @@ async function install() {
|
|
|
62
68
|
const signal = controller.signal;
|
|
63
69
|
installing.value = true; error.value = ''; status.value = '';
|
|
64
70
|
try {
|
|
65
|
-
await store.installCatalogRelease(release, workspace, signal);
|
|
71
|
+
await store.installCatalogRelease(release, workspace, signal, installScope.value);
|
|
66
72
|
if (!signal.aborted) status.value = release.manifest.manifestVersion === 2
|
|
67
73
|
? t('已安装 {0},请在“已安装”详情中核对并授权此版本运行。', [release.manifest.version]) : t('已安装 {0}。', [release.manifest.version]);
|
|
68
74
|
} catch (cause) { if (!signal.aborted) error.value = String(cause); }
|
|
@@ -116,15 +122,18 @@ onScopeDispose(() => controller.abort());
|
|
|
116
122
|
<p v-if="selected.status === 'withdrawn'" role="status">{{ t('此版本已撤回:') }}{{ selected.reason }}{{ t('。已安装内容不会自动删除。') }}</p>
|
|
117
123
|
<pre class="catalog-notes">{{ selected.notes || t('此版本未提供更新说明。') }}</pre>
|
|
118
124
|
<PluginChangeSummary v-if="!unchanged" :before="installed?.manifest" :after="selected.manifest" :workspace="store.workspace?.name" />
|
|
119
|
-
<p>{{ t('所需权限:') }}{{ permissions.map(permission => labels[permission]).join('、') || t('无代码权限') }}</p>
|
|
120
|
-
<p v-if="installed && addedPermissions.length">{{ t('新增权限:') }}{{ addedPermissions.map(permission => labels[permission]).join('、') }}</p>
|
|
125
|
+
<p>{{ t('所需权限:') }}{{ permissions.map(permission => labels[permission] ?? permission).join('、') || t('无代码权限') }}</p>
|
|
126
|
+
<p v-if="installed && addedPermissions.length">{{ t('新增权限:') }}{{ addedPermissions.map(permission => labels[permission] ?? permission).join('、') }}</p>
|
|
121
127
|
<template v-if="selected.manifest.manifestVersion === 2">
|
|
122
128
|
<p v-if="selected.manifest.networkOrigins.length">{{ t('网络来源:') }}{{ selected.manifest.networkOrigins.join('、') }}</p>
|
|
123
129
|
<p v-if="selected.manifest.nativeCommands.length">{{ t('本机能力:') }}{{ selected.manifest.nativeCommands.join('、') }}</p>
|
|
124
130
|
</template>
|
|
125
131
|
<p class="catalog-origin">{{ (selected.bytes / 1024).toFixed(1) }} KiB · SHA-256 {{ selected.integrity }}</p>
|
|
126
|
-
<
|
|
127
|
-
<
|
|
132
|
+
<label>{{ t('安装范围') }} <select v-model="installScope" :aria-label="t('目录插件安装范围')" :disabled="installing"><option value="workspace">{{ t('当前工作区(随工作区同步)') }}</option><option value="user" :disabled="!!userScopeReason">{{ t('全局插件(跨工作区生效)') }}</option></select></label>
|
|
133
|
+
<p v-if="!selectedCompat.compatible" class="pc-feedback error" role="alert">{{ selectedCompat.reason }}</p>
|
|
134
|
+
<p v-if="installScope === 'workspace' && !store.canManagePlugins">{{ t('需要工作区管理员安装或更新插件。') }}</p>
|
|
135
|
+
<p v-if="userScopeReason">{{ userScopeReason }}</p>
|
|
136
|
+
<button class="pc-button pc-primary" :disabled="installing || (installScope === 'workspace' ? !store.canManagePlugins : !!userScopeReason) || selected.status !== 'published' || unchanged" @click="install">{{ installing ? t('正在校验并安装…') : unchanged ? t('已安装此版本') : t('安装所选版本') }}</button>
|
|
128
137
|
</PluginDialog>
|
|
129
138
|
</section>
|
|
130
139
|
</template>
|
|
@@ -2,14 +2,27 @@
|
|
|
2
2
|
import { t } from '../../i18n/i18n';
|
|
3
3
|
import { computed } from 'vue';
|
|
4
4
|
import { canonicalPluginJson, type PluginManifest } from '@tano/protocol';
|
|
5
|
+
import { pluginPermissionLabels as labels } from '../plugin-permissions';
|
|
5
6
|
const props = defineProps<{ before?: PluginManifest; after: PluginManifest; workspace?: string }>();
|
|
6
|
-
const labels: Record<string, string> = { get 'documents.read'() { return t('读取与打开文档'); }, get 'documents.write'() { return t('创建与修改文档'); }, get 'objects.read'() { return t('读取对象'); }, get 'objects.write'() { return t('创建与修改对象'); }, get 'relations.read'() { return t('读取关系'); }, get 'relations.write'() { return t('修改关系'); }, get storage() { return t('保存插件本机状态'); }, get network() { return t('访问指定网络来源'); }, get connections() { return t('使用单独授权的服务凭据'); }, get native() { return t('调用指定本机能力'); }, get ui() { return t('运行隔离的自定义界面'); } };
|
|
7
7
|
function capabilities(manifest?: PluginManifest) {
|
|
8
|
-
return manifest?.manifestVersion === 2
|
|
8
|
+
return manifest?.manifestVersion === 2
|
|
9
|
+
? [
|
|
10
|
+
manifest.permissions.map(value => labels[value] ?? value),
|
|
11
|
+
manifest.networkOrigins,
|
|
12
|
+
manifest.nativeCommands,
|
|
13
|
+
(manifest.fileHandlers ?? []).flatMap(handler =>
|
|
14
|
+
handler.extensions.map(ext => `${ext}(${handler.mode === 'editor' ? t('编辑') : t('预览')})`),
|
|
15
|
+
),
|
|
16
|
+
[
|
|
17
|
+
...(manifest.assistantTools ?? []).map(tool => `${tool.label}(${tool.effect})`),
|
|
18
|
+
...(manifest.assistantContextProviders ?? []).map(provider => `@${provider.id}(${provider.label})`),
|
|
19
|
+
],
|
|
20
|
+
]
|
|
21
|
+
: [[], [], [], [], []];
|
|
9
22
|
}
|
|
10
23
|
const changes = computed(() => {
|
|
11
24
|
const before = capabilities(props.before), after = capabilities(props.after);
|
|
12
|
-
return [t('运行权限'), t('联网地址'), t('本机能力')].map((label, i) => ({ label, before: before[i]!, after: after[i]!,
|
|
25
|
+
return [t('运行权限'), t('联网地址'), t('本机能力'), t('文件打开器'), t('助手扩展')].map((label, i) => ({ label, before: before[i]!, after: after[i]!,
|
|
13
26
|
added: after[i]!.filter(value => !before[i]!.includes(value)), removed: before[i]!.filter(value => !after[i]!.includes(value)) }));
|
|
14
27
|
});
|
|
15
28
|
const appearanceChanged = computed(() => canonicalPluginJson(props.before?.appearance ?? null) !== canonicalPluginJson(props.after.appearance ?? null));
|
|
@@ -11,7 +11,7 @@ const authentication = ref<PluginConnectionAuthentication>('bearer');
|
|
|
11
11
|
const methods = ref<PluginConnectionMethod[]>(['GET']);
|
|
12
12
|
const busy = ref(false), error = ref(''), status = ref('');
|
|
13
13
|
let controller = new AbortController();
|
|
14
|
-
const plugins = computed(() => store.installedPlugins.filter(item => item.manifest.manifestVersion === 2 && item.manifest.permissions.includes('connections')));
|
|
14
|
+
const plugins = computed(() => store.installedPlugins.filter(item => item.scope !== 'user' && !item.system && item.manifest.manifestVersion === 2 && item.manifest.permissions.includes('connections')));
|
|
15
15
|
const installation = computed(() => plugins.value.find(item => item.manifest.id === pluginId.value));
|
|
16
16
|
const origins = computed(() => installation.value?.manifest.manifestVersion === 2 ? installation.value.manifest.networkOrigins : []);
|
|
17
17
|
const existing = computed(() => entries.value.find(item => item.pluginId === pluginId.value && item.origin === origin.value));
|
|
@@ -3,7 +3,7 @@ import { ref, watch } from 'vue';
|
|
|
3
3
|
import type { PluginJson, PluginUiBundle } from '@tano/protocol';
|
|
4
4
|
import { createPluginUiSandbox, type PluginUiSandbox } from '../ui-sandbox';
|
|
5
5
|
import type { PluginInteraction } from '../workbench';
|
|
6
|
-
const props = defineProps<{ bundle: PluginUiBundle; state: PluginJson; workspaceId: string; pluginId: string; instanceId: string; viewId: string;
|
|
6
|
+
const props = defineProps<{ bundle: PluginUiBundle; state: PluginJson; workspaceId: string; pluginId: string; instanceId: string; viewId: string; fill?: boolean;
|
|
7
7
|
execute: (interaction: PluginInteraction) => Promise<void> }>();
|
|
8
8
|
const container = ref<HTMLElement>();
|
|
9
9
|
const error = ref('');
|
|
@@ -24,7 +24,7 @@ watch([() => container.value, () => props.workspaceId, () => props.pluginId, ()
|
|
|
24
24
|
watch(() => props.state, state => sandbox?.update(state), { flush: 'post' });
|
|
25
25
|
</script>
|
|
26
26
|
<template>
|
|
27
|
-
<div class="plugin-custom-view" :class="{ 'plugin-custom-fill':
|
|
27
|
+
<div class="plugin-custom-view" :class="{ 'plugin-custom-fill': !!fill }">
|
|
28
28
|
<p v-if="error" role="alert">{{ error }}</p>
|
|
29
29
|
<div ref="container" class="plugin-custom-container" v-show="!error" />
|
|
30
30
|
</div>
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import './plugin-center.css';
|
|
3
|
+
import { computed, inject, ref, watch } from 'vue';
|
|
3
4
|
import { ArrowUpRight, Download, LoaderCircle, ShieldCheck } from 'lucide-vue-next';
|
|
4
|
-
import
|
|
5
|
+
import { checkPluginCompatibility, type PluginMode } from '@tano/protocol';
|
|
5
6
|
import { t } from '../../i18n/i18n';
|
|
7
|
+
import { workbenchPrefsKey } from '../../shell/workbench-context';
|
|
6
8
|
import { useWorkspaceStore } from '../../stores/workspace';
|
|
7
9
|
import { bundledPluginCatalog } from '../plugin-catalog';
|
|
10
|
+
import { pluginPermissionLabels as permissionLabels } from '../plugin-permissions';
|
|
11
|
+
import { userScopeUnsupportedReason } from '../user-plugins';
|
|
8
12
|
import { usePluginActions } from '../use-plugin-actions';
|
|
9
13
|
import PluginIcon from './PluginIcon.vue';
|
|
10
14
|
import PluginMaintenance from './PluginMaintenance.vue';
|
|
11
|
-
|
|
15
|
+
import PluginSettingsForm from './PluginSettingsForm.vue';
|
|
16
|
+
const props = defineProps<{ pluginId: string; developerMode?: boolean }>();
|
|
17
|
+
const workbench = inject(workbenchPrefsKey, null);
|
|
18
|
+
const isDeveloperMode = computed(() => props.developerMode ?? Boolean(workbench?.developerMode));
|
|
12
19
|
const store = useWorkspaceStore();
|
|
13
20
|
const detail = computed(
|
|
14
21
|
() =>
|
|
@@ -23,11 +30,20 @@ const {
|
|
|
23
30
|
policyMode,
|
|
24
31
|
settingsText,
|
|
25
32
|
sourceUrl,
|
|
33
|
+
pathScopesText,
|
|
26
34
|
change,
|
|
27
35
|
authorize,
|
|
28
36
|
savePolicy,
|
|
37
|
+
saveUserSettings,
|
|
29
38
|
installFromCatalog,
|
|
30
39
|
} = usePluginActions(detail);
|
|
40
|
+
const userScopeBlocked = computed(() => (detail.value ? userScopeUnsupportedReason(detail.value) : undefined));
|
|
41
|
+
const compatibility = computed(() =>
|
|
42
|
+
detail.value ? checkPluginCompatibility(detail.value, store.pluginHostEnvironment) : { compatible: true },
|
|
43
|
+
);
|
|
44
|
+
const settingsSchema = computed(() =>
|
|
45
|
+
detail.value?.manifestVersion === 2 ? detail.value.settingsSchema : undefined,
|
|
46
|
+
);
|
|
31
47
|
const detailViews = computed(() =>
|
|
32
48
|
detail.value?.manifestVersion === 2
|
|
33
49
|
? detail.value.views.map((view) => ({
|
|
@@ -38,10 +54,11 @@ const detailViews = computed(() =>
|
|
|
38
54
|
: [],
|
|
39
55
|
);
|
|
40
56
|
const commands = computed(() => (detail.value?.manifestVersion === 2 ? detail.value.commands : []));
|
|
57
|
+
const fileHandlers = computed(() => (detail.value?.manifestVersion === 2 ? (detail.value.fileHandlers ?? []) : []));
|
|
41
58
|
const tabKeys = { details: '详细信息', features: '功能', permissions: '权限', settings: '设置' };
|
|
42
59
|
const tabs = computed(() => [
|
|
43
60
|
'详细信息',
|
|
44
|
-
...(detailViews.value.length || commands.value.length ? ['功能'] : []),
|
|
61
|
+
...(detailViews.value.length || commands.value.length || fileHandlers.value.length ? ['功能'] : []),
|
|
45
62
|
...(detail.value?.manifestVersion === 2 ? ['权限'] : []),
|
|
46
63
|
...(selectedInstallation.value && !selectedInstallation.value.system ? ['设置'] : []),
|
|
47
64
|
]);
|
|
@@ -49,44 +66,6 @@ const active = ref('详细信息');
|
|
|
49
66
|
watch(tabs, (values) => {
|
|
50
67
|
if (!values.includes(active.value)) active.value = values[0];
|
|
51
68
|
});
|
|
52
|
-
const permissionLabels: Record<PluginPermission, string> = {
|
|
53
|
-
get 'attachments.read'() {
|
|
54
|
-
return t('只读访问工作区附件');
|
|
55
|
-
},
|
|
56
|
-
get 'documents.read'() {
|
|
57
|
-
return t('读取与打开文档');
|
|
58
|
-
},
|
|
59
|
-
get 'documents.write'() {
|
|
60
|
-
return t('创建与修改文档');
|
|
61
|
-
},
|
|
62
|
-
get 'objects.read'() {
|
|
63
|
-
return t('读取对象');
|
|
64
|
-
},
|
|
65
|
-
get 'objects.write'() {
|
|
66
|
-
return t('创建与修改对象');
|
|
67
|
-
},
|
|
68
|
-
get 'relations.read'() {
|
|
69
|
-
return t('读取关系');
|
|
70
|
-
},
|
|
71
|
-
get 'relations.write'() {
|
|
72
|
-
return t('修改关系');
|
|
73
|
-
},
|
|
74
|
-
get storage() {
|
|
75
|
-
return t('保存插件本机状态');
|
|
76
|
-
},
|
|
77
|
-
get network() {
|
|
78
|
-
return t('访问指定网络来源');
|
|
79
|
-
},
|
|
80
|
-
get connections() {
|
|
81
|
-
return t('使用单独授权的服务凭据');
|
|
82
|
-
},
|
|
83
|
-
get native() {
|
|
84
|
-
return t('调用指定本机能力');
|
|
85
|
-
},
|
|
86
|
-
get ui() {
|
|
87
|
-
return t('运行隔离的自定义界面');
|
|
88
|
-
},
|
|
89
|
-
};
|
|
90
69
|
const modeLabels: Record<PluginMode, string> = {
|
|
91
70
|
get required() {
|
|
92
71
|
return t('必需');
|
|
@@ -114,6 +93,8 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
114
93
|
<p>
|
|
115
94
|
v{{ detail.version }} · {{ detail.id
|
|
116
95
|
}}<span v-if="selectedInstallation?.system"> · {{ t('系统插件') }}</span>
|
|
96
|
+
<span v-else-if="selectedInstallation?.scope === 'user'"> · {{ t('全局插件') }}</span>
|
|
97
|
+
<span v-else-if="selectedInstallation"> · {{ t('工作区插件') }}</span>
|
|
117
98
|
</p>
|
|
118
99
|
</div>
|
|
119
100
|
<span
|
|
@@ -123,12 +104,18 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
123
104
|
>{{ selectedInstallation.enabled ? t('已启用') : t('已停用') }}</span
|
|
124
105
|
>
|
|
125
106
|
</div>
|
|
107
|
+
<p v-if="!compatibility.compatible" role="alert" class="dialog-intro">
|
|
108
|
+
{{ compatibility.reason }}
|
|
109
|
+
</p>
|
|
110
|
+
<p v-if="selectedInstallation?.shadowedUserPlugin" role="status" class="dialog-intro">
|
|
111
|
+
{{ t('当前工作区已锁定此插件版本,正在优先使用工作区版本;切换到其他工作区后恢复你的全局版本。') }}
|
|
112
|
+
</p>
|
|
126
113
|
<footer class="detail-footer">
|
|
127
114
|
<template v-if="selectedInstallation"
|
|
128
115
|
><button
|
|
129
116
|
v-if="!selectedInstallation.system"
|
|
130
117
|
class="pc-button pc-text uninstall"
|
|
131
|
-
:disabled="busy || !store.canManagePlugins"
|
|
118
|
+
:disabled="busy || (selectedInstallation.scope !== 'user' && !store.canManagePlugins)"
|
|
132
119
|
@click="change({ uninstall: detail.id })"
|
|
133
120
|
>
|
|
134
121
|
{{ t('卸载插件') }}</button
|
|
@@ -143,16 +130,25 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
143
130
|
>
|
|
144
131
|
{{ selectedInstallation.enabled ? t('停用插件') : t('启用插件') }}
|
|
145
132
|
</button></template
|
|
146
|
-
><
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
133
|
+
><template v-else>
|
|
134
|
+
<button
|
|
135
|
+
class="pc-button pc-primary"
|
|
136
|
+
:disabled="busy || !store.canManagePlugins"
|
|
137
|
+
@click="installFromCatalog(detail, 'workspace')"
|
|
138
|
+
>
|
|
139
|
+
<Download v-if="!busy" :size="15" /><LoaderCircle v-else class="pc-spin" :size="15" />{{
|
|
140
|
+
busy ? t('正在安装…') : t('安装插件')
|
|
141
|
+
}}
|
|
142
|
+
</button>
|
|
143
|
+
<button
|
|
144
|
+
v-if="!userScopeBlocked"
|
|
145
|
+
class="pc-button pc-secondary"
|
|
146
|
+
:disabled="busy"
|
|
147
|
+
@click="installFromCatalog(detail, 'user')"
|
|
148
|
+
>
|
|
149
|
+
{{ t('安装为全局插件') }}
|
|
150
|
+
</button>
|
|
151
|
+
</template>
|
|
156
152
|
</footer>
|
|
157
153
|
<nav class="center-nav" :aria-label="t('插件详情')">
|
|
158
154
|
<button
|
|
@@ -177,6 +173,12 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
177
173
|
<p v-for="icons in detail.appearance.icons" :key="icons.id">
|
|
178
174
|
{{ t('文件与目录图标') }}:{{ icons.label }}
|
|
179
175
|
</p>
|
|
176
|
+
<p
|
|
177
|
+
v-for="iconRef in (detail.appearance.iconRefs ?? []).filter((ref) => !detail?.appearance?.icons?.some((item) => item.id === ref.id))"
|
|
178
|
+
:key="iconRef.id"
|
|
179
|
+
>
|
|
180
|
+
{{ t('文件与目录图标') }}:{{ iconRef.label }}
|
|
181
|
+
</p>
|
|
180
182
|
<p v-for="layout in detail.appearance.layouts" :key="layout.id">
|
|
181
183
|
{{ t('布局风格') }}:{{ layout.label }}
|
|
182
184
|
</p>
|
|
@@ -245,11 +247,69 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
245
247
|
>
|
|
246
248
|
{{ selectedInstallation.authorized ? t('撤销此设备授权') : t('授权此版本运行') }}
|
|
247
249
|
</button>
|
|
250
|
+
<button
|
|
251
|
+
v-if="
|
|
252
|
+
selectedInstallation?.scope === 'user' &&
|
|
253
|
+
!selectedInstallation.globallyAuthorized &&
|
|
254
|
+
store.canManagePlugins
|
|
255
|
+
"
|
|
256
|
+
class="pc-button pc-secondary"
|
|
257
|
+
@click="authorize(true, { allWorkspaces: true })"
|
|
258
|
+
>
|
|
259
|
+
{{ t('在我的全部个人工作区授权此版本') }}
|
|
260
|
+
</button>
|
|
261
|
+
<p v-if="selectedInstallation?.globallyAuthorized" class="dialog-intro">
|
|
262
|
+
{{ t('此精确版本已授权在你可管理的个人工作区自动运行;非管理员的团队工作区仍需单独授权。') }}
|
|
263
|
+
</p>
|
|
264
|
+
<p
|
|
265
|
+
v-if="selectedInstallation?.scope === 'user' && selectedInstallation.personalCodePolicy === 'block'"
|
|
266
|
+
role="alert"
|
|
267
|
+
class="dialog-intro"
|
|
268
|
+
>
|
|
269
|
+
{{ t('当前工作区管理员策略禁止个人代码插件运行。') }}
|
|
270
|
+
</p>
|
|
271
|
+
<p
|
|
272
|
+
v-else-if="selectedInstallation?.scope === 'user' && selectedInstallation.personalCodePolicy === 'read-only'"
|
|
273
|
+
role="status"
|
|
274
|
+
class="dialog-intro"
|
|
275
|
+
>
|
|
276
|
+
{{ t('当前工作区管理员策略仅允许个人代码插件只读访问,所有写入操作将被拦截。') }}
|
|
277
|
+
</p>
|
|
248
278
|
</section>
|
|
249
279
|
</section>
|
|
250
280
|
<section v-if="active === tabKeys.settings">
|
|
251
281
|
<section
|
|
252
|
-
v-if="selectedInstallation?.
|
|
282
|
+
v-if="selectedInstallation?.scope === 'user'"
|
|
283
|
+
class="detail-section plugin-policy"
|
|
284
|
+
>
|
|
285
|
+
<h4>{{ t('全局插件设置') }}</h4>
|
|
286
|
+
<p>{{ t('此插件为全局安装,跨工作区生效;设置保存在当前设备的应用数据中,不写入工作区文件。') }}</p>
|
|
287
|
+
<PluginSettingsForm v-if="settingsSchema?.length" v-model="settingsText" :schema="settingsSchema" :disabled="busy" :developer-mode="isDeveloperMode" />
|
|
288
|
+
<label v-else
|
|
289
|
+
>{{ t('个人设置')
|
|
290
|
+
}}<textarea
|
|
291
|
+
v-model="settingsText"
|
|
292
|
+
:aria-label="t('插件个人设置')"
|
|
293
|
+
rows="4"
|
|
294
|
+
spellcheck="false"
|
|
295
|
+
/>
|
|
296
|
+
</label>
|
|
297
|
+
<label v-if="detail.manifestVersion === 2"
|
|
298
|
+
>{{ t('限制可访问目录(可选,每行一个目录前缀)')
|
|
299
|
+
}}<textarea
|
|
300
|
+
v-model="pathScopesText"
|
|
301
|
+
:aria-label="t('插件目录权限范围')"
|
|
302
|
+
:placeholder="t('例如:日报/')"
|
|
303
|
+
rows="2"
|
|
304
|
+
spellcheck="false"
|
|
305
|
+
/>
|
|
306
|
+
</label>
|
|
307
|
+
<button class="pc-button pc-secondary" :disabled="busy" @click="saveUserSettings">
|
|
308
|
+
{{ t('保存全局设置') }}
|
|
309
|
+
</button>
|
|
310
|
+
</section>
|
|
311
|
+
<section
|
|
312
|
+
v-else-if="selectedInstallation?.rule && !selectedInstallation.system && store.canManagePlugins"
|
|
253
313
|
class="detail-section plugin-policy"
|
|
254
314
|
>
|
|
255
315
|
<h4>{{ t('工作区规则') }}</h4>
|
|
@@ -269,7 +329,8 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
269
329
|
<option value="disabled">{{ t('禁止') }}</option>
|
|
270
330
|
</select></label
|
|
271
331
|
>
|
|
272
|
-
<
|
|
332
|
+
<PluginSettingsForm v-if="settingsSchema?.length" v-model="settingsText" :schema="settingsSchema" :disabled="busy" :developer-mode="isDeveloperMode" />
|
|
333
|
+
<label v-else
|
|
273
334
|
>{{ t('共享设置')
|
|
274
335
|
}}<textarea
|
|
275
336
|
v-model="settingsText"
|
|
@@ -279,6 +340,16 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
279
340
|
/>
|
|
280
341
|
</label>
|
|
281
342
|
<label v-if="detail.manifestVersion === 2"
|
|
343
|
+
>{{ t('限制可访问目录(可选,每行一个目录前缀)')
|
|
344
|
+
}}<textarea
|
|
345
|
+
v-model="pathScopesText"
|
|
346
|
+
:aria-label="t('插件目录权限范围')"
|
|
347
|
+
:placeholder="t('例如:日报/')"
|
|
348
|
+
rows="2"
|
|
349
|
+
spellcheck="false"
|
|
350
|
+
/>
|
|
351
|
+
</label>
|
|
352
|
+
<label v-if="detail.manifestVersion === 2 && isDeveloperMode"
|
|
282
353
|
>{{ t('插件包 HTTPS 地址(可选)')
|
|
283
354
|
}}<input v-model="sourceUrl" :aria-label="t('插件包下载地址')" type="url"
|
|
284
355
|
/></label>
|
|
@@ -295,13 +366,16 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
295
366
|
<PluginMaintenance
|
|
296
367
|
v-if="selectedInstallation && !selectedInstallation.system && detail.manifestVersion === 2"
|
|
297
368
|
:id="detail.id"
|
|
369
|
+
:developer-mode="isDeveloperMode"
|
|
298
370
|
/>
|
|
299
371
|
<p class="detail-scope">
|
|
300
372
|
<ShieldCheck :size="17" /><span
|
|
301
373
|
>{{
|
|
302
374
|
selectedInstallation?.system
|
|
303
375
|
? t('系统插件随应用提供;启用偏好仅保存在此设备。')
|
|
304
|
-
:
|
|
376
|
+
: selectedInstallation?.scope === 'user'
|
|
377
|
+
? t('全局插件保存在此设备的应用数据中,跨工作区生效,不写入工作区文件。')
|
|
378
|
+
: t('版本与共享设置保存在工作区;代码和缓存保存在应用数据中。')
|
|
305
379
|
}}<br />{{ t('插件操作遵循你的文档权限。') }}</span
|
|
306
380
|
>
|
|
307
381
|
</p>
|
|
@@ -320,10 +394,15 @@ const modeLabels: Record<PluginMode, string> = {
|
|
|
320
394
|
<p v-for="command in commands" :key="command.id">
|
|
321
395
|
{{ command.label }} {{ command.shortcut }}
|
|
322
396
|
</p>
|
|
397
|
+
<section v-if="fileHandlers.length" class="detail-section">
|
|
398
|
+
<h4>{{ t('文件打开器') }}</h4>
|
|
399
|
+
<p v-for="(handler, index) in fileHandlers" :key="index">
|
|
400
|
+
{{ handler.extensions.join('、') }} · {{ handler.mode === 'editor' ? t('编辑') : t('预览') }}
|
|
401
|
+
</p>
|
|
402
|
+
</section>
|
|
323
403
|
</section>
|
|
324
404
|
</article>
|
|
325
405
|
</template>
|
|
326
|
-
<style scoped src="./plugin-center.css"></style>
|
|
327
406
|
<style scoped>
|
|
328
407
|
.plugin-detail-page {
|
|
329
408
|
padding: 28px;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, useSlots, watch } from 'vue';
|
|
3
|
+
import { Code2, Hammer, Send, Square, Upload } from 'lucide-vue-next';
|
|
4
|
+
import { t } from '../../i18n/i18n';
|
|
5
|
+
import { useWorkspaceStore } from '../../stores/workspace';
|
|
6
|
+
import PluginRepositoryStorage from './PluginRepositoryStorage.vue';
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
canPublish?: boolean;
|
|
10
|
+
initialSection?: 'tools' | 'forge' | 'publishing';
|
|
11
|
+
}>();
|
|
12
|
+
const emit = defineEmits<{
|
|
13
|
+
openImport: [];
|
|
14
|
+
}>();
|
|
15
|
+
|
|
16
|
+
const slots = useSlots();
|
|
17
|
+
const store = useWorkspaceStore();
|
|
18
|
+
|
|
19
|
+
type DevSection = 'tools' | 'forge' | 'publishing';
|
|
20
|
+
const section = ref<DevSection>(props.initialSection ?? 'tools');
|
|
21
|
+
const publishingOpened = ref(props.initialSection === 'publishing');
|
|
22
|
+
|
|
23
|
+
watch(
|
|
24
|
+
() => props.initialSection,
|
|
25
|
+
(next) => {
|
|
26
|
+
if (!next) return;
|
|
27
|
+
chooseSection(next);
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
function chooseSection(next: DevSection) {
|
|
32
|
+
if (next === 'forge' && !slots.forge) return;
|
|
33
|
+
if (next === 'publishing' && !slots.publishing) return;
|
|
34
|
+
if (next === 'publishing') publishingOpened.value = true;
|
|
35
|
+
section.value = next;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
defineExpose({ chooseSection });
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<template>
|
|
42
|
+
<section class="plugin-developer-area" :aria-label="t('插件开发者区')">
|
|
43
|
+
<nav v-if="$slots.forge || $slots.publishing" class="dev-subnav" :aria-label="t('开发者工具导航')">
|
|
44
|
+
<button
|
|
45
|
+
type="button"
|
|
46
|
+
:class="{ active: section === 'tools' }"
|
|
47
|
+
:aria-pressed="section === 'tools'"
|
|
48
|
+
@click="chooseSection('tools')"
|
|
49
|
+
>
|
|
50
|
+
<Code2 :size="14" aria-hidden="true" />{{ t('导入与调试') }}
|
|
51
|
+
</button>
|
|
52
|
+
<button
|
|
53
|
+
v-if="$slots.forge"
|
|
54
|
+
type="button"
|
|
55
|
+
:class="{ active: section === 'forge' }"
|
|
56
|
+
:aria-pressed="section === 'forge'"
|
|
57
|
+
@click="chooseSection('forge')"
|
|
58
|
+
>
|
|
59
|
+
<Hammer :size="14" aria-hidden="true" />{{ t('插件工坊') }}
|
|
60
|
+
</button>
|
|
61
|
+
<button
|
|
62
|
+
v-if="$slots.publishing"
|
|
63
|
+
type="button"
|
|
64
|
+
:class="{ active: section === 'publishing' }"
|
|
65
|
+
:aria-pressed="section === 'publishing'"
|
|
66
|
+
@click="chooseSection('publishing')"
|
|
67
|
+
>
|
|
68
|
+
<Send :size="14" aria-hidden="true" />{{ t('我的投稿') }}
|
|
69
|
+
</button>
|
|
70
|
+
</nav>
|
|
71
|
+
|
|
72
|
+
<div v-if="section === 'tools'" class="dev-tools-panel">
|
|
73
|
+
<div class="dev-card">
|
|
74
|
+
<div class="dev-card-copy">
|
|
75
|
+
<h3>{{ t('导入本地插件包') }}</h3>
|
|
76
|
+
<p>{{ t('导入 .tano-plugin.zip 归档包或声明式 JSON 清单,也可载入内置示例或仅缓存到当前设备用于调试。') }}</p>
|
|
77
|
+
</div>
|
|
78
|
+
<button type="button" class="pc-button pc-primary" :aria-label="t('导入插件')" @click="emit('openImport')">
|
|
79
|
+
<Upload :size="15" aria-hidden="true" />{{ t('导入插件包…') }}
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<div v-if="store.pluginDevelopment.active" class="dev-card dev-watch-card" role="status">
|
|
84
|
+
<div class="dev-card-copy">
|
|
85
|
+
<h3>{{ t('本地开发监听运行中') }}</h3>
|
|
86
|
+
<p>
|
|
87
|
+
<code>{{ store.pluginDevelopment.pluginId }}</code> · {{ store.pluginDevelopment.message }}
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
<div class="dev-card-actions">
|
|
91
|
+
<button
|
|
92
|
+
v-if="store.pluginDevelopment.pluginId"
|
|
93
|
+
type="button"
|
|
94
|
+
class="pc-button pc-secondary"
|
|
95
|
+
@click="store.openPluginDetail(store.pluginDevelopment.pluginId)"
|
|
96
|
+
>
|
|
97
|
+
{{ t('查看详情') }}
|
|
98
|
+
</button>
|
|
99
|
+
<button
|
|
100
|
+
type="button"
|
|
101
|
+
class="pc-button pc-secondary"
|
|
102
|
+
@click="store.stopPluginDevelopment()"
|
|
103
|
+
>
|
|
104
|
+
<Square :size="13" aria-hidden="true" />{{ t('停止自动重载') }}
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
<PluginRepositoryStorage />
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div v-if="$slots.forge && section === 'forge'" class="dev-slot-panel">
|
|
113
|
+
<slot
|
|
114
|
+
name="forge"
|
|
115
|
+
:can-publish="Boolean(canPublish && $slots.publishing)"
|
|
116
|
+
:developer-mode="true"
|
|
117
|
+
:open-publishing="() => chooseSection('publishing')"
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div v-if="$slots.publishing && publishingOpened" v-show="section === 'publishing'" class="dev-slot-panel">
|
|
122
|
+
<slot name="publishing" :developer-mode="true" />
|
|
123
|
+
</div>
|
|
124
|
+
</section>
|
|
125
|
+
</template>
|
|
126
|
+
|
|
127
|
+
<style scoped>
|
|
128
|
+
.plugin-developer-area {
|
|
129
|
+
display: grid;
|
|
130
|
+
gap: 16px;
|
|
131
|
+
}
|
|
132
|
+
.dev-subnav {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-wrap: wrap;
|
|
135
|
+
gap: 8px;
|
|
136
|
+
}
|
|
137
|
+
.dev-subnav button {
|
|
138
|
+
display: inline-flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
gap: 6px;
|
|
141
|
+
padding: 6px 12px;
|
|
142
|
+
border: 1px solid var(--line);
|
|
143
|
+
border-radius: 999px;
|
|
144
|
+
background: var(--paper);
|
|
145
|
+
color: var(--muted);
|
|
146
|
+
font: inherit;
|
|
147
|
+
font-size: 12.5px;
|
|
148
|
+
cursor: pointer;
|
|
149
|
+
}
|
|
150
|
+
.dev-subnav button.active {
|
|
151
|
+
color: var(--text);
|
|
152
|
+
border-color: var(--text);
|
|
153
|
+
background: var(--surface);
|
|
154
|
+
font-weight: 500;
|
|
155
|
+
}
|
|
156
|
+
.dev-tools-panel {
|
|
157
|
+
display: grid;
|
|
158
|
+
gap: 12px;
|
|
159
|
+
}
|
|
160
|
+
.dev-card {
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: space-between;
|
|
164
|
+
gap: 16px;
|
|
165
|
+
flex-wrap: wrap;
|
|
166
|
+
padding: 16px 18px;
|
|
167
|
+
border: 1px solid var(--line);
|
|
168
|
+
border-radius: 10px;
|
|
169
|
+
background: var(--surface);
|
|
170
|
+
}
|
|
171
|
+
.dev-card-copy {
|
|
172
|
+
display: grid;
|
|
173
|
+
gap: 4px;
|
|
174
|
+
min-width: 0;
|
|
175
|
+
}
|
|
176
|
+
.dev-card-copy h3 {
|
|
177
|
+
margin: 0;
|
|
178
|
+
font-size: 14px;
|
|
179
|
+
font-weight: 600;
|
|
180
|
+
color: var(--text);
|
|
181
|
+
}
|
|
182
|
+
.dev-card-copy p {
|
|
183
|
+
margin: 0;
|
|
184
|
+
font-size: 12.5px;
|
|
185
|
+
color: var(--muted);
|
|
186
|
+
}
|
|
187
|
+
.dev-card-actions {
|
|
188
|
+
display: flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
gap: 8px;
|
|
191
|
+
}
|
|
192
|
+
</style>
|