@xiping/react-components 1.0.55 → 1.0.58

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 (177) hide show
  1. package/dist/cjs/components/blur-text/BlurText.d.ts +16 -0
  2. package/dist/cjs/components/blur-text/BlurText.js +1 -0
  3. package/dist/cjs/components/blur-text/index.d.ts +2 -0
  4. package/dist/cjs/components/button/Button.css +1 -0
  5. package/dist/cjs/components/button/Button.js +1 -1
  6. package/dist/cjs/components/comic-text/ComicText.css +1 -0
  7. package/dist/cjs/components/comic-text/ComicText.js +2 -2
  8. package/dist/cjs/components/dock/Duck.css +1 -0
  9. package/dist/cjs/components/dock/Duck.d.ts +2 -4
  10. package/dist/cjs/components/dock/Duck.js +1 -1
  11. package/dist/cjs/components/flip-text/FlipText.css +1 -0
  12. package/dist/cjs/components/flip-text/FlipText.js +1 -1
  13. package/dist/cjs/components/gradient-text/index.css +1 -0
  14. package/dist/cjs/components/gradient-text/index.js +1 -1
  15. package/dist/cjs/components/hyper-text/HyperText.css +1 -0
  16. package/dist/cjs/components/hyper-text/index.js +1 -1
  17. package/dist/cjs/components/image-compare/ImageCompare.css +1 -0
  18. package/dist/cjs/components/image-compare/ImageCompare.d.ts +4 -2
  19. package/dist/cjs/components/image-compare/ImageCompare.js +1 -1
  20. package/dist/cjs/components/image-viewer/ImageThumbnails.css +1 -0
  21. package/dist/cjs/components/image-viewer/ImageThumbnails.js +1 -1
  22. package/dist/cjs/components/image-viewer/ImageViewer.css +1 -0
  23. package/dist/cjs/components/image-viewer/ImageViewer.js +1 -1
  24. package/dist/cjs/components/message/Message.css +1 -0
  25. package/dist/cjs/components/message/Message.js +1 -1
  26. package/dist/cjs/components/pointer/Pointer.css +1 -0
  27. package/dist/cjs/components/pointer/Pointer.js +1 -1
  28. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.css +1 -0
  29. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +1 -1
  30. package/dist/cjs/components/shimmer-button/ShimmerButton.css +1 -0
  31. package/dist/cjs/components/shimmer-button/ShimmerButton.js +1 -1
  32. package/dist/cjs/components/shiny-button/ShinyButton.css +1 -0
  33. package/dist/cjs/components/shiny-button/ShinyButton.js +1 -1
  34. package/dist/cjs/components/shiny-text/ShinyText.css +1 -0
  35. package/dist/cjs/components/shiny-text/ShinyText.d.ts +16 -0
  36. package/dist/cjs/components/shiny-text/ShinyText.js +1 -0
  37. package/dist/cjs/components/shiny-text/index.d.ts +2 -0
  38. package/dist/cjs/components/sparkles-text/SparklesText.css +1 -0
  39. package/dist/cjs/components/sparkles-text/SparklesText.js +1 -1
  40. package/dist/cjs/components/split-text/SplitText.css +1 -0
  41. package/dist/cjs/components/split-text/SplitText.js +1 -1
  42. package/dist/cjs/components/subtitle-player/CurrentMode.css +1 -0
  43. package/dist/cjs/components/subtitle-player/CurrentMode.d.ts +2 -0
  44. package/dist/cjs/components/subtitle-player/CurrentMode.js +2 -2
  45. package/dist/cjs/components/subtitle-player/LyricsMode.css +1 -0
  46. package/dist/cjs/components/subtitle-player/LyricsMode.d.ts +2 -0
  47. package/dist/cjs/components/subtitle-player/LyricsMode.js +2 -2
  48. package/dist/cjs/components/subtitle-player/SubtitlePlayer.css +1 -0
  49. package/dist/cjs/components/subtitle-player/SubtitlePlayer.d.ts +2 -0
  50. package/dist/cjs/components/subtitle-player/SubtitlePlayer.js +1 -1
  51. package/dist/cjs/components/text-animate/TextAnimate.css +1 -0
  52. package/dist/cjs/components/text-animate/TextAnimate.js +2 -2
  53. package/dist/cjs/components/text-type/TextType.css +1 -0
  54. package/dist/cjs/components/text-type/TextType.js +1 -1
  55. package/dist/cjs/components/txt-reader/index.module.css +1 -0
  56. package/dist/cjs/components/txt-reader/index.module.css.js +1 -1
  57. package/dist/cjs/components/typing-animation/index.css +1 -0
  58. package/dist/cjs/components/typing-animation/index.js +1 -1
  59. package/dist/cjs/components/variable-proximity/index.css +1 -0
  60. package/dist/cjs/components/variable-proximity/index.js +1 -1
  61. package/dist/cjs/components/video-dialog/VideoDialog.css +1 -0
  62. package/dist/cjs/components/video-dialog/VideoDialog.js +1 -1
  63. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -0
  64. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.d.ts +3 -3
  65. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.js +1 -1
  66. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -0
  67. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -0
  68. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerMobile.d.ts +20 -0
  69. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +1 -0
  70. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerPC.d.ts +23 -0
  71. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerPC.js +1 -0
  72. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.d.ts +8 -0
  73. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +1 -0
  74. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.d.ts +6 -0
  75. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +1 -0
  76. package/dist/cjs/components/video-subtitle-player/layouts/index.d.ts +3 -0
  77. package/dist/cjs/components/video-subtitle-player/layouts/types.d.ts +17 -0
  78. package/dist/cjs/components/video-subtitle-player/useXGPlayer.d.ts +10 -0
  79. package/dist/cjs/components/video-subtitle-player/useXGPlayer.js +1 -0
  80. package/dist/cjs/index.d.ts +2 -1
  81. package/dist/cjs/index.js +1 -1
  82. package/dist/cjs/llms.txt +2 -13
  83. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -0
  84. package/dist/cjs/react-components.css +114 -1
  85. package/dist/es/components/blur-text/BlurText.d.ts +16 -0
  86. package/dist/es/components/blur-text/BlurText.js +77 -0
  87. package/dist/es/components/blur-text/index.d.ts +2 -0
  88. package/dist/es/components/button/Button.css +1 -0
  89. package/dist/es/components/button/Button.js +35 -46
  90. package/dist/es/components/comic-text/ComicText.css +1 -0
  91. package/dist/es/components/comic-text/ComicText.js +13 -12
  92. package/dist/es/components/dock/Duck.css +1 -0
  93. package/dist/es/components/dock/Duck.d.ts +2 -4
  94. package/dist/es/components/dock/Duck.js +60 -64
  95. package/dist/es/components/flip-text/FlipText.css +1 -0
  96. package/dist/es/components/flip-text/FlipText.js +8 -8
  97. package/dist/es/components/gradient-text/index.css +1 -0
  98. package/dist/es/components/gradient-text/index.js +9 -8
  99. package/dist/es/components/hyper-text/HyperText.css +1 -0
  100. package/dist/es/components/hyper-text/index.js +16 -13
  101. package/dist/es/components/image-compare/ImageCompare.css +1 -0
  102. package/dist/es/components/image-compare/ImageCompare.d.ts +4 -2
  103. package/dist/es/components/image-compare/ImageCompare.js +55 -48
  104. package/dist/es/components/image-viewer/ImageThumbnails.css +1 -0
  105. package/dist/es/components/image-viewer/ImageThumbnails.js +41 -42
  106. package/dist/es/components/image-viewer/ImageViewer.css +1 -0
  107. package/dist/es/components/image-viewer/ImageViewer.js +34 -35
  108. package/dist/es/components/message/Message.css +1 -0
  109. package/dist/es/components/message/Message.js +65 -54
  110. package/dist/es/components/pointer/Pointer.css +1 -0
  111. package/dist/es/components/pointer/Pointer.js +23 -25
  112. package/dist/es/components/scratch-to-reveal/ScratchToReveal.css +1 -0
  113. package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +17 -16
  114. package/dist/es/components/shimmer-button/ShimmerButton.css +1 -0
  115. package/dist/es/components/shimmer-button/ShimmerButton.js +8 -8
  116. package/dist/es/components/shiny-button/ShinyButton.css +1 -0
  117. package/dist/es/components/shiny-button/ShinyButton.js +13 -13
  118. package/dist/es/components/shiny-text/ShinyText.css +1 -0
  119. package/dist/es/components/shiny-text/ShinyText.d.ts +16 -0
  120. package/dist/es/components/shiny-text/ShinyText.js +76 -0
  121. package/dist/es/components/shiny-text/index.d.ts +2 -0
  122. package/dist/es/components/sparkles-text/SparklesText.css +1 -0
  123. package/dist/es/components/sparkles-text/SparklesText.js +14 -14
  124. package/dist/es/components/split-text/SplitText.css +1 -0
  125. package/dist/es/components/split-text/SplitText.js +1 -1
  126. package/dist/es/components/subtitle-player/CurrentMode.css +1 -0
  127. package/dist/es/components/subtitle-player/CurrentMode.d.ts +2 -0
  128. package/dist/es/components/subtitle-player/CurrentMode.js +75 -40
  129. package/dist/es/components/subtitle-player/LyricsMode.css +1 -0
  130. package/dist/es/components/subtitle-player/LyricsMode.d.ts +2 -0
  131. package/dist/es/components/subtitle-player/LyricsMode.js +139 -68
  132. package/dist/es/components/subtitle-player/SubtitlePlayer.css +1 -0
  133. package/dist/es/components/subtitle-player/SubtitlePlayer.d.ts +2 -0
  134. package/dist/es/components/subtitle-player/SubtitlePlayer.js +63 -60
  135. package/dist/es/components/text-animate/TextAnimate.css +1 -0
  136. package/dist/es/components/text-animate/TextAnimate.js +57 -55
  137. package/dist/es/components/text-type/TextType.css +1 -0
  138. package/dist/es/components/text-type/TextType.js +24 -19
  139. package/dist/es/components/txt-reader/index.module.css +1 -0
  140. package/dist/es/components/txt-reader/index.module.css.js +1 -1
  141. package/dist/es/components/typing-animation/index.css +1 -0
  142. package/dist/es/components/typing-animation/index.js +12 -12
  143. package/dist/es/components/variable-proximity/index.css +1 -0
  144. package/dist/es/components/variable-proximity/index.js +19 -18
  145. package/dist/es/components/video-dialog/VideoDialog.css +1 -0
  146. package/dist/es/components/video-dialog/VideoDialog.js +1 -1
  147. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -0
  148. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.d.ts +3 -3
  149. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +69 -122
  150. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -0
  151. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -0
  152. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerMobile.d.ts +20 -0
  153. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +47 -0
  154. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerPC.d.ts +23 -0
  155. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerPC.js +75 -0
  156. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.d.ts +8 -0
  157. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +21 -0
  158. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.d.ts +6 -0
  159. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +50 -0
  160. package/dist/es/components/video-subtitle-player/layouts/index.d.ts +3 -0
  161. package/dist/es/components/video-subtitle-player/layouts/types.d.ts +17 -0
  162. package/dist/es/components/video-subtitle-player/useXGPlayer.d.ts +10 -0
  163. package/dist/es/components/video-subtitle-player/useXGPlayer.js +36 -0
  164. package/dist/es/index.d.ts +2 -1
  165. package/dist/es/index.js +59 -60
  166. package/dist/es/llms.txt +2 -13
  167. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -0
  168. package/dist/es/react-components.css +114 -1
  169. package/package.json +20 -15
  170. package/dist/cjs/components/animated-list/AnimatedList.d.ts +0 -9
  171. package/dist/cjs/components/animated-list/AnimatedList.js +0 -1
  172. package/dist/cjs/components/animated-list/index.d.ts +0 -1
  173. package/dist/cjs/utils/utils.js +0 -1
  174. package/dist/es/components/animated-list/AnimatedList.d.ts +0 -9
  175. package/dist/es/components/animated-list/AnimatedList.js +0 -44
  176. package/dist/es/components/animated-list/index.d.ts +0 -1
  177. package/dist/es/utils/utils.js +0 -8
