@tbox.cn/app-template-agent 1.0.0-alpha.15 → 1.0.0-alpha.17
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/.gitignore +2 -0
- package/.tbox/app.json +1 -1
- package/.tbox/cache/._apps-client-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._apps-client.tsbuildinfo +0 -0
- package/.tbox/cache/._apps-server-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._apps-server.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-agent-ui-kit-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-agent-ui-kit.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-shared-strict.tsbuildinfo +0 -0
- package/.tbox/cache/._packages-shared.tsbuildinfo +0 -0
- package/.tbox/cache/apps-client-strict.tsbuildinfo +1 -0
- package/.tbox/cache/apps-client.tsbuildinfo +1 -0
- package/.tbox/cache/apps-server-strict.tsbuildinfo +1 -0
- package/.tbox/cache/apps-server.tsbuildinfo +1 -0
- package/.tbox/cache/packages-agent-ui-kit-strict.tsbuildinfo +1 -0
- package/.tbox/cache/packages-agent-ui-kit.tsbuildinfo +1 -0
- package/.tbox/cache/packages-shared-strict.tsbuildinfo +1 -0
- package/.tbox/cache/packages-shared.tsbuildinfo +1 -0
- package/.tbox/default-modules.json +1 -1
- package/.tbox/miniapp-containers.json +1 -1
- package/AGENTS.md +4 -0
- package/apps/client/scripts/._home-preset-wiring.test.ts +0 -0
- package/apps/client/scripts/._home-preset-wiring.ts +0 -0
- package/apps/client/scripts/._static-checks.test.mjs +0 -0
- package/apps/client/scripts/acceptance-changes.test.mjs +16 -3
- package/apps/client/scripts/check-evidence.mjs +69 -7
- package/apps/client/scripts/evidence-gate.mjs +9 -6
- package/apps/client/scripts/experience-checks.mjs +139 -0
- package/apps/client/scripts/geometry-kernel.test.mjs +3 -1
- package/apps/client/scripts/home-preset-wiring.test.ts +61 -0
- package/apps/client/scripts/home-preset-wiring.ts +41 -0
- package/apps/client/scripts/in-process-checks.mjs +100 -1
- package/apps/client/scripts/probe-checks.mjs +1 -0
- package/apps/client/scripts/static-checks.test.mjs +219 -0
- package/apps/client/src/cards/._home-preset.test.ts +0 -0
- package/apps/client/src/cards/._home-preset.ts +0 -0
- package/apps/client/src/cards/home-preset.test.ts +40 -0
- package/apps/client/src/cards/home-preset.ts +19 -0
- package/apps/client/src/cards/registry.ts +10 -3
- package/apps/client/src/pages/index/index.tsx +1 -1
- package/apps/client/src/styles/tailwind.css +3 -1
- package/apps/client/tsconfig.json +1 -0
- package/apps/client/vite.config.ts +15 -5
- package/apps/server/scripts/scenario-lib.mjs +12 -1
- package/config/._agent.jsonc +0 -0
- package/config/agent.jsonc +10 -0
- package/docs/agent/card-action.md +5 -1
- package/docs/agent/card.md +7 -1
- package/docs/agent/errors.md +7 -1
- package/docs/agent/kit.md +7 -6
- package/docs/agent/shell.md +3 -1
- package/docs/agent/style.md +37 -0
- package/docs/agent/verify.md +5 -2
- package/package.json +5 -4
- package/packages/agent-ui-kit/catalog.json +134 -5
- package/packages/agent-ui-kit/package.json +1 -1
- package/packages/agent-ui-kit/src/._contract.test.tsx +0 -0
- package/packages/agent-ui-kit/src/ChatPage.tsx +204 -27
- package/packages/agent-ui-kit/src/card/._confirm-fields.test.tsx +0 -0
- package/packages/agent-ui-kit/src/card/confirm-fields.test.tsx +106 -0
- package/packages/agent-ui-kit/src/card/primitives.tsx +270 -59
- package/packages/agent-ui-kit/src/card/use-card-actions.ts +5 -1
- package/packages/agent-ui-kit/src/card/view-card.tsx +113 -22
- package/packages/agent-ui-kit/src/chat-config.ts +2 -0
- package/packages/agent-ui-kit/src/components/ActionBar/DebugButton.tsx +12 -4
- package/packages/agent-ui-kit/src/components/ActionBar/index.tsx +61 -27
- package/packages/agent-ui-kit/src/components/BottomSheet/index.tsx +26 -2
- package/packages/agent-ui-kit/src/components/QuickCommands/index.tsx +60 -14
- package/packages/agent-ui-kit/src/components/ToolCallBlock/detail.test.ts +2 -0
- package/packages/agent-ui-kit/src/components/ToolCallBlock/detail.ts +9 -2
- package/packages/agent-ui-kit/src/contract.test.tsx +176 -0
- package/packages/agent-ui-kit/src/hooks/use-stick-to-bottom.test.tsx +101 -0
- package/packages/agent-ui-kit/src/hooks/use-stick-to-bottom.ts +35 -7
- package/packages/agent-ui-kit/src/index.ts +2 -0
- package/packages/agent-ui-kit/src/overlay/Overlay.tsx +21 -2
- package/packages/agent-ui-kit/src/overlay/overlay.test.tsx +15 -0
- package/packages/agent-ui-kit/src/preview-provider.tsx +8 -0
- package/packages/agent-ui-kit/src/shell.contract.json +1 -1
- package/packages/agent-ui-kit/src/shell.test.ts +105 -2
- package/packages/agent-ui-kit/src/theme/base.css +42 -2
- package/pnpm-lock.template.yaml +94 -94
- package/pnpm-workspace.template.yaml +11 -11
- package/scripts/._interaction-probe.mjs +0 -0
- package/scripts/check-fast.mjs +11 -2
- package/scripts/checks.json +80 -2
- package/scripts/deliver.mjs +85 -7
- package/scripts/interaction-probe.mjs +222 -0
- package/scripts/lib/geometry-kernel.mjs +8 -1
- package/scripts/shell-probe.mjs +8 -3
- package/scripts/storyboard.mjs +5 -0
package/docs/agent/kit.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { Card, CardHeader, KeyValueList, StatusTag } from '@tbox.cn/app-agent-ui-kit';
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
## 基元(
|
|
15
|
+
## 基元(21)
|
|
16
16
|
|
|
17
17
|
| 基元 | 用途 | props |
|
|
18
18
|
|---|---|---|
|
|
@@ -23,18 +23,19 @@ import { Card, CardHeader, KeyValueList, StatusTag } from '@tbox.cn/app-agent-ui
|
|
|
23
23
|
| `StatusTag` | 状态标签。 * | `children: ReactNode` `tone?: Tone` |
|
|
24
24
|
| `Notice` | 提示条:说明、限制、下一步指引。 * | `children: ReactNode` `tone?: Tone` `icon?: ReactNode` |
|
|
25
25
|
| `ActionRow` | 按钮行:主次两级,禁用整行。 * | `primary?: ReactNode` `secondary?: ReactNode` `disabled?: boolean` |
|
|
26
|
-
| `CardButton` | — | `children: ReactNode` `onClick?: () => void` `variant?:
|
|
27
|
-
| `ConfirmSheet` | 确认弹层:写操作前的一次确认(走 kit 统一弹层内核:传送、滚动锁、Escape、焦点循环与恢复)。 | `open: boolean` `title: ReactNode` `description?: ReactNode` `confirmText?: string` `cancelText?: string` `onConfirm: () => void` `onCancel: () => void` |
|
|
28
|
-
| `Ticket` | 票券形:券、凭证、卡包条目。 | `amount: ReactNode` `condition?: ReactNode` `meta?: ReactNode` `status?: ReactNode` `tone?: 'primary' \| 'muted'` |
|
|
26
|
+
| `CardButton` | — | `children: ReactNode` `onClick?: () => void` `variant?: CardButtonVariant` `size?: 'md' \| 'sm'` `disabled?: boolean` `busy?: boolean` `loading?: boolean` `className?: string` |
|
|
27
|
+
| `ConfirmSheet` | 确认弹层:写操作前的一次确认(走 kit 统一弹层内核:传送、滚动锁、Escape、焦点循环与恢复)。 | `open: boolean` `title: ReactNode` `description?: ReactNode` `confirmText?: string` `cancelText?: string` `tone?: 'primary' \| 'danger'` `highlights?: string[]` `onConfirm: () => void` `onCancel: () => void` |
|
|
28
|
+
| `Ticket` | 票券形:券、凭证、卡包条目。 | `amount: ReactNode` `title?: ReactNode` `action?: ReactNode` `condition?: ReactNode` `meta?: ReactNode` `status?: ReactNode` `tone?: 'primary' \| 'muted'` |
|
|
29
29
|
| `Steps` | 步骤/路线:取车路线、办理进度。 | `steps: StepItem[]` |
|
|
30
30
|
| `MediaRow` | 图文条目:门店、商品、活动。 | `title: ReactNode` `meta?: ReactNode` `tags?: ReactNode` `action?: ReactNode` `thumb?: ReactNode` |
|
|
31
|
-
| `Hero` | 品牌色块:主数值 + 说明,用于会员、积分、钱包类卡片的头部。 | `eyebrow?: ReactNode` `title
|
|
31
|
+
| `Hero` | 品牌色块:主数值 + 说明,用于会员、积分、钱包类卡片的头部。 | `eyebrow?: ReactNode` `title?: ReactNode` `value?: ReactNode` `unit?: ReactNode` `footnote?: ReactNode` `icon?: ReactNode` `tone?: 'primary' \| 'warm' \| 'jade' \| 'inverse' \| 'neutral'` |
|
|
32
32
|
| `StatGrid` | 并列数值格(两到三格):积分/余额、车位/时长。 | `items: StatItem[]` |
|
|
33
|
-
| `EntityRow` | 实体行(MediaRow 的超集):商户、活动、券包条目,支持价格与展开说明。 | `title: ReactNode` `meta?: ReactNode` `tags?: ReactNode` `price?: ReactNode` `action?: ReactNode` `thumb?: ReactNode` `description?: ReactNode` |
|
|
33
|
+
| `EntityRow` | 实体行(MediaRow 的超集):商户、活动、券包条目,支持价格与展开说明。 | `title: ReactNode` `badge?: ReactNode` `status?: ReactNode` `meta?: ReactNode` `tags?: ReactNode` `price?: ReactNode` `action?: ReactNode` `actions?: ReactNode` `thumb?: ReactNode` `description?: ReactNode` |
|
|
34
34
|
| `CheckRow` | 勾选行:用券、同意条款、选择车位。 | `label: ReactNode` `description?: ReactNode` `checked: boolean` `onChange?: (checked: boolean) => void` `disabled?: boolean` `trailing?: ReactNode` |
|
|
35
35
|
| `Timeline` | 明细时间线:积分收支、停车计费。 * | `items: TimelineItem[]` |
|
|
36
36
|
| `EmptyState` | 空态:没券、没订单、没记录时给一句解释与一个下一步。 * | `title: ReactNode` `description?: ReactNode` `action?: ReactNode` |
|
|
37
37
|
| `TagList` | 标签组:口味、距离、适用条件。 * | `tags: ReactNode[]` `tone?: Tone` |
|
|
38
|
+
| `CardActionButton` | 单动作按钮(`ActionList` 的单个版本):三件套自定义卡片想复用「单飞 / 确认弹层 / 历史禁用」 | `api: CardActions` `action: CardActionSpec` `variant?: CardButtonVariant` `size?: 'md' \| 'sm'` `className?: string` |
|
|
38
39
|
| `ActionList` | — | `actions: CardActionSpec[]` `api: CardActions` |
|
|
39
40
|
|
|
40
41
|
## 图标
|
package/docs/agent/shell.md
CHANGED
|
@@ -23,6 +23,8 @@ export default function Index() {
|
|
|
23
23
|
壳没有页头,也不渲染任何常驻标题区。智能体身份由两处配置承载:
|
|
24
24
|
|
|
25
25
|
- `welcome.title` / `welcome.subtitle`:空会话欢迎区的标题与副标题;
|
|
26
|
+
- `welcome.surface`:欢迎区表面(`default` 缺省 / `brand` 品牌深色渐变 / `subtle` 弱化描边)。
|
|
27
|
+
`brand` 只组合既有主题变量并在上面叠 18% 深色罩保证小字对比度——换品牌色不用改它;
|
|
26
28
|
- `page.title`:页面标题(浏览器标签页与分享卡片)。
|
|
27
29
|
|
|
28
30
|
欢迎区只在空会话且没有 `home` 槽时出现。
|
|
@@ -41,7 +43,7 @@ export default function Index() {
|
|
|
41
43
|
| 位置 | 改法 |
|
|
42
44
|
|---|---|
|
|
43
45
|
| 空会话欢迎区 | `config/chat.json` 的 `welcome.title` / `welcome.subtitle` |
|
|
44
|
-
| 快捷问题 | `config/chat.json` 的 `quickCommands
|
|
46
|
+
| 快捷问题 | `config/chat.json` 的 `quickCommands`(无 `home` 槽的空会话在正文用两列网格;有 `home` 槽的首页与对话态共用输入框上方单行,见 [agent-prompt](agent-prompt.md)) |
|
|
45
47
|
| 出错重试 | `config/chat.json` 的 `retryOnError`(缺省 true):错误气泡上给「重试」,重发上一条用户消息 |
|
|
46
48
|
| 输入框行数 | `config/chat.json` 的 `input.minRows`(空输入框行数,缺省 1)/ `input.maxRows`(自动长高上限,缺省 4)。只有用户明确要求时才改 `minRows`——改了会记入「偏离出厂」 |
|
|
47
49
|
| 出厂能力开关 | 语音输入/播报、图片/视频上传缺省开启;`chat.json` 不写这些键。只有用户明确要求时才写 `false`——门禁会把它记为「偏离出厂」并要求写明依据 |
|
package/docs/agent/style.md
CHANGED
|
@@ -51,6 +51,43 @@ const TONE = { ok: 'bg-success-soft text-success', warn: 'bg-warning-soft text-w
|
|
|
51
51
|
- 禁用:默认调色板(`bg-red-500` 不生成)、透明度修饰符(`bg-primary/50` 依赖 `color-mix`,旧内核回落为不透明)、`!` 重要性(只在覆写无层的旧规则时用,写在变体尾部如 `rounded-none!`)。
|
|
52
52
|
- 未知类不会报错、只是不生效;上面这几类禁用项由 `check:fast` 的证据包直接判错(`palette-color` / `color-opacity-modifier` / `font-size-off-scale` / `element-asset-declaration`)。
|
|
53
53
|
|
|
54
|
+
## 出厂色板(三套,全部过 WCAG AA)
|
|
55
|
+
|
|
56
|
+
不想自己调色时,从下面三套里挑一套整段贴进 `brand.css` 的 `@tbox:tokens-begin/end` 标记区。
|
|
57
|
+
三套的八对常用前景/背景组合都 ≥ 4.5:1(大字号标题另算,只需 3:1),可以直接用,不必再跑 `theme check`。
|
|
58
|
+
|
|
59
|
+
| 风格 | 主色 | 深色 | 浅色 | 适合 |
|
|
60
|
+
|---|---|---|---|---|
|
|
61
|
+
| 暖砂松绿(默认推荐) | `#2f7d5d` | `#1f5a42` | `#eaf4ef` | 生活服务、商圈、社区 |
|
|
62
|
+
| 现代海蓝 | `#1b62d6` | `#134a9f` | `#eaf1fd` | 工具型、缴费、政务 |
|
|
63
|
+
| 温暖琥珀 | `#a15a12` | `#7a430b` | `#fdf1e2` | 餐饮、零售、促销 |
|
|
64
|
+
|
|
65
|
+
配套文字与中性色(三套通用,差异只在品牌彩部):
|
|
66
|
+
|
|
67
|
+
```css
|
|
68
|
+
html[data-theme='tbox'] {
|
|
69
|
+
/* 暖砂松绿 */
|
|
70
|
+
--tbox-primary: #2f7d5d;
|
|
71
|
+
--tbox-primary-dark: #1f5a42;
|
|
72
|
+
--tbox-primary-light: #eaf4ef;
|
|
73
|
+
--tbox-accent: #3f8f6c;
|
|
74
|
+
--tbox-accent-light: #eaf4ef;
|
|
75
|
+
--tbox-text-primary: #12181f;
|
|
76
|
+
--tbox-text-secondary: #4f5a68;
|
|
77
|
+
--tbox-text-muted: #6d7787;
|
|
78
|
+
--tbox-bg-page: #f8faf9;
|
|
79
|
+
--tbox-bg-card: #ffffff;
|
|
80
|
+
--tbox-bg-subtle: #f2f6f4;
|
|
81
|
+
--tbox-border: #e0e7e3;
|
|
82
|
+
--tbox-border-strong: #cfd9d3;
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- 换品牌只改这 13 个键,不要改 `--tbox-fs-*` / `--tbox-radius-*` / 阴影:那几组是版式合同,改了就与基元对不上。
|
|
87
|
+
- 深色主视觉(`hero.tone: 'inverse'`、`welcome.surface: 'brand'`)用 `primary-dark` 打底 + `primary-light` 写字;
|
|
88
|
+
浅色字压在中间调品牌色上达不到 4.5:1,平台已在欢迎区叠 18% 深色罩兜底,自定义时不要把它去掉。
|
|
89
|
+
- 需要第四套以外的品牌色:`theme derive --seed <hex>` 从种子派生,再 `theme check` 复核。
|
|
90
|
+
|
|
54
91
|
## 品牌与主题变量
|
|
55
92
|
|
|
56
93
|
品牌入口只有一个:`apps/client/src/styles/brand.css`,在 `html[data-theme='tbox']` 段里覆写平台变量:
|
package/docs/agent/verify.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
1. `pnpm generate`——生成 registry 与入口;三件套不成对、`cardType` 不一致在这里报错(视图卡声明了 `view`,免成对)。
|
|
20
20
|
2. `eslint --fix`——先修复,避免改文件与类型检查竞争。
|
|
21
|
-
3. 并行:四个包 `tsc --noEmit
|
|
21
|
+
3. 并行:四个包 `tsc --noEmit`(开发期放宽未用变量、增量缓存写 `.tbox/cache/`;`pnpm deliver` 会再跑一次严格 tsc)、`verify-generated` 结构检查、证据包。
|
|
22
22
|
4. **证据包**(`apps/client/scripts/check-evidence.mjs`,一个进程):品牌变量编译 → 卡片样例 / 出卡类型 / 出卡提示 / `invoke` 与动作对齐 / 字号 / 颜色语法 → 每张卡 × 每个样例经真实 React 组件渲染 → `scenarios/*.json` 全部执行 → 验收项覆盖与裁决。
|
|
23
23
|
|
|
24
24
|
成功输出一行 JSON,自带证据:
|
|
@@ -87,7 +87,10 @@
|
|
|
87
87
|
摘要里的 `coverage` 给每个维度一个状态(结构 / 逻辑 / 渲染 / 视觉 / 模型路由),`handoff` 是当前策略
|
|
88
88
|
验不了的清单。档位缺省 `visual`(静态 + 布局车道);应用把档位降到 `static` 必须写 `policyReason`(用户原话),否则门禁按 `visual` 执行并告警。平台可用 `TBOX_POLICY` 注入档位。
|
|
89
89
|
|
|
90
|
-
交付用 `pnpm deliver
|
|
90
|
+
交付用 `pnpm deliver`,只运行一次:它跑一次严格 tsc + `check:fast`(`--policy quick` 且门禁结果未过期时直接复用),输出裁决、未运行项、偏离出厂与验收变更,并生成 `DELIVERY.md`;摘要固定给一行「视觉证据:.tbox/evidence/storyboard.png(N 帧,几何问题 k 个)」。`pnpm storyboard` 仅供人工查看;`pnpm verify` 只在发布前由人/CI 跑。
|
|
91
|
+
|
|
92
|
+
`pnpm probe:interaction`:真 Chrome 里量弹层命中(`elementFromPoint`),含 `prefers-reduced-motion` 两页;
|
|
93
|
+
面板没有定位上下文这类「遮罩盖住按钮」的缺陷只有它能抓(happy-dom 单测看不见)。改过 `Overlay`/`ConfirmSheet`/`BottomSheet` 后跑一次;`stage` 会强制跑。
|
|
91
94
|
|
|
92
95
|
`pnpm storyboard`:把壳与每张卡的样例在 390 / 320 两个宽度排成一页长图并同时量几何(溢出、截断、点击区、字号)。源文件没变时命中缓存(<2s);没有 Chrome 记 not-run;帧数超预算时截断并注明。看图即可判断「界面到底长什么样」,不需要起 dev server;它仅供人工查看,交付时不要再单独运行。
|
|
93
96
|
已经 `deliverable` 之后再跑,`delivery.changedSinceDelivered` 给出交付后改动的文件数;裁决保持 `deliverable`,只记录不降级。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tbox.cn/app-template-agent",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.17",
|
|
4
4
|
"description": "tbox AI Agent 全栈模板(多包 pnpm workspace):apps/client + apps/server。唯一模板(W4 单一模板统一化:缺省带 AI 支付体验的 chat 形态;mall 能力经 profiles/mall 加装),能力经 CLI module add 模块扩展(shopping-guide/member 等)。",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0 <25.0.0",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"typescript-eslint": "8.67.0",
|
|
50
50
|
"eslint-plugin-react-hooks": "5.2.0",
|
|
51
51
|
"vite": "6.4.3",
|
|
52
|
-
"@tbox.cn/app-sdk-server": "1.0.0-alpha.
|
|
53
|
-
"@tbox.cn/app-build": "1.0.0-alpha.
|
|
54
|
-
"@tbox.cn/app-cli": "1.0.0-alpha.
|
|
52
|
+
"@tbox.cn/app-sdk-server": "1.0.0-alpha.17",
|
|
53
|
+
"@tbox.cn/app-build": "1.0.0-alpha.17",
|
|
54
|
+
"@tbox.cn/app-cli": "1.0.0-alpha.17"
|
|
55
55
|
},
|
|
56
56
|
"license": "MIT",
|
|
57
57
|
"publishConfig": {
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"check:fast": "node scripts/check-fast.mjs",
|
|
84
84
|
"deliver": "node scripts/deliver.mjs",
|
|
85
85
|
"probe:shell": "node scripts/shell-probe.mjs",
|
|
86
|
+
"probe:interaction": "node scripts/interaction-probe.mjs",
|
|
86
87
|
"check:css": "node scripts/check-css-target.mjs",
|
|
87
88
|
"scenario": "pnpm --filter ./apps/server exec node --import tsx scripts/scenario.mjs",
|
|
88
89
|
"card:render": "pnpm --filter ./apps/client exec node scripts/render-card.mjs",
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
195
|
"name": "CardButton",
|
|
196
|
-
"propsType": "{\n children: ReactNode;\n onClick?: () => void;\n variant?:
|
|
196
|
+
"propsType": "{\n children: ReactNode;\n onClick?: () => void;\n variant?: CardButtonVariant;\n /** `sm` 只压视觉(字号/内距),命中区仍 ≥44px */\n size?: 'md' | 'sm';\n disabled?: boolean;\n /** 动作进行中:只影响可访问性语义,视觉由调用方给 spinner */\n busy?: boolean;\n /** 由按钮自己渲染 spinner(自定义卡不必再手写 loading 标记) */\n loading?: boolean;\n /** 追加类名(布局用;颜色/尺寸仍走变体与 size,避免再次出现类冲突) */\n className?: string;\n}",
|
|
197
197
|
"props": [
|
|
198
198
|
{
|
|
199
199
|
"name": "children",
|
|
@@ -207,9 +207,15 @@
|
|
|
207
207
|
},
|
|
208
208
|
{
|
|
209
209
|
"name": "variant",
|
|
210
|
-
"type": "
|
|
210
|
+
"type": "CardButtonVariant",
|
|
211
211
|
"optional": true
|
|
212
212
|
},
|
|
213
|
+
{
|
|
214
|
+
"name": "size",
|
|
215
|
+
"type": "'md' | 'sm'",
|
|
216
|
+
"optional": true,
|
|
217
|
+
"doc": "`sm` 只压视觉(字号/内距),命中区仍 ≥44px"
|
|
218
|
+
},
|
|
213
219
|
{
|
|
214
220
|
"name": "disabled",
|
|
215
221
|
"type": "boolean",
|
|
@@ -220,6 +226,18 @@
|
|
|
220
226
|
"type": "boolean",
|
|
221
227
|
"optional": true,
|
|
222
228
|
"doc": "动作进行中:只影响可访问性语义,视觉由调用方给 spinner"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"name": "loading",
|
|
232
|
+
"type": "boolean",
|
|
233
|
+
"optional": true,
|
|
234
|
+
"doc": "由按钮自己渲染 spinner(自定义卡不必再手写 loading 标记)"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "className",
|
|
238
|
+
"type": "string",
|
|
239
|
+
"optional": true,
|
|
240
|
+
"doc": "追加类名(布局用;颜色/尺寸仍走变体与 size,避免再次出现类冲突)"
|
|
223
241
|
}
|
|
224
242
|
]
|
|
225
243
|
},
|
|
@@ -253,6 +271,18 @@
|
|
|
253
271
|
"type": "string",
|
|
254
272
|
"optional": true
|
|
255
273
|
},
|
|
274
|
+
{
|
|
275
|
+
"name": "tone",
|
|
276
|
+
"type": "'primary' | 'danger'",
|
|
277
|
+
"optional": true,
|
|
278
|
+
"doc": "主按钮语气:`danger` 用于取消报名/解绑等不可逆操作"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"name": "highlights",
|
|
282
|
+
"type": "string[]",
|
|
283
|
+
"optional": true,
|
|
284
|
+
"doc": "确认要点(如「+100 积分」「满100减20券」):渲染为紧凑标签行,扫一眼即知收益"
|
|
285
|
+
},
|
|
256
286
|
{
|
|
257
287
|
"name": "onConfirm",
|
|
258
288
|
"type": "() => void",
|
|
@@ -276,6 +306,18 @@
|
|
|
276
306
|
"optional": false,
|
|
277
307
|
"doc": "主金额或主标题"
|
|
278
308
|
},
|
|
309
|
+
{
|
|
310
|
+
"name": "title",
|
|
311
|
+
"type": "ReactNode",
|
|
312
|
+
"optional": true,
|
|
313
|
+
"doc": "券名(券组场景必填,单票券可省)"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"name": "action",
|
|
317
|
+
"type": "ReactNode",
|
|
318
|
+
"optional": true,
|
|
319
|
+
"doc": "右侧/底部动作(券组里的「领取」按钮)"
|
|
320
|
+
},
|
|
279
321
|
{
|
|
280
322
|
"name": "condition",
|
|
281
323
|
"type": "ReactNode",
|
|
@@ -377,7 +419,8 @@
|
|
|
377
419
|
{
|
|
378
420
|
"name": "title",
|
|
379
421
|
"type": "ReactNode",
|
|
380
|
-
"optional":
|
|
422
|
+
"optional": true,
|
|
423
|
+
"doc": "主标题(可选:纯数值型主视觉只需要 eyebrow + value)"
|
|
381
424
|
},
|
|
382
425
|
{
|
|
383
426
|
"name": "value",
|
|
@@ -453,6 +496,18 @@
|
|
|
453
496
|
"type": "ReactNode",
|
|
454
497
|
"optional": false
|
|
455
498
|
},
|
|
499
|
+
{
|
|
500
|
+
"name": "badge",
|
|
501
|
+
"type": "ReactNode",
|
|
502
|
+
"optional": true,
|
|
503
|
+
"doc": "标题前的短标记(分类字、评分)"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
"name": "status",
|
|
507
|
+
"type": "ReactNode",
|
|
508
|
+
"optional": true,
|
|
509
|
+
"doc": "标题右侧状态胶囊(可领取 / 已领取 / 售罄)"
|
|
510
|
+
},
|
|
456
511
|
{
|
|
457
512
|
"name": "meta",
|
|
458
513
|
"type": "ReactNode",
|
|
@@ -476,6 +531,12 @@
|
|
|
476
531
|
"optional": true,
|
|
477
532
|
"doc": "右侧操作(按钮)"
|
|
478
533
|
},
|
|
534
|
+
{
|
|
535
|
+
"name": "actions",
|
|
536
|
+
"type": "ReactNode",
|
|
537
|
+
"optional": true,
|
|
538
|
+
"doc": "底部操作行(多个条目级动作并排)"
|
|
539
|
+
},
|
|
479
540
|
{
|
|
480
541
|
"name": "thumb",
|
|
481
542
|
"type": "ReactNode",
|
|
@@ -610,6 +671,74 @@
|
|
|
610
671
|
}
|
|
611
672
|
]
|
|
612
673
|
},
|
|
674
|
+
{
|
|
675
|
+
"name": "CardActionButton",
|
|
676
|
+
"summary": "单动作按钮(`ActionList` 的单个版本):三件套自定义卡片想复用「单飞 / 确认弹层 / 历史禁用」",
|
|
677
|
+
"propsType": "{\n api: CardActions;\n action: CardActionSpec;\n /** 缺省按 action.style(primary → 实心) */\n variant?: CardButtonVariant;\n size?: 'md' | 'sm';\n className?: string;\n}",
|
|
678
|
+
"props": [
|
|
679
|
+
{
|
|
680
|
+
"name": "api",
|
|
681
|
+
"type": "CardActions",
|
|
682
|
+
"optional": false
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
"name": "action",
|
|
686
|
+
"type": "CardActionSpec",
|
|
687
|
+
"optional": false
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
"name": "variant",
|
|
691
|
+
"type": "CardButtonVariant",
|
|
692
|
+
"optional": true,
|
|
693
|
+
"doc": "缺省按 action.style(primary → 实心)"
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"name": "size",
|
|
697
|
+
"type": "'md' | 'sm'",
|
|
698
|
+
"optional": true
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
"name": "className",
|
|
702
|
+
"type": "string",
|
|
703
|
+
"optional": true
|
|
704
|
+
}
|
|
705
|
+
],
|
|
706
|
+
"itemTypes": [
|
|
707
|
+
{
|
|
708
|
+
"name": "CardActionSpec",
|
|
709
|
+
"members": [
|
|
710
|
+
{
|
|
711
|
+
"name": "label",
|
|
712
|
+
"type": "string",
|
|
713
|
+
"optional": false
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
"name": "send",
|
|
717
|
+
"type": "string | { text: string; displayText?: string }",
|
|
718
|
+
"optional": true,
|
|
719
|
+
"doc": "走模型:一句话(或气泡文案与透传文案分开)"
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"name": "invoke",
|
|
723
|
+
"type": "{ id: string; input?: Record<string, unknown> }",
|
|
724
|
+
"optional": true,
|
|
725
|
+
"doc": "走确定性动作:id + 入参"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"name": "confirm",
|
|
729
|
+
"type": "{\n title: string;\n description?: ReactNode;\n confirmText?: string;\n cancelText?: string;\n tone?: 'primary' | 'danger';\n highlights?: string[];\n }",
|
|
730
|
+
"optional": true,
|
|
731
|
+
"doc": "点击前确认(tone/highlights 与 ConfirmSheet 同义:危险操作语气、权益摘要)"
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
"name": "style",
|
|
735
|
+
"type": "'primary' | 'secondary'",
|
|
736
|
+
"optional": true
|
|
737
|
+
}
|
|
738
|
+
]
|
|
739
|
+
}
|
|
740
|
+
]
|
|
741
|
+
},
|
|
613
742
|
{
|
|
614
743
|
"name": "ActionList",
|
|
615
744
|
"propsType": "{ actions: CardActionSpec[]; api: CardActions }",
|
|
@@ -648,9 +777,9 @@
|
|
|
648
777
|
},
|
|
649
778
|
{
|
|
650
779
|
"name": "confirm",
|
|
651
|
-
"type": "{
|
|
780
|
+
"type": "{\n title: string;\n description?: ReactNode;\n confirmText?: string;\n cancelText?: string;\n tone?: 'primary' | 'danger';\n highlights?: string[];\n }",
|
|
652
781
|
"optional": true,
|
|
653
|
-
"doc": "
|
|
782
|
+
"doc": "点击前确认(tone/highlights 与 ConfirmSheet 同义:危险操作语气、权益摘要)"
|
|
654
783
|
},
|
|
655
784
|
{
|
|
656
785
|
"name": "style",
|
|
Binary file
|