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