@xiping/react-components 1.0.55 → 1.0.57

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 (147) 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.js +1 -1
  65. package/dist/cjs/index.d.ts +2 -1
  66. package/dist/cjs/index.js +1 -1
  67. package/dist/cjs/llms.txt +2 -13
  68. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -0
  69. package/dist/es/components/blur-text/BlurText.d.ts +16 -0
  70. package/dist/es/components/blur-text/BlurText.js +77 -0
  71. package/dist/es/components/blur-text/index.d.ts +2 -0
  72. package/dist/es/components/button/Button.css +1 -0
  73. package/dist/es/components/button/Button.js +35 -46
  74. package/dist/es/components/comic-text/ComicText.css +1 -0
  75. package/dist/es/components/comic-text/ComicText.js +13 -12
  76. package/dist/es/components/dock/Duck.css +1 -0
  77. package/dist/es/components/dock/Duck.d.ts +2 -4
  78. package/dist/es/components/dock/Duck.js +60 -64
  79. package/dist/es/components/flip-text/FlipText.css +1 -0
  80. package/dist/es/components/flip-text/FlipText.js +8 -8
  81. package/dist/es/components/gradient-text/index.css +1 -0
  82. package/dist/es/components/gradient-text/index.js +9 -8
  83. package/dist/es/components/hyper-text/HyperText.css +1 -0
  84. package/dist/es/components/hyper-text/index.js +16 -13
  85. package/dist/es/components/image-compare/ImageCompare.css +1 -0
  86. package/dist/es/components/image-compare/ImageCompare.d.ts +4 -2
  87. package/dist/es/components/image-compare/ImageCompare.js +55 -48
  88. package/dist/es/components/image-viewer/ImageThumbnails.css +1 -0
  89. package/dist/es/components/image-viewer/ImageThumbnails.js +41 -42
  90. package/dist/es/components/image-viewer/ImageViewer.css +1 -0
  91. package/dist/es/components/image-viewer/ImageViewer.js +34 -35
  92. package/dist/es/components/message/Message.css +1 -0
  93. package/dist/es/components/message/Message.js +65 -54
  94. package/dist/es/components/pointer/Pointer.css +1 -0
  95. package/dist/es/components/pointer/Pointer.js +23 -25
  96. package/dist/es/components/scratch-to-reveal/ScratchToReveal.css +1 -0
  97. package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +17 -16
  98. package/dist/es/components/shimmer-button/ShimmerButton.css +1 -0
  99. package/dist/es/components/shimmer-button/ShimmerButton.js +8 -8
  100. package/dist/es/components/shiny-button/ShinyButton.css +1 -0
  101. package/dist/es/components/shiny-button/ShinyButton.js +13 -13
  102. package/dist/es/components/shiny-text/ShinyText.css +1 -0
  103. package/dist/es/components/shiny-text/ShinyText.d.ts +16 -0
  104. package/dist/es/components/shiny-text/ShinyText.js +76 -0
  105. package/dist/es/components/shiny-text/index.d.ts +2 -0
  106. package/dist/es/components/sparkles-text/SparklesText.css +1 -0
  107. package/dist/es/components/sparkles-text/SparklesText.js +14 -14
  108. package/dist/es/components/split-text/SplitText.css +1 -0
  109. package/dist/es/components/split-text/SplitText.js +1 -1
  110. package/dist/es/components/subtitle-player/CurrentMode.css +1 -0
  111. package/dist/es/components/subtitle-player/CurrentMode.d.ts +2 -0
  112. package/dist/es/components/subtitle-player/CurrentMode.js +75 -40
  113. package/dist/es/components/subtitle-player/LyricsMode.css +1 -0
  114. package/dist/es/components/subtitle-player/LyricsMode.d.ts +2 -0
  115. package/dist/es/components/subtitle-player/LyricsMode.js +139 -68
  116. package/dist/es/components/subtitle-player/SubtitlePlayer.css +1 -0
  117. package/dist/es/components/subtitle-player/SubtitlePlayer.d.ts +2 -0
  118. package/dist/es/components/subtitle-player/SubtitlePlayer.js +63 -60
  119. package/dist/es/components/text-animate/TextAnimate.css +1 -0
  120. package/dist/es/components/text-animate/TextAnimate.js +57 -55
  121. package/dist/es/components/text-type/TextType.css +1 -0
  122. package/dist/es/components/text-type/TextType.js +24 -19
  123. package/dist/es/components/txt-reader/index.module.css +1 -0
  124. package/dist/es/components/txt-reader/index.module.css.js +1 -1
  125. package/dist/es/components/typing-animation/index.css +1 -0
  126. package/dist/es/components/typing-animation/index.js +12 -12
  127. package/dist/es/components/variable-proximity/index.css +1 -0
  128. package/dist/es/components/variable-proximity/index.js +19 -18
  129. package/dist/es/components/video-dialog/VideoDialog.css +1 -0
  130. package/dist/es/components/video-dialog/VideoDialog.js +1 -1
  131. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -0
  132. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +100 -93
  133. package/dist/es/index.d.ts +2 -1
  134. package/dist/es/index.js +59 -60
  135. package/dist/es/llms.txt +2 -13
  136. package/dist/es/node_modules/.pnpm/xgplayer@3.0.23_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -0
  137. package/package.json +14 -12
  138. package/dist/cjs/components/animated-list/AnimatedList.d.ts +0 -9
  139. package/dist/cjs/components/animated-list/AnimatedList.js +0 -1
  140. package/dist/cjs/components/animated-list/index.d.ts +0 -1
  141. package/dist/cjs/react-components.css +0 -1
  142. package/dist/cjs/utils/utils.js +0 -1
  143. package/dist/es/components/animated-list/AnimatedList.d.ts +0 -9
  144. package/dist/es/components/animated-list/AnimatedList.js +0 -44
  145. package/dist/es/components/animated-list/index.d.ts +0 -1
  146. package/dist/es/react-components.css +0 -1
  147. package/dist/es/utils/utils.js +0 -8
