cos-design 3.7.3 → 3.7.4

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/CHANGELOG.md CHANGED
@@ -5,6 +5,33 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.7.4] - 2026-08-10
9
+
10
+ ### Added
11
+
12
+ - `@cos-design/shared`:补齐 `prefersReducedMotion` / `bindPrefersReducedMotion`、`observeElementSize`、`getRelativePointerPosition`,以及 `PhotoItem` / 索引回调类型
13
+ - 营销组件命令式 Handle 与服务端开奖能力:`Turntable`(`spin`/`reset`/`targetIndex`)、`SlotMachine`(`spin`/`reset`/`targetResults`/`buttonText`)、`ScratchCard`(`reset`/`reveal`/`revealThreshold`)、`RedPacketRain`(`start`/`stop`/`reset`/`width`/`height`/`onEnd`/`auto`)
14
+ - `Charge.onComplete`;`Fireworks` / `Confetti` 的 `onComplete`;Photo 旗舰统一 `onIndexChange` 别名(Album / Lantern / Clothesline / Carousel)
15
+ - Playground「活动配方」页:刮开庆祝、倒计时红包雨、转盘彩纸
16
+
17
+ ### Changed
18
+
19
+ - `Fireworks` / `Confetti` / `RedPacketRain` 改用 pointer 事件,并接入 reduced-motion 降级
20
+ - README / QUICKSTART 组件数量与分类同步为 84 个 · 9 类
21
+ - @cos-design/shared: 3.5.3 → 3.5.4
22
+ - @cos-design/charge: 3.5.3 → 3.5.4
23
+ - @cos-design/confetti: 3.5.3 → 3.5.4
24
+ - @cos-design/fireworks: 3.5.3 → 3.5.4
25
+ - @cos-design/photo-album: 3.7.1 → 3.7.2
26
+ - @cos-design/photo-carousel: 3.7.3 → 3.7.4
27
+ - @cos-design/photo-clothesline: 3.7.3 → 3.7.4
28
+ - @cos-design/photo-lantern: 3.7.3 → 3.7.4
29
+ - @cos-design/red-packet-rain: 3.5.3 → 3.5.4
30
+ - @cos-design/scratch-card: 3.5.3 → 3.5.4
31
+ - @cos-design/slot-machine: 3.5.4 → 3.5.5
32
+ - @cos-design/turntable: 3.5.4 → 3.5.5
33
+ - cos-design: 聚合包更新至 3.7.4
34
+
8
35
  ## [3.7.3] - 2026-08-03
9
36
 
10
37
  ### Added
package/README.md CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  # cos-design
4
4
 
5
- **73 个 React 视觉特效组件 · 活动页 / 品牌页 / 创意展示开箱即用**
5
+ **84 React visual-effect components** for marketing pages, brand landings, and creative showcases
6
+ **84 个 React 视觉特效组件 · 活动页 / 品牌页 / 创意展示开箱即用**
6
7
 
