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 +27 -0
- package/README.md +59 -13
- package/dist/index.cjs +3 -3
- package/dist/index.js +2135 -1975
- 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 +4 -4
- package/dist/src/components/photoAlbum/types.d.ts +2 -0
- package/dist/src/components/photoCarousel/types.d.ts +3 -1
- package/dist/src/components/photoClothesline/types.d.ts +2 -0
- package/dist/src/components/photoLantern/types.d.ts +2 -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 +11 -1
- package/dist/src/components/turntable/index.d.ts +9 -1
- package/package.json +8 -2
|
@@ -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';
|
|
@@ -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,17 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface RedPacketRainProps {
|
|
3
|
+
/** 画布宽度,默认 400 */
|
|
4
|
+
width?: number;
|
|
5
|
+
/** 画布高度,默认 500 */
|
|
6
|
+
height?: number;
|
|
3
7
|
/** 持续时间(毫秒),默认 10000 */
|
|
4
8
|
duration?: number;
|
|
9
|
+
/** 挂载后自动开始,默认 true */
|
|
10
|
+
auto?: boolean;
|
|
5
11
|
/** 抢到红包回调 */
|
|
6
12
|
onGrab?: (amount: number) => void;
|
|
13
|
+
/** 红包雨结束回调 */
|
|
14
|
+
onEnd?: () => void;
|
|
7
15
|
/** 已抢金额标签 */
|
|
8
16
|
grabbedLabel?: string;
|
|
9
17
|
/** 红包雨结束提示 */
|
|
@@ -11,5 +19,13 @@ export interface RedPacketRainProps {
|
|
|
11
19
|
/** 操作提示 */
|
|
12
20
|
hint?: string;
|
|
13
21
|
}
|
|
14
|
-
|
|
22
|
+
export interface RedPacketRainHandle {
|
|
23
|
+
/** 重新开始一轮红包雨 */
|
|
24
|
+
start: () => void;
|
|
25
|
+
/** 立即结束 */
|
|
26
|
+
stop: () => void;
|
|
27
|
+
/** 结束并清零金额 */
|
|
28
|
+
reset: () => void;
|
|
29
|
+
}
|
|
30
|
+
declare const RedPacketRain: React.ForwardRefExoticComponent<RedPacketRainProps & React.RefAttributes<RedPacketRainHandle>>;
|
|
15
31
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.7.4",
|
|
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
|
],
|