@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
@@ -0,0 +1,10 @@
1
+ import './index.module.css';//#region src/components/txt-reader/index.module.css
2
+ var e = {
3
+ "xiping-top-progress": "_xiping-top-progress_rkm9f_23",
4
+ "xiping-container": "_xiping-container_rkm9f_33",
5
+ "xiping-content": "_xiping-content_rkm9f_41",
6
+ "xiping-bottom-progress": "_xiping-bottom-progress_rkm9f_48",
7
+ "xiping-text-content": "_xiping-text-content_rkm9f_63"
8
+ };
9
+ //#endregion
10
+ export { e as default };
@@ -1 +1 @@
1
- .xiping-typing-animation{font-size:2.25rem;font-weight:700;line-height:5rem;letter-spacing:-.02em}
1
+ .xiping-typing-animation{letter-spacing:-.02em;font-size:2.25rem;font-weight:700;line-height:5rem}
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import './index.css';/* empty css */
3
+ import { jsx as e } from "react/jsx-runtime";
4
+ import { useEffect as t, useRef as n, useState as r } from "react";
5
+ import i from "clsx";
6
+ import { motion as a } from "motion/react";
7
+ //#region src/components/typing-animation/index.tsx
8
+ function o({ children: o, className: s, duration: c = 100, delay: l = 0, as: u = "div", startOnView: d = !1, ...f }) {
9
+ let p = a.create(u, { forwardMotionProps: !0 }), [m, h] = r(""), [g, _] = r(!1), v = n(null);
10
+ return t(() => {
11
+ if (!d) {
12
+ let e = setTimeout(() => {
13
+ _(!0);
14
+ }, l);
15
+ return () => clearTimeout(e);
16
+ }
17
+ let e = new IntersectionObserver(([t]) => {
18
+ t.isIntersecting && (setTimeout(() => {
19
+ _(!0);
20
+ }, l), e.disconnect());
21
+ }, { threshold: .1 });
22
+ return v.current && e.observe(v.current), () => e.disconnect();
23
+ }, [l, d]), t(() => {
24
+ if (!g) return;
25
+ let e = 0, t = setInterval(() => {
26
+ e < o.length ? (h(o.substring(0, e + 1)), e++) : clearInterval(t);
27
+ }, c);
28
+ return () => {
29
+ clearInterval(t);
30
+ };
31
+ }, [
32
+ o,
33
+ c,
34
+ g
35
+ ]), /* @__PURE__ */ e(p, {
36
+ ref: v,
37
+ className: i("xiping-typing-animation", s),
38
+ ...f,
39
+ children: m
40
+ });
41
+ }
42
+ //#endregion
43
+ export { o as default };
@@ -1 +1 @@
1
- .xiping-variable-proximity{font-family:Roboto Flex,Noto Sans SC,PingFang SC,Microsoft YaHei,SimHei,sans-serif}.xiping-variable-proximity__sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
1
+ .xiping-variable-proximity{font-family:Roboto Flex,Noto Sans SC,PingFang SC,Microsoft YaHei,SimHei,sans-serif}.xiping-variable-proximity__sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}
@@ -0,0 +1,179 @@
1
+ import './index.css';/* empty css */
2
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
+ import { forwardRef as n, useEffect as r, useMemo as i, useRef as a } from "react";
4
+ import o from "clsx";
5
+ import { motion as s } from "motion/react";
6
+ //#region src/components/variable-proximity/index.tsx
7
+ var c = {
8
+ robotoFlex: !1,
9
+ notoSansSC: !1,
10
+ loading: !1
11
+ };
12
+ function l(e) {
13
+ if (typeof document > "u") return !1;
14
+ try {
15
+ return document.fonts.check(`1em "${e}"`);
16
+ } catch {
17
+ return !0;
18
+ }
19
+ }
20
+ function u() {
21
+ if (c.loading || c.robotoFlex && c.notoSansSC) return;
22
+ c.loading = !0;
23
+ let e = l("Roboto Flex"), t = l("Noto Sans SC");
24
+ if (e && (c.robotoFlex = !0), t && (c.notoSansSC = !0), e && t) {
25
+ c.loading = !1;
26
+ return;
27
+ }
28
+ let n = (e, t) => {
29
+ if (document.querySelector(`link[href="${e}"]`)) {
30
+ t?.();
31
+ return;
32
+ }
33
+ let n = document.createElement("link");
34
+ n.rel = "stylesheet", n.href = e, n.onload = () => t?.(), document.head.appendChild(n);
35
+ }, r = [{
36
+ roboto: "https://fonts.loli.net/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap",
37
+ noto: "https://fonts.loli.net/css2?family=Noto+Sans+SC:wght@100..900&display=swap"
38
+ }, {
39
+ roboto: "https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap",
40
+ noto: "https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@100..900&display=swap"
41
+ }], i = (a) => {
42
+ if (a >= r.length) {
43
+ c.loading = !1;
44
+ return;
45
+ }
46
+ let o = r[a], s = 0, l = () => {
47
+ s++, s === 2 && (c.loading = !1);
48
+ };
49
+ e ? l() : n(o.roboto, () => {
50
+ c.robotoFlex = !0, l();
51
+ }), t ? l() : n(o.noto, () => {
52
+ c.notoSansSC = !0, l();
53
+ }), setTimeout(() => {
54
+ (!c.robotoFlex || !c.notoSansSC) && i(a + 1);
55
+ }, 3e3);
56
+ };
57
+ i(0);
58
+ }
59
+ function d(e = !0) {
60
+ r(() => {
61
+ e && typeof document < "u" && u();
62
+ }, [e]);
63
+ }
64
+ function f(e) {
65
+ r(() => {
66
+ let t, n = () => {
67
+ e(), t = requestAnimationFrame(n);
68
+ };
69
+ return t = requestAnimationFrame(n), () => cancelAnimationFrame(t);
70
+ }, [e]);
71
+ }
72
+ function p(e) {
73
+ let t = a({
74
+ x: 0,
75
+ y: 0
76
+ });
77
+ return r(() => {
78
+ let n = (n, r) => {
79
+ if (e?.current) {
80
+ let i = e.current.getBoundingClientRect();
81
+ t.current = {
82
+ x: n - i.left,
83
+ y: r - i.top
84
+ };
85
+ } else t.current = {
86
+ x: n,
87
+ y: r
88
+ };
89
+ }, r = (e) => n(e.clientX, e.clientY), i = (e) => {
90
+ let t = e.touches[0];
91
+ n(t.clientX, t.clientY);
92
+ };
93
+ return window.addEventListener("mousemove", r), window.addEventListener("touchmove", i), () => {
94
+ window.removeEventListener("mousemove", r), window.removeEventListener("touchmove", i);
95
+ };
96
+ }, [e]), t;
97
+ }
98
+ var m = n((n, r) => {
99
+ let { label: c, fromFontVariationSettings: l, toFontVariationSettings: u, containerRef: m, radius: h = 50, falloff: g = "linear", className: _ = "", onClick: v, style: y, fontFamily: b, autoLoadFonts: x = !0, ...S } = n;
100
+ d(x && !b);
101
+ let C = a([]), w = a([]), T = p(m), E = a({
102
+ x: null,
103
+ y: null
104
+ }), D = i(() => {
105
+ let e = (e) => new Map(e.split(",").map((e) => e.trim()).map((e) => {
106
+ let [t, n] = e.split(" ");
107
+ return [t.replace(/['"]/g, ""), parseFloat(n)];
108
+ })), t = e(l), n = e(u);
109
+ return Array.from(t.entries()).map(([e, t]) => ({
110
+ axis: e,
111
+ fromValue: t,
112
+ toValue: n.get(e) ?? t
113
+ }));
114
+ }, [l, u]), O = (e, t, n, r) => Math.sqrt((n - e) ** 2 + (r - t) ** 2), k = (e) => {
115
+ let t = Math.min(Math.max(1 - e / h, 0), 1);
116
+ switch (g) {
117
+ case "exponential": return t ** 2;
118
+ case "gaussian": return Math.exp(-((e / (h / 2)) ** 2) / 2);
119
+ default: return t;
120
+ }
121
+ };
122
+ f(() => {
123
+ if (!m?.current) return;
124
+ let { x: e, y: t } = T.current;
125
+ if (E.current.x === e && E.current.y === t) return;
126
+ E.current = {
127
+ x: e,
128
+ y: t
129
+ };
130
+ let n = m.current.getBoundingClientRect();
131
+ C.current.forEach((e, t) => {
132
+ if (!e) return;
133
+ let r = e.getBoundingClientRect(), i = r.left + r.width / 2 - n.left, a = r.top + r.height / 2 - n.top, o = O(T.current.x, T.current.y, i, a);
134
+ if (o >= h) {
135
+ e.style.fontVariationSettings = l;
136
+ return;
137
+ }
138
+ let s = k(o), c = D.map(({ axis: e, fromValue: t, toValue: n }) => `'${e}' ${t + (n - t) * s}`).join(", ");
139
+ w.current[t] = c, e.style.fontVariationSettings = c;
140
+ });
141
+ });
142
+ let A = /[\u4e00-\u9fa5]/.test(c) ? c.split("") : c.split(" ").flatMap((e, t, n) => {
143
+ let r = e.split("");
144
+ return t < n.length - 1 ? [...r, " "] : r;
145
+ }), j = 0, M = i(() => {
146
+ let e = {
147
+ display: "inline",
148
+ ...y
149
+ };
150
+ return b && (e.fontFamily = b), e;
151
+ }, [b, y]);
152
+ return /* @__PURE__ */ t("span", {
153
+ ref: r,
154
+ className: o("xiping-variable-proximity", _),
155
+ onClick: v,
156
+ style: M,
157
+ ...S,
158
+ children: [A.map((t, n) => {
159
+ let r = j++;
160
+ return /* @__PURE__ */ e(s.span, {
161
+ ref: (e) => {
162
+ C.current[r] = e;
163
+ },
164
+ style: {
165
+ display: t === " " ? "inline" : "inline-block",
166
+ fontVariationSettings: w.current[r]
167
+ },
168
+ "aria-hidden": "true",
169
+ children: t
170
+ }, n);
171
+ }), /* @__PURE__ */ e("span", {
172
+ className: "xiping-variable-proximity__sr-only",
173
+ children: c
174
+ })]
175
+ });
176
+ });
177
+ m.displayName = "VariableProximity";
178
+ //#endregion
179
+ export { m as default };
@@ -1 +1 @@
1
- .xiping-video-dialog{position:relative}.xiping-video-dialog-container{position:relative;cursor:pointer}.xiping-video-dialog-thumbnail{width:100%;border-radius:.375rem;border:1px solid;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d;transition:all .2s ease-out}.xiping-video-dialog-container:hover .xiping-video-dialog-thumbnail{filter:brightness(.8)}.xiping-video-dialog-overlay{position:absolute;inset:0;display:flex;transform:scale(.9);align-items:center;justify-content:center;border-radius:1rem;transition:all .2s ease-out}.xiping-video-dialog-container:hover .xiping-video-dialog-overlay{transform:scale(1)}.xiping-video-dialog-play-outer{display:flex;width:7rem;height:7rem;align-items:center;justify-content:center;border-radius:9999px;background-color:hsla(var(--primary-h),var(--primary-s),var(--primary-l),.1);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}.xiping-video-dialog-play-inner{position:relative;display:flex;width:5rem;height:5rem;transform:scale(1);align-items:center;justify-content:center;border-radius:9999px;background:linear-gradient(to bottom,hsla(var(--primary-h),var(--primary-s),var(--primary-l),.3),hsl(var(--primary-h),var(--primary-s),var(--primary-l)));box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;transition:all .2s ease-out}.xiping-video-dialog-container:hover .xiping-video-dialog-play-inner{transform:scale(1.2)}.xiping-video-dialog-play-icon{width:2rem;height:2rem;transform:scale(1);fill:#fff;color:#fff;transition:transform .2s ease-out;filter:drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06))}.xiping-video-dialog-container:hover .xiping-video-dialog-play-icon{transform:scale(1.05)}.xiping-video-dialog-modal{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background-color:#00000080;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}.xiping-video-dialog-modal-content{position:relative;margin:0 1rem;aspect-ratio:16 / 9;width:100%;max-width:56rem}@media(min-width:768px){.xiping-video-dialog-modal-content{margin:0}}.xiping-video-dialog-close-button{position:absolute;top:-4rem;right:0;border-radius:9999px;background-color:#17171780;padding:.5rem;font-size:1.25rem;color:#fff;box-shadow:0 0 0 1px #0000001a;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}@media(prefers-color-scheme:dark){.xiping-video-dialog-close-button{background-color:#f5f5f580;color:#000}}.xiping-video-dialog-close-icon{width:1.25rem;height:1.25rem}.xiping-video-dialog-video-wrapper{position:relative;isolation:isolate;z-index:1;width:100%;height:100%;overflow:hidden;border-radius:1rem;border:2px solid white}.xiping-video-dialog-iframe{width:100%;height:100%;border-radius:1rem}:root{--primary-h: 221.2;--primary-s: 83.2%;--primary-l: 53.3%}
1
+ .xiping-video-dialog{position:relative}.xiping-video-dialog-container{cursor:pointer;position:relative}.xiping-video-dialog-thumbnail{border:1px solid;border-radius:.375rem;width:100%;transition:all .2s ease-out;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}.xiping-video-dialog-container:hover .xiping-video-dialog-thumbnail{filter:brightness(.8)}.xiping-video-dialog-overlay{border-radius:1rem;justify-content:center;align-items:center;transition:all .2s ease-out;display:flex;position:absolute;inset:0;transform:scale(.9)}.xiping-video-dialog-container:hover .xiping-video-dialog-overlay{transform:scale(1)}.xiping-video-dialog-play-outer{background-color:hsla(var(--primary-h), var(--primary-s), var(--primary-l), .1);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-radius:9999px;justify-content:center;align-items:center;width:7rem;height:7rem;display:flex}.xiping-video-dialog-play-inner{background:linear-gradient(to bottom, hsla(var(--primary-h), var(--primary-s), var(--primary-l), .3), hsl(var(--primary-h), var(--primary-s), var(--primary-l)));border-radius:9999px;justify-content:center;align-items:center;width:5rem;height:5rem;transition:all .2s ease-out;display:flex;position:relative;transform:scale(1);box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.xiping-video-dialog-container:hover .xiping-video-dialog-play-inner{transform:scale(1.2)}.xiping-video-dialog-play-icon{fill:#fff;color:#fff;filter:drop-shadow(0 4px 3px #00000012)drop-shadow(0 2px 2px #0000000f);width:2rem;height:2rem;transition:transform .2s ease-out;transform:scale(1)}.xiping-video-dialog-container:hover .xiping-video-dialog-play-icon{transform:scale(1.05)}.xiping-video-dialog-modal{z-index:50;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background-color:#00000080;justify-content:center;align-items:center;display:flex;position:fixed;inset:0}.xiping-video-dialog-modal-content{aspect-ratio:16/9;width:100%;max-width:56rem;margin:0 1rem;position:relative}@media (width>=768px){.xiping-video-dialog-modal-content{margin:0}}.xiping-video-dialog-close-button{color:#fff;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);background-color:#17171780;border-radius:9999px;padding:.5rem;font-size:1.25rem;position:absolute;top:-4rem;right:0;box-shadow:0 0 0 1px #0000001a}@media (prefers-color-scheme:dark){.xiping-video-dialog-close-button{color:#000;background-color:#f5f5f580}}.xiping-video-dialog-close-icon{width:1.25rem;height:1.25rem}.xiping-video-dialog-video-wrapper{isolation:isolate;z-index:1;border:2px solid #fff;border-radius:1rem;width:100%;height:100%;position:relative;overflow:hidden}.xiping-video-dialog-iframe{border-radius:1rem;width:100%;height:100%}:root{--primary-h:221.2;--primary-s:83.2%;--primary-l:53.3%}
@@ -0,0 +1,168 @@
1
+ "use client";
2
+ import './VideoDialog.css';/* empty css */
3
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
4
+ import { useState as n } from "react";
5
+ import r from "clsx";
6
+ import { AnimatePresence as i, motion as a } from "motion/react";
7
+ import { Play as o, XIcon as s } from "lucide-react";
8
+ //#region src/components/video-dialog/VideoDialog.tsx
9
+ var c = {
10
+ "from-bottom": {
11
+ initial: {
12
+ y: "100%",
13
+ opacity: 0
14
+ },
15
+ animate: {
16
+ y: 0,
17
+ opacity: 1
18
+ },
19
+ exit: {
20
+ y: "100%",
21
+ opacity: 0
22
+ }
23
+ },
24
+ "from-center": {
25
+ initial: {
26
+ scale: .5,
27
+ opacity: 0
28
+ },
29
+ animate: {
30
+ scale: 1,
31
+ opacity: 1
32
+ },
33
+ exit: {
34
+ scale: .5,
35
+ opacity: 0
36
+ }
37
+ },
38
+ "from-top": {
39
+ initial: {
40
+ y: "-100%",
41
+ opacity: 0
42
+ },
43
+ animate: {
44
+ y: 0,
45
+ opacity: 1
46
+ },
47
+ exit: {
48
+ y: "-100%",
49
+ opacity: 0
50
+ }
51
+ },
52
+ "from-left": {
53
+ initial: {
54
+ x: "-100%",
55
+ opacity: 0
56
+ },
57
+ animate: {
58
+ x: 0,
59
+ opacity: 1
60
+ },
61
+ exit: {
62
+ x: "-100%",
63
+ opacity: 0
64
+ }
65
+ },
66
+ "from-right": {
67
+ initial: {
68
+ x: "100%",
69
+ opacity: 0
70
+ },
71
+ animate: {
72
+ x: 0,
73
+ opacity: 1
74
+ },
75
+ exit: {
76
+ x: "100%",
77
+ opacity: 0
78
+ }
79
+ },
80
+ fade: {
81
+ initial: { opacity: 0 },
82
+ animate: { opacity: 1 },
83
+ exit: { opacity: 0 }
84
+ },
85
+ "top-in-bottom-out": {
86
+ initial: {
87
+ y: "-100%",
88
+ opacity: 0
89
+ },
90
+ animate: {
91
+ y: 0,
92
+ opacity: 1
93
+ },
94
+ exit: {
95
+ y: "100%",
96
+ opacity: 0
97
+ }
98
+ },
99
+ "left-in-right-out": {
100
+ initial: {
101
+ x: "-100%",
102
+ opacity: 0
103
+ },
104
+ animate: {
105
+ x: 0,
106
+ opacity: 1
107
+ },
108
+ exit: {
109
+ x: "100%",
110
+ opacity: 0
111
+ }
112
+ }
113
+ };
114
+ function l({ animationStyle: l = "from-center", videoSrc: u, thumbnailSrc: d, thumbnailAlt: f = "Video thumbnail", className: p }) {
115
+ let [m, h] = n(!1), g = c[l];
116
+ return /* @__PURE__ */ t("div", {
117
+ className: r("xiping-video-dialog", p),
118
+ children: [/* @__PURE__ */ t("div", {
119
+ className: "xiping-video-dialog-container",
120
+ onClick: () => h(!0),
121
+ children: [/* @__PURE__ */ e("img", {
122
+ src: d,
123
+ alt: f,
124
+ width: 1920,
125
+ height: 1080,
126
+ className: "xiping-video-dialog-thumbnail"
127
+ }), /* @__PURE__ */ e("div", {
128
+ className: "xiping-video-dialog-overlay",
129
+ children: /* @__PURE__ */ e("div", {
130
+ className: "xiping-video-dialog-play-outer",
131
+ children: /* @__PURE__ */ e("div", {
132
+ className: "xiping-video-dialog-play-inner",
133
+ children: /* @__PURE__ */ e(o, { className: "xiping-video-dialog-play-icon" })
134
+ })
135
+ })
136
+ })]
137
+ }), /* @__PURE__ */ e(i, { children: m && /* @__PURE__ */ e(a.div, {
138
+ initial: { opacity: 0 },
139
+ animate: { opacity: 1 },
140
+ onClick: () => h(!1),
141
+ exit: { opacity: 0 },
142
+ className: "xiping-video-dialog-modal",
143
+ children: /* @__PURE__ */ t(a.div, {
144
+ ...g,
145
+ transition: {
146
+ type: "spring",
147
+ damping: 30,
148
+ stiffness: 300
149
+ },
150
+ className: "xiping-video-dialog-modal-content",
151
+ children: [/* @__PURE__ */ e(a.button, {
152
+ className: "xiping-video-dialog-close-button",
153
+ children: /* @__PURE__ */ e(s, { className: "xiping-video-dialog-close-icon" })
154
+ }), /* @__PURE__ */ e("div", {
155
+ className: "xiping-video-dialog-video-wrapper",
156
+ children: /* @__PURE__ */ e("iframe", {
157
+ src: u,
158
+ className: "xiping-video-dialog-iframe",
159
+ allowFullScreen: !0,
160
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
161
+ })
162
+ })]
163
+ })
164
+ }) })]
165
+ });
166
+ }
167
+ //#endregion
168
+ export { l as VideoDialog };
@@ -1 +1 @@
1
- .xiping-video-subtitle-player{width:100%;height:100%;background:#1a1a1a;border-radius:8px;overflow:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif}.xiping-video-subtitle-player__video-wrapper{width:100%;height:100%;background:#000;overflow:hidden}.xiping-video-subtitle-player__video-container{position:relative;width:100%;height:100%;background:#000;overflow:hidden}.xiping-video-subtitle-player__video{position:absolute;top:0;left:0;width:100%;height:100%;padding:0}.xiping-video-subtitle-player__video-container .xgplayer{width:100%!important;height:100%!important}.xiping-video-subtitle-player__video-container .xgplayer video{object-fit:fill!important}.xiping-video-subtitle-player__subtitle-container{width:100%;height:100%;padding:20px;overflow-y:auto;background:#0000004d}.xiping-video-subtitle-player__right{width:100%;height:100%;background:#00000080;display:flex;flex-direction:column}.xiping-video-subtitle-player__detail{flex:1;padding:24px;overflow-y:auto;color:#fff}.xiping-video-subtitle-player__detail-loading{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:16px;color:#ffffffb3}.xiping-video-subtitle-player__detail-loading-spinner{width:40px;height:40px;border:3px solid rgba(255,255,255,.1);border-top-color:#fbbf24;border-radius:50%;animation:xiping-vsp-spin 1s linear infinite}@keyframes xiping-vsp-spin{to{transform:rotate(360deg)}}.xiping-video-subtitle-player__detail-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;gap:16px;color:#ffffff80;text-align:center}.xiping-video-subtitle-player__detail-empty-icon{font-size:48px;opacity:.5}.xiping-video-subtitle-player__detail-empty-text{font-size:14px;line-height:1.6}.xiping-video-subtitle-player__detail-content{display:flex;flex-direction:column;gap:20px}.xiping-video-subtitle-player__detail-word{font-size:32px;font-weight:700;color:#fbbf24;line-height:1.2;margin-bottom:8px}.xiping-video-subtitle-player__detail-pronunciation{font-size:18px;color:#ffffffb3;font-style:italic;margin-bottom:4px}.xiping-video-subtitle-player__detail-pos{display:inline-block;padding:4px 12px;background:#fbbf2433;color:#fbbf24;border-radius:4px;font-size:12px;font-weight:600;text-transform:uppercase;width:fit-content;margin-bottom:8px}.xiping-video-subtitle-player__detail-label{font-size:12px;font-weight:600;color:#ffffff80;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px}.xiping-video-subtitle-player__detail-text{font-size:16px;line-height:1.6;color:#ffffffe6}.xiping-video-subtitle-player__detail-translation,.xiping-video-subtitle-player__detail-definition{padding-bottom:16px;border-bottom:1px solid rgba(255,255,255,.1)}.xiping-video-subtitle-player__detail-definition{border-bottom:none}.xiping-video-subtitle-player__detail-examples{display:flex;flex-direction:column;gap:16px}.xiping-video-subtitle-player__detail-example{padding:16px;background:#ffffff0d;border-radius:8px;border-left:3px solid #fbbf24}.xiping-video-subtitle-player__detail-example-en{font-size:15px;line-height:1.6;color:#fffffff2;margin-bottom:8px}.xiping-video-subtitle-player__detail-example-zh{font-size:14px;line-height:1.6;color:#ffffffb3;padding-left:12px;border-left:2px solid rgba(255,255,255,.2)}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar,.xiping-video-subtitle-player__detail::-webkit-scrollbar{width:8px}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar-track,.xiping-video-subtitle-player__detail::-webkit-scrollbar-track{background:#ffffff0d;border-radius:4px}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar-thumb,.xiping-video-subtitle-player__detail::-webkit-scrollbar-thumb{background:#fff3;border-radius:4px}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar-thumb:hover,.xiping-video-subtitle-player__detail::-webkit-scrollbar-thumb:hover{background:#ffffff4d}
1
+ .xiping-video-subtitle-player{background:#1a1a1a;border-radius:8px;width:100%;height:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;overflow:hidden}.xiping-video-subtitle-player__video-wrapper{background:#000;width:100%;height:100%;overflow:hidden}.xiping-video-subtitle-player__video-container{background:#000;width:100%;height:100%;position:relative;overflow:hidden}.xiping-video-subtitle-player__video{width:100%;height:100%;padding:0;position:absolute;top:0;left:0}.xiping-video-subtitle-player__video-container .xgplayer{width:100%!important;height:100%!important}.xiping-video-subtitle-player__video-container .xgplayer video{object-fit:fill!important}.xiping-video-subtitle-player__subtitle-container{background:#0000004d;width:100%;height:100%;padding:20px;overflow-y:auto}.xiping-video-subtitle-player__right{background:#00000080;flex-direction:column;width:100%;height:100%;display:flex}.xiping-video-subtitle-player__detail{color:#fff;flex:1;padding:24px;overflow-y:auto}.xiping-video-subtitle-player__detail-loading{color:#ffffffb3;flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex}.xiping-video-subtitle-player__detail-loading-spinner{border:3px solid #ffffff1a;border-top-color:#fbbf24;border-radius:50%;width:40px;height:40px;animation:1s linear infinite xiping-vsp-spin}@keyframes xiping-vsp-spin{to{transform:rotate(360deg)}}.xiping-video-subtitle-player__detail-empty{color:#ffffff80;text-align:center;flex-direction:column;justify-content:center;align-items:center;gap:16px;height:100%;display:flex}.xiping-video-subtitle-player__detail-empty-icon{opacity:.5;font-size:48px}.xiping-video-subtitle-player__detail-empty-text{font-size:14px;line-height:1.6}.xiping-video-subtitle-player__detail-content{flex-direction:column;gap:20px;display:flex}.xiping-video-subtitle-player__detail-word{color:#fbbf24;margin-bottom:8px;font-size:32px;font-weight:700;line-height:1.2}.xiping-video-subtitle-player__detail-pronunciation{color:#ffffffb3;margin-bottom:4px;font-size:18px;font-style:italic}.xiping-video-subtitle-player__detail-pos{color:#fbbf24;text-transform:uppercase;background:#fbbf2433;border-radius:4px;width:fit-content;margin-bottom:8px;padding:4px 12px;font-size:12px;font-weight:600;display:inline-block}.xiping-video-subtitle-player__detail-label{color:#ffffff80;text-transform:uppercase;letter-spacing:.05em;margin-bottom:8px;font-size:12px;font-weight:600}.xiping-video-subtitle-player__detail-text{color:#ffffffe6;font-size:16px;line-height:1.6}.xiping-video-subtitle-player__detail-translation,.xiping-video-subtitle-player__detail-definition{border-bottom:1px solid #ffffff1a;padding-bottom:16px}.xiping-video-subtitle-player__detail-definition{border-bottom:none}.xiping-video-subtitle-player__detail-examples{flex-direction:column;gap:16px;display:flex}.xiping-video-subtitle-player__detail-example{background:#ffffff0d;border-left:3px solid #fbbf24;border-radius:8px;padding:16px}.xiping-video-subtitle-player__detail-example-en{color:#fffffff2;margin-bottom:8px;font-size:15px;line-height:1.6}.xiping-video-subtitle-player__detail-example-zh{color:#ffffffb3;border-left:2px solid #fff3;padding-left:12px;font-size:14px;line-height:1.6}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar{width:8px}.xiping-video-subtitle-player__detail::-webkit-scrollbar{width:8px}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar-track{background:#ffffff0d;border-radius:4px}.xiping-video-subtitle-player__detail::-webkit-scrollbar-track{background:#ffffff0d;border-radius:4px}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar-thumb{background:#fff3;border-radius:4px}.xiping-video-subtitle-player__detail::-webkit-scrollbar-thumb{background:#fff3;border-radius:4px}.xiping-video-subtitle-player__subtitle-container::-webkit-scrollbar-thumb:hover{background:#ffffff4d}.xiping-video-subtitle-player__detail::-webkit-scrollbar-thumb:hover{background:#ffffff4d}
@@ -1 +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{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}
1
+ .xiping-video-subtitle-player--mobile{flex-direction:column;height:100%;min-height:0;display:flex}.xiping-video-subtitle-player__mobile-video{aspect-ratio:16/9;background:#000;flex:none;width:100%}.xiping-video-subtitle-player__mobile-video-wrapper{background:#000;width:100%;height:100%;overflow:hidden}.xiping-video-subtitle-player__mobile-video-container{background-color:#a62c2c;width:100%;height:100%;position:relative;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{object-fit:fill!important}.xiping-video-subtitle-player__mobile-subtitle{-webkit-overflow-scrolling:touch;background:#0000004d;flex:1;min-height:0;padding:12px 16px;overflow-y:auto}
@@ -1 +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}
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 #ffffff1a}.xiping-video-subtitle-player__resize-handle--horizontal{cursor:col-resize;background:#ffffff1a;flex-shrink:0;width:2px;transition:background .2s;position:relative}.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:"";cursor:col-resize;position:absolute;inset:0 -4px}.xiping-video-subtitle-player__resize-handle--vertical{cursor:row-resize;background:#ffffff1a;flex-shrink:0;height:2px;transition:background .2s;position:relative}.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:"";cursor:row-resize;position:absolute;inset:-4px 0}
@@ -0,0 +1,43 @@
1
+ import { useVideoSubtitleStore as e } from "./useVideoSubtitleStore.js";
2
+ import { useXGPlayer as t } from "./useXGPlayer.js";
3
+ import { VideoSubtitlePlayerPC as n } from "./VideoSubtitlePlayerPC.js";
4
+ import { VideoSubtitlePlayerMobile as r } from "./VideoSubtitlePlayerMobile.js";
5
+ import './VideoSubtitlePlayer.css';/* empty css */
6
+ import { jsx as i } from "react/jsx-runtime";
7
+ import { useCallback as a, useEffect as o, useRef as s } from "react";
8
+ import { isMobile as c, isTablet as l } from "react-device-detect";
9
+ //#region src/components/video-subtitle-player/VideoSubtitlePlayer.tsx
10
+ var u = ({ videoUrl: u, subtitles: d, poster: f, className: p = "", style: m, onFetchDetail: h, forceLayout: g }) => {
11
+ let _ = s(null), v = g === void 0 ? c || l : g === "mobile", { currentTime: y, setCurrentTime: b, setIsPlaying: x, setSubtitles: S, currentDetail: C, isLoadingDetail: w, fetchDetail: T } = e();
12
+ o(() => {
13
+ S(d);
14
+ }, [d, S]), t(_, u, f, {
15
+ setCurrentTime: b,
16
+ setIsPlaying: x
17
+ }, y);
18
+ let E = a(async (e) => {
19
+ h ? await h(e) : await T(e);
20
+ }, [h, T]), D = a(async (e) => {
21
+ h ? await h(e) : await T(e);
22
+ }, [h, T]);
23
+ return v ? /* @__PURE__ */ i(r, {
24
+ playerRef: _,
25
+ subtitles: d,
26
+ currentTime: y,
27
+ onWordHoverChange: E,
28
+ onWordClick: D,
29
+ className: p,
30
+ style: m
31
+ }) : /* @__PURE__ */ i(n, {
32
+ playerRef: _,
33
+ subtitles: d,
34
+ currentTime: y,
35
+ currentDetail: C,
36
+ isLoadingDetail: w,
37
+ onWordHoverChange: E,
38
+ className: p,
39
+ style: m
40
+ });
41
+ };
42
+ //#endregion
43
+ export { u as default };
@@ -1,47 +1,30 @@
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
1
+ import e from "../subtitle-player/SubtitlePlayer2.js";
2
+ import { VideoSubtitlePlayerLayoutMobile as t } from "./layouts/VideoSubtitlePlayerLayoutMobile.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import { useCallback as r } from "react";
5
+ import i from "clsx";
6
+ //#region src/components/video-subtitle-player/VideoSubtitlePlayerMobile.tsx
7
+ var a = ({ playerRef: a, subtitles: o, currentTime: s, onWordHoverChange: c, onWordClick: l, className: u = "", style: d }) => {
8
+ let f = r(async (e) => {
9
+ await c(e);
10
+ }, [c]), p = r(async (e) => {
11
+ await l(e);
12
+ }, [l]), m = /* @__PURE__ */ n("div", {
13
+ ref: a,
14
+ className: "xiping-video-subtitle-player__video"
15
+ }), h = /* @__PURE__ */ n(e, {
16
+ subtitles: o,
17
+ currentTime: s,
18
+ mode: "lyrics",
19
+ onWordHoverChange: f,
20
+ onWordClick: p
21
+ });
22
+ return /* @__PURE__ */ n(t, {
23
+ className: i(u),
24
+ style: d,
25
+ videoSlot: m,
26
+ subtitleSlot: h
27
+ });
47
28
  };
29
+ //#endregion
30
+ export { a as VideoSubtitlePlayerMobile };