@arcblock/terminal 3.1.7 → 3.1.9
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/LICENSE +1 -1
- package/README.md +130 -5
- package/lib/Player.js +74 -85
- package/lib/Terminal.js +13 -7
- package/lib/styles.js +299 -0
- package/package.json +4 -4
- package/src/Player.jsx +29 -36
- package/src/Player.stories.jsx +4 -0
- package/src/Terminal.jsx +8 -4
- package/src/styles.js +362 -0
- package/lib/player.css +0 -378
- package/lib/xterm.css +0 -171
- package/src/player.css +0 -378
- package/src/xterm.css +0 -171
package/src/styles.js
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import styled from '@emotion/styled';
|
|
2
|
+
|
|
3
|
+
// Terminal Player Root with camelCase styles
|
|
4
|
+
export const PlayerRoot = styled.div({
|
|
5
|
+
// Base styles for .terminal-player
|
|
6
|
+
display: 'inline-block',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
fontSize: 0,
|
|
9
|
+
|
|
10
|
+
// Terminal styles
|
|
11
|
+
'& .terminal': { display: 'inline-block' },
|
|
12
|
+
|
|
13
|
+
'& .terminal .xterm .xterm-viewport': { overflowY: 'hidden !important' },
|
|
14
|
+
|
|
15
|
+
// Terminal frame
|
|
16
|
+
'& .terminal-frame': { position: 'relative' },
|
|
17
|
+
|
|
18
|
+
// Reset styles for terminal divs
|
|
19
|
+
'& .terminal div': {
|
|
20
|
+
margin: 0,
|
|
21
|
+
padding: 0,
|
|
22
|
+
border: 0,
|
|
23
|
+
outline: 0,
|
|
24
|
+
fontWeight: 'inherit',
|
|
25
|
+
fontStyle: 'inherit',
|
|
26
|
+
fontSize: '100%',
|
|
27
|
+
fontFamily: 'inherit',
|
|
28
|
+
verticalAlign: 'baseline',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Window theme
|
|
32
|
+
'&.terminal-window .terminal-frame': {
|
|
33
|
+
borderRadius: 6,
|
|
34
|
+
border: '1px solid #b3b3b3',
|
|
35
|
+
boxShadow: '0px 0px 18px #b3b3b3',
|
|
36
|
+
margin: 18,
|
|
37
|
+
overflow: 'hidden',
|
|
38
|
+
|
|
39
|
+
'& .terminal-titlebar': {
|
|
40
|
+
background: '#e8e8e8',
|
|
41
|
+
borderBottom: '1px solid #b1aeb1',
|
|
42
|
+
borderTop: '1px solid #f3f1f3',
|
|
43
|
+
borderTopLeftRadius: 6,
|
|
44
|
+
borderTopRightRadius: 6,
|
|
45
|
+
color: '#3b4247',
|
|
46
|
+
fontFamily: 'Arial, sans-serif',
|
|
47
|
+
fontSize: 14,
|
|
48
|
+
height: 22,
|
|
49
|
+
lineHeight: '22px',
|
|
50
|
+
position: 'relative',
|
|
51
|
+
textAlign: 'center',
|
|
52
|
+
width: '100%',
|
|
53
|
+
|
|
54
|
+
'& .buttons': { left: 8, lineHeight: '0px', position: 'absolute', top: 3.5 },
|
|
55
|
+
|
|
56
|
+
'& .close-button': {
|
|
57
|
+
background: '#ff5c5c',
|
|
58
|
+
borderRadius: '50%',
|
|
59
|
+
border: '1px solid #e33e41',
|
|
60
|
+
display: 'inline-block',
|
|
61
|
+
height: 12,
|
|
62
|
+
width: 12,
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
'& .minimize-button': {
|
|
66
|
+
background: '#ffbd4c',
|
|
67
|
+
borderRadius: '50%',
|
|
68
|
+
border: '1px solid #e09e3e',
|
|
69
|
+
display: 'inline-block',
|
|
70
|
+
height: 12,
|
|
71
|
+
marginLeft: 4,
|
|
72
|
+
width: 12,
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
'& .maximize-button': {
|
|
76
|
+
background: '#00ca56',
|
|
77
|
+
borderRadius: '50%',
|
|
78
|
+
border: '1px solid #14ae46',
|
|
79
|
+
display: 'inline-block',
|
|
80
|
+
height: 12,
|
|
81
|
+
marginLeft: 4,
|
|
82
|
+
width: 12,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
'& .terminal-body': { backgroundColor: '#1d1d1d', padding: 10 },
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// Floating theme
|
|
90
|
+
'&.terminal-floating .terminal-frame': {
|
|
91
|
+
backgroundColor: '#1d1d1d',
|
|
92
|
+
borderRadius: 6,
|
|
93
|
+
boxShadow: '0px 0px 18px #b3b3b3',
|
|
94
|
+
margin: 18,
|
|
95
|
+
overflow: 'hidden',
|
|
96
|
+
|
|
97
|
+
'& .terminal-titlebar': {
|
|
98
|
+
color: 'white',
|
|
99
|
+
fontFamily: 'Arial, sans-serif',
|
|
100
|
+
fontSize: 14,
|
|
101
|
+
height: 34,
|
|
102
|
+
lineHeight: '34px',
|
|
103
|
+
position: 'relative',
|
|
104
|
+
textAlign: 'center',
|
|
105
|
+
width: '100%',
|
|
106
|
+
|
|
107
|
+
'& .buttons': { left: 13, lineHeight: '0px', position: 'absolute', top: 9 },
|
|
108
|
+
|
|
109
|
+
'& .close-button': { background: '#ff5c5c', borderRadius: '50%', display: 'inline-block', height: 15, width: 15 },
|
|
110
|
+
|
|
111
|
+
'& .minimize-button': {
|
|
112
|
+
background: '#ffbd4c',
|
|
113
|
+
borderRadius: '50%',
|
|
114
|
+
display: 'inline-block',
|
|
115
|
+
height: 15,
|
|
116
|
+
lineHeight: '10px',
|
|
117
|
+
marginLeft: 4,
|
|
118
|
+
width: 15,
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
'& .maximize-button': {
|
|
122
|
+
background: '#00ca56',
|
|
123
|
+
borderRadius: '50%',
|
|
124
|
+
display: 'inline-block',
|
|
125
|
+
height: 15,
|
|
126
|
+
lineHeight: '10px',
|
|
127
|
+
marginLeft: 4,
|
|
128
|
+
width: 15,
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
'& .terminal-body': { padding: 20 },
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
// Solid theme
|
|
136
|
+
'&.terminal-solid .terminal-frame': {
|
|
137
|
+
backgroundColor: '#1d1d1d',
|
|
138
|
+
borderRadius: 6,
|
|
139
|
+
boxShadow: '0px 0px 18px #b3b3b3',
|
|
140
|
+
margin: 18,
|
|
141
|
+
overflow: 'hidden',
|
|
142
|
+
|
|
143
|
+
'& .terminal-titlebar': {
|
|
144
|
+
color: 'white',
|
|
145
|
+
fontFamily: 'Arial, sans-serif',
|
|
146
|
+
fontSize: 14,
|
|
147
|
+
position: 'relative',
|
|
148
|
+
textAlign: 'center',
|
|
149
|
+
width: '100%',
|
|
150
|
+
|
|
151
|
+
'& .title': {
|
|
152
|
+
margin: '15px 15px 15px',
|
|
153
|
+
|
|
154
|
+
'&:empty': { display: 'none' },
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
'& .buttons': { display: 'none' },
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
'& .terminal-body': { padding: 20 },
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
// Player controls
|
|
164
|
+
'& .controller': {
|
|
165
|
+
background: '#45484d', // Original first background value
|
|
166
|
+
backgroundColor: '#222222', // Override background (matches original CSS)
|
|
167
|
+
bottom: '0px',
|
|
168
|
+
display: 'none',
|
|
169
|
+
fontFamily: 'Helvetica, Arial, sans-serif',
|
|
170
|
+
fontSize: 12,
|
|
171
|
+
height: 40,
|
|
172
|
+
position: 'absolute',
|
|
173
|
+
width: '100%',
|
|
174
|
+
zIndex: 20,
|
|
175
|
+
transition: 'height ease 200ms',
|
|
176
|
+
WebkitTransition: 'height ease 200ms',
|
|
177
|
+
MozTransition: 'height ease 200ms',
|
|
178
|
+
OTransition: 'height ease 200ms',
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
'&.controls .controller': { display: 'block' },
|
|
182
|
+
|
|
183
|
+
'&.playing .controller': { height: 0, overflow: 'hidden' },
|
|
184
|
+
|
|
185
|
+
'&.playing:hover .controller': { height: 40, overflow: 'hidden' },
|
|
186
|
+
|
|
187
|
+
// Play/Pause buttons
|
|
188
|
+
'& .play, & .pause': {
|
|
189
|
+
fill: '#cacaca',
|
|
190
|
+
float: 'left',
|
|
191
|
+
height: 40,
|
|
192
|
+
lineHeight: '40px',
|
|
193
|
+
textAlign: 'center',
|
|
194
|
+
width: 40,
|
|
195
|
+
|
|
196
|
+
'& .icon': {
|
|
197
|
+
borderColor: 'transparent transparent transparent #cacaca',
|
|
198
|
+
boxSizing: 'border-box',
|
|
199
|
+
cursor: 'pointer',
|
|
200
|
+
display: 'inline-block',
|
|
201
|
+
height: 15,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
'& .pause': {
|
|
206
|
+
display: 'none',
|
|
207
|
+
|
|
208
|
+
'& .icon': { borderStyle: 'double', borderWidth: '0px 0px 0px 12px', marginTop: 11 },
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
'& .play .icon': { borderStyle: 'solid', borderWidth: '8px 0px 8px 13px', marginTop: 10 },
|
|
212
|
+
|
|
213
|
+
'&.playing .play': { display: 'none' },
|
|
214
|
+
|
|
215
|
+
'&.playing .pause': { display: 'inline-block' },
|
|
216
|
+
|
|
217
|
+
// Timer
|
|
218
|
+
'& .timer': { color: '#cacaca', float: 'right', lineHeight: '40px', padding: '0 10px' },
|
|
219
|
+
|
|
220
|
+
// Progress bar
|
|
221
|
+
'& .progressbar-wrapper': { height: 40, lineHeight: '38px', overflow: 'hidden' },
|
|
222
|
+
|
|
223
|
+
'& .progressbar': {
|
|
224
|
+
backgroundColor: '#424242',
|
|
225
|
+
display: 'inline-block',
|
|
226
|
+
height: 7,
|
|
227
|
+
overflow: 'hidden',
|
|
228
|
+
width: '100%',
|
|
229
|
+
borderRadius: 10,
|
|
230
|
+
MozBorderRadius: 10,
|
|
231
|
+
WebkitBorderRadius: 10,
|
|
232
|
+
},
|
|
233
|
+
|
|
234
|
+
'&.started .progressbar': { cursor: 'pointer' },
|
|
235
|
+
|
|
236
|
+
'& .progress': { backgroundColor: '#cacaca', height: 7, position: 'relative', width: '0%' },
|
|
237
|
+
|
|
238
|
+
// Cover and start button
|
|
239
|
+
'& .cover': { cursor: 'pointer', height: '100%', position: 'absolute', width: '100%', zIndex: 10 },
|
|
240
|
+
|
|
241
|
+
'& .start svg': {
|
|
242
|
+
cursor: 'pointer',
|
|
243
|
+
fill: '#eaeaea',
|
|
244
|
+
height: 130,
|
|
245
|
+
left: '50%',
|
|
246
|
+
marginLeft: -65,
|
|
247
|
+
marginTop: -65,
|
|
248
|
+
position: 'absolute',
|
|
249
|
+
top: '50%',
|
|
250
|
+
width: 130,
|
|
251
|
+
zIndex: 20,
|
|
252
|
+
filter: 'drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4))',
|
|
253
|
+
WebkitFilter: 'drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4))',
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
'&.small .start svg': { height: 60, marginLeft: -30, marginTop: -30, width: 60 },
|
|
257
|
+
|
|
258
|
+
'&.framed .start svg': {
|
|
259
|
+
transform: 'translate(0px, 8px)',
|
|
260
|
+
WebkitTransform: 'translate(0px, 8px)',
|
|
261
|
+
MozTransform: 'translate(0px, 8px)',
|
|
262
|
+
OTransform: 'translate(0px, 8px)',
|
|
263
|
+
MsTransform: 'translate(0px, 8px)',
|
|
264
|
+
},
|
|
265
|
+
|
|
266
|
+
'& .cover:hover + .start svg, & .start:hover svg': { fill: 'white' },
|
|
267
|
+
|
|
268
|
+
'&.started .cover, &.started .start': { display: 'none' },
|
|
269
|
+
|
|
270
|
+
'& .terminal-watermark': { zIndex: 99999 },
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
// Terminal Root with camelCase xterm styles
|
|
274
|
+
export const TerminalRoot = styled.div({
|
|
275
|
+
// Xterm base styles
|
|
276
|
+
'& .xterm': {
|
|
277
|
+
fontFeatureSettings: "'liga' 0",
|
|
278
|
+
position: 'relative',
|
|
279
|
+
userSelect: 'none',
|
|
280
|
+
MsUserSelect: 'none',
|
|
281
|
+
WebkitUserSelect: 'none',
|
|
282
|
+
cursor: 'text',
|
|
283
|
+
|
|
284
|
+
'&.focus, &:focus': { outline: 'none' },
|
|
285
|
+
|
|
286
|
+
'&.enable-mouse-events': { cursor: 'default' },
|
|
287
|
+
|
|
288
|
+
'&.xterm-cursor-pointer': { cursor: 'pointer' },
|
|
289
|
+
|
|
290
|
+
'&.column-select.focus': { cursor: 'crosshair' },
|
|
291
|
+
},
|
|
292
|
+
|
|
293
|
+
'& .xterm .xterm-helpers': { position: 'absolute', top: 0, zIndex: 5 },
|
|
294
|
+
|
|
295
|
+
'& .xterm .xterm-helper-textarea': {
|
|
296
|
+
position: 'absolute',
|
|
297
|
+
opacity: 0,
|
|
298
|
+
left: '-9999em',
|
|
299
|
+
top: 0,
|
|
300
|
+
width: 0,
|
|
301
|
+
height: 0,
|
|
302
|
+
zIndex: -5,
|
|
303
|
+
whiteSpace: 'nowrap',
|
|
304
|
+
overflow: 'hidden',
|
|
305
|
+
resize: 'none',
|
|
306
|
+
},
|
|
307
|
+
|
|
308
|
+
'& .xterm .composition-view': {
|
|
309
|
+
background: '#000',
|
|
310
|
+
color: '#fff',
|
|
311
|
+
display: 'none',
|
|
312
|
+
position: 'absolute',
|
|
313
|
+
whiteSpace: 'nowrap',
|
|
314
|
+
zIndex: 1,
|
|
315
|
+
|
|
316
|
+
'&.active': { display: 'block' },
|
|
317
|
+
},
|
|
318
|
+
|
|
319
|
+
'& .xterm .xterm-viewport': {
|
|
320
|
+
backgroundColor: '#000',
|
|
321
|
+
overflowY: 'scroll',
|
|
322
|
+
cursor: 'default',
|
|
323
|
+
position: 'absolute',
|
|
324
|
+
right: 0,
|
|
325
|
+
left: 0,
|
|
326
|
+
top: 0,
|
|
327
|
+
bottom: 0,
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
'& .xterm .xterm-screen': {
|
|
331
|
+
position: 'relative',
|
|
332
|
+
|
|
333
|
+
'& canvas': { position: 'absolute', left: 0, top: 0 },
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
'& .xterm .xterm-scroll-area': { visibility: 'hidden' },
|
|
337
|
+
|
|
338
|
+
'& .xterm-char-measure-element': {
|
|
339
|
+
display: 'inline-block',
|
|
340
|
+
visibility: 'hidden',
|
|
341
|
+
position: 'absolute',
|
|
342
|
+
top: 0,
|
|
343
|
+
left: '-9999em',
|
|
344
|
+
lineHeight: 'normal',
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
'& .xterm .xterm-accessibility, & .xterm .xterm-message': {
|
|
348
|
+
position: 'absolute',
|
|
349
|
+
left: 0,
|
|
350
|
+
top: 0,
|
|
351
|
+
bottom: 0,
|
|
352
|
+
right: 0,
|
|
353
|
+
zIndex: 10,
|
|
354
|
+
color: 'transparent',
|
|
355
|
+
},
|
|
356
|
+
|
|
357
|
+
'& .xterm .live-region': { position: 'absolute', left: '-9999px', width: 1, height: 1, overflow: 'hidden' },
|
|
358
|
+
|
|
359
|
+
'& .xterm-dim': { opacity: 0.5 },
|
|
360
|
+
|
|
361
|
+
'& .xterm-underline': { textDecoration: 'underline' },
|
|
362
|
+
});
|