Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .agents/skills/mas-frontend-standards/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Before editing frontend code:
| Route page | `src/views/<module>/index.vue` or `src/views/Xxx.vue` | `src/components` |
| Single-module component | `src/views/<module>/components` | `src/components` root |
| Cross-module component | `src/components` | Copied across page folders |
| Shared UI primitive / shell | `src/components/ui` (exported via `@/components/ui`) | Hand-rolled raw `a-modal` / page surface / state wrappers per view |
| Confirmation dialog service | `src/composables/useConfirm.ts` | Repeated `Modal.confirm` option blocks across pages |
| Business API wrapper | `src/composables/useXxxApi.ts` | Vue page or `src/api` |
| Reusable page flow | `src/views/<module>/useXxxLogic.ts` or composable | Template expressions |
| Pure utility | `src/utils` | Copied inside components |
Expand Down
14 changes: 7 additions & 7 deletions .agents/skills/mas-frontend-ui/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ If Playwright cannot render or capture the concept, report the blocker and pause

| Need | Prefer |
| ------------ | ---------------------------------------------------------------------------------------------------------------------- |
| Layout | `a-layout`, `a-menu`, `a-tabs`, `a-card`, `a-space`, `a-flex`, `a-row`, `a-col` |
| Form input | `a-form`, `a-form-item`, `a-input`, `a-input-number`, `a-select`, `a-switch`, `a-checkbox`, `a-radio`, `a-date-picker` |
| Data display | `a-table`, `a-tag`, `a-empty`, `a-statistic`, `a-typography` |
| Feedback | `a-modal`, `Modal.confirm`, `message`, `a-spin`, `a-progress`, `a-alert` |
| Layout | `AppPage`, `PageHeader`, `PageSurface`, `SectionCard`, `ConfigEditShell` (`@/components/ui`); AntD `a-layout`, `a-menu`, `a-tabs`, `a-card`, `a-space`, `a-flex`, `a-row`, `a-col` |
| Form input | `SettingRow` (`@/components/ui`); AntD `a-form`, `a-form-item`, `a-input`, `a-input-number`, `a-select`, `a-switch`, `a-checkbox`, `a-radio`, `a-date-picker` |
| Data display | `StateView`, `NoData`, `StatusChip` (`@/components/ui`); AntD `a-table`, `a-tag`, `a-statistic`, `a-typography` |
| Feedback | `AppModal`, `ConfirmActionButton`, `useConfirm` (`@/composables/useConfirm`); AntD `message`, `a-progress`, `a-alert` |
| Icons | `@ant-design/icons-vue` |

Use default component styles, official props, slots, layout components, and theme tokens first. Custom CSS is for local layout constraints or real readability needs.
For new or refactored UI, reuse the shared primitives in [Shared UI components](references/shared-ui-components.md) before hand-rolling raw `a-modal`, `Modal.confirm`, `a-spin`, `a-empty`, or `.form-section` wrappers. Use default component styles, official props, slots, layout components, and theme tokens first. Custom CSS is for local layout constraints or real readability needs.

When overriding Ant Design Vue internals:

Expand Down Expand Up @@ -122,8 +122,8 @@ Before completing styling work that touches colors, borders, backgrounds, or add

### Modals And Drawers

1. Use `Modal.confirm` for destructive confirmation.
2. Use `a-modal` for short forms and simple flows.
1. Use `useConfirm` (`@/composables/useConfirm`) or `ConfirmActionButton` (`@/components/ui`) for destructive confirmation instead of ad hoc `Modal.confirm` calls.
2. Use `AppModal` (`@/components/ui`) for short forms and simple flows; rely on its `size`, `submitting`, `dirty`, `scroll`, and `layer` presets rather than hand-coding widths, `z-index`, or close locks per page.
3. Prefer Drawer or a full page for long configuration, complex details, or logs.
4. Titles use concrete wording such as "新增 XX", "编辑 XX", "查看 XX", "删除确认".
5. Footer buttons follow "取消 / 确定" or "取消 / 保存".
Expand Down
25 changes: 25 additions & 0 deletions .agents/skills/mas-frontend-ui/references/shared-ui-components.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Shared UI Components

