@versa_ai/vmml-editor 1.0.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.
Files changed (47) hide show
  1. package/.turbo/turbo-build.log +335 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +1 -0
  4. package/biome.json +7 -0
  5. package/dist/index.d.mts +5 -0
  6. package/dist/index.d.ts +5 -0
  7. package/dist/index.js +2675 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/index.mjs +2673 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/package.json +48 -0
  12. package/postcss.config.js +3 -0
  13. package/src/assets/css/closeLayer.scss +50 -0
  14. package/src/assets/css/colorSelector.scss +59 -0
  15. package/src/assets/css/editorTextMenu.less +130 -0
  16. package/src/assets/css/editorTextMenu.scss +149 -0
  17. package/src/assets/css/index.scss +252 -0
  18. package/src/assets/css/loading.scss +31 -0
  19. package/src/assets/css/maxTextLayer.scss +31 -0
  20. package/src/assets/img/icon_Brush.png +0 -0
  21. package/src/assets/img/icon_Change.png +0 -0
  22. package/src/assets/img/icon_Cut.png +0 -0
  23. package/src/assets/img/icon_Face.png +0 -0
  24. package/src/assets/img/icon_Graffiti.png +0 -0
  25. package/src/assets/img/icon_Mute.png +0 -0
  26. package/src/assets/img/icon_Refresh.png +0 -0
  27. package/src/assets/img/icon_Text1.png +0 -0
  28. package/src/assets/img/icon_Text2.png +0 -0
  29. package/src/assets/img/icon_Volume.png +0 -0
  30. package/src/assets/img/icon_Word.png +0 -0
  31. package/src/components/CloseLayer.tsx +25 -0
  32. package/src/components/ColorSelector.tsx +90 -0
  33. package/src/components/Controls.tsx +32 -0
  34. package/src/components/EditorCanvas.tsx +566 -0
  35. package/src/components/Loading.tsx +16 -0
  36. package/src/components/MaxTextLayer.tsx +27 -0
  37. package/src/components/SeekBar.tsx +126 -0
  38. package/src/components/TextMenu.tsx +332 -0
  39. package/src/components/VideoMenu.tsx +49 -0
  40. package/src/index.tsx +551 -0
  41. package/src/utils/HistoryClass.ts +131 -0
  42. package/src/utils/VmmlConverter.ts +339 -0
  43. package/src/utils/const.ts +10 -0
  44. package/src/utils/keyBoardUtils.ts +199 -0
  45. package/src/utils/usePeekControl.ts +242 -0
  46. package/tsconfig.json +5 -0
  47. package/tsup.config.ts +14 -0
