@ray-js/ipc-player-integration 0.0.70-beta.0 → 0.0.71-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.
Files changed (120) hide show
  1. package/README.md +6 -0
  2. package/lib/ctx/ctx.js +12 -17
  3. package/lib/ctx/ctx.test.js +54 -19
  4. package/lib/ctx/intercom.test.d.ts +1 -0
  5. package/lib/ctx/intercom.test.js +85 -0
  6. package/lib/index.d.ts +4 -0
  7. package/lib/index.js +3 -1
  8. package/lib/renderer/capabilities.d.ts +8 -0
  9. package/lib/renderer/capabilities.js +19 -0
  10. package/lib/renderer/context.d.ts +5 -0
  11. package/lib/renderer/context.js +6 -0
  12. package/lib/renderer/directionControl.d.ts +6 -0
  13. package/lib/renderer/directionControl.js +3 -0
  14. package/lib/renderer/font-manifest.json +9 -0
  15. package/lib/renderer/font.less +5 -0
  16. package/lib/renderer/glyphs.d.ts +1 -0
  17. package/lib/renderer/glyphs.js +256 -0
  18. package/lib/renderer/index.module.less +48 -0
  19. package/lib/renderer/overlay.d.ts +6 -0
  20. package/lib/renderer/overlay.js +18 -0
  21. package/lib/renderer/ptzZoom.d.ts +6 -0
  22. package/lib/renderer/ptzZoom.js +3 -0
  23. package/lib/renderer/text.d.ts +4 -0
  24. package/lib/renderer/text.js +32 -0
  25. package/lib/renderer/text.module.less +4 -0
  26. package/lib/renderer/viewport.d.ts +7 -0
  27. package/lib/renderer/viewport.js +24 -0
  28. package/lib/res/lynx-signal/index.d.ts +1 -0
  29. package/lib/res/lynx-signal/index.js +22 -0
  30. package/lib/res/lynx-signal/signalFour0.png +0 -0
  31. package/lib/res/lynx-signal/signalFour1.png +0 -0
  32. package/lib/res/lynx-signal/signalFour2.png +0 -0
  33. package/lib/res/lynx-signal/signalFour3.png +0 -0
  34. package/lib/res/lynx-signal/signalFour4.png +0 -0
  35. package/lib/res/lynx-signal/signalThree0.png +0 -0
  36. package/lib/res/lynx-signal/signalThree1.png +0 -0
  37. package/lib/res/lynx-signal/signalThree2.png +0 -0
  38. package/lib/res/lynx-signal/signalThree3.png +0 -0
  39. package/lib/res/player-charging.png +0 -0
  40. package/lib/res/player-more-arrow.png +0 -0
  41. package/lib/res/player-solar.png +0 -0
  42. package/lib/ui/bottomLeftContent.js +121 -53
  43. package/lib/ui/bottomRightContent.js +10 -5
  44. package/lib/ui/scrollHintArrow.d.ts +23 -0
  45. package/lib/ui/scrollHintArrow.js +83 -0
  46. package/lib/ui/topLeftContent.js +4 -2
  47. package/lib/ui/topRightContent.js +4 -2
  48. package/lib/ui/ui.d.ts +5 -0
  49. package/lib/ui/ui.js +46 -23
  50. package/lib/widgets/battery/battery.js +7 -5
  51. package/lib/widgets/battery/batteryFull.js +7 -5
  52. package/lib/widgets/battery/statusIcon.d.ts +6 -0
  53. package/lib/widgets/battery/statusIcon.js +36 -0
  54. package/lib/widgets/battery/statusIcon.less +24 -0
  55. package/lib/widgets/captureResult/captureResult.js +2 -1
  56. package/lib/widgets/captureToast/captureToast.d.ts +10 -0
  57. package/lib/widgets/captureToast/captureToast.js +58 -0
  58. package/lib/widgets/floodlight/floodlight.js +2 -1
  59. package/lib/widgets/flowLowTip/flowLowTip.js +2 -1
  60. package/lib/widgets/fullScreen/fullScreen.js +2 -1
  61. package/lib/widgets/fullScreen/fullTravelRouteControl.d.ts +1 -1
  62. package/lib/widgets/fullScreen/fullTravelRouteControl.js +1 -1
  63. package/lib/widgets/fullScreen/verticalScreen.js +2 -1
  64. package/lib/widgets/moveInteractiveControl/controlButton.js +2 -1
  65. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.js +16 -5
  66. package/lib/widgets/moveInteractiveControl/moveInteractiveControlUI.less +24 -4
  67. package/lib/widgets/multiCamera/landscapeTip.js +8 -2
  68. package/lib/widgets/multiCamera/moveablePtzControl.js +5 -3
  69. package/lib/widgets/multiCamera/multiPtz.js +2 -1
  70. package/lib/widgets/multiCamera/ptzMoveableTip.js +8 -2
  71. package/lib/widgets/multiCamera/switchLayout.js +2 -1
  72. package/lib/widgets/multiCamera/tileMultiPtz.js +2 -1
  73. package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
  74. package/lib/widgets/multiCamera/tileTip.js +8 -2
  75. package/lib/widgets/muted/muted.js +2 -1
  76. package/lib/widgets/muted/muted.test.js +66 -52
  77. package/lib/widgets/ptz/ptz.js +2 -1
  78. package/lib/widgets/ptz/ptzControl.js +4 -3
  79. package/lib/widgets/ptzControlTip/ptzControlTip.js +9 -4
  80. package/lib/widgets/ptzControlTip/ptzControlTip.less +6 -0
  81. package/lib/widgets/realTimeMagnification/realTimeMagnification.js +2 -1
  82. package/lib/widgets/recordVideo/recordVideo.js +47 -169
  83. package/lib/widgets/recordVideo/recordVideo.lifecycle.test.js +4 -2
  84. package/lib/widgets/recordVideo/recordVideo.test.js +169 -2
  85. package/lib/widgets/recordVideo/recordVideoTimer.d.ts +3 -0
  86. package/lib/widgets/recordVideo/recordVideoTimer.js +26 -0
  87. package/lib/widgets/resolution/fullResolutionControl.js +29 -19
  88. package/lib/widgets/resolution/resolution.js +3 -2
  89. package/lib/widgets/screenshot/screenshot.js +48 -122
  90. package/lib/widgets/screenshot/screenshot.permissions.test.d.ts +1 -0
  91. package/lib/widgets/screenshot/screenshot.permissions.test.js +137 -0
  92. package/lib/widgets/screenshot/screenshot.test.js +108 -113
  93. package/lib/widgets/signal4G/signal4G.js +4 -1
  94. package/lib/widgets/siren/siren.js +2 -1
  95. package/lib/widgets/tempHumidity/tempHumidity.js +2 -1
  96. package/lib/widgets/toggleVerticalFull/toggleVerticalFull.js +2 -1
  97. package/lib/widgets/trialBadge/index.js +8 -3
  98. package/lib/widgets/trialBadge/index.less +24 -0
  99. package/lib/widgets/tryExperience/tryExperience.js +2 -1
  100. package/lib/widgets/videoBitKBP/videoBitKBP.js +2 -1
  101. package/lib/widgets/voiceIntercom/voiceIntercom.js +57 -81
  102. package/lib/widgets/voiceIntercom/voiceIntercom.less +35 -0
  103. package/lib/widgets/voiceIntercom/voiceIntercom.test.d.ts +1 -0
  104. package/lib/widgets/voiceIntercom/voiceIntercom.test.js +135 -0
  105. package/lib/widgets/zoomTurntable/lynxDockLayout.d.ts +6 -0
  106. package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
  107. package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
  108. package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
  109. package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
  110. package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
  111. package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
  112. package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
  113. package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
  114. package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
  115. package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
  116. package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +5 -3
  117. package/lib/widgets/zoomTurntable/zoomTurntableDock.js +4 -4
  118. package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +32 -19
  119. package/lib/widgets/zoomTurntable/zoomTurntableTip.js +17 -3
  120. package/package.json +15 -7
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
  import "core-js/modules/esnext.iterator.constructor.js";
