@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
@@ -1,223 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import { getFileInfo, getFileSystemManager } from '@ray-js/ray';
3
- import { getCaptureResultSummary } from './captureResult';
4
- import { getDeviceInfo } from './device';
5
- jest.mock('@ray-js/ray', () => ({
6
- getFileInfo: jest.fn(),
7
- getFileSystemManager: jest.fn()
8
- }));
9
- jest.mock('./device', () => ({
10
- getDeviceInfo: jest.fn()
11
- }));
12
- const mockGetDeviceInfo = getDeviceInfo;
13
- const mockGetFileInfo = getFileInfo;
14
- const mockGetFileSystemManager = getFileSystemManager;
15
- const access = jest.fn();
16
- const basePath = 'https://thing.miniapp.com/__tmp__/capture.png';
17
- const result = {
18
- tempImagePath: basePath,
19
- filePath: basePath
20
- };
21
- const options = {
22
- multiLens: true,
23
- lensIndices: [1, 2, 3, 4],
24
- devId: 'dev-1'
25
- };
26
- beforeEach(() => {
27
- jest.resetAllMocks();
28
- mockGetDeviceInfo.mockResolvedValue({
29
- configMetas: {}
30
- });
31
- mockGetFileSystemManager.mockReturnValue({
32
- access
33
- });
34
- access.mockImplementation(_ref => {
35
- let {
36
- success
37
- } = _ref;
38
- return success();
39
- });
40
- mockGetFileInfo.mockImplementation(() => {
41
- throw new Error('Source file inspection is forbidden');
42
- });
43
- });
44
- it('counts existing images instead of the configured lens total', async () => {
45
- access.mockImplementation(_ref2 => {
46
- let {
47
- path,
48
- success,
49
- fail
50
- } = _ref2;
51
- if (path.endsWith('_lens2.png')) fail({
52
- errorCode: 10011
53
- });else success();
54
- });
55
- await expect(getCaptureResultSummary(result, options)).resolves.toEqual({
56
- count: 3,
57
- isMultiLens: true,
58
- thumbnailPath: 'https://thing.miniapp.com/__tmp__/capture_lens1.png'
59
- });
60
- });
61
- it('uses protocol indices unchanged and selects the first existing image', async () => {
62
- access.mockImplementation(_ref3 => {
63
- let {
64
- path,
65
- success,
66
- fail
67
- } = _ref3;
68
- if (path === 'https://thing.miniapp.com/__tmp__/capture_lens7.png') success();else fail({
69
- errorCode: 10011
70
- });
71
- });
72
- await expect(getCaptureResultSummary(result, _objectSpread(_objectSpread({}, options), {}, {
73
- lensIndices: [2, 7, 9]
74
- }))).resolves.toEqual({
75
- count: 1,
76
- isMultiLens: true,
77
- thumbnailPath: 'https://thing.miniapp.com/__tmp__/capture_lens7.png'
78
- });
79
- });
80
- it('waits for access callbacks even when the method returns undefined', async () => {
81
- const callbacks = [];
82
- access.mockImplementation(_ref4 => {
83
- let {
84
- success
85
- } = _ref4;
86
- callbacks.push(success);
87
- });
88
- const summary = getCaptureResultSummary(result, options);
89
- await Promise.resolve();
90
- await Promise.resolve();
91
- expect(callbacks).toHaveLength(4);
92
- for (const success of callbacks) success();
93
- await expect(summary).resolves.toMatchObject({
94
- count: 4
95
- });
96
- });
97
- it('returns no success summary when every image is missing', async () => {
98
- access.mockImplementation(_ref5 => {
99
- let {
100
- fail
101
- } = _ref5;
102
- return fail({
103
- errorCode: 10011
104
- });
105
- });
106
- await expect(getCaptureResultSummary(result, options)).resolves.toBeNull();
107
- });
108
- it('does not duplicate a lens suffix or count duplicate indices', async () => {
109
- await expect(getCaptureResultSummary({
110
- tempImagePath: 'thingfile://tmp/capture_lens7.jpg?token=a',
111
- filePath: ''
112
- }, _objectSpread(_objectSpread({}, options), {}, {
113
- lensIndices: [2, 7, 7]
114
- }))).resolves.toEqual({
115
- count: 2,
116
- isMultiLens: true,
117
- thumbnailPath: 'thingfile://tmp/capture_lens2.jpg?token=a'
118
- });
119
- });
120
- it('reads the original lens indices from the ability when no protocol is supplied', async () => {
121
- mockGetDeviceInfo.mockResolvedValue({
122
- configMetas: {
123
- tyabimr4v3: JSON.stringify({
124
- split_info: [{
125
- index: '2'
126
- }, {
127
- index: '7'
128
- }]
129
- })
130
- }
131
- });
132
- await expect(getCaptureResultSummary(result, {
133
- multiLens: true,
134
- devId: 'dev-1'
135
- })).resolves.toMatchObject({
136
- count: 2,
137
- thumbnailPath: basePath.replace('.png', '_lens2.png')
138
- });
139
- });
140
- it('keeps legacy or mono capture unchanged', async () => {
141
- await expect(getCaptureResultSummary(result, {
142
- multiLens: false,
143
- lensIndices: [1],
144
- devId: 'dev-1'
145
- })).resolves.toEqual({
146
- count: 1,
147
- isMultiLens: false,
148
- thumbnailPath: basePath
149
- });
150
- expect(access).not.toHaveBeenCalled();
151
- expect(mockGetFileInfo).not.toHaveBeenCalled();
152
- });
153
- it('counts recording thumbnails even when the source video path is missing', async () => {
154
- const recording = {
155
- tempImagePath: '',
156
- thumbPath: basePath,
157
- filePath: '/missing/record.mp4'
158
- };
159
- access.mockImplementation(_ref6 => {
160
- let {
161
- path,
162
- success,
163
- fail
164
- } = _ref6;
165
- if (path.endsWith('_lens2.png')) fail({
166
- errorCode: 10011
167
- });else success();
168
- });
169
- await expect(getCaptureResultSummary(recording, options)).resolves.toEqual({
170
- count: 3,
171
- isMultiLens: true,
172
- thumbnailPath: basePath.replace('.png', '_lens1.png')
173
- });
174
- expect(mockGetFileInfo).not.toHaveBeenCalled();
175
- expect(recording.filePath).toBe('/missing/record.mp4');
176
- });
177
- it('does not count source videos when every recording thumbnail is missing', async () => {
178
- access.mockImplementation(_ref7 => {
179
- let {
180
- fail
181
- } = _ref7;
182
- return fail({
183
- errorCode: 10011
184
- });
185
- });
186
- await expect(getCaptureResultSummary(_objectSpread(_objectSpread({}, result), {}, {
187
- filePath: '/album/record.mp4'
188
- }), options)).resolves.toBeNull();
189
- expect(mockGetFileInfo).not.toHaveBeenCalled();
190
- });
191
- it('never falls back to a source path when no thumbnail is returned', async () => {
192
- await expect(getCaptureResultSummary({
193
- tempImagePath: '',
194
- filePath: '/album/record.mp4'
195
- }, options)).resolves.toBeNull();
196
- expect(access).not.toHaveBeenCalled();
197
- expect(mockGetFileInfo).not.toHaveBeenCalled();
198
- });
199
- it('uses explicit thumbnails ahead of other image paths without renumbering lenses', async () => {
200
- access.mockImplementation(_ref8 => {
201
- let {
202
- path,
203
- success,
204
- fail
205
- } = _ref8;
206
- if (path === 'thingfile://tmp/record_thumb_lens7.png') success();else fail({
207
- errorCode: 10011
208
- });
209
- });
210
- const recording = {
211
- tempImagePath: 'thingfile://tmp/other.png',
212
- thumbPath: 'thingfile://tmp/record_thumb.png',
213
- filePath: '/album/record.mp4'
214
- };
215
- await expect(getCaptureResultSummary(recording, _objectSpread(_objectSpread({}, options), {}, {
216
- lensIndices: [2, 7, 9]
217
- }))).resolves.toEqual({
218
- count: 1,
219
- isMultiLens: true,
220
- thumbnailPath: 'thingfile://tmp/record_thumb_lens7.png'
221
- });
222
- expect(recording.filePath).toBe('/album/record.mp4');
223
- });
@@ -1,5 +0,0 @@
1
- export type EntryTracking = Record<'utm_source' | 'utm_medium' | 'entry_source_type' | 'utm_rtid', string>;
2
- export declare const createEntryTracking: (fallbackRtid?: string) => EntryTracking;
3
- export declare const appendTrackingQuery: (url: string, tracking: EntryTracking) => string;
4
- export declare const reportEntryView: (devId: string, tracking: EntryTracking) => Promise<void>;
5
- export declare const reportEntryClick: (devId: string, tracking: EntryTracking) => Promise<void>;
@@ -1,71 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import "core-js/modules/esnext.iterator.constructor.js";
3
- import "core-js/modules/esnext.iterator.filter.js";
4
- import "core-js/modules/esnext.iterator.for-each.js";
5
- import { getLaunchOptionsSync } from '@ray-js/ray';
6
- import { getInitUtmTid } from '@ray-js/ray-ipc-utils';
7
- export const createEntryTracking = fallbackRtid => {
8
- let upstreamRtid;
9
- try {
10
- var _getLaunchOptionsSync;
11
- upstreamRtid = (_getLaunchOptionsSync = getLaunchOptionsSync()) === null || _getLaunchOptionsSync === void 0 || (_getLaunchOptionsSync = _getLaunchOptionsSync.query) === null || _getLaunchOptionsSync === void 0 ? void 0 : _getLaunchOptionsSync.utm_rtid;
12
- } catch (error) {
13
- // Tracking must not prevent navigation when launch options are unavailable.
14
- }
15
- return {
16
- utm_source: 'miniprogram',
17
- utm_medium: 'panel_smart_quality',
18
- entry_source_type: 'organic',
19
- utm_rtid: upstreamRtid || fallbackRtid || getInitUtmTid()
20
- };
21
- };
22
- export const appendTrackingQuery = (url, tracking) => {
23
- const hashIndex = url.indexOf('#');
24
- const base = hashIndex < 0 ? url : url.slice(0, hashIndex);
25
- const hash = hashIndex < 0 ? '' : url.slice(hashIndex);
26
- const queryIndex = base.indexOf('?');
27
- const path = queryIndex < 0 ? base : base.slice(0, queryIndex);
28
- const params = (queryIndex < 0 ? [] : base.slice(queryIndex + 1).split('&')).filter(param => {
29
- if (!param) return false;
30
- return !Object.prototype.hasOwnProperty.call(tracking, decodeURIComponent(param.split('=')[0]));
31
- });
32
- Object.entries(tracking).forEach(_ref => {
33
- let [key, value] = _ref;
34
- params.push(`${key}=${encodeURIComponent(value)}`);
35
- });
36
- return `${path}?${params.join('&')}${hash}`;
37
- };
38
- const reportEntry = async (eventType, devId, tracking) => {
39
- try {
40
- const {
41
- homeId
42
- } = await new Promise((resolve, reject) => {
43
- ty.home.getCurrentHomeInfo({
44
- success: resolve,
45
- fail: reject
46
- });
47
- });
48
- const {
49
- miniProgram
50
- } = ty.getAccountInfoSync();
51
- const event = _objectSpread(_objectSpread({
52
- project_type: 'cloud_storage',
53
- event_type: eventType,
54
- container_type: 'miniapp',
55
- miniapp_code: miniProgram.appId,
56
- miniapp_version: miniProgram.version,
57
- service_type: 'security_cloud_service'
58
- }, tracking), {}, {
59
- device_id: devId,
60
- homeid: homeId
61
- });
62
- ty.event({
63
- eventId: eventType === 'card_view' ? 'ty_XjSozxV0YkDMjzH8orMHx0g2HMc6GQ3q' : 'ty_tUWSmFcHcSetzZd5soRTq6Y3nEYE0RgP',
64
- event
65
- });
66
- } catch (error) {
67
- console.warn('[IPC] entry tracking failed:', error);
68
- }
69
- };
70
- export const reportEntryView = (devId, tracking) => reportEntry('card_view', devId, tracking);
71
- export const reportEntryClick = (devId, tracking) => reportEntry('card_click', devId, tracking);
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- import './captureResult.less';
3
- export type CaptureKind = 'record' | 'screenshot';
4
- export interface CaptureResultToastProps {
5
- brandColor: string;
6
- kind: CaptureKind;
7
- thumbnailPath: string;
8
- onCheck: () => void;
9
- count?: number;
10
- /** 自定义标题(可选),不传时使用默认文案 */
11
- title?: React.ReactNode;
12
- /** 自定义操作按钮文案(可选),不传时默认为“查看” */
13
- checkText?: string;
14
- className?: string;
15
- }
16
- export declare function CaptureResultToast({ brandColor, count, kind, onCheck, thumbnailPath, title, checkText, className, }: CaptureResultToastProps): React.JSX.Element;
@@ -1,85 +0,0 @@
1
- import React from 'react';
2
- import { Image, Text, View } from '@ray-js/ray';
3
- import clsx from 'clsx';
4
- import Strings from '../../i18n';
5
- import './captureResult.less';
6
- const BACKDROP_LAYERS = ['back', 'middle'];
7
- const TEXT_KEYS = {
8
- record: {
9
- check: 'ipc_player_record_success_check',
10
- multi: 'ipc_player_record_multi_success_tip',
11
- single: 'ipc_player_record_success_tip'
12
- },
13
- screenshot: {
14
- check: 'ipc_player_shot_success_check',
15
- multi: 'ipc_player_screenshot_multi_success_tip',
16
- single: 'ipc_player_screenshot_success_tip'
17
- }
18
- };
19
- const LEGACY_CLASS_MAP = {
20
- record: {
21
- toast: 'ipc-player-plugin-record-success-toast',
22
- imageBox: 'ipc-player-plugin-record-success-toast-image-box',
23
- imageBoxMulti: 'ipc-player-plugin-record-success-toast-image-box-multi',
24
- image: 'ipc-player-plugin-record-success-toast-image',
25
- playIconBox: 'ipc-player-plugin-record-success-play-icon-box',
26
- playIcon: 'ipc-player-plugin-record-success-play-icon',
27
- title: 'ipc-player-plugin-record-success-toast-title',
28
- check: 'ipc-player-plugin-record-success-toast-bottom'
29
- },
30
- screenshot: {
31
- toast: 'ipc-player-plugin-screenshot-toast',
32
- imageBox: 'ipc-player-plugin-screenshot-toast-image-box',
33
- imageBoxMulti: 'ipc-player-plugin-screenshot-toast-image-box-multi',
34
- image: 'ipc-player-plugin-screenshot-toast-image',
35
- playIconBox: '',
36
- playIcon: '',
37
- title: 'ipc-player-plugin-screenshot-toast-title',
38
- check: 'ipc-player-plugin-screenshot-toast-bottom'
39
- }
40
- };
41
- export function CaptureResultToast(_ref) {
42
- let {
43
- brandColor,
44
- count = 0,
45
- kind,
46
- onCheck,
47
- thumbnailPath,
48
- title,
49
- checkText,
50
- className
51
- } = _ref;
52
- const isMultiLens = count > 1;
53
- const textKeys = TEXT_KEYS[kind];
54
- const legacyCls = LEGACY_CLASS_MAP[kind];
55
- const imageClassName = clsx('ipc-player-plugin-capture-result-image', legacyCls.image);
56
- return /*#__PURE__*/React.createElement(View, {
57
- className: clsx('ipc-player-plugin-capture-result-toast', legacyCls.toast, className)
58
- }, /*#__PURE__*/React.createElement(View, {
59
- className: clsx('ipc-player-plugin-capture-result-image-box', legacyCls.imageBox, isMultiLens && ['ipc-player-plugin-capture-result-image-box-multi', legacyCls.imageBoxMulti])
60
- }, isMultiLens ? /*#__PURE__*/React.createElement(React.Fragment, null, BACKDROP_LAYERS.map(layer => /*#__PURE__*/React.createElement(View, {
61
- key: layer,
62
- className: clsx('ipc-player-plugin-capture-result-backdrop', `ipc-player-plugin-capture-result-image-${layer}`)
63
- })), /*#__PURE__*/React.createElement(Image, {
64
- className: clsx(imageClassName, 'ipc-player-plugin-capture-result-image-front'),
65
- src: thumbnailPath
66
- })) : /*#__PURE__*/React.createElement(Image, {
67
- className: imageClassName,
68
- src: thumbnailPath
69
- }), kind === 'record' && /*#__PURE__*/React.createElement(View, {
70
- className: clsx('ipc-player-plugin-capture-result-play-icon-box', legacyCls.playIconBox)
71
- }, /*#__PURE__*/React.createElement(Text, {
72
- className: clsx('icon-panel', 'icon-panel-record-play', 'ipc-player-plugin-capture-result-play-icon', legacyCls.playIcon)
73
- }))), /*#__PURE__*/React.createElement(View, {
74
- className: clsx('ipc-player-plugin-capture-result-title', legacyCls.title)
75
- }, title ? typeof title === 'string' ? /*#__PURE__*/React.createElement(Text, null, title) : title : count > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, null, Strings.getLang(textKeys.multi)), /*#__PURE__*/React.createElement(Text, {
76
- className: "ipc-player-plugin-capture-result-count"
77
- }, Strings.formatString(Strings.getLang('ipc_player_multi_capture_success_count'), count))) : Strings.getLang(textKeys.single)), /*#__PURE__*/React.createElement(View, {
78
- onClick: onCheck,
79
- className: clsx('ipc-player-plugin-capture-result-check', legacyCls.check),
80
- style: {
81
- color: brandColor,
82
- borderColor: brandColor
83
- }
84
- }, checkText || Strings.getLang(textKeys.check)));
85
- }
@@ -1,144 +0,0 @@
1
- .ipc-player-plugin-capture-result-toast,
2
- .ipc-player-plugin-record-success-toast,
3
- .ipc-player-plugin-screenshot-toast {
4
- --capture-result-text-color: var(--fontColor, #fff);
5
- --capture-result-near-backdrop-color: rgba(255, 255, 255, 0.2);
6
- --capture-result-far-backdrop-color: rgba(255, 255, 255, 0.1);
7
-
8
- z-index: 100;
9
- display: flex;
10
- flex: 1;
11
- align-items: center;
12
- padding: calc(7px * var(--ipc-player-size-scale, 1))
13
- calc(16px * var(--ipc-player-size-scale, 1))
14
- calc(7px * var(--ipc-player-size-scale, 1))
15
- calc(12px * var(--ipc-player-size-scale, 1));
16
- background-color: var(--shot-card-bg-color);
17
- border-radius: calc(8px * var(--ipc-player-size-scale, 1));
18
- }
19
-
20
- :root[theme='light'] .ipc-player-plugin-capture-result-toast {
21
- --capture-result-text-color: #1a1a1a;
22
- --capture-result-near-backdrop-color: rgba(0, 0, 0, 0.1);
23
- --capture-result-far-backdrop-color: rgba(0, 0, 0, 0.05);
24
-
25
- background-color: #fff;
26
- }
27
-
28
- .ipc-player-plugin-capture-result-image-box,
29
- .ipc-player-plugin-record-success-toast-image-box,
30
- .ipc-player-plugin-screenshot-toast-image-box {
31
- position: relative;
32
- width: calc(66px * var(--ipc-player-size-scale, 1));
33
- height: calc(39px * var(--ipc-player-size-scale, 1));
34
- overflow: hidden;
35
- border-radius: calc(4px * var(--ipc-player-size-scale, 1));
36
- }
37
-
38
- .ipc-player-plugin-capture-result-image,
39
- .ipc-player-plugin-record-success-toast-image,
40
- .ipc-player-plugin-screenshot-toast-image {
41
- width: 100%;
42
- height: 100%;
43
- object-fit: cover;
44
- }
45
-
46
- .ipc-player-plugin-capture-result-backdrop,
47
- .ipc-player-plugin-capture-result-image-front {
48
- position: absolute;
49
- box-sizing: border-box;
50
- border-radius: calc(4px * var(--ipc-player-size-scale, 1));
51
- }
52
-
53
- .ipc-player-plugin-capture-result-image-back {
54
- top: calc(1px * var(--ipc-player-size-scale, 1));
55
- left: calc(5px * var(--ipc-player-size-scale, 1));
56
- z-index: 1;
57
- width: calc(56px * var(--ipc-player-size-scale, 1));
58
- height: calc(28px * var(--ipc-player-size-scale, 1));
59
- background: var(--capture-result-far-backdrop-color);
60
- }
61
-
62
- .ipc-player-plugin-capture-result-image-middle {
63
- top: calc(3px * var(--ipc-player-size-scale, 1));
64
- left: calc(2.5px * var(--ipc-player-size-scale, 1));
65
- z-index: 2;
66
- width: calc(61px * var(--ipc-player-size-scale, 1));
67
- height: calc(30.5px * var(--ipc-player-size-scale, 1));
68
- background: var(--capture-result-near-backdrop-color);
69
- }
70
-
71
- .ipc-player-plugin-capture-result-image-front {
72
- top: calc(5px * var(--ipc-player-size-scale, 1));
73
- left: 0;
74
- z-index: 3;
75
- width: calc(66px * var(--ipc-player-size-scale, 1));
76
- height: calc(33px * var(--ipc-player-size-scale, 1));
77
- }
78
-
79
- .ipc-player-plugin-capture-result-play-icon-box,
80
- .ipc-player-plugin-record-success-play-icon-box {
81
- position: absolute;
82
- top: 50%;
83
- left: 50%;
84
- z-index: 4;
85
- display: flex;
86
- align-items: center;
87
- justify-content: center;
88
- width: calc(16px * var(--ipc-player-size-scale, 1));
89
- height: calc(16px * var(--ipc-player-size-scale, 1));
90
- overflow: hidden;
91
- background-color: rgba(0, 0, 0, 0.2);
92
- border-radius: 50%;
93
- transform: translate(-50%, -50%);
94
- }
95
-
96
- .ipc-player-plugin-capture-result-image-box-multi
97
- .ipc-player-plugin-capture-result-play-icon-box {
98
- top: calc(50% + 2px * var(--ipc-player-size-scale, 1));
99
- }
100
-
101
- .ipc-player-plugin-capture-result-play-icon,
102
- .ipc-player-plugin-record-success-play-icon {
103
- color: #ffffff;
104
- font-size: calc(9px * var(--ipc-player-size-scale, 1)) !important;
105
- }
106
-
107
- .ipc-player-plugin-capture-result-title,
108
- .ipc-player-plugin-record-success-toast-title,
109
- .ipc-player-plugin-screenshot-toast-title {
110
- display: flex;
111
- flex: 1;
112
- flex-direction: column;
113
- min-width: 0;
114
- margin-right: calc(12px * var(--ipc-player-size-scale, 1));
115
- margin-left: calc(8px * var(--ipc-player-size-scale, 1));
116
- color: var(--capture-result-text-color, var(--fontColor));
117
- font-size: calc(14px * var(--ipc-player-size-scale, 1));
118
- line-height: calc(20px * var(--ipc-player-size-scale, 1));
119
- word-break: break-word;
120
- }
121
-
122
- .ipc-player-plugin-capture-result-count {
123
- margin-top: calc(2px * var(--ipc-player-size-scale, 1));
124
- color: var(--capture-result-text-color, var(--fontColor));
125
- font-size: calc(12px * var(--ipc-player-size-scale, 1));
126
- line-height: calc(17px * var(--ipc-player-size-scale, 1));
127
- opacity: 0.5;
128
- }
129
-
130
- .ipc-player-plugin-capture-result-check,
131
- .ipc-player-plugin-record-success-toast-bottom,
132
- .ipc-player-plugin-screenshot-toast-bottom {
133
- min-width: calc(52px * var(--ipc-player-size-scale, 1));
134
- max-width: calc(100px * var(--ipc-player-size-scale, 1));
135
- flex-shrink: 0;
136
- padding: calc(5px * var(--ipc-player-size-scale, 1))
137
- calc(11px * var(--ipc-player-size-scale, 1));
138
- overflow: hidden;
139
- font-size: calc(14px * var(--ipc-player-size-scale, 1));
140
- white-space: nowrap;
141
- text-overflow: ellipsis;
142
- border: 1px solid #1989fa;
143
- border-radius: calc(4px * var(--ipc-player-size-scale, 1));
144
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,84 +0,0 @@
1
- import React from 'react';
2
- import { renderToStaticMarkup } from 'react-dom/server';
3
- jest.mock('@ray-js/ray', () => {
4
- const React = require('react');
5
- return {
6
- Image: _ref => {
7
- let {
8
- className,
9
- src
10
- } = _ref;
11
- return /*#__PURE__*/React.createElement("img", {
12
- alt: "",
13
- className: className,
14
- src: src
15
- });
16
- },
17
- Text: _ref2 => {
18
- let {
19
- children,
20
- className
21
- } = _ref2;
22
- return /*#__PURE__*/React.createElement("span", {
23
- className: className
24
- }, children);
25
- },
26
- View: _ref3 => {
27
- let {
28
- children,
29
- className
30
- } = _ref3;
31
- return /*#__PURE__*/React.createElement("div", {
32
- className: className
33
- }, children);
34
- }
35
- };
36
- });
37
- jest.mock('../../i18n', () => ({
38
- __esModule: true,
39
- default: {
40
- getLang: key => key,
41
- formatString: (template, count) => `${template}:${count}`
42
- }
43
- }));
44
- jest.mock('./captureResult.less', () => ({}));
45
- const {
46
- CaptureResultToast
47
- } = require('./captureResult');
48
- const renderToast = count => renderToStaticMarkup(/*#__PURE__*/React.createElement(CaptureResultToast, {
49
- brandColor: "#ff592a",
50
- count: count,
51
- kind: "screenshot",
52
- onCheck: () => undefined,
53
- thumbnailPath: "thingfile://capture.jpg"
54
- }));
55
- const countClass = (markup, className) => [...markup.matchAll(/class="([^"]*)"/g)].filter(_ref4 => {
56
- let [, names] = _ref4;
57
- return names.split(/\s+/).includes(className);
58
- }).length;
59
- describe('CaptureResultToast', () => {
60
- it('shows the actual count for one successful multi-lens item', () => {
61
- expect(renderToast(1)).toContain('ipc_player_multi_capture_success_count:1');
62
- expect(renderToast(0)).not.toContain('ipc_player_multi_capture_success_count');
63
- });
64
- it('keeps the single-item thumbnail unchanged', () => {
65
- const markup = renderToast(1);
66
- expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(0);
67
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(0);
68
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image')).toBe(1);
69
- });
70
- it('renders both backdrops for two captured items', () => {
71
- const markup = renderToast(2);
72
- expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
73
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
74
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
75
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
76
- });
77
- it('caps the backdrop count at two', () => {
78
- const markup = renderToast(4);
79
- expect(countClass(markup, 'ipc-player-plugin-capture-result-backdrop')).toBe(2);
80
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-back')).toBe(1);
81
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-middle')).toBe(1);
82
- expect(countClass(markup, 'ipc-player-plugin-capture-result-image-front')).toBe(1);
83
- });
84
- });
@@ -1,2 +0,0 @@
1
- export * from './captureResult';
2
- export type { CaptureResultToastProps, CaptureKind } from './captureResult';
@@ -1,2 +0,0 @@
1
- export * from './captureResult';
2
- export {};