@arcblock/terminal 3.1.25 → 3.1.27

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/src/Player.jsx CHANGED
@@ -254,8 +254,8 @@ export default function Player({ ...rawProps }) {
254
254
  }
255
255
  },
256
256
  {
257
- threshold: 0.1, // Trigger when 10% of the element is visible
258
- rootMargin: '0px 0px 0px 0px', // Add some margin to avoid triggering too early
257
+ threshold: options.autoplayThreshold, // 可配置的可见度阈值
258
+ rootMargin: options.autoplayRootMargin, // 可配置的根边距
259
259
  }
260
260
  );
261
261
 
@@ -265,7 +265,7 @@ export default function Player({ ...rawProps }) {
265
265
  return () => {
266
266
  observer.disconnect();
267
267
  };
268
- }, [options.autoplay, state.isStarted, onStart]);
268
+ }, [options.autoplay, options.autoplayThreshold, options.autoplayRootMargin, state.isStarted, onStart]);
269
269
 
270
270
  // Render thumbnailTime
271
271
  useEffect(() => {
@@ -434,14 +434,40 @@ export default function Player({ ...rawProps }) {
434
434
  <PlayerRoot className={getPlayerClass(options, state)} ref={container}>
435
435
  <div className="cover" onClick={onStart} />
436
436
  <div className="start" onClick={onStart}>
437
- <svg style={{ enableBackground: 'new 0 0 30 30' }} viewBox="0 0 30 30">
438
- <polygon points="6.583,3.186 5,4.004 5,15 26,15 26.483,14.128 " />
439
- <polygon points="6.583,26.814 5,25.996 5,15 26,15 26.483,15.872 " />
440
- <circle cx="26" cy="15" r="1" />
441
- <circle cx="6" cy="4" r="1" />
442
- <circle cx="6" cy="26" r="1" />
443
- </svg>
437
+ <div className="start-button">
438
+ <svg viewBox="0 0 30 30">
439
+ <polygon points="6.583,3.186 5,4.004 5,15 26,15 26.483,14.128 " />
440
+ <polygon points="6.583,26.814 5,25.996 5,15 26,15 26.483,15.872 " />
441
+ <circle cx="26" cy="15" r="1" />
442
+ <circle cx="6" cy="4" r="1" />
443
+ <circle cx="6" cy="26" r="1" />
444
+ </svg>
445
+ </div>
444
446
  </div>
447
+
448
+ {/* Hover overlay for playing state */}
449
+ {state.isPlaying && state.isStarted && (
450
+ <div className="hover-overlay" onClick={onPause}>
451
+ <div className="hover-pause-button">
452
+ <span className="pause-icon" />
453
+ </div>
454
+ </div>
455
+ )}
456
+
457
+ {/* Overlay for paused state */}
458
+ {!state.isPlaying && state.isStarted && (
459
+ <div className="pause-overlay" onClick={onPlay}>
460
+ <div className="overlay-play-button">
461
+ <svg viewBox="0 0 30 30">
462
+ <polygon points="6.583,3.186 5,4.004 5,15 26,15 26.483,14.128 " />
463
+ <polygon points="6.583,26.814 5,25.996 5,15 26,15 26.483,15.872 " />
464
+ <circle cx="26" cy="15" r="1" />
465
+ <circle cx="6" cy="4" r="1" />
466
+ <circle cx="6" cy="26" r="1" />
467
+ </svg>
468
+ </div>
469
+ </div>
470
+ )}
445
471
  <div className="terminal">
446
472
  <div className={getFrameClass(options)} style={options.frameBox.style || {}}>
447
473
  <div className="terminal-titlebar">
@@ -494,6 +520,8 @@ Player.propTypes = {
494
520
  theme: PropTypes.object,
495
521
  cols: PropTypes.number,
496
522
  rows: PropTypes.number,
523
+ autoplayThreshold: PropTypes.number,
524
+ autoplayRootMargin: PropTypes.string,
497
525
  }).isRequired,
498
526
  onComplete: PropTypes.func,
499
527
  onStart: PropTypes.func,
package/src/styles.js CHANGED
@@ -1,124 +1,365 @@
1
1
  import styled from '@emotion/styled';
2
2
 
3
- // Terminal Player Root with camelCase styles
4
- export const PlayerRoot = styled.div({
5
- // Base styles for .terminal-player
6
- display: 'block',
7
- position: 'relative',
8
- overflow: 'hidden',
9
-
10
- // Player controls
11
- '& .controller': {
12
- background: '#45484d', // Original first background value
13
- backgroundColor: '#222222', // Override background (matches original CSS)
14
- bottom: '0px',
15
- display: 'none',
16
- fontSize: 12,
17
- height: 40,
18
- position: 'absolute',
19
- width: '100%',
20
- zIndex: 20,
21
- transition: 'height ease 200ms',
22
- WebkitTransition: 'height ease 200ms',
23
- MozTransition: 'height ease 200ms',
24
- OTransition: 'height ease 200ms',
25
- },
26
-
27
- '&.controls .controller': { display: 'block' },
28
-
29
- '&.playing .controller': { height: 0, overflow: 'hidden' },
30
-
31
- '&.playing:hover .controller': { height: 40, overflow: 'hidden' },
32
-
33
- // Play/Pause buttons
34
- '& .play, & .pause': {
35
- fill: '#cacaca',
36
- float: 'left',
37
- height: 40,
38
- lineHeight: '40px',
39
- textAlign: 'center',
40
- width: 40,
41
-
42
- '& .icon': {
43
- borderColor: 'transparent transparent transparent #cacaca',
44
- boxSizing: 'border-box',
45
- cursor: 'pointer',
46
- display: 'inline-block',
47
- height: 15,
48
- },
49
- },
3
+ // Color constants for consistent theming
4
+ const COLORS = {
5
+ BLACK_OVERLAY_LIGHT: 'rgba(0, 0, 0, 0.3)', // Light overlay for paused state
6
+ BLACK_OVERLAY_MEDIUM: 'rgba(0, 0, 0, 0.7)', // Button backgrounds
7
+ BLACK_OVERLAY_DARK: 'rgba(0, 0, 0, 0.8)', // Hover state for buttons
8
+ BLACK_DROP_SHADOW: 'rgba(0, 0, 0, 0.4)', // Drop shadow effect
9
+ BLACK_SOLID: '#000', // Solid black for composition view
10
+ };
50
11
 
51
- '& .pause': {
52
- display: 'none',
53
-
54
- '& .icon': { borderStyle: 'double', borderWidth: '0px 0px 0px 12px', marginTop: 11 },
55
- },
56
-
57
- '& .play .icon': { borderStyle: 'solid', borderWidth: '8px 0px 8px 13px', marginTop: 10 },
58
-
59
- '&.playing .play': { display: 'none' },
60
-
61
- '&.playing .pause': { display: 'inline-block' },
62
-
63
- // Timer
64
- '& .timer': { color: '#cacaca', float: 'right', lineHeight: '40px', padding: '0 10px' },
65
-
66
- // Progress bar
67
- '& .progressbar-wrapper': { height: 40, lineHeight: '38px', overflow: 'hidden' },
68
-
69
- '& .progressbar': {
70
- backgroundColor: '#424242',
71
- display: 'inline-block',
72
- height: 7,
73
- overflow: 'hidden',
74
- width: '100%',
75
- borderRadius: 10,
76
- MozBorderRadius: 10,
77
- WebkitBorderRadius: 10,
78
- },
79
-
80
- '&.started .progressbar': { cursor: 'pointer' },
81
-
82
- '& .progress': { backgroundColor: '#cacaca', height: 7, position: 'relative', width: '0%' },
83
-
84
- // Cover and start button
85
- '& .cover': { cursor: 'pointer', height: '100%', position: 'absolute', width: '100%', zIndex: 10 },
86
-
87
- '& .start svg': {
88
- cursor: 'pointer',
89
- fill: '#eaeaea',
90
- width: 80,
91
- height: 80,
92
- left: '50%',
93
- marginLeft: -65,
94
- marginTop: -65,
95
- position: 'absolute',
96
- top: '50%',
97
-
98
- zIndex: 20,
99
- filter: 'drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4))',
100
- WebkitFilter: 'drop-shadow(10px 10px 15px rgba(0, 0, 0, 0.4))',
101
- opacity: 0.7,
102
- '&:hover': {
103
- opacity: 0.9,
104
- transition: 'all 0.3s ease',
105
- },
106
- },
107
-
108
- '&.small .start svg': { height: 60, marginLeft: -30, marginTop: -30, width: 60 },
109
-
110
- '&.framed .start svg': {
111
- transform: 'translate(0px, 8px)',
112
- WebkitTransform: 'translate(0px, 8px)',
113
- MozTransform: 'translate(0px, 8px)',
114
- OTransform: 'translate(0px, 8px)',
115
- MsTransform: 'translate(0px, 8px)',
116
- },
117
-
118
- '&.started .cover, &.started .start': { display: 'none' },
119
-
120
- '& .terminal-watermark': { zIndex: 99999 },
121
- });
12
+ // Terminal Player Root with camelCase styles
13
+ export const PlayerRoot = styled.div`
14
+ /* Base styles */
15
+ display: block;
16
+ position: relative;
17
+ overflow: hidden;
18
+
19
+ /* Player controls */
20
+ .controller {
21
+ background: #45484d;
22
+ background-color: #222222;
23
+ bottom: 0px;
24
+ display: none;
25
+ font-size: 12px;
26
+ height: 40px;
27
+ position: absolute;
28
+ width: 100%;
29
+ z-index: 20;
30
+ transition: height ease 200ms;
31
+ -webkit-transition: height ease 200ms;
32
+ -moz-transition: height ease 200ms;
33
+ -o-transition: height ease 200ms;
34
+ }
35
+
36
+ &.controls .controller {
37
+ display: block;
38
+ }
39
+ &.playing .controller {
40
+ height: 0;
41
+ overflow: hidden;
42
+ }
43
+ &.playing:hover .controller {
44
+ height: 40px;
45
+ overflow: hidden;
46
+ }
47
+
48
+ /* Play/Pause buttons in controller */
49
+ .play,
50
+ .pause {
51
+ fill: #cacaca;
52
+ float: left;
53
+ height: 40px;
54
+ line-height: 40px;
55
+ text-align: center;
56
+ width: 40px;
57
+
58
+ .icon {
59
+ border-color: transparent transparent transparent #cacaca;
60
+ box-sizing: border-box;
61
+ cursor: pointer;
62
+ display: inline-block;
63
+ height: 15px;
64
+ }
65
+ }
66
+
67
+ .pause {
68
+ display: none;
69
+ .icon {
70
+ border-style: double;
71
+ border-width: 0px 0px 0px 12px;
72
+ margin-top: 11px;
73
+ }
74
+ }
75
+
76
+ .play .icon {
77
+ border-style: solid;
78
+ border-width: 8px 0px 8px 13px;
79
+ margin-top: 10px;
80
+ }
81
+
82
+ &.playing .play {
83
+ display: none;
84
+ }
85
+ &.playing .pause {
86
+ display: inline-block;
87
+ }
88
+
89
+ /* Timer */
90
+ .timer {
91
+ color: #cacaca;
92
+ float: right;
93
+ line-height: 40px;
94
+ padding: 0 10px;
95
+ }
96
+
97
+ /* Progress bar */
98
+ .progressbar-wrapper {
99
+ height: 40px;
100
+ line-height: 38px;
101
+ overflow: hidden;
102
+ }
103
+
104
+ .progressbar {
105
+ background-color: #424242;
106
+ display: inline-block;
107
+ height: 7px;
108
+ overflow: hidden;
109
+ width: 100%;
110
+ border-radius: 10px;
111
+ -moz-border-radius: 10px;
112
+ -webkit-border-radius: 10px;
113
+ }
114
+
115
+ &.started .progressbar {
116
+ cursor: pointer;
117
+ }
118
+
119
+ .progress {
120
+ background-color: #cacaca;
121
+ height: 7px;
122
+ position: relative;
123
+ width: 0%;
124
+ }
125
+
126
+ /* Cover */
127
+ .cover {
128
+ cursor: pointer;
129
+ height: 100%;
130
+ position: absolute;
131
+ width: 100%;
132
+ z-index: 10;
133
+ }
134
+
135
+ /* Start button */
136
+ .start-button {
137
+ position: absolute;
138
+ top: 50%;
139
+ left: 50%;
140
+ transform: translate(-50%, -50%);
141
+ width: 80px;
142
+ height: 80px;
143
+ background-color: ${COLORS.BLACK_OVERLAY_MEDIUM};
144
+ border-radius: 50%;
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: center;
148
+ filter: drop-shadow(10px 10px 15px ${COLORS.BLACK_DROP_SHADOW});
149
+ -webkit-filter: drop-shadow(10px 10px 15px ${COLORS.BLACK_DROP_SHADOW});
150
+ transition: all 0.3s ease;
151
+ cursor: pointer;
152
+ z-index: 20;
153
+
154
+ &:hover {
155
+ background-color: ${COLORS.BLACK_OVERLAY_DARK};
156
+ transform: translate(-50%, -50%) scale(1.05);
157
+ }
158
+
159
+ svg {
160
+ fill: #eaeaea;
161
+ width: 40px;
162
+ height: 40px;
163
+ pointer-events: none;
164
+ }
165
+ }
166
+
167
+ &.small .start-button {
168
+ width: 60px;
169
+ height: 60px;
170
+ svg {
171
+ width: 30px;
172
+ height: 30px;
173
+ }
174
+ }
175
+
176
+ /* Position adjustments for different layouts */
177
+ &.controls .start-button {
178
+ transform: translate(-50%, -50%) translate(0px, -20px);
179
+ &:hover {
180
+ transform: translate(-50%, -50%) translate(0px, -20px) scale(1.05);
181
+ }
182
+ }
183
+
184
+ &.framed .start-button {
185
+ transform: translate(-50%, -50%) translate(0px, 8px);
186
+ &:hover {
187
+ transform: translate(-50%, -50%) translate(0px, 8px) scale(1.05);
188
+ }
189
+ }
190
+
191
+ &.framed.controls .start-button {
192
+ transform: translate(-50%, -50%) translate(0px, -12px);
193
+ &:hover {
194
+ transform: translate(-50%, -50%) translate(0px, -12px) scale(1.05);
195
+ }
196
+ }
197
+
198
+ &.started .cover,
199
+ &.started .start {
200
+ display: none;
201
+ }
202
+
203
+ /* Hover overlay for playing state */
204
+ .hover-overlay {
205
+ position: absolute;
206
+ top: 0;
207
+ left: 0;
208
+ right: 0;
209
+ bottom: 0;
210
+ z-index: 15;
211
+ opacity: 0;
212
+ transition: opacity 0.3s ease;
213
+ cursor: pointer;
214
+ &:hover {
215
+ opacity: 1;
216
+ }
217
+ }
218
+
219
+ /* Hover pause button */
220
+ .hover-pause-button {
221
+ position: absolute;
222
+ top: 50%;
223
+ left: 50%;
224
+ transform: translate(-50%, -50%);
225
+ width: 80px;
226
+ height: 80px;
227
+ background-color: ${COLORS.BLACK_OVERLAY_MEDIUM};
228
+ border-radius: 50%;
229
+ display: flex;
230
+ align-items: center;
231
+ justify-content: center;
232
+ filter: drop-shadow(10px 10px 15px ${COLORS.BLACK_DROP_SHADOW});
233
+ -webkit-filter: drop-shadow(10px 10px 15px ${COLORS.BLACK_DROP_SHADOW});
234
+ transition: all 0.3s ease;
235
+ cursor: pointer;
236
+
237
+ &:hover {
238
+ background-color: ${COLORS.BLACK_OVERLAY_MEDIUM};
239
+ transform: translate(-50%, -50%) scale(1.05);
240
+ }
241
+ }
242
+
243
+ &.small .hover-pause-button {
244
+ width: 60px;
245
+ height: 60px;
246
+ &:hover {
247
+ background-color: ${COLORS.BLACK_OVERLAY_MEDIUM};
248
+ transform: translate(-50%, -50%);
249
+ }
250
+ }
251
+
252
+ /* Position adjustments for hover pause button */
253
+ &.controls .hover-pause-button {
254
+ transform: translate(-50%, -50%) translate(0px, -20px);
255
+ &:hover {
256
+ transform: translate(-50%, -50%) translate(0px, -20px) scale(1.05);
257
+ }
258
+ }
259
+
260
+ &.framed .hover-pause-button {
261
+ transform: translate(-50%, -50%) translate(0px, 8px);
262
+ &:hover {
263
+ transform: translate(-50%, -50%) translate(0px, 8px) scale(1.05);
264
+ }
265
+ }
266
+
267
+ &.framed.controls .hover-pause-button {
268
+ transform: translate(-50%, -50%) translate(0px, -12px);
269
+ &:hover {
270
+ transform: translate(-50%, -50%) translate(0px, -12px) scale(1.05);
271
+ }
272
+ }
273
+
274
+ .pause-icon {
275
+ display: inline-block;
276
+ border-style: double;
277
+ border-width: 0px 0px 0px 24px;
278
+ border-color: transparent transparent transparent #ffffff;
279
+ height: 32px;
280
+ box-sizing: border-box;
281
+ }
282
+
283
+ &.small .pause-icon {
284
+ border-width: 0px 0px 0px 18px;
285
+ height: 24px;
286
+ }
287
+
288
+ /* Pause overlay */
289
+ .pause-overlay {
290
+ position: absolute;
291
+ top: 0;
292
+ left: 0;
293
+ right: 0;
294
+ bottom: 0;
295
+ z-index: 15;
296
+ background-color: ${COLORS.BLACK_OVERLAY_LIGHT};
297
+ cursor: pointer;
298
+ display: flex;
299
+ align-items: center;
300
+ justify-content: center;
301
+ outline: none;
302
+ border: none;
303
+
304
+ &:focus {
305
+ outline: none;
306
+ }
307
+ &:active {
308
+ background-color: ${COLORS.BLACK_OVERLAY_LIGHT};
309
+ }
310
+ }
311
+
312
+ /* Position adjustments for pause overlay */
313
+ &.controls .pause-overlay {
314
+ transform: translateY(-20px);
315
+ }
316
+ &.framed.controls .pause-overlay {
317
+ transform: translateY(-12px);
318
+ }
319
+
320
+ /* Overlay play button */
321
+ .overlay-play-button {
322
+ position: relative;
323
+ width: 80px;
324
+ height: 80px;
325
+ background-color: ${COLORS.BLACK_OVERLAY_MEDIUM};
326
+ border-radius: 50%;
327
+ display: flex;
328
+ align-items: center;
329
+ justify-content: center;
330
+ filter: drop-shadow(10px 10px 15px ${COLORS.BLACK_DROP_SHADOW});
331
+ -webkit-filter: drop-shadow(10px 10px 15px ${COLORS.BLACK_DROP_SHADOW});
332
+ transition: all 0.3s ease;
333
+ cursor: pointer;
334
+ transform: none;
335
+
336
+ &:hover {
337
+ background-color: ${COLORS.BLACK_OVERLAY_DARK};
338
+ transform: scale(1.05);
339
+ }
340
+
341
+ svg {
342
+ fill: #eaeaea;
343
+ width: 40px;
344
+ height: 40px;
345
+ pointer-events: none;
346
+ }
347
+ }
348
+
349
+ &.small .overlay-play-button {
350
+ width: 60px;
351
+ height: 60px;
352
+ svg {
353
+ width: 30px;
354
+ height: 30px;
355
+ }
356
+ }
357
+
358
+ /* Terminal watermark */
359
+ .terminal-watermark {
360
+ z-index: 99999;
361
+ }
362
+ `;
122
363
 
123
364
  // Terminal Root with camelCase xterm styles
124
365
  export const TerminalRoot = styled.div({
@@ -138,7 +379,6 @@ export const TerminalRoot = styled.div({
138
379
  '& .xterm .xterm-helpers': {
139
380
  position: 'absolute',
140
381
  top: 0,
141
- // The z-index of the helpers must be higher than the canvases in order for IMEs to appear on top
142
382
  zIndex: 5,
143
383
  },
144
384
 
@@ -146,7 +386,6 @@ export const TerminalRoot = styled.div({
146
386
  padding: 0,
147
387
  border: 0,
148
388
  margin: 0,
149
- // Move textarea out of the screen to the far left, so that the cursor is not visible
150
389
  position: 'absolute',
151
390
  opacity: 0,
152
391
  left: '-9999em',
@@ -154,15 +393,13 @@ export const TerminalRoot = styled.div({
154
393
  width: 0,
155
394
  height: 0,
156
395
  zIndex: -5,
157
- // Prevent wrapping so the IME appears against the textarea at the correct position
158
396
  whiteSpace: 'nowrap',
159
397
  overflow: 'hidden',
160
398
  resize: 'none',
161
399
  },
162
400
 
163
401
  '& .xterm .composition-view': {
164
- // TODO: Composition position got messed up somewhere
165
- background: '#000',
402
+ background: COLORS.BLACK_SOLID,
166
403
  color: '#FFF',
167
404
  display: 'none',
168
405
  position: 'absolute',
@@ -175,7 +412,6 @@ export const TerminalRoot = styled.div({
175
412
  },
176
413
 
177
414
  '& .xterm .xterm-viewport': {
178
- // On OS X this is required in order for the scroll bar to appear fully opaque
179
415
  backgroundColor: 'transparent !important',
180
416
  overflowY: 'scroll',
181
417
  cursor: 'default',
@@ -184,15 +420,13 @@ export const TerminalRoot = styled.div({
184
420
  left: 0,
185
421
  top: 0,
186
422
  bottom: 0,
187
- // scrollbarWidth: 'none',
188
423
  '&::-webkit-scrollbar': {
189
- width: 8 /* 滚动条宽度 */,
190
- backgroundColor: 'transparent' /* 滚动条背景 */,
424
+ width: '8px',
425
+ backgroundColor: 'transparent',
191
426
  },
192
-
193
427
  '&::-webkit-scrollbar-thumb': {
194
- background: '#888' /* 滚动条滑块颜色 */,
195
- borderRadius: 4 /* 滑块圆角 */,
428
+ background: '#aaa',
429
+ borderRadius: '4px',
196
430
  },
197
431
  },
198
432
 
@@ -220,7 +454,6 @@ export const TerminalRoot = styled.div({
220
454
  },
221
455
 
222
456
  '& .xterm.enable-mouse-events': {
223
- // When mouse events are enabled (eg. tmux), revert to the standard pointer cursor
224
457
  cursor: 'default',
225
458
  },
226
459
 
@@ -229,7 +462,6 @@ export const TerminalRoot = styled.div({
229
462
  },
230
463
 
231
464
  '& .xterm.column-select.focus': {
232
- // Column selection mode
233
465
  cursor: 'crosshair',
234
466
  },
235
467
 
@@ -262,8 +494,6 @@ export const TerminalRoot = styled.div({
262
494
  },
263
495
 
264
496
  '& .xterm-dim': {
265
- // Dim should not apply to background, so the opacity of the foreground color is applied
266
- // explicitly in the generated class and reset to 1 here
267
497
  opacity: '1 !important',
268
498
  },
269
499
 
@@ -274,9 +504,7 @@ export const TerminalRoot = styled.div({
274
504
  '& .xterm-underline-4': { textDecoration: 'dotted underline' },
275
505
  '& .xterm-underline-5': { textDecoration: 'dashed underline' },
276
506
 
277
- '& .xterm-overline': {
278
- textDecoration: 'overline',
279
- },
507
+ '& .xterm-overline': { textDecoration: 'overline' },
280
508
 
281
509
  '& .xterm-overline.xterm-underline-1': { textDecoration: 'overline underline' },
282
510
  '& .xterm-overline.xterm-underline-2': { textDecoration: 'overline double underline' },
@@ -284,9 +512,7 @@ export const TerminalRoot = styled.div({
284
512
  '& .xterm-overline.xterm-underline-4': { textDecoration: 'overline dotted underline' },
285
513
  '& .xterm-overline.xterm-underline-5': { textDecoration: 'overline dashed underline' },
286
514
 
287
- '& .xterm-strikethrough': {
288
- textDecoration: 'line-through',
289
- },
515
+ '& .xterm-strikethrough': { textDecoration: 'line-through' },
290
516
 
291
517
  // Decoration styles
292
518
  '& .xterm-screen .xterm-decoration-container .xterm-decoration': {
package/src/util.js CHANGED
@@ -164,4 +164,7 @@ export const defaultOptions = {
164
164
  autoplay: false,
165
165
  thumbnailTime: 999999,
166
166
  frameBox: {},
167
+ // IntersectionObserver 配置
168
+ autoplayThreshold: 0.5, // 元素50%可见时才自动播放
169
+ autoplayRootMargin: '-10% 0px -10% 0px', // 上下留10%边距,确保元素充分进入视口
167
170
  };