Phase 007: migrate every remaining view from naive-ui to Arco Design Vue

The project now has exactly one UI library. Every naive-ui component in
packages/client/src is replaced by its Arco equivalent across 24 views and
roughly 80 components, and naive-ui is dropped from package.json along with
its transitive vueuc / @css-render / vdirs / seemly dependencies.

The migration is rendering-layer only. No store logic, no API contract, and
no /chat-run payload was touched.

Three classes of leftover were invisible to `grep naive-ui` and are now
covered by tests/client/no-naive-ui.test.ts, which asserts all three:
  - dead .n-* class names in style blocks
  - dead --n-* custom properties
  - naive-ui in package.json

Notable behavioural traps handled along the way, recorded in
docs/arco-migration-rules.md:
  - a-input-password defaults to masked; passing default-visibility="false"
    would have exposed API keys in clear text
  - a-upload fires a real XHR unless auto-upload is false
  - nested Trigger components fight over the first element child, so the
    group-chat settings dropdown was flattened
  - Arco renders tooltip default-slot text inline, which was silently
    collapsing the chat and group-chat toolbars
This commit is contained in:
2026-10-18 22:57:25 +08:00
parent c3eeea4187
commit 836d0228d2
115 changed files with 4067 additions and 3891 deletions
+16 -15
View File
@@ -1,8 +1,8 @@
// @vitest-environment jsdom
import { describe, expect, it, vi, beforeEach } from 'vitest'
import { defineComponent } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { mount } from '@vue/test-utils'
import { createTestingPinia } from '@pinia/testing'
import ArcoVue from '@arco-design/web-vue'
const routerPush = vi.hoisted(() => vi.fn())
@@ -18,23 +18,24 @@ vi.mock('vue-i18n', () => ({
useI18n: () => ({ t: (key: string) => key }),
}))
vi.mock('naive-ui', () => ({
NButton: defineComponent({
emits: ['click'],
template: '<button class="n-button-stub" type="button" @click="$emit(\'click\')"><slot /></button>',
}),
NTag: defineComponent({
template: '<span><slot /></span>',
}),
NSpin: defineComponent({
template: '<div><slot /></div>',
}),
vi.mock('@/composables/useMessage', () => ({
useMessage: () => ({ success: vi.fn(), error: vi.fn() }),
}))
vi.mock('@/composables/useDialog', () => ({
useDialog: () => ({ warning: vi.fn() }),
}))
import ProfileCard from '@/components/hermes/profiles/ProfileCard.vue'
function actionButton(wrapper: any, text: string) {
const button = wrapper
.findAll('.card-actions button')
.find((node: any) => node.text().trim() === text)
if (!button) throw new Error(`no card action labelled "${text}"`)
return button
}
describe('ProfileCard config edit affordance', () => {
beforeEach(() => {
vi.clearAllMocks()
@@ -52,14 +53,14 @@ describe('ProfileCard config edit affordance', () => {
},
},
global: {
plugins: [createTestingPinia({ createSpy: vi.fn })],
plugins: [createTestingPinia({ createSpy: vi.fn }), ArcoVue],
stubs: {
ProfileAvatar: { template: '<span class="profile-avatar-stub" />' },
},
},
})
await wrapper.get('.card-actions .n-button-stub').trigger('click')
await actionButton(wrapper, 'profiles.editConfig').trigger('click')
expect(routerPush).toHaveBeenCalledWith({
name: 'hermes.files',