cos-design 3.6.0 → 3.7.1

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 (34) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +121 -61
  3. package/dist/index.cjs +3 -3
  4. package/dist/index.css +1 -1
  5. package/dist/index.js +2355 -1373
  6. package/dist/src/components/blurText/index.d.ts +21 -0
  7. package/dist/src/components/burnAway/index.d.ts +2 -0
  8. package/dist/src/components/circularText/index.d.ts +17 -0
  9. package/dist/src/components/confetti/index.d.ts +2 -0
  10. package/dist/src/components/countdown/index.d.ts +13 -0
  11. package/dist/src/components/cursorTrail/index.d.ts +2 -0
  12. package/dist/src/components/curvedLoop/index.d.ts +19 -0
  13. package/dist/src/components/diceRoll/index.d.ts +6 -0
  14. package/dist/src/components/fireworks/index.d.ts +2 -0
  15. package/dist/src/components/fuzzyText/index.d.ts +21 -0
  16. package/dist/src/components/gameOfLife/index.d.ts +8 -0
  17. package/dist/src/components/index.d.ts +16 -0
  18. package/dist/src/components/networkGraph/index.d.ts +2 -0
  19. package/dist/src/components/particleNetwork/index.d.ts +2 -0
  20. package/dist/src/components/photoAlbum/index.d.ts +5 -0
  21. package/dist/src/components/photoAlbum/types.d.ts +57 -0
  22. package/dist/src/components/progressChest/index.d.ts +2 -0
  23. package/dist/src/components/redPacketRain/index.d.ts +6 -0
  24. package/dist/src/components/rotatingText/index.d.ts +19 -0
  25. package/dist/src/components/sandFall/index.d.ts +4 -0
  26. package/dist/src/components/scratchCard/index.d.ts +2 -0
  27. package/dist/src/components/shinyText/index.d.ts +17 -0
  28. package/dist/src/components/slotMachine/index.d.ts +8 -0
  29. package/dist/src/components/smokeFog/index.d.ts +2 -0
  30. package/dist/src/components/springMass/index.d.ts +2 -0
  31. package/dist/src/components/trueFocus/index.d.ts +25 -0
  32. package/dist/src/components/turntable/index.d.ts +4 -0
  33. package/dist/src/components/weatherBackground/types.d.ts +4 -0
  34. package/package.json +11 -3
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ export interface BlurTextProps {
3
+ /** 显示文字 */
4
+ text?: string;
5
+ /** 按词或按字拆分 */
6
+ animateBy?: 'words' | 'letters';
7
+ /** 入场方向 */
8
+ direction?: 'top' | 'bottom';
9
+ /** 相邻单元延迟(毫秒) */
10
+ stagger?: number;
11
+ /** 单单元动画时长(毫秒) */
12
+ duration?: number;
13
+ /** 字号 */
14
+ fontSize?: number;
15
+ /** 颜色 */
16
+ color?: string;
17
+ /** 动画完成后回调 */
18
+ onAnimationComplete?: () => void;
19
+ }
20
+ declare const BlurText: React.FC<BlurTextProps>;
21
+ export default BlurText;
@@ -6,6 +6,8 @@ export interface BurnAwayProps {
6
6
  fontSize?: number;
7
7
  /** 燃烧完成回调 */
8
8
  onComplete?: () => void;
9
+ /** 燃烧完成提示 */
10
+ completedText?: string;
9
11
  }
10
12
  declare const BurnAway: React.FC<BurnAwayProps>;