Prefer the unified primitives exported from `@/components/ui` (and `@/composables/useConfirm`) over hand-rolling raw Ant Design Vue wrappers or page-local layout CSS.

## Component Map

| Need | Prefer | Key Props / API | Notes |
| --- | --- | --- | --- |
| Dialog / form modal | `AppModal` (`@/components/ui`) | `v-model:open`, `size?: 'sm'\|'md'\|'lg'\|'xl'\|'full'` (`480/600/760/960/90vw`), `width`, `title`, `subtitle`, `icon`, `footer?: 'confirm'\|'close'\|'none'\|'custom'`, `okText`, `cancelText`, `okDanger`, `okDisabled`, `submitting`, `dirty`, `scroll?: 'body'\|'none'`, `layer?: 'default'\|'nested'\|'blocking'` | Defaults to `centered` and `destroyOnClose`. `submitting` syncs confirm loading and locks `closable`/`keyboard`/`maskClosable`. `dirty` triggers an unsaved-changes confirm before closing. Inherits 32px Electron title-bar avoidance via `styles/appOverlays.css`; forwards extra AntD `a-modal` props via `$attrs`. Slots: `header`, `header-extra`, `default`, `footer-left`, `footer`. |
| Imperative confirmation | `useConfirm` / `openConfirm` (`@/composables/useConfirm`) | `confirm({ tone?: 'danger'\|'warning'\|'info', title, description?, okText?, cancelText?, width?, maskClosable?, zIndex?, onOk? }): Promise<boolean>` | Defaults to `centered: true`, `wrapClassName: 'app-confirm-modal'`, and `okType: 'danger'` for `tone: 'danger'`. Pass `Modal.useModal()` host when inside a scoped `ConfigProvider` theme. `onOk` rejections stay open instead of resolving `true`; cancel resolves `false`. |
| Destructive / confirm action button | `ConfirmActionButton` (`@/components/ui`) | `risk?: 'low'\|'high'`, `tone`, `title`, `description`, `okText`, `cancelText`, `danger`, `type`, `size`, `disabled`, `loading`, `confirm: () => void \| Promise<unknown>` | `risk="low"` uses `a-popconfirm`; `risk="high"` uses `Modal.useModal()` + `useConfirm`. Prevents duplicate clicks and tracks async `confirm` loading automatically. |
| Page root shell | `AppPage` (`@/components/ui`) | `layout?: 'scroll'\|'fill'`, `maxWidth` | Use `scroll` for normal scrolling pages and `fill` for viewport-bound split/scrollable panes (e.g. history, plugins, logs). |
| Page header | `PageHeader` (`@/components/ui` or `@/components/PageHeader.vue`) | `title`, `subtitle`, `icon`; slots `leading`, `title`, `meta`, `search`, `actions` | Reuses `.app-page-header` / `.app-page-title` tokens from `styles/pageTitle.css`. |
| Page content surface | `PageSurface` (`@/components/ui` or `@/components/PageSurface.vue`) | `variant?: 'surface'\|'section'\|'transparent'`, `padding?: 'none'\|'sm'\|'md'`, `scrollable` | Applies `.app-page-surface` / `.app-page-section` backed by `--app-appearance-surface-bg`, providing custom-background opacity and nested transparent surfaces without adding page selectors to `appearanceSurfaces.css`. |
| Section container | `SectionCard` (`@/components/ui`) | `title`, `subtitle`, `icon`, `variant?: 'card'\|'plain'\|'sub'`, `density?: 'default'\|'compact'`, `collapsible`, `v-model:collapsed`, `anchorId`; slots `title`, `actions`, `default`, `footer` | Keeps `.form-section > .section-header > h3` so anchor layouts continue collecting headings. Use `plain` for flat form sections and `sub` for framed nested subsections. |
| Loading / error / empty boundary | `StateView` (`@/components/ui`) + `NoData` | `loading`, `error`, `empty`, `loadingTip`, `emptyTitle`, `emptyDescription`, `emptySize?: 'sm'\|'md'\|'lg'`, `minHeight`, `overlayLoading`, `@retry`; slots `loading`, `error`, `empty`, `empty-action`, `default` | Renders a centered spinner inside an explicit `minHeight` box (avoiding zero-height origin drift), `ApiRetryAlert` for errors, and `NoData` for empty states. |
| Script / user config edit shell | `ConfigEditShell` (`@/components/ui`) | `loading`, `error`, `loadingTip`, `maxWidth`, `surface`, `@retry`; slots `header`, `banner`, `default`, `footer`, `overlay` | Composes `AppPage`, `PageSurface`, and `StateView`. Set `:surface="false"` when wrapping legacy `ConfigLockPanel` + `a-card` pages incrementally. |
| Existing form/status primitives | `SettingRow`, `StatusChip` (`@/components/ui`) | See component props | Use `SettingRow` for label-to-control rows inside `SectionCard`, and `StatusChip` for finite status indicators. |

