diff --git a/app-pages-brainstorm.md b/app-pages-brainstorm.md new file mode 100644 index 0000000..167cb13 --- /dev/null +++ b/app-pages-brainstorm.md @@ -0,0 +1,715 @@ +# 知习 APP 页面整理 + +> 本文档根据头脑风暴内容整理,只记录已讨论的内容,后续逐步扩展。 + +--- + +## 多端定位 + +``` +iPhone:阅读、轻问答、复习、自测、继续上次进度、消息提醒、资料状态查看 +iPad:深度阅读、PDF 标注、手写笔记、分屏学习、资料旁路问答、导图查看和轻编辑 +Mac/Web:知识库管理、批量资料处理、长笔记、结构化整理、完整导图、深度分析、公开知识库管理 +``` + +> iPhone 不追求完整学习工作台,而是围绕资料消费、轻问答、复习、自测和进度恢复做体验。真正的大屏学习、标注、笔记和知识整理放到 iPad/Mac/Web。 + +--- + +## 整体结构 + +``` +知习 APP +├── 登录 +├── 首页(学习) +├── 学习 +│ ├── 复习 +│ ├── 答题测试 +│ └── 消息 +├── 知识库 +│ ├── 创建知识库 +│ ├── 知识库详情 +│ │ └── 知识点预览 +│ └── AI 对话 +├── 分析 +└── 我的 + ├── 个人中心 + └── 设置 +``` + +--- + +## 底部导航 Tab + +| Tab | 说明 | +| --- | --- | +| 首页 | 学习页面 | +| 知识库 | 资料、知识点、问答入口 | +| 分析 | AI 诊断、学习结果 | +| 我的 | 账号、设置、许可、反馈 | + +--- + +## 已有页面 + +### 1. 登录页面 + +**功能模块** + +- Apple 登录(已接入) +- 微信登录(后续) +- 手机号登录(后续) +- Rive 状态机动画 + +> 待继续扩展 + +--- + +### 2. 首页(学习页面) + +**定位**:学习行动面板,回答——我现在该做什么。 + +**主行动优先级**(首页第一屏只强调一个主行动) + +| 优先级 | 条件 | 主卡片 | +| --- | --- | --- | +| 1 | 有未完成学习 | 继续上次学习 | +| 2 | 无未完成、有今日复习 | 今日复习 | +| 3 | 无复习、有新自测 | 资料自测 | +| 4 | 有新资料整理完成 | 开始学习 | +| 5 | 空状态 | 引导去知识库添加资料 | + +**核心模块** + +- **继续上次学习** — 恢复具体学习上下文(回忆做到一半/分析没看完/测验做到一半/复习做到一半),文案带状态,如「你上次停在《数据库事务》的主动回忆,第 4/10 个知识点」 +- **今日复习入口** — 只告知有复习任务和大概时长,不展开卡片列表;复习详情和薄弱点分析分别由复习页、分析页负责 +- **资料自测入口** — 区分于复习(复习=系统安排长期巩固,自测=用户主动即时检测),叫「资料自测」不叫「测验」 +- **本周学习进度摘要** — 本周时长、完成学习次数、完成复习数量、连续学习天数(可选),轻量反馈,→ 查看分析 +- **状态提示** — 轻量 banner:资料整理中/整理失败/整理完成、测验生成中、复习卡生成中 + +**页面布局** + +- 第一屏:顶部轻状态文案 + 主行动卡片 +- 中部:今日复习小卡、资料自测小卡、处理中/新资料完成提示 +- 底部:本周进度摘要 + 查看分析入口 + +**优先级** + +- P0:继续上次学习、今日复习、资料自测、本周进度摘要 +- P1:新资料整理完成提示、处理中/失败状态提示 +- P2:最近完成记录、连续学习天数 + +--- + +### 3. 学习页面 + +**定位**:学习行动中心。主动回忆、AI 诊断、学习结果。 + +> 待扩展 + +--- + +### 复习页面 + +**上级**:学习页面 + +**定位**:今日复习、复习卡、复习结果。从学习页面进入。 + +> 待扩展 + +--- + +### 4. 知识库页面 + +**定位**:内容中心。管理我的知识库、查看已订阅和官方知识库,所有信息服务于下一步学习。 + +**知识库分类**(三类,不混) + +| 分类 | 说明 | +| --- | --- | +| 我的知识库 | 用户自己创建/上传资料生成的 | +| 已订阅知识库 | 订阅了别人公开的知识库 | +| 官方/精选知识库 | 平台发布或平台认证的 | + +用户自己创建的,哪怕公开了也叫「公开知识库」或「个人知识库」,不叫「官方」。 + +**实体字段** + +``` +ownerType: user / official +visibility: private / public / unlisted +relation: owned / subscribed / official +isPinned: true / false +isVerified: true / false +``` + +**页面结构** + +- 顶部:标题「知识库」+ 搜索入口 + 右上角 + +- 筛选 chips:全部 | 我的 | 已订阅 | 官方 +- 列表:置顶区 + 普通列表 +- 交互:下拉刷新、上拉加载 + +**搜索** + +- 列表页顶部保留搜索入口,点击进入独立搜索页 `KnowledgeSearchView` +- 搜索页按范围切换:知识库 / 资料 / 知识点 / 公开知识库 +- 支持作用域:我的内容 / 已订阅 / 官方公开 / 全部 + +**创建知识库** + +- 右上角 +,点击可弹出小菜单:「创建知识库」「上传资料」,或直接进入 `CreateKnowledgeBaseView` + +--- + +**知识库卡片字段** + +- 名称 +- 简介 +- 类型标签:官方 / 已订阅 / 公开 / 私有 +- 资料数量、知识点数量、测验数量 +- 最近学习时间 +- 学习进度 +- 导入状态(整理中/失败/完成) +- 置顶状态 + +卡片要点:不只展示资料状态,要体现「可学习」。 + +**卡片操作**(按类型区分) + +- 我的知识库:重命名、上传资料、公开设置、置顶、删除 +- 已订阅知识库:置顶、取消订阅、查看来源、生成我的学习内容 +- 官方知识库:置顶、开始学习、订阅、查看来源 + +**置顶** + +- 置顶是用户个人行为,只影响自己的列表 +- 置顶区不随分页重复出现 +- 第一版支持置顶/取消置顶,不做多级收藏夹、拖拽排序、分组命名 + +**排序** + +- 默认:置顶优先 → 最近学习 → 最近更新 +- 可提供排序入口:最近学习 / 最近更新 / 创建时间 / 名称 + +**订阅公开知识库**(第一版克制) + +- 支持:展示已订阅、搜索发现公开库、官方精选入口、订阅/取消订阅 +- 暂不做:信息流、创作者主页、评论区、排行榜、付费订阅、二创市场 + +**数据边界** + +- 知识库内容 → 归属原作者 +- 学习记录 → 归属当前用户 +- 复习卡 → 可归属当前用户 +- 测验结果 → 归属当前用户 +- 订阅库 → 只读,不可改原内容 + +**空状态**(分场景) + +- 全部为空:还没有知识库,可上传资料让知习整理成可学习的内容 +- 我的为空:还没有创建自己的知识库 +- 已订阅为空:还没有订阅公开知识库 +- 官方为空:暂时没有官方知识库 + +**状态** + +- 加载中 +- 加载失败 +- 无网络 +- 导入中/失败提示(如「正在整理 2 份资料」「1 份资料导入失败」) + +--- + +**优先级** + +- P0:知识库列表、筛选、搜索入口、创建入口、置顶、下拉刷新、上拉加载、卡片状态展示、空状态/错误状态/加载状态 +- P1:公开知识库发现、订阅/取消订阅、官方精选入口、排序切换、只读提示、导入失败提醒 +- P2:收藏分组、拖拽排序、创作者主页、排行榜、付费订阅、协作知识库 + +--- + +### 4-1. 知识库创建页面 + +**定位**:轻量创建,用户只填名称就能创建成功。 + +**表单字段** + +- 知识库封面:选填,默认已选中系统封面,点击弹出底部抽屉切换 +- 知识库名称:必填,最多 30~40 字,不能全空格,允许同名 +- 知识库描述:选填,最多 200 字 + +**按钮**:创建知识库(名称填写后才可点击) + +**创建成功**:直接进入知识库详情页,展示下一步引导「上传资料后,知习会帮你整理知识点」 + +**创建失败**:展示错误提示,可重试;封面上传失败时提供「先用默认封面创建」降级方案 + +--- + +**封面规则** + +- 比例 1:1,建议 512×512,支持 JPG/PNG/HEIC,大小限制 5~10MB +- 用户选图 → 正方形裁剪 → 上传 +- 数据结构:`coverType: system/custom`,系统封面由 `coverIcon + coverColor` 组合 + +**底部封面抽屉(CoverPickerSheet)** + +- 默认封面:一组图标 + 背景色可选(书本/笔记/代码/考试等) +- 自定义:从相册选择、恢复默认封面 + +--- + +**描述处理** + +- 输入框 placeholder:「例如:整理数据库课程笔记、复习题和考试重点」 +- 用户不填不强制,列表卡片通过 fallback 兜底:「包含 4 份资料,最近添加《数据库事务笔记》」「还没有添加资料」 +- 知识库卡片不依赖描述作为布局必需项 + +--- + +**创建页不放** + +上传资料、选择公开范围、选择协作者、复杂标签——这些不是创建页该承担的功能。创建的知识库默认私有,公开设置后续在详情页加入。 + +--- + +**优先级** + +- P0:名称、系统默认封面、创建按钮、创建成功跳转详情页 +- P1:自定义封面上传裁剪、底部抽屉封面选择器 +- P2:AI 智能描述建议、「帮我生成描述」按钮 + +--- + +### 4-2. 知识库详情页面 + +**定位**:知识库内部的学习内容工作台。看概览、管资料、管知识点、开始学习、问答、自测。 + +--- + +**顶部信息区** + +- 封面、名称、描述(空时 fallback:「还没有描述。上传资料后,知习会根据内容整理知识点」) +- 类型标签:私有/公开/已订阅/官方 +- 资料数、知识点数、测验数、最近学习时间、导入状态 + +**快捷操作区**(仅 owned 知识库显示完整操作) + +- 开始学习 +- 上传资料 +- 资料自测 +- 问资料(ZxIcon(.aiChat),点击进入独立 KnowledgeBaseChatView,默认绑定当前知识库) + +主按钮动态变化:有知识点→开始学习,有资料处理中→查看导入进度,没有资料→上传资料 + +**分区**(分段控件或 chips) + +概览 | 资料 | 知识点 | 测验 | 问答 + +--- + +**知识点列表**(主内容区) + +卡片字段:标题、摘要、所属分类/章节、来源资料、掌握状态、是否已生成复习卡、最近学习时间 + +操作: +- 点击 → 知识点详情页 +- 左滑 → 删除/移动分类 +- 更多 → 编辑/加入复习/开始回忆 +- 右上角选择 → 批量删除/移动分类/生成复习卡/开始学习(P1) + +**新增知识点** + +- 点击 + → 底部抽屉选择入口(手动新增/从资料生成/上传资料生成/批量导入) +- 手动新增进入独立 CreateKnowledgeItemView(标题、内容摘要、所属分类、来源说明、是否生成复习卡) + +--- + +**分类**(不叫「文件夹」) + +- 叫「分类/章节/主题」 +- P0:单层分类(未分类、自定义分类、创建/重命名/删除分类、知识点移动分类) +- P1:二级章节 +- P2:标签系统(#易错 #考试重点 #概念辨析) + +--- + +**资料区** + +- 资料列表、导入状态、进入资料详情、重新处理、删除资料、查看生成的知识点 +- 导入失败明确提示 + +**测验区** + +- 知识库下全部测验,按资料/分类生成 +- 操作:开始测验、重新生成、查看结果 +- 第一版可很轻:「测验 3 个,最近测验:《传输层基础》10 题」 + +**问答区** + +- 最近问答、常用问题建议、问答历史、进入完整问答 +- 不直接塞完整聊天 + +--- + +**问资料入口** + +- 快捷操作区放聊天图标→进入 KnowledgeBaseChatView +- 默认范围=当前知识库,回答必须带引用来源 +- 支持范围切换:整个知识库/当前分类/当前资料/当前知识点 +- 没有检索到来源时提示「当前知识库中没有找到足够相关的内容」 +- 第一版不做跨知识库提问 +- 底部不做常驻可输入聊天框 + +**知识库管理入口** + +- 右上角 ··· → 底部抽屉(编辑信息/分类管理/公开设置/删除知识库) +- 编辑信息、分类管理等具体管理进独立页面 + +--- + +**权限区分**(详情页根据权限变化) + +| 权限 | 可操作 | +| --- | --- | +| owned | 编辑、新增、删除、学习、自测、问答 | +| subscribed | 只读,可学习、复习、自测、问答、取消订阅 | +| official | 只读,可学习、自测、订阅 | + +--- + +**删除知识点** + +- 左滑 → 二次确认 +- 批量删除 → 明确提示数量 +- 删除后关联复习卡失效/归档,不硬删学习记录 + +--- + +**页面拆分策略** + +- 当前页面:概览、资料摘要、知识点列表、分类筛选、左滑删除 +- 底部抽屉:新增入口选择、更多操作菜单、排序筛选、删除确认 +- 独立页面:新增/编辑知识点、知识点详情、知识库管理、分类管理、资料详情、测验列表/过程、知识库问答 + +--- + +**优先级** + +- P0:顶部信息、资料列表、知识点列表、新增/删除知识点、分类筛选、上传/学习/问答入口、知识库管理入口、空/加载/错误状态 +- P1:分类管理、批量操作、测验列表、公开设置、订阅库只读状态、导入失败处理 +- P2:多级分类、标签系统、知识图谱、协作编辑、版本历史 + +--- + +### 知识点预览页面 + +**上级**:知识库详情页面 + +**定位**:移动端轻阅读学习单元,不是完整学习主场。 + +**负责** +- 查看知识点内容 +- 查看引用来源 +- 问这个知识点(进入 AI 对话) +- 加入复习 / 收藏 +- 轻量备注 +- 开始自测 / 开始复习 + +**不负责**(留给 iPad/Mac/Web) +- 长笔记、复杂标注 +- 多窗口对照资料 +- 手写整理、导图编辑 +- 系统化重构知识 + +--- + +### 答题测试页面 + +**上级**:学习页面 + +**定位**:用户答题/自测。从首页、知识库详情页等入口进入。 + +> 待扩展 + +--- + +### AI 对话页面 + +**上级**:知识库页面 + +**定位**:基于知识库/资料/分类的学习问答与产物生成页。不是普通聊天,绑定知识库上下文,回答带引用来源。 + +**页面结构** + +- 顶部:返回、当前范围(知识库名)、会话切换按钮、更多 +- 上下文提示条:「基于「计算机网络」回答」,可切换范围 +- 消息区:用户问题、AI 回答、引用来源、生成中/错误/重试状态 +- 底部输入区:添加文件、输入框、发送按钮、模式按钮(快速/深度/联网) + +**空状态** + +提示示例按范围变化: +- 知识库级:「总结这个知识库的核心内容」「找出最重要的知识点」 +- 资料级:「总结这份资料」「提取关键概念」「根据这份资料生成测验」 +- 知识点级:「解释这个概念」「举一个例子」「找出容易混淆的地方」 + +--- + +**P0 功能** + +- 当前知识库上下文问答 +- 新建/切换/删除会话(删除二次确认,区分:删除会话 ≠ 删除知识库/资料/学习记录) +- AI 提示问题 +- 回答引用来源、复制、分享(分享私有知识库内容需提醒用户确认) +- 保存为笔记(保存到当前知识库) +- 重新生成 +- 文本输入发送 +- 加载/失败/重试状态 + +**P1 功能** + +- 切换提问范围:整个知识库/当前分类/当前资料 +- 添加文件到知识库(区分临时提问 vs 入库资料,P0 先只做到入库) +- 深度思考模式、联网搜索模式(默认关闭,仅知识库回答) +- 生成导图、生成测验、生成复习卡 +- 模型选择(高级设置,普通用户看到「快速/深度/联网」而非模型名) +- 会话重命名/搜索 +- 语音转文字提问 + +**P2 功能** + +- 跨知识库问答 +- 临时文件问答 +- 生成播客脚本/音频播客 +- 上传音频资料转写 +- 多模态图片/视频问答 +- 会话分享链接 +- 协作会话 + +--- + +**AI 回答卡片操作** + +引用来源 | 复制 | 分享 | 保存为笔记 | 重新生成 | 更多(生成导图/生成测验/生成复习卡/反馈) + +**模式切换** + +普通用户:快速 / 深度 / 联网 +高级用户/设置中:具体模型选择 + +- 默认仅知识库回答,联网搜索开启后需区分「知识库引用」和「网络来源」 +- 深度思考提示更慢、消耗更多额度 + +**核心边界** + +第一版收敛为:基于当前知识库提问 → 回答带引用 → 可保存为学习材料 +不堆模型市场、语音通话、播客、多模态、跨库 Agent + +--- + +### 5. 分析页面 + +**定位**:反馈中心。告诉用户学了多少、记住了多少、哪里薄弱、为什么薄弱、下一步该做什么。 + +**核心逻辑链** + +``` +学了多少 → 有没有坚持 → 复习得怎么样 → 答题表现怎么样 +→ 哪些掌握了 → 哪些薄弱 → 为什么薄弱 → 下一步做什么 +``` + +**移动端定位**:随手查看学习反馈,摘要 + 关键趋势 + AI 结论。完整图表和深度分析留给 iPad / Web。 + +--- + +**移动端结构** + +**a. 顶部总览卡片**(3~4 个关键数字) + +- 本周学习时长 +- 累计学习时长 +- 本周复习次数 +- 测验正确率 + +**b. 学习热力图** + +- 近 30 天 / 近 90 天 +- 点击某天显示:当天学习时长、完成知识点、复习卡数、测验数 +- 强度综合计算(学习时长 + 主动回忆次数 + 复习次数 + 测验完成数),第一版可先用学习时长 + +**c. 本周学习趋势**(一个简单折线或柱状图即可) + +**d. 复习表现摘要** + +- 本周复习完成率 +- 到期未复习数量 +- 容易遗忘知识点数量 + +**e. 测验表现摘要** + +- 最近测验正确率 +- 高频错误知识点 Top 3 +- 最近一次测验结果 + +**f. 知识掌握摘要** + +- 掌握较好 / 需要巩固 / 可能遗忘 +- Top 3~5 薄弱知识点 +- 掌握度来源综合:主动回忆表现、复习自评、测验正确率、遗忘间隔、AI 诊断结果 + +**g. AI 综合分析卡片** + +- 本周总结 +- 主要薄弱点 +- 薄弱原因 +- 下一步建议 +- 展示分析依据(如「最近 3 次测验中隔离级别相关题目正确率较低」) +- → 查看详细分析 + +--- + +**知识库维度筛选** + +按知识库切换查看:全部 / 计算机网络 / 数据库 / 操作系统 / 官方 / 订阅 + +每个知识库显示:学习时长、知识点掌握、复习完成、测验表现、薄弱点 + +--- + +**移动端不放** + +复杂知识库对比、多维筛选器、完整错题分析、题型正确率矩阵、复习预测曲线、学习效率评分、知识图谱、月报/年报完整详情、导出报告、排行榜 + +--- + +**iPad / Web 扩展** + +- iPad:左右分栏,左侧总览+热力图+AI 分析,右侧复习+测验+知识库掌握度 +- Web:完整仪表盘,时间范围筛选、知识库筛选、多维图表、导出报告 + +--- + +**优先级** + +- P0:总览卡片、学习热力图、复习摘要、测验摘要、薄弱知识点 Top 5、AI 综合分析 +- P1:记忆状态分布(刚开始学/正在巩固/基本掌握/长期记住/可能遗忘)、复习准时率、高频错误概念、知识库对比、周报/月报、即将遗忘提醒、学习目标 +- P2:考试倒计时计划、预测复习负载、学习效率评分、同类用户对比、排行榜、公开报告分享 + +--- + +### 消息页面 + +**上级**:学习页面 + +**定位**:消息与通知汇总。从「我的页面」消息中心入口进入。 + +> 待扩展 + +--- + +### 6. 我的页面 + +**定位**:个人中心。身份展示 + 学习资产 + 常用入口。 + +**a. 个人信息区** + +- 头像、昵称、邮箱/账号 +- 账号状态 +- 编辑资料入口 +- 右上角设置按钮 + +**b. 学习资产摘要**(轻量,增强「我在这里有资产」的感觉) + +- 知识库数量、资料数量、知识点数量、复习卡数量 +- 点击分别跳转对应页面 + +**c. 常用入口** + +- 消息中心(导入完成/失败、复习提醒、测验生成完成、AI 分析完成、订阅更新、系统通知) +- 存储空间(云端空间、资料文件占用、离线缓存占用、剩余空间) +- 缓存管理(清理图片/文件预览/离线资料/临时上传文件缓存,明确不删云端资料) +- 我的订阅 +- 用量与额度(可选,P1) + +> 退出登录、注销账号、隐私政策、用户协议、开源许可、帮助反馈等低频操作不放首页,统一进设置页。 + +**优先级** + +- P0:个人信息区、学习资产摘要、消息中心、存储空间/缓存管理、设置入口 +- P1:用量与额度、我的订阅 +- P2:成就徽章、学习报告分享 + +--- + +### 5-1. 设置页面 + +**定位**:账号、安全、通知、学习偏好、存储、隐私、反馈、合规的集中管理。从「我的页面」进入。 + +| 分组 | 内容 | +| --- | --- | +| 账号与安全 | 个人资料、绑定邮箱/Apple 登录、登录设备、退出登录、注销账号 | +| 学习偏好 | 每日学习提醒、默认复习时间、复习强度、测验题数偏好、AI 诊断详细程度 | +| 通知设置 | 复习提醒、导入完成、测验生成、订阅更新、系统通知 | +| 数据与存储 | 存储空间、缓存管理、离线内容、数据导出(P1) | +| 隐私与公开 | 公开知识库设置、订阅可见性、学习记录隐私、数据权限说明 | +| 支持与反馈 | 帮助中心、问题反馈、功能建议、联系我们 | +| 关于与合规 | 关于知习、用户协议、隐私政策、开源许可、第三方资源署名、版本号 | + +**优先级** + +- P0:账号与安全、通知设置、数据与存储、隐私与公开、支持与反馈、关于与合规 +- P1:学习偏好、数据导出、登录设备管理 +- P2:注销账号 + +--- + +### 6-2. 个人中心页面(编辑资料) + +**定位**:只修改用户在知习内展示的个人身份信息。不承担账号安全、注销、隐私协议等。 + +--- + +**P0 字段** + +- 头像(圆形,1:1,支持 JPG/PNG/HEIC,≤5MB,点击→底部抽屉选择默认头像/从相册选择/恢复默认) +- 昵称(必填,最多 20 中文/30 英文,允许中英文数字常见符号) +- 个人简介(选填,最多 80~120 字,不填不展示简介区域) + +**邮箱**:展示但不可修改,→ 前往账号与安全修改 + +--- + +**页面交互** + +- 右上角保存,或底部固定保存按钮 +- 未修改→保存置灰,修改后→可点击,保存中→loading,成功→toast,失败→错误可重试 +- 离开时有未保存内容→提示确认 + +**头像底部抽屉** + +- 选择默认头像(一组可选,不要只有一个)+ 从相册选择(进裁剪固定 1:1)+ 恢复默认头像 + +--- + +**不放** + +性别、生日、学校、职业、地区、手机号、真实姓名、学习目标(放学习偏好)、隐私设置、账号注销、退出登录 + +--- + +**优先级** + +- P0:头像、昵称、个人简介、保存 +- P1:@handle/知习号、公开主页预览、默认头像库 +- P2:创作者主页资料、社交链接、公开知识库作者认证 + +--- + +### 6-1. 设置页面 + +## 待补充 + +> 以下内容待你逐个说明后补充。 + diff --git a/技术设计/DESIGN.md b/技术设计/DESIGN.md new file mode 100644 index 0000000..8e8351e --- /dev/null +++ b/技术设计/DESIGN.md @@ -0,0 +1,1192 @@ +--- +name: 知习 AI Design System +version: 2.0 +description: > + 知习 AI — AI 驱动的知识学习平台。设计语言融合 Notion 的温润极简、Linear 的精准克制 + 与 Apple 的质感表达,定位为"温润而聪慧"。全 Token 机器可读,AI 代理可直接引用。 +platforms: iOS 18+ / iPadOS 18+ (优先), Web / Android 后续对齐 +--- + +# 知习 AI 设计系统 v2.0 + +## Overview + +知习 AI 是一款 AI 驱动的知识学习平台,覆盖**知识导入 → AI 分析 → 主动回忆 → 间隔复习**全链路。 +设计系统以机器可读的 Token 为核心,每个组件通过 `{section.token}` 交叉引用, +AI 编程代理无需"理解文意"即可精确还原 UI。 + +**设计基因**: + +| 参考 | 采纳点 | 刻意不采纳 | +|------|--------|-----------| +| Notion | 暖白底色、中性色分层、卡片圆角、非胶囊按钮 | 深海军蓝 Hero(学习场景忌压抑) | +| Linear | 单主色克制、极致留白、精准字间距 | 纯黑底色(学习需要明亮感) | +| Apple (HIG) | SF Pro 全系、SF Symbols、Dynamic Type、Haptics | 灰度按钮(学习场景需要明确的 CTA 色) | + +--- + +## Colors + +colors: + # ── 品牌主色 ── + primary: "#5B5FED" + primary-pressed: "#4A4ECC" + primary-deep: "#3B3EA8" + primary-soft: "#EEEDFC" + on-primary: "#FFFFFF" + primary-gradient-start: "#5B5FED" + primary-gradient-end: "#7B6FF0" + + # ── 功能色 ── + accent-amber: "#F59E0B" + accent-amber-soft: "#FEF3C7" + accent-amber-deep: "#92400E" + accent-coral: "#F87171" + accent-coral-soft: "#FEE2E2" + accent-coral-deep: "#991B1B" + accent-mint: "#34D399" + accent-mint-soft: "#D1FAE5" + accent-mint-deep: "#065F46" + accent-sky: "#60A5FA" + accent-sky-soft: "#DBEAFE" + accent-sky-deep: "#1E40AF" + + # ── 中性色(暖灰体系) ── + canvas: "#FAFAF8" + canvas-dark: "#1C1C1E" + surface: "#F3F2F0" + surface-dark: "#2C2C2E" + surface-soft: "#FAFAF9" + surface-soft-dark: "#242426" + surface-elevated: "#FFFFFF" + surface-elevated-dark: "#3A3A3C" + hairline: "#E8E6E1" + hairline-dark: "#38383A" + hairline-soft: "#F0EEE9" + hairline-soft-dark: "#303032" + hairline-strong: "#D4D1CB" + hairline-strong-dark: "#48484A" + ink-primary: "#1E1B18" + ink-primary-dark: "#FFFFFF" + ink-secondary: "#6B6560" + ink-secondary-dark: "#A1A1A6" + ink-tertiary: "#9F9993" + ink-tertiary-dark: "#636366" + ink-inverse: "#FFFFFF" + ink-inverse-dark: "#1E1B18" + on-dark: "#FFFFFF" + on-dark-muted: "#8E8E93" + + # ── 知识库分类色(参考 Notion 数据库属性色) ── + kb-blue-bg: "#E8F0FE" + kb-blue-fg: "#1967D2" + kb-green-bg: "#E6F4EA" + kb-green-fg: "#137333" + kb-purple-bg: "#F1E8FD" + kb-purple-fg: "#7627BF" + kb-amber-bg: "#FEF7E0" + kb-amber-fg: "#B06000" + kb-rose-bg: "#FDE8EC" + kb-rose-fg: "#B81C3C" + +--- + +## Typography + +typography: + # ── 字体族 ── + font-display: "SF Pro Display, -apple-system, system-ui, sans-serif" + font-text: "SF Pro Text, -apple-system, system-ui, sans-serif" + font-mono: "SF Mono, Menlo, monospace" + + # ── 字号层级 ── + hero: + fontFamily: "{typography.font-display}" + fontSize: 34pt + fontWeight: 700 + lineHeight: 1.12 + letterSpacing: -0.5pt + dynamicTypeStyle: largeTitle + use: 页面大标题(如"我的知识库") + + title-1: + fontFamily: "{typography.font-display}" + fontSize: 28pt + fontWeight: 700 + lineHeight: 1.18 + letterSpacing: -0.3pt + dynamicTypeStyle: title1 + use: 页面标题 + + title-2: + fontFamily: "{typography.font-display}" + fontSize: 22pt + fontWeight: 600 + lineHeight: 1.22 + letterSpacing: -0.2pt + dynamicTypeStyle: title2 + use: 区块标题、卡片标题 + + title-3: + fontFamily: "{typography.font-display}" + fontSize: 20pt + fontWeight: 600 + lineHeight: 1.25 + letterSpacing: -0.1pt + dynamicTypeStyle: title3 + use: 列表项标题、KB 卡片名称 + + headline: + fontFamily: "{typography.font-text}" + fontSize: 17pt + fontWeight: 600 + lineHeight: 1.29 + letterSpacing: 0 + dynamicTypeStyle: headline + use: 段落小标题、Sheet 标题 + + body: + fontFamily: "{typography.font-text}" + fontSize: 17pt + fontWeight: 400 + lineHeight: 1.47 + letterSpacing: 0 + dynamicTypeStyle: body + use: 正文、知识点内容、AI 回复正文 + + body-medium: + fontFamily: "{typography.font-text}" + fontSize: 17pt + fontWeight: 500 + lineHeight: 1.47 + letterSpacing: 0 + dynamicTypeStyle: body + use: 列表行主标题(需要比 body 更突出) + + body-sm: + fontFamily: "{typography.font-text}" + fontSize: 15pt + fontWeight: 400 + lineHeight: 1.47 + letterSpacing: 0 + dynamicTypeStyle: subheadline + use: 辅助说明、卡片描述、副标题 + + body-sm-medium: + fontFamily: "{typography.font-text}" + fontSize: 15pt + fontWeight: 500 + lineHeight: 1.47 + letterSpacing: 0 + dynamicTypeStyle: subheadline + use: Section Header 右侧"查看全部" + + callout: + fontFamily: "{typography.font-text}" + fontSize: 14pt + fontWeight: 500 + lineHeight: 1.43 + letterSpacing: 0 + dynamicTypeStyle: callout + use: 按钮文字、Tab 标签、Pill 标签 + + caption: + fontFamily: "{typography.font-text}" + fontSize: 13pt + fontWeight: 400 + lineHeight: 1.38 + letterSpacing: 0 + dynamicTypeStyle: caption1 + use: 时间戳、元信息、输入框辅助文字 + + caption-bold: + fontFamily: "{typography.font-text}" + fontSize: 13pt + fontWeight: 600 + lineHeight: 1.38 + letterSpacing: 0 + dynamicTypeStyle: caption1 + use: 徽章文字、强调标签 + + caption-2: + fontFamily: "{typography.font-text}" + fontSize: 11pt + fontWeight: 500 + lineHeight: 1.36 + letterSpacing: 0.5pt + dynamicTypeStyle: caption2 + use: Tab Bar 文字、微小标签、角标数字 + + micro-caps: + fontFamily: "{typography.font-text}" + fontSize: 10pt + fontWeight: 600 + lineHeight: 1.30 + letterSpacing: 1.2pt + dynamicTypeStyle: caption2 + use: 全大写标签(如"NEW""PRO") + + nav-title: + fontFamily: "{typography.font-text}" + fontSize: 17pt + fontWeight: 600 + lineHeight: 1.29 + letterSpacing: 0 + dynamicTypeStyle: headline + use: 导航栏居中标题 + +--- + +## Rounded + +rounded: + none: 0pt + xs: 4pt + sm: 6pt + md: 10pt + lg: 14pt + xl: 20pt + xxl: 24pt + full: 9999pt + +### Border Radius Usage + +| Token | Value | Use | +|-------|-------|-----| +| `{rounded.xs}` | 4pt | Tag chips, small inline badges | +| `{rounded.sm}` | 6pt | Badge backgrounds, color swatches | +| `{rounded.md}` | 10pt | Buttons (NOT pills), inputs, list thumbnails | +| `{rounded.lg}` | 14pt | Cards, panels, sheets | +| `{rounded.xl}` | 20pt | KB cover cards, modals | +| `{rounded.xxl}` | 24pt | Large feature cards | +| `{rounded.full}` | 9999pt | Avatars, progress rings, pill-shaped filter chips | + +--- + +## Spacing + +spacing: + xxs: 4pt + xs: 8pt + sm: 12pt + md: 16pt + lg: 20pt + xl: 24pt + xxl: 32pt + xxxl: 40pt + section: 48pt + section-lg: 64pt + hero: 80pt + +### Page Margin + +| Context | Horizontal | Vertical | +|---------|-----------|----------| +| pageMargin-h: 20pt | Main content area | — | +| pageMargin-card: 16pt | Inside cards | 16pt | +| pageMargin-sheet: 24pt | Sheet / modal | 20pt | +| pageMargin-listLeading: 20pt | List row without icon | — | +| pageMargin-listLeadingWithIcon: 68pt | List row with 40pt icon | — | +| pageMargin-listTrailing: 16pt | List row right edge | — | + +### Grid + +- **iPhone**: Single column, 640pt max content width +- **iPad portrait**: Single column, 640pt max +- **iPad landscape**: KB grid 3 columns, 12pt gutter; lists max 720pt +- **Column gap** (KB grid): `{spacing.sm}` (12pt) + +--- + +## Depth & Elevation + +elevation: + level-0: + shadow: none + use: 列表、正文区、无边框卡片 + level-1: + shadow: "0 1px 3px rgba(0,0,0,0.06)" + use: 标准卡片、Section 面板 + level-2: + shadow: "0 4px 12px rgba(0,0,0,0.08)" + use: 长按浮起、下拉菜单、Context Menu + level-3: + shadow: "0 -4px 20px rgba(0,0,0,0.10)" + use: Sheet/弹窗、Modal + +### Dark Mode Elevation + +In dark mode, shadows are invisible. Use **brightness steps** instead: +- `level-1`: surface raised 1 step above canvas +- `level-2`: surface raised 2 steps +- `level-3`: surface raised 3 steps + 0.5pt `{colors.hairline-dark}` border + +--- + +## Components + +### 7.1 Button + +button-primary: + backgroundColor: "{colors.primary}" + textColor: "{colors.on-primary}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 50pt + paddingH: 24pt + minimumAccessibleSize: 44x44pt + +button-primary-pressed: + backgroundColor: "{colors.primary-pressed}" + textColor: "{colors.on-primary}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + transform: scale(0.97) + +button-primary-disabled: + backgroundColor: "{colors.hairline}" + textColor: "{colors.ink-tertiary}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 50pt + +button-secondary: + backgroundColor: transparent + textColor: "{colors.ink-primary}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 50pt + paddingH: 24pt + border: "1.5pt solid {colors.hairline-strong}" + +button-secondary-pressed: + backgroundColor: "{colors.surface}" + textColor: "{colors.ink-primary}" + border: "1.5pt solid {colors.hairline-strong}" + transform: scale(0.97) + +button-tertiary: + backgroundColor: transparent + textColor: "{colors.primary}" + typography: "{typography.callout}" + height: 44pt + paddingH: 0 + border: none + +button-tertiary-pressed: + textColor: "{colors.primary-pressed}" + +button-icon: + backgroundColor: transparent + tintColor: "{colors.ink-secondary}" + size: 44x44pt + symbolConfig: "pointSize:22, weight:regular" + +button-icon-pressed: + tintColor: "{colors.primary}" + transform: scale(0.92) + +button-pill: + backgroundColor: "{colors.surface}" + textColor: "{colors.ink-secondary}" + typography: "{typography.callout}" + rounded: "{rounded.full}" + height: 34pt + paddingH: 16pt + +button-pill-selected: + backgroundColor: "{colors.primary-soft}" + textColor: "{colors.primary}" + typography: "{typography.callout}" + +button-destructive: + backgroundColor: "{colors.accent-coral}" + textColor: "{colors.on-primary}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 50pt + +### 7.2 Input + +text-input: + backgroundColor: "{colors.surface-elevated}" + textColor: "{colors.ink-primary}" + placeholderColor: "{colors.ink-tertiary}" + typography: "{typography.body}" + rounded: "{rounded.md}" + height: 50pt + paddingH: "{spacing.md}" + border: "1pt solid {colors.hairline-strong}" + +text-input-focused: + backgroundColor: "{colors.surface-elevated}" + border: "2pt solid {colors.primary}" + outerGlow: "0 0 0 3pt {colors.primary-soft}" + +text-input-error: + border: "2pt solid {colors.accent-coral}" + outerGlow: "0 0 0 3pt {colors.accent-coral-soft}" + +text-input-disabled: + backgroundColor: "{colors.surface}" + textColor: "{colors.ink-tertiary}" + border: "1pt solid {colors.hairline}" + +search-bar: + backgroundColor: "{colors.surface}" + textColor: "{colors.ink-primary}" + placeholderColor: "{colors.ink-tertiary}" + typography: "{typography.body}" + rounded: "{rounded.md}" + height: 40pt + paddingH: "{spacing.sm}" + icon: "magnifyingglass" + iconColor: "{colors.ink-tertiary}" + +### 7.3 Card + +card-base: + backgroundColor: "{colors.surface-elevated}" + rounded: "{rounded.lg}" + padding: "{spacing.md}" + border: "0.5pt solid {colors.hairline}" + elevation: "{elevation.level-1}" + +card-kb-cover: + width: flexible (grid column) + rounded: "{rounded.xl}" + topColorArea: + height: 120pt + backgroundColor: one of "{colors.kb-*-bg}" + infoArea: + height: 56pt + backgroundColor: "{colors.surface-elevated}" + padding: "{spacing.sm} {spacing.md}" + icon: + sfSymbol: "books.vertical.fill" + size: 64pt + color: matching "{colors.kb-*-fg}" + position: centered in topColorArea + title: + typography: "{typography.title-3}" + textColor: "{colors.ink-primary}" + subtitle: + typography: "{typography.caption}" + textColor: "{colors.ink-tertiary}" + +card-stat: + width: ~148pt (flexible) + backgroundColor: "{colors.surface-elevated}" + rounded: "{rounded.lg}" + padding: "{spacing.md}" + elevation: "{elevation.level-1}" + value: + typography: "{typography.title-1}" + textColor: "{colors.primary}" + label: + typography: "{typography.caption}" + textColor: "{colors.ink-tertiary}" + +card-chat-bubble-user: + backgroundColor: "{colors.primary}" + textColor: "{colors.on-primary}" + typography: "{typography.body}" + rounded: "{rounded.lg}" + padding: "{spacing.sm} {spacing.md}" + maxWidth: 75% of container + alignment: trailing + +card-chat-bubble-ai: + backgroundColor: "{colors.surface}" + textColor: "{colors.ink-primary}" + typography: "{typography.body}" + rounded: "{rounded.lg}" + padding: "{spacing.sm} {spacing.md}" + maxWidth: 85% of container + alignment: leading + +card-review-face: + backgroundColor: "{colors.surface-elevated}" + rounded: "{rounded.lg}" + padding: "{spacing.xl}" + elevation: "{elevation.level-1}" + frontText: + typography: "{typography.body}" + textColor: "{colors.ink-primary}" + backText: + typography: "{typography.body}" + textColor: "{colors.ink-secondary}" + +### 7.4 Navigation + +tab-bar: + backgroundColor: "{colors.surface-elevated}" + topBorder: "0.5pt solid {colors.hairline}" + height: 49pt + safeAreaBottom + items: 5 (学习 / 知识库 / AI / 分析 / 我的) + +tab-bar-item-selected: + icon: fill variant + iconColor: "{colors.primary}" + textColor: "{colors.primary}" + typography: "{typography.caption-2}" + animation: spring(damping=0.7, duration=250ms) + +tab-bar-item-unselected: + icon: outline variant + iconColor: "{colors.ink-tertiary}" + textColor: "{colors.ink-tertiary}" + typography: "{typography.caption-2}" + +tab-bar-badge: + backgroundColor: "{colors.accent-coral}" + textColor: "{colors.on-primary}" + typography: "{typography.caption-2}" + size: 18pt diameter + position: top-right of icon + +navigation-bar-large: + titleTypography: "{typography.hero}" + titleColor: "{colors.ink-primary}" + titleAlignment: leading + collapseBehavior: "scrolls up into standard nav-bar" + +navigation-bar-standard: + backgroundColor: "{colors.canvas} @ 0.85 opacity + blur" + titleTypography: "{typography.nav-title}" + titleColor: "{colors.ink-primary}" + titleAlignment: center + backButton: system default chevron (DO NOT customize text or icon) + trailingButtons: + tintColor: "{colors.primary}" + symbolConfig: "pointSize:22, weight:regular" + +section-header: + leadingText: + typography: "{typography.body-sm-medium}" + textColor: "{colors.ink-secondary}" + trailingLink: + typography: "{typography.body-sm-medium}" + textColor: "{colors.primary}" + text: "查看全部" + padding: "{spacing.lg} {pageMargin-h} {spacing.sm}" + +segmented-control: + backgroundColor: "{colors.surface}" + rounded: "{rounded.md}" + height: 36pt + +segmented-control-selected: + backgroundColor: "{colors.surface-elevated}" + textColor: "{colors.ink-primary}" + typography: "{typography.callout}" + elevation: "{elevation.level-1}" + +segmented-control-unselected: + backgroundColor: transparent + textColor: "{colors.ink-tertiary}" + typography: "{typography.callout}" + +### 7.5 List Row + +list-row-standard: + height: 52pt + backgroundColor: "{colors.surface-elevated}" + separatorColor: "{colors.hairline}" + separatorInset: "{pageMargin-h}" + +list-row-with-thumbnail: + height: 64pt + thumbnail: + size: 40x40pt + rounded: "{rounded.sm}" + position: leading, centered vertically + separatorInset: "{pageMargin-listLeadingWithIcon}" + +list-row-title: + typography: "{typography.body-medium}" + textColor: "{colors.ink-primary}" + maxLines: 1 + +list-row-subtitle: + typography: "{typography.body-sm}" + textColor: "{colors.ink-secondary}" + maxLines: 1 + +list-row-trailing: + typography: "{typography.caption}" + textColor: "{colors.ink-tertiary}" + accessory: chevron.right SF Symbol, 14pt + +### 7.6 Badge & Tag + +badge-review: + backgroundColor: "{colors.accent-amber-soft}" + textColor: "{colors.accent-amber-deep}" + typography: "{typography.caption-bold}" + rounded: "{rounded.xs}" + padding: "3pt 8pt" + text: "需复习" + +badge-mastered: + backgroundColor: "{colors.accent-mint-soft}" + textColor: "{colors.accent-mint-deep}" + typography: "{typography.caption-bold}" + rounded: "{rounded.xs}" + padding: "3pt 8pt" + text: "已掌握" + +badge-ai: + backgroundColor: "{colors.primary-soft}" + textColor: "{colors.primary}" + typography: "{typography.caption-bold}" + rounded: "{rounded.xs}" + padding: "3pt 8pt" + text: "AI 推荐" + +badge-new: + backgroundColor: "{colors.accent-coral-soft}" + textColor: "{colors.accent-coral-deep}" + typography: "{typography.micro-caps}" + rounded: "{rounded.xs}" + padding: "2pt 6pt" + text: "NEW" + +### 7.7 Progress + +progress-bar: + trackColor: "{colors.hairline}" + trackHeight: 6pt + trackRounded: 3pt + fillColor: "{colors.primary}" + fillRounded: 3pt + animation: 600ms ease-out on width change + +progress-bar-amber: + fillColor: "{colors.accent-amber}" + +progress-bar-mint: + fillColor: "{colors.accent-mint}" + +progress-ring: + size: 80pt diameter + trackColor: "{colors.hairline}" + trackWidth: 6pt + fillColor: "{colors.primary}" + fillWidth: 6pt + centerText: + typography: "{typography.title-2}" + textColor: "{colors.ink-primary}" + animation: 800ms ease-out on strokeEnd + +### 7.8 Toggle / Switch + +toggle-on: + trackColor: "{colors.primary}" + thumbColor: "{colors.on-primary}" + +toggle-off: + trackColor: "{colors.hairline-strong}" + thumbColor: "{colors.surface-elevated}" + +### 7.9 Action Sheet + +action-sheet: + backgroundColor: "{colors.surface-elevated}" + rounded: "{rounded.lg}" + titleTypography: "{typography.headline}" + destructiveButton: + textColor: "{colors.accent-coral}" + cancelButton: + textColor: "{colors.ink-primary}" + fontWeight: 600 + +### 7.10 Toast / Banner + +toast: + backgroundColor: "{colors.ink-primary}" + textColor: "{colors.on-dark}" + typography: "{typography.body-sm}" + rounded: "{rounded.md}" + padding: "{spacing.sm} {spacing.md}" + position: bottom of safe area + 16pt + animation: slide up 300ms spring, auto-dismiss 3s + icon: optional leading SF Symbol 16pt + +### 7.11 Skeleton + +skeleton: + backgroundColor: "{colors.hairline}" + rounded: "{rounded.md}" + animation: pulse 1.5s ease-in-out infinite + brightnessRange: 0.6 — 1.0 + +### 7.12 Rating Button Group (复习评分) + +rating-group: + layout: horizontal, equal width + spacing: "{spacing.sm}" + paddingH: "{pageMargin-h}" + +rating-button-again: + backgroundColor: "{colors.accent-coral-soft}" + textColor: "{colors.accent-coral-deep}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 48pt + icon: "arrow.counterclockwise" + label: "再来一次" + +rating-button-hard: + backgroundColor: "{colors.accent-amber-soft}" + textColor: "{colors.accent-amber-deep}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 48pt + icon: "hand.thumbsup" + label: "有些难" + +rating-button-good: + backgroundColor: "{colors.accent-mint-soft}" + textColor: "{colors.accent-mint-deep}" + typography: "{typography.callout}" + rounded: "{rounded.md}" + height: 48pt + icon: "hand.thumbsup.fill" + label: "记住了" + +### 7.13 Empty State + +empty-state: + layout: centered vertically & horizontally + icon: + sfSymbol: "tray" (or "sparkles" for AI, "chart.bar" for Analysis) + size: 48pt + color: "{colors.ink-tertiary}" + title: + typography: "{typography.body}" + textColor: "{colors.ink-secondary}" + description: + typography: "{typography.body-sm}" + textColor: "{colors.ink-tertiary}" + maxLines: 2 + action: + component: "{components.button-secondary}" + marginTop: "{spacing.md}" + +### 7.14 Error State + +error-state: + extends: "{components.empty-state}" + icon: + sfSymbol: "wifi.slash" + action: + text: "重试" + component: "{components.button-tertiary}" + +--- + +## Animation + +animation: + # 默认过渡 + default-duration: 200ms + default-curve: ease-out + + # 页面导航 + push-duration: 300ms + push-curve: ease-out + pop-duration: 250ms + pop-curve: ease-in + + # Sheet + sheet-present-duration: 350ms + sheet-present-curve: "spring(damping=0.85, response=0.35)" + sheet-dismiss-duration: 250ms + sheet-dismiss-curve: ease-in + + # 按压反馈 + press-scale: 0.97 + press-duration: 150ms + press-curve: ease-out + + # Tab 图标 + tab-select-duration: 250ms + tab-select-curve: "spring(damping=0.7, response=0.3)" + + # AI 内容生成 + ai-reveal-duration: 400ms + ai-reveal-curve: ease-out + ai-reveal-effect: "opacity 0→1 + translateY 8pt→0" + + # AI 思考指示器 + ai-thinking-dot-size: 6pt + ai-thinking-dot-spacing: 6pt + ai-thinking-dot-color: "{colors.primary}" + ai-thinking-scale-sequence: "1.0 → 1.4 → 1.0" + ai-thinking-interval: 200ms + ai-thinking-label: "AI 正在思考…" + ai-thinking-label-typography: "{typography.body-sm}" + ai-thinking-label-color: "{colors.ink-tertiary}" + + # 消息气泡 + chat-bubble-ai-duration: 400ms + chat-bubble-ai-effect: "opacity + translateY 8pt" + chat-bubble-user-duration: 200ms + chat-bubble-user-effect: "opacity + translateY 4pt" + + # 列表入场 + list-stagger-duration: 300ms + list-stagger-delay: 50ms + list-stagger-effect: "opacity + translateY 20pt→0" + + # 进度 + progress-fill-duration: 600ms + progress-ring-fill-duration: 800ms + + # 复习卡片翻转 + card-flip-duration: 400ms + card-flip-curve: ease-in-out + card-flip-effect: "3D perspective rotateY(180deg)" + + # 禁止的动画 + forbidden: + - "打字机逐字动画(AI 回复用整段渐现)" + - "无限弹跳循环" + - "旋转加载指示器(使用系统 UIActivityIndicator)" + - "百叶窗/翻页切换" + - "自动轮播 onboarding" + +--- + +## Haptics + +haptics: + light: + iOS: "UIImpactFeedbackGenerator(style: .light)" + use: 按钮点击、Tab 切换、列表选择 + medium: + iOS: "UIImpactFeedbackGenerator(style: .medium)" + use: 刷新完成、AI 回答到达、Sheet 弹出 + heavy: + iOS: "UIImpactFeedbackGenerator(style: .heavy)" + use: 学习成就达成、连续打卡里程碑、卡片翻面 + selection: + iOS: "UISelectionFeedbackGenerator()" + use: Picker 滚动、滑块拖动 + notification-error: + iOS: "UINotificationFeedbackGenerator(.error)" + use: 操作失败、网络错误 + notification-success: + iOS: "UINotificationFeedbackGenerator(.success)" + use: 导入完成、知识点已掌握 + +--- + +## Icons + +icons: + source: "SF Symbols 6.0+ (iOS 18 minimum)" + rendering: "hierarchical (outline default, fill on selected)" + sizes: + tabBar: 25pt + navigationBar: 22pt + listRow: 20pt + kb-cover: 64pt + emptyState: 48pt + toast: 16pt + badge: 12pt + + # 语义映射 + symbol-knowledgeBase: "books.vertical" + symbol-ai: "sparkles" + symbol-study: "brain.head.profile" + symbol-analysis: "chart.bar" + symbol-profile: "person.crop.circle" + symbol-search: "magnifyingglass" + symbol-add: "plus" + symbol-close: "xmark" + symbol-chevron: "chevron.right" + symbol-check: "checkmark.circle.fill" + symbol-warning: "exclamationmark.triangle" + symbol-error: "wifi.slash" + symbol-empty: "tray" + symbol-review: "arrow.triangle.2.circlepath" + symbol-notification: "bell" + symbol-settings: "gearshape" + symbol-feedback: "pencil.and.scribble" + symbol-goal: "target" + symbol-time: "clock" + symbol-streak: "flame" + symbol-mastery: "star.circle.fill" + +--- + +## Layout Patterns + +### 5-Tab Structure + +``` +┌──────────┬──────────┬──────────┬──────────┬──────────┐ +│ 学习 │ 知识库 │ AI │ 分析 │ 我的 │ +└──────────┴──────────┴──────────┴──────────┴──────────┘ +``` + +### StudyHome (学习) Layout + +``` +┌──────────────────────────────────┐ +│ NavBar large: "学习" │ +│ ┌──────────────────────────────┐│ +│ │ card-stat-group ││ ← 今日进度环 + 数据(掌握 12 · 待复习 4) +│ └──────────────────────────────┘│ +│ ┌──────────────────────────────┐│ +│ │ list-row: "继续学习" → ││ ← 上次会话快捷入口 +│ └──────────────────────────────┘│ +│ section-header: "今日推荐" → │ +│ [card][card][card] 水平滚动 │ ← 推荐知识点 +│ section-header: "复习队列" │ +│ list-row × N (含 badge-review) │ +└──────────────────────────────────┘ +``` + +### LibraryHome (知识库) Layout + +``` +┌──────────────────────────────────┐ +│ NavBar large: "知识库" │ +│ search-bar │ +│ ┌──────────┐ ┌──────────┐ │ +│ │ card-kb │ │ card-kb │ │ ← 2 列网格 +│ └──────────┘ └──────────┘ │ +│ ┌──────────┐ ┌──────────┐ │ +│ │ card-kb │ │ + 新建立 │ │ +│ └──────────┘ └──────────┘ │ +└──────────────────────────────────┘ +``` + +### AiHome (AI) Layout + +``` +┌──────────────────────────────────┐ +│ NavBar large: "AI" + sparkles │ +│ ┌──────────────────────────────┐│ +│ │ ✨ 大图标 ││ +│ │ 今天想学什么? ││ +│ │ 我可以帮你解释、出题、分析… ││ +│ └──────────────────────────────┘│ +│ section-header: "建议" │ +│ card × 3 (建议问题,点击即对话) │ +│ ── fixed bottom ── │ +│ text-input + mic icon │ +└──────────────────────────────────┘ +``` + +### AnalysisHome (分析) Layout + +``` +┌──────────────────────────────────┐ +│ NavBar large: "学习分析" │ +│ ┌──────────────────────────────┐│ +│ │ 本周学习时长 · 柱状图 ││ +│ └──────────────────────────────┘│ +│ card-stat card-stat +│ ┌──────┐ ┌──────┐ │ +│ │ 78% │ │ 5天 │ │ +│ │掌握率 │ │连续 │ │ +│ └──────┘ └──────┘ │ +│ section-header: "AI 学习建议" │ +│ card: AI 分析建议文 │ +└──────────────────────────────────┘ +``` + +### Profile (我的) Layout + +``` +┌──────────────────────────────────┐ +│ ┌──────────────────────────────┐│ +│ │ ● 头像 64pt ││ +│ │ 昵称 · 学习方向 ││ +│ └──────────────────────────────┘│ +│ list-row: 学习偏好 → │ +│ list-row: 目标设定 → │ +│ list-row: 通知管理 → │ +│ list-row: 意见反馈 → │ +│ list-row: 设置 → │ +└──────────────────────────────────┘ +``` + +--- + +## Interaction + +### Gestures + +| Gesture | Context | Feedback | +|---------|---------|----------| +| Swipe left | List row: delete / archive | Red action button reveals | +| Long press | KB card: context menu | `{haptics.medium}` + card elevated to `{elevation.level-2}` | +| Pull down | List / home: refresh | System spinner + data reload | +| Edge swipe right | Any pushed page: back | System default edge gesture | +| Double tap | Review card: flip | `{animation.card-flip}` + `{haptics.heavy}` | + +### Keyboard (iPad) + +- **Focus ring**: `{colors.primary}` 2pt outline with `{colors.primary-soft}` outer glow +- **Tab order**: logical reading order (top→bottom, left→right) +- **⌘K**: Global search / command palette (if implemented) + +--- + +## Page ↔ Component Mapping + +| iOS Page | Layout Pattern | Key Components | +|----------|---------------|----------------| +| AIHomeView | Hero + suggestion list | `card-base`, `section-header`, `text-input` | +| AIChatPage | Message stream | `card-chat-bubble-user`, `card-chat-bubble-ai`, `ai-thinking` | +| ActiveRecallView | Q&A card | `card-review-face`, `text-input`, `progress-bar` | +| RecallTestPage | Full-screen test | `progress-bar`, `button-primary`, timer (monospaced) | +| DailyThinkingPage | Dated list | `list-row-standard` with date grouping | +| WeakPointsPage | Item list | `list-row-standard`, `badge-review` / `badge-ai` | +| AIFeedbackPageView | Analysis cards | `card-base`, `badge-ai` | +| LibraryHomeView | 2-col grid + search | `card-kb-cover`, `search-bar` | +| LibrarySubpages | List / detail | `list-row-with-thumbnail`, `card-base` | +| StudyHomeView | Hero + horizontal scroll | `progress-ring`, `card-stat`, `card-base` | +| LearningSessionView | Immersive learning | `card-review-face`, `progress-bar` | +| ReviewCardView | Flashcard flip | `card-review-face`, `rating-group` | +| AnalysisHomeView | Charts + stats | `progress-ring`, `card-stat`, `card-base` | +| ProfileView | Static list | `list-row-standard`, avatar | +| EditProfilePage | Form | `text-input`, avatar, `button-primary` | +| SettingsView | List with toggles | `list-row-standard`, `toggle` | +| NotificationListView | Dated list | `list-row-standard`, `badge-new` | +| GoalSettingDetailView | Form + list | `text-input`, `card-stat`, `progress-bar` | +| MethodPreferenceView | Multi-select list | `list-row-standard` with checkmark | +| FeedbackFormView | Form | `text-input` (multiline), `button-primary` | + +--- + +## Dark Mode + +dark-mode: + strategy: "system follows user preference (automatic)" + mapping: + canvas: "{colors.canvas-dark}" + surface: "{colors.surface-dark}" + surface-soft: "{colors.surface-soft-dark}" + surface-elevated: "{colors.surface-elevated-dark}" + hairline: "{colors.hairline-dark}" + hairline-soft: "{colors.hairline-soft-dark}" + hairline-strong: "{colors.hairline-strong-dark}" + ink-primary: "{colors.ink-primary-dark}" + ink-secondary: "{colors.ink-secondary-dark}" + ink-tertiary: "{colors.ink-tertiary-dark}" + elevation: + # Shadows invisible in dark mode; use brightness steps + level-1: surface raised 1 step above canvas + level-2: surface raised 2 steps + level-3: surface raised 3 steps + 0.5pt border hairline-dark + accentBehavior: + # Functional colors keep same hue, slightly desaturated for dark + primary: unchanged (has enough contrast on dark surfaces) + kb-colors: use bg variants at 50% opacity + +--- + +## Responsive Behavior + +responsive: + breakpoints: + iPhone: "320—430pt width (compact)" + iPad-portrait: "744—820pt width (regular, single column max 640pt)" + iPad-landscape: "1024—1366pt width (regular, KB grid → 3 columns, lists max 720pt)" + + touch-targets: + minimum: 44×44pt (HIG) + ideal: 48×48pt for primary actions + + collapsing-navigation: + large-title: visible at scroll top + scroll-past: collapses to standard nav-bar with centered title + threshold: 20pt scroll offset + + text-scaling: + all typography tokens mapped to dynamicTypeStyle + supported sizes: xSmall, small, medium, large, xLarge, xxLarge, xxxLarge + layout adjustments: grids may drop to single column at accessibility sizes + +--- + +## Do's & Don'ts + +do: + - "Use {colors.canvas} for page background" + - "Use {colors.surface-elevated} for cards and sheets" + - "Use {colors.primary} only on interactive elements (buttons, links, selected states)" + - "Maximum one primary button per screen" + - "AI-generated content: use {animation.ai-reveal} (fade + slide)" + - "All spacing must be from the {spacing} scale" + - "Use SF Symbols exclusively — no third-party icon libraries" + - "Minimum touch target 44×44pt for all interactive elements" + - "Cards: {rounded.lg}; Buttons: {rounded.md}; Tags: {rounded.xs}" + +dont: + - "NEVER use #000000 for text — use {colors.ink-primary}" + - "NEVER use pure #FFFFFF for backgrounds — use {colors.canvas} or {colors.surface-elevated}" + - "NEVER use {rounded.full} on buttons — pills are for filter chips and tags only" + - "NEVER stack heavy shadows (level-2 or higher) on more than one element per screen" + - "NEVER auto-play video" + - "NEVER nest modals inside modals" + - "NEVER customize navigation bar back button text or icon" + - "NEVER use neon/fluorescent colors (#00FF00, #FF00FF, etc.)" + - "NEVER use horizontal-scroll onboarding carousels" + - "NEVER use typewriter animation for AI responses — use whole-block {animation.ai-reveal}" + +--- + +## Agent Prompt Quick Reference + +``` +Build this page using the 知习 AI Design System: + +COLORS: + primary CTA: {colors.primary} #5B5FED + page background: {colors.canvas} #FAFAF8 + card background: {colors.surface-elevated} #FFFFFF + body text: {colors.ink-primary} #1E1B18 + secondary text: {colors.ink-secondary} #6B6560 + divider: {colors.hairline} #E8E6E1 + success: {colors.accent-mint} #34D399 / bg {colors.accent-mint-soft} + warning: {colors.accent-amber} #F59E0B / bg {colors.accent-amber-soft} + error: {colors.accent-coral} #F87171 / bg {colors.accent-coral-soft} + +TYPOGRAPHY: + page title: 34pt / 700 / -0.5pt tracking + card title: 22pt / 600 / -0.2pt tracking + body text: 17pt / 400 / 1.47 line-height + button: 14pt / 500 + caption: 13pt / 400 + +RADIUS: + buttons: 10pt | cards: 14pt | tags: 6pt + +SPACING: 4pt grid — page margins 20pt, card padding 16pt + +ANIMATION: 200ms ease-out default; AI content 400ms fade+slide(8pt) + +FORBIDDEN: pure black text, pure white bg, pill buttons, heavy shadows, + neon colors, typewriter animation, carousel onboarding +``` + +--- + +## Known Gaps + +- **Animation timing functions** documented as CSS keywords (`ease-out`, `spring`); iOS-native equivalents (`CAMediaTimingFunction`, `UISpringTimingParameters`) need per-platform mapping +- **Chart/Data Visualization** section is minimal — AnalysisHomeView bar chart needs full spec (axis labels, grid lines, bar width, gap, legend) +- **Markdown rendering** inside AI responses (code blocks, inline code, bold, lists) is not yet specified +- **Audio playback** (voice input for AI) has no UI spec — waveform, recording state, playback controls +- **Offline mode** visual indicators (sync status icons, stale data banners) not designed +- **Accessibility beyond Dynamic Type** — VoiceOver labels, Magic Tap, accessibility actions not enumerated per component +- **Sign-in / Onboarding flow** — Apple Sign In button, email verification, onboarding questions UI not specified +- **Notification content** — push notification card design (iOS notification extension) not covered +- The `kb-*-bg` / `kb-*-fg` color tokens work for 5 categories; a 6th+ category needs either rotation or user-custom color