@xiping/react-components 1.0.70 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.js +1 -0
  2. package/dist/cjs/components/blur-fade/BlurFade.js +1 -1
  3. package/dist/cjs/components/blur-text/BlurText.js +1 -1
  4. package/dist/cjs/components/button/Button.css +1 -1
  5. package/dist/cjs/components/button/Button2.js +1 -0
  6. package/dist/cjs/components/comic-text/ComicText2.js +4 -0
  7. package/dist/cjs/components/confetti-button/index.js +1 -1
  8. package/dist/cjs/components/dock/Duck.css +1 -1
  9. package/dist/cjs/components/dock/Duck2.js +1 -0
  10. package/dist/cjs/components/flip-text/FlipText.css +1 -1
  11. package/dist/cjs/components/flip-text/FlipText2.js +1 -0
  12. package/dist/cjs/components/gradient-text/index.css +1 -1
  13. package/dist/cjs/components/gradient-text/index2.js +1 -0
  14. package/dist/cjs/components/hyper-text/HyperText.css +1 -1
  15. package/dist/cjs/components/hyper-text/index.js +1 -1
  16. package/dist/cjs/components/image-compare/ImageCompare.css +1 -1
  17. package/dist/cjs/components/image-compare/ImageCompare2.js +1 -0
  18. package/dist/cjs/components/image-viewer/ImageThumbnails.css +1 -1
  19. package/dist/cjs/components/image-viewer/ImageThumbnails2.js +1 -0
  20. package/dist/cjs/components/image-viewer/ImageViewer.css +1 -1
  21. package/dist/cjs/components/image-viewer/ImageViewer.d.ts +1 -1
  22. package/dist/cjs/components/image-viewer/ImageViewer2.js +1 -0
  23. package/dist/cjs/components/message/Message.css +1 -1
  24. package/dist/cjs/components/message/Message2.js +1 -0
  25. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  26. package/dist/cjs/components/pinch-content/index.js +1 -1
  27. package/dist/cjs/components/pointer/Pointer.css +1 -1
  28. package/dist/cjs/components/pointer/Pointer2.js +1 -0
  29. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.css +1 -1
  30. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal2.js +1 -0
  31. package/dist/cjs/components/shimmer-button/ShimmerButton.css +1 -1
  32. package/dist/cjs/components/shimmer-button/ShimmerButton2.js +1 -0
  33. package/dist/cjs/components/shiny-button/ShinyButton.css +1 -1
  34. package/dist/cjs/components/shiny-button/ShinyButton2.js +1 -0
  35. package/dist/cjs/components/shiny-text/ShinyText2.js +1 -0
  36. package/dist/cjs/components/sparkles-text/SparklesText.css +1 -1
  37. package/dist/cjs/components/sparkles-text/SparklesText2.js +1 -0
  38. package/dist/cjs/components/split-text/SplitText.css +1 -1
  39. package/dist/cjs/components/split-text/SplitText2.js +1 -0
  40. package/dist/cjs/components/subtitle-player/CurrentMode.css +1 -1
  41. package/dist/cjs/components/subtitle-player/CurrentMode2.js +2 -0
  42. package/dist/cjs/components/subtitle-player/LyricsMode.css +1 -1
  43. package/dist/cjs/components/subtitle-player/LyricsMode2.js +2 -0
  44. package/dist/cjs/components/subtitle-player/SubtitlePlayer.css +1 -1
  45. package/dist/cjs/components/subtitle-player/SubtitlePlayer2.js +1 -0
  46. package/dist/cjs/components/subtitle-player/utils.js +1 -1
  47. package/dist/cjs/components/text-animate/TextAnimate.css +1 -1
  48. package/dist/cjs/components/text-animate/TextAnimate2.js +2 -0
  49. package/dist/cjs/components/text-type/TextType.css +1 -1
  50. package/dist/cjs/components/text-type/TextType2.js +1 -0
  51. package/dist/cjs/components/txt-editor/TxtEditor.js +4 -4
  52. package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
  53. package/dist/cjs/components/txt-reader/index.module.css +1 -1
  54. package/dist/cjs/components/txt-reader/index.module.js +1 -0
  55. package/dist/cjs/components/typing-animation/index.css +1 -1
  56. package/dist/cjs/components/typing-animation/index2.js +1 -0
  57. package/dist/cjs/components/variable-proximity/index.css +1 -1
  58. package/dist/cjs/components/variable-proximity/index2.js +1 -0
  59. package/dist/cjs/components/video-dialog/VideoDialog.css +1 -1
  60. package/dist/cjs/components/video-dialog/VideoDialog2.js +1 -0
  61. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
  62. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
  63. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
  64. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer2.js +1 -0
  65. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +1 -1
  66. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerPC.js +1 -1
  67. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +1 -1
  68. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +1 -1
  69. package/dist/cjs/components/video-subtitle-player/useVideoSubtitleStore.js +1 -1
  70. package/dist/cjs/components/video-subtitle-player/useXGPlayer.js +1 -1
  71. package/dist/cjs/hooks/useStayTimeReport.js +1 -1
  72. package/dist/cjs/index.js +1 -1
  73. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -1
  74. package/dist/cjs/packages/subtitle/lib/index.js +1 -0
  75. package/dist/cjs/packages/subtitle/lib/src/json-converter.js +1 -1
  76. package/dist/cjs/packages/subtitle/lib/src/parser.js +5 -5
  77. package/dist/cjs/react-components.css +27 -27
  78. package/dist/es/components/blur-fade/BlurFade.js +37 -49
  79. package/dist/es/components/blur-text/BlurText.js +67 -76
  80. package/dist/es/components/button/Button.css +1 -1
  81. package/dist/es/components/button/Button2.js +48 -0
  82. package/dist/es/components/comic-text/ComicText2.js +55 -0
  83. package/dist/es/components/confetti-button/index.js +63 -75
  84. package/dist/es/components/dock/Duck.css +1 -1
  85. package/dist/es/components/dock/Duck2.js +60 -0
  86. package/dist/es/components/flip-text/FlipText.css +1 -1
  87. package/dist/es/components/flip-text/FlipText2.js +41 -0
  88. package/dist/es/components/gradient-text/index.css +1 -1
  89. package/dist/es/components/gradient-text/index2.js +29 -0
  90. package/dist/es/components/hyper-text/HyperText.css +1 -1
  91. package/dist/es/components/hyper-text/index.js +51 -79
  92. package/dist/es/components/image-compare/ImageCompare.css +1 -1
  93. package/dist/es/components/image-compare/ImageCompare2.js +96 -0
  94. package/dist/es/components/image-viewer/ImageThumbnails.css +1 -1
  95. package/dist/es/components/image-viewer/ImageThumbnails2.js +40 -0
  96. package/dist/es/components/image-viewer/ImageViewer.css +1 -1
  97. package/dist/es/components/image-viewer/ImageViewer.d.ts +1 -1
  98. package/dist/es/components/image-viewer/ImageViewer2.js +151 -0
  99. package/dist/es/components/message/Message.css +1 -1
  100. package/dist/es/components/message/Message2.js +189 -0
  101. package/dist/es/components/pinch-content/PinchContent.js +120 -127
  102. package/dist/es/components/pinch-content/index.js +5 -5
  103. package/dist/es/components/pointer/Pointer.css +1 -1
  104. package/dist/es/components/pointer/Pointer2.js +61 -0
  105. package/dist/es/components/react-force-graph-3d/index.js +2 -0
  106. package/dist/es/components/scratch-to-reveal/ScratchToReveal.css +1 -1
  107. package/dist/es/components/scratch-to-reveal/ScratchToReveal2.js +88 -0
  108. package/dist/es/components/shimmer-button/ShimmerButton.css +1 -1
  109. package/dist/es/components/shimmer-button/ShimmerButton2.js +33 -0
  110. package/dist/es/components/shiny-button/ShinyButton.css +1 -1
  111. package/dist/es/components/shiny-button/ShinyButton2.js +53 -0
  112. package/dist/es/components/shiny-text/ShinyText2.js +61 -0
  113. package/dist/es/components/sparkles-text/SparklesText.css +1 -1
  114. package/dist/es/components/sparkles-text/SparklesText2.js +90 -0
  115. package/dist/es/components/split-text/SplitText.css +1 -1
  116. package/dist/es/components/split-text/SplitText2.js +109 -0
  117. package/dist/es/components/subtitle-player/CurrentMode.css +1 -1
  118. package/dist/es/components/subtitle-player/CurrentMode2.js +44 -0
  119. package/dist/es/components/subtitle-player/LyricsMode.css +1 -1
  120. package/dist/es/components/subtitle-player/LyricsMode2.js +114 -0
  121. package/dist/es/components/subtitle-player/SubtitlePlayer.css +1 -1
  122. package/dist/es/components/subtitle-player/SubtitlePlayer2.js +169 -0
  123. package/dist/es/components/subtitle-player/utils.js +63 -69
  124. package/dist/es/components/text-animate/TextAnimate.css +1 -1
  125. package/dist/es/components/text-animate/TextAnimate2.js +312 -0
  126. package/dist/es/components/text-type/TextType.css +1 -1
  127. package/dist/es/components/text-type/TextType2.js +80 -0
  128. package/dist/es/components/txt-editor/TxtEditor.js +60 -95
  129. package/dist/es/components/txt-reader/TxtReader.js +45 -74
  130. package/dist/es/components/txt-reader/index.module.css +1 -1
  131. package/dist/es/components/txt-reader/index.module.js +10 -0
  132. package/dist/es/components/typing-animation/index.css +1 -1
  133. package/dist/es/components/typing-animation/index2.js +43 -0
  134. package/dist/es/components/variable-proximity/index.css +1 -1
  135. package/dist/es/components/variable-proximity/index2.js +179 -0
  136. package/dist/es/components/video-dialog/VideoDialog.css +1 -1
  137. package/dist/es/components/video-dialog/VideoDialog2.js +168 -0
  138. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
  139. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
  140. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
  141. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer2.js +43 -0
  142. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +29 -46
  143. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerPC.js +94 -74
  144. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +24 -21
  145. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +58 -50
  146. package/dist/es/components/video-subtitle-player/useVideoSubtitleStore.js +61 -56
  147. package/dist/es/components/video-subtitle-player/useXGPlayer.js +38 -35
  148. package/dist/es/hooks/useStayTimeReport.js +29 -29
  149. package/dist/es/index.js +33 -70
  150. package/dist/es/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -1
  151. package/dist/es/packages/subtitle/lib/index.js +2 -0
  152. package/dist/es/packages/subtitle/lib/src/json-converter.js +22 -23
  153. package/dist/es/packages/subtitle/lib/src/parser.js +41 -54
  154. package/dist/es/react-components.css +27 -27
  155. package/package.json +25 -27
  156. package/dist/cjs/components/button/Button.js +0 -1
  157. package/dist/cjs/components/comic-text/ComicText.js +0 -4
  158. package/dist/cjs/components/dock/Duck.js +0 -1
  159. package/dist/cjs/components/flip-text/FlipText.js +0 -1
  160. package/dist/cjs/components/gradient-text/index.js +0 -1
  161. package/dist/cjs/components/image-compare/ImageCompare.js +0 -1
  162. package/dist/cjs/components/image-viewer/ImageThumbnails.js +0 -1
  163. package/dist/cjs/components/image-viewer/ImageViewer.js +0 -1
  164. package/dist/cjs/components/message/Message.js +0 -1
  165. package/dist/cjs/components/pointer/Pointer.js +0 -1
  166. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +0 -1
  167. package/dist/cjs/components/shimmer-button/ShimmerButton.js +0 -1
  168. package/dist/cjs/components/shiny-button/ShinyButton.js +0 -1
  169. package/dist/cjs/components/shiny-text/ShinyText.js +0 -1
  170. package/dist/cjs/components/sparkles-text/SparklesText.js +0 -1
  171. package/dist/cjs/components/split-text/SplitText.js +0 -1
  172. package/dist/cjs/components/subtitle-player/CurrentMode.js +0 -2
  173. package/dist/cjs/components/subtitle-player/LyricsMode.js +0 -2
  174. package/dist/cjs/components/subtitle-player/SubtitlePlayer.js +0 -1
  175. package/dist/cjs/components/text-animate/TextAnimate.js +0 -2
  176. package/dist/cjs/components/text-type/TextType.js +0 -1
  177. package/dist/cjs/components/txt-reader/index.module.css.js +0 -1
  178. package/dist/cjs/components/typing-animation/index.js +0 -1
  179. package/dist/cjs/components/variable-proximity/index.js +0 -1
  180. package/dist/cjs/components/video-dialog/VideoDialog.js +0 -1
  181. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -1
  182. package/dist/es/components/button/Button.js +0 -72
  183. package/dist/es/components/comic-text/ComicText.js +0 -52
  184. package/dist/es/components/dock/Duck.js +0 -80
  185. package/dist/es/components/flip-text/FlipText.js +0 -38
  186. package/dist/es/components/gradient-text/index.js +0 -22
  187. package/dist/es/components/image-compare/ImageCompare.js +0 -127
  188. package/dist/es/components/image-viewer/ImageThumbnails.js +0 -73
  189. package/dist/es/components/image-viewer/ImageViewer.js +0 -141
  190. package/dist/es/components/message/Message.js +0 -220
  191. package/dist/es/components/pointer/Pointer.js +0 -75
  192. package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +0 -97
  193. package/dist/es/components/shimmer-button/ShimmerButton.js +0 -42
  194. package/dist/es/components/shiny-button/ShinyButton.js +0 -61
  195. package/dist/es/components/shiny-text/ShinyText.js +0 -76
  196. package/dist/es/components/sparkles-text/SparklesText.js +0 -71
  197. package/dist/es/components/split-text/SplitText.js +0 -116
  198. package/dist/es/components/subtitle-player/CurrentMode.js +0 -78
  199. package/dist/es/components/subtitle-player/LyricsMode.js +0 -152
  200. package/dist/es/components/subtitle-player/SubtitlePlayer.js +0 -234
  201. package/dist/es/components/text-animate/TextAnimate.js +0 -310
  202. package/dist/es/components/text-type/TextType.js +0 -121
  203. package/dist/es/components/txt-reader/index.module.css.js +0 -10
  204. package/dist/es/components/typing-animation/index.js +0 -56
  205. package/dist/es/components/variable-proximity/index.js +0 -211
  206. package/dist/es/components/video-dialog/VideoDialog.js +0 -113
  207. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -74
