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
63 changes: 63 additions & 0 deletions showcase/specs/bar-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import type { ComponentSpec } from '../lib/spec'
import { h } from 'vue'
import { BarList, barListSortKeys, dataToneKeys } from '#/components/bar-list'

export const barListSpec: ComponentSpec = {
id: 'bar-list',
name: 'BarList',
description:
'Proportional horizontal comparison bars without a full-width background track, sharing one common readout column so bar lengths stay true to scale.',
descriptionZh:
'无全宽灰底轨道的横向比例对比条:共享统一的右侧数值列宽度,保证所有条形长度严格按同一比例尺绘制。',
controls: [
{ kind: 'string', key: 'title', label: 'Title', default: 'Throughput by tier' },
{ kind: 'enum', key: 'sort', label: 'Sort', options: barListSortKeys, default: 'desc', display: 'segmented' },
{ kind: 'enum', key: 'tone', label: 'Tone', options: dataToneKeys, default: 'blue' },
{ kind: 'boolean', key: 'grouped', label: 'Multi-series', default: false },
],
examples: [
{
name: 'Multi-series multipliers',
nameZh: '多序列倍率对比',
note: 'Series dots identify each bar within a group; decimals align automatically.',
noteZh: '顶部圆点图例区分组内多条序列,小数位自动补齐对齐。',
state: { title: 'Bandwidth vs. price multiplier', sort: 'none', grouped: true },
},
],
render: state =>
state.grouped
? h(BarList, {
class: 'w-full max-w-96',
title: String(state.title),
unit: '×',
sort: state.sort as never,
series: [
{ name: 'Bandwidth', tone: 'blue' },
{ name: 'Hourly cost', tone: 'amber' },
],
items: [
{ label: 'Baseline', values: [1, 1] },
{ label: 'Mid-range', values: [2.31, 1.28] },
{ label: 'Flagship', values: [5.56, 2.33] },
],
})
: h(BarList, {
class: 'w-full max-w-96',
title: String(state.title),
unit: 'req/s',
sort: state.sort as never,
items: [
{ label: 'Edge cache', value: 1420, tone: state.tone as never },
{ label: 'Regional API', value: 860, tone: state.tone as never },
{ label: 'Cold origin', value: 95, tone: state.tone as never },
],
}),
usage: `Use BarList to compare ranked or grouped quantities across items. Unlike Progress, bars have no full-width gray track behind them so visual weight reflects magnitude rather than completion.

- Reserve Progress for a single 0–100 completion or quota gauge.
- Set unit (such as "×", "%", "ms", "GB") when all items share one unit.`,
usageZh: `用 BarList 横向对比多条目的排行或分组数值。不同于 Progress,条形背后不铺满灰底轨道,使视觉长度直接表达量级而非完成度。

- 单一 0–100 完成度或配额进度请用 Progress。
- 各条目共用同一单位时传入 unit(如 "×"、"%"、"ms"、"GB")。`,
}
8 changes: 8 additions & 0 deletions showcase/specs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ComponentSpec } from '../lib/spec'
import { accordionSpec } from './accordion'
import { actionCardSpec } from './action-card'
import { badgeSpec } from './badge'
import { barListSpec } from './bar-list'
import { buttonSpec } from './button'
import { cardSpec } from './card'
import { checkboxSpec } from './checkbox'
Expand All @@ -15,9 +16,12 @@ import { nativeSelectSpec } from './native-select'
import { numberFieldSpec } from './number-field'
import { popoverSpec } from './popover'
import { segmentedSpec } from './segmented'
import { segmentedBarSpec } from './segmented-bar'
import { selectSpec } from './select'
import { skeletonSpec } from './skeleton'
import { sonnerSpec } from './sonner'
import { statusListSpec } from './status-list'
import { stepsSpec } from './steps'
import { switchSpec } from './switch'
import { tabsSpec } from './tabs'
import { textareaSpec } from './textarea'
Expand Down Expand Up @@ -45,6 +49,10 @@ export const componentSpecs: ComponentSpec[] = [
actionCardSpec,
badgeSpec,
cardSpec,
barListSpec,
segmentedBarSpec,
statusListSpec,
stepsSpec,
tabsSpec,
accordionSpec,
skeletonSpec,
Expand Down
47 changes: 47 additions & 0 deletions showcase/specs/segmented-bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type { ComponentSpec } from '../lib/spec'
import { h } from 'vue'
import { SegmentedBar } from '#/components/segmented-bar'

export const segmentedBarSpec: ComponentSpec = {
id: 'segmented-bar',
name: 'SegmentedBar',
description:
'Part-to-whole composition strip paired with dot-swatch breakdown rows; hovering a segment or row dims sibling segments via @layer components.',
descriptionZh:
'部分占整体的多段构成条与圆点明细行:悬停任一分段或行时联动弱化其余项(交互样式归口于 @layer components)。',
controls: [
{ kind: 'string', key: 'title', label: 'Title', default: 'Memory footprint' },
{ kind: 'boolean', key: 'showPercent', label: 'Show percent', default: true },
{ kind: 'number', key: 'total', label: 'Total cap (0 = sum)', default: 0, min: 0, max: 64 },
],
examples: [
{
name: 'With unallocated headroom',
nameZh: '带剩余容量上限',
note: 'Passing total larger than the item sum leaves neutral track space on the right.',
noteZh: '传入大于各段之和的 total 时,右侧自动留出未占用底槽。',
state: { title: '48 GiB card allocation', total: 48, showPercent: true },
},
],
render: state =>
h(SegmentedBar, {
class: 'w-full max-w-96',
title: String(state.title),
unit: 'GiB',
showPercent: Boolean(state.showPercent),
total: Number(state.total) > 0 ? Number(state.total) : undefined,
items: [
{ label: 'Model weights', value: 18, tone: 'blue' },
{ label: 'KV cache', value: 12, tone: 'teal' },
{ label: 'Runtime overhead', value: 4, tone: 'amber' },
],
}),
usage: `Use SegmentedBar when 2–6 parts add up to a meaningful whole (memory, storage, cost, or token share).

- Keep segment count ≤ 6 so swatches remain distinguishable at a glance.
- Pass total when comparing used slices against a fixed capacity ceiling.`,
usageZh: `当 2–6 个部分合成为一个整体(显存、存储、费用或配额构成)时使用 SegmentedBar。

- 分段数控制在 6 段以内,保证色点与比例一眼可辨。
- 需要对照固定容量上限展示剩余空间时传入 total。`,
}
34 changes: 34 additions & 0 deletions showcase/specs/status-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { ComponentSpec } from '../lib/spec'
import { h } from 'vue'
import { StatusList, statusListStateKeys } from '#/components/status-list'

export const statusListSpec: ComponentSpec = {
id: 'status-list',
name: 'StatusList',
description:
'Compact check or compatibility rows with rationed signal icons, accessible status labels, optional secondary metadata, and tabular right-aligned results.',
descriptionZh:
'带语义状态图标、无障碍状态读音、可选辅助说明与右侧等宽结果的紧凑检查列表。',
controls: [
{ kind: 'string', key: 'title', label: 'Title', default: 'Node compatibility' },
{ kind: 'boolean', key: 'divided', label: 'Divided', default: true },
{ kind: 'enum', key: 'firstStatus', label: 'First row status', options: statusListStateKeys, default: 'error' },
],
render: state =>
h(StatusList, {
class: 'w-full max-w-96',
title: String(state.title),
divided: Boolean(state.divided),
items: [
{ label: '24 GiB single card', sub: 'Entry workstation', meta: '$0.80/h', status: state.firstStatus as never, value: state.firstStatus === 'error' ? 'Insufficient' : 'Checked' },
{ label: '48 GiB single card', sub: 'Production baseline', meta: '$1.95/h', status: 'ok', value: 'Fits cleanly' },
{ label: '80 GiB high-bandwidth', meta: '$2.50/h', status: 'info', value: 'Headroom available' },
],
}),
usage: `Use StatusList for read-only pass/warn/error checks, preflight diagnostics, or compact key-value summaries.

- Do not use StatusList for interactive settings rows with switches or inputs — use SettingsRow inside SettingsSection or SettingsList instead.`,
usageZh: `用 StatusList 展示只读的通过/告警/失败检查项、前置诊断或紧凑键值摘要。

- 右侧带开关、下拉或按钮的可交互设置行请使用 SettingsSection / SettingsList 配合 SettingsRow,不要混用。`,
}
28 changes: 28 additions & 0 deletions showcase/specs/steps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { ComponentSpec } from '../lib/spec'
import { h } from 'vue'
import { Steps, stepStatusKeys } from '#/components/steps'

export const stepsSpec: ComponentSpec = {
id: 'steps',
name: 'Steps',
description:
'Vertical numbered and status step rail for linear rollouts, migrations, and operating procedures.',
descriptionZh:
'用于线性发布流程、数据迁移与操作指引的纵向编号状态步骤流。',
controls: [
{ kind: 'string', key: 'title', label: 'Title', default: 'Rollout sequence' },
{ kind: 'enum', key: 'middleStatus', label: 'Step 2 status', options: stepStatusKeys, default: 'current', display: 'segmented' },
],
render: state =>
h(Steps, {
class: 'w-full max-w-96',
title: String(state.title),
items: [
{ title: 'Dual-write shadow traffic', badge: '10 min', status: 'done', description: 'Mirror writes while keeping reads on the primary table.' },
{ title: 'Verify partition checksums', badge: '25 min', status: state.middleStatus as never, description: 'Confirm zero row drift across historical shards.' },
{ title: 'Switch read traffic', badge: '5 min', status: 'upcoming', description: 'Retain previous table read-only for 24h rollback.' },
],
}),
usage: 'Use Steps to communicate ordered stages and their current state. Keep descriptions to one concise sentence per step.',
usageZh: '用 Steps 呈现有先后顺序的阶段及其当前状态。每步说明保持在一句简短正文以内。',
}
12 changes: 12 additions & 0 deletions skills/ui-owners/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ description: 在编写或修改任何设置页、Bot 详情页 Tab、弹窗/气

- **`MetricReadout` `[稳定]`**
- 单个统计数值块:上方小字标签 + 下方等宽数字(`tabular-nums`)或状态点。Props:`label`、`value`、`sub`、`framed`(默认 `true` 带边框白卡,在已有表面上裸放时设 `false`)、`status: 'ok' | 'warn' | 'error'`;插槽:`#value`(自定义相对时间或等宽文本)。网格列数由调用方外层容器控制。
- **`BarList` `[稳定]`**
- 单序列排行或多序列分组横向比例对比条(无全宽灰底轨道,与 `Progress` 单指标进度槽区分):顶部可选圆点图例(`series`),左侧为 `h-3.5 rounded-sm` 比例条,右侧为自动对齐小数位的等宽数值与单位(`tabular-nums`)。
- **`SegmentedBar` `[稳定]`**
- 部分占整体的多段构成占比条(`h-3.5 rounded-sm`):上方分段色条与下方圆点明细行共享悬停联动弱化(`opacity-40`),自动计算百分比与数值读数。
- **`StatusList` `[稳定]`**
- 带状态图标(`ok` / `warn` / `error` / `info` / `neutral`)的紧凑检查或键值对齐行:支持 `divided` 细线分隔、左侧副说明 `sub` 与右侧辅助 `meta` + 等宽状态结果。
- **`Steps` `[稳定]`**
- 纵向编号与状态步骤流(`done` / `current` / `warn` / `upcoming`):左侧状态圆标与连接细线,右侧步骤标题、可选 `Badge` 与说明文案。
- **`PersonaTile` `[稳定]`**
- 垂直居中的实体/新增磁贴卡片(`w-52 flex-col items-center`,`variant: 'entity' | 'add'`),是水平 `BackendCard` 的纵向对应物。
- **`CalloutBanner` `[稳定]`**
Expand Down Expand Up @@ -164,6 +172,10 @@ description: 在编写或修改任何设置页、Bot 详情页 Tab、弹窗/气
| 同页堆叠多组自带边框的网格(如多组卡片) | `SectionGroup` |
| 标签在上的垂直表单字段(含校验报错) | `FieldStack`(连续多个外包 `FormStack`) |
| 单个统计数字/状态磁贴 | `MetricReadout`(外层网格由调用方排布) |
| 横向排行或多序列分组比例对比条 | `BarList`(单值进度用 `Progress`) |
| 部分占整体的多段占比构成条 | `SegmentedBar` |
| 带通过/告警/失败图标的检查对齐列表 | `StatusList` |
| 纵向阶段或操作步骤流 | `Steps` |
| 垂直居中的角色/新增磁贴 | `PersonaTile` |
| 警告或错误提示横幅 | `CalloutBanner` |
| 设备码输入与一键复制跳转面板 | `DeviceCodePanel` |
Expand Down
Loading
Loading