3
4
  import "core-js/modules/esnext.iterator.every.js";
@@ -6,8 +7,11 @@ import "core-js/modules/esnext.iterator.find.js";
6
7
  import "core-js/modules/esnext.iterator.map.js";
7
8
  import "core-js/modules/esnext.iterator.reduce.js";
8
9
  import React, { useEffect, useMemo, useRef, useState } from 'react';
9
- import { CoverView, ScrollView, View } from '@ray-js/ray';
10
+ import { ScrollView, View, getSystemInfoSync } from '@ray-js/ray';
10
11
  import clsx from 'clsx';
12
+ import { usePlayerOverlayHost } from '../renderer/overlay';
13
+ import { ScrollHintArrow, ScrollHintButton, usesNativeHintImage, getHintViewport } from './scrollHintArrow';
14
+ import { usePlayerRenderMode } from '../renderer/context';
11
15
  import { useStore } from '../ctx/store';
12
16
  import { useComponentHideState } from './hooks';
13
17
  import { getBottomCoverHeight } from './bottomCoverHeight';
@@ -24,6 +28,7 @@ const VERTICAL_FLAT_MAX = 4;
24
28
  // 这段同时也是箭头的落位区 —— 箭头贴着内容压在第 5 项露出的一角上(和改动前的观感一致),
25
29
  // 因此至少要放得下箭头本体 26 + 左右各 4 的间隙。
26
30
  const VERTICAL_PEEK_WIDTH = 34;
31
+ const VERTICAL_HINT_EDGE_GAP = 4;
27
32
 
28
33
  // 平铺档内容与右下角按钮之间的最小安全间距
29
34
  const VERTICAL_FLAT_SAFE_GAP = 8;
@@ -44,6 +49,7 @@ const BottomLeftContent = _ref => {
44
49
  canOpenSettings = true,
45
50
  scrollHintMode = 'button'
46
51
  } = _ref;
52
+ const OverlayView = usePlayerOverlayHost();
47
53
  const {
48
54
  screenType,
49
55
  isVerticalFullLayout,
@@ -82,6 +88,11 @@ const BottomLeftContent = _ref => {
82
88
  const tryExp = bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.find(item => item.id === 'TryExperience');
83
89
  return (_gRawData = tryExp === null || tryExp === void 0 || (_tryExp$initProps5 = tryExp.initProps) === null || _tryExp$initProps5 === void 0 ? void 0 : _tryExp$initProps5.gRawData) !== null && _gRawData !== void 0 ? _gRawData : false;
84
90
  }, [bottomLeftContent]);
91
+ const renderMode = usePlayerRenderMode();
92
+ const hintPlatform = useMemo(() => {
93
+ var _getSystemInfoSync;
94
+ return renderMode === 'lynx' ? ((_getSystemInfoSync = getSystemInfoSync()) === null || _getSystemInfoSync === void 0 ? void 0 : _getSystemInfoSync.platform) || '' : '';
95
+ }, [renderMode]);
85
96
  const [shouldHide] = useComponentHideState();