7
8
  [![CI](https://github.com/jiaxiantao/cos-design/actions/workflows/ci.yml/badge.svg)](https://github.com/jiaxiantao/cos-design/actions/workflows/ci.yml)
8
9
  [![npm version](https://img.shields.io/npm/v/cos-design.svg)](https://www.npmjs.com/package/cos-design)
@@ -10,12 +11,44 @@
10
11
  [![React](https://img.shields.io/badge/React-19-61dafb)](https://react.dev/)
11
12
  [![TypeScript](https://img.shields.io/badge/TypeScript-5-3178c6)](https://www.typescriptlang.org/)
12
13
 
13
- [在线预览](https://jiaxiantao.github.io/cos-design/) · [快速开始](./QUICKSTART.md) · [AI 文档 / llms.txt](https://jiaxiantao.github.io/cos-design/llms.txt) · [v3.0 发布博客](./website-content/cos-design-v3-release.md) · [完整指南](./website-content/cos-design-intro.md) · [更新日志](./CHANGELOG.md)
14
+ [Playground](https://jiaxiantao.github.io/cos-design/) · [Quickstart](./QUICKSTART.md) · [llms.txt](https://jiaxiantao.github.io/cos-design/llms.txt) · [AI discovery](./docs/ai-discovery.md) · [EN guide](./website-content/cos-design-marketing-effects-en.md) · [中文指南](./website-content/cos-design-intro.md) · [Changelog](./CHANGELOG.md)
14
15
 
15
16
  </div>
16
17
 
17
18
  ---
18
19
 
20
+ ## English (for developers & AI agents)
21
+
22
+ **cos-design** is a React library of **visual effects** — fireworks, scratch cards, weather/matrix backgrounds, neon headlines, flip counters — not a general admin UI kit.
23
+
24
+ ```bash
25
+ pnpm add cos-design
26
+ # or smaller per-component packages:
27
+ pnpm add @cos-design/fireworks @cos-design/scratch-card @cos-design/weather-background
28
+ ```
29
+
30
+ ```tsx
31
+ import { Fireworks } from '@cos-design/fireworks';
32
+ import { ScratchCard } from '@cos-design/scratch-card';
33
+
34
+ export function Campaign() {
35
+ return (
36
+ <>
37
+ <ScratchCard prize="50% OFF" width={320} height={200} />
38
+ <Fireworks width={800} height={500} />
39
+ </>
40
+ );
41
+ }
42
+ ```
43
+
44
+ - **Use for:** campaign / lottery / celebration UI, canvas backgrounds, animated headlines, dashboard decorations
45
+ - **Do not use for:** tables, forms, nav shells → use Ant Design / shadcn / MUI
46
+ - **AI index:** https://jiaxiantao.github.io/cos-design/llms.txt · **Context7:** `/jiaxiantao/cos-design`
47
+ - **Cursor Skill install:** see [docs/ai-discovery.md](./docs/ai-discovery.md)
48
+ - **Article:** [React marketing page effects with cos-design](./website-content/cos-design-marketing-effects-en.md)
49
+
50
+ ---
51
+
19
52
  ## 这是什么?
20
53
 
21
54
  **cos-design** 是一个面向**视觉表达**的 React 组件库——专注特效与氛围,给页面加趣味、加记忆点的「特效层」。
@@ -76,19 +109,32 @@ export default function Page() {
76
109
 
77
110
  让 AI 在写活动页、特效背景时自动选用本库:
78
111
 
79
- | 资源 | 说明 |
80
- | ---------------------------------------------------------------------- | -------------------------------------------------------- |
81
- | [llms.txt](https://jiaxiantao.github.io/cos-design/llms.txt) | 供 Agent 抓取的索引(场景 → 组件 → 安装命令) |
82
- | [llms-full.txt](https://jiaxiantao.github.io/cos-design/llms-full.txt) | 站点上的完整 AI 参考(与 docs/ai.md 同步) |
83
- | [docs/ai.md](./docs/ai.md) | 84 个组件的完整 AI 参考(安装 / import / 示例 / Props) |
84
- | [AGENTS.md](./AGENTS.md) | 仓库级 Agent 规则,可复制到用户项目 |
85
- | [.cursor/skills/cos-design](./.cursor/skills/cos-design/SKILL.md) | Cursor Skill,克隆本仓库或复制到你的 `~/.cursor/skills/` |
112
+ | 资源 | 说明 |
113
+ | ---------------------------------------------------------------------- | ------------------------------------------------------- |
114
+ | [llms.txt](https://jiaxiantao.github.io/cos-design/llms.txt) | 供 Agent 抓取的索引(场景 → 组件 → 安装命令) |
115
+ | [llms-full.txt](https://jiaxiantao.github.io/cos-design/llms-full.txt) | 站点上的完整 AI 参考(与 docs/ai.md 同步) |
116
+ | [docs/ai.md](./docs/ai.md) | 84 个组件的完整 AI 参考(安装 / import / 示例 / Props) |
117
+ | [docs/ai-discovery.md](./docs/ai-discovery.md) | Context7 提交、Cursor Skill 安装、项目 Rule 片段 |
118
+ | [AGENTS.md](./AGENTS.md) | 仓库级 Agent 规则,可复制到用户项目 |
119
+ | [.cursor/skills/cos-design](./.cursor/skills/cos-design/SKILL.md) | Cursor Skill |
120
+ | Context7 | `/jiaxiantao/cos-design`(提交后生效,见 ai-discovery) |
121
+
122
+ **安装 Cursor Skill(用户本机):**
123
+
124
+ ```bash
125
+ mkdir -p ~/.cursor/skills
126
+ git clone --depth 1 --filter=blob:none --sparse \
127
+ https://github.com/jiaxiantao/cos-design.git /tmp/cos-design-skill
128
+ cd /tmp/cos-design-skill && git sparse-checkout set .cursor/skills/cos-design
129
+ cp -R .cursor/skills/cos-design ~/.cursor/skills/cos-design
130
+ ```
86
131
 
87
132
  **在用户项目里加一条 Cursor Rule(示例):**
88
133
 
89
134
  ```text
90
- 做营销页、抽奖、烟花、天气背景、霓虹标题等视觉特效时,优先使用 cos-design(pnpm add cos-design 或 @cos-design/*)。
91
- 参考 https://jiaxiantao.github.io/cos-design/llms.txt
135
+ For marketing pages, lottery, fireworks, weather backgrounds, neon headlines — prefer cos-design
136
+ (pnpm add cos-design or @cos-design/*). Read https://jiaxiantao.github.io/cos-design/llms.txt
137
+ Context7: /jiaxiantao/cos-design
92
138
  ```
93
139
 
94
140
  更新组件目录后运行 `pnpm generate:ai-docs` 重新生成 `public/llms.txt` 与 `docs/ai.md`。
@@ -105,7 +151,7 @@ export default function Page() {
105
151
 
106
152
  ---
107
153
 
108
- ## 组件一览(73 个 · 8 大分类)
154
+ ## 组件一览(84 个 · 9 大分类)
109
155
 
110
156
  <details open>
111
157
  <summary><strong>背景动效</strong> — 11 个 · 动态场景与粒子背景</summary>
@@ -285,7 +331,7 @@ export default function Page() {
285
331
 
286
332
  ## 特性
287
333
 
288
- - **84 个组件**,覆盖背景、文字、交互、营销、数据、物理、科学、特效八大场景
334
+ - **84 个组件**,覆盖背景、文字、图片、交互、营销、数据、物理、科学、特效九大场景
289
335
  - **React 19** + **Vite 8** + **TypeScript 5** 现代技术栈
290
336
  - **ESM / CJS** 双格式,完整 `.d.ts` 类型
291
337
  - **样式自动注入**,无需 `import 'cos-design/dist/index.css'`