cos-design 3.0.4 → 3.1.0

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 (3) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +21 -2
  3. package/package.json +3 -1
package/CHANGELOG.md CHANGED
@@ -5,6 +5,21 @@ 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.1.0] - 2026-06-23
9
+
10
+ ### Added
11
+
12
+ - Playground **快速开始** 页面(`#/quickstart`)与仓库根目录 `QUICKSTART.md`
13
+ - 组件页 **实时编辑代码**(`react-live`),修改后预览立即更新
14
+ - 各组件 **配置参数** 表格,由 `pnpm extract-props` 从源码自动生成
15
+ - 顶栏 **GitHub** 图标外链仓库
16
+
17
+ ### Changed
18
+
19
+ - 组件页「编辑代码」打开时自动滚动至编辑器
20
+ - 配置参数展示在页面底部(预览 / 编辑区下方)
21
+ - README 增加快速开始入口与使用注意摘要
22
+
8
23
  ## [3.0.4] - 2026-06-23
9
24
 
10
25
  ### Fixed
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  [![React](https://img.shields.io/badge/React-19-61dafb)](https://react.dev/)
11
11
  [![TypeScript](https://img.shields.io/badge/TypeScript-5-3178c6)](https://www.typescriptlang.org/)
12
12
 
13
- [在线预览](https://jiaxiantao.github.io/cos-design/) · [v3.0 发布博客](./website-content/cos-design-v3-release.md) · [完整指南](./website-content/cos-design-intro.md) · [更新日志](./CHANGELOG.md)
13
+ [在线预览](https://jiaxiantao.github.io/cos-design/) · [快速开始](./QUICKSTART.md) · [v3.0 发布博客](./website-content/cos-design-v3-release.md) · [完整指南](./website-content/cos-design-intro.md) · [更新日志](./CHANGELOG.md)
14
14
 
15
15
  </div>
16
16
 
@@ -33,12 +33,18 @@
33
33
 
34
34
  ---
35
35
 
36
- ## 30 秒上手
36
+ ## 快速开始
37
+
38
+ > 完整说明见 **[QUICKSTART.md](./QUICKSTART.md)** · Playground 内访问 **#/quickstart**
39
+
40
+ ### 安装
37
41
 
38
42
  ```bash
39
43
  pnpm add cos-design
40
44
  ```
41
45
 
46
+ ### 最简示例
47
+
42
48
  ```tsx
43
49
  import { Fireworks, ScrambleText, ScratchCard } from 'cos-design';
44
50
 
@@ -55,6 +61,16 @@ export default function Page() {
55
61
 
56
62
  无需手动引入 CSS,样式自动注入。完整 TypeScript 类型开箱即用。
57
63
 
64
+ ### 使用注意(摘要)
65
+
66
+ | 注意点 | 说明 |
67
+ | -------- | --------------------------------------------------------------- |
68
+ | **SSR** | Canvas 组件需在 Next.js 等框架中 `dynamic(..., { ssr: false })` |
69
+ | **尺寸** | Canvas 组件需明确 `width` / `height`,父容器也应有可见高度 |
70
+ | **密度** | 建议每页「一个强背景 + 若干局部交互」,避免多 Canvas 抢性能 |
71
+ | **权限** | `AudioVisualizer` 开启麦克风时需 HTTPS 与用户授权 |
72
+ | **省电** | 标签页隐藏时,多数 Canvas 动画自动暂停 |
73
+
58
74
  ---
59
75
 
60
76
  ## 组件一览(49 个 · 6 大分类)
@@ -211,6 +227,8 @@ npx --yes pnpm@9 dev # 启动 Playground
211
227
 
212
228
  ## 使用注意
213
229
 
230
+ 详见 [QUICKSTART.md](./QUICKSTART.md)。以下为高频场景摘要:
231
+
214
232
  **Canvas 组件请客户端渲染**(依赖 `window` / `canvas` / `requestAnimationFrame`):
215
233
 
216
234
  ```tsx
@@ -227,6 +245,7 @@ const Fireworks = dynamic(() => import('cos-design').then((m) => m.Fireworks), {
227
245
 
228
246
  | 文档 | 内容 |
229
247
  | ----------------------------------------------------------- | -------------------------------- |
248
+ | [快速开始](./QUICKSTART.md) | 安装、用法、注意事项与常见问题 |
230
249
  | [v3.0 发布博客](./website-content/cos-design-v3-release.md) | 重大升级解读、分类体系、技术实现 |
231
250
  | [完整介绍与实践指南](./website-content/cos-design-intro.md) | 架构、使用规则、组件详解 |
232
251
  | [CHANGELOG](./CHANGELOG.md) | 版本更新记录 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cos-design",
3
- "version": "3.0.4",
3
+ "version": "3.1.0",
4
4
  "description": "A React component library built with Vite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -70,6 +70,7 @@
70
70
  "prettier": "^3.8.4",
71
71
  "react": "^19.2.7",
72
72
  "react-dom": "^19.2.7",
73
+ "react-live": "^4.1.8",
73
74
  "react-router": "^7.18.0",
74
75
  "react-router-dom": "^7.18.0",
75
76
  "stylelint": "^17.13.0",
@@ -99,6 +100,7 @@
99
100
  "build": "tsc -p tsconfig.build.json --noEmit && vite build --mode lib",
100
101
  "build:demo": "vite build",
101
102
  "build:pages": "vite build --mode pages",
103
+ "extract-props": "node scripts/extract-component-props.mjs",
102
104
  "preview": "vite preview",
103
105
  "pub": "pnpm build && pnpm publish",
104
106
  "lint": "eslint \"src/**/*.{ts,tsx}\" && stylelint \"src/**/*.less\"",