cos-design 3.7.3 → 3.7.5

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.
@@ -6,6 +6,8 @@ export interface ChargeProps {
6
6
  value?: number;
7
7
  /** 电量变化回调 */
8
8
  onChange?: (value: number) => void;
9
+ /** 电量首次到达 100% 时回调 */
10
+ onComplete?: () => void;
9
11
  /** 是否自动充电,默认 true */
10
12
  autoCharge?: boolean;
11
13
  /** 充电间隔(毫秒),默认 500 */
@@ -2,12 +2,16 @@ import { default as React } from 'react';
2
2
  export interface ConfettiProps {
3
3
  width?: number;
4
4
  height?: number;
5
+ /** 为 true 时铺满父容器(父级需有明确高度) */
6
+ fill?: boolean;
5
7
  /** 挂载后自动播放,默认 true */
6
8
  auto?: boolean;
7
9
  /** 每次喷射粒子数,默认 120 */
8
10
  particleCount?: number;
9
11
  /** 画布操作提示 */
10
12
  hint?: string;
13
+ /** 粒子全部消散后回调 */
14
+ onComplete?: () => void;
11
15
  }
12
16
  export interface ConfettiHandle {
13
17
  /** 手动触发彩纸喷射 */
@@ -2,10 +2,14 @@ import { default as React } from 'react';
2
2
  export interface FireworksProps {
3
3
  width?: number;
4
4
  height?: number;
5
+ /** 为 true 时铺满父容器(父级需有明确高度) */
6
+ fill?: boolean;
5
7
  /** 是否自动燃放,默认 true */
6
8
  auto?: boolean;
7
9
  /** 画布操作提示 */
8
10
  hint?: string;
11
+ /** 画面空闲(无火箭/粒子)时回调 */
12
+ onComplete?: () => void;
9
13
  }
10
14
  export interface FireworksHandle {
11
15
  /** 手动燃放烟花,可指定 x 坐标 */
@@ -121,7 +121,7 @@ export type { ProgressChestProps } from './progressChest';
121
121
  export { default as RadarScan } from './radarScan';
122
122
  export type { RadarScanProps } from './radarScan';
123
123
  export { default as RedPacketRain } from './redPacketRain';
124
- export type { RedPacketRainProps } from './redPacketRain';
124
+ export type { RedPacketRainHandle, RedPacketRainProps } from './redPacketRain';
125
125
  export { default as ReturnCity } from './returnCity';
126
126
  export { default as RopeChain } from './ropeChain';
127
127
  export type { RopeChainProps } from './ropeChain';
@@ -138,9 +138,9 @@ export type { RippleWaterProps } from './rippleWater';
138
138
  export { default as ScrambleText } from './scrambleText';
139
139
  export type { ScrambleTextProps } from './scrambleText';
140
140
  export { default as ScratchCard } from './scratchCard';
141
- export type { ScratchCardProps } from './scratchCard';
141
+ export type { ScratchCardHandle, ScratchCardProps } from './scratchCard';
142
142
  export { default as SlotMachine } from './slotMachine';
143
- export type { SlotMachineProps } from './slotMachine';
143
+ export type { SlotMachineHandle, SlotMachineProps } from './slotMachine';
144
144
  export { default as SandFall } from './sandFall';
145
145
  export type { SandFallProps } from './sandFall';
146
146
  export { default as SplitReveal } from './splitReveal';
@@ -152,7 +152,7 @@ export type { SpringMassProps } from './springMass';
152
152
  export { default as Spotlight } from './spotlight';
153
153
  export type { SpotlightProps } from './spotlight';
154
154
  export type { ReturnCityProps } from './returnCity';
155
- export type { TurntablePrize, TurntableProps } from './turntable';
155
+ export type { TurntableHandle, TurntablePrize, TurntableProps } from './turntable';
156
156
  export { default as Turntable } from './turntable';
157
157
  export { default as TextMorph } from './textMorph';
158
158
  export type { TextMorphProps } from './textMorph';
@@ -2,6 +2,8 @@ import { default as React } from 'react';
2
2
  export interface MatrixRainProps {
3
3
  width?: number;
4
4
  height?: number;
5
+ /** 为 true 时铺满父容器(父级需有明确高度) */
6
+ fill?: boolean;
5
7
  /** 列密度 0~1,默认 0.6 */
6
8
  density?: number;
7
9
  /** 主色调 */
@@ -2,6 +2,8 @@ import { default as React } from 'react';
2
2
  export interface ParticleNetworkProps {
3
3
  width?: number;
4
4
  height?: number;
5
+ /** 为 true 时铺满父容器(父级需有明确高度) */
6
+ fill?: boolean;
5
7
  /** 粒子数量 */
6
8
  particleCount?: number;
7
9
  /** 连线距离 */
@@ -50,6 +50,8 @@ export interface PhotoAlbumProps {
50
50
  labels?: PhotoAlbumLabels;
51
51
  /** 当前照片变化回调 */
52
52
  onPageChange?: (index: number, photo: PhotoAlbumItem) => void;
53
+ /** 当前照片变化回调别名(与其他 photo 组件对齐) */
54
+ onIndexChange?: (index: number, photo: PhotoAlbumItem) => void;
53
55
  /** 自定义类名 */
54
56
  className?: string;
55
57
  /** 自定义样式 */
@@ -37,7 +37,9 @@ export interface PhotoCarouselProps {
37
37
  /** 点击正面照片回调 */
38
38
  onPhotoClick?: (index: number, photo: PhotoCarouselItem) => void;
39
39
  /** 正对镜头的照片索引变化回调 */
40
- onFaceChange?: (index: number) => void;
40
+ onFaceChange?: (index: number, photo?: PhotoCarouselItem) => void;
41
+ /** 正对镜头照片变化回调别名(与其他 photo 组件对齐) */
42
+ onIndexChange?: (index: number, photo: PhotoCarouselItem) => void;
41
43
  /** 无障碍名称 */
42
44
  ariaLabel?: string;
43
45
  /** 自定义类名 */
@@ -56,6 +56,8 @@ export interface PhotoClotheslineProps {
56
56
  showCaption?: boolean;
57
57
  /** 初始居中显示的照片索引 */
58
58
  initialIndex?: number;
59
+ /** 居中照片变化回调(拖拽/惯性停稳后) */
60
+ onIndexChange?: (index: number, photo: PhotoClotheslineItem) => void;
59
61
  /** 点击照片回调 */
60
62
  onPhotoClick?: (index: number, photo: PhotoClotheslineItem) => void;
61
63
  /** 无障碍名称 */
@@ -48,6 +48,8 @@ export interface PhotoLanternProps {
48
48
  initialAngle?: number;
49
49
  /** 正面照片变化回调 */
50
50
  onFaceChange?: (index: number, photo: PhotoLanternItem | undefined) => void;
51
+ /** 正面照片变化回调别名(与其他 photo 组件对齐) */
52
+ onIndexChange?: (index: number, photo: PhotoLanternItem) => void;
51
53
  /** 点击照片回调 */
52
54
  onPhotoClick?: (index: number, photo: PhotoLanternItem) => void;
53
55
  /** 无障碍名称 */
@@ -1,9 +1,19 @@
1
1
  import { default as React } from 'react';
2
2
  export interface RedPacketRainProps {
3
+ /** 画布宽度,默认 400 */
4
+ width?: number;
5
+ /** 画布高度,默认 500 */
6
+ height?: number;
7
+ /** 为 true 时铺满父容器(父级需有明确高度) */
8
+ fill?: boolean;
3
9
  /** 持续时间(毫秒),默认 10000 */
4
10
  duration?: number;
11
+ /** 挂载后自动开始,默认 true */
12
+ auto?: boolean;
5
13
  /** 抢到红包回调 */
6
14
  onGrab?: (amount: number) => void;
15
+ /** 红包雨结束回调 */
16
+ onEnd?: () => void;
7
17
  /** 已抢金额标签 */
8
18
  grabbedLabel?: string;
9
19
  /** 红包雨结束提示 */
@@ -11,5 +21,13 @@ export interface RedPacketRainProps {
11
21
  /** 操作提示 */
12
22
  hint?: string;
13
23
  }
14
- declare const RedPacketRain: React.FC<RedPacketRainProps>;
24
+ export interface RedPacketRainHandle {
25
+ /** 重新开始一轮红包雨 */
26
+ start: () => void;
27
+ /** 立即结束 */
28
+ stop: () => void;
29
+ /** 结束并清零金额 */
30
+ reset: () => void;
31
+ }
32
+ declare const RedPacketRain: React.ForwardRefExoticComponent<RedPacketRainProps & React.RefAttributes<RedPacketRainHandle>>;
15
33
  export default RedPacketRain;
@@ -6,10 +6,18 @@ export interface ScratchCardProps {
6
6
  prize?: string;
7
7
  /** 涂层上的提示文案 */
8
8
  coverText?: string;
9
+ /** 刮开面积比例阈值(0~1),默认 0.45 */
10
+ revealThreshold?: number;
9
11
  /** 刮开完成回调 */
10
12
  onReveal?: () => void;
11
13
  width?: number;
12
14
  height?: number;
13
15
  }
14
- declare const ScratchCard: React.FC<ScratchCardProps>;
16
+ export interface ScratchCardHandle {
17
+ /** 重置涂层 */
18
+ reset: () => void;
19
+ /** 立即揭开奖品 */
20
+ reveal: () => void;
21
+ }
22
+ declare const ScratchCard: React.ForwardRefExoticComponent<ScratchCardProps & React.RefAttributes<ScratchCardHandle>>;
15
23
  export default ScratchCard;
@@ -4,10 +4,14 @@ export interface SlotMachineProps {
4
4
  symbols?: string[];
5
5
  /** 单列旋转时长(毫秒),默认 3000;列之间仍有错峰停轮 */
6
6
  spinDuration?: number;
7
+ /** 指定下一次停轮结果(长度 3);不传则随机 */
8
+ targetResults?: string[];
7
9
  /** 旋转结束回调 */
8
10
  onSpinEnd?: (results: string[]) => void;
9
11
  /** 开始按钮文案 */
10
12
  startText?: string;
13
+ /** 开始按钮文案别名(与 Turntable.buttonText 对齐) */
14
+ buttonText?: string;
11
15
  /** 旋转中的按钮文案 */
12
16
  spinningText?: string;
13
17
  /** 中奖提示 */
@@ -15,5 +19,11 @@ export interface SlotMachineProps {
15
19
  /** 普通结果前缀 */
16
20
  resultPrefix?: string;
17
21
  }
18
- declare const SlotMachine: React.FC<SlotMachineProps>;
22
+ export interface SlotMachineHandle {
23
+ /** 手动旋转;可传入三列结果覆盖 props.targetResults */
24
+ spin: (results?: string[]) => void;
25
+ /** 清除结果文案 */
26
+ reset: () => void;
27
+ }
28
+ declare const SlotMachine: React.ForwardRefExoticComponent<SlotMachineProps & React.RefAttributes<SlotMachineHandle>>;
19
29
  export default SlotMachine;
@@ -12,6 +12,8 @@ export interface TurntableProps {
12
12
  spinDuration?: number;
13
13
  /** 旋转圈数,默认 5 */
14
14
  spinRounds?: number;
15
+ /** 指定下一次抽中的奖品索引(服务端开奖);不传则随机 */
16
+ targetIndex?: number;
15
17
  /** 抽奖按钮文案 */
16
18
  buttonText?: string;
17
19
  /** 抽奖进行中的按钮文案 */
@@ -21,5 +23,11 @@ export interface TurntableProps {
21
23
  /** 旋转结束回调 */
22
24
  onSpinEnd?: (prize: TurntablePrize, index: number) => void;
23
25
  }
24
- declare const Turntable: React.FC<TurntableProps>;
26
+ export interface TurntableHandle {
27
+ /** 手动抽奖;可传入目标索引覆盖 props.targetIndex */
28
+ spin: (targetIndex?: number) => void;
29
+ /** 清除结果文案并允许再次抽奖 */
30
+ reset: () => void;
31
+ }
32
+ declare const Turntable: React.ForwardRefExoticComponent<TurntableProps & React.RefAttributes<TurntableHandle>>;
25
33
  export default Turntable;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cos-design",
3
- "version": "3.7.3",
4
- "description": "A React component library built with Vite",
3
+ "version": "3.7.5",
4
+ "description": "React visual-effect components for marketing pages, campaigns, canvas backgrounds, and creative showcases",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.js",
@@ -37,10 +37,16 @@
37
37
  "canvas",
38
38
  "animation",
39
39
  "fireworks",
40
+ "confetti",
40
41
  "scratch-card",
41
42
  "lottery",
43
+ "turntable",
44
+ "matrix-rain",
45
+ "weather-background",
46
+ "neon-text",
42
47
  "marketing-page",
43
48
  "landing-page",
49
+ "campaign",
44
50
  "typescript",
45
51
  "vite"
46
52
  ],