@@ -1,128 +1,75 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
- import { useRef as N, useEffect as u, useCallback as H } from "react";
3
- import I from "xgplayer";
4
- /* empty css */
5
- import { PanelGroup as z, Panel as o, PanelResizeHandle as S } from "react-resizable-panels";
6
- import { SubtitlePlayer as j } from "../subtitle-player/SubtitlePlayer.js";
7
- import { useVideoSubtitleStore as D } from "./useVideoSubtitleStore.js";
8
- /* empty css */
9
- const q = ({
10
- videoUrl: m,
11
- subtitles: p,
12
- poster: v,
13
- className: P = "",
14
- style: w,
15
- onFetchDetail: c
1
+ import { jsx as u } from "react/jsx-runtime";
2
+ import { useRef as v, useEffect as w, useCallback as d } from "react";
3
+ import { isMobile as V, isTablet as g } from "react-device-detect";
4
+ import { useVideoSubtitleStore as k } from "./useVideoSubtitleStore.js";
5
+ import { useXGPlayer as H } from "./useXGPlayer.js";
6
+ import { VideoSubtitlePlayerPC as M } from "./VideoSubtitlePlayerPC.js";
7
+ import { VideoSubtitlePlayerMobile as T } from "./VideoSubtitlePlayerMobile.js";
8
+ import './VideoSubtitlePlayer.css';/* empty css */
9
+ const X = ({
10
+ videoUrl: p,
11
+ subtitles: r,
12
+ poster: b,
13
+ className: l = "",
14
+ style: n,
15
+ onFetchDetail: e,
16
+ forceLayout: m
16
17
  }) => {
17
- const n = N(null), d = N(null), {
18
- currentTime: r,
19
- isPlaying: E,
20
- setCurrentTime: _,
21
- setIsPlaying: s,
22
- setSubtitles: h,
23
- currentDetail: l,
24
- isLoadingDetail: T,
25
- fetchDetail: y
26
- } = D();
27
- u(() => {
28
- h(p);
29
- }, [p, h]), u(() => {
30
- if (!n.current) return;
31
- const a = `xiping-video-subtitle-player-${Date.now()}`;
32
- n.current && (n.current.id = a);
33
- const i = new I({
34
- id: a,
35
- url: m,
36
- poster: v,
37
- autoplay: !1,
38
- fluid: !1,
39
- width: "100%",
40
- height: "100%",
41
- controls: !0
42
- });
43
- d.current = i;
44
- const f = () => {
45
- const R = i.currentTime || 0;
46
- _(R);
47
- }, x = () => {
48
- s(!0);
49
- }, g = () => {
50
- s(!1);
51
- }, b = () => {
52
- s(!1);
53
- };
54
- return i.on("timeupdate", f), i.on("play", x), i.on("pause", g), i.on("ended", b), () => {
55
- i.off("timeupdate", f), i.off("play", x), i.off("pause", g), i.off("ended", b), i.destroy(), d.current = null;
56
- };
57
- }, [m, v, _, s]), u(() => {
58
- if (d.current) {
59
- const a = d.current;
60
- Math.abs(a.currentTime - r) > 0.5 && (a.currentTime = r);
61
- }
62
- }, [r]);
63
- const C = H(
64
- async (a) => {
65
- c ? await c(a) : await y(a);
18
+ const t = v(null), c = m !== void 0 ? m === "mobile" : V || g, {
19
+ currentTime: a,
20
+ setCurrentTime: C,
21
+ setIsPlaying: y,
22
+ setSubtitles: s,
23
+ currentDetail: P,
24
+ isLoadingDetail: S,
25
+ fetchDetail: i
26
+ } = k();
27
+ w(() => {
28
+ s(r);
29
+ }, [r, s]), H(
30
+ t,
31
+ p,
32
+ b,
33
+ { setCurrentTime: C, setIsPlaying: y },
34
+ a
35
+ );
36
+ const f = d(
37
+ async (o) => {
38
+ e ? await e(o) : await i(o);
39
+ },
40
+ [e, i]
41
+ ), W = d(
42
+ async (o) => {
43
+ e ? await e(o) : await i(o);
66
44
  },
67
- [c, y]
45
+ [e, i]
46
+ );
47
+ return c ? /* @__PURE__ */ u(
48
+ T,
49
+ {
50
+ playerRef: t,
51
+ subtitles: r,
52
+ currentTime: a,
53
+ onWordHoverChange: f,
54
+ onWordClick: W,
55
+ className: l,
56
+ style: n
57
+ }
58
+ ) : /* @__PURE__ */ u(
59
+ M,
60
+ {
61
+ playerRef: t,
62
+ subtitles: r,
63
+ currentTime: a,
64
+ currentDetail: P,
65
+ isLoadingDetail: S,
66
+ onWordHoverChange: f,
67
+ className: l,
68
+ style: n
69
+ }
68
70
  );
69
- return /* @__PURE__ */ e("div", { className: `xiping-video-subtitle-player ${P}`, style: w, children: /* @__PURE__ */ t(z, { direction: "horizontal", children: [
70
- /* @__PURE__ */ e(o, { defaultSize: 65, minSize: 40, children: /* @__PURE__ */ t(z, { direction: "vertical", children: [
71
- /* @__PURE__ */ e(o, { defaultSize: 60, minSize: 30, children: /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__video-wrapper", children: /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__video-container", children: /* @__PURE__ */ e(
72
- "div",
73
- {
74
- ref: n,
75
- className: "xiping-video-subtitle-player__video"
76
- }
77
- ) }) }) }),
78
- /* @__PURE__ */ e(S, { className: "xiping-video-subtitle-player__resize-handle xiping-video-subtitle-player__resize-handle--vertical" }),
79
- /* @__PURE__ */ e(o, { defaultSize: 40, minSize: 20, children: /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__subtitle-container", children: /* @__PURE__ */ e(
80
- j,
81
- {
82
- subtitles: p,
83
- currentTime: r,
84
- mode: "current",
85
- onWordHoverChange: C
86
- }
87
- ) }) })
88
- ] }) }),
89
- /* @__PURE__ */ e(S, { className: "xiping-video-subtitle-player__resize-handle xiping-video-subtitle-player__resize-handle--horizontal" }),
90
- /* @__PURE__ */ e(o, { defaultSize: 35, minSize: 25, maxSize: 50, children: /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__right", children: /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail", children: T ? /* @__PURE__ */ t("div", { className: "xiping-video-subtitle-player__detail-loading", children: [
91
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-loading-spinner" }),
92
- /* @__PURE__ */ e("span", { children: "加载中..." })
93
- ] }) : l ? /* @__PURE__ */ t("div", { className: "xiping-video-subtitle-player__detail-content", children: [
94
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-word", children: l.word }),
95
- l.pronunciation && /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-pronunciation", children: l.pronunciation }),
96
- l.partOfSpeech && /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-pos", children: l.partOfSpeech }),
97
- l.translation && /* @__PURE__ */ t("div", { className: "xiping-video-subtitle-player__detail-translation", children: [
98
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-label", children: "中文翻译" }),
99
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-text", children: l.translation })
100
- ] }),
101
- l.definition && /* @__PURE__ */ t("div", { className: "xiping-video-subtitle-player__detail-definition", children: [
102
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-label", children: "英文解释" }),
103
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-text", children: l.definition })
104
- ] }),
105
- l.examples && l.examples.length > 0 && /* @__PURE__ */ t("div", { className: "xiping-video-subtitle-player__detail-examples", children: [
106
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-label", children: "例句" }),
107
- l.examples.map((a, i) => /* @__PURE__ */ t(
108
- "div",
109
- {
110
- className: "xiping-video-subtitle-player__detail-example",
111
- children: [
112
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-example-en", children: a.sentence }),
113
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-example-zh", children: a.translation })
114
- ]
115
- },
116
- i
117
- ))
118
- ] })
119
- ] }) : /* @__PURE__ */ t("div", { className: "xiping-video-subtitle-player__detail-empty", children: [
120
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-empty-icon", children: "📖" }),
121
- /* @__PURE__ */ e("div", { className: "xiping-video-subtitle-player__detail-empty-text", children: "将鼠标悬停在字幕单词上查看详情" })
122
- ] }) }) }) })
123
- ] }) });
124
71
  };