## Extension Rules

1. Keep wrappers thin: accept semantic presets (`size`, `variant`, `density`, `tone`, `risk`) and forward native Ant Design Vue attributes via `v-bind="$attrs"` (`inheritAttrs: false`) instead of mirroring every AntD prop.
2. Drive variations with props and `--ant-*` / `--app-*` tokens, never by coupling shared components to page-specific ancestor class names.
3. Keep default chrome quiet: render optional subtitles, icons, or footer notes only when explicitly supplied by the caller; avoid decorative emojis and filler explanatory copy.
4. Keep overlay geometry in `frontend/src/styles/appOverlays.css` and surface transparency in `frontend/src/styles/pageSurface.css` / `appearanceSurfaces.css` rather than duplicating portal or background overrides per page.
60 changes: 53 additions & 7 deletions frontend/src/components/NoData.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,66 @@
<script setup lang="ts">
import { computed } from 'vue'
import { Empty, type EmptyProps } from 'ant-design-vue'
import noDataImage from '@/assets/NoData.svg'

defineProps<{
description?: EmptyProps['description']
imageStyle?: EmptyProps['imageStyle']
}>()
export type NoDataSize = 'sm' | 'md' | 'lg'

const SIZE_HEIGHT_MAP: Record<NoDataSize, string> = {
sm: '64px',
md: '80px',
lg: '120px',
}

const props = withDefaults(
defineProps<{
title?: string
description?: EmptyProps['description']
size?: NoDataSize
imageStyle?: EmptyProps['imageStyle']
}>(),
{
title: undefined,
description: undefined,
size: 'md',
imageStyle: undefined,
}
)

const resolvedImageStyle = computed(() => ({
height: SIZE_HEIGHT_MAP[props.size],
maxWidth: '100%',
...props.imageStyle,
}))
</script>

<template>
<Empty
:image="noDataImage"
:description="description"
:image-style="{ height: '80px', maxWidth: '100%', ...imageStyle }"
:description="title ? undefined : description"
:image-style="resolvedImageStyle"
>
<template v-if="$slots.description" #description><slot name="description" /></template>
<template v-if="$slots.description || title" #description>
<slot name="description">
<div class="no-data-title">{{ title }}</div>
<div v-if="description" class="no-data-description">{{ description }}</div>
</slot>
</template>
<template v-if="$slots.default" #default><slot /></template>
</Empty>
</template>

<style scoped>
.no-data-title {
color: var(--ant-color-text);
font-size: 15px;
font-weight: 500;
line-height: 22px;
}

.no-data-description {
margin-top: 4px;
color: var(--ant-color-text-secondary);
font-size: 13px;
line-height: 20px;
}
</style>
68 changes: 59 additions & 9 deletions frontend/src/components/PageHeader.vue
Original file line number Diff line number Diff line change
@@ -1,38 +1,88 @@
<script setup lang="ts">
import type { Component } from 'vue'

