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