cos-design 3.7.2 → 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 +66 -0
- package/README.md +94 -27
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +5835 -2930
- package/dist/src/components/charge/index.d.ts +2 -0
- package/dist/src/components/confetti/index.d.ts +2 -0
- package/dist/src/components/fireworks/index.d.ts +2 -0
- package/dist/src/components/index.d.ts +26 -4
- package/dist/src/components/photoAlbum/types.d.ts +2 -0
- package/dist/src/components/photoCarousel/index.d.ts +9 -0
- package/dist/src/components/photoCarousel/types.d.ts +49 -0
- package/dist/src/components/photoClothesline/constants.d.ts +44 -0
- package/dist/src/components/photoClothesline/layout.d.ts +23 -0
- package/dist/src/components/photoClothesline/math.d.ts +6 -0
- package/dist/src/components/photoClothesline/model.d.ts +110 -0
- package/dist/src/components/photoClothesline/ropePath.d.ts +5 -0
- package/dist/src/components/photoClothesline/simulation.d.ts +46 -0
- package/dist/src/components/photoClothesline/types.d.ts +2 -0
- package/dist/src/components/photoFilmstrip/index.d.ts +5 -0
- package/dist/src/components/photoFilmstrip/types.d.ts +43 -0
- package/dist/src/components/photoFridge/index.d.ts +5 -0
- package/dist/src/components/photoFridge/types.d.ts +41 -0
- package/dist/src/components/photoLantern/accessories.d.ts +4 -0
- package/dist/src/components/photoLantern/constants.d.ts +5 -0
- package/dist/src/components/photoLantern/dispose.d.ts +4 -0
- package/dist/src/components/photoLantern/geometry.d.ts +5 -0
- package/dist/src/components/photoLantern/index.d.ts +5 -0
- package/dist/src/components/photoLantern/materials.d.ts +9 -0
- package/dist/src/components/photoLantern/scene.d.ts +32 -0
- package/dist/src/components/photoLantern/textures.d.ts +9 -0
- package/dist/src/components/photoLantern/types.d.ts +61 -0
- package/dist/src/components/photoLightbox/index.d.ts +5 -0
- package/dist/src/components/photoLightbox/types.d.ts +39 -0
- package/dist/src/components/photoPolaroid/index.d.ts +5 -0
- package/dist/src/components/photoPolaroid/types.d.ts +39 -0
- package/dist/src/components/photoPostcard/index.d.ts +8 -0
- package/dist/src/components/photoPostcard/types.d.ts +45 -0
- package/dist/src/components/photoPrism/index.d.ts +9 -0
- package/dist/src/components/photoPrism/types.d.ts +39 -0
- package/dist/src/components/photoScroll/index.d.ts +9 -0
- package/dist/src/components/photoScroll/types.d.ts +43 -0
- package/dist/src/components/photoTunnel/index.d.ts +9 -0
- package/dist/src/components/photoTunnel/types.d.ts +43 -0
- package/dist/src/components/photoViewMaster/index.d.ts +9 -0
- package/dist/src/components/photoViewMaster/types.d.ts +47 -0
- package/dist/src/components/redPacketRain/index.d.ts +17 -1
- package/dist/src/components/scratchCard/index.d.ts +9 -1
- package/dist/src/components/slotMachine/index.d.ts +13 -1
- package/dist/src/components/turntable/index.d.ts +9 -1
- package/package.json +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,72 @@ 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
|
+
|
|
35
|
+
## [3.7.3] - 2026-08-03
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- 新增图片预览分类 `photo`,并将 `PhotoAlbum` / `PhotoLantern` / `PhotoClothesline` 归入该类
|
|
40
|
+
- 新增 `PhotoFilmstrip` 胶卷条:横向齿孔胶卷、拖拽惯性与整帧吸附
|
|
41
|
+
- 新增 `PhotoPolaroid` 拍立得堆:桌面散落、拖拽置顶、松手留位
|
|
42
|
+
- 新增 `PhotoLightbox` 灯箱透片:发光灯箱上横向拖出切换
|
|
43
|
+
- 新增 `PhotoCarousel` 旋转木马托盘:环形立照、拖拽环绕与空闲自转
|
|
44
|
+
- 新增 `PhotoPrism` 棱镜立方:CSS 3D 六面贴图、拖拽翻滚与空闲自转
|
|
45
|
+
- 新增 `PhotoScroll` 卷轴照片:中式手卷、横向拖拽惯性与整帧吸附
|
|
46
|
+
- 新增 `PhotoPostcard` 旅行明信片:正反面翻转、横向拖拽切换
|
|
47
|
+
- 新增 `PhotoViewMaster` 观景器圆盘:玩具圆盘旋转、惯性吸附与空闲自转
|
|
48
|
+
- 新增 `PhotoFridge` 冰箱磁贴墙:散落磁贴、拖拽置顶并留位
|
|
49
|
+
- 新增 `PhotoTunnel` 纵深隧道:Z 轴穿行、惯性吸附与景深虚化
|
|
50
|
+
- 新增 `PhotoLantern` 走马灯图片预览:基于 Three.js 的六面灯笼、空闲顺时针自转、拖拽跟手旋转与惯性、灯芯暖光自然摆动
|
|
51
|
+
|
|
52
|
+
### Changed
|
|
53
|
+
|
|
54
|
+
- `PhotoLantern` 由 CSS 3D 改为 Three.js 实现,立体感与光照更真实;`three` 为 peer 依赖
|
|
55
|
+
- `PhotoClothesline` 拆分为 layout / simulation 等模块,交互与视觉保持不变
|
|
56
|
+
- `SlotMachine` 支持 `spinDuration`,并加固滚轮错峰停轮
|
|
57
|
+
- `Turntable` 小幅交互修正
|
|
58
|
+
- @cos-design/photo-carousel: 新增 3.7.3
|
|
59
|
+
- @cos-design/photo-clothesline: 3.7.2 → 3.7.3
|
|
60
|
+
- @cos-design/photo-filmstrip: 新增 3.7.3
|
|
61
|
+
- @cos-design/photo-fridge: 新增 3.7.3
|
|
62
|
+
- @cos-design/photo-lantern: 新增 3.7.3
|
|
63
|
+
- @cos-design/photo-lightbox: 新增 3.7.3
|
|
64
|
+
- @cos-design/photo-polaroid: 新增 3.7.3
|
|
65
|
+
- @cos-design/photo-postcard: 新增 3.7.3
|
|
66
|
+
- @cos-design/photo-prism: 新增 3.7.3
|
|
67
|
+
- @cos-design/photo-scroll: 新增 3.7.3
|
|
68
|
+
- @cos-design/photo-tunnel: 新增 3.7.3
|
|
69
|
+
- @cos-design/photo-view-master: 新增 3.7.3
|
|
70
|
+
- @cos-design/slot-machine: 3.5.3 → 3.5.4
|
|
71
|
+
- @cos-design/turntable: 3.5.3 → 3.5.4
|
|
72
|
+
- cos-design: 聚合包更新至 3.7.3
|
|
73
|
+
|
|
8
74
|
## [3.7.2] - 2026-07-31
|
|
9
75
|
|
|
10
76
|
### Added
|
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
# cos-design
|
|
4
4
|
|
|
5
|
-
**
|
|
5
|
+
**84 React visual-effect components** for marketing pages, brand landings, and creative showcases
|
|
6
|
+
**84 个 React 视觉特效组件 · 活动页 / 品牌页 / 创意展示开箱即用**
|
|
6
7
|
|
|
7
8
|
[](https://github.com/jiaxiantao/cos-design/actions/workflows/ci.yml)
|
|
8
9
|
[](https://www.npmjs.com/package/cos-design)
|
|
@@ -10,12 +11,44 @@
|
|
|
10
11
|
[](https://react.dev/)
|
|
11
12
|
[](https://www.typescriptlang.org/)
|
|
12
13
|
|
|
13
|
-
[
|
|
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 组件库——专注特效与氛围,给页面加趣味、加记忆点的「特效层」。
|
|
@@ -29,7 +62,7 @@
|
|
|
29
62
|
| 数据大屏 | 翻牌器、数字递增、仪表盘、关系网络图 |
|
|
30
63
|
| 创意作品集 | 牛顿摆、DNA 螺旋、迷宫生成、生命游戏 |
|
|
31
64
|
|
|
32
|
-
> 从背景到物理、从文字到营销,
|
|
65
|
+
> 从背景到物理、从文字到营销,84 个组件刚好组成一套完整的「视觉工具箱」。
|
|
33
66
|
|
|
34
67
|
---
|
|
35
68
|
|
|
@@ -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
|
-
| [
|
|
85
|
-
| [.
|
|
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
|
-
|
|
91
|
-
|
|
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
|
-
## 组件一览(
|
|
154
|
+
## 组件一览(84 个 · 9 大分类)
|
|
109
155
|
|
|
110
156
|
<details open>
|
|
111
157
|
<summary><strong>背景动效</strong> — 11 个 · 动态场景与粒子背景</summary>
|
|
@@ -157,21 +203,42 @@ export default function Page() {
|
|
|
157
203
|
</details>
|
|
158
204
|
|
|
159
205
|
<details>
|
|
160
|
-
<summary><strong
|
|
206
|
+
<summary><strong>图片预览</strong> — 13 个 · 物件隐喻式图片浏览</summary>
|
|
207
|
+
|
|
208
|
+
<br>
|
|
209
|
+
|
|
210
|
+
| 组件 | 说明 |
|
|
211
|
+
| ------------------ | ------------------ |
|
|
212
|
+
| `PhotoAlbum` | 真实翻页相册 |
|
|
213
|
+
| `PhotoLantern` | 走马灯(Three.js) |
|
|
214
|
+
| `PhotoClothesline` | 晾绳照片墙 |
|
|
215
|
+
| `PhotoFilmstrip` | 胶卷条 |
|
|
216
|
+
| `PhotoPolaroid` | 拍立得堆 |
|
|
217
|
+
| `PhotoLightbox` | 灯箱透片 |
|
|
218
|
+
| `PhotoCarousel` | 旋转木马托盘 |
|
|
219
|
+
| `PhotoPrism` | 棱镜立方 |
|
|
220
|
+
| `PhotoScroll` | 卷轴照片 |
|
|
221
|
+
| `PhotoPostcard` | 旅行明信片 |
|
|
222
|
+
| `PhotoViewMaster` | 观景器圆盘 |
|
|
223
|
+
| `PhotoFridge` | 冰箱磁贴墙 |
|
|
224
|
+
| `PhotoTunnel` | 纵深隧道 |
|
|
225
|
+
|
|
226
|
+
</details>
|
|
227
|
+
|
|
228
|
+
<details>
|
|
229
|
+
<summary><strong>交互玩具</strong> — 7 个 · 鼠标驱动的趣味反馈</summary>
|
|
161
230
|
|
|
162
231
|
<br>
|
|
163
232
|
|
|
164
|
-
| 组件
|
|
165
|
-
|
|
|
166
|
-
| `WaveButton`
|
|
167
|
-
| `Spotlight`
|
|
168
|
-
| `MagneticButton`
|
|
169
|
-
| `HolographicCard`
|
|
170
|
-
| `
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `CursorTrail` | 光标拖尾 |
|
|
174
|
-
| `LiquidGlass` | 液态毛玻璃 |
|
|
233
|
+
| 组件 | 说明 |
|
|
234
|
+
| ----------------- | ------------ |
|
|
235
|
+
| `WaveButton` | 水波扩散按钮 |
|
|
236
|
+
| `Spotlight` | 手电筒照亮 |
|
|
237
|
+
| `MagneticButton` | 磁吸按钮 |
|
|
238
|
+
| `HolographicCard` | 全息反光卡片 |
|
|
239
|
+
| `ClickSpark` | 点击火花 |
|
|
240
|
+
| `CursorTrail` | 光标拖尾 |
|
|
241
|
+
| `LiquidGlass` | 液态毛玻璃 |
|
|
175
242
|
|
|
176
243
|
</details>
|
|
177
244
|
|
|
@@ -264,7 +331,7 @@ export default function Page() {
|
|
|
264
331
|
|
|
265
332
|
## 特性
|
|
266
333
|
|
|
267
|
-
- **
|
|
334
|
+
- **84 个组件**,覆盖背景、文字、图片、交互、营销、数据、物理、科学、特效九大场景
|
|
268
335
|
- **React 19** + **Vite 8** + **TypeScript 5** 现代技术栈
|
|
269
336
|
- **ESM / CJS** 双格式,完整 `.d.ts` 类型
|
|
270
337
|
- **样式自动注入**,无需 `import 'cos-design/dist/index.css'`
|
|
@@ -285,7 +352,7 @@ npm run setup # 安装依赖(绕过 corepack 问题)
|
|
|
285
352
|
npx --yes pnpm@9 dev # 启动 Playground
|
|
286
353
|
```
|
|
287
354
|
|
|
288
|
-
访问 **http://localhost:4000** — 按分类浏览全部
|
|
355
|
+
访问 **http://localhost:4000** — 按分类浏览全部 84 个组件,右侧可查看与复制示例代码。
|
|
289
356
|
|
|
290
357
|
---
|
|
291
358
|
|