@@ -0,0 +1,50 @@
1
+ .closeLayer{
2
+ width: 100vw;
3
+ height: 100vh;
4
+ position: fixed;
5
+ left: 0;
6
+ top: 0;
7
+ background: rgba(0,0,0,0.55);
8
+ &>div{
9
+ width: 74.667vw;
10
+ height: 34.933vw;
11
+ background: #fff;
12
+ border-radius: 3.2vw;
13
+ position: absolute;
14
+ left: 50%;
15
+ top: 50%;
16
+ transform: translate(-50%, -50%);
17
+ text-align: center;
18
+ &>p{
19
+ width: 100%;
20
+ height: 21.6vw;
21
+ font-size: 4vw;
22
+ line-height: 5.6vw;
23
+ color: #333;
24
+ display: flex;
25
+ justify-content: center;
26
+ align-items: center;
27
+ }
28
+ &>div{
29
+ display: flex;
30
+ border-top: 1px solid #e5e5e5;
31
+ position: relative;
32
+ &>p{
33
+ width: 50%;
34
+ height: 13.067vw;
35
+ line-height: 13.067vw;
36
+ text-align: center;
37
+ color: #1677FF;
38
+ cursor: pointer;
39
+ }
40
+ &>div{
41
+ width: 1px;
42
+ height: 13.067vw;
43
+ background-color: #e5e5e5;
44
+ left: 50%;
45
+ top: 0;
46
+ transform: translateX(-50%);
47
+ }
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,59 @@
1
+ $vm_base: 750;
2
+
3
+ @function vm($px) {
4
+
5
+ @return ($px / 750) * 100vw;
6
+
7
+ }
8
+
9
+ .color-selector{
10
+ width: 100%;
11
+ height: 100%;
12
+ display: flex;
13
+ flex-flow: row nowrap;
14
+ align-items: center;
15
+ padding-right: vm(20);
16
+ .text_bg_change{
17
+ width: vm(48);
18
+ height: vm(48);
19
+ flex: 0 0 auto;
20
+ text-align: center;
21
+ line-height: vm(48);
22
+ padding:0 vm(36);
23
+ margin-right: vm(30);
24
+ border-right: 2px solid #FFFFFF66; /* 设置左边框的宽度、样式和颜色 */
25
+ }
26
+ .text_color_change{
27
+ flex: 1 1 auto;
28
+ display: flex;
29
+ flex-flow: row nowrap;
30
+ overflow-x: auto; // 允许横向滚动
31
+ white-space: nowrap; // 确保文本不会换行
32
+ height:100%;
33
+ padding-right: vm(10);
34
+ align-items: center;
35
+ & > * {
36
+ flex-shrink: 0; // 防止子元素缩小
37
+ }
38
+ .color-item{
39
+ width: vm(48);
40
+ height:vm(48);
41
+ border-radius: 50%;
42
+ margin: 0 vm(15);
43
+ box-sizing: border-box;
44
+ }
45
+ .black-border{
46
+ border:vm(2) solid #333333FF
47
+ }
48
+ .current{
49
+ // border: vm(6) solid #1677FF;
50
+ box-shadow: 0 0 0 vm(6) #1677FF;
51
+ }
52
+ // 隐藏滚动条,但仍然保持滚动功能
53
+ &::-webkit-scrollbar {
54
+ display: none;
55
+ }
56
+ -ms-overflow-style: none; /* IE and Edge */
57
+ scrollbar-width: none; /* Firefox */
58
+ }
59
+ }
@@ -0,0 +1,130 @@
1
+ .overlay {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ background-color: rgba(0, 0, 0, 0.5);
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ color: white;
12
+ font-size: 24px;
13
+ overflow: hidden;
14
+ }
15
+ .overlay > .text-header {
16
+ width: 100%;
17
+ display: flex;
18
+ justify-content: space-between;
19
+ align-items: center;
20
+ height: 11.467vw;
21
+ padding-left: 4.4vw;
22
+ padding-right: 3.2vw;
23
+ box-sizing: border-box;
24
+ position: fixed;
25
+ top: 0;
26
+ transition: all 0.01s;
27
+ z-index: 16;
28
+ }
29
+ .overlay > .text-header > .close {
30
+ width: 5.0666666667vw;
31
+ height: 5.0666666667vw;
32
+ }
33
+ .overlay > .text-header > .close img {
34
+ width: 100%;
35
+ height: 100%;
36
+ }
37
+ .overlay > .text-header > .history-operate {
38
+ height: 7.2vw;
39
+ display: none;
40
+ align-items: center;
41
+ position: absolute;
42
+ left: 50%;
43
+ top: 50%;
44
+ transform: translate(-50%, -50%);
45
+ }
46
+ .overlay > .text-header > .history-operate img {
47
+ width: 4.667vw;
48
+ height: 5.067vw;
49
+ }
50
+ .overlay > .text-header > .history-operate > img:last-child {
51
+ margin-left: 8vw;
52
+ }
53
+ .overlay > .text-header > .next-button {
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ width: 16vw;
58
+ height: 7.2vw;
59
+ line-height: 7.2vw;
60
+ background: #1677FF;
61
+ border-radius: 6.533vw;
62
+ text-align: center;
63
+ font-size: 3.2vw;
64
+ color: #fff;
65
+ border: 0;
66
+ }
67
+ .overlay .cover {
68
+ position: fixed;
69
+ bottom: 8vw;
70
+ width: 100%;
71
+ height: 10.6666666667vw;
72
+ z-index: 999;
73
+ transition: all 0.1s;
74
+ }
75
+ .overlay .text-input, .overlay .mappingarea {
76
+ font-family: PingFangSC, PingFang SC;
77
+ border: none;
78
+ font-size: 22px;
79
+ /* 取消外边框 */
80
+ outline: none;
81
+ background-color: rgba(0, 0, 0, 0);
82
+ line-height: 30px;
83
+ -ms-overflow-style: none;
84
+ /* IE and Edge */
85
+ scrollbar-width: none;
86
+ /* Firefox */
87
+ transition: all 0.1s;
88
+ }
89
+ .overlay .text-input::-webkit-scrollbar, .overlay .mappingarea::-webkit-scrollbar {
90
+ display: none;
91
+ }
92
+ .overlay .text-input {
93
+ padding-top: 1.0666666667vw;
94
+ padding-bottom: 1.0666666667vw;
95
+ padding-left: 1.6vw;
96
+ padding-right: 1.3333333333vw;
97
+ z-index: 10;
98
+ width: 84vw;
99
+ caret-color: #1677FFFF;
100
+ position: absolute;
101
+ top: 30%;
102
+ left: 5%;
103
+ height: 200px;
104
+ word-break: break-all;
105
+ }
106
+ .overlay .mappingarea {
107
+ padding-top: 1.0666666667vw;
108
+ padding-bottom: 1.0666666667vw;
109
+ padding-left: 1.6vw;
110
+ padding-right: 1.3333333333vw;
111
+ border-radius: 1.3333333333vw;
112
+ border: 0;
113
+ position: fixed;
114
+ top: 30%;
115
+ left: 5%;
116
+ height: fit-content;
117
+ max-height: 200px;
118
+ color: transparent;
119
+ overflow-y: scroll;
120
+ z-index: 9;
121
+ display: flex;
122
+ flex-flow: column nowrap;
123
+ box-sizing: content-box;
124
+ }
125
+ .overlay .mappingarea .mappingarea_span {
126
+ font-size: 22px;
127
+ max-width: 84vw;
128
+ white-space: pre-wrap;
129
+ word-break: break-all;
130
+ }
@@ -0,0 +1,149 @@
1
+ $vm_base: 750;
2
+
3
+ @function vm($px) {
4
+
5
+ @return ($px / 750) * 100vw;
6
+
7
+ }
8
+ .overlay {
9
+ position: fixed;
10
+ top: 0;
11
+ left: 0;
12
+ width: 100%;
13
+ height: 100%;
14
+ background-color: rgba(0, 0, 0, 0.5);
15
+ // backdrop-filter: blur(10px);
16
+ // -webkit-backdrop-filter: blur(10px);
17
+ display: flex;
18
+ justify-content: center;
19
+ align-items: center;
20
+ color: white;
21
+ font-size: 24px;
22
+ overflow: hidden;
23
+ // 顶部
24
+ &>.text-header {
25
+ width: 100%;
26
+ display: flex;
27
+ justify-content: space-between;
28
+ align-items: center;
29
+ height: 11.467vw;
30
+ padding-left: 4.4vw;
31
+ padding-right: 3.2vw;
32
+ box-sizing: border-box;
33
+ position: fixed;
34
+ top: 0;
35
+ transition: all 0.01s;
36
+ z-index:16;
37
+ &>.close {
38
+ width: vm(38);
39
+ height: vm(38);
40
+
41
+ img {
42
+ width: 100%;
43
+ height: 100%;
44
+ }
45
+ }
46
+
47
+ &>.history-operate {
48
+ height: 7.2vw;
49
+ display: none;
50
+ align-items: center;
51
+ position: absolute;
52
+ left: 50%;
53
+ top: 50%;
54
+ transform: translate(-50%, -50%);
55
+
56
+ img {
57
+ width: 4.667vw;
58
+ height: 5.067vw;
59
+ }
60
+
61
+ &>img:last-child {
62
+ margin-left: 8vw;
63
+ }
64
+ }
65
+
66
+ &>.next-button {
67
+ display: flex;
68
+ justify-content: center;
69
+ align-items: center;
70
+ width: 16vw;
71
+ height: 7.2vw;
72
+ line-height: 7.2vw;
73
+ background: #1677FF;
74
+ border-radius: 6.533vw;
75
+ text-align: center;
76
+ font-size: 3.2vw;
77
+ color: #fff;
78
+ border: 0;
79
+ }
80
+ }
81
+
82
+ .cover {
83
+ position: fixed;
84
+ bottom: vm(60);
85
+ width: 100%;
86
+ height:vm(80);
87
+ z-index: 999;
88
+ transition: all 0.1s;
89
+ }
90
+
91
+ .text-input,.mappingarea{
92
+ // font-family:;
93
+ font-family: PingFangSC, PingFang SC;
94
+ border: none;
95
+ // font-weight: 600;
96
+ font-size: 22px;
97
+ /* 取消外边框 */
98
+ outline: none;
99
+ background-color: rgba(0, 0, 0, 0);
100
+ line-height: 30px;
101
+ // 隐藏滚动条,但仍然保持滚动功能
102
+ &::-webkit-scrollbar {
103
+ display: none;
104
+ }
105
+ -ms-overflow-style: none; /* IE and Edge */
106
+ scrollbar-width: none; /* Firefox */
107
+ transition: all 0.1s;
108
+ }
109
+ .text-input{
110
+ padding-top: vm(8);
111
+ padding-bottom: vm(8);
112
+ padding-left: vm(12);
113
+ padding-right: vm(10);
114
+ z-index: 10;
115
+ width: 84vw;
116
+ caret-color: #1677FFFF;
117
+ position: absolute;
118
+ top: 30%;
119
+ left: 5%;
120
+ height: 200px;
121
+ word-break: break-all;
122
+ // padding: vm(18);
123
+ }
124
+ .mappingarea{
125
+ padding-top: vm(8);
126
+ padding-bottom: vm(8);
127
+ padding-left: vm(12);
128
+ padding-right: vm(10);
129
+ border-radius: vm(10);
130
+ border:0;
131
+ position: fixed;
132
+ top: 30%;
133
+ left: 5%;
134
+ height: fit-content;
135
+ max-height: 200px;
136
+ color: transparent; //设置颜色透明,保证背景颜色
137
+ overflow-y: scroll;
138
+ z-index: 9;
139
+ display: flex;
140
+ flex-flow: column nowrap;
141
+ box-sizing: content-box;
142
+ .mappingarea_span{
143
+ font-size: 22px;
144
+ max-width: 84vw;
145
+ white-space: pre-wrap;
146
+ word-break: break-all;
147
+ }
148
+ }
149
+ }
@@ -0,0 +1,252 @@
1
+ .editor{
2
+ background: #000;
3
+ width: 100%;
4
+ min-height: 100vh;
5
+ overflow: hidden;
6
+ display: flex;
7
+ flex-direction: column;
8
+ .padding-box {
9
+ flex: 1;
10
+ }
11
+ // 顶部
12
+ &>.header{
13
+ width: 100%;
14
+ display: flex;
15
+ justify-content: space-between;
16
+ align-items: center;
17
+ height: 11.467vw;
18
+ padding-left: 4.4vw;
19
+ padding-right: 3.2vw;
20
+ box-sizing: border-box;
21
+ position: relative;
22
+ &>.close{
23
+ width: 4vw;
24
+ height: 4vw;
25
+ img{
26
+ width: 100%;
27
+ height: 100%;
28
+ }
29
+ }
30
+ &>.history-operate{
31
+ height: 7.2vw;
32
+ display: none;
33
+ align-items: center;
34
+ position: absolute;
35
+ left: 50%;
36
+ top: 50%;
37
+ transform: translate(-50%,-50%);
38
+ img{
39
+ width: 4.667vw;
40
+ height: 5.067vw;
41
+ }
42
+ &>img:last-child{
43
+ margin-left: 8vw;
44
+ }
45
+ }
46
+ &>.next-button{
47
+ width: 16vw;
48
+ height: 7.2vw;
49
+ line-height: 7.2vw;
50
+ background: #1677FF;
51
+ border-radius: 6.533vw;
52
+ text-align: center;
53
+ font-size: 3.2vw;
54
+ color: #fff;
55
+ }
56
+ }
57
+ .text-style{
58
+ filter:blur(10px)
59
+ }
60
+
61
+ .editor-vessel {
62
+ padding-top: 3.2vw;
63
+ }
64
+ //player与画布
65
+ .main{
66
+ width: 81.467vw;
67
+ height: 144.8vw;
68
+ margin: auto;
69
+ position: relative;
70
+ display: flex;
71
+ justify-content: center;
72
+ border-radius: 3.2vw;
73
+ overflow: hidden;
74
+ .vessel {
75
+ width: 100%;
76
+ height: 100%;
77
+ }
78
+ .controls-box {
79
+ height: 12vw;
80
+ position: absolute;
81
+ bottom: 0;
82
+ width: 100%;
83
+ border-radius: 3.2vw;
84
+ }
85
+ .player-controls {
86
+ display: flex;
87
+ align-items: center;
88
+ width: 100%;
89
+ height: 100%;
90
+ padding: 0 2.13vw;
91
+ box-sizing: border-box;
92
+ background: linear-gradient( 180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.6) 100%);
93
+ .mr-16 {
94
+ margin-right: 2.13vw;
95
+ }
96
+ .player-controls-toggle {
97
+ >img {
98
+ display: block;
99
+ width: 4.8vw;
100
+ height: 4.8vw;
101
+ cursor: pointer;
102
+ }
103
+ }
104
+ .player-controls-seekbar {
105
+ flex: 1;
106
+ position: relative;
107
+ .seekbar-container {
108
+ height: 100%;
109
+ user-select: none;
110
+ touch-action: none;
111
+ position: relative;
112
+ cursor: pointer;
113
+ box-sizing: border-box;
114
+ .seekbar-background {
115
+ user-select: none;
116
+ height: 1.6vw;
117
+ width: 100%;
118
+ background-color: rgba(255, 255, 255, 0.2);
119
+ border-radius: 1vw;
120
+ .seekbar-fill {
121
+ position: absolute;
122
+ user-select: none;
123
+ width: 100%;
124
+ height: 100%;
125
+ border-radius: 1vw;
126
+ }
127
+ .seekbar-line {
128
+ height: 100%;
129
+ border-radius: 1vw;
130
+ background-color: #eeeeee;
131
+ }
132
+ .seekbar-sign {
133
+ width: 10px;
134
+ position: absolute;
135
+ top: 50%;
136
+ margin-top: -6px;
137
+ }
138
+ .seekbar-cirle {
139
+ position: absolute;
140
+ top: -0.8vw;
141
+ width: 3.2vw;
142
+ height: 3.2vw;
143
+ border-radius: 50%;
144
+ background: #eeeeee;
145
+ }
146
+ }
147
+ }
148
+ }
149
+ .player-controls-time {
150
+ width: 10vw;
151
+ color: #fff;
152
+ }
153
+ }
154
+ .play-btn {
155
+ position: absolute;
156
+ bottom: 4vw;
157
+ left: 3vw;
158
+ width: 4.8vw;
159
+ height: 4.8vw;
160
+ img {
161
+ width: 100%;
162
+ height: 100%;
163
+ display: block;
164
+ }
165
+ }
166
+ .opacity-06 {
167
+ opacity: 0.6;
168
+ }
169
+ }
170
+
171
+ //底部
172
+ .footer{
173
+ display: flex;
174
+ justify-content: center;
175
+ box-sizing: border-box;
176
+ width: 100%;
177
+ padding: 0 20.333vw 10.933vw;
178
+ &>div{
179
+ width: 30%;
180
+ margin: 0 15%;
181
+ img{
182
+ width: 6.4vw;
183
+ height: 6.4vw;
184
+ display: block;
185
+ margin: auto;
186
+ }
187
+ p{
188
+ font-size: 3.2vw;
189
+ color: #fff;
190
+ margin-top: 1.867vw;
191
+ text-align: center;
192
+ }
193
+ }
194
+ }
195
+
196
+ .not-show-text{
197
+ justify-content: space-around;
198
+ }
199
+
200
+ .editor-video-menu {
201
+ position: fixed;
202
+ // height: 38.13vh;
203
+ height: 0;
204
+ width: 100%;
205
+ background: #1E1E1E;
206
+ bottom: 0;
207
+ border-radius: 8px 8px 0 0;
208
+ transition: all 0.5s ease-in-out;
209
+ &.active {
210
+ height: 38.13vh;
211
+ }
212
+ .editor-video-menu-header {
213
+ display: flex;
214
+ padding: 1.6vw 1.6vw 0;
215
+ height: 4.81vh;
216
+ line-height: 4.81vh;
217
+ color: rgba(255, 255, 255, 0.40);
218
+ overflow: hidden;
219
+ overflow-x: auto;
220
+ &::-webkit-scrollbar {
221
+ display: none; /* 隐藏滚动条 */
222
+ }
223
+ >div {
224
+ margin: 0 3.2vw;
225
+ white-space: nowrap;
226
+ }
227
+ .active {
228
+ color: #FFFFFF;
229
+ }
230
+ }
231
+ .editor-video-menu-itmes {
232
+ padding: 0 3.33vw;
233
+ max-height: calc(100% - 4.81vh - 1.6vw);
234
+ display: grid;
235
+ grid-template-columns: repeat(4, 1fr);
236
+ row-gap: 3.2vw;
237
+ column-gap: 2.6vw;
238
+ overflow: auto;
239
+ >div {
240
+ width: 21.33vw;
241
+ height: 21.33vw;
242
+ background-color: #1e1e1e;
243
+ img {
244
+ width: 100%;
245
+ height: 100%;
246
+ object-fit: contain;
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ }
@@ -0,0 +1,31 @@
1
+
2
+ .page-loader {
3
+ position: absolute;
4
+ top: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ display: flex;
8
+ justify-content: center;
9
+ align-items: center;
10
+ z-index: 100;
11
+ overflow: hidden;
12
+ .light {
13
+ width: 75%;
14
+ height: 100%;
15
+ background: linear-gradient(90deg,
16
+ rgba(255, 255, 255, 0),
17
+ rgba(255, 255, 255, 0.15),
18
+ rgba(255, 255, 255, 0.3),
19
+ rgba(255, 255, 255, 0.15),
20
+ rgba(255, 255, 255, 0.0),
21
+ );
22
+ transform: skew(-45deg) translateX(-400%);
23
+ animation: animate_light 1s infinite;
24
+ }
25
+ }
26
+
27
+ @keyframes animate_light {
28
+ 100% {
29
+ transform: skew(-45deg) translateX(200%);
30
+ }
31
+ }
@@ -0,0 +1,31 @@
1
+ $vm_base: 750;
2
+
3
+ @function vm($px) {
4
+
5
+ @return ($px / 750) * 100vw;
6
+
7
+ }
8
+
9
+ .container{
10
+ width: 100vw;
11
+ height: 100vh;
12
+ position: fixed;
13
+ left: 0;
14
+ top: 0;
15
+ display: flex;
16
+ flex-flow: row nowrap;
17
+ align-items: center;
18
+ justify-content: center;
19
+ .main_text{
20
+ background: #000000;
21
+ border-radius: 16px;
22
+ backdrop-filter: blur(40px);
23
+ padding: vm(24);
24
+ font-weight: 400;
25
+ font-size: vm(30);
26
+ color: #FFFFFF;
27
+ line-height: vm(42);
28
+ text-align: right;
29
+ font-style: normal;
30
+ }
31
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file