@xiping/react-components 1.0.70 → 1.0.78

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 (207) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.js +1 -0
  2. package/dist/cjs/components/blur-fade/BlurFade.js +1 -1
  3. package/dist/cjs/components/blur-text/BlurText.js +1 -1
  4. package/dist/cjs/components/button/Button.css +1 -1
  5. package/dist/cjs/components/button/Button2.js +1 -0
  6. package/dist/cjs/components/comic-text/ComicText2.js +4 -0
  7. package/dist/cjs/components/confetti-button/index.js +1 -1
  8. package/dist/cjs/components/dock/Duck.css +1 -1
  9. package/dist/cjs/components/dock/Duck2.js +1 -0
  10. package/dist/cjs/components/flip-text/FlipText.css +1 -1
  11. package/dist/cjs/components/flip-text/FlipText2.js +1 -0
  12. package/dist/cjs/components/gradient-text/index.css +1 -1
  13. package/dist/cjs/components/gradient-text/index2.js +1 -0
  14. package/dist/cjs/components/hyper-text/HyperText.css +1 -1
  15. package/dist/cjs/components/hyper-text/index.js +1 -1
  16. package/dist/cjs/components/image-compare/ImageCompare.css +1 -1
  17. package/dist/cjs/components/image-compare/ImageCompare2.js +1 -0
  18. package/dist/cjs/components/image-viewer/ImageThumbnails.css +1 -1
  19. package/dist/cjs/components/image-viewer/ImageThumbnails2.js +1 -0
  20. package/dist/cjs/components/image-viewer/ImageViewer.css +1 -1
  21. package/dist/cjs/components/image-viewer/ImageViewer.d.ts +1 -1
  22. package/dist/cjs/components/image-viewer/ImageViewer2.js +1 -0
  23. package/dist/cjs/components/message/Message.css +1 -1
  24. package/dist/cjs/components/message/Message2.js +1 -0
  25. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  26. package/dist/cjs/components/pinch-content/index.js +1 -1
  27. package/dist/cjs/components/pointer/Pointer.css +1 -1
  28. package/dist/cjs/components/pointer/Pointer2.js +1 -0
  29. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.css +1 -1
  30. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal2.js +1 -0
  31. package/dist/cjs/components/shimmer-button/ShimmerButton.css +1 -1
  32. package/dist/cjs/components/shimmer-button/ShimmerButton2.js +1 -0
  33. package/dist/cjs/components/shiny-button/ShinyButton.css +1 -1
  34. package/dist/cjs/components/shiny-button/ShinyButton2.js +1 -0
  35. package/dist/cjs/components/shiny-text/ShinyText2.js +1 -0
  36. package/dist/cjs/components/sparkles-text/SparklesText.css +1 -1
  37. package/dist/cjs/components/sparkles-text/SparklesText2.js +1 -0
  38. package/dist/cjs/components/split-text/SplitText.css +1 -1
  39. package/dist/cjs/components/split-text/SplitText2.js +1 -0
  40. package/dist/cjs/components/subtitle-player/CurrentMode.css +1 -1
  41. package/dist/cjs/components/subtitle-player/CurrentMode2.js +2 -0
  42. package/dist/cjs/components/subtitle-player/LyricsMode.css +1 -1
  43. package/dist/cjs/components/subtitle-player/LyricsMode2.js +2 -0
  44. package/dist/cjs/components/subtitle-player/SubtitlePlayer.css +1 -1
  45. package/dist/cjs/components/subtitle-player/SubtitlePlayer2.js +1 -0
  46. package/dist/cjs/components/subtitle-player/utils.js +1 -1
  47. package/dist/cjs/components/text-animate/TextAnimate.css +1 -1
  48. package/dist/cjs/components/text-animate/TextAnimate2.js +2 -0
  49. package/dist/cjs/components/text-type/TextType.css +1 -1
  50. package/dist/cjs/components/text-type/TextType2.js +1 -0
  51. package/dist/cjs/components/txt-editor/TxtEditor.js +4 -4
  52. package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
  53. package/dist/cjs/components/txt-reader/index.module.css +1 -1
  54. package/dist/cjs/components/txt-reader/index.module.js +1 -0
  55. package/dist/cjs/components/typing-animation/index.css +1 -1
  56. package/dist/cjs/components/typing-animation/index2.js +1 -0
  57. package/dist/cjs/components/variable-proximity/index.css +1 -1
  58. package/dist/cjs/components/variable-proximity/index2.js +1 -0
  59. package/dist/cjs/components/video-dialog/VideoDialog.css +1 -1
  60. package/dist/cjs/components/video-dialog/VideoDialog2.js +1 -0
  61. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
  62. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
  63. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
  64. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer2.js +1 -0
  65. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +1 -1
  66. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerPC.js +1 -1
  67. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +1 -1
  68. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +1 -1
  69. package/dist/cjs/components/video-subtitle-player/useVideoSubtitleStore.js +1 -1
  70. package/dist/cjs/components/video-subtitle-player/useXGPlayer.js +1 -1
  71. package/dist/cjs/hooks/useStayTimeReport.js +1 -1
  72. package/dist/cjs/index.js +1 -1
  73. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -1
  74. package/dist/cjs/packages/subtitle/lib/index.js +1 -0
  75. package/dist/cjs/packages/subtitle/lib/src/json-converter.js +1 -1
  76. package/dist/cjs/packages/subtitle/lib/src/parser.js +5 -5
  77. package/dist/cjs/react-components.css +27 -27
  78. package/dist/es/components/blur-fade/BlurFade.js +37 -49
  79. package/dist/es/components/blur-text/BlurText.js +67 -76
  80. package/dist/es/components/button/Button.css +1 -1
  81. package/dist/es/components/button/Button2.js +48 -0
  82. package/dist/es/components/comic-text/ComicText2.js +55 -0
  83. package/dist/es/components/confetti-button/index.js +63 -75
  84. package/dist/es/components/dock/Duck.css +1 -1
  85. package/dist/es/components/dock/Duck2.js +60 -0
  86. package/dist/es/components/flip-text/FlipText.css +1 -1
  87. package/dist/es/components/flip-text/FlipText2.js +41 -0
  88. package/dist/es/components/gradient-text/index.css +1 -1
  89. package/dist/es/components/gradient-text/index2.js +29 -0
  90. package/dist/es/components/hyper-text/HyperText.css +1 -1
  91. package/dist/es/components/hyper-text/index.js +51 -79
  92. package/dist/es/components/image-compare/ImageCompare.css +1 -1
  93. package/dist/es/components/image-compare/ImageCompare2.js +96 -0
  94. package/dist/es/components/image-viewer/ImageThumbnails.css +1 -1
  95. package/dist/es/components/image-viewer/ImageThumbnails2.js +40 -0
  96. package/dist/es/components/image-viewer/ImageViewer.css +1 -1
  97. package/dist/es/components/image-viewer/ImageViewer.d.ts +1 -1
  98. package/dist/es/components/image-viewer/ImageViewer2.js +151 -0
  99. package/dist/es/components/message/Message.css +1 -1
  100. package/dist/es/components/message/Message2.js +189 -0
  101. package/dist/es/components/pinch-content/PinchContent.js +120 -127
  102. package/dist/es/components/pinch-content/index.js +5 -5
  103. package/dist/es/components/pointer/Pointer.css +1 -1
  104. package/dist/es/components/pointer/Pointer2.js +61 -0
  105. package/dist/es/components/react-force-graph-3d/index.js +2 -0
  106. package/dist/es/components/scratch-to-reveal/ScratchToReveal.css +1 -1
  107. package/dist/es/components/scratch-to-reveal/ScratchToReveal2.js +88 -0
  108. package/dist/es/components/shimmer-button/ShimmerButton.css +1 -1
  109. package/dist/es/components/shimmer-button/ShimmerButton2.js +33 -0
  110. package/dist/es/components/shiny-button/ShinyButton.css +1 -1
  111. package/dist/es/components/shiny-button/ShinyButton2.js +53 -0
  112. package/dist/es/components/shiny-text/ShinyText2.js +61 -0
  113. package/dist/es/components/sparkles-text/SparklesText.css +1 -1
  114. package/dist/es/components/sparkles-text/SparklesText2.js +90 -0
  115. package/dist/es/components/split-text/SplitText.css +1 -1
  116. package/dist/es/components/split-text/SplitText2.js +109 -0
  117. package/dist/es/components/subtitle-player/CurrentMode.css +1 -1
  118. package/dist/es/components/subtitle-player/CurrentMode2.js +44 -0
  119. package/dist/es/components/subtitle-player/LyricsMode.css +1 -1
  120. package/dist/es/components/subtitle-player/LyricsMode2.js +114 -0
  121. package/dist/es/components/subtitle-player/SubtitlePlayer.css +1 -1
  122. package/dist/es/components/subtitle-player/SubtitlePlayer2.js +169 -0
  123. package/dist/es/components/subtitle-player/utils.js +63 -69
  124. package/dist/es/components/text-animate/TextAnimate.css +1 -1
  125. package/dist/es/components/text-animate/TextAnimate2.js +312 -0
  126. package/dist/es/components/text-type/TextType.css +1 -1
  127. package/dist/es/components/text-type/TextType2.js +80 -0
  128. package/dist/es/components/txt-editor/TxtEditor.js +60 -95
  129. package/dist/es/components/txt-reader/TxtReader.js +45 -74
  130. package/dist/es/components/txt-reader/index.module.css +1 -1
  131. package/dist/es/components/txt-reader/index.module.js +10 -0
  132. package/dist/es/components/typing-animation/index.css +1 -1
  133. package/dist/es/components/typing-animation/index2.js +43 -0
  134. package/dist/es/components/variable-proximity/index.css +1 -1
  135. package/dist/es/components/variable-proximity/index2.js +179 -0
  136. package/dist/es/components/video-dialog/VideoDialog.css +1 -1
  137. package/dist/es/components/video-dialog/VideoDialog2.js +168 -0
  138. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
  139. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
  140. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
  141. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer2.js +43 -0
  142. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +29 -46
  143. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerPC.js +94 -74
  144. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +24 -21
  145. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +58 -50
  146. package/dist/es/components/video-subtitle-player/useVideoSubtitleStore.js +61 -56
  147. package/dist/es/components/video-subtitle-player/useXGPlayer.js +38 -35
  148. package/dist/es/hooks/useStayTimeReport.js +29 -29
  149. package/dist/es/index.js +33 -70
  150. package/dist/es/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -1
  151. package/dist/es/packages/subtitle/lib/index.js +2 -0
  152. package/dist/es/packages/subtitle/lib/src/json-converter.js +22 -23
  153. package/dist/es/packages/subtitle/lib/src/parser.js +41 -54
  154. package/dist/es/react-components.css +27 -27
  155. package/package.json +25 -27
  156. package/dist/cjs/components/button/Button.js +0 -1
  157. package/dist/cjs/components/comic-text/ComicText.js +0 -4
  158. package/dist/cjs/components/dock/Duck.js +0 -1
  159. package/dist/cjs/components/flip-text/FlipText.js +0 -1
  160. package/dist/cjs/components/gradient-text/index.js +0 -1
  161. package/dist/cjs/components/image-compare/ImageCompare.js +0 -1
  162. package/dist/cjs/components/image-viewer/ImageThumbnails.js +0 -1
  163. package/dist/cjs/components/image-viewer/ImageViewer.js +0 -1
  164. package/dist/cjs/components/message/Message.js +0 -1
  165. package/dist/cjs/components/pointer/Pointer.js +0 -1
  166. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +0 -1
  167. package/dist/cjs/components/shimmer-button/ShimmerButton.js +0 -1
  168. package/dist/cjs/components/shiny-button/ShinyButton.js +0 -1
  169. package/dist/cjs/components/shiny-text/ShinyText.js +0 -1
  170. package/dist/cjs/components/sparkles-text/SparklesText.js +0 -1
  171. package/dist/cjs/components/split-text/SplitText.js +0 -1
  172. package/dist/cjs/components/subtitle-player/CurrentMode.js +0 -2
  173. package/dist/cjs/components/subtitle-player/LyricsMode.js +0 -2
  174. package/dist/cjs/components/subtitle-player/SubtitlePlayer.js +0 -1
  175. package/dist/cjs/components/text-animate/TextAnimate.js +0 -2
  176. package/dist/cjs/components/text-type/TextType.js +0 -1
  177. package/dist/cjs/components/txt-reader/index.module.css.js +0 -1
  178. package/dist/cjs/components/typing-animation/index.js +0 -1
  179. package/dist/cjs/components/variable-proximity/index.js +0 -1
  180. package/dist/cjs/components/video-dialog/VideoDialog.js +0 -1
  181. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -1
  182. package/dist/es/components/button/Button.js +0 -72
  183. package/dist/es/components/comic-text/ComicText.js +0 -52
  184. package/dist/es/components/dock/Duck.js +0 -80
  185. package/dist/es/components/flip-text/FlipText.js +0 -38
  186. package/dist/es/components/gradient-text/index.js +0 -22
  187. package/dist/es/components/image-compare/ImageCompare.js +0 -127
  188. package/dist/es/components/image-viewer/ImageThumbnails.js +0 -73
  189. package/dist/es/components/image-viewer/ImageViewer.js +0 -141
  190. package/dist/es/components/message/Message.js +0 -220
  191. package/dist/es/components/pointer/Pointer.js +0 -75
  192. package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +0 -97
  193. package/dist/es/components/shimmer-button/ShimmerButton.js +0 -42
  194. package/dist/es/components/shiny-button/ShinyButton.js +0 -61
  195. package/dist/es/components/shiny-text/ShinyText.js +0 -76
  196. package/dist/es/components/sparkles-text/SparklesText.js +0 -71
  197. package/dist/es/components/split-text/SplitText.js +0 -116
  198. package/dist/es/components/subtitle-player/CurrentMode.js +0 -78
  199. package/dist/es/components/subtitle-player/LyricsMode.js +0 -152
  200. package/dist/es/components/subtitle-player/SubtitlePlayer.js +0 -234
  201. package/dist/es/components/text-animate/TextAnimate.js +0 -310
  202. package/dist/es/components/text-type/TextType.js +0 -121
  203. package/dist/es/components/txt-reader/index.module.css.js +0 -10
  204. package/dist/es/components/typing-animation/index.js +0 -56
  205. package/dist/es/components/variable-proximity/index.js +0 -211
  206. package/dist/es/components/video-dialog/VideoDialog.js +0 -113
  207. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -74
