cos-design 3.7.0 → 3.7.2
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 +21 -0
- package/README.md +49 -23
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +2374 -1249
- package/dist/src/components/burnAway/index.d.ts +2 -0
- package/dist/src/components/confetti/index.d.ts +2 -0
- package/dist/src/components/countdown/index.d.ts +13 -0
- package/dist/src/components/cursorTrail/index.d.ts +2 -0
- package/dist/src/components/diceRoll/index.d.ts +6 -0
- package/dist/src/components/fireworks/index.d.ts +2 -0
- package/dist/src/components/gameOfLife/index.d.ts +8 -0
- package/dist/src/components/index.d.ts +4 -0
- package/dist/src/components/networkGraph/index.d.ts +2 -0
- package/dist/src/components/particleNetwork/index.d.ts +2 -0
- package/dist/src/components/photoAlbum/index.d.ts +5 -0
- package/dist/src/components/photoAlbum/types.d.ts +57 -0
- package/dist/src/components/photoClothesline/index.d.ts +5 -0
- package/dist/src/components/photoClothesline/types.d.ts +67 -0
- package/dist/src/components/progressChest/index.d.ts +2 -0
- package/dist/src/components/redPacketRain/index.d.ts +6 -0
- package/dist/src/components/sandFall/index.d.ts +4 -0
- package/dist/src/components/scratchCard/index.d.ts +2 -0
- package/dist/src/components/slotMachine/index.d.ts +8 -0
- package/dist/src/components/smokeFog/index.d.ts +2 -0
- package/dist/src/components/springMass/index.d.ts +2 -0
- package/dist/src/components/turntable/index.d.ts +4 -0
- package/dist/src/components/weatherBackground/types.d.ts +4 -0
- package/package.json +11 -3
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -77,6 +77,10 @@ export type { NeonTextProps } from './neonText';
|
|
|
77
77
|
export { default as OrbitalChart } from './orbitalChart';
|
|
78
78
|
export type { OrbitalChartItem, OrbitalChartProps } from './orbitalChart';
|
|
79
79
|
export { default as ParticleNetwork } from './particleNetwork';
|
|
80
|
+
export { default as PhotoAlbum } from './photoAlbum';
|
|
81
|
+
export type { PhotoAlbumItem, PhotoAlbumLabels, PhotoAlbumProps } from './photoAlbum';
|
|
82
|
+
export { default as PhotoClothesline } from './photoClothesline';
|
|
83
|
+
export type { PhotoClotheslineItem, PhotoClotheslineProps } from './photoClothesline';
|
|
80
84
|
export { default as PlasmaBall } from './plasmaBall';
|
|
81
85
|
export type { PlasmaBallProps } from './plasmaBall';
|
|
82
86
|
export { default as SmokeFog } from './smokeFog';
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoClotheslineProps } from './types';
|
|
3
|
+
declare const PhotoClothesline: React.FC<PhotoClotheslineProps>;
|
|
4
|
+
export type { PhotoClotheslineItem, PhotoClotheslineProps } from './types';
|
|
5
|
+
export default PhotoClothesline;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface PhotoClotheslineItem {
|
|
3
|
+
/** 图片地址 */
|
|
4
|
+
src: string;
|
|
5
|
+
/** 图片替代文本 */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** 照片标题 */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** 照片说明 */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PhotoClotheslineProps {
|
|
13
|
+
/** 晾绳上的照片列表 */
|
|
14
|
+
photos: PhotoClotheslineItem[];
|
|
15
|
+
/** 组件宽度 */
|
|
16
|
+
width?: number | string;
|
|
17
|
+
/** 组件高度 */
|
|
18
|
+
height?: number | string;
|
|
19
|
+
/** 单张照片宽度(px) */
|
|
20
|
+
photoWidth?: number;
|
|
21
|
+
/** 单张照片高度(px) */
|
|
22
|
+
photoHeight?: number;
|
|
23
|
+
/** 照片间距(px) */
|
|
24
|
+
photoGap?: number;
|
|
25
|
+
/** 绳索悬挂高度(px,距顶部) */
|
|
26
|
+
ropeTop?: number;
|
|
27
|
+
/** 绳索整体垂度(px) */
|
|
28
|
+
ropeSag?: number;
|
|
29
|
+
/** 照片吊带长度(px),越长摆动幅度越大、周期越慢 */
|
|
30
|
+
bandLength?: number;
|
|
31
|
+
/** 吊带宽度(px) */
|
|
32
|
+
bandWidth?: number;
|
|
33
|
+
/** 照片被拖离静止位的最大距离(px),越小吊带越快绷紧 */
|
|
34
|
+
maxPull?: number;
|
|
35
|
+
/** 主绳刚度 0.1~2,越大被拽下后弹回越快 */
|
|
36
|
+
stiffness?: number;
|
|
37
|
+
/** 阻尼比 0~1,越小摆动越久 */
|
|
38
|
+
damping?: number;
|
|
39
|
+
/** 相邻照片之间的绳索牵连强度 0~1 */
|
|
40
|
+
tension?: number;
|
|
41
|
+
/** 照片随机倾角幅度(度) */
|
|
42
|
+
tilt?: number;
|
|
43
|
+
/** 主绳颜色 */
|
|
44
|
+
ropeColor?: string;
|
|
45
|
+
/** 吊带颜色,默认跟随 ropeColor */
|
|
46
|
+
bandColor?: string;
|
|
47
|
+
/** 木夹子颜色 */
|
|
48
|
+
pinColor?: string;
|
|
49
|
+
/** 相纸边框颜色 */
|
|
50
|
+
frameColor?: string;
|
|
51
|
+
/** 背景(任意 CSS background 值) */
|
|
52
|
+
background?: string;
|
|
53
|
+
/** 照片填充方式 */
|
|
54
|
+
objectFit?: CSSProperties['objectFit'];
|
|
55
|
+
/** 是否显示照片标题与说明 */
|
|
56
|
+
showCaption?: boolean;
|
|
57
|
+
/** 初始居中显示的照片索引 */
|
|
58
|
+
initialIndex?: number;
|
|
59
|
+
/** 点击照片回调 */
|
|
60
|
+
onPhotoClick?: (index: number, photo: PhotoClotheslineItem) => void;
|
|
61
|
+
/** 无障碍名称 */
|
|
62
|
+
ariaLabel?: string;
|
|
63
|
+
/** 自定义类名 */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** 自定义样式 */
|
|
66
|
+
style?: CSSProperties;
|
|
67
|
+
}
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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.7.
|
|
3
|
+
"version": "3.7.2",
|
|
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
|
-
"
|
|
37
|
-
"
|
|
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": {
|