@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,68 +1,67 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useScroll as h, motion as g, useMotionValue as p, useMotionValueEvent as b, animate as l } from "motion/react";
3
- import { cn as v } from "../../utils/utils.js";
4
- import { size as w } from "lodash-es";
5
- import { useRef as k } from "react";
6
- const m = "0%", x = "100%", d = "20%", s = "80%", t = "#0000", e = "#000";
7
- function I(r) {
8
- const n = p(
9
- `linear-gradient(90deg, ${e}, ${e} ${m}, ${e} ${s}, ${t})`
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useScroll as f, motion as h, useMotionValue as b, useMotionValueEvent as x, animate as r } from "motion/react";
3
+ import { size as v } from "lodash-es";
4
+ import { useRef as I } from "react";
5
+ import g from "clsx";
6
+ import './ImageThumbnails.css';/* empty css */
7
+ const $ = "0%", N = "100%", u = "20%", l = "80%", a = "#0000", e = "#000";
8
+ function k(i) {
9
+ const n = b(
10
+ `linear-gradient(90deg, ${e}, ${e} ${$}, ${e} ${l}, ${a})`
10
11
  );
11
- return b(r, "change", (a) => {
12
- a === 0 ? l(
12
+ return x(i, "change", (s) => {
13
+ s === 0 ? r(
13
14
  n,
14
- `linear-gradient(90deg, ${e}, ${e} ${m}, ${e} ${s}, ${t})`
15
- ) : a === 1 ? l(
15
+ `linear-gradient(90deg, ${e}, ${e} ${$}, ${e} ${l}, ${a})`
16
+ ) : s === 1 ? r(
16
17
  n,
17
- `linear-gradient(90deg, ${t}, ${e} ${d}, ${e} ${x}, ${e})`
18
- ) : (r.getPrevious() === 0 || r.getPrevious() === 1) && l(
18
+ `linear-gradient(90deg, ${a}, ${e} ${u}, ${e} ${N}, ${e})`
19
+ ) : (i.getPrevious() === 0 || i.getPrevious() === 1) && r(
19
20
  n,
20
- `linear-gradient(90deg, ${t}, ${e} ${d}, ${e} ${s}, ${t})`
21
+ `linear-gradient(90deg, ${a}, ${e} ${u}, ${e} ${l}, ${a})`
21
22
  );
22
23
  }), n;
23
24
  }
24
- const j = ({
25
- images: r,
25
+ const q = ({
26
+ images: i,
26
27
  currentIndex: n,
27
- onImageSelect: a
28
+ onImageSelect: s
28
29
  }) => {
29
- const i = k(null), { scrollXProgress: $ } = h({ container: i }), u = I($);
30
- return /* @__PURE__ */ o(
30
+ const o = I(null), { scrollXProgress: p } = f({ container: o }), d = k(p);
31
+ return /* @__PURE__ */ t(
31
32
  "div",
32
33
  {
33
- className: v(
34
- "h-24 bg-black/50 shrink-0 z-10 pb-safe-offset-0 pl-safe-offset-0 pr-safe-offset-0",
35
- {
36
- hidden: w(r) <= 1
37
- }
34
+ className: g(
35
+ "xiping-thumbnails-wrapper",
36
+ v(i) <= 1 && "xiping-thumbnails-wrapper--hidden"
38
37
  ),
39
- children: /* @__PURE__ */ o(
40
- g.div,
38
+ children: /* @__PURE__ */ t(
39
+ h.div,
41
40
  {
42
- ref: i,
41
+ ref: o,
43
42
  style: {
44
- maskImage: u,
45
- WebkitOverflowScrolling: "touch",
46
- scrollbarWidth: "none",
47
- msOverflowStyle: "none"
43
+ maskImage: d
48
44
  },
49
- className: "h-24 w-screen overflow-x-auto overflow-y-hidden scrollbar-hide",
50
- children: /* @__PURE__ */ o("div", { className: "flex gap-2 p-2 h-24 min-w-max", children: r.map((c, f) => /* @__PURE__ */ o(
45
+ className: "xiping-thumbnails-scroll",
46
+ children: /* @__PURE__ */ t("div", { className: "xiping-thumbnails-container", children: i.map((m, c) => /* @__PURE__ */ t(
51
47
  "div",
52
48
  {
53
- className: `h-full aspect-square flex-shrink-0 cursor-pointer border-2 transition-all ${f === n ? "border-white" : "border-transparent"}`,
54
- onClick: () => a(f),
55
- children: /* @__PURE__ */ o(
49
+ className: g(
50
+ "xiping-thumbnail-item",
51
+ c === n && "xiping-thumbnail-item--active"
52
+ ),
53
+ onClick: () => s(c),
54
+ children: /* @__PURE__ */ t(
56
55
  "img",
57
56
  {
58
- src: c,
57
+ src: m,
59
58
  alt: "",
60
- className: "w-full h-full object-contain",
59
+ className: "xiping-thumbnail-image",
61
60
  draggable: "false"
62
61
  }
63
62
  )
64
63
  },
65
- c
64
+ m
66
65
  )) })
67
66
  }
68
67
  )
@@ -70,5 +69,5 @@ const j = ({
70
69
  );
71
70
  };
72
71
  export {
73
- j as default
72
+ q as default
74
73
  };
@@ -0,0 +1 @@
1
+ .xiping-wrapper{width:100vw;height:100vh;position:relative;display:flex;flex-direction:column;padding-top:env(safe-area-inset-top,0)}.xiping-tool-wrapper{position:absolute;top:16px;right:16px;display:flex;gap:16px;z-index:10}.xiping-close-icon,.xiping-download-icon{color:#fff;cursor:pointer}.xiping-main-content{flex:1;min-height:0;position:relative;display:flex;align-items:center;justify-content:center}.xiping-pinch-content{width:100%;height:100%}.xiping-image{width:100vw;height:100%;-o-object-fit:contain;object-fit:contain;pointer-events:none}.xiping-loading{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background-color:#00000080}.xiping-modal-content{overflow:hidden}.xiping-modal-overlay{background-color:#000000b3}.scrollbar-hide{-ms-overflow-style:none;scrollbar-width:none}.scrollbar-hide::-webkit-scrollbar{display:none}
@@ -1,21 +1,20 @@
1
1
  "use client";
2
- import { jsx as n, jsxs as h } from "react/jsx-runtime";
2
+ import { jsx as n, jsxs as f } from "react/jsx-runtime";
3
3
  import { Modal as z, ModalContent as O, Spinner as S } from "@heroui/react";
4
4
  import P from "../pinch-content/PinchContent.js";
5
5
  import V from "./ImageThumbnails.js";
6
6
  import { useState as v, useCallback as b, useEffect as x } from "react";
7
- import X from "clsx";
8
- import { Download as B, X as K } from "lucide-react";
9
- import { AnimatePresence as W, motion as _ } from "motion/react";
10
- import { cn as f } from "../../utils/utils.js";
11
- /* empty css */
12
- const C = (c) => {
13
- c.target.closest(".xiping-main-content") && c.preventDefault();
14
- }, ne = (c) => {
7
+ import d from "clsx";
8
+ import { Download as X, X as B } from "lucide-react";
9
+ import { AnimatePresence as K, motion as W } from "motion/react";
10
+ import './ImageViewer.css';/* empty css */
11
+ const C = (l) => {
12
+ l.target.closest(".xiping-main-content") && l.preventDefault();
13
+ }, $ = (l) => {
15
14
  const {
16
15
  isOpen: a,
17
16
  onClose: w,
18
- imgSrc: d,
17
+ imgSrc: g,
19
18
  thumbnailImages: N,
20
19
  canDownload: y = !1,
21
20
  wrapperClassName: I,
@@ -23,13 +22,13 @@ const C = (c) => {
23
22
  downloadClassName: L,
24
23
  toolWrapperClassName: k,
25
24
  initialIndex: D = 0
26
- } = c, o = Array.isArray(d) ? d : [d], A = N || o, R = Math.max(
25
+ } = l, o = Array.isArray(g) ? g : [g], A = N || o, R = Math.max(
27
26
  0,
28
27
  Math.min(D, o.length - 1)
29
- ), [l, g] = v(R), [M, p] = v(!0), m = b(() => {
30
- p(!0), w();
28
+ ), [c, p] = v(R), [M, u] = v(!0), m = b(() => {
29
+ u(!0), w();
31
30
  }, [w]), T = async () => {
32
- const i = o[l];
31
+ const i = o[c];
33
32
  try {
34
33
  const r = await (await fetch(i)).blob(), e = window.URL.createObjectURL(r), s = document.createElement("a");
35
34
  s.href = e, s.download = i.split("/").pop() || "image", document.body.appendChild(s), s.click(), window.URL.revokeObjectURL(e), document.body.removeChild(s);
@@ -37,9 +36,9 @@ const C = (c) => {
37
36
  console.error("Error downloading image:", t);
38
37
  }
39
38
  }, U = () => {
40
- p(!1);
39
+ u(!1);
41
40
  }, j = () => {
42
- p(!1);
41
+ u(!1);
43
42
  };
44
43
  x(() => {
45
44
  if (a)
@@ -49,7 +48,7 @@ const C = (c) => {
49
48
  document.removeEventListener("touchmove", C);
50
49
  };
51
50
  }, [a]);
52
- const u = b(() => {
51
+ const h = b(() => {
53
52
  "vibrate" in navigator && navigator.vibrate([50, 50, 50]);
54
53
  }, []);
55
54
  return x(() => {
@@ -59,10 +58,10 @@ const C = (c) => {
59
58
  if (!(r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.isContentEditable))
60
59
  switch (t.key) {
61
60
  case "ArrowLeft":
62
- t.preventDefault(), g((e) => e > 0 ? e - 1 : (u(), e));
61
+ t.preventDefault(), p((e) => e > 0 ? e - 1 : (h(), e));
63
62
  break;
64
63
  case "ArrowRight":
65
- t.preventDefault(), g((e) => e < o.length - 1 ? e + 1 : (u(), e));
64
+ t.preventDefault(), p((e) => e < o.length - 1 ? e + 1 : (h(), e));
66
65
  break;
67
66
  case "Escape":
68
67
  t.preventDefault(), m();
@@ -72,43 +71,43 @@ const C = (c) => {
72
71
  return document.addEventListener("keydown", i), () => {
73
72
  document.removeEventListener("keydown", i);
74
73
  };
75
- }, [a, o.length, m, u]), /* @__PURE__ */ n(
74
+ }, [a, o.length, m, h]), /* @__PURE__ */ n(
76
75
  z,
77
76
  {
78
77
  isOpen: a,
79
78
  size: "full",
80
79
  onClose: m,
81
80
  classNames: {
82
- wrapper: X(I)
81
+ wrapper: d(I)
83
82
  },
84
83
  className: "xiping-modal-overlay",
85
84
  hideCloseButton: !0,
86
85
  portalContainer: document.body,
87
- children: /* @__PURE__ */ n(O, { className: "xiping-modal-content", children: /* @__PURE__ */ h("div", { className: "xiping-wrapper", children: [
88
- /* @__PURE__ */ h("div", { className: f("xiping-tool-wrapper", k), children: [
86
+ children: /* @__PURE__ */ n(O, { className: "xiping-modal-content", children: /* @__PURE__ */ f("div", { className: "xiping-wrapper", children: [
87
+ /* @__PURE__ */ f("div", { className: d("xiping-tool-wrapper", k), children: [
89
88
  y && /* @__PURE__ */ n(
90
- B,
89
+ X,
91
90
  {
92
91
  size: 24,
93
- className: f("xiping-download-icon", L),
92
+ className: d("xiping-download-icon", L),
94
93
  onClick: T
95
94
  }
96
95
  ),
97
96
  /* @__PURE__ */ n(
98
- K,
97
+ B,
99
98
  {
100
99
  size: 24,
101
- className: f("xiping-close-icon", E),
100
+ className: d("xiping-close-icon", E),
102
101
  onClick: m
103
102
  }
104
103
  )
105
104
  ] }),
106
- /* @__PURE__ */ h("div", { className: "xiping-main-content", children: [
107
- /* @__PURE__ */ n(P, { canRotate: !1, className: "xiping-pinch-content", children: /* @__PURE__ */ n(W, { mode: "wait", children: /* @__PURE__ */ n(
108
- _.img,
105
+ /* @__PURE__ */ f("div", { className: "xiping-main-content", children: [
106
+ /* @__PURE__ */ n(P, { canRotate: !1, className: "xiping-pinch-content", children: /* @__PURE__ */ n(K, { mode: "wait", children: /* @__PURE__ */ n(
107
+ W.img,
109
108
  {
110
109
  draggable: "false",
111
- src: o[l],
110
+ src: o[c],
112
111
  alt: "",
113
112
  className: "xiping-image",
114
113
  onLoad: U,
@@ -121,7 +120,7 @@ const C = (c) => {
121
120
  ease: "easeInOut"
122
121
  }
123
122
  },
124
- l
123
+ c
125
124
  ) }) }),
126
125
  M && /* @__PURE__ */ n("div", { className: "xiping-loading", children: /* @__PURE__ */ n(S, { color: "white", size: "lg" }) })
127
126
  ] }),
@@ -129,8 +128,8 @@ const C = (c) => {
129
128
  V,
130
129
  {
131
130
  images: A,
132
- currentIndex: l,
133
- onImageSelect: g
131
+ currentIndex: c,
132
+ onImageSelect: p
134
133
  }
135
134
  )
136
135
  ] }) })
@@ -138,5 +137,5 @@ const C = (c) => {
138
137
  );
139
138
  };
140
139
  export {
141
- ne as default
140
+ $ as default
142
141
  };
@@ -0,0 +1 @@
1
+ .xiping-message{display:flex;align-items:flex-start;max-width:80%;margin-bottom:16px}.xiping-message.user{align-self:flex-end;flex-direction:row-reverse;margin-left:auto}.xiping-message.assistant{align-self:flex-start;margin-right:auto}.xiping-message__avatar{width:36px;height:36px;border-radius:50%;overflow:hidden;margin:0 8px;background-color:#e0e0e0;display:flex;align-items:center;justify-content:center;flex-shrink:0}.xiping-message__content{background-color:#fff;padding:12px 16px;border-radius:12px;box-shadow:0 1px 2px #0000001a;position:relative;max-width:100%}.xiping-message:not(:has(.xiping-message__avatar)) .xiping-message__content{margin:0}.xiping-message.user .xiping-message__content{background-color:#007bff;color:#fff}.xiping-message__text{word-break:break-word;line-height:1.5}.xiping-message__timestamp{font-size:.75rem;color:#888;margin-top:4px;text-align:right}.xiping-message.user .xiping-message__timestamp{color:#fffc}.xiping-message__thinking{display:flex;align-items:center;margin-top:8px}.xiping-message__thinking-dots{display:flex;align-items:center;margin-right:8px}.xiping-message__thinking-dots span{width:8px;height:8px;margin:0 2px;background-color:#888;border-radius:50%;display:inline-block;animation:xiping-thinking 1.4s infinite ease-in-out both}.xiping-message__thinking-dots span:nth-child(1){animation-delay:-.32s}.xiping-message__thinking-dots span:nth-child(2){animation-delay:-.16s}.xiping-message__thinking-text{font-size:.9rem;color:#888}.xiping-message.user .xiping-message__thinking-text{color:#fffc}@keyframes xiping-thinking{0%,80%,to{transform:scale(.6)}40%{transform:scale(1)}}.xiping-message__loading{display:flex;align-items:center;justify-content:center;padding:8px}.xiping-message__loading-spinner{width:24px;height:24px;border:3px solid rgba(0,123,255,.3);border-radius:50%;border-top-color:#007bff;animation:xiping-spin 1s ease-in-out infinite}@keyframes xiping-spin{to{transform:rotate(360deg)}}.xiping-message__think{margin-top:12px;padding:8px 12px;background-color:#0000000d;border-radius:8px;font-size:.9rem}.xiping-message.user .xiping-message__think{background-color:#ffffff1a}.xiping-message__think-header{display:flex;align-items:center;gap:8px;margin-bottom:8px;font-weight:500}.xiping-message__think-toggle{background:none;border:none;padding:4px;cursor:pointer;color:#666;display:flex;align-items:center;justify-content:center;border-radius:4px;transition:background-color .2s ease}.xiping-message__think-toggle:hover{background-color:#0000000d}.xiping-message__think-content{max-height:1000px;opacity:1;overflow:hidden;transition:all .3s ease-in-out}.xiping-message__think-content.hidden{max-height:0;opacity:0;margin:0;padding:0}.xiping-message__knowledge-sources{margin-top:8px;padding:8px;background-color:#00000008;border-radius:4px;font-size:.9em}.xiping-message__knowledge-sources-header{font-weight:500;margin-bottom:4px;color:#666}.xiping-message__knowledge-sources-list{list-style:none;padding:0;margin:0}.xiping-message__knowledge-source-item{margin-bottom:4px}.xiping-message__knowledge-source-item:last-child{margin-bottom:0}.xiping-message__knowledge-source-item a{color:#06c;text-decoration:none}.xiping-message__knowledge-source-item a:hover{text-decoration:underline}.xiping-message__knowledge-source-description{font-size:.9em;color:#666;margin-top:2px;margin-left:8px}.xiping-message__text-container{position:relative;display:flex;flex-direction:column;gap:4px}.xiping-message__copy-button{align-self:flex-end;padding:4px;background:none;border:none;cursor:pointer;color:#666;opacity:0;transition:all .2s ease;border-radius:4px;display:flex;align-items:center;justify-content:center}.xiping-message__text-container:hover .xiping-message__copy-button{opacity:1}.xiping-message__copy-button:hover{color:#333;background-color:#0000000d}.xiping-message__copy-tooltip{position:absolute;top:-24px;right:0;background-color:#333;color:#fff;padding:4px 8px;border-radius:4px;font-size:12px;white-space:nowrap;animation:xiping-fadeInOut 2s ease-in-out}@keyframes xiping-fadeInOut{0%{opacity:0;transform:translateY(4px)}10%{opacity:1;transform:translateY(0)}90%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(4px)}}
@@ -1,54 +1,55 @@
1
- import { jsxs as i, jsx as e, Fragment as L } from "react/jsx-runtime";
2
- import { useState as b } from "react";
1
+ import { jsxs as i, jsx as e, Fragment as b } from "react/jsx-runtime";
2
+ import { useState as y } from "react";
3
3
  import a from "react-markdown";
4
- /* empty css */
5
- const q = ({
6
- id: y,
7
- content: o,
4
+ import o from "clsx";
5
+ import './Message.css';/* empty css */
6
+ const E = ({
7
+ id: j,
8
+ content: d,
8
9
  sender: n,
9
- timestamp: d,
10
- isThinking: c = !1,
11
- isLoading: j = !1,
12
- className: V = "",
13
- style: B = {},
14
- showTimestamp: g = !0,
10
+ timestamp: c,
11
+ isThinking: g = !1,
12
+ isLoading: V = !1,
13
+ className: B = "",
14
+ style: H = {},
15
+ showTimestamp: m = !0,
15
16
  avatarUser: h,
16
- avatarAssistant: m,
17
- thinkingText: H = "思考中...",
18
- customThinkingComponent: p,
19
- customUserMessageComponent: _,
20
- customAssistantMessageComponent: u,
21
- parseContent: M = !1,
22
- parsedContent: x,
17
+ avatarAssistant: p,
18
+ thinkingText: M = "思考中...",
19
+ customThinkingComponent: _,
20
+ customUserMessageComponent: u,
21
+ customAssistantMessageComponent: x,
22
+ parseContent: W = !1,
23
+ parsedContent: k,
23
24
  thinkContent: r,
24
25
  knowledgeSources: l
25
26
  }) => {
26
- const [t, k] = b(!0), [W, v] = b("idle");
27
- console.log(y, "id");
28
- const N = (s) => s.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }), $ = async () => {
27
+ const [t, v] = y(!0), [I, N] = y("idle");
28
+ console.log(j, "id");
29
+ const w = (s) => s.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }), S = async () => {
29
30
  try {
30
- await navigator.clipboard.writeText(o), v("copied"), setTimeout(() => v("idle"), 2e3);
31
+ await navigator.clipboard.writeText(d), N("copied"), setTimeout(() => N("idle"), 2e3);
31
32
  } catch (s) {
32
33
  console.error("复制失败:", s);
33
34
  }
34
- }, w = () => p || /* @__PURE__ */ i("div", { className: "xiping-message__thinking", children: [
35
+ }, f = () => _ || /* @__PURE__ */ i("div", { className: "xiping-message__thinking", children: [
35
36
  /* @__PURE__ */ i("div", { className: "xiping-message__thinking-dots", children: [
36
37
  /* @__PURE__ */ e("span", {}),
37
38
  /* @__PURE__ */ e("span", {}),
38
39
  /* @__PURE__ */ e("span", {})
39
40
  ] }),
40
- /* @__PURE__ */ e("span", { className: "xiping-message__thinking-text", children: H })
41
- ] }), I = () => /* @__PURE__ */ e("div", { className: "xiping-message__loading", children: /* @__PURE__ */ e("div", { className: "xiping-message__loading-spinner" }) }), f = () => !l || l.length === 0 ? null : /* @__PURE__ */ i("div", { className: "xiping-message__knowledge-sources", children: [
41
+ /* @__PURE__ */ e("span", { className: "xiping-message__thinking-text", children: M })
42
+ ] }), F = () => /* @__PURE__ */ e("div", { className: "xiping-message__loading", children: /* @__PURE__ */ e("div", { className: "xiping-message__loading-spinner" }) }), C = () => !l || l.length === 0 ? null : /* @__PURE__ */ i("div", { className: "xiping-message__knowledge-sources", children: [
42
43
  /* @__PURE__ */ e("div", { className: "xiping-message__knowledge-sources-header", children: "知识来源:" }),
43
- /* @__PURE__ */ e("ul", { className: "xiping-message__knowledge-sources-list", children: l.map((s, S) => /* @__PURE__ */ i("li", { className: "xiping-message__knowledge-source-item", children: [
44
+ /* @__PURE__ */ e("ul", { className: "xiping-message__knowledge-sources-list", children: l.map((s, K) => /* @__PURE__ */ i("li", { className: "xiping-message__knowledge-source-item", children: [
44
45
  s.url ? /* @__PURE__ */ e("a", { href: s.url, target: "_blank", rel: "noopener noreferrer", children: s.title }) : /* @__PURE__ */ e("span", { children: s.title }),
45
46
  s.description && /* @__PURE__ */ e("div", { className: "xiping-message__knowledge-source-description", children: s.description })
46
- ] }, S)) })
47
- ] }), C = () => n === "user" ? null : /* @__PURE__ */ i(
47
+ ] }, K)) })
48
+ ] }), L = () => n === "user" ? null : /* @__PURE__ */ i(
48
49
  "button",
49
50
  {
50
51
  className: "xiping-message__copy-button",
51
- onClick: $,
52
+ onClick: S,
52
53
  "aria-label": "Copy message",
53
54
  title: "Copy message",
54
55
  children: [
@@ -84,18 +85,22 @@ const q = ({
84
85
  ]
85
86
  }
86
87
  ),
87
- W === "copied" && /* @__PURE__ */ e("span", { className: "xiping-message__copy-tooltip", children: "Copied" })
88
+ I === "copied" && /* @__PURE__ */ e("span", { className: "xiping-message__copy-tooltip", children: "Copied" })
88
89
  ]
89
90
  }
90
91
  );
91
- return n === "user" && _ ? _ : n === "assistant" && u ? u : /* @__PURE__ */ i(
92
+ return n === "user" && u ? u : n === "assistant" && x ? x : /* @__PURE__ */ i(
92
93
  "div",
93
94
  {
94
- className: `xiping-message ${n === "user" ? "user" : "assistant"} ${V}`,
95
- style: B,
95
+ className: o(
96
+ "xiping-message",
97
+ n === "user" ? "user" : "assistant",
98
+ B
99
+ ),
100
+ style: H,
96
101
  children: [
97
- n === "user" && h || n === "assistant" && m ? /* @__PURE__ */ e("div", { className: "xiping-message__avatar", children: n === "user" ? h : m }) : null,
98
- /* @__PURE__ */ e("div", { className: "xiping-message__content", children: j ? I() : M && n === "assistant" ? /* @__PURE__ */ i(L, { children: [
102
+ n === "user" && h || n === "assistant" && p ? /* @__PURE__ */ e("div", { className: "xiping-message__avatar", children: n === "user" ? h : p }) : null,
103
+ /* @__PURE__ */ e("div", { className: "xiping-message__content", children: V ? F() : W && n === "assistant" ? /* @__PURE__ */ i(b, { children: [
99
104
  r && /* @__PURE__ */ i("div", { className: "xiping-message__think", children: [
100
105
  /* @__PURE__ */ i("div", { className: "xiping-message__think-header", children: [
101
106
  "思考过程:",
@@ -103,7 +108,7 @@ const q = ({
103
108
  "button",
104
109
  {
105
110
  className: "xiping-message__think-toggle",
106
- onClick: () => k(!t),
111
+ onClick: () => v(!t),
107
112
  "aria-label": t ? "隐藏思考过程" : "显示思考过程",
108
113
  children: /* @__PURE__ */ e(
109
114
  "svg",
@@ -135,19 +140,22 @@ const q = ({
135
140
  /* @__PURE__ */ e(
136
141
  "div",
137
142
  {
138
- className: `xiping-message__think-content ${t ? "visible" : "hidden"}`,
143
+ className: o(
144
+ "xiping-message__think-content",
145
+ t ? "visible" : "hidden"
146
+ ),
139
147
  children: /* @__PURE__ */ e(a, { children: r })
140
148
  }
141
149
  )
142
150
  ] }),
143
- c && w(),
144
- x && /* @__PURE__ */ i("div", { className: "xiping-message__text-container", children: [
145
- /* @__PURE__ */ e("div", { className: "xiping-message__text", children: /* @__PURE__ */ e(a, { children: x }) }),
146
- C()
151
+ g && f(),
152
+ k && /* @__PURE__ */ i("div", { className: "xiping-message__text-container", children: [
153
+ /* @__PURE__ */ e("div", { className: "xiping-message__text", children: /* @__PURE__ */ e(a, { children: k }) }),
154
+ L()
147
155
  ] }),
148
- f(),
149
- g && /* @__PURE__ */ e("div", { className: "xiping-message__timestamp", children: N(d) })
150
- ] }) : /* @__PURE__ */ i(L, { children: [
156
+ C(),
157
+ m && /* @__PURE__ */ e("div", { className: "xiping-message__timestamp", children: w(c) })
158
+ ] }) : /* @__PURE__ */ i(b, { children: [
151
159
  r && /* @__PURE__ */ i("div", { className: "xiping-message__think", children: [
152
160
  /* @__PURE__ */ i("div", { className: "xiping-message__think-header", children: [
153
161
  "思考过程:",
@@ -155,7 +163,7 @@ const q = ({
155
163
  "button",
156
164
  {
157
165
  className: "xiping-message__think-toggle",
158
- onClick: () => k(!t),
166
+ onClick: () => v(!t),
159
167
  "aria-label": t ? "隐藏思考过程" : "显示思考过程",
160
168
  children: /* @__PURE__ */ e(
161
169
  "svg",
@@ -187,24 +195,27 @@ const q = ({
187
195
  /* @__PURE__ */ e(
188
196
  "div",
189
197
  {
190
- className: `xiping-message__think-content ${t ? "visible" : "hidden"}`,
198
+ className: o(
199
+ "xiping-message__think-content",
200
+ t ? "visible" : "hidden"
201
+ ),
191
202
  children: /* @__PURE__ */ e(a, { children: r })
192
203
  }
193
204
  )
194
205
  ] }),
195
206
  /* @__PURE__ */ i("div", { className: "xiping-message__text-container", children: [
196
- /* @__PURE__ */ e("div", { className: "xiping-message__text", children: /* @__PURE__ */ e(a, { children: o }) }),
197
- C()
207
+ /* @__PURE__ */ e("div", { className: "xiping-message__text", children: /* @__PURE__ */ e(a, { children: d }) }),
208
+ L()
198
209
  ] }),
199
- c && w(),
200
- f(),
201
- g && /* @__PURE__ */ e("div", { className: "xiping-message__timestamp", children: N(d) })
210
+ g && f(),
211
+ C(),
212
+ m && /* @__PURE__ */ e("div", { className: "xiping-message__timestamp", children: w(c) })
202
213
  ] }) })
203
214
  ]
204
215
  }
205
216
  );
206
217
  };
207
218
  export {
208
- q as Message,
209
- q as default
219
+ E as Message,
220
+ E as default
210
221
  };
@@ -0,0 +1 @@
1
+ .xiping-pointer{position:fixed;z-index:50;pointer-events:none;transform:translate(-50%,-50%)}.xiping-pointer-icon{transform:rotate(-70deg);stroke:#fff;color:#000}
@@ -1,42 +1,43 @@
1
1
  "use client";
2
- import { jsxs as h, Fragment as E, jsx as t } from "react/jsx-runtime";
3
- import { cn as w } from "../../utils/utils.js";
4
- import { useMotionValue as m, AnimatePresence as x, motion as L } from "motion/react";
5
- import { useState as y, useRef as g, useEffect as M } from "react";
6
- function C({
2
+ import { jsxs as h, Fragment as x, jsx as t } from "react/jsx-runtime";
3
+ import { useMotionValue as m, AnimatePresence as E, motion as L } from "motion/react";
4
+ import { useState as w, useRef as y, useEffect as g } from "react";
5
+ import M from "clsx";
6
+ import './Pointer.css';/* empty css */
7
+ function P({
7
8
  className: u,
8
- style: d,
9
- children: v,
10
- ...f
9
+ style: v,
10
+ children: d,
11
+ ...p
11
12
  }) {
12
- const n = m(0), o = m(0), [p, s] = y(!1), r = g(null);
13
- return M(() => {
13
+ const n = m(0), o = m(0), [f, s] = w(!1), r = y(null);
14
+ return g(() => {
14
15
  if (typeof window < "u" && r.current) {
15
16
  const e = r.current.parentElement;
16
17
  if (e) {
17
18
  e.style.cursor = "none";
18
19
  const i = (l) => {
19
20
  n.set(l.clientX), o.set(l.clientY);
20
- }, a = () => {
21
- s(!0);
22
21
  }, c = () => {
22
+ s(!0);
23
+ }, a = () => {
23
24
  s(!1);
24
25
  };
25
- return e.addEventListener("mousemove", i), e.addEventListener("mouseenter", a), e.addEventListener("mouseleave", c), () => {
26
- e.style.cursor = "", e.removeEventListener("mousemove", i), e.removeEventListener("mouseenter", a), e.removeEventListener("mouseleave", c);
26
+ return e.addEventListener("mousemove", i), e.addEventListener("mouseenter", c), e.addEventListener("mouseleave", a), () => {
27
+ e.style.cursor = "", e.removeEventListener("mousemove", i), e.removeEventListener("mouseenter", c), e.removeEventListener("mouseleave", a);
27
28
  };
28
29
  }
29
30
  }
30
- }, [n, o]), /* @__PURE__ */ h(E, { children: [
31
+ }, [n, o]), /* @__PURE__ */ h(x, { children: [
31
32
  /* @__PURE__ */ t("div", { ref: r }),
32
- /* @__PURE__ */ t(x, { children: p && /* @__PURE__ */ t(
33
+ /* @__PURE__ */ t(E, { children: f && /* @__PURE__ */ t(
33
34
  L.div,
34
35
  {
35
- className: "transform-[translate(-50%,-50%)] pointer-events-none fixed z-50",
36
+ className: M("xiping-pointer", u),
36
37
  style: {
37
38
  top: o,
38
39
  left: n,
39
- ...d
40
+ ...v
40
41
  },
41
42
  initial: {
42
43
  scale: 0,
@@ -50,8 +51,8 @@ function C({
50
51
  scale: 0,
51
52
  opacity: 0
52
53
  },
53
- ...f,
54
- children: v || /* @__PURE__ */ t(
54
+ ...p,
55
+ children: d || /* @__PURE__ */ t(
55
56
  "svg",
56
57
  {
57
58
  stroke: "currentColor",
@@ -61,10 +62,7 @@ function C({
61
62
  height: "24",
62
63
  width: "24",
63
64
  xmlns: "http://www.w3.org/2000/svg",
64
- className: w(
65
- "rotate-[-70deg] stroke-white text-black",
66
- u
67
- ),
65
+ className: "xiping-pointer-icon",
68
66
  children: /* @__PURE__ */ t("path", { d: "M14.082 2.182a.5.5 0 0 1 .103.557L8.528 15.467a.5.5 0 0 1-.917-.007L5.57 10.694.803 8.652a.5.5 0 0 1-.006-.916l12.728-5.657a.5.5 0 0 1 .556.103z" })
69
67
  }
70
68
  )
@@ -73,5 +71,5 @@ function C({
73
71
  ] });
74
72
  }
75
73
  export {
76
- C as Pointer
74
+ P as Pointer
77
75
  };
@@ -0,0 +1 @@
1
+ .xiping-scratch-to-reveal{position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.xiping-scratch-canvas{position:absolute;left:0;top:0}