86
97
  const {
87
98
  showTrialBadge,
@@ -90,7 +101,7 @@ const BottomLeftContent = _ref => {
90
101
  handleCountdownEnd
91
102
  } = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec, ctx.trialBadgeViewedRef, ctx.trialBadgeRtidRef);
92
103
 
93
- // 横向滚动状态:内容溢出且未滑到对应边缘时,显示左 / 右箭头提示
104
+ // 横向滚动状态:右侧仍有内容时显示右箭头提示
94
105
  const idRef = useRef(++scrollClsSeq);
95
106
  // wrap 是左下角的可用区(left:0 ~ right:reservedRight),宽度不随 ScrollView 收窄而变,
96
107
  // 因此用它、而不是 ScrollView 自身,作为“能摆多宽”的基准,避免收窄与分档互相依赖
@@ -111,6 +122,8 @@ const BottomLeftContent = _ref => {
111
122
  // 点击箭头时的受控滚动目标;仅在程序化滚动期间为数值,结束后置回 undefined,
112
123
  // 避免持续受控导致用户手动拖动被回弹
113
124
  const [scrollTo, setScrollTo] = useState(undefined);
125
+ const [lynxAtEnd, setLynxAtEnd] = useState(false);
126
+ const endPageTouchRef = useRef(null);
114
127
  // 横竖屏切换后,强制 ScrollView 重新挂载并把滚动状态重置为初始值
115
128
  const [scrollResetKey, setScrollResetKey] = useState(0);
116
129
  // 用户在某种屏幕模式下拖动过一次之后,该模式不再展示箭头(竖屏 / 横屏各自独立记录)
@@ -133,10 +146,12 @@ const BottomLeftContent = _ref => {
133
146
  const scrollEndTimerRef = useRef();
134
147
  // 测量时需要叠加当前滚动量,用 ref 避免闭包拿到过期值
135
148
  const scrollLeftRef = useRef(0);
149
+ const pageOffsetRef = useRef(0);
136
150
  useEffect(() => {
137
151
  setScrollResetKey(k => k + 1);
138
152
  setScrollLeft(0);
139
153
  setScrollTo(undefined);
154
+ setLynxAtEnd(false);
140
155
  scrollLeftRef.current = 0;
141
156
  // 清零上一屏的测量值,避免用旧 clientWidth/contentWidth 在重新测量前误判溢出导致箭头闪现
142
157
  setClientWidth(0);
@@ -297,7 +312,7 @@ const BottomLeftContent = _ref => {
297
312
  // 这样即使内容容器被撑满到可视内盒宽,也能拿到真实内容宽;哨兵不可用时回退到容器宽。
298
313
  let tw = 0;
299
314
  if (scrollRect && endRect && typeof endRect.left === 'number') {
300
- tw = endRect.left - scrollRect.left - paddingLeftPx + scrollLeftRef.current;
315
+ tw = endRect.left - scrollRect.left - paddingLeftPx + scrollLeftRef.current + pageOffsetRef.current;
301
316
  }
302
317
  if (!(tw > 0)) {
303
318
  tw = (contentRect === null || contentRect === void 0 ? void 0 : contentRect.width) || 0;
@@ -306,11 +321,11 @@ const BottomLeftContent = _ref => {
306
321
  setContentWidth(tw);
307
322
  }
308
323
  attempts += 1;
309
- // 最多轮询 15 次(约 6s)兜底,避免无限轮询
310
- if (attempts >= 15) {
324
+ // Lynx 首轮加密测量以尽快收敛,WebView 保持原有 400ms/15 次节奏。
325
+ if (attempts >= (renderMode === 'lynx' ? 20 : 15)) {
311
326
  return;
312
327
  }
313
- timer = setTimeout(measure, 400);
328
+ timer = setTimeout(measure, renderMode === 'lynx' && attempts < 8 ? 150 : 400);
314
329
  });
315
330
  };
316
331
 
@@ -326,7 +341,7 @@ const BottomLeftContent = _ref => {
326
341
  // playState:视频就绪后 overlay 可能重新布局,需重新测量
327
342
  playState, bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.length, shouldHide, showBadge, wrapCls, scrollCls, contentCls, scrollResetKey, resizeSignal,
328
343
  // 收紧后各项 padding 变小,必须重测一遍逐项宽,否则分档还在用收紧前的旧值
329
- tightened]);
344
+ tightened, renderMode]);
330
345
 
331
346
  // 子元素主动上报宽度变化 → 重跑测量,及时更新横滑箭头与右边缘淡出
332
347
  useEffect(() => {
@@ -356,19 +371,37 @@ const BottomLeftContent = _ref => {
356
371
  const totalContentWidth = naturalWidth > 0 ? paddingLeftPx + naturalWidth + paddingRightPx : 0;
357
372
  // 竖屏由“个数”决定是否溢出(平铺档恒不溢出);横屏保持原来的像素比对
358
373
  const isOverflow = isVertical ? !isFlat : totalContentWidth > clientWidth + 1;
359
- const scrollViewWidth = verticalScrollWidth > 0 ? verticalScrollWidth : clientWidth;
360
- const atEnd = !isOverflow || scrollLeft + scrollViewWidth >= totalContentWidth - 2;
361
- const isDismissed = dismissed[screenType];
362
374
  const isButtonHint = scrollHintMode === 'button';
375
+ const hintSize = isButtonHint ? 26 : 16;
376
+ // Once the end is reached there is no hint to mask: restore the WebView layout budget.
377
+
378
+ const hintViewport = getHintViewport(renderMode, hintPlatform, isScrollMode, verticalScrollWidth, usesNativeHintImage(renderMode, hintPlatform) ? availableWidth : clientWidth, hintSize, VERTICAL_HINT_EDGE_GAP, lynxAtEnd);
379
+ const scrollViewWidth = hintViewport.visibleWidth;
380
+ const atEnd = lynxAtEnd || !isOverflow || scrollLeft + scrollViewWidth >= totalContentWidth - 2;
381
+ // Lynx 不响应 ScrollView 的受控 scrollLeft / scrollIntoView,点击时平移现有内容。
382
+ // 保留原节点;末页通过右滑返回,不增加 WebView 没有的反向箭头。
383
+ const pageOffset = renderMode === 'lynx' && lynxAtEnd ? Math.max(0, totalContentWidth - scrollViewWidth - scrollLeft) : 0;
384
+ pageOffsetRef.current = pageOffset;
385
+ const isDismissed = dismissed[screenType];
363
386
  // button 模式:溢出且未到末端即常显(不受 dismissed 影响);pulse 模式:保留拖动后消失的旧逻辑。
364
387
  // compact 档(<= 4 个但摆不下)不出箭头:那点空间要留给元素本身,箭头只会遮更多
365
388
 
366
389
  // 右侧还有未滚到头的内容时,启用右边缘淡出,把没完全露出的元素渐隐隐藏(横竖屏都生效)
367
390
  const fadeRightEdge = isOverflow && !atEnd;
368
391
 
369
- // 点击右箭头:直接滚动到最右端。
370
- // 给一个足够大的目标值,交由 ScrollView 自身夹取到真实最右端,避免测量误差导致滚不到底。
392
+ // Lynx 用子节点 id 定位末端:其受控 scrollLeft 属性不会可靠地驱动原生横滑。
393
+ // WebView 仍以有限的实际最大偏移滚动。
371
394
 
395
+ const readTouch = event => {
396
+ var _event$touches, _event$changedTouches, _event$origin, _event$origin2, _touch$clientX, _touch$clientY;
397
+ const touch = (event === null || event === void 0 || (_event$touches = event.touches) === null || _event$touches === void 0 ? void 0 : _event$touches[0]) || (event === null || event === void 0 || (_event$changedTouches = event.changedTouches) === null || _event$changedTouches === void 0 ? void 0 : _event$changedTouches[0]) || (event === null || event === void 0 || (_event$origin = event.origin) === null || _event$origin === void 0 || (_event$origin = _event$origin.touches) === null || _event$origin === void 0 ? void 0 : _event$origin[0]) || (event === null || event === void 0 || (_event$origin2 = event.origin) === null || _event$origin2 === void 0 || (_event$origin2 = _event$origin2.changedTouches) === null || _event$origin2 === void 0 ? void 0 : _event$origin2[0]);
398
+ const x = (_touch$clientX = touch === null || touch === void 0 ? void 0 : touch.clientX) !== null && _touch$clientX !== void 0 ? _touch$clientX : touch === null || touch === void 0 ? void 0 : touch.pageX;
399
+ const y = (_touch$clientY = touch === null || touch === void 0 ? void 0 : touch.clientY) !== null && _touch$clientY !== void 0 ? _touch$clientY : touch === null || touch === void 0 ? void 0 : touch.pageY;
400
+ return typeof x === 'number' && typeof y === 'number' ? {
401
+ x,
402
+ y
403
+ } : null;
404
+ };
372
405
  const coverHeight = getBottomCoverHeight(screenType, isVerticalFullLayout, shouldHide);
373
406
  const containerHeight = screenType === 'vertical' ? 48 : 58;
374
407
 
@@ -381,29 +414,33 @@ const BottomLeftContent = _ref => {
381
414
  // 竖屏: 0 + 24 = 24 → bottom = 16
382
415
  // 横屏: 25 + 16.5 = 41.5 → bottom = 33.5
383
416
  const visibleRowHeight = containerHeight - paddingBottomPx;
417
+
384
418
  // button 模式用半透明圆做点击热区,比 pulse 提示大;下移半个差值以保持图标中心不变
385
- const hintSize = isButtonHint ? 26 : 16;
419
+
386
420
  // 竖屏:箭头贴着可视区右缘、压在第 5 项露出的那一角上(改动前就是这个观感)。
387
421
  // 箭头右缘距可视区右缘 4px => right = 可用宽 - 可视宽 + 4
388
422
  // 可视宽是“前 4 项 + 34 露出区”,箭头宽 26,因此箭头左缘落在第 4 项之后 4px,碰不到它。
389
423
  // 横屏维持原来的 6px
390
424
  const hintRight = (() => {
391
425
  if (!isVertical) return 6;
392
- if (!(availableWidth > 0) || !(scrollViewWidth > 0)) return 4;
393
- return Math.max(availableWidth - scrollViewWidth + 4, 4);
426
+ if (!(availableWidth > 0) || !(hintViewport.layoutWidth > 0)) return VERTICAL_HINT_EDGE_GAP;
427
+ return Math.max(availableWidth - hintViewport.layoutWidth + VERTICAL_HINT_EDGE_GAP, VERTICAL_HINT_EDGE_GAP);
394
428
  })();
395
- return /*#__PURE__*/React.createElement(CoverView, {
429
+ return /*#__PURE__*/React.createElement(OverlayView, {
396
430
  className: clsx('ipc-player-bottom-left-content-wrap', wrapCls),
397
- style: {
431
+ style: _objectSpread(_objectSpread({
398
432
  right: rightCss,
399
433
  height: showBadge ? `${coverHeight + 30}px` : `${coverHeight}px`,
400
434
  boxSizing: 'border-box',
401
435
  display: 'flex',
402
436
  flexDirection: 'column',
403
437
  justifyContent: 'flex-start',
404
- opacity: shouldHide ? 0 : 1,
438
+ opacity: shouldHide ? 0 : 1
439
+ }, renderMode === 'lynx' ? {
440
+ transition: 'opacity 0.3s ease'
441
+ } : {}), {}, {
405
442
  pointerEvents: shouldHide ? 'none' : 'auto'
406
- }
443
+ })
407
444
  }, showBadge && /*#__PURE__*/React.createElement(View, {
408
445
  style: {
409
446
  height: '32px',
@@ -417,11 +454,14 @@ const BottomLeftContent = _ref => {
417
454
  trialRemainingSec: trialRemainingSec,
418
455
  onSubscribe: handleTrialSubscribe,
419
456
  onCountdownEnd: handleCountdownEnd
420
- })), /*#__PURE__*/React.createElement(ScrollView, {
457
+ })), /*#__PURE__*/React.createElement(ScrollView, _extends({
421
458
  key: scrollResetKey,
422
- scrollX: true,
459
+ scrollX: renderMode !== 'lynx' || !lynxAtEnd,
423
460
  scrollLeft: scrollTo,
424
- scrollWithAnimation: true,
461
+ scrollWithAnimation: true
462
+ }, usesNativeHintImage(renderMode, hintPlatform) ? {
463
+ bounces: false
464
+ } : {}, {
425
465
  onScroll: e => {
426
466
  var _e$detail;
427
467
  // 滑动开始时暂停自动隐藏(仅在一次滑动会话内触发一次),滑动停止后恢复
@@ -442,8 +482,13 @@ const BottomLeftContent = _ref => {
442
482
  // Ray ScrollView 在不同实现下,scrollLeft 可能直接挂在事件上,也可能在 detail 内
443
483
  const sl = typeof (e === null || e === void 0 ? void 0 : e.scrollLeft) === 'number' ? e.scrollLeft : e === null || e === void 0 || (_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.scrollLeft;
444
484
  if (typeof sl === 'number') {
445
- scrollLeftRef.current = sl;
446
- setScrollLeft(sl);
485
+ // Android's boundary events can overshoot the range; never use elastic offsets as page state.
486
+ const nextScrollLeft = usesNativeHintImage(renderMode, hintPlatform) ? Math.max(0, Math.min(sl, Math.max(0, totalContentWidth - clientWidth))) : sl;
487
+ scrollLeftRef.current = nextScrollLeft;
488
+ setScrollLeft(nextScrollLeft);
489
+ if (usesNativeHintImage(renderMode, hintPlatform) && isScrollMode && !lynxAtEnd && nextScrollLeft > 0 && clientWidth > 0 && nextScrollLeft + clientWidth >= totalContentWidth - 2) {
490
+ setLynxAtEnd(true);
491
+ }
447
492
  // 一旦真的拖动过(>2px 阈值过滤抖动 / 重置触发的 0 值),当前屏幕模式下不再展示箭头
448
493
  if (sl > 2 && !dismissed[screenType]) {
449
494
  setDismissed(d => _objectSpread(_objectSpread({}, d), {}, {
@@ -460,28 +505,47 @@ const BottomLeftContent = _ref => {
460
505
  // 横屏 isScrollMode 恒为 false,仍走 72px 宽渐变,行为不变。
461
506
  'ipc-player-bottom-left-scroll-fademask--narrow': fadeRightEdge && isScrollMode
462
507
  }),
463
- style: {
508
+ style: _objectSpread(_objectSpread({
464
509
  paddingBottom: `${paddingBottomPx}px`,
465
510
  paddingLeft: `${paddingLeftPx}px`,
466
511
  paddingRight: `${paddingRightPx}px`,
467
- width: verticalScrollWidth > 0 ? `${verticalScrollWidth}px` : '100%',
512
+ width: hintViewport.width
513
+ }, usesNativeHintImage(renderMode, hintPlatform) && isScrollMode ? {
514
+ clipPath: 'none'
515
+ } : {}), {}, {
468
516
  height: `${containerHeight}px`,
469
517
  position: 'relative',
470
518
  top: `${coverHeight - containerHeight}px`,
471
519
  marginTop: showBadge ? '-2px' : 0,
472
520
  whiteSpace: 'nowrap'
473
- }
474
- }, /*#__PURE__*/React.createElement(View, {
521
+ })
522
+ }), /*#__PURE__*/React.createElement(View, {
523
+ onTouchStart: renderMode === 'lynx' ? event => {
524
+ endPageTouchRef.current = renderMode === 'lynx' && lynxAtEnd ? readTouch(event) : null;
525
+ } : undefined,
526
+ onTouchEnd: renderMode === 'lynx' ? event => {
527
+ const start = endPageTouchRef.current;
528
+ const end = readTouch(event);
529
+ endPageTouchRef.current = null;
530
+ if (!start || !end || renderMode !== 'lynx' || !lynxAtEnd) return;
531
+ const dx = end.x - start.x;
532
+ if (dx > 24 && dx > Math.abs(end.y - start.y)) setLynxAtEnd(false);
533
+ } : undefined,
534
+ onTouchCancel: () => {
535
+ endPageTouchRef.current = null;
536
+ },
475
537
  className: clsx('ipc-player-bottom-left-content-container', contentCls, {
476
538
  'ipc-player-bottom-left-content-container-tight': tightened
477
539
  }),
478
- style: {
479
- display: 'inline-flex',
540
+ style: _objectSpread({
541
+ display: renderMode === 'lynx' ? 'flex' : 'inline-flex',
480
542
  flexDirection: 'row',
481
543
  height: `${visibleRowHeight}px`,
482
544
  alignItems: 'center',
483
545
  paddingLeft: `${contentPaddingLeftPx}px`
484
- }
546
+ }, pageOffset > 0 ? {
547
+ transform: `translateX(-${pageOffset}px)`
548
+ } : {})
485
549
  }, children, /*#__PURE__*/React.createElement(View, {
486
550
  className: endCls,
487
551
  style: {
@@ -489,11 +553,26 @@ const BottomLeftContent = _ref => {
489
553
  height: '1px',
490
554
  flexShrink: 0
491
555
  }
492
- }))), isOverflow && !atEnd && !isCompact && (!isVertical || isScrollMode) && (isButtonHint || !isDismissed) && /*#__PURE__*/React.createElement(CoverView, {
556
+ }))), isOverflow && !atEnd && !isCompact && (!isVertical || isScrollMode) && (isButtonHint || !isDismissed) && /*#__PURE__*/React.createElement(ScrollHintButton, {
557
+ renderMode: renderMode,
558
+ platform: hintPlatform,
559
+ onPress: isButtonHint ? () => {
560
+ if (!isOverflow) {
561
+ return;
562
+ }
563
+ if (renderMode === 'lynx') {
564
+ var _ctx$event6, _ctx$event7;
565
+ (_ctx$event6 = ctx.event) === null || _ctx$event6 === void 0 || _ctx$event6.emit(pauseTimeToHideAllComponent);
566
+ setLynxAtEnd(true);
567
+ (_ctx$event7 = ctx.event) === null || _ctx$event7 === void 0 || _ctx$event7.emit(startTimeToHideAllComponent);
568
+ return;
569
+ }
570
+ setScrollTo(Math.max(0, Math.ceil(totalContentWidth - scrollViewWidth)));
571
+ } : undefined,
493
572
  className: clsx('ipc-player-bottom-left-scroll-hint', {
494
573
  'ipc-player-bottom-left-scroll-hint--button': isButtonHint
495
574
  }),
496
- style: {
575
+ style: _objectSpread({
497
576
  position: 'absolute',
498
577
  right: `${hintRight}px`,
499
578
  bottom: `${paddingBottomPx + visibleRowHeight / 2 - 8 - (hintSize - 16) / 2}px`,
@@ -503,26 +582,15 @@ const BottomLeftContent = _ref => {
503
582
  alignItems: 'center',
504
583
  justifyContent: 'center',
505
584
  pointerEvents: isButtonHint ? 'auto' : 'none'
506
- },
507
- onClick: isButtonHint ? () => {
508
- if (!isOverflow) {
509
- return;
510
- }
511
- setScrollTo(totalContentWidth + clientWidth + 9999);
512
- } : undefined
513
- }, /*#__PURE__*/React.createElement(View, {
514
- className: clsx('ipc-player-bottom-left-scroll-hint-arrow', {
515
- 'ipc-player-bottom-left-scroll-hint-arrow--right': true,
516
- 'ipc-player-bottom-left-scroll-hint-arrow--light': isButtonHint,
517
- 'ipc-player-bottom-left-scroll-hint-arrow--static': isButtonHint
518
- })
519
- // 右向 chevron 由 top+right 描边旋转而成,视觉重心偏右;放大并整体左移使其在圆内居中
520
- ,
521
- style: isButtonHint ? {
522
- width: '9px',
523
- height: '9px',
524
- transform: 'translate(-1px, 0) rotate(45deg)'
525
- } : undefined
585
+ }, usesNativeHintImage(renderMode, hintPlatform) && isButtonHint ? {
586
+ backgroundColor: 'rgba(0, 0, 0, 0.45)',
587
+ backgroundImage: 'none',
588
+ borderRadius: '50%'
589
+ } : {})
590
+ }, /*#__PURE__*/React.createElement(ScrollHintArrow, {
591
+ renderMode: renderMode,
592
+ platform: hintPlatform,
593
+ button: isButtonHint
526
594
  })));
527
595
  };
528
596
  export default BottomLeftContent;
@@ -1,7 +1,9 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { useEffect, useRef } from 'react';
3
- import { CoverView, View } from '@ray-js/ray';
3
+ import { View } from '@ray-js/ray';
4
4
  import clsx from 'clsx';
5
+ import { usePlayerOverlayHost } from '../renderer/overlay';
6
+ import { usePlayerRenderMode } from '../renderer/context';
5
7
  import { useStore } from '../ctx/store';
6
8
  import { useComponentHideState } from './hooks';
7
9
  import { getBottomCoverHeight } from './bottomCoverHeight';
@@ -15,6 +17,7 @@ const BottomRightContent = _ref => {
15
17
  width,
16
18
  onWidthChange
17
19
  } = _ref;
20
+ const OverlayView = usePlayerOverlayHost();
18
21
  const {
19
22
  screenType,
20
23
  isVerticalFullLayout,
@@ -27,6 +30,7 @@ const BottomRightContent = _ref => {
27
30
  bottomRightContent: ctx.bottomRightContent
28
31
  });
29
32
  const [shouldHide] = useComponentHideState();
33
+ const renderMode = usePlayerRenderMode();
30
34
  const idRef = useRef(++rightClsSeq);
31
35
  const wrapCls = `ipc-br-wrap-${idRef.current}`;
32
36
  const lastWidthRef = useRef(0);
@@ -47,17 +51,18 @@ const BottomRightContent = _ref => {
47
51
  onWidthChange === null || onWidthChange === void 0 || onWidthChange(w);
48
52
  }
49
53
  attempts += 1;
50
- if (attempts >= 15) {
54
+ // Lynx 首轮加密测量以尽快收敛,WebView 保持原有节奏。
55
+ if (attempts >= (renderMode === 'lynx' ? 20 : 15)) {
51
56
  return;
52
57
  }
53
- timer = setTimeout(measure, 400);
58
+ timer = setTimeout(measure, renderMode === 'lynx' && attempts < 8 ? 150 : 400);
54
59
  });
55
60
  };
56
61
  timer = setTimeout(measure, 60);
57
62
  return () => {
58
63
  if (timer) clearTimeout(timer);
59
64
  };
60
- }, [screenType, playState, bottomRightContent === null || bottomRightContent === void 0 ? void 0 : bottomRightContent.length, shouldHide, wrapCls, onWidthChange]);
65
+ }, [screenType, playState, bottomRightContent === null || bottomRightContent === void 0 ? void 0 : bottomRightContent.length, shouldHide, wrapCls, onWidthChange, renderMode]);
61
66
  const containerHeight = screenType === 'vertical' ? 48 : 58;
62
67
  const coverHeight = getBottomCoverHeight(screenType, isVerticalFullLayout, shouldHide);
63
68
 
@@ -70,7 +75,7 @@ const BottomRightContent = _ref => {
70
75
  width,
71
76
  boxSizing: 'border-box'
72
77
  } : null;
73
- return /*#__PURE__*/React.createElement(CoverView, {
78
+ return /*#__PURE__*/React.createElement(OverlayView, {
74
79
  className: clsx('ipc-player-bottom-right-content-wrap', wrapCls),
75
80
  style: _objectSpread({
76
81
  // 竖屏归 0:这 10px 是纯空白,且计入实测宽后又被 reservedRight 带给左下角,
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ export declare function usesNativeHintImage(renderMode: string, platform: string): boolean;
3
+ /** Android cannot paint the WebView fade mask: end its viewport at the hint's left edge.
4
+ * Layout width and hint position still use the original measured WebView budget.
5
+ */
6
+ export declare const getHintViewport: (renderMode: string, platform: string, scrollMode: boolean, lockedWidth: number, availableWidth: number, hintSize: number, hintEdgeGap: number, atEnd?: boolean) => {
7
+ layoutWidth: number;
8
+ visibleWidth: number;
9
+ width: string;
10
+ };
11
+ /** Consume a Lynx control tap before paging can remove its native hit target. */
12
+ export declare function ScrollHintButton({ renderMode, platform, onPress, ...props }: {
13
+ renderMode: 'lynx' | 'webview';
14
+ platform?: string;
15
+ onPress?: () => void;
16
+ [key: string]: any;
17
+ }): React.JSX.Element;
18
+ /** Keep legacy/iOS geometry; Android Lynx paints a real image rather than CSS URL/borders. */
19
+ export declare function ScrollHintArrow({ renderMode, platform, button, }: {
20
+ renderMode: string;
21
+ platform: string;
22
+ button: boolean;
23
+ }): React.JSX.Element;
@@ -0,0 +1,83 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ const _excluded = ["renderMode", "platform", "onPress"];
4
+ import React from 'react';
5
+ import { Image, View } from '@ray-js/ray';
6
+ import clsx from 'clsx';
7
+ import { getPlayerOverlayHost } from '../renderer/overlay';
8
+ import moreArrow from '../res/player-more-arrow.png';
9
+ export function usesNativeHintImage(renderMode, platform) {
10
+ return renderMode === 'lynx' && platform === 'android';
11
+ }
12
+
13
+ /** Android cannot paint the WebView fade mask: end its viewport at the hint's left edge.
14
+ * Layout width and hint position still use the original measured WebView budget.
15
+ */
16
+ export const getHintViewport = function (renderMode, platform, scrollMode, lockedWidth, availableWidth, hintSize, hintEdgeGap) {
17
+ let atEnd = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
18
+ const layoutWidth = lockedWidth > 0 ? lockedWidth : availableWidth;
19
+ const reservedHintWidth = usesNativeHintImage(renderMode, platform) && scrollMode && !atEnd ? hintSize + hintEdgeGap : 0;
20
+ const visibleWidth = Math.max(0, layoutWidth - reservedHintWidth);
21
+ return {
22
+ layoutWidth,
23
+ visibleWidth,
24
+ width: lockedWidth > 0 ? `${visibleWidth}px` : reservedHintWidth ? `calc(100% - ${reservedHintWidth}px)` : '100%'
25
+ };
26
+ };
27
+
28
+ /** Consume a Lynx control tap before paging can remove its native hit target. */
29
+ export function ScrollHintButton(_ref) {
30
+ let {
31
+ renderMode,
32
+ platform,
33
+ onPress
34
+ } = _ref,
35
+ props = _objectWithoutProperties(_ref, _excluded);
36
+ const nativeHitTarget = usesNativeHintImage(renderMode, platform || '');
37
+ const HintHost = getPlayerOverlayHost(renderMode);
38
+ return /*#__PURE__*/React.createElement(HintHost, _extends({}, props, nativeHitTarget ? {
39
+ flatten: false,
40
+ 'native-interaction-enabled': true
41
+ } : {}, {
42
+ onClick: onPress ? event => {
43
+ var _event$origin, _event$origin$stopPro;
44
+ if (renderMode === 'lynx') event === null || event === void 0 || (_event$origin = event.origin) === null || _event$origin === void 0 || (_event$origin$stopPro = _event$origin.stopPropagation) === null || _event$origin$stopPro === void 0 || _event$origin$stopPro.call(_event$origin);
45
+ onPress();
46
+ } : undefined
47
+ }));
48
+ }
49
+
50
+ /** Keep legacy/iOS geometry; Android Lynx paints a real image rather than CSS URL/borders. */
51
+ export function ScrollHintArrow(_ref2) {
52
+ let {
53
+ renderMode,
54
+ platform,
55
+ button
56
+ } = _ref2;
57
+ if (usesNativeHintImage(renderMode, platform)) {
58
+ const size = button ? '14px' : '10px';
59
+ return /*#__PURE__*/React.createElement(Image, {
60
+ className: "ipc-player-bottom-left-scroll-hint-image",
61
+ src: moreArrow,
62
+ mode: "aspectFit",
63
+ style: {
64
+ width: size,
65
+ height: size,
66
+ flexShrink: 0,
67
+ pointerEvents: 'none'
68
+ }
69
+ });
70
+ }
71
+ return /*#__PURE__*/React.createElement(View, {
72
+ className: clsx('ipc-player-bottom-left-scroll-hint-arrow', {
73
+ 'ipc-player-bottom-left-scroll-hint-arrow--right': true,
74
+ 'ipc-player-bottom-left-scroll-hint-arrow--light': button,
75
+ 'ipc-player-bottom-left-scroll-hint-arrow--static': button
76
+ }),
77
+ style: button ? {
78
+ width: '9px',
79
+ height: '9px',
80
+ transform: 'translate(-1px, 0) rotate(45deg)'
81
+ } : undefined
82
+ });
83
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { CoverView, View } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { usePlayerOverlayHost } from '../renderer/overlay';
4
5
  import { useStore } from '../ctx/store';
5
6
  import { useComponentHideState } from './hooks';
6
7
  const TopLeftContent = _ref => {
@@ -8,6 +9,7 @@ const TopLeftContent = _ref => {
8
9
  ctx,
9
10
  children
10
11
  } = _ref;
12
+ const OverlayView = usePlayerOverlayHost();
11
13
  const {
12
14
  screenType
13
15
  } = useStore({
@@ -15,7 +17,7 @@ const TopLeftContent = _ref => {
15
17
  playState: ctx.playState
16
18
  });
17
19
  const [shouldHide] = useComponentHideState();
18
- return /*#__PURE__*/React.createElement(CoverView, {
20
+ return /*#__PURE__*/React.createElement(OverlayView, {
19
21
  className: clsx('ipc-player-top-left-content-wrap'),
20
22
  style: {
21
23
  paddingRight: screenType === 'vertical' ? '0' : '20px',
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { CoverView, View } from '@ray-js/ray';
2
+ import { View } from '@ray-js/ray';
3
3
  import clsx from 'clsx';
4
+ import { usePlayerOverlayHost } from '../renderer/overlay';
4
5
  import { useStore } from '../ctx/store';
5
6
  import { useComponentHideState } from './hooks';
6
7
  const TopRightContent = _ref => {
@@ -8,6 +9,7 @@ const TopRightContent = _ref => {
8
9
  ctx,
9
10
  children
10
11
  } = _ref;
12
+ const OverlayView = usePlayerOverlayHost();
11
13
  const {
12
14
  screenType
13
15
  } = useStore({
@@ -15,7 +17,7 @@ const TopRightContent = _ref => {
15
17
  playState: ctx.playState
16
18
  });
17
19
  const [shouldHide] = useComponentHideState();
18
- return /*#__PURE__*/React.createElement(CoverView, {
20
+ return /*#__PURE__*/React.createElement(OverlayView, {
19
21
  className: clsx('ipc-player-top-right-content-wrap'),
20
22
  style: {
21
23
  height: screenType === 'vertical' ? shouldHide ? '37px' : '36px' : shouldHide ? '41px' : '40px'
package/lib/ui/ui.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
+ import { PlayerRenderMode } from '../renderer/context';
3
+ import { LynxPlayerAdapters } from '../renderer/capabilities';
2
4
  import { PlayStatusData, UseCtx, EventInstance } from '../interface';
3
5
  import './ui.less';
4
6
  type CtxInstance = ReturnType<UseCtx>;
@@ -14,6 +16,9 @@ type CSSVariable = {
14
16
  '--fontSize': string;
15
17
  };
16
18
  type Props = {
19
+ renderMode?: PlayerRenderMode;
20
+ /** Required when Lynx enables widgets backed by WebView-only renderers. */
21
+ lynxAdapters?: LynxPlayerAdapters;
17
22
  devId: string;
18
23
  /** 未提供 instance 时,传给播放器内部的 useCtx。null 表示配置查询中。 */
19
24
  autoClarityDisabled?: boolean | null;