125
72
  export {
126
- q as VideoSubtitlePlayer,
127
- q as default
73
+ X as VideoSubtitlePlayer,
74
+ X as default
128
75
  };
@@ -0,0 +1 @@
1
+ .xiping-video-subtitle-player--mobile{display:flex;flex-direction:column;min-height:0;height:100%}.xiping-video-subtitle-player__mobile-video{flex:0 0 auto;width:100%;aspect-ratio:16 / 9;background:#000}.xiping-video-subtitle-player__mobile-video-wrapper{width:100%;height:100%;background:#000;overflow:hidden}.xiping-video-subtitle-player__mobile-video-container{position:relative;width:100%;height:100%;background-color:#a62c2c;overflow:hidden}.xiping-video-subtitle-player__mobile-video-container .xgplayer{width:100%!important;height:100%!important}.xiping-video-subtitle-player__mobile-video-container .xgplayer video{-o-object-fit:fill!important;object-fit:fill!important}.xiping-video-subtitle-player__mobile-subtitle{flex:1;min-height:0;padding:12px 16px;overflow-y:auto;background:#0000004d;-webkit-overflow-scrolling:touch}
@@ -0,0 +1 @@
1
+ .xiping-video-subtitle-player--pc .xiping-video-subtitle-player__panel-group,.xiping-video-subtitle-player--pc .xiping-video-subtitle-player__panel-group-inner{width:100%;height:100%}.xiping-video-subtitle-player--pc .xiping-video-subtitle-player__right{border-left:1px solid rgba(255,255,255,.1)}.xiping-video-subtitle-player__resize-handle--horizontal{position:relative;width:2px;background:#ffffff1a;cursor:col-resize;transition:background .2s ease;flex-shrink:0}.xiping-video-subtitle-player__resize-handle--horizontal:hover{background:#fbbf2480}.xiping-video-subtitle-player__resize-handle--horizontal:active{background:#fbbf24cc}.xiping-video-subtitle-player__resize-handle--horizontal:before{content:"";position:absolute;inset:0 -4px;cursor:col-resize}.xiping-video-subtitle-player__resize-handle--vertical{position:relative;height:2px;background:#ffffff1a;cursor:row-resize;transition:background .2s ease;flex-shrink:0}.xiping-video-subtitle-player__resize-handle--vertical:hover{background:#fbbf2480}.xiping-video-subtitle-player__resize-handle--vertical:active{background:#fbbf24cc}.xiping-video-subtitle-player__resize-handle--vertical:before{content:"";position:absolute;inset:-4px 0;cursor:row-resize}
@@ -0,0 +1,20 @@
1
+ import { default as React, RefObject } from 'react';
2
+ import { SubtitleData, HoverTarget, WordClickTarget } from '../subtitle-player/SubtitlePlayer';
3
+ export interface VideoSubtitlePlayerMobileProps {
4
+ /** 播放器挂载的容器 ref */
5
+ playerRef: RefObject<HTMLDivElement | null>;
6
+ /** 字幕数据 */
7
+ subtitles: SubtitleData[];
8
+ /** 当前播放时间(秒) */
9
+ currentTime: number;
10
+ /** 单词 hover 变化时拉取/展示详情(可为弹窗等) */
11
+ onWordHoverChange: (target: HoverTarget | null) => void | Promise<void>;
12
+ /** 单词点击时拉取/展示详情(移动端主要交互) */
13
+ onWordClick: (target: WordClickTarget) => void | Promise<void>;
14
+ className?: string;
15
+ style?: React.CSSProperties;
16
+ }
17
+ /**
18
+ * 移动端视图:上下两栏(视频 + 字幕),无右侧详情区,详情后续以弹窗等形式实现
19
+ */
20
+ export declare const VideoSubtitlePlayerMobile: React.FC<VideoSubtitlePlayerMobileProps>;
@@ -0,0 +1,47 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ import { useCallback as l } from "react";
3
+ import u from "clsx";
4
+ import { SubtitlePlayer as y } from "../subtitle-player/SubtitlePlayer.js";
5
+ import { VideoSubtitlePlayerLayoutMobile as f } from "./layouts/VideoSubtitlePlayerLayoutMobile.js";
6
+ const P = ({
7
+ playerRef: r,
8
+ subtitles: a,
9
+ currentTime: s,
10
+ onWordHoverChange: t,
11
+ onWordClick: i,
12
+ className: c = "",
13
+ style: m
14
+ }) => {
15
+ const n = l(
16
+ async (o) => {
17
+ await t(o);
18
+ },
19
+ [t]
20
+ ), d = l(
21
+ async (o) => {
22
+ await i(o);
23
+ },
24
+ [i]
25
+ ), b = /* @__PURE__ */ e("div", { ref: r, className: "xiping-video-subtitle-player__video" }), p = /* @__PURE__ */ e(
26
+ y,
27
+ {
28
+ subtitles: a,
29
+ currentTime: s,
30
+ mode: "lyrics",
31
+ onWordHoverChange: n,
32
+ onWordClick: d
33
+ }
34
+ );
35
+ return /* @__PURE__ */ e(
36
+ f,
37
+ {
38
+ className: u(c),
39
+ style: m,
40
+ videoSlot: b,
41
+ subtitleSlot: p
42
+ }
43
+ );
44
+ };
45
+ export {
46
+ P as VideoSubtitlePlayerMobile
47
+ };
@@ -0,0 +1,23 @@
1
+ import { default as React, RefObject } from 'react';
2
+ import { SubtitleData, HoverTarget } from '../subtitle-player/SubtitlePlayer';
3
+ import { SubtitleDetail } from './useVideoSubtitleStore';
4
+ export interface VideoSubtitlePlayerPCProps {
5
+ /** 播放器挂载的容器 ref */
6
+ playerRef: RefObject<HTMLDivElement | null>;
7
+ /** 字幕数据 */
8
+ subtitles: SubtitleData[];
9
+ /** 当前播放时间(秒) */
10
+ currentTime: number;
11
+ /** 当前悬停单词的详情 */
12
+ currentDetail: SubtitleDetail | null;
13
+ /** 是否正在加载详情 */
14
+ isLoadingDetail: boolean;
15
+ /** 单词 hover 变化时拉取/展示详情 */
16
+ onWordHoverChange: (target: HoverTarget | null) => void | Promise<void>;
17
+ className?: string;
18
+ style?: React.CSSProperties;
19
+ }
20
+ /**
21
+ * PC 端视图:可拖拽分栏 + 右侧详情区,所有 PC 专属 UI 集中在此
22
+ */
23
+ export declare const VideoSubtitlePlayerPC: React.FC<VideoSubtitlePlayerPCProps>;
@@ -0,0 +1,75 @@
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
75
+ };
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { VideoSubtitlePlayerLayoutMobileProps } from './types';
3
+ /**
4
+ * 移动端布局:上下两栏,无拖拽
5
+ * - 上:视频区域(100vw 宽,16:9 占位)
6
+ * - 下:仅字幕区域(单词详情后续以弹窗等形式实现,此处不展示)
7
+ */
8
+ export declare const VideoSubtitlePlayerLayoutMobile: React.FC<VideoSubtitlePlayerLayoutMobileProps>;
@@ -0,0 +1,21 @@
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
+ };
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { VideoSubtitlePlayerLayoutPCProps } from './types';
3
+ /**
4
+ * PC 端布局:左右分栏 + 左侧上下分栏,支持拖拽调整
5
+ */
6
+ export declare const VideoSubtitlePlayerLayoutPC: React.FC<VideoSubtitlePlayerLayoutPCProps>;
@@ -0,0 +1,50 @@
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
+ };
@@ -0,0 +1,3 @@
1
+ export { VideoSubtitlePlayerLayoutPC } from './VideoSubtitlePlayerLayoutPC';
2
+ export { VideoSubtitlePlayerLayoutMobile } from './VideoSubtitlePlayerLayoutMobile';
3
+ export type { VideoSubtitlePlayerLayoutMobileProps, VideoSubtitlePlayerLayoutPCProps, } from './types';
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ /** 移动端布局 props:仅视频 + 字幕,无详情区(详情后续弹窗等单独实现) */
3
+ export interface VideoSubtitlePlayerLayoutMobileProps {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ videoSlot: ReactNode;
7
+ subtitleSlot: ReactNode;
8
+ }
9
+ /** PC 端布局 props:视频 + 字幕 + 右侧详情区 */
10
+ export interface VideoSubtitlePlayerLayoutPCProps {
11
+ className?: string;
12
+ style?: React.CSSProperties;
13
+ videoSlot: ReactNode;
14
+ subtitleSlot: ReactNode;
15
+ /** 右侧详情区域 */
16
+ detailSlot: ReactNode;
17
+ }
@@ -0,0 +1,10 @@
1
+ import { RefObject } from 'react';
2
+ export interface UseXGPlayerCallbacks {
3
+ setCurrentTime: (time: number) => void;
4
+ setIsPlaying: (playing: boolean) => void;
5
+ }
6
+ /**
7
+ * 封装 xgplayer 的创建、事件绑定与销毁,以及外部 currentTime 同步
8
+ * 调用方需渲染一个 div 并传入其 ref,播放器会挂载到该节点
9
+ */
10
+ export declare function useXGPlayer(containerRef: RefObject<HTMLDivElement | null>, videoUrl: string, poster: string | undefined, callbacks: UseXGPlayerCallbacks, currentTime: number): void;
@@ -0,0 +1,36 @@
1
+ import { useRef as h, useEffect as p } from "react";
2
+ import P from "xgplayer";
3
+ import '../../node_modules/.pnpm/xgplayer@3.0.23_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]);
33
+ }
34
+ export {
35
+ T as useXGPlayer
36
+ };
@@ -18,13 +18,14 @@ export * from './components/blur-fade';
18
18
  export * from './components/video-dialog';
19
19
  export * from './components/comic-text';
20
20
  export * from './components/flip-text';
21
- export * from './components/animated-list';
22
21
  export * from './components/shiny-button';
22
+ export * from './components/shiny-text';
23
23
  export * from './components/scratch-to-reveal';
24
24
  export * from './components/split-text';
25
25
  export * from './components/dome-gallery';
26
26
  export * from './components/text-type';
27
27
  export * from './components/gradient-text';
28
+ export * from './components/blur-text';
28
29
  export * from './components/variable-proximity';
29
30
  export * from './components/subtitle-player';
30
31
  export * from './components/video-subtitle-player';