@douyinfe/semi-foundation 2.72.2 → 2.73.0-beta.0
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/audioPlayer/audioPlayer.scss +217 -0
- package/audioPlayer/constants.ts +7 -0
- package/audioPlayer/foundation.ts +103 -0
- package/audioPlayer/variables.scss +55 -0
- package/button/iconButton.scss +8 -0
- package/cropper/constants.ts +26 -0
- package/cropper/cropper.scss +116 -0
- package/cropper/foundation.ts +821 -0
- package/cropper/utils.ts +12 -0
- package/cropper/variables.scss +6 -0
- package/dragMove/foundation.ts +12 -0
- package/jsonViewer/foundation.ts +6 -0
- package/jsonViewer/jsonViewer.scss +8 -3
- package/lib/cjs/audioPlayer/audioPlayer.css +188 -0
- package/lib/cjs/audioPlayer/audioPlayer.scss +217 -0
- package/lib/cjs/audioPlayer/constants.d.ts +4 -0
- package/lib/cjs/audioPlayer/constants.js +10 -0
- package/lib/cjs/audioPlayer/foundation.d.ts +41 -0
- package/lib/cjs/audioPlayer/foundation.js +79 -0
- package/lib/cjs/audioPlayer/variables.scss +55 -0
- package/lib/cjs/button/iconButton.css +8 -0
- package/lib/cjs/button/iconButton.scss +8 -0
- package/lib/cjs/cropper/constants.d.ts +17 -0
- package/lib/cjs/cropper/constants.js +24 -0
- package/lib/cjs/cropper/cropper.css +97 -0
- package/lib/cjs/cropper/cropper.scss +116 -0
- package/lib/cjs/cropper/foundation.d.ts +101 -0
- package/lib/cjs/cropper/foundation.js +786 -0
- package/lib/cjs/cropper/utils.d.ts +2 -0
- package/lib/cjs/cropper/utils.js +19 -0
- package/lib/cjs/cropper/variables.scss +6 -0
- package/lib/cjs/dragMove/foundation.d.ts +2 -0
- package/lib/cjs/dragMove/foundation.js +10 -0
- package/lib/cjs/jsonViewer/foundation.js +6 -0
- package/lib/cjs/jsonViewer/jsonViewer.css +8 -2
- package/lib/cjs/jsonViewer/jsonViewer.scss +8 -3
- package/lib/es/audioPlayer/audioPlayer.css +188 -0
- package/lib/es/audioPlayer/audioPlayer.scss +217 -0
- package/lib/es/audioPlayer/constants.d.ts +4 -0
- package/lib/es/audioPlayer/constants.js +5 -0
- package/lib/es/audioPlayer/foundation.d.ts +41 -0
- package/lib/es/audioPlayer/foundation.js +72 -0
- package/lib/es/audioPlayer/variables.scss +55 -0
- package/lib/es/button/iconButton.css +8 -0
- package/lib/es/button/iconButton.scss +8 -0
- package/lib/es/cropper/constants.d.ts +17 -0
- package/lib/es/cropper/constants.js +19 -0
- package/lib/es/cropper/cropper.css +97 -0
- package/lib/es/cropper/cropper.scss +116 -0
- package/lib/es/cropper/foundation.d.ts +101 -0
- package/lib/es/cropper/foundation.js +778 -0
- package/lib/es/cropper/utils.d.ts +2 -0
- package/lib/es/cropper/utils.js +12 -0
- package/lib/es/cropper/variables.scss +6 -0
- package/lib/es/dragMove/foundation.d.ts +2 -0
- package/lib/es/dragMove/foundation.js +10 -0
- package/lib/es/jsonViewer/foundation.js +6 -0
- package/lib/es/jsonViewer/jsonViewer.css +8 -2
- package/lib/es/jsonViewer/jsonViewer.scss +8 -3
- package/package.json +4 -4
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
$color-audio-player-background: rgba(var(--semi-grey-9), .8);
|
|
2
|
+
$color-audio-player-control-icon: var(--semi-color-bg-0);
|
|
3
|
+
$color-audio-player-control-icon-play: var(--semi-color-text-0);
|
|
4
|
+
$color-audio-player-font-color: var(--semi-color-bg-0);
|
|
5
|
+
$color-audio-player-font-color-speed: rgba(var(--semi-grey-8), 1);
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
$color-audio-player-background-light: var(--semi-color-bg-0);
|
|
9
|
+
$color-audio-player-control-icon-light: rgba(var(--semi-grey-9), 1);
|
|
10
|
+
$color-audio-player-control-icon-play-light: var(--semi-color-bg-0);
|
|
11
|
+
$color-audio-player-font-color-light: rgba(var(--semi-grey-9), 1);
|
|
12
|
+
|
|
13
|
+
$font-size-audio-player-text: 14px;
|
|
14
|
+
|
|
15
|
+
$gap-audio-player-small: 4px;
|
|
16
|
+
$gap-audio-player-medium: 16px;
|
|
17
|
+
$gap-audio-player-large: 24px;
|
|
18
|
+
|
|
19
|
+
// Size variables
|
|
20
|
+
$width-audio-player-max: 1440px;
|
|
21
|
+
$height-audio-player: 78px;
|
|
22
|
+
$width-audio-player-slider: 323px;
|
|
23
|
+
$width-audio-player-speed: 40px;
|
|
24
|
+
$height-audio-player-speed: 24px;
|
|
25
|
+
$width-audio-player-speed-menu: 65px;
|
|
26
|
+
$width-audio-player-volume: 43px;
|
|
27
|
+
$height-audio-player-volume: 164px;
|
|
28
|
+
$height-audio-player-time: 22px;
|
|
29
|
+
|
|
30
|
+
// Border radius
|
|
31
|
+
$border-radius-audio-player-speed: 3px;
|
|
32
|
+
$border-radius-audio-player-volume: 4px;
|
|
33
|
+
$border-radius-audio-player-slider: 9999px;
|
|
34
|
+
|
|
35
|
+
// Font sizes
|
|
36
|
+
$font-size-audio-player-small: 12px;
|
|
37
|
+
$line-height-audio-player-small: 16px;
|
|
38
|
+
|
|
39
|
+
// Slider dimensions
|
|
40
|
+
$width-audio-player-slider-bar: 4px;
|
|
41
|
+
$size-audio-player-slider-dot: 16px;
|
|
42
|
+
|
|
43
|
+
// Colors
|
|
44
|
+
$color-audio-player-disabled-bg: rgba(var(--semi-grey-0), .35);
|
|
45
|
+
$color-audio-player-slider-bg: rgba(var(--semi-grey-5), 1);
|
|
46
|
+
$color-audio-player-slider-bg-light: rgba(var(--semi-grey-2), 1);
|
|
47
|
+
$color-audio-player-slider-progress: rgba(var(--semi-blue-4), 1);
|
|
48
|
+
$color-audio-player-slider-dot-bg: rgba(var(--semi-white), 1);
|
|
49
|
+
|
|
50
|
+
$color-audio-player-disabled-text: var(--semi-color-grey-7);
|
|
51
|
+
$color-audio-player-text-default: var(--semi-color-default);
|
|
52
|
+
$color-audio-player-light-disabled-bg: var(--semi-color-disabled-text);
|
|
53
|
+
$color-audio-player-light-disabled-text: rgba(var(--semi-white), 1);
|
|
54
|
+
$color-audio-player-light-text: rgba(var(--semi-grey-9), 1);
|
|
55
|
+
$color-audio-player-light-hover-bg: rgba(var(--semi-grey-1), 1);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare const cssClasses: {
|
|
2
|
+
PREFIX: string;
|
|
3
|
+
IMG: string;
|
|
4
|
+
IMG_WRAPPER: string;
|
|
5
|
+
CROPPER_BOX: string;
|
|
6
|
+
CROPPER_VIEW_BOX: string;
|
|
7
|
+
CROPPER_VIEW_BOX_ROUND: string;
|
|
8
|
+
CROPPER_IMG: string;
|
|
9
|
+
MASK: string;
|
|
10
|
+
CORNER: string;
|
|
11
|
+
};
|
|
12
|
+
declare const strings: {
|
|
13
|
+
shape: string[];
|
|
14
|
+
corner: string[];
|
|
15
|
+
roundCorner: string[];
|
|
16
|
+
};
|
|
17
|
+
export { cssClasses, strings };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
|
+
const moduleName = `${BASE_CLASS_PREFIX}-cropper`;
|
|
3
|
+
const cssClasses = {
|
|
4
|
+
PREFIX: `${moduleName}`,
|
|
5
|
+
IMG: `${moduleName}-img`,
|
|
6
|
+
IMG_WRAPPER: `${moduleName}-img-wrapper`,
|
|
7
|
+
CROPPER_BOX: `${moduleName}-box`,
|
|
8
|
+
CROPPER_VIEW_BOX: `${moduleName}-view-box`,
|
|
9
|
+
CROPPER_VIEW_BOX_ROUND: `${moduleName}-view-box-round`,
|
|
10
|
+
CROPPER_IMG: `${moduleName}-view-img`,
|
|
11
|
+
MASK: `${moduleName}-mask`,
|
|
12
|
+
CORNER: `${moduleName}-box-corner`
|
|
13
|
+
};
|
|
14
|
+
const strings = {
|
|
15
|
+
shape: ['rect', 'round', 'roundRect'],
|
|
16
|
+
corner: ['tl', 'tm', 'tr', 'ml', 'mr', 'bl', 'bm', 'br'],
|
|
17
|
+
roundCorner: ['tm', 'ml', 'mr', 'bm']
|
|
18
|
+
};
|
|
19
|
+
export { cssClasses, strings };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* shadow */
|
|
2
|
+
/* sizing */
|
|
3
|
+
/* spacing */
|
|
4
|
+
.semi-cropper {
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
.semi-cropper-img {
|
|
8
|
+
position: absolute;
|
|
9
|
+
user-select: none;
|
|
10
|
+
}
|
|
11
|
+
.semi-cropper-img-wrapper {
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
}
|
|
19
|
+
.semi-cropper-mask {
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
background: var(--semi-color-overlay-bg);
|
|
26
|
+
cursor: move;
|
|
27
|
+
}
|
|
28
|
+
.semi-cropper-box {
|
|
29
|
+
position: absolute;
|
|
30
|
+
outline: 1px solid var(--semi-color-primary);
|
|
31
|
+
}
|
|
32
|
+
.semi-cropper-box-corner {
|
|
33
|
+
position: absolute;
|
|
34
|
+
background: var(--semi-color-primary);
|
|
35
|
+
width: 10px;
|
|
36
|
+
height: 10px;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
}
|
|
39
|
+
.semi-cropper-box-corner-tl {
|
|
40
|
+
top: -5px;
|
|
41
|
+
left: -5px;
|
|
42
|
+
cursor: nwse-resize;
|
|
43
|
+
}
|
|
44
|
+
.semi-cropper-box-corner-tr {
|
|
45
|
+
top: -5px;
|
|
46
|
+
right: -5px;
|
|
47
|
+
cursor: nesw-resize;
|
|
48
|
+
}
|
|
49
|
+
.semi-cropper-box-corner-tm {
|
|
50
|
+
top: -5px;
|
|
51
|
+
left: 50%;
|
|
52
|
+
margin-left: -5px;
|
|
53
|
+
cursor: ns-resize;
|
|
54
|
+
}
|
|
55
|
+
.semi-cropper-box-corner-ml {
|
|
56
|
+
top: 50%;
|
|
57
|
+
left: -5px;
|
|
58
|
+
margin-top: -5px;
|
|
59
|
+
cursor: ew-resize;
|
|
60
|
+
}
|
|
61
|
+
.semi-cropper-box-corner-mr {
|
|
62
|
+
top: 50%;
|
|
63
|
+
right: -5px;
|
|
64
|
+
margin-top: -5px;
|
|
65
|
+
cursor: ew-resize;
|
|
66
|
+
}
|
|
67
|
+
.semi-cropper-box-corner-bl {
|
|
68
|
+
bottom: -5px;
|
|
69
|
+
left: -5px;
|
|
70
|
+
cursor: nesw-resize;
|
|
71
|
+
}
|
|
72
|
+
.semi-cropper-box-corner-bm {
|
|
73
|
+
bottom: -5px;
|
|
74
|
+
left: 50%;
|
|
75
|
+
margin-left: -5px;
|
|
76
|
+
cursor: ns-resize;
|
|
77
|
+
}
|
|
78
|
+
.semi-cropper-box-corner-br {
|
|
79
|
+
bottom: -5px;
|
|
80
|
+
right: -5px;
|
|
81
|
+
cursor: nwse-resize;
|
|
82
|
+
}
|
|
83
|
+
.semi-cropper-view-box {
|
|
84
|
+
position: absolute;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
cursor: move;
|
|
87
|
+
top: 0;
|
|
88
|
+
left: 0;
|
|
89
|
+
right: 0;
|
|
90
|
+
bottom: 0;
|
|
91
|
+
}
|
|
92
|
+
.semi-cropper-view-box-round {
|
|
93
|
+
border-radius: 50%;
|
|
94
|
+
}
|
|
95
|
+
.semi-cropper-view-img {
|
|
96
|
+
user-select: none;
|
|
97
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
@import "./variables.scss";
|
|
2
|
+
$module: #{$prefix}-cropper;
|
|
3
|
+
|
|
4
|
+
$half_corner_width: calc($width-cropper_box_corner / 2);
|
|
5
|
+
|
|
6
|
+
.#{$module} {
|
|
7
|
+
position: relative;
|
|
8
|
+
|
|
9
|
+
&-img {
|
|
10
|
+
position: absolute;
|
|
11
|
+
user-select: none;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-img-wrapper {
|
|
15
|
+
position: absolute;
|
|
16
|
+
top: 0;
|
|
17
|
+
left: 0;
|
|
18
|
+
right: 0;
|
|
19
|
+
bottom: 0;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&-mask {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
background: $color-cropper_mask-bg;
|
|
30
|
+
cursor: move;;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&-box {
|
|
34
|
+
position: absolute;
|
|
35
|
+
outline: $width-cropper_box-outline solid $color-cropper_box-outline;
|
|
36
|
+
|
|
37
|
+
&-corner {
|
|
38
|
+
position: absolute;
|
|
39
|
+
background: $color-cropper_box_corner-bg;
|
|
40
|
+
width: $width-cropper_box_corner;
|
|
41
|
+
height: $width-cropper_box_corner;
|
|
42
|
+
z-index: 1;
|
|
43
|
+
|
|
44
|
+
&-tl {
|
|
45
|
+
top: -$half_corner_width;
|
|
46
|
+
left: -$half_corner_width;
|
|
47
|
+
cursor: nwse-resize;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&-tr {
|
|
51
|
+
top: -$half_corner_width;
|
|
52
|
+
right: -$half_corner_width;
|
|
53
|
+
cursor: nesw-resize;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-tm {
|
|
57
|
+
top: -$half_corner_width;
|
|
58
|
+
left: 50%;
|
|
59
|
+
margin-left: -$half_corner_width;
|
|
60
|
+
cursor: ns-resize;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&-ml {
|
|
64
|
+
top: 50%;
|
|
65
|
+
left: -$half_corner_width;
|
|
66
|
+
margin-top: -$half_corner_width;
|
|
67
|
+
cursor: ew-resize;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&-mr {
|
|
71
|
+
top: 50%;
|
|
72
|
+
right: -$half_corner_width;
|
|
73
|
+
margin-top: -$half_corner_width;
|
|
74
|
+
cursor: ew-resize;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&-bl {
|
|
78
|
+
bottom: -$half_corner_width;
|
|
79
|
+
left: -$half_corner_width;
|
|
80
|
+
cursor: nesw-resize;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&-bm {
|
|
84
|
+
bottom: -$half_corner_width;
|
|
85
|
+
left: 50%;
|
|
86
|
+
margin-left: -$half_corner_width;
|
|
87
|
+
cursor: ns-resize;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&-br {
|
|
91
|
+
bottom: -$half_corner_width;
|
|
92
|
+
right: -$half_corner_width;
|
|
93
|
+
cursor: nwse-resize
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&-view-box {
|
|
99
|
+
position: absolute;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
cursor: move;
|
|
102
|
+
top: 0;
|
|
103
|
+
left: 0;
|
|
104
|
+
right: 0;
|
|
105
|
+
bottom: 0;
|
|
106
|
+
|
|
107
|
+
&-round {
|
|
108
|
+
border-radius: 50%;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&-view-img {
|
|
113
|
+
// position: absolute;
|
|
114
|
+
user-select: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from "../base/foundation";
|
|
2
|
+
export interface CropperAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
|
+
getContainer: () => HTMLElement;
|
|
4
|
+
notifyZoomChange: (zoom: number) => void;
|
|
5
|
+
getImg: () => HTMLImageElement;
|
|
6
|
+
}
|
|
7
|
+
interface Point {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ImageData {
|
|
12
|
+
originalWidth: number;
|
|
13
|
+
originalHeight: number;
|
|
14
|
+
scale: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ImageDataState {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
centerPoint: Point;
|
|
20
|
+
}
|
|
21
|
+
export interface CropperBox {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
centerPoint: Point;
|
|
25
|
+
}
|
|
26
|
+
export interface ContainerData {
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
}
|
|
30
|
+
export interface CropperBoxBorder {
|
|
31
|
+
borderTop: number;
|
|
32
|
+
borderLeft: number;
|
|
33
|
+
}
|
|
34
|
+
export default class CropperFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CropperAdapter<P, S>, P, S> {
|
|
35
|
+
imgData: ImageData;
|
|
36
|
+
containerData: ContainerData;
|
|
37
|
+
boxMoveDir: string;
|
|
38
|
+
cropperBoxMoveStart: Point;
|
|
39
|
+
imgMoveStart: Point;
|
|
40
|
+
moveRange: {
|
|
41
|
+
xMax: number;
|
|
42
|
+
xMin: number;
|
|
43
|
+
yMax: number;
|
|
44
|
+
yMin: number;
|
|
45
|
+
};
|
|
46
|
+
boxMoveParam: {
|
|
47
|
+
paramX: number;
|
|
48
|
+
paramY: number;
|
|
49
|
+
};
|
|
50
|
+
cropperBox: CropperBoxBorder;
|
|
51
|
+
rangeX: [number, number];
|
|
52
|
+
rangeY: [number, number];
|
|
53
|
+
initial: boolean;
|
|
54
|
+
constructor(adapter: CropperAdapter<P, S>);
|
|
55
|
+
init(): void;
|
|
56
|
+
destroy(): void;
|
|
57
|
+
getImgDataWhenResize: (ratio: number) => {
|
|
58
|
+
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
centerPoint: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
getCropperBoxWhenResize: (ratio: number, newContainerData: ContainerData) => {
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
centerPoint: {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
handleResize: () => void;
|
|
74
|
+
handleImageLoad: (e: any) => void;
|
|
75
|
+
handleWheel: (e: any) => void;
|
|
76
|
+
getMoveParamByDir(dir: string): {
|
|
77
|
+
paramX: number;
|
|
78
|
+
paramY: number;
|
|
79
|
+
};
|
|
80
|
+
getRangeForAspectChange: () => void;
|
|
81
|
+
handleCornerMouseDown: (e: any) => void;
|
|
82
|
+
bindResizeEvent: () => void;
|
|
83
|
+
unBindResizeEvent: () => void;
|
|
84
|
+
viewIMGDragStart: (e: any) => void;
|
|
85
|
+
handleCornerAspectMouseMove: (e: any) => void;
|
|
86
|
+
changeDir: () => void;
|
|
87
|
+
handleCornerMouseMove: (e: any) => void;
|
|
88
|
+
handleCornerMouseUp: (e: any) => void;
|
|
89
|
+
handleCropperBoxMouseDown: (e: any) => void;
|
|
90
|
+
bindMoveEvent: () => void;
|
|
91
|
+
unBindMoveEvent: () => void;
|
|
92
|
+
handleCropperBoxMouseMove: (e: any) => void;
|
|
93
|
+
handleCropperBoxMouseUp: (e: any) => void;
|
|
94
|
+
handleMaskMouseDown: (e: any) => void;
|
|
95
|
+
bindImgMoveEvent: () => void;
|
|
96
|
+
unBindImgMoveEvent: () => void;
|
|
97
|
+
handleImgMove: (e: any) => void;
|
|
98
|
+
handleImgMoveUp: (e: any) => void;
|
|
99
|
+
getCropperCanvas: () => HTMLCanvasElement;
|
|
100
|
+
}
|
|
101
|
+
export {};
|