@arcblock/terminal 3.1.16 → 3.1.18
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/README.md +1 -3
- package/lib/Player.js +134 -152
- package/lib/Terminal.js +24 -19
- package/lib/styles.js +122 -161
- package/package.json +8 -8
- package/src/Player.jsx +30 -73
- package/src/Terminal.jsx +21 -14
- package/src/styles.js +132 -186
package/src/styles.js
CHANGED
|
@@ -3,158 +3,9 @@ import styled from '@emotion/styled';
|
|
|
3
3
|
// Terminal Player Root with camelCase styles
|
|
4
4
|
export const PlayerRoot = styled.div({
|
|
5
5
|
// Base styles for .terminal-player
|
|
6
|
-
display: '
|
|
6
|
+
display: 'block',
|
|
7
7
|
position: 'relative',
|
|
8
|
-
|
|
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
|
-
verticalAlign: 'baseline',
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
// Window theme
|
|
31
|
-
'&.terminal-window .terminal-frame': {
|
|
32
|
-
borderRadius: 6,
|
|
33
|
-
border: '1px solid #b3b3b3',
|
|
34
|
-
boxShadow: '0px 0px 18px #b3b3b3',
|
|
35
|
-
margin: 18,
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
|
|
38
|
-
'& .terminal-titlebar': {
|
|
39
|
-
background: '#e8e8e8',
|
|
40
|
-
borderBottom: '1px solid #b1aeb1',
|
|
41
|
-
borderTop: '1px solid #f3f1f3',
|
|
42
|
-
borderTopLeftRadius: 6,
|
|
43
|
-
borderTopRightRadius: 6,
|
|
44
|
-
color: '#3b4247',
|
|
45
|
-
fontSize: 14,
|
|
46
|
-
height: 22,
|
|
47
|
-
lineHeight: '22px',
|
|
48
|
-
position: 'relative',
|
|
49
|
-
textAlign: 'center',
|
|
50
|
-
width: '100%',
|
|
51
|
-
|
|
52
|
-
'& .buttons': { left: 8, lineHeight: '0px', position: 'absolute', top: 3.5 },
|
|
53
|
-
|
|
54
|
-
'& .close-button': {
|
|
55
|
-
background: '#ff5c5c',
|
|
56
|
-
borderRadius: '50%',
|
|
57
|
-
border: '1px solid #e33e41',
|
|
58
|
-
display: 'inline-block',
|
|
59
|
-
height: 12,
|
|
60
|
-
width: 12,
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
'& .minimize-button': {
|
|
64
|
-
background: '#ffbd4c',
|
|
65
|
-
borderRadius: '50%',
|
|
66
|
-
border: '1px solid #e09e3e',
|
|
67
|
-
display: 'inline-block',
|
|
68
|
-
height: 12,
|
|
69
|
-
marginLeft: 4,
|
|
70
|
-
width: 12,
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
'& .maximize-button': {
|
|
74
|
-
background: '#00ca56',
|
|
75
|
-
borderRadius: '50%',
|
|
76
|
-
border: '1px solid #14ae46',
|
|
77
|
-
display: 'inline-block',
|
|
78
|
-
height: 12,
|
|
79
|
-
marginLeft: 4,
|
|
80
|
-
width: 12,
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
'& .terminal-body': { backgroundColor: '#1d1d1d', padding: 10 },
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
// Floating theme
|
|
88
|
-
'&.terminal-floating .terminal-frame': {
|
|
89
|
-
backgroundColor: '#1d1d1d',
|
|
90
|
-
borderRadius: 6,
|
|
91
|
-
boxShadow: '0px 0px 18px #b3b3b3',
|
|
92
|
-
margin: 18,
|
|
93
|
-
overflow: 'hidden',
|
|
94
|
-
|
|
95
|
-
'& .terminal-titlebar': {
|
|
96
|
-
color: 'white',
|
|
97
|
-
fontSize: 14,
|
|
98
|
-
height: 34,
|
|
99
|
-
lineHeight: '34px',
|
|
100
|
-
position: 'relative',
|
|
101
|
-
textAlign: 'center',
|
|
102
|
-
width: '100%',
|
|
103
|
-
|
|
104
|
-
'& .buttons': { left: 13, lineHeight: '0px', position: 'absolute', top: 9 },
|
|
105
|
-
|
|
106
|
-
'& .close-button': { background: '#ff5c5c', borderRadius: '50%', display: 'inline-block', height: 15, width: 15 },
|
|
107
|
-
|
|
108
|
-
'& .minimize-button': {
|
|
109
|
-
background: '#ffbd4c',
|
|
110
|
-
borderRadius: '50%',
|
|
111
|
-
display: 'inline-block',
|
|
112
|
-
height: 15,
|
|
113
|
-
lineHeight: '10px',
|
|
114
|
-
marginLeft: 4,
|
|
115
|
-
width: 15,
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
'& .maximize-button': {
|
|
119
|
-
background: '#00ca56',
|
|
120
|
-
borderRadius: '50%',
|
|
121
|
-
display: 'inline-block',
|
|
122
|
-
height: 15,
|
|
123
|
-
lineHeight: '10px',
|
|
124
|
-
marginLeft: 4,
|
|
125
|
-
width: 15,
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
|
|
129
|
-
'& .terminal-body': { padding: 20 },
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
// Solid theme
|
|
133
|
-
'&.terminal-solid .terminal-frame': {
|
|
134
|
-
backgroundColor: '#1d1d1d',
|
|
135
|
-
borderRadius: 6,
|
|
136
|
-
boxShadow: '0px 0px 18px #b3b3b3',
|
|
137
|
-
margin: 18,
|
|
138
|
-
overflow: 'hidden',
|
|
139
|
-
|
|
140
|
-
'& .terminal-titlebar': {
|
|
141
|
-
color: 'white',
|
|
142
|
-
fontSize: 14,
|
|
143
|
-
position: 'relative',
|
|
144
|
-
textAlign: 'center',
|
|
145
|
-
width: '100%',
|
|
146
|
-
|
|
147
|
-
'& .title': {
|
|
148
|
-
margin: '15px 15px 15px',
|
|
149
|
-
|
|
150
|
-
'&:empty': { display: 'none' },
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
'& .buttons': { display: 'none' },
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
'& .terminal-body': { padding: 20 },
|
|
157
|
-
},
|
|
8
|
+
overflow: 'hidden',
|
|
158
9
|
|
|
159
10
|
// Player controls
|
|
160
11
|
'& .controller': {
|
|
@@ -236,16 +87,22 @@ export const PlayerRoot = styled.div({
|
|
|
236
87
|
'& .start svg': {
|
|
237
88
|
cursor: 'pointer',
|
|
238
89
|
fill: '#eaeaea',
|
|
239
|
-
|
|
90
|
+
width: 100,
|
|
91
|
+
height: 100,
|
|
240
92
|
left: '50%',
|
|
241
93
|
marginLeft: -65,
|
|
242
94
|
marginTop: -65,
|
|
243
95
|
position: 'absolute',
|
|
244
96
|
top: '50%',
|
|
245
|
-
|
|
97
|
+
|
|
246
98
|
zIndex: 20,
|
|
247
99
|
filter: 'drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4))',
|
|
248
100
|
WebkitFilter: 'drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4))',
|
|
101
|
+
opacity: 0.6,
|
|
102
|
+
'&:hover': {
|
|
103
|
+
opacity: 0.8,
|
|
104
|
+
transition: 'all 0.3s ease',
|
|
105
|
+
},
|
|
249
106
|
},
|
|
250
107
|
|
|
251
108
|
'&.small .start svg': { height: 60, marginLeft: -30, marginTop: -30, width: 60 },
|
|
@@ -258,8 +115,6 @@ export const PlayerRoot = styled.div({
|
|
|
258
115
|
MsTransform: 'translate(0px, 8px)',
|
|
259
116
|
},
|
|
260
117
|
|
|
261
|
-
'& .cover:hover + .start svg, & .start:hover svg': { fill: 'white' },
|
|
262
|
-
|
|
263
118
|
'&.started .cover, &.started .start': { display: 'none' },
|
|
264
119
|
|
|
265
120
|
'& .terminal-watermark': { zIndex: 99999 },
|
|
@@ -267,27 +122,31 @@ export const PlayerRoot = styled.div({
|
|
|
267
122
|
|
|
268
123
|
// Terminal Root with camelCase xterm styles
|
|
269
124
|
export const TerminalRoot = styled.div({
|
|
270
|
-
//
|
|
125
|
+
// Base xterm styles
|
|
271
126
|
'& .xterm': {
|
|
272
|
-
|
|
127
|
+
cursor: 'text',
|
|
273
128
|
position: 'relative',
|
|
274
129
|
userSelect: 'none',
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
'&.focus, &:focus': { outline: 'none' },
|
|
280
|
-
|
|
281
|
-
'&.enable-mouse-events': { cursor: 'default' },
|
|
282
|
-
|
|
283
|
-
'&.xterm-cursor-pointer': { cursor: 'pointer' },
|
|
130
|
+
msUserSelect: 'none',
|
|
131
|
+
webkitUserSelect: 'none',
|
|
132
|
+
},
|
|
284
133
|
|
|
285
|
-
|
|
134
|
+
'& .xterm.focus, & .xterm:focus': {
|
|
135
|
+
outline: 'none',
|
|
286
136
|
},
|
|
287
137
|
|
|
288
|
-
'& .xterm .xterm-helpers': {
|
|
138
|
+
'& .xterm .xterm-helpers': {
|
|
139
|
+
position: 'absolute',
|
|
140
|
+
top: 0,
|
|
141
|
+
// The z-index of the helpers must be higher than the canvases in order for IMEs to appear on top
|
|
142
|
+
zIndex: 5,
|
|
143
|
+
},
|
|
289
144
|
|
|
290
145
|
'& .xterm .xterm-helper-textarea': {
|
|
146
|
+
padding: 0,
|
|
147
|
+
border: 0,
|
|
148
|
+
margin: 0,
|
|
149
|
+
// Move textarea out of the screen to the far left, so that the cursor is not visible
|
|
291
150
|
position: 'absolute',
|
|
292
151
|
opacity: 0,
|
|
293
152
|
left: '-9999em',
|
|
@@ -295,40 +154,51 @@ export const TerminalRoot = styled.div({
|
|
|
295
154
|
width: 0,
|
|
296
155
|
height: 0,
|
|
297
156
|
zIndex: -5,
|
|
157
|
+
// Prevent wrapping so the IME appears against the textarea at the correct position
|
|
298
158
|
whiteSpace: 'nowrap',
|
|
299
159
|
overflow: 'hidden',
|
|
300
160
|
resize: 'none',
|
|
301
161
|
},
|
|
302
162
|
|
|
303
163
|
'& .xterm .composition-view': {
|
|
164
|
+
// TODO: Composition position got messed up somewhere
|
|
304
165
|
background: '#000',
|
|
305
|
-
color: '#
|
|
166
|
+
color: '#FFF',
|
|
306
167
|
display: 'none',
|
|
307
168
|
position: 'absolute',
|
|
308
169
|
whiteSpace: 'nowrap',
|
|
309
170
|
zIndex: 1,
|
|
310
|
-
|
|
311
|
-
'&.active': { display: 'block' },
|
|
312
171
|
},
|
|
313
172
|
|
|
314
|
-
'& .xterm .
|
|
315
|
-
|
|
316
|
-
overflowY: 'scroll',
|
|
317
|
-
cursor: 'default',
|
|
318
|
-
position: 'absolute',
|
|
319
|
-
right: 0,
|
|
320
|
-
left: 0,
|
|
321
|
-
top: 0,
|
|
322
|
-
bottom: 0,
|
|
173
|
+
'& .xterm .composition-view.active': {
|
|
174
|
+
display: 'block',
|
|
323
175
|
},
|
|
324
176
|
|
|
177
|
+
// '& .xterm .xterm-viewport': {
|
|
178
|
+
// // On OS X this is required in order for the scroll bar to appear fully opaque
|
|
179
|
+
// backgroundColor: 'transparent',
|
|
180
|
+
// overflowY: 'scroll',
|
|
181
|
+
// cursor: 'default',
|
|
182
|
+
// position: 'absolute',
|
|
183
|
+
// right: 0,
|
|
184
|
+
// left: 0,
|
|
185
|
+
// top: 0,
|
|
186
|
+
// bottom: 0,
|
|
187
|
+
// },
|
|
188
|
+
|
|
325
189
|
'& .xterm .xterm-screen': {
|
|
326
190
|
position: 'relative',
|
|
191
|
+
},
|
|
327
192
|
|
|
328
|
-
|
|
193
|
+
'& .xterm .xterm-screen canvas': {
|
|
194
|
+
position: 'absolute',
|
|
195
|
+
left: 0,
|
|
196
|
+
top: 0,
|
|
329
197
|
},
|
|
330
198
|
|
|
331
|
-
'& .xterm .xterm-scroll-area': {
|
|
199
|
+
'& .xterm .xterm-scroll-area': {
|
|
200
|
+
visibility: 'hidden',
|
|
201
|
+
},
|
|
332
202
|
|
|
333
203
|
'& .xterm-char-measure-element': {
|
|
334
204
|
display: 'inline-block',
|
|
@@ -339,7 +209,21 @@ export const TerminalRoot = styled.div({
|
|
|
339
209
|
lineHeight: 'normal',
|
|
340
210
|
},
|
|
341
211
|
|
|
342
|
-
'& .xterm
|
|
212
|
+
'& .xterm.enable-mouse-events': {
|
|
213
|
+
// When mouse events are enabled (eg. tmux), revert to the standard pointer cursor
|
|
214
|
+
cursor: 'default',
|
|
215
|
+
},
|
|
216
|
+
|
|
217
|
+
'& .xterm.xterm-cursor-pointer, & .xterm .xterm-cursor-pointer': {
|
|
218
|
+
cursor: 'pointer',
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
'& .xterm.column-select.focus': {
|
|
222
|
+
// Column selection mode
|
|
223
|
+
cursor: 'crosshair',
|
|
224
|
+
},
|
|
225
|
+
|
|
226
|
+
'& .xterm .xterm-accessibility:not(.debug), & .xterm .xterm-message': {
|
|
343
227
|
position: 'absolute',
|
|
344
228
|
left: 0,
|
|
345
229
|
top: 0,
|
|
@@ -347,11 +231,73 @@ export const TerminalRoot = styled.div({
|
|
|
347
231
|
right: 0,
|
|
348
232
|
zIndex: 10,
|
|
349
233
|
color: 'transparent',
|
|
234
|
+
pointerEvents: 'none',
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
'& .xterm .xterm-accessibility-tree:not(.debug) *::selection': {
|
|
238
|
+
color: 'transparent',
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
'& .xterm .xterm-accessibility-tree': {
|
|
242
|
+
userSelect: 'text',
|
|
243
|
+
whiteSpace: 'pre',
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
'& .xterm .live-region': {
|
|
247
|
+
position: 'absolute',
|
|
248
|
+
left: '-9999px',
|
|
249
|
+
width: '1px',
|
|
250
|
+
height: '1px',
|
|
251
|
+
overflow: 'hidden',
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
'& .xterm-dim': {
|
|
255
|
+
// Dim should not apply to background, so the opacity of the foreground color is applied
|
|
256
|
+
// explicitly in the generated class and reset to 1 here
|
|
257
|
+
opacity: '1 !important',
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
// Text decoration styles
|
|
261
|
+
'& .xterm-underline-1': { textDecoration: 'underline' },
|
|
262
|
+
'& .xterm-underline-2': { textDecoration: 'double underline' },
|
|
263
|
+
'& .xterm-underline-3': { textDecoration: 'wavy underline' },
|
|
264
|
+
'& .xterm-underline-4': { textDecoration: 'dotted underline' },
|
|
265
|
+
'& .xterm-underline-5': { textDecoration: 'dashed underline' },
|
|
266
|
+
|
|
267
|
+
'& .xterm-overline': {
|
|
268
|
+
textDecoration: 'overline',
|
|
350
269
|
},
|
|
351
270
|
|
|
352
|
-
'& .xterm
|
|
271
|
+
'& .xterm-overline.xterm-underline-1': { textDecoration: 'overline underline' },
|
|
272
|
+
'& .xterm-overline.xterm-underline-2': { textDecoration: 'overline double underline' },
|
|
273
|
+
'& .xterm-overline.xterm-underline-3': { textDecoration: 'overline wavy underline' },
|
|
274
|
+
'& .xterm-overline.xterm-underline-4': { textDecoration: 'overline dotted underline' },
|
|
275
|
+
'& .xterm-overline.xterm-underline-5': { textDecoration: 'overline dashed underline' },
|
|
353
276
|
|
|
354
|
-
'& .xterm-
|
|
277
|
+
'& .xterm-strikethrough': {
|
|
278
|
+
textDecoration: 'line-through',
|
|
279
|
+
},
|
|
355
280
|
|
|
356
|
-
|
|
281
|
+
// Decoration styles
|
|
282
|
+
'& .xterm-screen .xterm-decoration-container .xterm-decoration': {
|
|
283
|
+
zIndex: 6,
|
|
284
|
+
position: 'absolute',
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
'& .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer': {
|
|
288
|
+
zIndex: 7,
|
|
289
|
+
},
|
|
290
|
+
|
|
291
|
+
'& .xterm-decoration-overview-ruler': {
|
|
292
|
+
zIndex: 8,
|
|
293
|
+
position: 'absolute',
|
|
294
|
+
top: 0,
|
|
295
|
+
right: 0,
|
|
296
|
+
pointerEvents: 'none',
|
|
297
|
+
},
|
|
298
|
+
|
|
299
|
+
'& .xterm-decoration-top': {
|
|
300
|
+
zIndex: 2,
|
|
301
|
+
position: 'relative',
|
|
302
|
+
},
|
|
357
303
|
});
|