cos-design 3.7.1 → 3.7.3
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 +51 -0
- package/README.md +30 -8
- package/dist/index.cjs +3 -3
- package/dist/index.css +1 -1
- package/dist/index.js +5601 -2229
- package/dist/src/components/index.d.ts +24 -0
- package/dist/src/components/photoCarousel/index.d.ts +9 -0
- package/dist/src/components/photoCarousel/types.d.ts +47 -0
- package/dist/src/components/photoClothesline/constants.d.ts +44 -0
- package/dist/src/components/photoClothesline/index.d.ts +5 -0
- package/dist/src/components/photoClothesline/layout.d.ts +23 -0
- package/dist/src/components/photoClothesline/math.d.ts +6 -0
- package/dist/src/components/photoClothesline/model.d.ts +110 -0
- package/dist/src/components/photoClothesline/ropePath.d.ts +5 -0
- package/dist/src/components/photoClothesline/simulation.d.ts +46 -0
- package/dist/src/components/photoClothesline/types.d.ts +67 -0
- package/dist/src/components/photoFilmstrip/index.d.ts +5 -0
- package/dist/src/components/photoFilmstrip/types.d.ts +43 -0
- package/dist/src/components/photoFridge/index.d.ts +5 -0
- package/dist/src/components/photoFridge/types.d.ts +41 -0
- package/dist/src/components/photoLantern/accessories.d.ts +4 -0
- package/dist/src/components/photoLantern/constants.d.ts +5 -0
- package/dist/src/components/photoLantern/dispose.d.ts +4 -0
- package/dist/src/components/photoLantern/geometry.d.ts +5 -0
- package/dist/src/components/photoLantern/index.d.ts +5 -0
- package/dist/src/components/photoLantern/materials.d.ts +9 -0
- package/dist/src/components/photoLantern/scene.d.ts +32 -0
- package/dist/src/components/photoLantern/textures.d.ts +9 -0
- package/dist/src/components/photoLantern/types.d.ts +59 -0
- package/dist/src/components/photoLightbox/index.d.ts +5 -0
- package/dist/src/components/photoLightbox/types.d.ts +39 -0
- package/dist/src/components/photoPolaroid/index.d.ts +5 -0
- package/dist/src/components/photoPolaroid/types.d.ts +39 -0
- package/dist/src/components/photoPostcard/index.d.ts +8 -0
- package/dist/src/components/photoPostcard/types.d.ts +45 -0
- package/dist/src/components/photoPrism/index.d.ts +9 -0
- package/dist/src/components/photoPrism/types.d.ts +39 -0
- package/dist/src/components/photoScroll/index.d.ts +9 -0
- package/dist/src/components/photoScroll/types.d.ts +43 -0
- package/dist/src/components/photoTunnel/index.d.ts +9 -0
- package/dist/src/components/photoTunnel/types.d.ts +43 -0
- package/dist/src/components/photoViewMaster/index.d.ts +9 -0
- package/dist/src/components/photoViewMaster/types.d.ts +47 -0
- package/dist/src/components/slotMachine/index.d.ts +2 -0
- package/package.json +3 -2
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface PhotoLightboxItem {
|
|
3
|
+
/** 图片地址 */
|
|
4
|
+
src: string;
|
|
5
|
+
/** 图片替代文本 */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** 照片标题 */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** 照片说明 */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PhotoLightboxProps {
|
|
13
|
+
/** 灯箱内的胶片幻灯片列表 */
|
|
14
|
+
photos: PhotoLightboxItem[];
|
|
15
|
+
/** 组件宽度 */
|
|
16
|
+
width?: number | string;
|
|
17
|
+
/** 组件高度 */
|
|
18
|
+
height?: number | string;
|
|
19
|
+
/** 单张幻灯片宽度(px) */
|
|
20
|
+
slideWidth?: number;
|
|
21
|
+
/** 单张幻灯片高度(px) */
|
|
22
|
+
slideHeight?: number;
|
|
23
|
+
/** 横向拖拽超过该距离(px)后松手即切换上一张/下一张 */
|
|
24
|
+
pullThreshold?: number;
|
|
25
|
+
/** 是否显示幻灯片底部标题与说明 */
|
|
26
|
+
showCaption?: boolean;
|
|
27
|
+
/** 初始显示的幻灯片索引 */
|
|
28
|
+
initialIndex?: number;
|
|
29
|
+
/** 点击当前幻灯片(未发生拖拽)时的回调 */
|
|
30
|
+
onPhotoClick?: (index: number, photo: PhotoLightboxItem) => void;
|
|
31
|
+
/** 当前索引变化时的回调 */
|
|
32
|
+
onIndexChange?: (index: number, photo: PhotoLightboxItem) => void;
|
|
33
|
+
/** 无障碍名称 */
|
|
34
|
+
ariaLabel?: string;
|
|
35
|
+
/** 自定义类名 */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** 自定义样式 */
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/** 单张拍立得照片数据 */
|
|
3
|
+
export interface PhotoPolaroidItem {
|
|
4
|
+
/** 图片地址 */
|
|
5
|
+
src: string;
|
|
6
|
+
/** 图片替代文本 */
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** 照片标题(显示在底部留白区) */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** 照片说明(显示在标题下方) */
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
/** PhotoPolaroid 组件属性 */
|
|
14
|
+
export interface PhotoPolaroidProps {
|
|
15
|
+
/** 拍立得照片列表 */
|
|
16
|
+
photos: PhotoPolaroidItem[];
|
|
17
|
+
/** 组件宽度 */
|
|
18
|
+
width?: number | string;
|
|
19
|
+
/** 组件高度 */
|
|
20
|
+
height?: number | string;
|
|
21
|
+
/** 单张卡片宽度(px) */
|
|
22
|
+
cardWidth?: number;
|
|
23
|
+
/** 单张卡片高度(px) */
|
|
24
|
+
cardHeight?: number;
|
|
25
|
+
/** 散落程度,0 为紧凑堆叠,1 为默认散布,>1 更分散 */
|
|
26
|
+
scatter?: number;
|
|
27
|
+
/** 是否显示底部标题与说明 */
|
|
28
|
+
showCaption?: boolean;
|
|
29
|
+
/** 初始置于最前的照片索引 */
|
|
30
|
+
initialIndex?: number;
|
|
31
|
+
/** 点击照片回调(几乎无位移时触发) */
|
|
32
|
+
onPhotoClick?: (index: number, photo: PhotoPolaroidItem) => void;
|
|
33
|
+
/** 无障碍名称 */
|
|
34
|
+
ariaLabel?: string;
|
|
35
|
+
/** 自定义类名 */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** 自定义样式 */
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoPostcardProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 旅行明信片堆叠:单张特色明信片可 3D 翻转,水平拖拽切换上一张/下一张。
|
|
5
|
+
*/
|
|
6
|
+
declare const PhotoPostcard: React.FC<PhotoPostcardProps>;
|
|
7
|
+
export default PhotoPostcard;
|
|
8
|
+
export type { PhotoPostcardItem, PhotoPostcardProps } from './types';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/** 单张旅行明信片数据 */
|
|
3
|
+
export interface PhotoPostcardItem {
|
|
4
|
+
/** 图片地址 */
|
|
5
|
+
src: string;
|
|
6
|
+
/** 图片替代文本 */
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** 明信片标题(背面问候语 / 正面说明标题) */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** 明信片正文(背面书写区 / 正面说明) */
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
/** PhotoPostcard 组件属性 */
|
|
14
|
+
export interface PhotoPostcardProps {
|
|
15
|
+
/** 明信片照片列表 */
|
|
16
|
+
photos: PhotoPostcardItem[];
|
|
17
|
+
/** 组件宽度 */
|
|
18
|
+
width?: number | string;
|
|
19
|
+
/** 组件高度 */
|
|
20
|
+
height?: number | string;
|
|
21
|
+
/** 单张明信片宽度(px) */
|
|
22
|
+
cardWidth?: number;
|
|
23
|
+
/** 单张明信片高度(px) */
|
|
24
|
+
cardHeight?: number;
|
|
25
|
+
/** 水平拖拽切换阈值(px) */
|
|
26
|
+
pullThreshold?: number;
|
|
27
|
+
/** 是否在正面底部显示标题与说明 */
|
|
28
|
+
showCaption?: boolean;
|
|
29
|
+
/** 初始展示索引 */
|
|
30
|
+
initialIndex?: number;
|
|
31
|
+
/** 初始是否背面朝上 */
|
|
32
|
+
initialFlipped?: boolean;
|
|
33
|
+
/** 点击当前明信片(几乎无位移时触发) */
|
|
34
|
+
onPhotoClick?: (index: number, photo: PhotoPostcardItem) => void;
|
|
35
|
+
/** 当前索引变化回调 */
|
|
36
|
+
onIndexChange?: (index: number, photo: PhotoPostcardItem) => void;
|
|
37
|
+
/** 正反面翻转状态变化回调 */
|
|
38
|
+
onFlipChange?: (flipped: boolean) => void;
|
|
39
|
+
/** 无障碍名称 */
|
|
40
|
+
ariaLabel?: string;
|
|
41
|
+
/** 自定义类名 */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** 自定义样式 */
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoPrismProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 照片棱镜:CSS 3D 立方体,最多六面贴图。
|
|
5
|
+
* 拖拽翻滚并带惯性,空闲时缓慢自转与轻微浮动。
|
|
6
|
+
*/
|
|
7
|
+
declare const PhotoPrism: React.FC<PhotoPrismProps>;
|
|
8
|
+
export type { PhotoPrismItem, PhotoPrismProps } from './types';
|
|
9
|
+
export default PhotoPrism;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/** 棱镜单面照片数据 */
|
|
3
|
+
export interface PhotoPrismItem {
|
|
4
|
+
/** 图片地址 */
|
|
5
|
+
src: string;
|
|
6
|
+
/** 图片替代文本 */
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** 照片标题 */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** 照片说明 */
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
/** PhotoPrism 组件属性 */
|
|
14
|
+
export interface PhotoPrismProps {
|
|
15
|
+
/** 六面照片(最多取前 6 张,按 front/back/right/left/top/bottom 顺序映射) */
|
|
16
|
+
photos: PhotoPrismItem[];
|
|
17
|
+
/** 组件宽度 */
|
|
18
|
+
width?: number | string;
|
|
19
|
+
/** 组件高度 */
|
|
20
|
+
height?: number | string;
|
|
21
|
+
/** 立方体边长(px) */
|
|
22
|
+
size?: number;
|
|
23
|
+
/** 空闲时是否缓慢绕 Y 轴自转 */
|
|
24
|
+
autoRotate?: boolean;
|
|
25
|
+
/** 拖拽灵敏度(度/像素) */
|
|
26
|
+
dragSensitivity?: number;
|
|
27
|
+
/** 松手后惯性衰减系数(越大停得越快,约 0.6~4) */
|
|
28
|
+
friction?: number;
|
|
29
|
+
/** 是否在每面照片底部嵌入标题与说明 */
|
|
30
|
+
showCaption?: boolean;
|
|
31
|
+
/** 点击某面照片回调 */
|
|
32
|
+
onPhotoClick?: (index: number, photo: PhotoPrismItem) => void;
|
|
33
|
+
/** 无障碍名称 */
|
|
34
|
+
ariaLabel?: string;
|
|
35
|
+
/** 自定义类名 */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** 自定义样式 */
|
|
38
|
+
style?: CSSProperties;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoScrollProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 中式手卷轴照片浏览:左右木轴固定,中间宣纸横向拖拽滚动,
|
|
5
|
+
* 松手后带指数摩擦惯性并吸附到最近照片中心。
|
|
6
|
+
*/
|
|
7
|
+
declare const PhotoScroll: React.FC<PhotoScrollProps>;
|
|
8
|
+
export default PhotoScroll;
|
|
9
|
+
export type { PhotoScrollItem, PhotoScrollProps } from './types';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface PhotoScrollItem {
|
|
3
|
+
/** 图片地址 */
|
|
4
|
+
src: string;
|
|
5
|
+
/** 图片替代文本 */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** 照片标题,用于卷轴底部墨迹说明 */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** 照片说明,显示在标题下方 */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PhotoScrollProps {
|
|
13
|
+
/** 卷轴上的照片列表 */
|
|
14
|
+
photos: PhotoScrollItem[];
|
|
15
|
+
/** 组件宽度 */
|
|
16
|
+
width?: number | string;
|
|
17
|
+
/** 组件高度 */
|
|
18
|
+
height?: number | string;
|
|
19
|
+
/** 单张照片框宽度(px) */
|
|
20
|
+
frameWidth?: number;
|
|
21
|
+
/** 单张照片框高度(px) */
|
|
22
|
+
frameHeight?: number;
|
|
23
|
+
/** 照片框之间的间距(px) */
|
|
24
|
+
frameGap?: number;
|
|
25
|
+
/** 拖拽灵敏度,1 为 1:1 跟手 */
|
|
26
|
+
dragSensitivity?: number;
|
|
27
|
+
/** 惯性摩擦系数,越大减速越快 */
|
|
28
|
+
friction?: number;
|
|
29
|
+
/** 是否在每张照片底部嵌入标题与说明 */
|
|
30
|
+
showCaption?: boolean;
|
|
31
|
+
/** 初始居中显示的照片索引 */
|
|
32
|
+
initialIndex?: number;
|
|
33
|
+
/** 点击照片回调(位移小于 CLICK_SLOP 时触发) */
|
|
34
|
+
onPhotoClick?: (index: number, photo: PhotoScrollItem) => void;
|
|
35
|
+
/** 当前居中照片索引变化回调 */
|
|
36
|
+
onIndexChange?: (index: number, photo: PhotoScrollItem) => void;
|
|
37
|
+
/** 无障碍区域名称 */
|
|
38
|
+
ariaLabel?: string;
|
|
39
|
+
/** 自定义类名 */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** 自定义样式 */
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoTunnelProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 纵深照片隧道:照片沿 Z 轴叠成隧道,拖拽或惯性滑过,
|
|
5
|
+
* 空闲时可选缓慢自动前进;当前帧最大最清晰。
|
|
6
|
+
*/
|
|
7
|
+
declare const PhotoTunnel: React.FC<PhotoTunnelProps>;
|
|
8
|
+
export default PhotoTunnel;
|
|
9
|
+
export type { PhotoTunnelItem, PhotoTunnelProps } from './types';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export interface PhotoTunnelItem {
|
|
3
|
+
/** 图片地址 */
|
|
4
|
+
src: string;
|
|
5
|
+
/** 图片替代文本 */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** 照片标题 */
|
|
8
|
+
title?: string;
|
|
9
|
+
/** 照片说明 */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface PhotoTunnelProps {
|
|
13
|
+
/** 隧道中的照片列表 */
|
|
14
|
+
photos: PhotoTunnelItem[];
|
|
15
|
+
/** 组件宽度 */
|
|
16
|
+
width?: number | string;
|
|
17
|
+
/** 组件高度 */
|
|
18
|
+
height?: number | string;
|
|
19
|
+
/** 相邻照片沿 Z 轴间距(px) */
|
|
20
|
+
depthStep?: number;
|
|
21
|
+
/** 拖拽灵敏度(索引单位 / px) */
|
|
22
|
+
dragSensitivity?: number;
|
|
23
|
+
/** 惯性摩擦系数,越大减速越快 */
|
|
24
|
+
friction?: number;
|
|
25
|
+
/** 空闲时是否缓慢自动前进 */
|
|
26
|
+
autoAdvance?: boolean;
|
|
27
|
+
/** 自动前进速度(张 / 秒) */
|
|
28
|
+
autoAdvanceSpeed?: number;
|
|
29
|
+
/** 是否显示当前照片的标题与说明 */
|
|
30
|
+
showCaption?: boolean;
|
|
31
|
+
/** 初始照片索引 */
|
|
32
|
+
initialIndex?: number;
|
|
33
|
+
/** 点击当前照片回调 */
|
|
34
|
+
onPhotoClick?: (index: number, photo: PhotoTunnelItem) => void;
|
|
35
|
+
/** 当前索引变化回调(吸附到整数后触发) */
|
|
36
|
+
onIndexChange?: (index: number, photo: PhotoTunnelItem) => void;
|
|
37
|
+
/** 无障碍名称 */
|
|
38
|
+
ariaLabel?: string;
|
|
39
|
+
/** 自定义类名 */
|
|
40
|
+
className?: string;
|
|
41
|
+
/** 自定义样式 */
|
|
42
|
+
style?: CSSProperties;
|
|
43
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PhotoViewMasterProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* 观景器:View-Master 风格圆盘照片玩具。
|
|
5
|
+
* 水平拖拽旋转底片盘,松手带惯性与吸附;空闲时可缓慢自动旋转。
|
|
6
|
+
*/
|
|
7
|
+
declare const PhotoViewMaster: React.FC<PhotoViewMasterProps>;
|
|
8
|
+
export type { PhotoViewMasterItem, PhotoViewMasterProps } from './types';
|
|
9
|
+
export default PhotoViewMaster;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
/** 观景器单张照片数据 */
|
|
3
|
+
export interface PhotoViewMasterItem {
|
|
4
|
+
/** 图片地址 */
|
|
5
|
+
src: string;
|
|
6
|
+
/** 图片替代文本 */
|
|
7
|
+
alt?: string;
|
|
8
|
+
/** 照片标题 */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** 照片说明 */
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
/** PhotoViewMaster 组件属性 */
|
|
14
|
+
export interface PhotoViewMasterProps {
|
|
15
|
+
/** 转盘照片列表 */
|
|
16
|
+
photos: PhotoViewMasterItem[];
|
|
17
|
+
/** 组件宽度 */
|
|
18
|
+
width?: number | string;
|
|
19
|
+
/** 组件高度 */
|
|
20
|
+
height?: number | string;
|
|
21
|
+
/** 转盘直径(px) */
|
|
22
|
+
discSize?: number;
|
|
23
|
+
/** 窥视窗直径(px) */
|
|
24
|
+
peepSize?: number;
|
|
25
|
+
/** 水平拖拽灵敏度(度/像素) */
|
|
26
|
+
dragSensitivity?: number;
|
|
27
|
+
/** 松手后惯性衰减系数(越大停得越快) */
|
|
28
|
+
friction?: number;
|
|
29
|
+
/** 空闲时是否缓慢自动旋转 */
|
|
30
|
+
autoRotate?: boolean;
|
|
31
|
+
/** 自动旋转角速度(度/秒) */
|
|
32
|
+
autoRotateSpeed?: number;
|
|
33
|
+
/** 是否在窥视窗下方显示当前照片标题与说明 */
|
|
34
|
+
showCaption?: boolean;
|
|
35
|
+
/** 初始正对镜头的照片索引 */
|
|
36
|
+
initialIndex?: number;
|
|
37
|
+
/** 点击当前照片回调 */
|
|
38
|
+
onPhotoClick?: (index: number, photo: PhotoViewMasterItem) => void;
|
|
39
|
+
/** 当前照片索引变化回调 */
|
|
40
|
+
onIndexChange?: (index: number, photo: PhotoViewMasterItem) => void;
|
|
41
|
+
/** 无障碍名称 */
|
|
42
|
+
ariaLabel?: string;
|
|
43
|
+
/** 自定义类名 */
|
|
44
|
+
className?: string;
|
|
45
|
+
/** 自定义样式 */
|
|
46
|
+
style?: CSSProperties;
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cos-design",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.3",
|
|
4
4
|
"description": "A React component library built with Vite",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": ">=18.0.0",
|
|
60
|
-
"react-dom": ">=18.0.0"
|
|
60
|
+
"react-dom": ">=18.0.0",
|
|
61
|
+
"three": ">=0.160.0"
|
|
61
62
|
},
|
|
62
63
|
"publishConfig": {
|
|
63
64
|
"access": "public",
|