@@ -1,35 +1,36 @@
1
- import { jsx as S, jsxs as z } from "react/jsx-runtime";
2
- import { useMemo as h, useRef as F, useState as k, useEffect as G, useCallback as u } from "react";
1
+ import { jsx as S, jsxs as F } from "react/jsx-runtime";
2
+ import { useMemo as f, useRef as G, useState as D, useEffect as V, useCallback as u } from "react";
3
3
  import { parseSRT as w, parseVTT as v } from "../../packages/subtitle/lib/src/parser.js";
4
- import { srtToJson as V, vttToJson as q } from "../../packages/subtitle/lib/src/json-converter.js";
5
- import K from "clsx";
6
- import { CurrentMode as Q } from "./CurrentMode.js";
7
- import { LyricsMode as U } from "./LyricsMode.js";
8
- import { getCurrentSubtitleEntry as X, timeStringToSeconds as A } from "./utils.js";
9
- /* empty css */
10
- const ot = ({
4
+ import { srtToJson as q, vttToJson as K } from "../../packages/subtitle/lib/src/json-converter.js";
5
+ import Q from "clsx";
6
+ import { CurrentMode as U } from "./CurrentMode.js";
7
+ import { LyricsMode as X } from "./LyricsMode.js";
8
+ import { getCurrentSubtitleEntry as Y, timeStringToSeconds as J } from "./utils.js";
9
+ import './SubtitlePlayer.css';/* empty css */
10
+ const ct = ({
11
11
  subtitles: p,
12
- currentTime: f,
12
+ currentTime: h,
13
13
  mode: m = "current",
14
- className: D = "",
15
- style: J,
14
+ textAlign: E = "left",
15
+ className: L = "",
16
+ style: A,
16
17
  onWordHoverChange: a,
17
18
  renderWordOverlay: d,
18
19
  onWordClick: y,
19
20
  onSubtitleClick: T
20
21
  }) => {
21
- const i = h(
22
+ const i = f(
22
23
  () => Array.isArray(p) ? p : [p],
23
24
  [p]
24
- ), l = F(null), [s, E] = k(null), [R, M] = k([]);
25
- G(() => {
25
+ ), l = G(null), [s, M] = D(null), [R, b] = D([]);
26
+ V(() => {
26
27
  let r = !0;
27
28
  async function c() {
28
29
  try {
29
30
  const e = await Promise.all(
30
31
  i.map(async (t) => {
31
32
  try {
32
- const n = t.language || "zh", o = t.type === "srt" ? await V(t.content, n) : await q(t.content, n);
33
+ const n = t.language || "zh", o = t.type === "srt" ? await q(t.content, n) : await K(t.content, n);
33
34
  return {
34
35
  entries: JSON.parse(o),
35
36
  label: t.label
@@ -42,7 +43,7 @@ const ot = ({
42
43
  }
43
44
  })
44
45
  );
45
- r && M(e);
46
+ r && b(e);
46
47
  } catch (e) {
47
48
  if (console.error("加载字幕失败:", e), r) {
48
49
  const t = i.map((n) => {
@@ -58,7 +59,7 @@ const ot = ({
58
59
  };
59
60
  }
60
61
  });
61
- M(t);
62
+ b(t);
62
63
  }
63
64
  }
64
65
  }
@@ -66,7 +67,7 @@ const ot = ({
66
67
  r = !1;
67
68
  };
68
69
  }, [i]);
69
- const g = h(() => R.length > 0 ? R : i.map((r) => {
70
+ const g = f(() => R.length > 0 ? R : i.map((r) => {
70
71
  try {
71
72
  return {
72
73
  entries: r.type === "srt" ? w(r.content) : v(r.content),
@@ -78,20 +79,20 @@ const ot = ({
78
79
  label: r.label
79
80
  };
80
81
  }
81
- }), [R, i]), L = h(() => g.map(({ entries: r, label: c }) => ({
82
- entry: X(r, f),
82
+ }), [R, i]), W = f(() => g.map(({ entries: r, label: c }) => ({
83
+ entry: Y(r, h),
83
84
  label: c,
84
85
  entries: r
85
86
  // 保留所有条目用于歌词模式
86
- })), [g, f]), W = h(() => {
87
+ })), [g, h]), _ = f(() => {
87
88
  const r = [];
88
89
  g.forEach(({ entries: t, label: n }) => {
89
90
  t.forEach((o) => {
90
91
  r.push({
91
92
  entry: o,
92
93
  label: n,
93
- startTime: A(o.startTime),
94
- endTime: A(o.endTime)
94
+ startTime: J(o.startTime),
95
+ endTime: J(o.endTime)
95
96
  });
96
97
  });
97
98
  }), r.sort((t, n) => t.startTime - n.startTime);
@@ -105,7 +106,7 @@ const ot = ({
105
106
  t.startTime <= n.endTime ? e.push(t) : (c.push(e), e = [t]);
106
107
  }
107
108
  return e.length > 0 && c.push(e), c;
108
- }, [g]), b = u(
109
+ }, [g]), x = u(
109
110
  (r, c) => {
110
111
  const e = r.currentTarget.getBoundingClientRect(), t = l.current?.getBoundingClientRect(), n = t !== void 0 ? new DOMRect(
111
112
  e.left - t.left,
@@ -117,12 +118,12 @@ const ot = ({
117
118
  rect: n,
118
119
  element: r.currentTarget
119
120
  };
120
- E(o), a?.(o);
121
+ M(o), a?.(o);
121
122
  },
122
123
  [a]
123
- ), x = u(() => {
124
- E(null), a?.(null);
125
- }, [a]), B = u(
124
+ ), B = u(() => {
125
+ M(null), a?.(null);
126
+ }, [a]), C = u(
126
127
  (r, c) => {
127
128
  if (!y) return;
128
129
  r.stopPropagation();
@@ -140,36 +141,36 @@ const ot = ({
140
141
  y(o);
141
142
  },
142
143
  [y]
143
- ), C = u(
144
+ ), N = u(
144
145
  (r, c, e) => {
145
146
  if (!T || r.target.closest(".xiping-subtitle-word"))
146
147
  return;
147
- const n = r.currentTarget.getBoundingClientRect(), o = l.current?.getBoundingClientRect(), j = o !== void 0 ? new DOMRect(
148
+ const n = r.currentTarget.getBoundingClientRect(), o = l.current?.getBoundingClientRect(), k = o !== void 0 ? new DOMRect(
148
149
  n.left - o.left,
149
150
  n.top - o.top,
150
151
  n.width,
151
152
  n.height
152
- ) : n, _ = {
153
+ ) : n, z = {
153
154
  type: "subtitle",
154
155
  entry: c,
155
156
  label: e,
156
- rect: j,
157
+ rect: k,
157
158
  element: r.currentTarget
158
159
  };
159
- T(_);
160
+ T(z);
160
161
  },
161
162
  [T]
162
- ), N = u(
163
+ ), O = u(
163
164
  (r, c) => (e, t, n) => ({
164
- onMouseEnter: (o) => b(o, {
165
+ onMouseEnter: (o) => x(o, {
165
166
  word: e,
166
167
  wordIndex: t,
167
168
  lineIndex: n,
168
169
  entry: r,
169
170
  label: c
170
171
  }),
171
- onMouseLeave: x,
172
- onClick: (o) => B(o, {
172
+ onMouseLeave: B,
173
+ onClick: (o) => C(o, {
173
174
  word: e,
174
175
  wordIndex: t,
175
176
  lineIndex: n,
@@ -177,8 +178,8 @@ const ot = ({
177
178
  label: c
178
179
  })
179
180
  }),
180
- [b, x, B]
181
- ), O = d && s ? /* @__PURE__ */ S(
181
+ [x, B, C]
182
+ ), P = d && s ? /* @__PURE__ */ S(
182
183
  "div",
183
184
  {
184
185
  className: "xiping-subtitle-player__hover-overlay",
@@ -188,38 +189,40 @@ const ot = ({
188
189
  },
189
190
  children: d(s)
190
191
  }
191
- ) : null, P = !!(d || a);
192
- return /* @__PURE__ */ z(
192
+ ) : null, j = !!(d || a);
193
+ return /* @__PURE__ */ F(
193
194
  "div",
194
195
  {
195
196
  ref: l,
196
- className: K(
197
+ className: Q(
197
198
  "xiping-subtitle-player",
198
199
  m === "lyrics" ? "xiping-subtitle-player--lyrics" : "xiping-subtitle-player--current",
199
- D
200
+ L
200
201
  ),
201
- style: J,
202
+ style: A,
202
203
  children: [
203
204
  m === "current" && /* @__PURE__ */ S(
204
- Q,
205
+ U,
205
206
  {
206
- currentEntries: L,
207
- wordHoverFactory: N,
208
- enableWordHover: P,
209
- overlayNode: O,
210
- onSubtitleClick: C
207
+ currentEntries: W,
208
+ wordHoverFactory: O,
209
+ enableWordHover: j,
210
+ overlayNode: P,
211
+ onSubtitleClick: N,
212
+ textAlign: E
211
213
  }
212
214
  ),
213
215
  m === "lyrics" && /* @__PURE__ */ S(
214
- U,
216
+ X,
215
217
  {
216
- groupedEntriesByTime: W,
217
- currentTime: f,
218
- wordHoverFactory: N,
219
- enableWordHover: P,
220
- overlayNode: O,
218
+ groupedEntriesByTime: _,
219
+ currentTime: h,
220
+ wordHoverFactory: O,
221
+ enableWordHover: j,
222
+ overlayNode: P,
221
223
  containerRef: l,
222
- onSubtitleClick: C
224
+ onSubtitleClick: N,
225
+ textAlign: E
223
226
  }
224
227
  )
225
228
  ]
@@ -227,6 +230,6 @@ const ot = ({
227
230
  );
228
231
  };
229
232
  export {
230
- ot as SubtitlePlayer,
231
- ot as default
233
+ ct as SubtitlePlayer,
234
+ ct as default
232
235
  };
@@ -0,0 +1 @@
1
+ .xiping-text-animate{white-space:pre-wrap}.xiping-text-animate-segment{display:inline-block;white-space:pre}.xiping-text-animate-segment--line{display:block}
@@ -1,13 +1,14 @@
1
1
  "use client";
2
2
  import { jsx as r } from "react/jsx-runtime";
3
- import { cn as y } from "../../utils/utils.js";
4
- import { motion as u, AnimatePresence as g } from "motion/react";
3
+ import { motion as y, AnimatePresence as w } from "motion/react";
4
+ import u from "clsx";
5
+ import './TextAnimate.css';/* empty css */
5
6
  const s = {
6
7
  text: 0.06,
7
8
  word: 0.05,
8
9
  character: 0.03,
9
10
  line: 0.06
10
- }, t = {
11
+ }, i = {
11
12
  hidden: { opacity: 1 },
12
13
  show: {
13
14
  opacity: 1,
@@ -32,14 +33,14 @@ const s = {
32
33
  }
33
34
  }, o = {
34
35
  fadeIn: {
35
- container: t,
36
+ container: i,
36
37
  item: {
37
38
  hidden: { opacity: 0, y: 20 },
38
- show: (i) => ({
39
+ show: (t) => ({
39
40
  opacity: 1,
40
41
  y: 0,
41
42
  transition: {
42
- delay: i,
43
+ delay: t,
43
44
  duration: 0.3
44
45
  }
45
46
  }),
@@ -51,14 +52,14 @@ const s = {
51
52
  }
52
53
  },
53
54
  blurIn: {
54
- container: t,
55
+ container: i,
55
56
  item: {
56
57
  hidden: { opacity: 0, filter: "blur(10px)" },
57
- show: (i) => ({
58
+ show: (t) => ({
58
59
  opacity: 1,
59
60
  filter: "blur(0px)",
60
61
  transition: {
61
- delay: i * 0.1,
62
+ delay: t * 0.1,
62
63
  duration: 0.3
63
64
  }
64
65
  }),
@@ -70,10 +71,10 @@ const s = {
70
71
  }
71
72
  },
72
73
  blurInUp: {
73
- container: t,
74
+ container: i,
74
75
  item: {
75
76
  hidden: { opacity: 0, filter: "blur(10px)", y: 20 },
76
- show: (i) => ({
77
+ show: (t) => ({
77
78
  opacity: 1,
78
79
  filter: "blur(0px)",
79
80
  y: 0,
@@ -96,10 +97,10 @@ const s = {
96
97
  }
97
98
  },
98
99
  blurInDown: {
99
- container: t,
100
+ container: i,
100
101
  item: {
101
102
  hidden: { opacity: 0, filter: "blur(10px)", y: -20 },
102
- show: (i) => ({
103
+ show: (t) => ({
103
104
  opacity: 1,
104
105
  filter: "blur(0px)",
105
106
  y: 0,
@@ -112,14 +113,14 @@ const s = {
112
113
  }
113
114
  },
114
115
  slideUp: {
115
- container: t,
116
+ container: i,
116
117
  item: {
117
118
  hidden: { y: 20, opacity: 0 },
118
- show: (i) => ({
119
+ show: (t) => ({
119
120
  y: 0,
120
121
  opacity: 1,
121
122
  transition: {
122
- delay: i,
123
+ delay: t,
123
124
  duration: 0.3
124
125
  }
125
126
  }),
@@ -133,7 +134,7 @@ const s = {
133
134
  }
134
135
  },
135
136
  slideDown: {
136
- container: t,
137
+ container: i,
137
138
  item: {
138
139
  hidden: { y: -20, opacity: 0 },
139
140
  show: {
@@ -149,7 +150,7 @@ const s = {
149
150
  }
150
151
  },
151
152
  slideLeft: {
152
- container: t,
153
+ container: i,
153
154
  item: {
154
155
  hidden: { x: 20, opacity: 0 },
155
156
  show: {
@@ -165,7 +166,7 @@ const s = {
165
166
  }
166
167
  },
167
168
  slideRight: {
168
- container: t,
169
+ container: i,
169
170
  item: {
170
171
  hidden: { x: -20, opacity: 0 },
171
172
  show: {
@@ -181,7 +182,7 @@ const s = {
181
182
  }
182
183
  },
183
184
  scaleUp: {
184
- container: t,
185
+ container: i,
185
186
  item: {
186
187
  hidden: { scale: 0.5, opacity: 0 },
187
188
  show: {
@@ -204,14 +205,14 @@ const s = {
204
205
  }
205
206
  },
206
207
  scaleDown: {
207
- container: t,
208
+ container: i,
208
209
  item: {
209
210
  hidden: { scale: 1.5, opacity: 0 },
210
- show: (i) => ({
211
+ show: (t) => ({
211
212
  scale: 1,
212
213
  opacity: 1,
213
214
  transition: {
214
- delay: i,
215
+ delay: t,
215
216
  duration: 0.3,
216
217
  scale: {
217
218
  type: "spring",
@@ -228,81 +229,82 @@ const s = {
228
229
  }
229
230
  }
230
231
  };
231
- function U({
232
- children: i,
232
+ function $({
233
+ children: t,
233
234
  delay: I = 0,
234
- duration: k = 0.3,
235
- variants: C,
236
- className: h,
237
- segmentClassName: x,
235
+ duration: C = 0.3,
236
+ variants: v,
237
+ className: x,
238
+ segmentClassName: h,
238
239
  as: m = "p",
239
240
  startOnView: c = !0,
240
- once: v = !1,
241
- by: a = "word",
242
- animation: n = "fadeIn",
241
+ once: D = !1,
242
+ by: n = "word",
243
+ animation: a = "fadeIn",
243
244
  ...f
244
245
  }) {
245
- const w = u.create(m), d = n ? {
246
+ const g = y.create(m), d = a ? {
246
247
  container: {
247
- ...o[n].container,
248
+ ...o[a].container,
248
249
  show: {
249
- ...o[n].container.show,
250
+ ...o[a].container.show,
250
251
  transition: {
251
- staggerChildren: s[a]
252
+ staggerChildren: s[n]
252
253
  }
253
254
  },
254
255
  exit: {
255
- ...o[n].container.exit,
256
+ ...o[a].container.exit,
256
257
  transition: {
257
- staggerChildren: s[a],
258
+ staggerChildren: s[n],
258
259
  staggerDirection: -1
259
260
  }
260
261
  }
261
262
  },
262
- item: o[n].item
263
- } : { container: t, item: b };
263
+ item: o[a].item
264
+ } : { container: i, item: b };
264
265
  let e = [];
265
- switch (a) {
266
+ switch (n) {
266
267
  case "word":
267
- e = i.split(/(\s+)/);
268
+ e = t.split(/(\s+)/);
268
269
  break;
269
270
  case "character":
270
- e = i.split("");
271
+ e = t.split("");
271
272
  break;
272
273
  case "line":
273
- e = i.split(`
274
+ e = t.split(`
274
275
  `);
275
276
  break;
276
277
  default:
277
- e = [i];
278
+ e = [t];
278
279
  break;
279
280
  }
280
- return /* @__PURE__ */ r(g, { mode: "popLayout", children: /* @__PURE__ */ r(
281
- w,
281
+ return /* @__PURE__ */ r(w, { mode: "popLayout", children: /* @__PURE__ */ r(
282
+ g,
282
283
  {
283
284
  variants: d.container,
284
285
  initial: "hidden",
285
286
  whileInView: c ? "show" : void 0,
286
287
  animate: c ? void 0 : "show",
287
288
  exit: "exit",
288
- className: y("whitespace-pre-wrap", h),
289
+ className: u("xiping-text-animate", x),
289
290
  ...f,
290
291
  children: e.map((p, l) => /* @__PURE__ */ r(
291
- u.span,
292
+ y.span,
292
293
  {
293
294
  variants: d.item,
294
- custom: l * s[a],
295
- className: y(
296
- a === "line" ? "block" : "inline-block whitespace-pre",
297
- x
295
+ custom: l * s[n],
296
+ className: u(
297
+ "xiping-text-animate-segment",
298
+ n === "line" && "xiping-text-animate-segment--line",
299
+ h
298
300
  ),
299
301
  children: p
300
302
  },
301
- `${a}-${p}-${l}`
303
+ `${n}-${p}-${l}`
302
304
  ))
303
305
  }
304
306
  ) });
305
307
  }
306
308
  export {
307
- U as TextAnimate
309
+ $ as TextAnimate
308
310
  };
@@ -0,0 +1 @@
1
+ .xiping-text-type{display:inline-block;white-space:pre-wrap}.xiping-text-type__content{display:inline-block}.xiping-text-type__cursor{margin-left:.25rem;display:inline-block;opacity:1}.xiping-text-type__cursor--hidden{display:none}
@@ -2,8 +2,9 @@
2
2
  import { jsx as b } from "react/jsx-runtime";
3
3
  import { useState as o, useRef as k, useMemo as U, useCallback as V, useEffect as I, createElement as W } from "react";
4
4
  import { gsap as q } from "gsap";
5
- /* empty css */
6
- const D = ({
5
+ import X from "clsx";
6
+ import './TextType.css';/* empty css */
7
+ const ee = ({
7
8
  text: u,
8
9
  as: v = "div",
9
10
  typingSpeed: f = 50,
@@ -20,11 +21,11 @@ const D = ({
20
21
  textColors: g = [],
21
22
  variableSpeed: c,
22
23
  onSentenceComplete: d,
23
- startOnVisible: y = !1,
24
+ startOnVisible: p = !1,
24
25
  reverseMode: N = !1,
25
26
  ...J
26
27
  }) => {
27
- const [l, $] = o(""), [i, j] = o(0), [a, C] = o(!1), [t, K] = o(0), [H, L] = o(!y), m = k(null), p = k(null), r = U(() => Array.isArray(u) ? u : [u], [u]), O = V(() => {
28
+ const [l, j] = o(""), [i, C] = o(0), [a, H] = o(!1), [t, K] = o(0), [M, L] = o(!p), m = k(null), y = k(null), r = U(() => Array.isArray(u) ? u : [u], [u]), O = V(() => {
28
29
  if (!c) return f;
29
30
  const { min: e, max: n } = c;
30
31
  return Math.random() * (n - e) + e;
@@ -33,7 +34,7 @@ const D = ({
33
34
  return g[t % g.length];
34
35
  };
35
36
  I(() => {
36
- if (!y || !p.current) return;
37
+ if (!p || !y.current) return;
37
38
  const e = new IntersectionObserver(
38
39
  (n) => {
39
40
  n.forEach((x) => {
@@ -42,8 +43,8 @@ const D = ({
42
43
  },
43
44
  { threshold: 0.1 }
44
45
  );
45
- return e.observe(p.current), () => e.disconnect();
46
- }, [y]), I(() => {
46
+ return e.observe(y.current), () => e.disconnect();
47
+ }, [p]), I(() => {
47
48
  T && m.current && (q.set(m.current, { opacity: 1 }), q.to(m.current, {
48
49
  opacity: 0,
49
50
  duration: E,
@@ -52,30 +53,30 @@ const D = ({
52
53
  ease: "power2.inOut"
53
54
  }));
54
55
  }, [T, E]), I(() => {
55
- if (!H) return;
56
+ if (!M) return;
56
57
  let e;
57
- const n = r[t], x = N ? n.split("").reverse().join("") : n, M = () => {
58
+ const n = r[t], x = N ? n.split("").reverse().join("") : n, $ = () => {
58
59
  if (a)
59
60
  if (l === "") {
60
- if (C(!1), t === r.length - 1 && !R)
61
+ if (H(!1), t === r.length - 1 && !R)
61
62
  return;
62
- d && d(r[t], t), K((s) => (s + 1) % r.length), j(0), e = setTimeout(() => {
63
+ d && d(r[t], t), K((s) => (s + 1) % r.length), C(0), e = setTimeout(() => {
63
64
  }, h);
64
65
  } else
65
66
  e = setTimeout(() => {
66
- $((s) => s.slice(0, -1));
67
+ j((s) => s.slice(0, -1));
67
68
  }, A);
68
69
  else
69
70
  i < x.length ? e = setTimeout(
70
71
  () => {
71
- $((s) => s + x[i]), j((s) => s + 1);
72
+ j((s) => s + x[i]), C((s) => s + 1);
72
73
  },
73
74
  c ? O() : f
74
75
  ) : r.length > 1 && (e = setTimeout(() => {
75
- C(!0);
76
+ H(!0);
76
77
  }, h));
77
78
  };
78
- return i === 0 && !a && l === "" ? e = setTimeout(M, _) : M(), () => clearTimeout(e);
79
+ return i === 0 && !a && l === "" ? e = setTimeout($, _) : $(), () => clearTimeout(e);
79
80
  }, [
80
81
  i,
81
82
  l,
@@ -87,7 +88,7 @@ const D = ({
87
88
  t,
88
89
  R,
89
90
  _,
90
- H,
91
+ M,
91
92
  N,
92
93
  c,
93
94
  d
@@ -96,7 +97,7 @@ const D = ({
96
97
  return W(
97
98
  v,
98
99
  {
99
- ref: p,
100
+ ref: y,
100
101
  className: `xiping-text-type ${w}`,
101
102
  ...J
102
103
  },
@@ -105,12 +106,16 @@ const D = ({
105
106
  "span",
106
107
  {
107
108
  ref: m,
108
- className: `xiping-text-type__cursor ${G} ${Q ? "xiping-text-type__cursor--hidden" : ""}`,
109
+ className: X(
110
+ "xiping-text-type__cursor",
111
+ G,
112
+ Q && "xiping-text-type__cursor--hidden"
113
+ ),
109
114
  children: F
110
115
  }
111
116
  )
112
117
  );
113
118
  };
114
119
  export {
115
- D as default
120
+ ee as default
116
121
  };
@@ -0,0 +1 @@
1
+ ._xiping-top-progress_rkm9f_23{position:fixed;left:0;top:0;right:0;background-color:#f08;height:10px}._xiping-container_rkm9f_33{position:relative;width:100%;height:100%;overflow-y:auto}._xiping-content_rkm9f_41{width:100%;white-space:pre-wrap;word-break:break-word}._xiping-bottom-progress_rkm9f_48{position:fixed;color:#fff;border-radius:4px;font-size:.875rem;background-color:#000000b3;padding:.25rem .5rem;right:1.25rem;bottom:1.25rem}._xiping-text-content_rkm9f_63::-webkit-scrollbar{width:8px}._xiping-text-content_rkm9f_63::-webkit-scrollbar-thumb{box-shadow:inset 0 0 5px #0003;background:#0003}._xiping-text-content_rkm9f_63::-webkit-scrollbar-track{box-shadow:inset 0 0 5px #0003;border-radius:0;background:#00000014}
@@ -1,4 +1,4 @@
1
- const t = {
1
+ import './index.module.css';const t = {
2
2
  "xiping-top-progress": "_xiping-top-progress_rkm9f_23",
3
3
  "xiping-container": "_xiping-container_rkm9f_33",
4
4
  "xiping-content": "_xiping-content_rkm9f_41",
@@ -0,0 +1 @@
1
+ .xiping-typing-animation{font-size:2.25rem;font-weight:700;line-height:5rem;letter-spacing:-.02em}