withDefaults(
defineProps<{
title: string
icon?: unknown
title?: string

Check warning on line 6 in frontend/src/components/PageHeader.vue

View workflow job for this annotation

GitHub Actions / 检查是否删掉了他人近期合入的代码

可能回退了 a617ddd11 的改动

这里删掉了 a617ddd11(DLmaster,2026-11-17 05:34 UTC 合入)加入的 2 行(原第 5、20 行)。如果不是有意修改,多半是同步分支时带回了旧版本的文件。
subtitle?: string
icon?: Component | unknown
}>(),
{ icon: undefined }
{
title: '',
subtitle: undefined,
icon: undefined,
}
)
</script>

<template>
<header class="app-page-header">
<div class="page-header-main">
<slot name="leading" />
<h1 class="app-page-title">
<component :is="icon" v-if="icon" />
{{ title }}
</h1>
<div class="page-header-heading">
<div class="page-header-title-row">
<slot name="title">
<h1 class="app-page-title">
<component :is="icon" v-if="icon" />
{{ title }}
</h1>
</slot>
<div v-if="$slots.meta" class="page-header-meta">
<slot name="meta" />
</div>
<div v-if="$slots.search" class="page-header-search">
<slot name="search" />
</div>
</div>
<p v-if="subtitle" class="page-header-subtitle">{{ subtitle }}</p>
</div>
</div>
<div class="page-header-actions">
<div v-if="$slots.actions" class="page-header-actions">
<slot name="actions" />
</div>
</header>
</template>

<style scoped>
.page-header-main,
.page-header-actions {
.page-header-actions,
.page-header-title-row,
.page-header-meta {
display: flex;
align-items: center;
min-width: 0;
}

.page-header-main {
gap: 8px;
flex: 1;
}

.page-header-heading {
display: flex;
flex-direction: column;
min-width: 0;
flex: 1;
}

.page-header-title-row {
flex-wrap: wrap;
gap: 12px;
}

.page-header-meta {
gap: 8px;
}

.page-header-search {
min-width: 0;
}

.page-header-subtitle {
margin: 4px 0 0;
color: var(--ant-color-text-secondary);
font-size: 13px;
line-height: 20px;
}

.page-header-actions {
Expand Down
53 changes: 48 additions & 5 deletions frontend/src/components/PageSurface.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
<script setup lang="ts">
import { computed } from 'vue'

/**
* 统一页面正文表面容器。
*
* 复用 styles/pageSurface.css 与 styles/appearanceSurfaces.css 的共享表面类,
* 自动适配亮/暗主题、自定义背景透明度与嵌套透明去重。
*/
const props = withDefaults(
defineProps<{
variant?: 'surface' | 'section' | 'transparent'
padding?: 'none' | 'sm' | 'md'
scrollable?: boolean
}>(),
{
variant: 'surface',
padding: 'md',
scrollable: true,
}
)

const surfaceClass = computed(() => [
'page-surface',
props.variant === 'surface' ? 'app-page-surface' : null,
props.variant === 'section' ? 'app-page-section' : null,
`page-surface--pad-${props.padding}`,
props.scrollable ? 'page-surface--scrollable' : null,
])
</script>

<template>
<section class="page-surface">
<section :class="surfaceClass">

Check warning on line 33 in frontend/src/components/PageSurface.vue

View workflow job for this annotation

GitHub Actions / 检查是否删掉了他人近期合入的代码

可能回退了 a617ddd11 的改动

这里删掉了 a617ddd11(DLmaster,2026-11-17 05:34 UTC 合入)加入的 4 行(原第 2、12、14、16 行)。如果不是有意修改,多半是同步分支时带回了旧版本的文件。
<slot />
</section>
</template>
Expand All @@ -8,11 +39,23 @@
.page-surface {
flex: 1;
width: 100%;
min-width: 0;
min-height: 0;
padding: 16px;
}

.page-surface--scrollable {
overflow: auto;
background: var(--ant-color-bg-container);
border: 1px solid var(--ant-color-border-secondary);
border-radius: 8px;
}

.page-surface--pad-none {
padding: 0;
}

.page-surface--pad-sm {
padding: 12px;
}

.page-surface--pad-md {
padding: var(--app-page-content-padding);
}
</style>
Loading
Loading