11
13
  export default BurnAway;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface CircularTextProps {
3
+ /** 环绕文字 */
4
+ text?: string;
5
+ /** 一圈旋转时长(秒) */
6
+ spinDuration?: number;
7
+ /** 悬停行为 */
8
+ onHover?: 'slowDown' | 'speedUp' | 'pause' | 'goBonkers';
9
+ /** 字号 */
10
+ fontSize?: number;
11
+ /** 圆环半径(像素) */
12
+ radius?: number;
13
+ /** 文字颜色 */
14
+ color?: string;
15
+ }
16
+ declare const CircularText: React.FC<CircularTextProps>;
17
+ export default CircularText;
@@ -6,6 +6,8 @@ export interface ConfettiProps {
6
6
  auto?: boolean;
7
7
  /** 每次喷射粒子数,默认 120 */
8
8
  particleCount?: number;
9
+ /** 画布操作提示 */
10
+ hint?: string;
9
11
  }
10
12
  export interface ConfettiHandle {
11
13
  /** 手动触发彩纸喷射 */
@@ -8,6 +8,19 @@ export interface CountdownProps {
8
8
  showLabels?: boolean;
9
9
  /** 主色 */
10
10
  color?: string;
11
+ /** 单位标签,可用于国际化 */
12
+ labels?: Partial<Record<keyof Omit<TimeLeft, 'total'>, string>>;
13
+ /** 目标时间无效时的提示 */
14
+ invalidText?: string;
15
+ /** 倒计时结束提示 */
16
+ endedText?: string;
17
+ }
18
+ interface TimeLeft {
19
+ days: number;
20
+ hours: number;
21
+ minutes: number;
22
+ seconds: number;
23
+ total: number;
11
24
  }
12
25
  declare const Countdown: React.FC<CountdownProps>;
13
26
  export default Countdown;
@@ -6,6 +6,8 @@ export interface CursorTrailProps {
6
6
  length?: number;
7
7
  width?: number;
8
8
  height?: number;
9
+ /** 操作提示 */
10
+ hint?: string;
9
11
  }
10
12
  declare const CursorTrail: React.FC<CursorTrailProps>;
11
13
  export default CursorTrail;
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ export interface CurvedLoopProps {
3
+ /** 跑马灯文案 */
4
+ text?: string;
5
+ /** 滚动速度(像素/帧) */
6
+ speed?: number;
7
+ /** 曲线幅度 */
8
+ curveAmount?: number;
9
+ /** 初始方向 */
10
+ direction?: 'left' | 'right';
11
+ /** 是否可拖拽 */
12
+ interactive?: boolean;
13
+ /** 文字颜色 */
14
+ color?: string;
15
+ /** 字号(相对 SVG) */
16
+ fontSize?: number;
17
+ }
18
+ declare const CurvedLoop: React.FC<CurvedLoopProps>;
19
+ export default CurvedLoop;
@@ -4,6 +4,12 @@ export interface DiceRollProps {
4
4
  onRoll?: (value: number) => void;
5
5
  /** 骰子面数,默认 6 */
6
6
  sides?: 6;
7
+ /** 掷骰按钮文案 */
8
+ rollText?: string;
9
+ /** 掷骰进行中的文案 */
10
+ rollingText?: string;
11
+ /** 点数结果前缀 */
12
+ resultPrefix?: string;
7
13
  }
8
14
  declare const DiceRoll: React.FC<DiceRollProps>;
9
15
  export default DiceRoll;
@@ -4,6 +4,8 @@ export interface FireworksProps {
4
4
  height?: number;
5
5
  /** 是否自动燃放,默认 true */
6
6
  auto?: boolean;
7
+ /** 画布操作提示 */
8
+ hint?: string;
7
9
  }
8
10
  export interface FireworksHandle {
9
11
  /** 手动燃放烟花,可指定 x 坐标 */
@@ -0,0 +1,21 @@
1
+ import { default as React } from 'react';
2
+ export interface FuzzyTextProps {
3
+ /** 显示文字 */
4
+ text?: string;
5
+ /** 字号 */
6
+ fontSize?: number;
7
+ /** 字重 */
8
+ fontWeight?: number;
9
+ /** 颜色 */
10
+ color?: string;
11
+ /** 基础抖动强度 0~1 */
12
+ baseIntensity?: number;
13
+ /** 悬停抖动强度 0~1 */
14
+ hoverIntensity?: number;
15
+ /** 是否启用悬停增强 */
16
+ enableHover?: boolean;
17
+ /** 抖动像素范围 */
18
+ fuzzRange?: number;
19
+ }
20
+ declare const FuzzyText: React.FC<FuzzyTextProps>;
21
+ export default FuzzyText;
@@ -12,6 +12,14 @@ export interface GameOfLifeProps {
12
12
  aliveColor?: string;
13
13
  /** 网格线颜色 */
14
14
  gridColor?: string;
15
+ /** 控制栏文案 */
16
+ labels?: Partial<{
17
+ generation: string;
18
+ alive: string;
19
+ pause: string;
20
+ play: string;
21
+ randomize: string;
22
+ }>;
15
23
  }
16
24
  declare const GameOfLife: React.FC<GameOfLifeProps>;
17
25
  export default GameOfLife;
@@ -1,5 +1,7 @@
1
1
  export { default as BarcodeScan } from './barcodeScan';
2
2
  export type { BarcodeScanProps } from './barcodeScan';
3
+ export { default as BlurText } from './blurText';
4
+ export type { BlurTextProps } from './blurText';
3
5
  export { default as BurnAway } from './burnAway';
4
6
  export type { BurnAwayProps } from './burnAway';
5
7
  export { default as Aurora } from './aurora';
@@ -10,9 +12,13 @@ export { default as CanvasClock } from './canvasClock';
10
12
  export type { CanvasClockProps } from './canvasClock';
11
13
  export { default as Charge } from './charge';
12
14
  export type { ChargeProps } from './charge';
15
+ export { default as CircularText } from './circularText';
16
+ export type { CircularTextProps } from './circularText';
13
17
  export { default as ClickSpark } from './clickSpark';
14
18
  export type { ClickSparkProps } from './clickSpark';
15
19
  export { default as Confetti } from './confetti';
20
+ export { default as CurvedLoop } from './curvedLoop';
21
+ export type { CurvedLoopProps } from './curvedLoop';
16
22
  export { default as CyberGrid } from './cyberGrid';
17
23
  export type { CyberGridProps } from './cyberGrid';
18
24
  export type { ConfettiHandle, ConfettiProps } from './confetti';
@@ -33,6 +39,8 @@ export { default as Fireworks } from './fireworks';
33
39
  export type { FireworksHandle, FireworksProps } from './fireworks';
34
40
  export { default as FlipCounter } from './flipCounter';
35
41
  export type { CountUpProps } from './countUp';
42
+ export { default as FuzzyText } from './fuzzyText';
43
+ export type { FuzzyTextProps } from './fuzzyText';
36
44
  export { default as GradientFlow } from './gradientFlow';
37
45
  export type { GradientFlowProps } from './gradientFlow';
38
46
  export type { FlipCounterProps } from './flipCounter';
@@ -69,6 +77,8 @@ export type { NeonTextProps } from './neonText';
69
77
  export { default as OrbitalChart } from './orbitalChart';
70
78
  export type { OrbitalChartItem, OrbitalChartProps } from './orbitalChart';
71
79
  export { default as ParticleNetwork } from './particleNetwork';
80
+ export { default as PhotoAlbum } from './photoAlbum';
81
+ export type { PhotoAlbumItem, PhotoAlbumLabels, PhotoAlbumProps } from './photoAlbum';
72
82
  export { default as PlasmaBall } from './plasmaBall';
73
83
  export type { PlasmaBallProps } from './plasmaBall';
74
84
  export { default as SmokeFog } from './smokeFog';
@@ -91,8 +101,12 @@ export type { RedPacketRainProps } from './redPacketRain';
91
101
  export { default as ReturnCity } from './returnCity';
92
102
  export { default as RopeChain } from './ropeChain';
93
103
  export type { RopeChainProps } from './ropeChain';
104
+ export { default as RotatingText } from './rotatingText';
105
+ export type { RotatingTextProps } from './rotatingText';
94
106
  export { default as Speedometer } from './speedometer';
95
107
  export type { SpeedometerProps } from './speedometer';
108
+ export { default as ShinyText } from './shinyText';
109
+ export type { ShinyTextProps } from './shinyText';
96
110
  export { default as TimelinePulse } from './timelinePulse';
97
111
  export type { TimelinePulseProps } from './timelinePulse';
98
112
  export { default as RippleWater } from './rippleWater';
@@ -118,6 +132,8 @@ export type { TurntablePrize, TurntableProps } from './turntable';
118
132
  export { default as Turntable } from './turntable';
119
133
  export { default as TextMorph } from './textMorph';
120
134
  export type { TextMorphProps } from './textMorph';
135
+ export { default as TrueFocus } from './trueFocus';
136
+ export type { TrueFocusProps } from './trueFocus';
121
137
  export { default as Typewriter } from './typewriter';
122
138
  export type { TypewriterProps } from './typewriter';
123
139
  export { default as WaveButton } from './waveButton';
@@ -19,6 +19,8 @@ export interface NetworkGraphProps {
19
19
  linkColor?: string;
20
20
  /** 节点半径 */
21
21
  nodeRadius?: number;
22
+ /** 未悬停节点时的操作提示 */
23
+ hint?: string;
22
24
  }
23
25
  declare const NetworkGraph: React.FC<NetworkGraphProps>;
24
26
  export default NetworkGraph;
@@ -10,6 +10,8 @@ export interface ParticleNetworkProps {
10
10
  repelRadius?: number;
11
11
  /** 粒子颜色 */
12
12
  color?: string;
13
+ /** 操作提示 */
14
+ hint?: string;
13
15
  }
14
16
  declare const ParticleNetwork: React.FC<ParticleNetworkProps>;
15
17
  export default ParticleNetwork;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { PhotoAlbumProps } from './types';
3
+ declare const PhotoAlbum: React.FC<PhotoAlbumProps>;
4
+ export type { PhotoAlbumItem, PhotoAlbumLabels, PhotoAlbumProps } from './types';
5
+ export default PhotoAlbum;
@@ -0,0 +1,57 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface PhotoAlbumItem {
3
+ /** 图片地址 */
4
+ src: string;
5
+ /** 图片替代文本 */
6
+ alt?: string;
7
+ /** 照片标题 */
8
+ title?: string;
9
+ /** 照片说明 */
10
+ description?: string;
11
+ }
12
+ export interface PhotoAlbumLabels {
13
+ /** 上一页按钮标签 */
14
+ previous?: string;
15
+ /** 下一页按钮标签 */
16
+ next?: string;
17
+ /** 空相册提示 */
18
+ empty?: string;
19
+ /** 首页飞页主标题 */
20
+ flyleafTitle?: string;
21
+ /** 首页飞页副标题 */
22
+ flyleafSubtitle?: string;
23
+ /** 尾页飞页主标题 */
24
+ flyleafEndTitle?: string;
25
+ /** 尾页飞页副标题 */
26
+ flyleafEndSubtitle?: string;
27
+ }
28
+ export interface PhotoAlbumProps {
29
+ /** 相册照片列表 */
30
+ photos: PhotoAlbumItem[];
31
+ /** 相册宽度 */
32
+ width?: number | string;
33
+ /** 相册高度 */
34
+ height?: number | string;
35
+ /** 初始右页照片索引(摊开为左 index-1 / 右 index;每次翻页翻过一叶两面) */
36
+ initialIndex?: number;
37
+ /** 单次翻页动画时长(毫秒) */
38
+ pageTurnDuration?: number;
39
+ /** 照片填充方式 */
40
+ objectFit?: CSSProperties['objectFit'];
41
+ /** 是否显示页码 */
42
+ showPageNumber?: boolean;
43
+ /** 相纸颜色 */
44
+ pageColor?: string;
45
+ /** 封皮颜色 */
46
+ coverColor?: string;
47
+ /** 相册无障碍名称 */
48
+ ariaLabel?: string;
49
+ /** 内置文案 */
50
+ labels?: PhotoAlbumLabels;
51
+ /** 当前照片变化回调 */
52
+ onPageChange?: (index: number, photo: PhotoAlbumItem) => void;
53
+ /** 自定义类名 */
54
+ className?: string;
55
+ /** 自定义样式 */
56
+ style?: CSSProperties;
57
+ }
@@ -6,6 +6,8 @@ export interface ProgressChestProps {
6
6
  onOpen?: () => void;
7
7
  /** 标签文字 */
8
8
  label?: string;
9
+ /** 宝箱开启后的标签文字 */
10
+ openedLabel?: string;
9
11
  }
10
12
  declare const ProgressChest: React.FC<ProgressChestProps>;
11
13
  export default ProgressChest;
@@ -4,6 +4,12 @@ export interface RedPacketRainProps {
4
4
  duration?: number;
5
5
  /** 抢到红包回调 */
6
6
  onGrab?: (amount: number) => void;
7
+ /** 已抢金额标签 */
8
+ grabbedLabel?: string;
9
+ /** 红包雨结束提示 */
10
+ endedText?: string;
11
+ /** 操作提示 */
12
+ hint?: string;
7
13
  }
8
14
  declare const RedPacketRain: React.FC<RedPacketRainProps>;
9
15
  export default RedPacketRain;
@@ -0,0 +1,19 @@
1
+ import { default as React } from 'react';
2
+ export interface RotatingTextProps {
3
+ /** 轮播文案列表 */
4
+ texts?: string[];
5
+ /** 切换间隔(毫秒) */
6
+ interval?: number;
7
+ /** 字符错峰延迟(毫秒) */
8
+ stagger?: number;
9
+ /** 单字符动画时长(毫秒) */
10
+ duration?: number;
11
+ /** 字号 */
12
+ fontSize?: number;
13
+ /** 颜色 */
14
+ color?: string;
15
+ /** 高亮背景色 */
16
+ highlightColor?: string;
17
+ }
18
+ declare const RotatingText: React.FC<RotatingTextProps>;
19
+ export default RotatingText;
@@ -8,6 +8,10 @@ export interface SandFallProps {
8
8
  colors?: string[];
9
9
  /** 每帧生成粒子数 */
10
10
  spawnRate?: number;
11
+ /** 操作提示 */
12
+ hint?: string;
13
+ /** 清空按钮文案 */
14
+ clearText?: string;
11
15
  }
12
16
  declare const SandFall: React.FC<SandFallProps>;
13
17
  export default SandFall;
@@ -4,6 +4,8 @@ export interface ScratchCardProps {
4
4
  coverColor?: string;
5
5
  /** 奖品文字 */
6
6
  prize?: string;
7
+ /** 涂层上的提示文案 */
8
+ coverText?: string;
7
9
  /** 刮开完成回调 */
8
10
  onReveal?: () => void;
9
11
  width?: number;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ export interface ShinyTextProps {
3
+ /** 显示文字 */
4
+ text?: string;
5
+ /** 扫光周期(秒) */
6
+ speed?: number;
7
+ /** 文字底色 */
8
+ color?: string;
9
+ /** 高光色 */
10
+ shineColor?: string;
11
+ /** 字号 */
12
+ fontSize?: number;
13
+ /** 是否暂停动画 */
14
+ disabled?: boolean;
15
+ }
16
+ declare const ShinyText: React.FC<ShinyTextProps>;
17
+ export default ShinyText;
@@ -4,6 +4,14 @@ export interface SlotMachineProps {
4
4
  symbols?: string[];
5
5
  /** 旋转结束回调 */
6
6
  onSpinEnd?: (results: string[]) => void;
7
+ /** 开始按钮文案 */
8
+ startText?: string;
9
+ /** 旋转中的按钮文案 */
10
+ spinningText?: string;
11
+ /** 中奖提示 */
12
+ jackpotText?: string;
13
+ /** 普通结果前缀 */
14
+ resultPrefix?: string;
7
15
  }
8
16
  declare const SlotMachine: React.FC<SlotMachineProps>;
9
17
  export default SlotMachine;
@@ -16,6 +16,8 @@ export interface SmokeFogProps {
16
16
  disperseRadius?: number;
17
17
  /** 是否响应点击/触摸驱散,默认 true */
18
18
  interactive?: boolean;
19
+ /** 画布无障碍标签 */
20
+ ariaLabel?: string;
19
21
  }
20
22
  declare const SmokeFog: React.FC<SmokeFogProps>;
21
23
  export default SmokeFog;
@@ -12,6 +12,8 @@ export interface SpringMassProps {
12
12
  damping?: number;
13
13
  /** 主色 */
14
14
  color?: string;
15
+ /** 操作提示 */
16
+ hint?: string;
15
17
  }
16
18
  declare const SpringMass: React.FC<SpringMassProps>;
17
19
  export default SpringMass;
@@ -0,0 +1,25 @@
1
+ import { default as React } from 'react';
2
+ export interface TrueFocusProps {
3
+ /** 句子文案 */
4
+ sentence?: string;
5
+ /** 分词分隔符 */
6
+ separator?: string;
7
+ /** 是否仅 hover 聚焦 */
8
+ manualMode?: boolean;
9
+ /** 非聚焦词模糊强度(px) */
10
+ blurAmount?: number;
11
+ /** 焦点框颜色 */
12
+ borderColor?: string;
13
+ /** 焦点光晕颜色 */
14
+ glowColor?: string;
15
+ /** 切换动画时长(秒) */
16
+ animationDuration?: number;
17
+ /** 自动切换间歇(秒) */
18
+ pauseBetweenAnimations?: number;
19
+ /** 字号 */
20
+ fontSize?: number;
21
+ /** 文字颜色 */
22
+ color?: string;
23
+ }
24
+ declare const TrueFocus: React.FC<TrueFocusProps>;
25
+ export default TrueFocus;
@@ -14,6 +14,10 @@ export interface TurntableProps {
14
14
  spinRounds?: number;
15
15
  /** 抽奖按钮文案 */
16
16
  buttonText?: string;
17
+ /** 抽奖进行中的按钮文案 */
18
+ spinningText?: string;
19
+ /** 中奖结果前缀 */
20
+ resultPrefix?: string;
17
21
  /** 旋转结束回调 */
18
22
  onSpinEnd?: (prize: TurntablePrize, index: number) => void;
19
23
  }
@@ -51,6 +51,10 @@ export interface WeatherBackgroundProps {
51
51
  onLiveWeather?: (weather: WeatherType) => void;
52
52
  /** 外部受控 loading:在当前画面上叠加加载遮罩(live 模式定位/请求期间会自动显示,无需传入) */
53
53
  loading?: boolean;
54
+ /** 画布无障碍标签;不传时使用默认中文描述 */
55
+ ariaLabel?: string;
56
+ /** 加载状态文案 */
57
+ loadingText?: string;
54
58
  }
55
59
  export interface WeatherConfig {
56
60
  sky: [string, string];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cos-design",
3
- "version": "3.6.0",
3
+ "version": "3.7.1",
4
4
  "description": "A React component library built with Vite",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -33,8 +33,16 @@
33
33
  "cos-design",
34
34
  "react",
35
35
  "component-library",
36
- "vite",
37
- "typescript"
36
+ "visual-effects",
37
+ "canvas",
38
+ "animation",
39
+ "fireworks",
40
+ "scratch-card",
41
+ "lottery",
42
+ "marketing-page",
43
+ "landing-page",
44
+ "typescript",
45
+ "vite"
38
46
  ],
39
47
  "homepage": "https://jiaxiantao.github.io/cos-design/",
40
48
  "bugs": {