simple-skills 1.4.1 → 1.5.3

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.
Files changed (30) hide show
  1. package/README.md +3 -6
  2. package/package.json +1 -1
  3. package/skills/engineering/README.md +3 -1
  4. package/skills/engineering/ask-route/SKILL.md +0 -2
  5. package/skills/taste/README.md +12 -0
  6. package/skills/taste/taste-brandkit/SKILL.md +794 -0
  7. package/skills/taste/taste-brutalist-ui/SKILL.md +88 -0
  8. package/skills/taste/taste-common/SKILL.md +801 -0
  9. package/skills/taste/taste-flutter/SKILL.md +391 -0
  10. package/skills/taste/taste-minimalist-ui/SKILL.md +80 -0
  11. package/skills/taste/taste-redesign/SKILL.md +178 -0
  12. package/skills/taste/taste-soft/SKILL.md +98 -0
  13. package/skills/taste/taste-web/SKILL.md +545 -0
  14. package/skills/engineering/doc-coauthoring/SKILL.md +0 -231
  15. package/skills/productivity/README.md +0 -12
  16. package/skills/productivity/wait-what/SKILL.md +0 -7
  17. package/skills/productivity/wait-what/agents/openai.yaml +0 -5
  18. package/skills/productivity/writing-for-agents/SKILL-MECHANICS.md +0 -22
  19. package/skills/productivity/writing-for-agents/SKILL.md +0 -81
  20. package/skills/productivity/writing-for-agents/agents/openai.yaml +0 -3
  21. /package/skills/{productivity → engineering}/grilling/SKILL.md +0 -0
  22. /package/skills/{productivity → engineering}/grilling/agents/openai.yaml +0 -0
  23. /package/skills/{productivity → engineering}/handoff/SKILL.md +0 -0
  24. /package/skills/{productivity → engineering}/handoff/agents/openai.yaml +0 -0
  25. /package/skills/{productivity → engineering}/teach/GLOSSARY-FORMAT.md +0 -0
  26. /package/skills/{productivity → engineering}/teach/LEARNING-RECORD-FORMAT.md +0 -0
  27. /package/skills/{productivity → engineering}/teach/MISSION-FORMAT.md +0 -0
  28. /package/skills/{productivity → engineering}/teach/RESOURCES-FORMAT.md +0 -0
  29. /package/skills/{productivity → engineering}/teach/SKILL.md +0 -0
  30. /package/skills/{productivity → engineering}/teach/agents/openai.yaml +0 -0
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: taste-soft
3
+ description: 教会 AI 像高端设计机构一样设计。定义让网站显得昂贵的精确字体、间距、shadow、card 结构和动画。屏蔽所有让 AI 设计显得廉价或通用的常见默认做法。
4
+ ---
5
+
6
+ # 代理技能:首席 UI/UX 架构师与动效编排师(Awwwards 级)
7
+
8
+ ## 1. 元信息与核心指令
9
+ - **人设:** `Vanguard_UI_Architect`
10
+ - **目标:** 你打造的是价值 15 万美元以上的机构级数字体验,而不仅是网站。
11
+ - **差异化指令:** 绝不在连续输出中生成完全相同的 layout 或美学。你必须动态组合不同的高端 layout 原型与纹理特征,同时严格遵守精英级的 "Apple 风 / Linear 级" 设计语言。
12
+
13
+ ## 2. "绝对零容忍" 指令(严格反模式)
14
+ 如果你生成的代码包含以下任何一项,设计立即失败:
15
+ - **禁止字体:** Inter、Roboto、Arial、Open Sans、Helvetica。(假设 `Geist`、`Clash Display`、`PP Editorial New` 或 `Plus Jakarta Sans` 等高端字体可用)。
16
+ - **禁止图标:** 标准粗 stroke 的 Lucide、FontAwesome 或 Material Icons。只使用超细、精确的线条(例如 Phosphor Light、Remix Line)。
17
+ - **禁止边框与 shadow:** 通用的 1px 实线灰色边框。生硬、深色的 shadow(`shadow-md`、`rgba(0,0,0,0.3)`)。
18
+ - **禁止 layout:** 紧贴顶部的边到边粘性 navbar。对称、乏味、无巨大留白间隙的 Bootstrap 式三列 grid。
19
+ - **禁止动效:** 标准的 `linear` 或 `ease-in-out` 过渡。没有插值的瞬时状态变化。
20
+
21
+ ## 3. 创意差异化引擎
22
+ 在编写代码之前,默默地 "掷骰子",根据 prompt 的上下文从以下原型中选择一种组合,以确保输出是独一无二定制的,但始终高端:
23
+
24
+ ### A. 氛围与纹理原型(选 1)
25
+ 1. **空灵玻璃(SaaS / AI / 科技):** 最深的 OLED 黑(`#050505`),背景中的径向 mesh gradient(例如含蓄发光的紫/翠绿光球)。配以厚重 `backdrop-blur-2xl` 和纯白/10 发丝线的 Vantablack card。宽阔的几何 Grotesk 排版。
26
+ 2. **编辑式奢华(生活方式 / 房地产 / 机构):** 暖米色(`#FDFBF7`)、柔和鼠尾草绿或深浓缩咖啡色调。用于大标题的高对比度可变 serif 字体。含蓄的 CSS 噪点/胶片颗粒叠加层(`opacity-[0.03]`)营造实体纸张感。
27
+ 3. **柔和结构主义(消费 / 健康 / 作品集):** 银灰或纯白背景。巨大的粗体 Grotesk 排版。轻逸、悬浮的 component,配以难以置信的柔和、高度扩散的环境 shadow。
28
+
29
+ ### B. layout 原型(选 1)
30
+ 1. **非对称 Bento:** 由不同大小 card 组成的类瀑布流 CSS Grid(例如 `col-span-8 row-span-2` 旁边是堆叠的 `col-span-4` card),以打破视觉单调。
31
+ - **移动端折叠:** 回退为单列堆叠(`grid-cols-1`),配以宽松的垂直间隙(`gap-6`)。所有 `col-span` 覆盖重置为 `col-span-1`。
32
+ 2. **Z 轴级联:** 元素像实体 card 一样堆叠,以不同的景深轻微交叠,部分带有含蓄的 `-2deg` 或 `3deg` 旋转以打破数字 grid。
33
+ - **移动端折叠:** 在 `768px` 以下移除所有旋转和负边距交叠。以标准间距垂直堆叠。交叠元素会在移动端造成触控目标冲突。
34
+ 3. **编辑式分栏:** 左半部分(`w-1/2`)为巨大排版,右侧为可交互、可 scroll 的水平图像胶囊或交错的交互 card。
35
+ - **移动端折叠:** 转换为全宽垂直堆叠(`w-full`)。排版块位于顶部,交互内容在其下方流动,必要时保留水平 scroll。
36
+
37
+ **移动端覆盖(通用):** 任何 `md:` 以上的非对称 layout,在 `768px` 以下的 viewport 都必须强力回退为 `w-full`、`px-4`、`py-8`。禁止为全高区块使用 `h-screen`——总是使用 `min-h-[100dvh]` 以防止 iOS Safari viewport 跳动。
38
+
39
+ ## 4. 触觉微美学(component 精通)
40
+
41
+ ### A. "双层边框"(Doppelrand / 嵌套架构)
42
+ 绝不将高端 card、图像或容器平放在背景上。它们必须通过嵌套外壳看起来像实体的、经机械加工的硬件(就像坐在铝制托盘中的玻璃板)。
43
+ - **外壳:** 一个包装 `div`,带含蓄背景(`bg-black/5` 或 `bg-white/5`)、发丝级外边框(`ring-1 ring-black/5` 或 `border border-white/10`)、特定内边距(例如 `p-1.5` 或 `p-2`)和较大的外 radius(`rounded-[2rem]`)。
44
+ - **内核:** 外壳内实际的内容容器。它有自己的独特背景色、自己的内高光(`shadow-[inset_0_1px_1px_rgba(255,255,255,0.15)]`),以及数学计算得出的较小 radius(例如 `rounded-[calc(2rem-0.375rem)]`)以形成同心曲线。
45
+
46
+ ### B. 嵌套 CTA 与 "岛屿" 按钮架构
47
+ - **结构:** 主要交互按钮必须是完全圆润的胶囊(`rounded-full`),配以宽松内边距(`px-6 py-3`)。
48
+ - **"按钮套按钮" 尾随图标:** 如果按钮有箭头(`↗`),它绝不能裸放在文字旁。它必须嵌套在自己独特的圆形包装内(例如 `w-8 h-8 rounded-full bg-black/5 dark:bg-white/10 flex items-center justify-center`),与主按钮的右侧内边距完全齐平。
49
+
50
+ ### C. 空间节奏与张力
51
+ - **宏观留白:** 将标准内边距加倍。区块使用 `py-24` 到 `py-40`。让设计充分呼吸。
52
+ - **眉题标签:** 在主 H1/H2 之前放置一个微小的胶囊形 badge(`rounded-full px-3 py-1 text-[10px] uppercase tracking-[0.2em] font-medium`)。
53
+
54
+ ## 5. 动效编排(流体动力学)
55
+ 禁止使用默认过渡。所有动效都必须模拟真实世界的质量与弹簧物理。使用自定义 cubic-bezier(例如 `transition-all duration-700 ease-[cubic-bezier(0.32,0.72,0,1)]`)。
56
+
57
+ ### A. "流体岛屿" 导航与汉堡菜单显现
58
+ - **关闭状态:** navbar 是一个脱离顶部的悬浮玻璃胶囊(`mt-6`、`mx-auto`、`w-max`、`rounded-full`)。
59
+ - **汉堡变形:** 点击时,汉堡图标的 2 或 3 条线必须流畅旋转并平移以形成一个完美的 'X'(`rotate-45` 和 `-rotate-45` 配绝对定位),而非仅仅消失。
60
+ - **modal 展开:** 菜单应以一个巨大、填满屏幕的叠加层打开,带厚重玻璃效果(`backdrop-blur-3xl bg-black/80` 或 `bg-white/80`)。
61
+ - **交错遮罩显现:** 展开状态中的导航链接不只是出现。它们从隐形盒子中淡入并上滑(`translate-y-12 opacity-0` 到 `translate-y-0 opacity-100`),带交错延迟(每项 `delay-100`、`delay-150`、`delay-200`)。
62
+
63
+ ### B. 磁性按钮 hover 物理
64
+ - 使用 `group` 工具类。hover 时,不要只改变背景色。
65
+ - 将整个按钮轻微缩小(`active:scale-[0.98]`)以模拟物理按压。
66
+ - 嵌套的内部图标圆应沿对角线平移(`group-hover:translate-x-1 group-hover:-translate-y-[1px]`)并轻微放大(`scale-105`),产生内部动能张力。
67
+
68
+ ### C. scroll 插值(进入动画)
69
+ - 元素绝不在加载时静态出现。进入 viewport 时,它们必须执行一次轻柔、有重量的淡入上移(`translate-y-16 blur-md opacity-0` 在 800ms 以上内过渡到 `translate-y-0 blur-0 opacity-100`)。
70
+ - 对于 JavaScript 驱动的 scroll 显现,使用 `IntersectionObserver` 或 Framer Motion 的 `whileInView`。禁止使用 `window.addEventListener('scroll')`——它会导致持续回流并摧毁移动端性能。
71
+
72
+ ## 6. 性能护栏
73
+ - **GPU 安全动画:** 禁止动画 `top`、`left`、`width` 或 `height`。仅通过 `transform` 和 `opacity` 进行动画。谨慎使用 `will-change: transform`,且仅用于正在动画的元素。
74
+ - **blur 约束:** 仅对固定或粘性元素(navbar、叠加层)应用 `backdrop-blur`。禁止对 scroll 容器或大型内容区域应用 blur 滤镜——这会导致持续 GPU 重绘和严重的移动端掉帧。
75
+ - **颗粒/噪点叠加层:** 仅对固定的、`pointer-events-none` 伪元素(`position: fixed; inset: 0; z-index: 50`)应用噪点纹理。禁止将它们附加到 scroll 容器。
76
+ - **Z 轴秩序:** 不要使用任意的 `z-50` 或 `z-[9999]`。严格将 z-index 保留给系统层级:粘性导航、modal、叠加层、工具提示。
77
+
78
+ ## 7. 执行协议
79
+ 生成 UI 代码时,严格遵循以下顺序:
80
+ 1. **[静默思考]** 运行差异化引擎(第 3 节)。根据 prompt 上下文选择你的氛围与 layout 原型,以确保输出独一无二。
81
+ 2. **[搭建]** 建立背景纹理、宏观留白尺度和巨大的排版字号。
82
+ 3. **[架构]** 对所有主要 card、输入框和特性 grid 严格使用 "双层边框"(Doppelrand)技术构建 DOM。使用夸张的超椭圆 radius(`rounded-[2rem]`)。
83
+ 4. **[编排]** 注入自定义 `cubic-bezier` 过渡、交错导航显现以及按钮套按钮的 hover 物理。
84
+ 5. **[输出]** 交付无瑕疵、像素级完美的 React/Tailwind/HTML 代码。不要包含基础、通用的 fallback。
85
+
86
+ ## 8. 输出前 checklist
87
+ 交付前,对照此矩阵评估你的代码。这是最后一道过滤器。
88
+ - [ ] 不存在第 2 节中的禁止字体、图标、边框、shadow、layout 或动效模式
89
+ - [ ] 有意识地从第 3 节选择并应用了一个氛围原型和一个 layout 原型
90
+ - [ ] 所有主要 card 和容器都使用双层边框嵌套架构(外壳 + 内核)
91
+ - [ ] CTA 按钮在适用处使用按钮套按钮尾随图标模式
92
+ - [ ] 区块内边距至少为 `py-24`——layout 充分呼吸
93
+ - [ ] 所有过渡都使用自定义 cubic-bezier 曲线——无 `linear` 或 `ease-in-out`
94
+ - [ ] 存在 scroll 进入动画——没有元素静态出现
95
+ - [ ] layout 在 `768px` 以下优雅折叠为单列,配 `w-full` 和 `px-4`
96
+ - [ ] 所有动画只使用 `transform` 和 `opacity`——无触发 layout 的属性
97
+ - [ ] `backdrop-blur` 只应用于固定/粘性元素,绝不用在 scroll 内容上
98
+ - [ ] 整体印象读起来像 "15 万美元机构级出品",而非 "用了好字体的模板"
@@ -0,0 +1,545 @@
1
+ ---
2
+ name: taste-web
3
+ description: taste-skill 的 Web 平台 overlay(React / Next.js / Tailwind / Motion / GSAP)。提供设计系统 npm 映射、架构约定、动画代码骨架、性能护栏、dark mode token 策略与 Web 专属起飞前检查。必须先读 ../taste-common/SKILL.md。
4
+ ---
5
+
6
+ # tasteskill Web overlay(React / Next.js)
7
+
8
+ > **必须先读 `../taste-common/SKILL.md`。** 本文件只含 Web 平台差异:设计系统映射、技术栈约定、动画骨架、性能机制、token 策略、Web 专属检查项与附录。设计判断(简报推断、旋钮、§4 设计工程指令、破绽清单、改版协议、起飞前检查的平台无关部分)全部在 common 中。
9
+
10
+ **编号与 common 对齐。** 本文件使用与 common 相同的节号;缺失的节号(0、1、4、7、10-13)说明该节内容平台无关,在 common 中。common 中标注「见平台 overlay」处的对接关系:
11
+
12
+ | common 引用点 | 本文件对接节 |
13
+ |---|---|
14
+ | 第 2 节设计系统映射表与审美实现 | §2.A / §2.B |
15
+ | 第 3 节平台架构约定 | §3.A-3.E |
16
+ | 第 5 节标准骨架与禁止的动画模式 | §5.A-5.D |
17
+ | 第 6 节性能机制 | §6.B、§6.D、§6.E |
18
+ | 第 8.A 节 token 策略 | §8.A |
19
+ | 第 9.E 节图标库 | §3.C、§9.E |
20
+ | 第 10 节动画库选择 | §10 |
21
+ | 第 14 节平台专属检查项 | §14(Web 补充) |
22
+ | 安装命令与官方来源 | 附录 A / B / C |
23
+
24
+ ---
25
+
26
+ ## 2. 简报 → 设计系统映射(Web 实现)
27
+
28
+ ### 2.A 何时使用真实设计系统(使用官方包)
29
+ | 简报读作… | 选用 | 原因 |
30
+ |---|---|---|
31
+ | 微软 / 企业 SaaS / 仪表盘 | `@fluentui/react-components` 或 `@fluentui/web-components` | 官方 Fluent UI、微软 token、无障碍已就绪 |
32
+ | 类 Google 界面、Material 风格产品 | `@material/web` + Material 3 tokens | 官方,可通过 Material Theming 定制主题 |
33
+ | IBM 风格 B2B / 企业分析 | `@carbon/react` + `@carbon/styles` | 官方 Carbon,成熟的数据密度模式 |
34
+ | Shopify 应用界面 | `polaris.js` web components / Polaris React | Shopify 管理界面所必需 |
35
+ | Atlassian / Jira 风格产品 | `@atlaskit/*` + `@atlaskit/tokens` | 官方 Atlassian DS |
36
+ | GitHub 风格开发者工具 / 社区页面 | `@primer/css` 或 `@primer/react-brand` | 官方 Primer;Brand 变体用于营销 |
37
+ | 英国公共部门服务 | `govuk-frontend` | 法律 / 监管所期望 |
38
+ | 美国公共部门 / 信任优先 | `uswds` | 同上 |
39
+ | 快速的本地商家 / 代理商 MVP | Bootstrap 5.3 | 平庸、快、能用 |
40
+ | 现代无障碍 React 基础 | `@radix-ui/themes` | 原语 + 精致主题 |
41
+ | component 归你所有的现代 SaaS | shadcn/ui(`npx shadcn@latest add ...`) | 代码归你所有,易于定制;绝不以默认状态交付 |
42
+ | 基于 Tailwind 的现代 SaaS / AI 营销 | Tailwind v4 工具类 + `dark:` 变体 | 独立开发者 + 小团队的默认选择 |
43
+
44
+ common 第 2 节的诚实规则与「每个项目一个系统」在此严格执行:不要在同一个依赖树里混用 Fluent React 和 Carbon;不要往 Material 3 应用里引入 shadcn/ui component。
45
+
46
+ ### 2.B 当简报是一种审美而非系统时
47
+ 对于这些方向,**没有单一官方包**。用原生 CSS + Tailwind + 一个维护良好的 component 库来构建。在代码注释中诚实说明哪些是借鉴的灵感、哪些是官方 asset。
48
+
49
+ | 审美 | 诚实的实现方式 |
50
+ |---|---|
51
+ | 玻璃拟态 / "磨砂玻璃" | `backdrop-filter`、分层边框、高光叠加。为 `prefers-reduced-transparency` 提供纯色填充回退。 |
52
+ | Bento(苹果风格磁贴 grid) | 混合单元格尺寸的 CSS Grid。没有单一库独占它。 |
53
+ | 粗野主义 | 原生 CSS、monospace、生硬边框。无库。 |
54
+ | 编辑 / 杂志 | serif、非对称 grid、充足留白。无库。 |
55
+ | 暗黑科技 / 黑客 | monospace + 强调霓虹色、终端母题。无库。 |
56
+ | 极光 / mesh gradient | SVG 或分层径向 gradient。无库。 |
57
+ | 动感字体排版 | 原生 CSS 动画、scroll 驱动动画、劫持 scroll 用 GSAP。无库。 |
58
+ | **Apple Liquid Glass** | Apple 只针对 Apple 平台记录了这个效果。**不存在官方的 `liquid-glass.css`。** Web 实现都是使用 `backdrop-filter` + 分层边框 + 高光的近似实现。要明确标注为近似(见附录 C)。 |
59
+
60
+ ---
61
+
62
+ ## 3. 默认架构与约定(Web)
63
+
64
+ 除非设计解读选择了真实设计系统(第 2.A 节),否则使用以下默认值:
65
+
66
+ ### 3.A 技术栈
67
+ * **框架:** React 或 Next.js。默认使用服务器 component(RSC)。
68
+ * **RSC 安全:** 全局状态只在客户端 component 中有效。在 Next.js 中,用 `"use client"` component 包裹 provider。
69
+ * **交互隔离:** 任何使用 Motion、scroll 监听器或指针物理的 component 都必须是顶部带 `'use client'` 的独立叶子 component。服务器 component 只 render 静态 layout。
70
+ * **样式:** **Tailwind v4**(默认)。仅当现有项目要求时才用 Tailwind v3。
71
+ * v4 下:不要在 `postcss.config.js` 中使用 `tailwindcss` 插件。使用 `@tailwindcss/postcss` 或 Vite 插件。
72
+ * **动画:** **Motion**(前身是 Framer Motion 的库)。从 `motion/react` 导入(`import { motion } from "motion/react"`)。`framer-motion` 包仍可作为旧版别名使用——新代码中优先用 `motion/react`。
73
+ * **字体:** 总是使用 `next/font`(Next.js)或通过 `@font-face` + `font-display: swap` 自托管。生产环境禁止通过 `<link>` 引用 Google Fonts。
74
+
75
+ ### 3.B 状态
76
+ * 本地 `useState` / `useReducer` 用于隔离的 UI。
77
+ * 全局状态仅用于避免深层 prop 传递——Zustand、Jotai 或 React context。
78
+ * **禁止**用 `useState` 跟踪由用户输入驱动的连续值(鼠标位置、scroll 进度、指针物理、磁吸 hover)。使用 Motion 的 `useMotionValue` / `useTransform` / `useScroll`。`useState` 会在每次变化时重 render 整个 React 树,在移动端会崩溃。
79
+
80
+ ### 3.C 图标
81
+ * **允许的库(优先级顺序):** `@phosphor-icons/react`、`hugeicons-react`、`@radix-ui/react-icons`、`@tabler/icons-react`。
82
+ * **不推荐:** `lucide-react`。仅当用户明确要求或项目已依赖它时才可接受。
83
+ * **禁止手写 SVG 图标。** 如果缺少某个图形,安装第二个库或从原语组合——不要从头画图标路径。
84
+ * **每个项目一个图标家族。** 不要在同一个 component 树里混用 Phosphor 和 Lucide。
85
+ * **全局统一 `strokeWidth`**(例如 `1.5` 或 `2.0`)。
86
+
87
+ ### 3.D Emoji 策略
88
+ 默认在代码、标记和可见文本中不推荐使用。用图标库图形替代符号。**覆盖:** 仅当用户明确要求俏皮 / 聊天风格 / 社交原生氛围时才允许使用 emoji——即便如此也要有意识地克制使用。
89
+
90
+ ### 3.E 响应式与 layout 机制
91
+ * 统一 breakpoint(`sm 640`、`md 768`、`lg 1024`、`xl 1280`、`2xl 1536`)。
92
+ * 用 `max-w-[1400px] mx-auto` 或 `max-w-7xl` 约束页面 layout。
93
+ * **viewport 稳定性:** 全高 Hero 区域禁止用 `h-screen`。总是用 `min-h-[100dvh]` 以防移动端(iOS Safari 地址栏)layout 跳动。
94
+ * **grid 优先于 Flex 计算:** 禁止用复杂的 flexbox 百分比计算(`w-[calc(33%-1rem)]`)。总是用 CSS Grid(`grid grid-cols-1 md:grid-cols-3 gap-6`)。
95
+
96
+ ### 3.F 依赖校验(强制)
97
+ 见 common 第 3.A 节。Web 下依赖清单是 `package.json`。
98
+
99
+ common 第 4 节规则在 Web 下的常用具体表达:hero 顶部内边距上限 = `pt-24`(96px);hero 默认字号区间 = `text-4xl md:text-5xl lg:text-6xl`;斜体下降部 = `leading-[1.1]` + `pb-1`;输入块间距 = `gap-2`;eyebrow 典型签名 = `text-[11px] uppercase tracking-[0.18em]`;窄屏折叠 = `w-full px-4 py-8` + `max-w-7xl mx-auto`;按压态 = `:active` 上 `-translate-y-[1px]` 或 `scale-[0.98]`。
100
+
101
+ ---
102
+
103
+ ## 5. 标准骨架与禁令(Web 实现)
104
+
105
+ common 第 5 节的通用原则在此落地为代码。
106
+
107
+ ### 5.A 粘性堆叠——标准骨架
108
+
109
+ ```tsx
110
+ "use client";
111
+ import { useRef, useEffect } from "react";
112
+ import { gsap } from "gsap";
113
+ import { ScrollTrigger } from "gsap/ScrollTrigger";
114
+ import { useReducedMotion } from "motion/react";
115
+
116
+ gsap.registerPlugin(ScrollTrigger);
117
+
118
+ export function StickyStack({ cards }: { cards: React.ReactNode[] }) {
119
+ const ref = useRef<HTMLDivElement>(null);
120
+ const reduce = useReducedMotion();
121
+
122
+ useEffect(() => {
123
+ if (reduce || !ref.current) return;
124
+ const ctx = gsap.context(() => {
125
+ const cardEls = gsap.utils.toArray<HTMLElement>(".stack-card");
126
+ cardEls.forEach((card, i) => {
127
+ if (i === cardEls.length - 1) return;
128
+ ScrollTrigger.create({
129
+ trigger: card,
130
+ start: "top top", // pin at viewport top
131
+ endTrigger: cardEls[cardEls.length - 1],
132
+ end: "top top",
133
+ pin: true,
134
+ pinSpacing: false,
135
+ });
136
+ gsap.to(card, {
137
+ scale: 0.92,
138
+ opacity: 0.55,
139
+ ease: "none",
140
+ scrollTrigger: {
141
+ trigger: cardEls[i + 1],
142
+ start: "top bottom",
143
+ end: "top top",
144
+ scrub: true,
145
+ },
146
+ });
147
+ });
148
+ }, ref);
149
+ return () => ctx.revert();
150
+ }, [reduce]);
151
+
152
+ return (
153
+ <div ref={ref} className="relative">
154
+ {cards.map((card, i) => (
155
+ <div
156
+ key={i}
157
+ className="stack-card sticky top-0 min-h-[100dvh] flex items-center justify-center"
158
+ >
159
+ {card}
160
+ </div>
161
+ ))}
162
+ </div>
163
+ );
164
+ }
165
+ ```
166
+
167
+ 关键点:`start: "top top"`、`pin: true`、除最后一张外每张 card 都被固定,scale/opacity 变换由下一张 card 的 scroll 触发器驱动(这样上一张 card 会在下一张到来时缩小)。
168
+
169
+ ### 5.B 横向平移——标准骨架
170
+
171
+ ```tsx
172
+ "use client";
173
+ import { useRef, useEffect } from "react";
174
+ import { gsap } from "gsap";
175
+ import { ScrollTrigger } from "gsap/ScrollTrigger";
176
+ import { useReducedMotion } from "motion/react";
177
+
178
+ gsap.registerPlugin(ScrollTrigger);
179
+
180
+ export function HorizontalPan({ children }: { children: React.ReactNode }) {
181
+ const wrap = useRef<HTMLDivElement>(null);
182
+ const track = useRef<HTMLDivElement>(null);
183
+ const reduce = useReducedMotion();
184
+
185
+ useEffect(() => {
186
+ if (reduce || !wrap.current || !track.current) return;
187
+ const ctx = gsap.context(() => {
188
+ const distance = track.current!.scrollWidth - window.innerWidth;
189
+ gsap.to(track.current, {
190
+ x: -distance,
191
+ ease: "none",
192
+ scrollTrigger: {
193
+ trigger: wrap.current,
194
+ start: "top top", // pin starts when section top hits viewport top
195
+ end: () => `+=${distance}`, // scroll distance = track width minus viewport
196
+ pin: true,
197
+ scrub: 1,
198
+ invalidateOnRefresh: true,
199
+ },
200
+ });
201
+ }, wrap);
202
+ return () => ctx.revert();
203
+ }, [reduce]);
204
+
205
+ return (
206
+ <section ref={wrap} className="relative overflow-hidden">
207
+ <div ref={track} className="flex h-[100dvh] items-center">
208
+ {children}
209
+ </div>
210
+ </section>
211
+ );
212
+ }
213
+ ```
214
+
215
+ 关键点:`start: "top top"`、`pin: true`、`end: "+=${distance}"`(scroll 长度 = 所需横向位移)、`scrub: 1`。外层包裹被固定,内层轨道随用户垂直 scroll 而横向滑动。
216
+
217
+ ### 5.C scroll 显现错峰——标准骨架(更轻量的替代)
218
+
219
+ 对于简单的"项目进入 viewport 时显现"(无固定),优先用 Motion 的 `whileInView` 而不是 GSAP——更轻量,无需 ScrollTrigger:
220
+
221
+ ```tsx
222
+ "use client";
223
+ import { motion, useReducedMotion } from "motion/react";
224
+
225
+ export function RevealStagger({ items }: { items: string[] }) {
226
+ const reduce = useReducedMotion();
227
+ return (
228
+ <ul className="grid gap-6">
229
+ {items.map((item, i) => (
230
+ <motion.li
231
+ key={item}
232
+ initial={reduce ? false : { opacity: 0, y: 24 }}
233
+ whileInView={{ opacity: 1, y: 0 }}
234
+ viewport={{ once: true, amount: 0.3 }}
235
+ transition={{
236
+ duration: 0.6,
237
+ delay: i * 0.06,
238
+ ease: [0.16, 1, 0.3, 1],
239
+ }}
240
+ >
241
+ {item}
242
+ </motion.li>
243
+ ))}
244
+ </ul>
245
+ );
246
+ }
247
+ ```
248
+
249
+ 用于:特性列表、证言 grid、标志墙,以及任何只需要"scroll 进入"的场景。把 GSAP 留给真正的固定 / scrub 工作。
250
+
251
+ ### 5.D 禁止的动画模式(Web)
252
+
253
+ * **`window.addEventListener("scroll", ...)`** 被禁止。它在每一帧 scroll 都运行,易卡顿,无批处理。使用 Motion 的 `useScroll()`、GSAP 的 `ScrollTrigger`、IntersectionObserver 或 CSS `scroll-driven animations`(`animation-timeline: view()`)。
254
+ * **在 React state 中用 `window.scrollY` 做自定义 scroll 进度计算**。同理。每一帧都重 render。
255
+ * **触碰 React state 的 `requestAnimationFrame` 循环。** 改用 motion values(`useMotionValue` + `useTransform`)。
256
+ * **layout 过渡:** 对于可见的状态变化(列表重排序、展开 modal、路由间共享元素),使用 Motion 的 `layout` 和 `layoutId` props。不要"为了保险"给静态内容包裹 `layout` props——那会付出测量成本。
257
+ * **错峰编排:** 对于顺序重要的显现时刻,使用 `staggerChildren`(Motion)或 CSS 级联(`animation-delay: calc(var(--index) * 100ms)`)。使用 `staggerChildren` 时,父级(`variants`)和子级必须共享同一个客户端 component 树。
258
+
259
+ ---
260
+
261
+ ## 6. 性能与无障碍护栏(Web 机制)
262
+
263
+ ### 6.A 硬件加速
264
+ common 原则(只动画化 `transform` 和 `opacity`;禁止 `top`、`left`、`width`、`height`)在 Web 下的补充:谨慎使用 `will-change: transform`——只用在真正会动画化的元素上。
265
+
266
+ ### 6.B 减弱动效(Web 机制)
267
+ * 在 Motion 中:用 `useReducedMotion()` 包裹并降级为静态。
268
+ * 在 CSS 中:把动画放在 `@media (prefers-reduced-motion: no-preference)` 之后,或在 `@media (prefers-reduced-motion: reduce)` 下提供禁用的覆盖块。
269
+
270
+ ### 6.D DOM 成本
271
+ * 颗粒 / 噪点滤镜只应用在固定的、`pointer-events-none` 的伪元素上(例如 `fixed inset-0 z-[60] pointer-events-none`)。禁止用在 scroll 容器上——持续的 GPU 重绘会摧毁移动端帧率。
272
+
273
+ ### 6.E Z-Index 克制
274
+ 禁止随意滥用 `z-50` 或 `z-10`。z-index 只严格用于系统性的层级场景(粘性 navbar、modal、遮罩、颗粒层)。在项目常量文件中记录 z-index 刻度。
275
+
276
+ ---
277
+
278
+ ## 8. dark mode 协议(Web token 策略)
279
+
280
+ ### 8.A Token 策略(选一种,坚持到底)
281
+ * **Tailwind `dark:` 变体**(工具类优先项目的默认):每个颜色工具类都配上深色变体(`bg-white dark:bg-zinc-950`、`text-gray-900 dark:text-gray-100`)。
282
+ * **CSS 变量**(用于 shadcn/ui、Radix Themes 或带主题功能的 component 库):定义语义 token(`--surface`、`--surface-elevated`、`--text-primary`、`--accent`),并在 `[data-theme="dark"]` 或 `@media (prefers-color-scheme: dark)` 下交换值。
283
+ * 使用内置主题功能的设计系统时(Radix Themes、带 `<Theme>` 的 shadcn/ui),在 `layout.tsx` 或页面根部设置一次主题。不要让单个区块覆盖。
284
+ * 尊重 `prefers-color-scheme: dark`。默认跟随系统偏好,除非品牌坚持单一模式。
285
+
286
+ ---
287
+
288
+ ## 9. AI 破绽(Web 补充)
289
+
290
+ ### 9.E 外部资源与 component(Web 补充)
291
+ * **shadcn/ui 定制:** 允许,但禁止处于默认状态。按项目审美定制 radius、颜色、shadow、字体排版。
292
+ * 图标库允许清单见 §3.C(Phosphor / HugeIcons / Radix / Tabler;Lucide 仅明确要求时)。
293
+
294
+ ---
295
+
296
+ ## 10. 动画库选择(Web)
297
+
298
+ * **Motion(`motion/react`)**——UI / Bento / 状态变化动效的默认。
299
+ * **GSAP + ScrollTrigger**——用于全页 scroll 叙事和 scroll 劫持。隔离在带 `useEffect` 清理的专用叶子 component 中。
300
+ * **Three.js / WebGL**——用于 canvas 背景和 3D 场景。同样隔离规则。
301
+ * **禁止在同一个 component 树里混用 GSAP / Three.js 与 Motion。** 它们会争夺同一批帧。
302
+
303
+ ---
304
+
305
+ ## 14. 最终起飞前检查(Web 补充项)
306
+
307
+ 先运行 common 第 14 节的平台无关检查矩阵,再运行以下 Web 专属项:
308
+
309
+ - [ ] **GSAP 粘性堆叠 / 横向平移**按第 5.A / 5.B 节标准骨架实现(`start: "top top"`、`pin: true`、正确的 scrub)?
310
+ - [ ] **无 `window.addEventListener('scroll')`**——只用 Motion `useScroll()` / ScrollTrigger / IntersectionObserver / CSS scroll 驱动动画?
311
+ - [ ] **`useEffect` 动画**有严格的清理函数?
312
+ - [ ] **viewport 稳定性**:`min-h-[100dvh]`,禁止 `h-screen`?
313
+ - [ ] 高变化 layout 的**移动端折叠**显式(`w-full`、`px-4`、`max-w-7xl mx-auto`)?
314
+ - [ ] **Motion** 隔离在顶部带 `'use client'` 的客户端叶子 component 中,并已 memo?
315
+ - [ ] **图标**仅来自允许的库(Phosphor / HugeIcons / Radix / Tabler),无手写 SVG 路径?
316
+ - [ ] **核心 Web 指标**可信达标(LCP < 2.5s、INP < 200ms、CLS < 0.1)?
317
+ - [ ] EYEBROW 机械计数:grep 所有 component 中 `uppercase tracking` 的出现次数,≤ ceil(区块数 / 3)?
318
+ - [ ] 每项目**一个设计系统**(不混用 Material + shadcn)?
319
+
320
+ ---
321
+
322
+ # 附录——真实来源支持的参考材料
323
+
324
+ 以下各节是收录的参考内容。它们为第 2 节中提到的每个设计系统提供真实的安装命令、真实的官方文档链接和真实可用的起始代码片段。用它们把决策锚定在生产现实中,而非训练数据虚构。
325
+
326
+ ## 附录 A——每个设计系统的安装命令
327
+
328
+ ```bash
329
+ # Material Web (Material 3)
330
+ npm install @material/web
331
+
332
+ # Fluent UI React (v9)
333
+ npm install @fluentui/react-components
334
+
335
+ # Fluent UI Web Components (framework-free)
336
+ npm install @fluentui/web-components @fluentui/tokens
337
+
338
+ # IBM Carbon
339
+ npm install @carbon/react @carbon/styles
340
+
341
+ # Radix Themes
342
+ npm install @radix-ui/themes
343
+
344
+ # shadcn/ui (open code, owned components)
345
+ npx shadcn@latest init
346
+ npx shadcn@latest add button card badge separator input
347
+
348
+ # Primer CSS (GitHub product/devtool UI)
349
+ npm install --save @primer/css
350
+
351
+ # Primer Brand (GitHub marketing UI)
352
+ npm install @primer/react-brand
353
+
354
+ # GOV.UK Frontend
355
+ npm install govuk-frontend
356
+
357
+ # USWDS (US Web Design System)
358
+ npm install uswds
359
+
360
+ # Atlassian Design System (Atlaskit)
361
+ yarn add @atlaskit/css-reset @atlaskit/tokens @atlaskit/button @atlaskit/badge @atlaskit/section-message @atlaskit/card
362
+
363
+ # Bootstrap 5.3
364
+ npm install bootstrap
365
+
366
+ # Shopify Polaris Web Components (Shopify apps only)
367
+ # Add this to your app HTML head:
368
+ # <meta name="shopify-api-key" content="%SHOPIFY_API_KEY%" />
369
+ # <script src="https://cdn.shopify.com/shopifycloud/polaris.js"></script>
370
+ ```
371
+
372
+ ## 附录 B——官方来源(在重新造轮子前先读这些)
373
+
374
+ ### Material Web
375
+ - https://github.com/material-components/material-web
376
+ - https://material-web.dev/theming/material-theming/
377
+ - https://m3.material.io/develop/web
378
+
379
+ ### Fluent UI
380
+ - https://fluent2.microsoft.design/get-started/develop
381
+ - https://fluent2.microsoft.design/components/web/react/
382
+ - https://github.com/microsoft/fluentui
383
+ - https://learn.microsoft.com/en-us/fluent-ui/web-components/
384
+
385
+ ### Carbon
386
+ - https://carbondesignsystem.com/
387
+ - https://github.com/carbon-design-system/carbon
388
+ - https://carbondesignsystem.com/developing/react-tutorial/overview/
389
+ - https://carbondesignsystem.com/developing/web-components-tutorial/overview/
390
+
391
+ ### Shopify Polaris
392
+ - https://shopify.dev/docs/api/app-home/web-components
393
+ - https://github.com/Shopify/polaris-react
394
+ - https://polaris-react.shopify.com/components
395
+
396
+ ### Atlassian
397
+ - https://atlassian.design/get-started/develop
398
+ - https://atlassian.design/components/button/examples
399
+ - https://atlaskit.atlassian.com/packages/design-system/button/example/disabled
400
+ - https://atlassian.design/tokens/design-tokens
401
+
402
+ ### Primer
403
+ - https://primer.style/
404
+ - https://github.com/primer/css
405
+ - https://github.com/primer/brand
406
+
407
+ ### GOV.UK
408
+ - https://design-system.service.gov.uk/components/button/
409
+ - https://design-system.service.gov.uk/styles/layout/
410
+ - https://github.com/alphagov/govuk-frontend
411
+
412
+ ### USWDS
413
+ - https://designsystem.digital.gov/documentation/developers/
414
+ - https://designsystem.digital.gov/components/button/
415
+ - https://designsystem.digital.gov/components/card/
416
+ - https://github.com/uswds/uswds
417
+
418
+ ### Bootstrap
419
+ - https://getbootstrap.com/docs/5.3/layout/grid/
420
+ - https://getbootstrap.com/docs/5.3/components/card/
421
+
422
+ ### Tailwind
423
+ - https://tailwindcss.com/docs/dark-mode
424
+ - https://tailwindcss.com/blog/tailwindcss-v4
425
+
426
+ ### Radix
427
+ - https://www.radix-ui.com/themes/docs/components/theme
428
+ - https://www.radix-ui.com/themes/docs/components/card
429
+ - https://github.com/radix-ui/themes
430
+
431
+ ### shadcn/ui
432
+ - https://ui.shadcn.com/docs
433
+ - https://ui.shadcn.com/docs/components/card
434
+ - https://github.com/shadcn-ui/ui
435
+
436
+ ### Native CSS / W3C standards
437
+ - https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/backdrop-filter
438
+ - https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme
439
+ - https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion
440
+ - https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Grid_layout
441
+ - https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Scroll-driven_animations
442
+ - https://drafts.csswg.org/scroll-animations-1/
443
+
444
+ ### Apple Liquid Glass(仅限 Apple 平台)
445
+ - https://developer.apple.com/design/human-interface-guidelines/materials
446
+ - https://developer.apple.com/documentation/TechnologyOverviews/liquid-glass
447
+ - https://developer.apple.com/documentation/TechnologyOverviews/adopting-liquid-glass
448
+ - https://developer.apple.com/documentation/SwiftUI/Material
449
+
450
+ ---
451
+
452
+ ## 附录 C——Apple Liquid Glass:诚实的 Web 近似实现
453
+
454
+ **不要**把随机 CSS 片段当作官方 Apple Liquid Glass。
455
+
456
+ ### 什么是官方的
457
+ Apple 在 Apple 平台的 Human Interface Guidelines 和 Developer Documentation 中记录了 Liquid Glass。它是一种跨 Apple 平台 UI 使用的动态材质。Apple 的原生实现属于 Apple 平台 API 和系统 component,**而不是公开的 Web CSS 包**。
458
+
459
+ 相关官方文档:
460
+ - Apple Human Interface Guidelines → Materials
461
+ - Apple Developer Documentation → Liquid Glass
462
+ - Apple Developer Documentation → Adopting Liquid Glass
463
+ - SwiftUI → Material
464
+
465
+ ### 什么不是官方的
466
+ 普通网站不存在 Apple 出的 `liquid-glass.css`。
467
+
468
+ Web 近似实现可以使用:
469
+ - `backdrop-filter`
470
+ - 透明背景
471
+ - 分层边框
472
+ - 高光叠加
473
+ - gradient
474
+ - 动效
475
+ - 强对比回退
476
+
477
+ 但那是 **Web 玻璃拟态 / 磨砂玻璃近似**,不是官方 Apple Liquid Glass。在注释中照此标注。
478
+
479
+ ### 更安全的 Web 近似骨架
480
+
481
+ ```css
482
+ .liquid-glass-web-approx {
483
+ position: relative;
484
+ isolation: isolate;
485
+ overflow: hidden;
486
+ border-radius: 999px;
487
+ border: 1px solid rgb(255 255 255 / .32);
488
+ background:
489
+ linear-gradient(135deg, rgb(255 255 255 / .30), rgb(255 255 255 / .08)),
490
+ rgb(255 255 255 / .12);
491
+ backdrop-filter: blur(24px) saturate(180%) contrast(1.05);
492
+ -webkit-backdrop-filter: blur(24px) saturate(180%) contrast(1.05);
493
+ box-shadow:
494
+ inset 0 1px 0 rgb(255 255 255 / .48),
495
+ inset 0 -1px 0 rgb(255 255 255 / .12),
496
+ 0 18px 60px rgb(0 0 0 / .18);
497
+ }
498
+
499
+ .liquid-glass-web-approx::before {
500
+ content: "";
501
+ position: absolute;
502
+ inset: 0;
503
+ z-index: -1;
504
+ border-radius: inherit;
505
+ background:
506
+ radial-gradient(circle at 20% 0%, rgb(255 255 255 / .55), transparent 34%),
507
+ linear-gradient(90deg, rgb(255 255 255 / .18), transparent 42%, rgb(255 255 255 / .14));
508
+ pointer-events: none;
509
+ }
510
+
511
+ .liquid-glass-web-approx::after {
512
+ content: "";
513
+ position: absolute;
514
+ inset: 1px;
515
+ border-radius: inherit;
516
+ border: 1px solid rgb(255 255 255 / .14);
517
+ pointer-events: none;
518
+ }
519
+
520
+ @media (prefers-color-scheme: dark) {
521
+ .liquid-glass-web-approx {
522
+ border-color: rgb(255 255 255 / .18);
523
+ background:
524
+ linear-gradient(135deg, rgb(255 255 255 / .16), rgb(255 255 255 / .04)),
525
+ rgb(15 23 42 / .42);
526
+ box-shadow:
527
+ inset 0 1px 0 rgb(255 255 255 / .22),
528
+ 0 18px 60px rgb(0 0 0 / .42);
529
+ }
530
+ }
531
+
532
+ @media (prefers-reduced-transparency: reduce) {
533
+ .liquid-glass-web-approx {
534
+ background: rgb(255 255 255 / .96);
535
+ backdrop-filter: none;
536
+ -webkit-backdrop-filter: none;
537
+ }
538
+ }
539
+ ```
540
+
541
+ **重要:** `prefers-reduced-transparency` 的浏览器支持参差不齐;要测试它。即便没有 blur,也总是提供足够的对比度。
542
+
543
+ ---
544
+
545
+ **附录结束。** 上述安装命令是现实锚点。Apple Liquid Glass 骨架是标注过的近似实现,不是 Apple 发布的包。每个设计系统的官方文档,请查阅该系统官方文档(第 2 节中的链接加附录 B)。