@@ -1,310 +0,0 @@
1
- "use client";
2
- import { jsx as r } from "react/jsx-runtime";
3
- import { motion as y, AnimatePresence as w } from "motion/react";
4
- import u from "clsx";
5
- import './TextAnimate.css';/* empty css */
6
- const s = {
7
- text: 0.06,
8
- word: 0.05,
9
- character: 0.03,
10
- line: 0.06
11
- }, i = {
12
- hidden: { opacity: 1 },
13
- show: {
14
- opacity: 1,
15
- transition: {
16
- staggerChildren: 0.05
17
- }
18
- },
19
- exit: {
20
- opacity: 0,
21
- transition: {
22
- staggerChildren: 0.05,
23
- staggerDirection: -1
24
- }
25
- }
26
- }, b = {
27
- hidden: { opacity: 0 },
28
- show: {
29
- opacity: 1
30
- },
31
- exit: {
32
- opacity: 0
33
- }
34
- }, o = {
35
- fadeIn: {
36
- container: i,
37
- item: {
38
- hidden: { opacity: 0, y: 20 },
39
- show: (t) => ({
40
- opacity: 1,
41
- y: 0,
42
- transition: {
43
- delay: t,
44
- duration: 0.3
45
- }
46
- }),
47
- exit: {
48
- opacity: 0,
49
- y: 20,
50
- transition: { duration: 0.3 }
51
- }
52
- }
53
- },
54
- blurIn: {
55
- container: i,
56
- item: {
57
- hidden: { opacity: 0, filter: "blur(10px)" },
58
- show: (t) => ({
59
- opacity: 1,
60
- filter: "blur(0px)",
61
- transition: {
62
- delay: t * 0.1,
63
- duration: 0.3
64
- }
65
- }),
66
- exit: {
67
- opacity: 0,
68
- filter: "blur(10px)",
69
- transition: { duration: 0.3 }
70
- }
71
- }
72
- },
73
- blurInUp: {
74
- container: i,
75
- item: {
76
- hidden: { opacity: 0, filter: "blur(10px)", y: 20 },
77
- show: (t) => ({
78
- opacity: 1,
79
- filter: "blur(0px)",
80
- y: 0,
81
- transition: {
82
- y: { duration: 0.3 },
83
- opacity: { duration: 0.4 },
84
- filter: { duration: 0.3 }
85
- }
86
- }),
87
- exit: {
88
- opacity: 0,
89
- filter: "blur(10px)",
90
- y: 20,
91
- transition: {
92
- y: { duration: 0.3 },
93
- opacity: { duration: 0.4 },
94
- filter: { duration: 0.3 }
95
- }
96
- }
97
- }
98
- },
99
- blurInDown: {
100
- container: i,
101
- item: {
102
- hidden: { opacity: 0, filter: "blur(10px)", y: -20 },
103
- show: (t) => ({
104
- opacity: 1,
105
- filter: "blur(0px)",
106
- y: 0,
107
- transition: {
108
- y: { duration: 0.3 },
109
- opacity: { duration: 0.4 },
110
- filter: { duration: 0.3 }
111
- }
112
- })
113
- }
114
- },
115
- slideUp: {
116
- container: i,
117
- item: {
118
- hidden: { y: 20, opacity: 0 },
119
- show: (t) => ({
120
- y: 0,
121
- opacity: 1,
122
- transition: {
123
- delay: t,
124
- duration: 0.3
125
- }
126
- }),
127
- exit: {
128
- y: -20,
129
- opacity: 0,
130
- transition: {
131
- duration: 0.3
132
- }
133
- }
134
- }
135
- },
136
- slideDown: {
137
- container: i,
138
- item: {
139
- hidden: { y: -20, opacity: 0 },
140
- show: {
141
- y: 0,
142
- opacity: 1,
143
- transition: { duration: 0.3 }
144
- },
145
- exit: {
146
- y: 20,
147
- opacity: 0,
148
- transition: { duration: 0.3 }
149
- }
150
- }
151
- },
152
- slideLeft: {
153
- container: i,
154
- item: {
155
- hidden: { x: 20, opacity: 0 },
156
- show: {
157
- x: 0,
158
- opacity: 1,
159
- transition: { duration: 0.3 }
160
- },
161
- exit: {
162
- x: -20,
163
- opacity: 0,
164
- transition: { duration: 0.3 }
165
- }
166
- }
167
- },
168
- slideRight: {
169
- container: i,
170
- item: {
171
- hidden: { x: -20, opacity: 0 },
172
- show: {
173
- x: 0,
174
- opacity: 1,
175
- transition: { duration: 0.3 }
176
- },
177
- exit: {
178
- x: 20,
179
- opacity: 0,
180
- transition: { duration: 0.3 }
181
- }
182
- }
183
- },
184
- scaleUp: {
185
- container: i,
186
- item: {
187
- hidden: { scale: 0.5, opacity: 0 },
188
- show: {
189
- scale: 1,
190
- opacity: 1,
191
- transition: {
192
- duration: 0.3,
193
- scale: {
194
- type: "spring",
195
- damping: 15,
196
- stiffness: 300
197
- }
198
- }
199
- },
200
- exit: {
201
- scale: 0.5,
202
- opacity: 0,
203
- transition: { duration: 0.3 }
204
- }
205
- }
206
- },
207
- scaleDown: {
208
- container: i,
209
- item: {
210
- hidden: { scale: 1.5, opacity: 0 },
211
- show: (t) => ({
212
- scale: 1,
213
- opacity: 1,
214
- transition: {
215
- delay: t,
216
- duration: 0.3,
217
- scale: {
218
- type: "spring",
219
- damping: 15,
220
- stiffness: 300
221
- }
222
- }
223
- }),
224
- exit: {
225
- scale: 1.5,
226
- opacity: 0,
227
- transition: { duration: 0.3 }
228
- }
229
- }
230
- }
231
- };
232
- function $({
233
- children: t,
234
- delay: I = 0,
235
- duration: C = 0.3,
236
- variants: v,
237
- className: x,
238
- segmentClassName: h,
239
- as: m = "p",
240
- startOnView: c = !0,
241
- once: D = !1,
242
- by: n = "word",
243
- animation: a = "fadeIn",
244
- ...f
245
- }) {
246
- const g = y.create(m), d = a ? {
247
- container: {
248
- ...o[a].container,
249
- show: {
250
- ...o[a].container.show,
251
- transition: {
252
- staggerChildren: s[n]
253
- }
254
- },
255
- exit: {
256
- ...o[a].container.exit,
257
- transition: {
258
- staggerChildren: s[n],
259
- staggerDirection: -1
260
- }
261
- }
262
- },
263
- item: o[a].item
264
- } : { container: i, item: b };
265
- let e = [];
266
- switch (n) {
267
- case "word":
268
- e = t.split(/(\s+)/);
269
- break;
270
- case "character":
271
- e = t.split("");
272
- break;
273
- case "line":
274
- e = t.split(`
275
- `);
276
- break;
277
- default:
278
- e = [t];
279
- break;
280
- }
281
- return /* @__PURE__ */ r(w, { mode: "popLayout", children: /* @__PURE__ */ r(
282
- g,
283
- {
284
- variants: d.container,
285
- initial: "hidden",
286
- whileInView: c ? "show" : void 0,
287
- animate: c ? void 0 : "show",
288
- exit: "exit",
289
- className: u("xiping-text-animate", x),
290
- ...f,
291
- children: e.map((p, l) => /* @__PURE__ */ r(
292
- y.span,
293
- {
294
- variants: d.item,
295
- custom: l * s[n],
296
- className: u(
297
- "xiping-text-animate-segment",
298
- n === "line" && "xiping-text-animate-segment--line",
299
- h
300
- ),
301
- children: p
302
- },
303
- `${n}-${p}-${l}`
304
- ))
305
- }
306
- ) });
307
- }
308
- export {
309
- $ as TextAnimate
310
- };
@@ -1,121 +0,0 @@
1
- "use client";
2
- import { jsx as b } from "react/jsx-runtime";
3
- import { useState as o, useRef as k, useMemo as U, useCallback as V, useEffect as I, createElement as W } from "react";
4
- import { gsap as q } from "gsap";
5
- import X from "clsx";
6
- import './TextType.css';/* empty css */
7
- const ee = ({
8
- text: u,
9
- as: v = "div",
10
- typingSpeed: f = 50,
11
- initialDelay: _ = 0,
12
- pauseDuration: h = 2e3,
13
- deletingSpeed: A = 30,
14
- loop: R = !0,
15
- className: w = "",
16
- showCursor: T = !0,
17
- hideCursorWhileTyping: z = !1,
18
- cursorCharacter: F = "|",
19
- cursorClassName: G = "",
20
- cursorBlinkDuration: E = 0.5,
21
- textColors: g = [],
22
- variableSpeed: c,
23
- onSentenceComplete: d,
24
- startOnVisible: p = !1,
25
- reverseMode: N = !1,
26
- ...J
27
- }) => {
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(() => {
29
- if (!c) return f;
30
- const { min: e, max: n } = c;
31
- return Math.random() * (n - e) + e;
32
- }, [c, f]), P = () => {
33
- if (g.length !== 0)
34
- return g[t % g.length];
35
- };
36
- I(() => {
37
- if (!p || !y.current) return;
38
- const e = new IntersectionObserver(
39
- (n) => {
40
- n.forEach((x) => {
41
- x.isIntersecting && L(!0);
42
- });
43
- },
44
- { threshold: 0.1 }
45
- );
46
- return e.observe(y.current), () => e.disconnect();
47
- }, [p]), I(() => {
48
- T && m.current && (q.set(m.current, { opacity: 1 }), q.to(m.current, {
49
- opacity: 0,
50
- duration: E,
51
- repeat: -1,
52
- yoyo: !0,
53
- ease: "power2.inOut"
54
- }));
55
- }, [T, E]), I(() => {
56
- if (!M) return;
57
- let e;
58
- const n = r[t], x = N ? n.split("").reverse().join("") : n, $ = () => {
59
- if (a)
60
- if (l === "") {
61
- if (H(!1), t === r.length - 1 && !R)
62
- return;
63
- d && d(r[t], t), K((s) => (s + 1) % r.length), C(0), e = setTimeout(() => {
64
- }, h);
65
- } else
66
- e = setTimeout(() => {
67
- j((s) => s.slice(0, -1));
68
- }, A);
69
- else
70
- i < x.length ? e = setTimeout(
71
- () => {
72
- j((s) => s + x[i]), C((s) => s + 1);
73
- },
74
- c ? O() : f
75
- ) : r.length > 1 && (e = setTimeout(() => {
76
- H(!0);
77
- }, h));
78
- };
79
- return i === 0 && !a && l === "" ? e = setTimeout($, _) : $(), () => clearTimeout(e);
80
- }, [
81
- i,
82
- l,
83
- a,
84
- f,
85
- A,
86
- h,
87
- r,
88
- t,
89
- R,
90
- _,
91
- M,
92
- N,
93
- c,
94
- d
95
- ]);
96
- const Q = z && (i < r[t].length || a);
97
- return W(
98
- v,
99
- {
100
- ref: y,
101
- className: `xiping-text-type ${w}`,
102
- ...J
103
- },
104
- /* @__PURE__ */ b("span", { className: "xiping-text-type__content", style: { color: P() || "inherit" }, children: l }),
105
- T && /* @__PURE__ */ b(
106
- "span",
107
- {
108
- ref: m,
109
- className: X(
110
- "xiping-text-type__cursor",
111
- G,
112
- Q && "xiping-text-type__cursor--hidden"
113
- ),
114
- children: F
115
- }
116
- )
117
- );
118
- };
119
- export {
120
- ee as default
121
- };
@@ -1,10 +0,0 @@
1
- import './index.module.css';const t = {
2
- "xiping-top-progress": "_xiping-top-progress_rkm9f_23",
3
- "xiping-container": "_xiping-container_rkm9f_33",
4
- "xiping-content": "_xiping-content_rkm9f_41",
5
- "xiping-bottom-progress": "_xiping-bottom-progress_rkm9f_48",
6
- "xiping-text-content": "_xiping-text-content_rkm9f_63"
7
- };
8
- export {
9
- t as default
10
- };
@@ -1,56 +0,0 @@
1
- "use client";
2
- import { jsx as d } from "react/jsx-runtime";
3
- import { motion as x } from "motion/react";
4
- import { useState as u, useRef as I, useEffect as m } from "react";
5
- import b from "clsx";
6
- import './index.css';/* empty css */
7
- function S({
8
- children: r,
9
- className: a,
10
- duration: s = 100,
11
- delay: n = 0,
12
- as: l = "div",
13
- startOnView: i = !1,
14
- ...p
15
- }) {
16
- const g = x.create(l, {
17
- forwardMotionProps: !0
18
- }), [v, T] = u(""), [c, f] = u(!1), o = I(null);
19
- return m(() => {
20
- if (!i) {
21
- const t = setTimeout(() => {
22
- f(!0);
23
- }, n);
24
- return () => clearTimeout(t);
25
- }
26
- const e = new IntersectionObserver(
27
- ([t]) => {
28
- t.isIntersecting && (setTimeout(() => {
29
- f(!0);
30
- }, n), e.disconnect());
31
- },
32
- { threshold: 0.1 }
33
- );
34
- return o.current && e.observe(o.current), () => e.disconnect();
35
- }, [n, i]), m(() => {
36
- if (!c) return;
37
- let e = 0;
38
- const t = setInterval(() => {
39
- e < r.length ? (T(r.substring(0, e + 1)), e++) : clearInterval(t);
40
- }, s);
41
- return () => {
42
- clearInterval(t);
43
- };
44
- }, [r, s, c]), /* @__PURE__ */ d(
45
- g,
46
- {
47
- ref: o,
48
- className: b("xiping-typing-animation", a),
49
- ...p,
50
- children: v
51
- }
52
- );
53
- }
54
- export {
55
- S as TypingAnimation
56
- };
@@ -1,211 +0,0 @@
1
- import { jsxs as U, jsx as k } from "react/jsx-runtime";
2
- import { forwardRef as G, useRef as y, useMemo as N, useEffect as w } from "react";
3
- import { motion as H } from "motion/react";
4
- import J from "clsx";
5
- import './index.css';/* empty css */
6
- const l = {
7
- robotoFlex: !1,
8
- notoSansSC: !1,
9
- loading: !1
10
- };
11
- function V(n) {
12
- if (typeof document > "u") return !1;
13
- try {
14
- return document.fonts.check(`1em "${n}"`);
15
- } catch {
16
- return !0;
17
- }
18
- }
19
- function K() {
20
- if (l.loading || l.robotoFlex && l.notoSansSC) return;
21
- l.loading = !0;
22
- const n = V("Roboto Flex"), r = V("Noto Sans SC");
23
- if (n && (l.robotoFlex = !0), r && (l.notoSansSC = !0), n && r) {
24
- l.loading = !1;
25
- return;
26
- }
27
- const i = (t, s) => {
28
- if (document.querySelector(`link[href="${t}"]`)) {
29
- s?.();
30
- return;
31
- }
32
- const c = document.createElement("link");
33
- c.rel = "stylesheet", c.href = t, c.onload = () => s?.(), document.head.appendChild(c);
34
- }, f = [
35
- // 国内镜像(优先)
36
- {
37
- roboto: "https://fonts.loli.net/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap",
38
- noto: "https://fonts.loli.net/css2?family=Noto+Sans+SC:wght@100..900&display=swap"
39
- },
40
- // Google Fonts(备选)
41
- {
42
- roboto: "https://fonts.googleapis.com/css2?family=Roboto+Flex:opsz,wght@8..144,100..1000&display=swap",
43
- noto: "https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@100..900&display=swap"
44
- }
45
- ], d = (t) => {
46
- if (t >= f.length) {
47
- l.loading = !1;
48
- return;
49
- }
50
- const s = f[t];
51
- let m = 0;
52
- const c = () => {
53
- m++, m === 2 && (l.loading = !1);
54
- };
55
- n ? c() : i(s.roboto, () => {
56
- l.robotoFlex = !0, c();
57
- }), r ? c() : i(s.noto, () => {
58
- l.notoSansSC = !0, c();
59
- }), setTimeout(() => {
60
- (!l.robotoFlex || !l.notoSansSC) && d(t + 1);
61
- }, 3e3);
62
- };
63
- d(0);
64
- }
65
- function O(n = !0) {
66
- w(() => {
67
- n && typeof document < "u" && K();
68
- }, [n]);
69
- }
70
- function Q(n) {
71
- w(() => {
72
- let r;
73
- const i = () => {
74
- n(), r = requestAnimationFrame(i);
75
- };
76
- return r = requestAnimationFrame(i), () => cancelAnimationFrame(r);
77
- }, [n]);
78
- }
79
- function W(n) {
80
- const r = y({ x: 0, y: 0 });
81
- return w(() => {
82
- const i = (t, s) => {
83
- if (n?.current) {
84
- const m = n.current.getBoundingClientRect();
85
- r.current = { x: t - m.left, y: s - m.top };
86
- } else
87
- r.current = { x: t, y: s };
88
- }, f = (t) => i(t.clientX, t.clientY), d = (t) => {
89
- const s = t.touches[0];
90
- i(s.clientX, s.clientY);
91
- };
92
- return window.addEventListener("mousemove", f), window.addEventListener("touchmove", d), () => {
93
- window.removeEventListener("mousemove", f), window.removeEventListener("touchmove", d);
94
- };
95
- }, [n]), r;
96
- }
97
- const Z = G(
98
- (n, r) => {
99
- const {
100
- label: i,
101
- fromFontVariationSettings: f,
102
- toFontVariationSettings: d,
103
- containerRef: t,
104
- radius: s = 50,
105
- falloff: m = "linear",
106
- className: c = "",
107
- onClick: E,
108
- style: C,
109
- fontFamily: h,
110
- autoLoadFonts: P = !0,
111
- ...A
112
- } = n;
113
- O(P && !h);
114
- const b = y([]), v = y([]), S = W(t), x = y({
115
- x: null,
116
- y: null
117
- }), q = N(() => {
118
- const e = (o) => new Map(
119
- o.split(",").map((p) => p.trim()).map((p) => {
120
- const [g, F] = p.split(" ");
121
- return [g.replace(/['"]/g, ""), parseFloat(F)];
122
- })
123
- ), a = e(f), u = e(d);
124
- return Array.from(a.entries()).map(([o, p]) => ({
125
- axis: o,
126
- fromValue: p,
127
- toValue: u.get(o) ?? p
128
- }));
129
- }, [f, d]), I = (e, a, u, o) => Math.sqrt((u - e) ** 2 + (o - a) ** 2), $ = (e) => {
130
- const a = Math.min(Math.max(1 - e / s, 0), 1);
131
- switch (m) {
132
- case "exponential":
133
- return a ** 2;
134
- case "gaussian":
135
- return Math.exp(-((e / (s / 2)) ** 2) / 2);
136
- default:
137
- return a;
138
- }
139
- };
140
- Q(() => {
141
- if (!t?.current) return;
142
- const { x: e, y: a } = S.current;
143
- if (x.current.x === e && x.current.y === a)
144
- return;
145
- x.current = { x: e, y: a };
146
- const u = t.current.getBoundingClientRect();
147
- b.current.forEach((o, p) => {
148
- if (!o) return;
149
- const g = o.getBoundingClientRect(), F = g.left + g.width / 2 - u.left, Y = g.top + g.height / 2 - u.top, L = I(
150
- S.current.x,
151
- S.current.y,
152
- F,
153
- Y
154
- );
155
- if (L >= s) {
156
- o.style.fontVariationSettings = f;
157
- return;
158
- }
159
- const z = $(L), M = q.map(({ axis: T, fromValue: R, toValue: _ }) => {
160
- const D = R + (_ - R) * z;
161
- return `'${T}' ${D}`;
162
- }).join(", ");
163
- v.current[p] = M, o.style.fontVariationSettings = M;
164
- });
165
- });
166
- const j = /[\u4e00-\u9fa5]/.test(i) ? i.split("") : i.split(" ").flatMap((e, a, u) => {
167
- const o = e.split("");
168
- return a < u.length - 1 ? [...o, " "] : o;
169
- });
170
- let B = 0;
171
- const X = N(() => {
172
- const e = { display: "inline", ...C };
173
- return h && (e.fontFamily = h), e;
174
- }, [h, C]);
175
- return /* @__PURE__ */ U(
176
- "span",
177
- {
178
- ref: r,
179
- className: J("xiping-variable-proximity", c),
180
- onClick: E,
181
- style: X,
182
- ...A,
183
- children: [
184
- j.map((e, a) => {
185
- const u = B++;
186
- return /* @__PURE__ */ k(
187
- H.span,
188
- {
189
- ref: (o) => {
190
- b.current[u] = o;
191
- },
192
- style: {
193
- display: e === " " ? "inline" : "inline-block",
194
- fontVariationSettings: v.current[u]
195
- },
196
- "aria-hidden": "true",
197
- children: e
198
- },
199
- a
200
- );
201
- }),
202
- /* @__PURE__ */ k("span", { className: "xiping-variable-proximity__sr-only", children: i })
203
- ]
204
- }
205
- );
206
- }
207
- );
208
- Z.displayName = "VariableProximity";
209
- export {
210
- Z as VariableProximity
211
- };