@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,18 +1,19 @@
1
1
  "use client";
2
2
  import { jsxs as P, jsx as R } from "react/jsx-runtime";
3
- import { cn as z } from "../../utils/utils.js";
4
- import { useAnimation as b, motion as A } from "motion/react";
5
- import { useRef as j, useState as p, useEffect as x } from "react";
6
- const B = ({
7
- width: l,
8
- height: m,
3
+ import { useAnimation as z, motion as A } from "motion/react";
4
+ import { useRef as b, useState as I, useEffect as x } from "react";
5
+ import j from "clsx";
6
+ import './ScratchToReveal.css';/* empty css */
7
+ const T = ({
8
+ width: m,
9
+ height: l,
9
10
  minScratchPercentage: E = 50,
10
11
  onComplete: h,
11
12
  children: L,
12
13
  className: M,
13
14
  gradientColors: a = ["#A97CF8", "#F38CB8", "#FDCC92"]
14
15
  }) => {
15
- const i = j(null), [d, r] = p(!1), [S, C] = p(!1), v = b();
16
+ const i = b(null), [d, r] = I(!1), [S, C] = I(!1), v = z();
16
17
  x(() => {
17
18
  const t = i.current, e = t?.getContext("2d");
18
19
  if (t && e) {
@@ -44,8 +45,8 @@ const B = ({
44
45
  const D = () => r(!0), w = () => r(!0), f = (t, e) => {
45
46
  const o = i.current, n = o?.getContext("2d");
46
47
  if (o && n) {
47
- const c = o.getBoundingClientRect(), s = t - c.left + 16, I = e - c.top + 16;
48
- n.globalCompositeOperation = "destination-out", n.beginPath(), n.arc(s, I, 30, 0, Math.PI * 2), n.fill();
48
+ const c = o.getBoundingClientRect(), s = t - c.left + 16, p = e - c.top + 16;
49
+ n.globalCompositeOperation = "destination-out", n.beginPath(), n.arc(s, p, 30, 0, Math.PI * 2), n.fill();
49
50
  }
50
51
  }, y = async () => {
51
52
  await v.start({
@@ -67,10 +68,10 @@ const B = ({
67
68
  return /* @__PURE__ */ P(
68
69
  A.div,
69
70
  {
70
- className: z("relative select-none", M),
71
+ className: j("xiping-scratch-to-reveal", M),
71
72
  style: {
72
- width: l,
73
- height: m,
73
+ width: m,
74
+ height: l,
74
75
  cursor: "url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Y2lyY2xlIGN4PSIxNiIgY3k9IjE2IiByPSIxNSIgc3R5bGU9ImZpbGw6I2ZmZjtzdHJva2U6IzAwMDtzdHJva2Utd2lkdGg6MXB4OyIgLz4KPC9zdmc+'), auto"
75
76
  },
76
77
  animate: v,
@@ -79,9 +80,9 @@ const B = ({
79
80
  "canvas",
80
81
  {
81
82
  ref: i,
82
- width: l,
83
- height: m,
84
- className: "absolute left-0 top-0",
83
+ width: m,
84
+ height: l,
85
+ className: "xiping-scratch-canvas",
85
86
  onMouseDown: D,
86
87
  onTouchStart: w
87
88
  }
@@ -92,5 +93,5 @@ const B = ({
92
93
  );
93
94
  };
94
95
  export {
95
- B as ScratchToReveal
96
+ T as ScratchToReveal
96
97
  };
@@ -0,0 +1 @@
1
+ .xiping-shimmer-button{position:relative;z-index:0;display:flex;cursor:pointer;align-items:center;justify-content:center;overflow:hidden;white-space:nowrap;border:1px solid rgba(255,255,255,.1);padding:.75rem 1.5rem;color:#fff;background:var(--bg);border-radius:var(--radius);transform:translateZ(0);transition:transform .3s ease-in-out}.xiping-shimmer-button:active{transform:translateY(1px) translateZ(0)}@media(prefers-color-scheme:dark){.xiping-shimmer-button{color:#000}}.xiping-shimmer-button-spark-container{position:absolute;z-index:-30;inset:0;overflow:visible;filter:blur(2px);container-type:size}.xiping-shimmer-button-spark{position:absolute;inset:0;height:100cqh;aspect-ratio:1;border-radius:0;-webkit-mask:none;mask:none;animation:xiping-shimmer-slide var(--speed) ease-in-out infinite alternate}.xiping-shimmer-button-spark-before{position:absolute;inset:-100%;width:auto;transform:rotate(0);background:conic-gradient(from calc(270deg - (var(--spread) * .5)),transparent 0,var(--shimmer-color) var(--spread),transparent var(--spread));animation:xiping-spin-around calc(var(--speed) * 2) infinite linear}.xiping-shimmer-button-highlight{position:absolute;inset:0;width:100%;height:100%;border-radius:1rem;box-shadow:inset 0 -8px 10px #ffffff1f;transform:translateZ(0);transition:all .3s ease-in-out}.xiping-shimmer-button:hover .xiping-shimmer-button-highlight{box-shadow:inset 0 -6px 10px #ffffff40}.xiping-shimmer-button:active .xiping-shimmer-button-highlight{box-shadow:inset 0 -10px 10px #ffffff40}.xiping-shimmer-button-backdrop{position:absolute;z-index:-20;background:var(--bg);border-radius:var(--radius);inset:var(--cut)}@keyframes xiping-shimmer-slide{to{transform:translate(calc(100cqw - 100%))}}@keyframes xiping-spin-around{0%{transform:translateZ(0) rotate(0)}15%,35%{transform:translateZ(0) rotate(90deg)}65%,85%{transform:translateZ(0) rotate(270deg)}to{transform:translateZ(0) rotate(360deg)}}
@@ -1,13 +1,13 @@
1
1
  import { jsxs as c, jsx as i } from "react/jsx-runtime";
2
2
  import d from "react";
3
- import { cn as h } from "../../utils/utils.js";
4
- /* empty css */
3
+ import h from "clsx";
4
+ import './ShimmerButton.css';/* empty css */
5
5
  const l = d.forwardRef(
6
6
  ({
7
7
  shimmerColor: r = "#ffffff",
8
- shimmerSize: e = "0.05em",
9
- shimmerDuration: m = "3s",
10
- borderRadius: s = "100px",
8
+ shimmerSize: s = "0.05em",
9
+ shimmerDuration: e = "3s",
10
+ borderRadius: m = "100px",
11
11
  background: t = "rgba(0, 0, 0, 1)",
12
12
  className: a,
13
13
  children: o,
@@ -18,9 +18,9 @@ const l = d.forwardRef(
18
18
  style: {
19
19
  "--spread": "90deg",
20
20
  "--shimmer-color": r,
21
- "--radius": s,
22
- "--speed": m,
23
- "--cut": e,
21
+ "--radius": m,
22
+ "--speed": e,
23
+ "--cut": s,
24
24
  "--bg": t
25
25
  },
26
26
  className: h("xiping-shimmer-button", a),
@@ -0,0 +1 @@
1
+ .xiping-shiny-button{position:relative;cursor:pointer;border-radius:.5rem;padding:.5rem 1.5rem;font-weight:500;-webkit-backdrop-filter:blur(24px);backdrop-filter:blur(24px);border:1px solid;transition:box-shadow .3s ease-in-out}.xiping-shiny-button:hover{box-shadow:0 1px 3px #0000001a,0 1px 2px -1px #0000001a}@media(prefers-color-scheme:dark){.xiping-shiny-button{background:radial-gradient(circle at 50% 0%,var(--primary) 10%,transparent 60%)}.xiping-shiny-button:hover{box-shadow:0 0 20px var(--primary) / 10%}}.xiping-shiny-button-text{position:relative;display:block;width:100%;height:100%;font-size:.875rem;text-transform:uppercase;letter-spacing:.05em;color:#000000a6}@media(prefers-color-scheme:dark){.xiping-shiny-button-text{font-weight:300;color:#ffffffe5}}.xiping-shiny-button-border{position:absolute;inset:0;z-index:10;display:block;border-radius:inherit;padding:1px}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsxs as t, jsx as a } from "react/jsx-runtime";
3
- import { cn as s } from "../../utils/utils.js";
4
- import { motion as o } from "motion/react";
5
- import p from "react";
6
- /* empty css */
7
- const c = {
3
+ import { motion as s } from "motion/react";
4
+ import o from "react";
5
+ import l from "clsx";
6
+ import './ShinyButton.css';/* empty css */
7
+ const p = {
8
8
  initial: { "--x": "100%", scale: 0.8 },
9
9
  animate: { "--x": "-100%", scale: 1 },
10
10
  whileTap: { scale: 0.95 },
@@ -23,13 +23,13 @@ const c = {
23
23
  mass: 0.5
24
24
  }
25
25
  }
26
- }, l = p.forwardRef(({ children: r, className: e, ...n }, i) => /* @__PURE__ */ t(
27
- o.button,
26
+ }, c = o.forwardRef(({ children: r, className: e, ...i }, n) => /* @__PURE__ */ t(
27
+ s.button,
28
28
  {
29
- ref: i,
30
- className: s("xiping-shiny-button", e),
31
- ...c,
32
- ...n,
29
+ ref: n,
30
+ className: l("xiping-shiny-button", e),
31
+ ...p,
32
+ ...i,
33
33
  children: [
34
34
  /* @__PURE__ */ a(
35
35
  "span",
@@ -55,7 +55,7 @@ const c = {
55
55
  ]
56
56
  }
57
57
  ));
58
- l.displayName = "ShinyButton";
58
+ c.displayName = "ShinyButton";
59
59
  export {
60
- l as ShinyButton
60
+ c as ShinyButton
61
61
  };
@@ -0,0 +1 @@
1
+ .shiny-text{display:inline-block}
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ interface ShinyTextProps {
3
+ text: string;
4
+ disabled?: boolean;
5
+ speed?: number;
6
+ className?: string;
7
+ color?: string;
8
+ shineColor?: string;
9
+ spread?: number;
10
+ yoyo?: boolean;
11
+ pauseOnHover?: boolean;
12
+ direction?: 'left' | 'right';
13
+ delay?: number;
14
+ }
15
+ declare const ShinyText: React.FC<ShinyTextProps>;
16
+ export default ShinyText;
@@ -0,0 +1,76 @@
1
+ import { jsx as L } from "react/jsx-runtime";
2
+ import { useState as W, useRef as d, useEffect as j, useCallback as y } from "react";
3
+ import { useMotionValue as v, useAnimationFrame as z, useTransform as A, motion as B } from "motion/react";
4
+ import './ShinyText.css';/* empty css */
5
+ const G = ({
6
+ text: T,
7
+ disabled: k = !1,
8
+ speed: $ = 2,
9
+ className: x = "",
10
+ color: u = "#b5b5b5",
11
+ shineColor: h = "#ffffff",
12
+ spread: C = 120,
13
+ yoyo: M = !1,
14
+ pauseOnHover: l = !1,
15
+ direction: f = "left",
16
+ delay: D = 0
17
+ }) => {
18
+ const [R, p] = W(!1), e = v(0), a = d(0), c = d(null), r = d(f === "left" ? 1 : -1), t = $ * 1e3, b = D * 1e3;
19
+ z((o) => {
20
+ if (k || R) {
21
+ c.current = null;
22
+ return;
23
+ }
24
+ if (c.current === null) {
25
+ c.current = o;
26
+ return;
27
+ }
28
+ const I = o - c.current;
29
+ if (c.current = o, a.current += I, M) {
30
+ const s = t + b, i = s * 2, n = a.current % i;
31
+ if (n < t) {
32
+ const m = n / t * 100;
33
+ e.set(r.current === 1 ? m : 100 - m);
34
+ } else if (n < s)
35
+ e.set(r.current === 1 ? 100 : 0);
36
+ else if (n < s + t) {
37
+ const g = 100 - (n - s) / t * 100;
38
+ e.set(r.current === 1 ? g : 100 - g);
39
+ } else
40
+ e.set(r.current === 1 ? 0 : 100);
41
+ } else {
42
+ const s = t + b, i = a.current % s;
43
+ if (i < t) {
44
+ const n = i / t * 100;
45
+ e.set(r.current === 1 ? n : 100 - n);
46
+ } else
47
+ e.set(r.current === 1 ? 100 : 0);
48
+ }
49
+ }), j(() => {
50
+ r.current = f === "left" ? 1 : -1, a.current = 0, e.set(0);
51
+ }, [f]);
52
+ const S = A(e, (o) => `${150 - o * 2}% center`), E = y(() => {
53
+ l && p(!0);
54
+ }, [l]), P = y(() => {
55
+ l && p(!1);
56
+ }, [l]), F = {
57
+ backgroundImage: `linear-gradient(${C}deg, ${u} 0%, ${u} 35%, ${h} 50%, ${u} 65%, ${u} 100%)`,
58
+ backgroundSize: "200% auto",
59
+ WebkitBackgroundClip: "text",
60
+ backgroundClip: "text",
61
+ WebkitTextFillColor: "transparent"
62
+ };
63
+ return /* @__PURE__ */ L(
64
+ B.span,
65
+ {
66
+ className: `shiny-text ${x}`,
67
+ style: { ...F, backgroundPosition: S },
68
+ onMouseEnter: E,
69
+ onMouseLeave: P,
70
+ children: T
71
+ }
72
+ );
73
+ };
74
+ export {
75
+ G as default
76
+ };
@@ -0,0 +1,2 @@
1
+ import { default as ShinyText } from './ShinyText';
2
+ export { ShinyText };
@@ -0,0 +1 @@
1
+ .xiping-sparkle{pointer-events:none;position:absolute;z-index:20}.xiping-sparkles-text{font-size:3.75rem;font-weight:700}.xiping-sparkles-text-wrapper{position:relative;display:inline-block}
@@ -2,19 +2,19 @@
2
2
  import { jsx as r, jsxs as g } from "react/jsx-runtime";
3
3
  import { motion as k } from "motion/react";
4
4
  import { useState as L, useEffect as S } from "react";
5
- import { cn as y } from "../../utils/utils.js";
6
- /* empty css */
7
- const M = ({ id: i, x: t, y: o, color: s, delay: c, scale: l }) => /* @__PURE__ */ r(
5
+ import y from "clsx";
6
+ import './SparklesText.css';/* empty css */
7
+ const M = ({ id: i, x: t, y: o, color: s, delay: l, scale: c }) => /* @__PURE__ */ r(
8
8
  k.svg,
9
9
  {
10
10
  className: "xiping-sparkle",
11
11
  initial: { opacity: 0, left: t, top: o },
12
12
  animate: {
13
13
  opacity: [0, 1, 0],
14
- scale: [0, l, 0],
14
+ scale: [0, c, 0],
15
15
  rotate: [75, 120, 150]
16
16
  },
17
- transition: { duration: 0.8, repeat: 1 / 0, delay: c },
17
+ transition: { duration: 0.8, repeat: 1 / 0, delay: l },
18
18
  width: "21",
19
19
  height: "21",
20
20
  viewBox: "0 0 21 21",
@@ -32,19 +32,19 @@ const M = ({ id: i, x: t, y: o, color: s, delay: c, scale: l }) => /* @__PURE__
32
32
  colors: t = { first: "#9E7AFF", second: "#FE8BBB" },
33
33
  className: o,
34
34
  sparklesCount: s = 10,
35
- ...c
35
+ ...l
36
36
  }) => {
37
- const [l, p] = L([]);
37
+ const [c, p] = L([]);
38
38
  return S(() => {
39
- const a = () => {
40
- const e = `${Math.random() * 100}%`, n = `${Math.random() * 100}%`, h = Math.random() > 0.5 ? t.first : t.second, x = Math.random() * 2, C = Math.random() * 1 + 0.3, u = Math.random() * 10 + 5;
41
- return { id: `${e}-${n}-${Date.now()}`, x: e, y: n, color: h, delay: x, scale: C, lifespan: u };
39
+ const n = () => {
40
+ const e = `${Math.random() * 100}%`, a = `${Math.random() * 100}%`, h = Math.random() > 0.5 ? t.first : t.second, x = Math.random() * 2, C = Math.random() * 1 + 0.3, u = Math.random() * 10 + 5;
41
+ return { id: `${e}-${a}-${Date.now()}`, x: e, y: a, color: h, delay: x, scale: C, lifespan: u };
42
42
  }, d = () => {
43
- const e = Array.from({ length: s }, a);
43
+ const e = Array.from({ length: s }, n);
44
44
  p(e);
45
45
  }, m = () => {
46
46
  p(
47
- (e) => e.map((n) => n.lifespan <= 0 ? a() : { ...n, lifespan: n.lifespan - 0.1 })
47
+ (e) => e.map((a) => a.lifespan <= 0 ? n() : { ...a, lifespan: a.lifespan - 0.1 })
48
48
  );
49
49
  };
50
50
  d();
@@ -54,13 +54,13 @@ const M = ({ id: i, x: t, y: o, color: s, delay: c, scale: l }) => /* @__PURE__
54
54
  "div",
55
55
  {
56
56
  className: y("xiping-sparkles-text", o),
57
- ...c,
57
+ ...l,
58
58
  style: {
59
59
  "--sparkles-first-color": `${t.first}`,
60
60
  "--sparkles-second-color": `${t.second}`
61
61
  },
62
62
  children: /* @__PURE__ */ g("span", { className: "xiping-sparkles-text-wrapper", children: [
63
- l.map((a) => /* @__PURE__ */ r(M, { ...a }, a.id)),
63
+ c.map((n) => /* @__PURE__ */ r(M, { ...n }, n.id)),
64
64
  /* @__PURE__ */ r("strong", { children: i })
65
65
  ] })
66
66
  }
@@ -0,0 +1 @@
1
+ .xiping-split-parent{overflow:hidden;display:inline-block;white-space:normal}
@@ -4,7 +4,7 @@ import { gsap as i } from "gsap";
4
4
  import { ScrollTrigger as N } from "gsap/ScrollTrigger";
5
5
  import { SplitText as S } from "gsap/SplitText";
6
6
  import j from "clsx";
7
- /* empty css */
7
+ import './SplitText.css';/* empty css */
8
8
  i.registerPlugin(N, S);
9
9
  const A = ({
10
10
  text: l,
@@ -0,0 +1 @@
1
+ .xiping-subtitle-player__current-item{display:flex;flex-direction:column;gap:.25rem;transition:all .2s ease}.xiping-subtitle-player__current-label{font-size:.75rem;font-weight:600;color:#ffffffb3;text-transform:uppercase;letter-spacing:.05em;margin-bottom:.25rem}.xiping-subtitle-player__current-text{font-size:1rem;font-weight:500;text-shadow:0 2px 4px rgba(0,0,0,.5)}.xiping-subtitle-player__current-line{margin:.25rem 0}.xiping-subtitle-player__current-line:first-child{margin-top:0}.xiping-subtitle-player__current-line:last-child{margin-bottom:0}.xiping-subtitle-player__current-hover-layer{position:absolute;inset:0;pointer-events:none}@media(max-width:768px){.xiping-subtitle-player__current-text{font-size:.9rem}}
@@ -15,6 +15,8 @@ export interface CurrentModeProps {
15
15
  overlayNode: React.ReactNode;
16
16
  /** 整条字幕点击处理器 */
17
17
  onSubtitleClick?: (event: React.MouseEvent<HTMLDivElement>, entry: SubtitleEntry, label?: string) => void;
18
+ /** 文本对齐方式 */
19
+ textAlign?: "left" | "center";
18
20
  }
19
21
  /**
20
22
  * 当前模式组件:只显示当前时间对应的字幕
@@ -1,43 +1,78 @@
1
- import { jsxs as p, Fragment as h, jsx as r } from "react/jsx-runtime";
2
- import { renderTextWithWords as x } from "./utils.js";
3
- const N = ({
4
- currentEntries: a,
5
- wordHoverFactory: u,
6
- enableWordHover: d,
7
- overlayNode: c,
8
- onSubtitleClick: t
9
- }) => a.some(({ entry: i }) => i !== null) ? /* @__PURE__ */ p(h, { children: [
10
- a.map(({ entry: i, label: s }, m) => i ? /* @__PURE__ */ p(
11
- "div",
12
- {
13
- className: "xiping-subtitle-player__item",
14
- "data-label": s || void 0,
15
- onClick: t ? (e) => t(e, i, s) : void 0,
16
- style: t ? { cursor: "pointer" } : void 0,
17
- children: [
18
- s && /* @__PURE__ */ r("span", { className: "xiping-subtitle-player__label", children: s }),
19
- /* @__PURE__ */ r("div", { className: "xiping-subtitle-player__text", children: (() => {
20
- let e = 0;
21
- return i.text.split(`
22
- `).map((n, l) => {
23
- if (!i.words || i.words.length === 0)
24
- return /* @__PURE__ */ r("div", { className: "xiping-subtitle-player__line", children: n }, l);
25
- const o = x(
26
- n,
27
- i.words,
28
- e,
29
- l,
30
- d ? u(i, s) : void 0
31
- );
32
- return e = o.nextWordIndex, /* @__PURE__ */ r("div", { className: "xiping-subtitle-player__line", children: o.nodes }, l);
33
- });
34
- })() })
35
- ]
36
- },
37
- m
38
- ) : null),
39
- d && /* @__PURE__ */ r("div", { className: "xiping-subtitle-player__hover-layer", children: c })
1
+ import { jsxs as u, Fragment as v, jsx as r } from "react/jsx-runtime";
2
+ import { renderTextWithWords as g } from "./utils.js";
3
+ import './CurrentMode.css';/* empty css */
4
+ const C = ({
5
+ currentEntries: l,
6
+ wordHoverFactory: p,
7
+ enableWordHover: o,
8
+ overlayNode: a,
9
+ onSubtitleClick: i,
10
+ textAlign: x = "left"
11
+ }) => l.some(({ entry: e }) => e !== null) ? /* @__PURE__ */ u(v, { children: [
12
+ l.map(({ entry: e, label: n }) => {
13
+ if (!e)
14
+ return null;
15
+ const h = e.text.split(`
16
+ `), m = o ? p(e, n) : void 0, _ = h.reduce(
17
+ (t, d, s) => {
18
+ if (!e.words || e.words.length === 0)
19
+ return t.content.push(
20
+ /* @__PURE__ */ r(
21
+ "div",
22
+ {
23
+ className: "xiping-subtitle-player__current-line",
24
+ children: d
25
+ },
26
+ s
27
+ )
28
+ ), t;
29
+ const c = g(
30
+ d,
31
+ e.words,
32
+ t.nextWordIndex,
33
+ s,
34
+ m
35
+ );
36
+ return t.content.push(
37
+ /* @__PURE__ */ r(
38
+ "div",
39
+ {
40
+ className: "xiping-subtitle-player__current-line",
41
+ children: c.nodes
42
+ },
43
+ s
44
+ )
45
+ ), {
46
+ content: t.content,
47
+ nextWordIndex: c.nextWordIndex
48
+ };
49
+ },
50
+ { content: [], nextWordIndex: 0 }
51
+ ).content;
52
+ return /* @__PURE__ */ u(
53
+ "div",
54
+ {
55
+ className: "xiping-subtitle-player__current-item",
56
+ "data-label": n || void 0,
57
+ onClick: i ? (t) => i(t, e, n) : void 0,
58
+ style: i ? { cursor: "pointer" } : void 0,
59
+ children: [
60
+ n && /* @__PURE__ */ r("span", { className: "xiping-subtitle-player__current-label", children: n }),
61
+ /* @__PURE__ */ r(
62
+ "div",
63
+ {
64
+ className: "xiping-subtitle-player__current-text",
65
+ style: { textAlign: x },
66
+ children: _
67
+ }
68
+ )
69
+ ]
70
+ },
71
+ `${e.index}-${n || ""}`
72
+ );
73
+ }),
74
+ o && /* @__PURE__ */ r("div", { className: "xiping-subtitle-player__current-hover-layer", children: a })
40
75
  ] }) : null;
41
76
  export {
42
- N as CurrentMode
77
+ C as CurrentMode
43
78
  };
@@ -0,0 +1 @@
1
+ .xiping-subtitle-player__lyrics-time{font-size:.7rem;font-weight:500;color:#ffffff80;font-family:Monaco,Menlo,Ubuntu Mono,monospace;margin-bottom:.25rem;-webkit-user-select:none;-moz-user-select:none;user-select:none}.xiping-subtitle-player__lyrics-item{display:flex;flex-direction:column;gap:.25rem;transition:all .2s ease}.xiping-subtitle-player__lyrics-item--active{color:#fbbf24;font-weight:600;transition:all .3s ease;position:relative}.xiping-subtitle-player__lyrics-item--active:before{content:"";position:absolute;left:-1rem;top:50%;transform:translateY(-50%);width:4px;height:92%;background:#fbbf24;border-radius:2px}.xiping-subtitle-player__lyrics-item--past{opacity:.5;color:#fff9}.xiping-subtitle-player__lyrics-label{font-size:.75rem;font-weight:600;color:#ffffffb3;text-transform:uppercase;letter-spacing:.05em;margin-bottom:.25rem}.xiping-subtitle-player__lyrics-text{font-size:1rem;font-weight:500;text-shadow:0 2px 4px rgba(0,0,0,.5)}.xiping-subtitle-player__lyrics-line{margin:.25rem 0}.xiping-subtitle-player__lyrics-line:first-child{margin-top:0}.xiping-subtitle-player__lyrics-line:last-child{margin-bottom:0}.xiping-subtitle-player__lyrics-hover-layer{position:absolute;inset:0;pointer-events:none}.xiping-subtitle-player--lyrics{max-height:600px;overflow-y:auto;gap:.5rem;scroll-behavior:smooth}.xiping-subtitle-player--lyrics::-webkit-scrollbar{width:8px}.xiping-subtitle-player--lyrics::-webkit-scrollbar-track{background:#ffffff1a;border-radius:4px}.xiping-subtitle-player--lyrics::-webkit-scrollbar-thumb{background:#ffffff4d;border-radius:4px}.xiping-subtitle-player--lyrics::-webkit-scrollbar-thumb:hover{background:#ffffff80}.xiping-subtitle-player__group{display:flex;flex-direction:column;gap:.5rem;width:100%;border-radius:.5rem;padding:.5rem;margin:-.5rem;transition:all .2s ease}.xiping-subtitle-player__group:hover{background-color:#ffffff1a}.xiping-subtitle-player__group:hover .xiping-subtitle-player__lyrics-item{transform:translate(4px)}.xiping-subtitle-player__group:hover .xiping-subtitle-player__lyrics-item--active{background-color:#fbbf2426}.xiping-subtitle-player__lyrics-item--active .xiping-subtitle-word{color:#fbbf24;font-weight:600}@media(max-width:768px){.xiping-subtitle-player__lyrics-text{font-size:.9rem}}
@@ -21,6 +21,8 @@ export interface LyricsModeProps {
21
21
  containerRef: React.RefObject<HTMLDivElement | null>;
22
22
  /** 整条字幕点击处理器 */
23
23
  onSubtitleClick?: (event: React.MouseEvent<HTMLDivElement>, entry: SubtitleEntry, label?: string) => void;
24
+ /** 文本对齐方式 */
25
+ textAlign?: "left" | "center";
24
26
  }
25
27
  /**
26
28
  * 歌词模式组件:显示全部字幕并高亮当前字幕