@@ -1,75 +1,95 @@
1
- import { jsx as i, jsxs as l } from "react/jsx-runtime";
2
- import { useCallback as y } from "react";
3
- import b from "clsx";
4
- import { SubtitlePlayer as h } from "../subtitle-player/SubtitlePlayer.js";
5
- import { VideoSubtitlePlayerLayoutPC as g } from "./layouts/VideoSubtitlePlayerLayoutPC.js";
6
- const C = ({
7
- playerRef: t,
8
- subtitles: s,
9
- currentTime: n,
10
- currentDetail: e,
11
- isLoadingDetail: p,
12
- onWordHoverChange: d,
13
- className: o = "",
14
- style: r
15
- }) => {
16
- const c = y(
17
- async (a) => {
18
- await d(a);
19
- },
20
- [d]
21
- ), v = /* @__PURE__ */ i("div", { ref: t, className: "xiping-video-subtitle-player__video" }), m = /* @__PURE__ */ i(
22
- h,
23
- {
24
- subtitles: s,
25
- currentTime: n,
26
- mode: "lyrics",
27
- onWordHoverChange: c
28
- }
29
- ), _ = /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail", children: p ? /* @__PURE__ */ l("div", { className: "xiping-video-subtitle-player__detail-loading", children: [
30
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-loading-spinner" }),
31
- /* @__PURE__ */ i("span", { children: "加载中..." })
32
- ] }) : e ? /* @__PURE__ */ l("div", { className: "xiping-video-subtitle-player__detail-content", children: [
33
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-word", children: e.word }),
34
- e.pronunciation && /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-pronunciation", children: e.pronunciation }),
35
- e.partOfSpeech && /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-pos", children: e.partOfSpeech }),
36
- e.translation && /* @__PURE__ */ l("div", { className: "xiping-video-subtitle-player__detail-translation", children: [
37
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-label", children: "中文翻译" }),
38
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-text", children: e.translation })
39
- ] }),
40
- e.definition && /* @__PURE__ */ l("div", { className: "xiping-video-subtitle-player__detail-definition", children: [
41
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-label", children: "英文解释" }),
42
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-text", children: e.definition })
43
- ] }),
44
- e.examples && e.examples.length > 0 && /* @__PURE__ */ l("div", { className: "xiping-video-subtitle-player__detail-examples", children: [
45
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-label", children: "例句" }),
46
- e.examples.map((a, x) => /* @__PURE__ */ l(
47
- "div",
48
- {
49
- className: "xiping-video-subtitle-player__detail-example",
50
- children: [
51
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-example-en", children: a.sentence }),
52
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-example-zh", children: a.translation })
53
- ]
54
- },
55
- x
56
- ))
57
- ] })
58
- ] }) : /* @__PURE__ */ l("div", { className: "xiping-video-subtitle-player__detail-empty", children: [
59
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-empty-icon", children: "📖" }),
60
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__detail-empty-text", children: "将鼠标悬停在字幕单词上查看详情" })
61
- ] }) });
62
- return /* @__PURE__ */ i(
63
- g,
64
- {
65
- className: b(o),
66
- style: r,
67
- videoSlot: v,
68
- subtitleSlot: m,
69
- detailSlot: _
70
- }
71
- );
72
- };
73
- export {
74
- C as VideoSubtitlePlayerPC
1
+ import e from "../subtitle-player/SubtitlePlayer2.js";
2
+ import { VideoSubtitlePlayerLayoutPC as t } from "./layouts/VideoSubtitlePlayerLayoutPC.js";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ import { useCallback as i } from "react";
5
+ import a from "clsx";
6
+ //#region src/components/video-subtitle-player/VideoSubtitlePlayerPC.tsx
7
+ var o = ({ playerRef: o, subtitles: s, currentTime: c, currentDetail: l, isLoadingDetail: u, onWordHoverChange: d, className: f = "", style: p }) => {
8
+ let m = i(async (e) => {
9
+ await d(e);
10
+ }, [d]), h = /* @__PURE__ */ n("div", {
11
+ ref: o,
12
+ className: "xiping-video-subtitle-player__video"
13
+ }), g = /* @__PURE__ */ n(e, {
14
+ subtitles: s,
15
+ currentTime: c,
16
+ mode: "lyrics",
17
+ onWordHoverChange: m
18
+ }), _ = /* @__PURE__ */ n("div", {
19
+ className: "xiping-video-subtitle-player__detail",
20
+ children: u ? /* @__PURE__ */ r("div", {
21
+ className: "xiping-video-subtitle-player__detail-loading",
22
+ children: [/* @__PURE__ */ n("div", { className: "xiping-video-subtitle-player__detail-loading-spinner" }), /* @__PURE__ */ n("span", { children: "加载中..." })]
23
+ }) : l ? /* @__PURE__ */ r("div", {
24
+ className: "xiping-video-subtitle-player__detail-content",
25
+ children: [
26
+ /* @__PURE__ */ n("div", {
27
+ className: "xiping-video-subtitle-player__detail-word",
28
+ children: l.word
29
+ }),
30
+ l.pronunciation && /* @__PURE__ */ n("div", {
31
+ className: "xiping-video-subtitle-player__detail-pronunciation",
32
+ children: l.pronunciation
33
+ }),
34
+ l.partOfSpeech && /* @__PURE__ */ n("div", {
35
+ className: "xiping-video-subtitle-player__detail-pos",
36
+ children: l.partOfSpeech
37
+ }),
38
+ l.translation && /* @__PURE__ */ r("div", {
39
+ className: "xiping-video-subtitle-player__detail-translation",
40
+ children: [/* @__PURE__ */ n("div", {
41
+ className: "xiping-video-subtitle-player__detail-label",
42
+ children: "中文翻译"
43
+ }), /* @__PURE__ */ n("div", {
44
+ className: "xiping-video-subtitle-player__detail-text",
45
+ children: l.translation
46
+ })]
47
+ }),
48
+ l.definition && /* @__PURE__ */ r("div", {
49
+ className: "xiping-video-subtitle-player__detail-definition",
50
+ children: [/* @__PURE__ */ n("div", {
51
+ className: "xiping-video-subtitle-player__detail-label",
52
+ children: "英文解释"
53
+ }), /* @__PURE__ */ n("div", {
54
+ className: "xiping-video-subtitle-player__detail-text",
55
+ children: l.definition
56
+ })]
57
+ }),
58
+ l.examples && l.examples.length > 0 && /* @__PURE__ */ r("div", {
59
+ className: "xiping-video-subtitle-player__detail-examples",
60
+ children: [/* @__PURE__ */ n("div", {
61
+ className: "xiping-video-subtitle-player__detail-label",
62
+ children: "例句"
63
+ }), l.examples.map((e, t) => /* @__PURE__ */ r("div", {
64
+ className: "xiping-video-subtitle-player__detail-example",
65
+ children: [/* @__PURE__ */ n("div", {
66
+ className: "xiping-video-subtitle-player__detail-example-en",
67
+ children: e.sentence
68
+ }), /* @__PURE__ */ n("div", {
69
+ className: "xiping-video-subtitle-player__detail-example-zh",
70
+ children: e.translation
71
+ })]
72
+ }, t))]
73
+ })
74
+ ]
75
+ }) : /* @__PURE__ */ r("div", {
76
+ className: "xiping-video-subtitle-player__detail-empty",
77
+ children: [/* @__PURE__ */ n("div", {
78
+ className: "xiping-video-subtitle-player__detail-empty-icon",
79
+ children: "📖"
80
+ }), /* @__PURE__ */ n("div", {
81
+ className: "xiping-video-subtitle-player__detail-empty-text",
82
+ children: "将鼠标悬停在字幕单词上查看详情"
83
+ })]
84
+ })
85
+ });
86
+ return /* @__PURE__ */ n(t, {
87
+ className: a(f),
88
+ style: p,
89
+ videoSlot: h,
90
+ subtitleSlot: g,
91
+ detailSlot: _
92
+ });
75
93
  };
94
+ //#endregion
95
+ export { o as VideoSubtitlePlayerPC };
@@ -1,21 +1,24 @@
1
- import { jsxs as r, jsx as i } from "react/jsx-runtime";
2
- import s from "clsx";
3
- import '../VideoSubtitlePlayer.mobile.css';/* empty css */
4
- const m = ({ className: e = "", style: l, videoSlot: o, subtitleSlot: t }) => /* @__PURE__ */ r(
5
- "div",
6
- {
7
- className: s(
8
- "xiping-video-subtitle-player",
9
- "xiping-video-subtitle-player--mobile",
10
- e
11
- ),
12
- style: l,
13
- children: [
14
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__mobile-video", children: /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__mobile-video-wrapper", children: /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__mobile-video-container", children: o }) }) }),
15
- /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__mobile-subtitle", children: t })
16
- ]
17
- }
18
- );
19
- export {
20
- m as VideoSubtitlePlayerLayoutMobile
21
- };
1
+ import '../VideoSubtitlePlayer.mobile.css';/* empty css */
2
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
+ import "react";
4
+ import n from "clsx";
5
+ //#region src/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.tsx
6
+ var r = ({ className: r = "", style: i, videoSlot: a, subtitleSlot: o }) => /* @__PURE__ */ t("div", {
7
+ className: n("xiping-video-subtitle-player", "xiping-video-subtitle-player--mobile", r),
8
+ style: i,
9
+ children: [/* @__PURE__ */ e("div", {
10
+ className: "xiping-video-subtitle-player__mobile-video",
11
+ children: /* @__PURE__ */ e("div", {
12
+ className: "xiping-video-subtitle-player__mobile-video-wrapper",
13
+ children: /* @__PURE__ */ e("div", {
14
+ className: "xiping-video-subtitle-player__mobile-video-container",
15
+ children: a
16
+ })
17
+ })
18
+ }), /* @__PURE__ */ e("div", {
19
+ className: "xiping-video-subtitle-player__mobile-subtitle",
20
+ children: o
21
+ })]
22
+ });
23
+ //#endregion
24
+ export { r as VideoSubtitlePlayerLayoutMobile };
@@ -1,50 +1,58 @@
1
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
2
- import { Group as r, Panel as e, Separator as t } from "react-resizable-panels";
3
- import l from "clsx";
4
- import '../VideoSubtitlePlayer.pc.css';/* empty css */
5
- const _ = ({ className: n = "", style: s, videoSlot: d, subtitleSlot: o, detailSlot: p }) => /* @__PURE__ */ i(
6
- "div",
7
- {
8
- className: l(
9
- "xiping-video-subtitle-player",
10
- "xiping-video-subtitle-player--pc",
11
- n
12
- ),
13
- style: s,
14
- children: /* @__PURE__ */ a(
15
- r,
16
- {
17
- orientation: "horizontal",
18
- className: "xiping-video-subtitle-player__panel-group",
19
- children: [
20
- /* @__PURE__ */ i(e, { defaultSize: "65", minSize: "40", children: /* @__PURE__ */ a(r, { orientation: "vertical", className: "xiping-video-subtitle-player__panel-group-inner", children: [
21
- /* @__PURE__ */ i(e, { defaultSize: "60", minSize: "30", children: /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__video-wrapper", children: /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__video-container", children: d }) }) }),
22
- /* @__PURE__ */ i(
23
- t,
24
- {
25
- className: l(
26
- "xiping-video-subtitle-player__resize-handle",
27
- "xiping-video-subtitle-player__resize-handle--vertical"
28
- )
29
- }
30
- ),
31
- /* @__PURE__ */ i(e, { defaultSize: "40", minSize: "20", children: /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__subtitle-container", children: o }) })
32
- ] }) }),
33
- /* @__PURE__ */ i(
34
- t,
35
- {
36
- className: l(
37
- "xiping-video-subtitle-player__resize-handle",
38
- "xiping-video-subtitle-player__resize-handle--horizontal"
39
- )
40
- }
41
- ),
42
- /* @__PURE__ */ i(e, { defaultSize: "35", minSize: "25", maxSize: "50", children: /* @__PURE__ */ i("div", { className: "xiping-video-subtitle-player__right", children: p }) })
43
- ]
44
- }
45
- )
46
- }
47
- );
48
- export {
49
- _ as VideoSubtitlePlayerLayoutPC
50
- };
1
+ import '../VideoSubtitlePlayer.pc.css';/* empty css */
2
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
+ import "react";
4
+ import n from "clsx";
5
+ import { Group as r, Panel as i, Separator as a } from "react-resizable-panels";
6
+ //#region src/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.tsx
7
+ var o = ({ className: o = "", style: s, videoSlot: c, subtitleSlot: l, detailSlot: u }) => /* @__PURE__ */ e("div", {
8
+ className: n("xiping-video-subtitle-player", "xiping-video-subtitle-player--pc", o),
9
+ style: s,
10
+ children: /* @__PURE__ */ t(r, {
11
+ orientation: "horizontal",
12
+ className: "xiping-video-subtitle-player__panel-group",
13
+ children: [
14
+ /* @__PURE__ */ e(i, {
15
+ defaultSize: "65",
16
+ minSize: "40",
17
+ children: /* @__PURE__ */ t(r, {
18
+ orientation: "vertical",
19
+ className: "xiping-video-subtitle-player__panel-group-inner",
20
+ children: [
21
+ /* @__PURE__ */ e(i, {
22
+ defaultSize: "60",
23
+ minSize: "30",
24
+ children: /* @__PURE__ */ e("div", {
25
+ className: "xiping-video-subtitle-player__video-wrapper",
26
+ children: /* @__PURE__ */ e("div", {
27
+ className: "xiping-video-subtitle-player__video-container",
28
+ children: c
29
+ })
30
+ })
31
+ }),
32
+ /* @__PURE__ */ e(a, { className: n("xiping-video-subtitle-player__resize-handle", "xiping-video-subtitle-player__resize-handle--vertical") }),
33
+ /* @__PURE__ */ e(i, {
34
+ defaultSize: "40",
35
+ minSize: "20",
36
+ children: /* @__PURE__ */ e("div", {
37
+ className: "xiping-video-subtitle-player__subtitle-container",
38
+ children: l
39
+ })
40
+ })
41
+ ]
42
+ })
43
+ }),
44
+ /* @__PURE__ */ e(a, { className: n("xiping-video-subtitle-player__resize-handle", "xiping-video-subtitle-player__resize-handle--horizontal") }),
45
+ /* @__PURE__ */ e(i, {
46
+ defaultSize: "35",
47
+ minSize: "25",
48
+ maxSize: "50",
49
+ children: /* @__PURE__ */ e("div", {
50
+ className: "xiping-video-subtitle-player__right",
51
+ children: u
52
+ })
53
+ })
54
+ ]
55
+ })
56
+ });
57
+ //#endregion
58
+ export { o as VideoSubtitlePlayerLayoutPC };
@@ -1,57 +1,62 @@
1
- import { create as r } from "zustand";
2
- const t = {
3
- currentTime: 0,
4
- isPlaying: !1,
5
- subtitles: [],
6
- currentDetail: null,
7
- isLoadingDetail: !1
8
- }, s = r((i, o) => ({
9
- ...t,
10
- setCurrentTime: (e) => {
11
- i({ currentTime: e });
12
- },
13
- setIsPlaying: (e) => {
14
- i({ isPlaying: e });
15
- },
16
- setSubtitles: (e) => {
17
- i({ subtitles: e });
18
- },
19
- setCurrentDetail: (e) => {
20
- i({ currentDetail: e });
21
- },
22
- setIsLoadingDetail: (e) => {
23
- i({ isLoadingDetail: e });
24
- },
25
- fetchDetail: async (e) => {
26
- if (!e) {
27
- i({ currentDetail: null, isLoadingDetail: !1 });
28
- return;
29
- }
30
- i({ isLoadingDetail: !0 });
31
- try {
32
- await new Promise((a) => setTimeout(a, 300));
33
- const n = {
34
- word: e.word,
35
- pronunciation: `/${e.word.toLowerCase()}/`,
36
- translation: `${e.word}的中文翻译`,
37
- definition: `Definition of ${e.word}`,
38
- examples: [
39
- {
40
- sentence: `This is an example sentence with ${e.word}.`,
41
- translation: `这是一个包含${e.word}的例句。`
42
- }
43
- ],
44
- partOfSpeech: "noun"
45
- };
46
- i({ currentDetail: n, isLoadingDetail: !1 });
47
- } catch (n) {
48
- console.error("获取详情失败:", n), i({ currentDetail: null, isLoadingDetail: !1 });
49
- }
50
- },
51
- reset: () => {
52
- i(t);
53
- }
1
+ import { create as e } from "zustand";
2
+ //#region src/components/video-subtitle-player/useVideoSubtitleStore.ts
3
+ var t = {
4
+ currentTime: 0,
5
+ isPlaying: !1,
6
+ subtitles: [],
7
+ currentDetail: null,
8
+ isLoadingDetail: !1
9
+ }, n = e((e, n) => ({
10
+ ...t,
11
+ setCurrentTime: (t) => {
12
+ e({ currentTime: t });
13
+ },
14
+ setIsPlaying: (t) => {
15
+ e({ isPlaying: t });
16
+ },
17
+ setSubtitles: (t) => {
18
+ e({ subtitles: t });
19
+ },
20
+ setCurrentDetail: (t) => {
21
+ e({ currentDetail: t });
22
+ },
23
+ setIsLoadingDetail: (t) => {
24
+ e({ isLoadingDetail: t });
25
+ },
26
+ fetchDetail: async (t) => {
27
+ if (!t) {
28
+ e({
29
+ currentDetail: null,
30
+ isLoadingDetail: !1
31
+ });
32
+ return;
33
+ }
34
+ e({ isLoadingDetail: !0 });
35
+ try {
36
+ await new Promise((e) => setTimeout(e, 300)), e({
37
+ currentDetail: {
38
+ word: t.word,
39
+ pronunciation: `/${t.word.toLowerCase()}/`,
40
+ translation: `${t.word}的中文翻译`,
41
+ definition: `Definition of ${t.word}`,
42
+ examples: [{
43
+ sentence: `This is an example sentence with ${t.word}.`,
44
+ translation: `这是一个包含${t.word}的例句。`
45
+ }],
46
+ partOfSpeech: "noun"
47
+ },
48
+ isLoadingDetail: !1
49
+ });
50
+ } catch (t) {
51
+ console.error("获取详情失败:", t), e({
52
+ currentDetail: null,
53
+ isLoadingDetail: !1
54
+ });
55
+ }
56
+ },
57
+ reset: () => {
58
+ e(t);
59
+ }
54
60
  }));
55
- export {
56
- s as useVideoSubtitleStore
57
- };
61
+ //#endregion
62
+ export { n as useVideoSubtitleStore };
@@ -1,36 +1,39 @@
1
- import { useRef as h, useEffect as p } from "react";
2
- import P from "xgplayer";
3
- import '../../node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css';/* empty css */
4
- function T(o, s, u, y, r) {
5
- const a = h(null), { setCurrentTime: l, setIsPlaying: n } = y;
6
- p(() => {
7
- if (!o.current) return;
8
- const t = `xiping-video-subtitle-player-${Date.now()}`;
9
- o.current.id = t;
10
- const e = new P({
11
- id: t,
12
- url: s,
13
- poster: u,
14
- autoplay: !1,
15
- fluid: !1,
16
- width: "100%",
17
- height: "100%",
18
- controls: !0
19
- });
20
- a.current = e;
21
- const f = () => {
22
- const m = e.currentTime ?? 0;
23
- l(m);
24
- }, i = () => n(!0), c = () => n(!1), d = () => n(!1);
25
- return e.on("timeupdate", f), e.on("play", i), e.on("pause", c), e.on("ended", d), () => {
26
- e.off("timeupdate", f), e.off("play", i), e.off("pause", c), e.off("ended", d), e.destroy(), a.current = null;
27
- };
28
- }, [s, u, l, n]), p(() => {
29
- const t = a.current;
30
- if (!t) return;
31
- Math.abs(t.currentTime - r) > 0.5 && (t.currentTime = r);
32
- }, [r]);
1
+ import '../../node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css';/* empty css */
2
+ import { useEffect as e, useRef as t } from "react";
3
+ import n from "xgplayer";
4
+ //#region src/components/video-subtitle-player/useXGPlayer.ts
5
+ function r(r, i, a, o, s) {
6
+ let c = t(null), { setCurrentTime: l, setIsPlaying: u } = o;
7
+ e(() => {
8
+ if (!r.current) return;
9
+ let e = `xiping-video-subtitle-player-${Date.now()}`;
10
+ r.current.id = e;
11
+ let t = new n({
12
+ id: e,
13
+ url: i,
14
+ poster: a,
15
+ autoplay: !1,
16
+ fluid: !1,
17
+ width: "100%",
18
+ height: "100%",
19
+ controls: !0
20
+ });
21
+ c.current = t;
22
+ let o = () => {
23
+ l(t.currentTime ?? 0);
24
+ }, s = () => u(!0), d = () => u(!1), f = () => u(!1);
25
+ return t.on("timeupdate", o), t.on("play", s), t.on("pause", d), t.on("ended", f), () => {
26
+ t.off("timeupdate", o), t.off("play", s), t.off("pause", d), t.off("ended", f), t.destroy(), c.current = null;
27
+ };
28
+ }, [
29
+ i,
30
+ a,
31
+ l,
32
+ u
33
+ ]), e(() => {
34
+ let e = c.current;
35
+ e && Math.abs(e.currentTime - s) > .5 && (e.currentTime = s);
36
+ }, [s]);
33
37
  }
34
- export {
35
- T as useXGPlayer
36
- };
38
+ //#endregion
39
+ export { r as useXGPlayer };
@@ -1,31 +1,31 @@
1
- import { useRef as s, useEffect as u } from "react";
2
- import d from "bowser";
3
- function f() {
4
- const t = d.getParser(window.navigator.userAgent), e = t.getBrowser(), n = t.getOS();
5
- return `${e.name} ${e.version} (${n.name} ${n.version})`;
1
+ import { useEffect as e, useRef as t } from "react";
2
+ import n from "bowser";
3
+ //#region src/hooks/useStayTimeReport.ts
4
+ function r() {
5
+ let e = n.getParser(window.navigator.userAgent), t = e.getBrowser(), r = e.getOS();
6
+ return `${t.name} ${t.version} (${r.name} ${r.version})`;
6
7
  }
7
- function v(t) {
8
- const e = s(Date.now()), n = s(!1);
9
- u(() => {
10
- e.current = Date.now(), n.current = !1;
11
- const r = () => {
12
- if (n.current) return;
13
- n.current = !0;
14
- const i = Date.now(), a = i - e.current, c = f();
15
- t({
16
- enterTime: e.current,
17
- leaveTime: i,
18
- duration: a,
19
- browser: c
20
- });
21
- }, o = () => {
22
- document.visibilityState === "hidden" && r();
23
- };
24
- return window.addEventListener("beforeunload", r), document.addEventListener("visibilitychange", o), () => {
25
- r(), window.removeEventListener("beforeunload", r), document.removeEventListener("visibilitychange", o);
26
- };
27
- }, []);
8
+ function i(n) {
9
+ let i = t(Date.now()), a = t(!1);
10
+ e(() => {
11
+ i.current = Date.now(), a.current = !1;
12
+ let e = () => {
13
+ if (a.current) return;
14
+ a.current = !0;
15
+ let e = Date.now(), t = e - i.current, o = r();
16
+ n({
17
+ enterTime: i.current,
18
+ leaveTime: e,
19
+ duration: t,
20
+ browser: o
21
+ });
22
+ }, t = () => {
23
+ document.visibilityState === "hidden" && e();
24
+ };
25
+ return window.addEventListener("beforeunload", e), document.addEventListener("visibilitychange", t), () => {
26
+ e(), window.removeEventListener("beforeunload", e), document.removeEventListener("visibilitychange", t);
27
+ };
28
+ }, []);
28
29
  }
29
- export {
30
- v as useStayTimeReport
31
- };
30
+ //#endregion
31
+ export { i as useStayTimeReport };