@ray-js/ipc-player-integration 0.0.65-beta.3 → 0.0.66-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 +3 -13
- package/lib/ctx/ctx.js +35 -46
- package/lib/ctx/multiCameraCtx.d.ts +0 -2
- package/lib/ctx/multiCameraCtx.js +1 -17
- 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 -17
- 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-charging.png +0 -0
- package/lib/res/player-more-arrow.png +0 -0
- package/lib/res/player-solar.png +0 -0
- package/lib/ui/bottomLeftContent.js +119 -55
- 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 -0
- package/lib/ui/ui.js +89 -98
- package/lib/utils/navigation.d.ts +1 -2
- package/lib/utils/navigation.js +3 -13
- package/lib/widgets/battery/battery.js +7 -5
- package/lib/widgets/battery/batteryFull.js +7 -5
- package/lib/widgets/battery/statusIcon.d.ts +6 -0
- package/lib/widgets/battery/statusIcon.js +36 -0
- package/lib/widgets/battery/statusIcon.less +24 -0
- 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/index.less +0 -1
- package/lib/widgets/multiCamera/landscapeTip.js +2 -1
- package/lib/widgets/multiCamera/moveablePtzControl.js +5 -5
- package/lib/widgets/multiCamera/multiPtz.js +3 -2
- package/lib/widgets/multiCamera/ptzMoveableTip.js +2 -1
- package/lib/widgets/multiCamera/switchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileMultiPtz.js +3 -2
- package/lib/widgets/multiCamera/tileSwitchLayout.js +2 -1
- package/lib/widgets/multiCamera/tileTip.js +2 -1
- package/lib/widgets/muted/muted.js +2 -1
- package/lib/widgets/muted/muted.test.js +66 -52
- 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.d.ts +1 -2
- package/lib/widgets/trialBadge/index.js +17 -20
- package/lib/widgets/trialBadge/index.less +24 -0
- package/lib/widgets/trialBadge/useTrialBadge.d.ts +2 -3
- package/lib/widgets/trialBadge/useTrialBadge.js +2 -13
- package/lib/widgets/tryExperience/tryExperience.js +2 -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/lynxDockLayout.d.ts +6 -0
- package/lib/widgets/zoomTurntable/lynxDockLayout.js +30 -0
- package/lib/widgets/zoomTurntable/turntable/index.d.ts +5 -7
- package/lib/widgets/zoomTurntable/turntable/index.js +3 -1
- package/lib/widgets/zoomTurntable/turntable/lynx.d.ts +5 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.js +273 -0
- package/lib/widgets/zoomTurntable/turntable/lynx.less +9 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.d.ts +37 -0
- package/lib/widgets/zoomTurntable/turntable/lynxModel.js +122 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.d.ts +3 -0
- package/lib/widgets/zoomTurntable/turntable/lynxPaint.js +36 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.d.ts +2 -0
- package/lib/widgets/zoomTurntable/zoomTurntableDock.js +1 -1
- package/lib/widgets/zoomTurntable/zoomTurntableEntry.js +31 -18
- package/lib/widgets/zoomTurntable/zoomTurntableTip.js +23 -3
- package/package.json +15 -7
- package/lib/ctx/ctx.album.test.d.ts +0 -1
- package/lib/ctx/ctx.album.test.js +0 -197
- package/lib/ctx/multiCameraCtx.test.d.ts +0 -1
- package/lib/ctx/multiCameraCtx.test.js +0 -65
- 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/utils/fullLinkTracking.d.ts +0 -5
- package/lib/utils/fullLinkTracking.js +0 -71
- 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/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
|
|
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,15 +83,19 @@ 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,
|
|
85
|
-
handleTrialView,
|
|
86
94
|
handleTrialSubscribe,
|
|
87
95
|
handleCountdownEnd
|
|
88
|
-
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec
|
|
96
|
+
} = useTrialBadge(ctx.event, ctx.devId, trialRemainingSec);
|
|
89
97
|
|
|
90
|
-
//
|
|
98
|
+
// 横向滚动状态:右侧仍有内容时显示右箭头提示
|
|
91
99
|
const idRef = useRef(++scrollClsSeq);
|
|
92
100
|
// wrap 是左下角的可用区(left:0 ~ right:reservedRight),宽度不随 ScrollView 收窄而变,
|
|
93
101
|
// 因此用它、而不是 ScrollView 自身,作为“能摆多宽”的基准,避免收窄与分档互相依赖
|
|
@@ -108,6 +116,8 @@ const BottomLeftContent = _ref => {
|
|
|
108
116
|
// 点击箭头时的受控滚动目标;仅在程序化滚动期间为数值,结束后置回 undefined,
|
|
109
117
|
// 避免持续受控导致用户手动拖动被回弹
|
|
110
118
|
const [scrollTo, setScrollTo] = useState(undefined);
|
|
119
|
+
const [lynxAtEnd, setLynxAtEnd] = useState(false);
|
|
120
|
+
const endPageTouchRef = useRef(null);
|
|
111
121
|
// 横竖屏切换后,强制 ScrollView 重新挂载并把滚动状态重置为初始值
|
|
112
122
|
const [scrollResetKey, setScrollResetKey] = useState(0);
|
|
113
123
|
// 用户在某种屏幕模式下拖动过一次之后,该模式不再展示箭头(竖屏 / 横屏各自独立记录)
|
|
@@ -130,10 +140,12 @@ const BottomLeftContent = _ref => {
|
|
|
130
140
|
const scrollEndTimerRef = useRef();
|
|
131
141
|
// 测量时需要叠加当前滚动量,用 ref 避免闭包拿到过期值
|
|
132
142
|
const scrollLeftRef = useRef(0);
|
|
143
|
+
const pageOffsetRef = useRef(0);
|
|
133
144
|
useEffect(() => {
|
|
134
145
|
setScrollResetKey(k => k + 1);
|
|
135
146
|
setScrollLeft(0);
|
|
136
147
|
setScrollTo(undefined);
|
|
148
|
+
setLynxAtEnd(false);
|
|
137
149
|
scrollLeftRef.current = 0;
|
|
138
150
|
// 清零上一屏的测量值,避免用旧 clientWidth/contentWidth 在重新测量前误判溢出导致箭头闪现
|
|
139
151
|
setClientWidth(0);
|
|
@@ -294,7 +306,7 @@ const BottomLeftContent = _ref => {
|
|
|
294
306
|
// 这样即使内容容器被撑满到可视内盒宽,也能拿到真实内容宽;哨兵不可用时回退到容器宽。
|
|
295
307
|
let tw = 0;
|
|
296
308
|
if (scrollRect && endRect && typeof endRect.left === 'number') {
|
|
297
|
-
tw = endRect.left - scrollRect.left - paddingLeftPx + scrollLeftRef.current;
|
|
309
|
+
tw = endRect.left - scrollRect.left - paddingLeftPx + scrollLeftRef.current + pageOffsetRef.current;
|
|
298
310
|
}
|
|
299
311
|
if (!(tw > 0)) {
|
|
300
312
|
tw = (contentRect === null || contentRect === void 0 ? void 0 : contentRect.width) || 0;
|
|
@@ -303,11 +315,11 @@ const BottomLeftContent = _ref => {
|
|
|
303
315
|
setContentWidth(tw);
|
|
304
316
|
}
|
|
305
317
|
attempts += 1;
|
|
306
|
-
//
|
|
307
|
-
if (attempts >= 15) {
|
|
318
|
+
// Lynx 首轮加密测量以尽快收敛,WebView 保持原有 400ms/15 次节奏。
|
|
319
|
+
if (attempts >= (renderMode === 'lynx' ? 20 : 15)) {
|
|
308
320
|
return;
|
|
309
321
|
}
|
|
310
|
-
timer = setTimeout(measure, 400);
|
|
322
|
+
timer = setTimeout(measure, renderMode === 'lynx' && attempts < 8 ? 150 : 400);
|
|
311
323
|
});
|
|
312
324
|
};
|
|
313
325
|
|
|
@@ -323,7 +335,7 @@ const BottomLeftContent = _ref => {
|
|
|
323
335
|
// playState:视频就绪后 overlay 可能重新布局,需重新测量
|
|
324
336
|
playState, bottomLeftContent === null || bottomLeftContent === void 0 ? void 0 : bottomLeftContent.length, shouldHide, showBadge, wrapCls, scrollCls, contentCls, scrollResetKey, resizeSignal,
|
|
325
337
|
// 收紧后各项 padding 变小,必须重测一遍逐项宽,否则分档还在用收紧前的旧值
|
|
326
|
-
tightened]);
|
|
338
|
+
tightened, renderMode]);
|
|
327
339
|
|
|
328
340
|
// 子元素主动上报宽度变化 → 重跑测量,及时更新横滑箭头与右边缘淡出
|
|
329
341
|
useEffect(() => {
|
|
@@ -353,19 +365,37 @@ const BottomLeftContent = _ref => {
|
|
|
353
365
|
const totalContentWidth = naturalWidth > 0 ? paddingLeftPx + naturalWidth + paddingRightPx : 0;
|
|
354
366
|
// 竖屏由“个数”决定是否溢出(平铺档恒不溢出);横屏保持原来的像素比对
|
|
355
367
|
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
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];
|
|
360
380
|
// button 模式:溢出且未到末端即常显(不受 dismissed 影响);pulse 模式:保留拖动后消失的旧逻辑。
|
|
361
381
|
// compact 档(<= 4 个但摆不下)不出箭头:那点空间要留给元素本身,箭头只会遮更多
|
|
362
382
|
|
|
363
383
|
// 右侧还有未滚到头的内容时,启用右边缘淡出,把没完全露出的元素渐隐隐藏(横竖屏都生效)
|
|
364
384
|
const fadeRightEdge = isOverflow && !atEnd;
|
|
365
385
|
|
|
366
|
-
//
|
|
367
|
-
//
|
|
386
|
+
// Lynx 用子节点 id 定位末端:其受控 scrollLeft 属性不会可靠地驱动原生横滑。
|
|
387
|
+
// WebView 仍以有限的实际最大偏移滚动。
|
|
368
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
|
+
};
|
|
369
399
|
const coverHeight = screenType === 'vertical' ? shouldHide ? 49 : 48 : shouldHide ? 59 : 58;
|
|
370
400
|
const containerHeight = screenType === 'vertical' ? 48 : 58;
|
|
371
401
|
|
|
@@ -378,44 +408,50 @@ const BottomLeftContent = _ref => {
|
|
|
378
408
|
// 竖屏: 0 + 24 = 24 → bottom = 16
|
|
379
409
|
// 横屏: 25 + 16.5 = 41.5 → bottom = 33.5
|
|
380
410
|
const visibleRowHeight = containerHeight - paddingBottomPx;
|
|
411
|
+
|
|
381
412
|
// button 模式用半透明圆做点击热区,比 pulse 提示大;下移半个差值以保持图标中心不变
|
|
382
|
-
|
|
413
|
+
|
|
383
414
|
// 竖屏:箭头贴着可视区右缘、压在第 5 项露出的那一角上(改动前就是这个观感)。
|
|
384
415
|
// 箭头右缘距可视区右缘 4px => right = 可用宽 - 可视宽 + 4
|
|
385
416
|
// 可视宽是“前 4 项 + 34 露出区”,箭头宽 26,因此箭头左缘落在第 4 项之后 4px,碰不到它。
|
|
386
417
|
// 横屏维持原来的 6px
|
|
387
418
|
const hintRight = (() => {
|
|
388
419
|
if (!isVertical) return 6;
|
|
389
|
-
if (!(availableWidth > 0) || !(
|
|
390
|
-
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);
|
|
391
422
|
})();
|
|
392
423
|
return /*#__PURE__*/React.createElement(CoverView, {
|
|
393
424
|
className: clsx('ipc-player-bottom-left-content-wrap', wrapCls),
|
|
394
|
-
style: {
|
|
425
|
+
style: _objectSpread(_objectSpread({
|
|
395
426
|
right: rightCss,
|
|
396
427
|
height: showBadge ? `${coverHeight + 30}px` : `${coverHeight}px`,
|
|
397
428
|
display: 'flex',
|
|
398
429
|
flexDirection: 'column',
|
|
399
430
|
justifyContent: 'flex-start',
|
|
400
|
-
opacity: shouldHide ? 0 : 1
|
|
431
|
+
opacity: shouldHide ? 0 : 1
|
|
432
|
+
}, renderMode === 'lynx' ? {
|
|
433
|
+
transition: 'opacity 0.3s ease'
|
|
434
|
+
} : {}), {}, {
|
|
401
435
|
pointerEvents: shouldHide ? 'none' : 'auto'
|
|
402
|
-
}
|
|
436
|
+
})
|
|
403
437
|
}, showBadge && /*#__PURE__*/React.createElement(View, {
|
|
404
438
|
style: {
|
|
405
439
|
height: '32px',
|
|
406
440
|
marginLeft: screenType === 'vertical' ? '12px' : '25px'
|
|
407
441
|
}
|
|
408
442
|
}, /*#__PURE__*/React.createElement(TrialBadge, {
|
|
409
|
-
onView: handleTrialView,
|
|
410
443
|
brandColor: brandColor,
|
|
411
444
|
trialRemainingSec: trialRemainingSec,
|
|
412
445
|
onSubscribe: handleTrialSubscribe,
|
|
413
446
|
onCountdownEnd: handleCountdownEnd
|
|
414
|
-
})), /*#__PURE__*/React.createElement(ScrollView, {
|
|
447
|
+
})), /*#__PURE__*/React.createElement(ScrollView, _extends({
|
|
415
448
|
key: scrollResetKey,
|
|
416
|
-
scrollX:
|
|
449
|
+
scrollX: renderMode !== 'lynx' || !lynxAtEnd,
|
|
417
450
|
scrollLeft: scrollTo,
|
|
418
|
-
scrollWithAnimation: true
|
|
451
|
+
scrollWithAnimation: true
|
|
452
|
+
}, usesNativeHintImage(renderMode, hintPlatform) ? {
|
|
453
|
+
bounces: false
|
|
454
|
+
} : {}, {
|
|
419
455
|
onScroll: e => {
|
|
420
456
|
var _e$detail;
|
|
421
457
|
// 滑动开始时暂停自动隐藏(仅在一次滑动会话内触发一次),滑动停止后恢复
|
|
@@ -436,8 +472,13 @@ const BottomLeftContent = _ref => {
|
|
|
436
472
|
// Ray ScrollView 在不同实现下,scrollLeft 可能直接挂在事件上,也可能在 detail 内
|
|
437
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;
|
|
438
474
|
if (typeof sl === 'number') {
|
|
439
|
-
|
|
440
|
-
|
|
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
|
+
}
|
|
441
482
|
// 一旦真的拖动过(>2px 阈值过滤抖动 / 重置触发的 0 值),当前屏幕模式下不再展示箭头
|
|
442
483
|
if (sl > 2 && !dismissed[screenType]) {
|
|
443
484
|
setDismissed(d => _objectSpread(_objectSpread({}, d), {}, {
|
|
@@ -454,26 +495,45 @@ const BottomLeftContent = _ref => {
|
|
|
454
495
|
// 横屏 isScrollMode 恒为 false,仍走 72px 宽渐变,行为不变。
|
|
455
496
|
'ipc-player-bottom-left-scroll-fademask--narrow': fadeRightEdge && isScrollMode
|
|
456
497
|
}),
|
|
457
|
-
style: {
|
|
498
|
+
style: _objectSpread(_objectSpread({
|
|
458
499
|
paddingBottom: `${paddingBottomPx}px`,
|
|
459
500
|
paddingLeft: `${paddingLeftPx}px`,
|
|
460
501
|
paddingRight: `${paddingRightPx}px`,
|
|
461
|
-
width:
|
|
502
|
+
width: hintViewport.width
|
|
503
|
+
}, usesNativeHintImage(renderMode, hintPlatform) && isScrollMode ? {
|
|
504
|
+
clipPath: 'none'
|
|
505
|
+
} : {}), {}, {
|
|
462
506
|
height: `${containerHeight}px`,
|
|
463
507
|
marginTop: showBadge ? '-2px' : 0,
|
|
464
508
|
whiteSpace: 'nowrap'
|
|
465
|
-
}
|
|
466
|
-
}, /*#__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
|
+
},
|
|
467
525
|
className: clsx('ipc-player-bottom-left-content-container', contentCls, {
|
|
468
526
|
'ipc-player-bottom-left-content-container-tight': tightened
|
|
469
527
|
}),
|
|
470
|
-
style: {
|
|
471
|
-
display: 'inline-flex',
|
|
528
|
+
style: _objectSpread({
|
|
529
|
+
display: renderMode === 'lynx' ? 'flex' : 'inline-flex',
|
|
472
530
|
flexDirection: 'row',
|
|
473
531
|
height: `${visibleRowHeight}px`,
|
|
474
532
|
alignItems: 'center',
|
|
475
533
|
paddingLeft: `${contentPaddingLeftPx}px`
|
|
476
|
-
}
|
|
534
|
+
}, pageOffset > 0 ? {
|
|
535
|
+
transform: `translateX(-${pageOffset}px)`
|
|
536
|
+
} : {})
|
|
477
537
|
}, children, /*#__PURE__*/React.createElement(View, {
|
|
478
538
|
className: endCls,
|
|
479
539
|
style: {
|
|
@@ -481,11 +541,26 @@ const BottomLeftContent = _ref => {
|
|
|
481
541
|
height: '1px',
|
|
482
542
|
flexShrink: 0
|
|
483
543
|
}
|
|
484
|
-
}))), 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,
|
|
485
560
|
className: clsx('ipc-player-bottom-left-scroll-hint', {
|
|
486
561
|
'ipc-player-bottom-left-scroll-hint--button': isButtonHint
|
|
487
562
|
}),
|
|
488
|
-
style: {
|
|
563
|
+
style: _objectSpread({
|
|
489
564
|
position: 'absolute',
|
|
490
565
|
right: `${hintRight}px`,
|
|
491
566
|
bottom: `${paddingBottomPx + visibleRowHeight / 2 - 8 - (hintSize - 16) / 2}px`,
|
|
@@ -495,26 +570,15 @@ const BottomLeftContent = _ref => {
|
|
|
495
570
|
alignItems: 'center',
|
|
496
571
|
justifyContent: 'center',
|
|
497
572
|
pointerEvents: isButtonHint ? 'auto' : 'none'
|
|
498
|
-
},
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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
|
|
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
|
|
518
582
|
})));
|
|
519
583
|
};
|
|
520
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,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;
|