@xiping/react-components 1.0.70 → 1.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.js +1 -0
  2. package/dist/cjs/components/blur-fade/BlurFade.js +1 -1
  3. package/dist/cjs/components/blur-text/BlurText.js +1 -1
  4. package/dist/cjs/components/button/Button.css +1 -1
  5. package/dist/cjs/components/button/Button2.js +1 -0
  6. package/dist/cjs/components/comic-text/ComicText2.js +4 -0
  7. package/dist/cjs/components/confetti-button/index.js +1 -1
  8. package/dist/cjs/components/dock/Duck.css +1 -1
  9. package/dist/cjs/components/dock/Duck2.js +1 -0
  10. package/dist/cjs/components/flip-text/FlipText.css +1 -1
  11. package/dist/cjs/components/flip-text/FlipText2.js +1 -0
  12. package/dist/cjs/components/gradient-text/index.css +1 -1
  13. package/dist/cjs/components/gradient-text/index2.js +1 -0
  14. package/dist/cjs/components/hyper-text/HyperText.css +1 -1
  15. package/dist/cjs/components/hyper-text/index.js +1 -1
  16. package/dist/cjs/components/image-compare/ImageCompare.css +1 -1
  17. package/dist/cjs/components/image-compare/ImageCompare2.js +1 -0
  18. package/dist/cjs/components/image-viewer/ImageThumbnails.css +1 -1
  19. package/dist/cjs/components/image-viewer/ImageThumbnails2.js +1 -0
  20. package/dist/cjs/components/image-viewer/ImageViewer.css +1 -1
  21. package/dist/cjs/components/image-viewer/ImageViewer.d.ts +1 -1
  22. package/dist/cjs/components/image-viewer/ImageViewer2.js +1 -0
  23. package/dist/cjs/components/message/Message.css +1 -1
  24. package/dist/cjs/components/message/Message2.js +1 -0
  25. package/dist/cjs/components/pinch-content/PinchContent.js +1 -1
  26. package/dist/cjs/components/pinch-content/index.js +1 -1
  27. package/dist/cjs/components/pointer/Pointer.css +1 -1
  28. package/dist/cjs/components/pointer/Pointer2.js +1 -0
  29. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.css +1 -1
  30. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal2.js +1 -0
  31. package/dist/cjs/components/shimmer-button/ShimmerButton.css +1 -1
  32. package/dist/cjs/components/shimmer-button/ShimmerButton2.js +1 -0
  33. package/dist/cjs/components/shiny-button/ShinyButton.css +1 -1
  34. package/dist/cjs/components/shiny-button/ShinyButton2.js +1 -0
  35. package/dist/cjs/components/shiny-text/ShinyText2.js +1 -0
  36. package/dist/cjs/components/sparkles-text/SparklesText.css +1 -1
  37. package/dist/cjs/components/sparkles-text/SparklesText2.js +1 -0
  38. package/dist/cjs/components/split-text/SplitText.css +1 -1
  39. package/dist/cjs/components/split-text/SplitText2.js +1 -0
  40. package/dist/cjs/components/subtitle-player/CurrentMode.css +1 -1
  41. package/dist/cjs/components/subtitle-player/CurrentMode2.js +2 -0
  42. package/dist/cjs/components/subtitle-player/LyricsMode.css +1 -1
  43. package/dist/cjs/components/subtitle-player/LyricsMode2.js +2 -0
  44. package/dist/cjs/components/subtitle-player/SubtitlePlayer.css +1 -1
  45. package/dist/cjs/components/subtitle-player/SubtitlePlayer2.js +1 -0
  46. package/dist/cjs/components/subtitle-player/utils.js +1 -1
  47. package/dist/cjs/components/text-animate/TextAnimate.css +1 -1
  48. package/dist/cjs/components/text-animate/TextAnimate2.js +2 -0
  49. package/dist/cjs/components/text-type/TextType.css +1 -1
  50. package/dist/cjs/components/text-type/TextType2.js +1 -0
  51. package/dist/cjs/components/txt-editor/TxtEditor.js +4 -4
  52. package/dist/cjs/components/txt-reader/TxtReader.js +1 -1
  53. package/dist/cjs/components/txt-reader/index.module.css +1 -1
  54. package/dist/cjs/components/txt-reader/index.module.js +1 -0
  55. package/dist/cjs/components/typing-animation/index.css +1 -1
  56. package/dist/cjs/components/typing-animation/index2.js +1 -0
  57. package/dist/cjs/components/variable-proximity/index.css +1 -1
  58. package/dist/cjs/components/variable-proximity/index2.js +1 -0
  59. package/dist/cjs/components/video-dialog/VideoDialog.css +1 -1
  60. package/dist/cjs/components/video-dialog/VideoDialog2.js +1 -0
  61. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
  62. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
  63. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
  64. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer2.js +1 -0
  65. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +1 -1
  66. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayerPC.js +1 -1
  67. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +1 -1
  68. package/dist/cjs/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +1 -1
  69. package/dist/cjs/components/video-subtitle-player/useVideoSubtitleStore.js +1 -1
  70. package/dist/cjs/components/video-subtitle-player/useXGPlayer.js +1 -1
  71. package/dist/cjs/hooks/useStayTimeReport.js +1 -1
  72. package/dist/cjs/index.js +1 -1
  73. package/dist/cjs/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -1
  74. package/dist/cjs/packages/subtitle/lib/index.js +1 -0
  75. package/dist/cjs/packages/subtitle/lib/src/json-converter.js +1 -1
  76. package/dist/cjs/packages/subtitle/lib/src/parser.js +5 -5
  77. package/dist/cjs/react-components.css +27 -27
  78. package/dist/es/components/blur-fade/BlurFade.js +37 -49
  79. package/dist/es/components/blur-text/BlurText.js +67 -76
  80. package/dist/es/components/button/Button.css +1 -1
  81. package/dist/es/components/button/Button2.js +48 -0
  82. package/dist/es/components/comic-text/ComicText2.js +55 -0
  83. package/dist/es/components/confetti-button/index.js +63 -75
  84. package/dist/es/components/dock/Duck.css +1 -1
  85. package/dist/es/components/dock/Duck2.js +60 -0
  86. package/dist/es/components/flip-text/FlipText.css +1 -1
  87. package/dist/es/components/flip-text/FlipText2.js +41 -0
  88. package/dist/es/components/gradient-text/index.css +1 -1
  89. package/dist/es/components/gradient-text/index2.js +29 -0
  90. package/dist/es/components/hyper-text/HyperText.css +1 -1
  91. package/dist/es/components/hyper-text/index.js +51 -79
  92. package/dist/es/components/image-compare/ImageCompare.css +1 -1
  93. package/dist/es/components/image-compare/ImageCompare2.js +96 -0
  94. package/dist/es/components/image-viewer/ImageThumbnails.css +1 -1
  95. package/dist/es/components/image-viewer/ImageThumbnails2.js +40 -0
  96. package/dist/es/components/image-viewer/ImageViewer.css +1 -1
  97. package/dist/es/components/image-viewer/ImageViewer.d.ts +1 -1
  98. package/dist/es/components/image-viewer/ImageViewer2.js +151 -0
  99. package/dist/es/components/message/Message.css +1 -1
  100. package/dist/es/components/message/Message2.js +189 -0
  101. package/dist/es/components/pinch-content/PinchContent.js +120 -127
  102. package/dist/es/components/pinch-content/index.js +5 -5
  103. package/dist/es/components/pointer/Pointer.css +1 -1
  104. package/dist/es/components/pointer/Pointer2.js +61 -0
  105. package/dist/es/components/react-force-graph-3d/index.js +2 -0
  106. package/dist/es/components/scratch-to-reveal/ScratchToReveal.css +1 -1
  107. package/dist/es/components/scratch-to-reveal/ScratchToReveal2.js +88 -0
  108. package/dist/es/components/shimmer-button/ShimmerButton.css +1 -1
  109. package/dist/es/components/shimmer-button/ShimmerButton2.js +33 -0
  110. package/dist/es/components/shiny-button/ShinyButton.css +1 -1
  111. package/dist/es/components/shiny-button/ShinyButton2.js +53 -0
  112. package/dist/es/components/shiny-text/ShinyText2.js +61 -0
  113. package/dist/es/components/sparkles-text/SparklesText.css +1 -1
  114. package/dist/es/components/sparkles-text/SparklesText2.js +90 -0
  115. package/dist/es/components/split-text/SplitText.css +1 -1
  116. package/dist/es/components/split-text/SplitText2.js +109 -0
  117. package/dist/es/components/subtitle-player/CurrentMode.css +1 -1
  118. package/dist/es/components/subtitle-player/CurrentMode2.js +44 -0
  119. package/dist/es/components/subtitle-player/LyricsMode.css +1 -1
  120. package/dist/es/components/subtitle-player/LyricsMode2.js +114 -0
  121. package/dist/es/components/subtitle-player/SubtitlePlayer.css +1 -1
  122. package/dist/es/components/subtitle-player/SubtitlePlayer2.js +169 -0
  123. package/dist/es/components/subtitle-player/utils.js +63 -69
  124. package/dist/es/components/text-animate/TextAnimate.css +1 -1
  125. package/dist/es/components/text-animate/TextAnimate2.js +312 -0
  126. package/dist/es/components/text-type/TextType.css +1 -1
  127. package/dist/es/components/text-type/TextType2.js +80 -0
  128. package/dist/es/components/txt-editor/TxtEditor.js +60 -95
  129. package/dist/es/components/txt-reader/TxtReader.js +45 -74
  130. package/dist/es/components/txt-reader/index.module.css +1 -1
  131. package/dist/es/components/txt-reader/index.module.js +10 -0
  132. package/dist/es/components/typing-animation/index.css +1 -1
  133. package/dist/es/components/typing-animation/index2.js +43 -0
  134. package/dist/es/components/variable-proximity/index.css +1 -1
  135. package/dist/es/components/variable-proximity/index2.js +179 -0
  136. package/dist/es/components/video-dialog/VideoDialog.css +1 -1
  137. package/dist/es/components/video-dialog/VideoDialog2.js +168 -0
  138. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.css +1 -1
  139. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.mobile.css +1 -1
  140. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.pc.css +1 -1
  141. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer2.js +43 -0
  142. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerMobile.js +29 -46
  143. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayerPC.js +94 -74
  144. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutMobile.js +24 -21
  145. package/dist/es/components/video-subtitle-player/layouts/VideoSubtitlePlayerLayoutPC.js +58 -50
  146. package/dist/es/components/video-subtitle-player/useVideoSubtitleStore.js +61 -56
  147. package/dist/es/components/video-subtitle-player/useXGPlayer.js +38 -35
  148. package/dist/es/hooks/useStayTimeReport.js +29 -29
  149. package/dist/es/index.js +33 -70
  150. package/dist/es/node_modules/.pnpm/xgplayer@3.0.24_core-js@3.47.0/node_modules/xgplayer/dist/index.min.css +1 -1
  151. package/dist/es/packages/subtitle/lib/index.js +2 -0
  152. package/dist/es/packages/subtitle/lib/src/json-converter.js +22 -23
  153. package/dist/es/packages/subtitle/lib/src/parser.js +41 -54
  154. package/dist/es/react-components.css +27 -27
  155. package/package.json +25 -27
  156. package/dist/cjs/components/button/Button.js +0 -1
  157. package/dist/cjs/components/comic-text/ComicText.js +0 -4
  158. package/dist/cjs/components/dock/Duck.js +0 -1
  159. package/dist/cjs/components/flip-text/FlipText.js +0 -1
  160. package/dist/cjs/components/gradient-text/index.js +0 -1
  161. package/dist/cjs/components/image-compare/ImageCompare.js +0 -1
  162. package/dist/cjs/components/image-viewer/ImageThumbnails.js +0 -1
  163. package/dist/cjs/components/image-viewer/ImageViewer.js +0 -1
  164. package/dist/cjs/components/message/Message.js +0 -1
  165. package/dist/cjs/components/pointer/Pointer.js +0 -1
  166. package/dist/cjs/components/scratch-to-reveal/ScratchToReveal.js +0 -1
  167. package/dist/cjs/components/shimmer-button/ShimmerButton.js +0 -1
  168. package/dist/cjs/components/shiny-button/ShinyButton.js +0 -1
  169. package/dist/cjs/components/shiny-text/ShinyText.js +0 -1
  170. package/dist/cjs/components/sparkles-text/SparklesText.js +0 -1
  171. package/dist/cjs/components/split-text/SplitText.js +0 -1
  172. package/dist/cjs/components/subtitle-player/CurrentMode.js +0 -2
  173. package/dist/cjs/components/subtitle-player/LyricsMode.js +0 -2
  174. package/dist/cjs/components/subtitle-player/SubtitlePlayer.js +0 -1
  175. package/dist/cjs/components/text-animate/TextAnimate.js +0 -2
  176. package/dist/cjs/components/text-type/TextType.js +0 -1
  177. package/dist/cjs/components/txt-reader/index.module.css.js +0 -1
  178. package/dist/cjs/components/typing-animation/index.js +0 -1
  179. package/dist/cjs/components/variable-proximity/index.js +0 -1
  180. package/dist/cjs/components/video-dialog/VideoDialog.js +0 -1
  181. package/dist/cjs/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -1
  182. package/dist/es/components/button/Button.js +0 -72
  183. package/dist/es/components/comic-text/ComicText.js +0 -52
  184. package/dist/es/components/dock/Duck.js +0 -80
  185. package/dist/es/components/flip-text/FlipText.js +0 -38
  186. package/dist/es/components/gradient-text/index.js +0 -22
  187. package/dist/es/components/image-compare/ImageCompare.js +0 -127
  188. package/dist/es/components/image-viewer/ImageThumbnails.js +0 -73
  189. package/dist/es/components/image-viewer/ImageViewer.js +0 -141
  190. package/dist/es/components/message/Message.js +0 -220
  191. package/dist/es/components/pointer/Pointer.js +0 -75
  192. package/dist/es/components/scratch-to-reveal/ScratchToReveal.js +0 -97
  193. package/dist/es/components/shimmer-button/ShimmerButton.js +0 -42
  194. package/dist/es/components/shiny-button/ShinyButton.js +0 -61
  195. package/dist/es/components/shiny-text/ShinyText.js +0 -76
  196. package/dist/es/components/sparkles-text/SparklesText.js +0 -71
  197. package/dist/es/components/split-text/SplitText.js +0 -116
  198. package/dist/es/components/subtitle-player/CurrentMode.js +0 -78
  199. package/dist/es/components/subtitle-player/LyricsMode.js +0 -152
  200. package/dist/es/components/subtitle-player/SubtitlePlayer.js +0 -234
  201. package/dist/es/components/text-animate/TextAnimate.js +0 -310
  202. package/dist/es/components/text-type/TextType.js +0 -121
  203. package/dist/es/components/txt-reader/index.module.css.js +0 -10
  204. package/dist/es/components/typing-animation/index.js +0 -56
  205. package/dist/es/components/variable-proximity/index.js +0 -211
  206. package/dist/es/components/video-dialog/VideoDialog.js +0 -113
  207. package/dist/es/components/video-subtitle-player/VideoSubtitlePlayer.js +0 -74
@@ -0,0 +1,312 @@
1
+ "use client";
2
+ import './TextAnimate.css';/* empty css */
3
+ import { jsx as e } from "react/jsx-runtime";
4
+ import t from "clsx";
5
+ import { AnimatePresence as n, motion as r } from "motion/react";
6
+ //#region src/components/text-animate/TextAnimate.tsx
7
+ var i = {
8
+ text: .06,
9
+ word: .05,
10
+ character: .03,
11
+ line: .06
12
+ }, a = {
13
+ hidden: { opacity: 1 },
14
+ show: {
15
+ opacity: 1,
16
+ transition: { staggerChildren: .05 }
17
+ },
18
+ exit: {
19
+ opacity: 0,
20
+ transition: {
21
+ staggerChildren: .05,
22
+ staggerDirection: -1
23
+ }
24
+ }
25
+ }, o = {
26
+ hidden: { opacity: 0 },
27
+ show: { opacity: 1 },
28
+ exit: { opacity: 0 }
29
+ }, s = {
30
+ fadeIn: {
31
+ container: a,
32
+ item: {
33
+ hidden: {
34
+ opacity: 0,
35
+ y: 20
36
+ },
37
+ show: (e) => ({
38
+ opacity: 1,
39
+ y: 0,
40
+ transition: {
41
+ delay: e,
42
+ duration: .3
43
+ }
44
+ }),
45
+ exit: {
46
+ opacity: 0,
47
+ y: 20,
48
+ transition: { duration: .3 }
49
+ }
50
+ }
51
+ },
52
+ blurIn: {
53
+ container: a,
54
+ item: {
55
+ hidden: {
56
+ opacity: 0,
57
+ filter: "blur(10px)"
58
+ },
59
+ show: (e) => ({
60
+ opacity: 1,
61
+ filter: "blur(0px)",
62
+ transition: {
63
+ delay: e * .1,
64
+ duration: .3
65
+ }
66
+ }),
67
+ exit: {
68
+ opacity: 0,
69
+ filter: "blur(10px)",
70
+ transition: { duration: .3 }
71
+ }
72
+ }
73
+ },
74
+ blurInUp: {
75
+ container: a,
76
+ item: {
77
+ hidden: {
78
+ opacity: 0,
79
+ filter: "blur(10px)",
80
+ y: 20
81
+ },
82
+ show: (e) => ({
83
+ opacity: 1,
84
+ filter: "blur(0px)",
85
+ y: 0,
86
+ transition: {
87
+ y: { duration: .3 },
88
+ opacity: { duration: .4 },
89
+ filter: { duration: .3 }
90
+ }
91
+ }),
92
+ exit: {
93
+ opacity: 0,
94
+ filter: "blur(10px)",
95
+ y: 20,
96
+ transition: {
97
+ y: { duration: .3 },
98
+ opacity: { duration: .4 },
99
+ filter: { duration: .3 }
100
+ }
101
+ }
102
+ }
103
+ },
104
+ blurInDown: {
105
+ container: a,
106
+ item: {
107
+ hidden: {
108
+ opacity: 0,
109
+ filter: "blur(10px)",
110
+ y: -20
111
+ },
112
+ show: (e) => ({
113
+ opacity: 1,
114
+ filter: "blur(0px)",
115
+ y: 0,
116
+ transition: {
117
+ y: { duration: .3 },
118
+ opacity: { duration: .4 },
119
+ filter: { duration: .3 }
120
+ }
121
+ })
122
+ }
123
+ },
124
+ slideUp: {
125
+ container: a,
126
+ item: {
127
+ hidden: {
128
+ y: 20,
129
+ opacity: 0
130
+ },
131
+ show: (e) => ({
132
+ y: 0,
133
+ opacity: 1,
134
+ transition: {
135
+ delay: e,
136
+ duration: .3
137
+ }
138
+ }),
139
+ exit: {
140
+ y: -20,
141
+ opacity: 0,
142
+ transition: { duration: .3 }
143
+ }
144
+ }
145
+ },
146
+ slideDown: {
147
+ container: a,
148
+ item: {
149
+ hidden: {
150
+ y: -20,
151
+ opacity: 0
152
+ },
153
+ show: {
154
+ y: 0,
155
+ opacity: 1,
156
+ transition: { duration: .3 }
157
+ },
158
+ exit: {
159
+ y: 20,
160
+ opacity: 0,
161
+ transition: { duration: .3 }
162
+ }
163
+ }
164
+ },
165
+ slideLeft: {
166
+ container: a,
167
+ item: {
168
+ hidden: {
169
+ x: 20,
170
+ opacity: 0
171
+ },
172
+ show: {
173
+ x: 0,
174
+ opacity: 1,
175
+ transition: { duration: .3 }
176
+ },
177
+ exit: {
178
+ x: -20,
179
+ opacity: 0,
180
+ transition: { duration: .3 }
181
+ }
182
+ }
183
+ },
184
+ slideRight: {
185
+ container: a,
186
+ item: {
187
+ hidden: {
188
+ x: -20,
189
+ opacity: 0
190
+ },
191
+ show: {
192
+ x: 0,
193
+ opacity: 1,
194
+ transition: { duration: .3 }
195
+ },
196
+ exit: {
197
+ x: 20,
198
+ opacity: 0,
199
+ transition: { duration: .3 }
200
+ }
201
+ }
202
+ },
203
+ scaleUp: {
204
+ container: a,
205
+ item: {
206
+ hidden: {
207
+ scale: .5,
208
+ opacity: 0
209
+ },
210
+ show: {
211
+ scale: 1,
212
+ opacity: 1,
213
+ transition: {
214
+ duration: .3,
215
+ scale: {
216
+ type: "spring",
217
+ damping: 15,
218
+ stiffness: 300
219
+ }
220
+ }
221
+ },
222
+ exit: {
223
+ scale: .5,
224
+ opacity: 0,
225
+ transition: { duration: .3 }
226
+ }
227
+ }
228
+ },
229
+ scaleDown: {
230
+ container: a,
231
+ item: {
232
+ hidden: {
233
+ scale: 1.5,
234
+ opacity: 0
235
+ },
236
+ show: (e) => ({
237
+ scale: 1,
238
+ opacity: 1,
239
+ transition: {
240
+ delay: e,
241
+ duration: .3,
242
+ scale: {
243
+ type: "spring",
244
+ damping: 15,
245
+ stiffness: 300
246
+ }
247
+ }
248
+ }),
249
+ exit: {
250
+ scale: 1.5,
251
+ opacity: 0,
252
+ transition: { duration: .3 }
253
+ }
254
+ }
255
+ }
256
+ };
257
+ function c({ children: c, delay: l = 0, duration: u = .3, variants: d, className: f, segmentClassName: p, as: m = "p", startOnView: h = !0, once: g = !1, by: _ = "word", animation: v = "fadeIn", ...y }) {
258
+ let b = r.create(m), x = v ? {
259
+ container: {
260
+ ...s[v].container,
261
+ show: {
262
+ ...s[v].container.show,
263
+ transition: { staggerChildren: i[_] }
264
+ },
265
+ exit: {
266
+ ...s[v].container.exit,
267
+ transition: {
268
+ staggerChildren: i[_],
269
+ staggerDirection: -1
270
+ }
271
+ }
272
+ },
273
+ item: s[v].item
274
+ } : {
275
+ container: a,
276
+ item: o
277
+ }, S = [];
278
+ switch (_) {
279
+ case "word":
280
+ S = c.split(/(\s+)/);
281
+ break;
282
+ case "character":
283
+ S = c.split("");
284
+ break;
285
+ case "line":
286
+ S = c.split("\n");
287
+ break;
288
+ default:
289
+ S = [c];
290
+ break;
291
+ }
292
+ return /* @__PURE__ */ e(n, {
293
+ mode: "popLayout",
294
+ children: /* @__PURE__ */ e(b, {
295
+ variants: x.container,
296
+ initial: "hidden",
297
+ whileInView: h ? "show" : void 0,
298
+ animate: h ? void 0 : "show",
299
+ exit: "exit",
300
+ className: t("xiping-text-animate", f),
301
+ ...y,
302
+ children: S.map((n, a) => /* @__PURE__ */ e(r.span, {
303
+ variants: x.item,
304
+ custom: a * i[_],
305
+ className: t("xiping-text-animate-segment", _ === "line" && "xiping-text-animate-segment--line", p),
306
+ children: n
307
+ }, `${_}-${n}-${a}`))
308
+ })
309
+ });
310
+ }
311
+ //#endregion
312
+ export { c as TextAnimate };
@@ -1 +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}
1
+ .xiping-text-type{white-space:pre-wrap;display:inline-block}.xiping-text-type__content{display:inline-block}.xiping-text-type__cursor{opacity:1;margin-left:.25rem;display:inline-block}.xiping-text-type__cursor--hidden{display:none}
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import './TextType.css';/* empty css */
3
+ import { jsx as e } from "react/jsx-runtime";
4
+ import { createElement as t, useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
5
+ import s from "clsx";
6
+ import { gsap as c } from "gsap";
7
+ //#region src/components/text-type/TextType.tsx
8
+ var l = ({ text: l, as: u = "div", typingSpeed: d = 50, initialDelay: f = 0, pauseDuration: p = 2e3, deletingSpeed: m = 30, loop: h = !0, className: g = "", showCursor: _ = !0, hideCursorWhileTyping: v = !1, cursorCharacter: y = "|", cursorClassName: b = "", cursorBlinkDuration: x = .5, textColors: S = [], variableSpeed: C, onSentenceComplete: w, startOnVisible: T = !1, reverseMode: E = !1, ...D }) => {
9
+ let [O, k] = o(""), [A, j] = o(0), [M, N] = o(!1), [P, F] = o(0), [I, L] = o(!T), R = a(null), z = a(null), B = i(() => Array.isArray(l) ? l : [l], [l]), V = n(() => {
10
+ if (!C) return d;
11
+ let { min: e, max: t } = C;
12
+ return Math.random() * (t - e) + e;
13
+ }, [C, d]), H = () => {
14
+ if (S.length !== 0) return S[P % S.length];
15
+ };
16
+ r(() => {
17
+ if (!T || !z.current) return;
18
+ let e = new IntersectionObserver((e) => {
19
+ e.forEach((e) => {
20
+ e.isIntersecting && L(!0);
21
+ });
22
+ }, { threshold: .1 });
23
+ return e.observe(z.current), () => e.disconnect();
24
+ }, [T]), r(() => {
25
+ _ && R.current && (c.set(R.current, { opacity: 1 }), c.to(R.current, {
26
+ opacity: 0,
27
+ duration: x,
28
+ repeat: -1,
29
+ yoyo: !0,
30
+ ease: "power2.inOut"
31
+ }));
32
+ }, [_, x]), r(() => {
33
+ if (!I) return;
34
+ let e, t = B[P], n = E ? t.split("").reverse().join("") : t, r = () => {
35
+ if (M) if (O === "") {
36
+ if (N(!1), P === B.length - 1 && !h) return;
37
+ w && w(B[P], P), F((e) => (e + 1) % B.length), j(0), e = setTimeout(() => {}, p);
38
+ } else e = setTimeout(() => {
39
+ k((e) => e.slice(0, -1));
40
+ }, m);
41
+ else A < n.length ? e = setTimeout(() => {
42
+ k((e) => e + n[A]), j((e) => e + 1);
43
+ }, C ? V() : d) : B.length > 1 && (e = setTimeout(() => {
44
+ N(!0);
45
+ }, p));
46
+ };
47
+ return A === 0 && !M && O === "" ? e = setTimeout(r, f) : r(), () => clearTimeout(e);
48
+ }, [
49
+ A,
50
+ O,
51
+ M,
52
+ d,
53
+ m,
54
+ p,
55
+ B,
56
+ P,
57
+ h,
58
+ f,
59
+ I,
60
+ E,
61
+ C,
62
+ w
63
+ ]);
64
+ let U = v && (A < B[P].length || M);
65
+ return t(u, {
66
+ ref: z,
67
+ className: `xiping-text-type ${g}`,
68
+ ...D
69
+ }, /* @__PURE__ */ e("span", {
70
+ className: "xiping-text-type__content",
71
+ style: { color: H() || "inherit" },
72
+ children: O
73
+ }), _ && /* @__PURE__ */ e("span", {
74
+ ref: R,
75
+ className: s("xiping-text-type__cursor", b, U && "xiping-text-type__cursor--hidden"),
76
+ children: y
77
+ }));
78
+ };
79
+ //#endregion
80
+ export { l as default };
@@ -1,81 +1,57 @@
1
- import { jsxs as k, jsx as c } from "react/jsx-runtime";
2
- import { useEditor as M, EditorContent as w } from "@tiptap/react";
3
- import C from "@tiptap/starter-kit";
4
- import { useMemo as P, useEffect as a } from "react";
5
- const U = ({
6
- height: t = "500px",
7
- width: i = "100%",
8
- language: y = "plaintext",
9
- // eslint-disable-line @typescript-eslint/no-unused-vars
10
- defaultValue: d,
11
- value: o,
12
- theme: p = "light",
13
- readOnly: n = !1,
14
- onChange: m,
15
- onMount: s,
16
- className: u
17
- }) => {
18
- const l = o !== void 0, g = P(
19
- () => d || o || "",
20
- [d, o]
21
- ), e = M({
22
- extensions: [
23
- C.configure({
24
- // 禁用大部分格式化功能,保持纯文本编辑体验
25
- bold: !1,
26
- italic: !1,
27
- strike: !1,
28
- code: !1,
29
- heading: !1,
30
- blockquote: !1,
31
- horizontalRule: !1,
32
- hardBreak: !1
33
- // 保留历史记录、拖拽光标和间隙光标功能(使用默认配置)
34
- })
35
- ],
36
- content: g,
37
- editable: !n,
38
- immediatelyRender: !1,
39
- onUpdate: ({ editor: f }) => {
40
- const b = f.getText();
41
- m?.(b);
42
- }
43
- });
44
- if (a(() => {
45
- if (!e || !l) return;
46
- const f = e.getText();
47
- o !== f && e.commands.setContent(o || "", { emitUpdate: !1 });
48
- }, [e, o, l]), a(() => {
49
- e && e.setEditable(!n);
50
- }, [e, n]), a(() => {
51
- e && s && s(e);
52
- }, [e, s]), !e)
53
- return null;
54
- const x = typeof t == "number" ? `${t}px` : t, h = typeof i == "number" ? `${i}px` : i, r = p === "vs-dark";
55
- return /* @__PURE__ */ k(
56
- "div",
57
- {
58
- className: u,
59
- style: {
60
- width: h,
61
- height: x,
62
- border: `1px solid ${r ? "#3e3e3e" : "#d4d4d4"}`,
63
- borderRadius: "4px",
64
- overflow: "hidden",
65
- backgroundColor: r ? "#1e1e1e" : "#ffffff"
66
- },
67
- children: [
68
- /* @__PURE__ */ c(
69
- w,
70
- {
71
- editor: e,
72
- style: {
73
- height: "100%",
74
- overflow: "auto"
75
- }
76
- }
77
- ),
78
- /* @__PURE__ */ c("style", { children: `
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ import { useEffect as n, useMemo as r } from "react";
3
+ import { EditorContent as i, useEditor as a } from "@tiptap/react";
4
+ import o from "@tiptap/starter-kit";
5
+ //#region src/components/txt-editor/TxtEditor.tsx
6
+ var s = ({ height: s = "500px", width: c = "100%", language: l = "plaintext", defaultValue: u, value: d, theme: f = "light", readOnly: p = !1, onChange: m, onMount: h, className: g }) => {
7
+ let _ = d !== void 0, v = r(() => u || d || "", [u, d]), y = a({
8
+ extensions: [o.configure({
9
+ bold: !1,
10
+ italic: !1,
11
+ strike: !1,
12
+ code: !1,
13
+ heading: !1,
14
+ blockquote: !1,
15
+ horizontalRule: !1,
16
+ hardBreak: !1
17
+ })],
18
+ content: v,
19
+ editable: !p,
20
+ immediatelyRender: !1,
21
+ onUpdate: ({ editor: e }) => {
22
+ let t = e.getText();
23
+ m?.(t);
24
+ }
25
+ });
26
+ if (n(() => {
27
+ !y || !_ || d !== y.getText() && y.commands.setContent(d || "", { emitUpdate: !1 });
28
+ }, [
29
+ y,
30
+ d,
31
+ _
32
+ ]), n(() => {
33
+ y && y.setEditable(!p);
34
+ }, [y, p]), n(() => {
35
+ y && h && h(y);
36
+ }, [y, h]), !y) return null;
37
+ let b = typeof s == "number" ? `${s}px` : s, x = typeof c == "number" ? `${c}px` : c, S = f === "vs-dark";
38
+ return /* @__PURE__ */ t("div", {
39
+ className: g,
40
+ style: {
41
+ width: x,
42
+ height: b,
43
+ border: `1px solid ${S ? "#3e3e3e" : "#d4d4d4"}`,
44
+ borderRadius: "4px",
45
+ overflow: "hidden",
46
+ backgroundColor: S ? "#1e1e1e" : "#ffffff"
47
+ },
48
+ children: [/* @__PURE__ */ e(i, {
49
+ editor: y,
50
+ style: {
51
+ height: "100%",
52
+ overflow: "auto"
53
+ }
54
+ }), /* @__PURE__ */ e("style", { children: `
79
55
  .ProseMirror {
80
56
  outline: none;
81
57
  padding: 12px;
@@ -83,7 +59,7 @@ const U = ({
83
59
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
84
60
  font-size: 14px;
85
61
  line-height: 1.5;
86
- color: ${r ? "#d4d4d4" : "#333333"};
62
+ color: ${S ? "#d4d4d4" : "#333333"};
87
63
  white-space: pre-wrap;
88
64
  word-wrap: break-word;
89
65
  }
@@ -97,20 +73,9 @@ const U = ({
97
73
  .ProseMirror:focus {
98
74
  outline: none;
99
75
  }
100
- ${r ? `
101
- .ProseMirror {
102
- background-color: #1e1e1e;
103
- }
104
- ` : `
105
- .ProseMirror {
106
- background-color: #ffffff;
107
- }
108
- `}
109
- ` })
110
- ]
111
- }
112
- );
113
- };
114
- export {
115
- U as TxtEditor
76
+ ${S ? "\n .ProseMirror {\n background-color: #1e1e1e;\n }\n " : "\n .ProseMirror {\n background-color: #ffffff;\n }\n "}
77
+ ` })]
78
+ });
116
79
  };
80
+ //#endregion
81
+ export { s as TxtEditor };
@@ -1,75 +1,46 @@
1
- import { jsxs as h, Fragment as v, jsx as t } from "react/jsx-runtime";
2
- import { useRef as c } from "react";
3
- import r from "clsx";
4
- import { useScroll as y, useTransform as I, useMotionTemplate as L, motion as l } from "motion/react";
5
- import e from "./index.module.css.js";
6
- const R = 16, S = 1.5, A = "normal", O = ({
7
- content: a,
8
- lineHeight: m = S,
9
- fontSize: p = R,
10
- fontWeight: g = A,
11
- className: d = "",
12
- style: x = {},
13
- onProgressChange: f,
14
- initialScrollPosition: D,
15
- cacheKey: H,
16
- showTopProgress: u = !0,
17
- topProgressClassName: T,
18
- showBottomProgress: N = !0,
19
- bottomProgressClassName: E
20
- }) => {
21
- const o = c(null), n = c(null), { scrollYProgress: s } = y({
22
- container: o,
23
- target: n
24
- }), i = I(() => (s.get() * 100).toFixed(2).replace(/\.0*$/, "")), F = L`${i}%`;
25
- return i.on("change", (_) => {
26
- f?.(Number(_));
27
- }), /* @__PURE__ */ h(v, { children: [
28
- u && /* @__PURE__ */ t(
29
- l.div,
30
- {
31
- id: "scroll-indicator",
32
- className: r(e["xiping-top-progress"], T),
33
- style: {
34
- scaleX: s,
35
- originX: 0
36
- }
37
- }
38
- ),
39
- /* @__PURE__ */ t(
40
- "div",
41
- {
42
- className: r(e["xiping-container"], e["xiping-text-content"]),
43
- ref: o,
44
- children: /* @__PURE__ */ t(
45
- "div",
46
- {
47
- ref: n,
48
- className: r(e["xiping-content"], d),
49
- style: {
50
- fontSize: `${p}px`,
51
- lineHeight: m,
52
- fontWeight: g,
53
- ...x
54
- },
55
- children: a
56
- }
57
- )
58
- }
59
- ),
60
- N && /* @__PURE__ */ t(
61
- l.div,
62
- {
63
- id: "scroll-present",
64
- className: r(
65
- e["xiping-bottom-progress"],
66
- E
67
- ),
68
- children: F
69
- }
70
- )
71
- ] });
72
- };
73
- export {
74
- O as TxtReader
1
+ import e from "./index.module.js";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import { useRef as i } from "react";
4
+ import a from "clsx";
5
+ import { motion as o, useMotionTemplate as s, useScroll as c, useTransform as l } from "motion/react";
6
+ //#region src/components/txt-reader/TxtReader.tsx
7
+ var u = 16, d = 1.5, f = "normal", p = ({ content: p, lineHeight: m = d, fontSize: h = u, fontWeight: g = f, className: _ = "", style: v = {}, onProgressChange: y, initialScrollPosition: b, cacheKey: x, showTopProgress: S = !0, topProgressClassName: C, showBottomProgress: w = !0, bottomProgressClassName: T }) => {
8
+ let E = i(null), D = i(null), { scrollYProgress: O } = c({
9
+ container: E,
10
+ target: D
11
+ }), k = l(() => (O.get() * 100).toFixed(2).replace(/\.0*$/, "")), A = s`${k}%`;
12
+ return k.on("change", (e) => {
13
+ y?.(Number(e));
14
+ }), /* @__PURE__ */ r(t, { children: [
15
+ S && /* @__PURE__ */ n(o.div, {
16
+ id: "scroll-indicator",
17
+ className: a(e["xiping-top-progress"], C),
18
+ style: {
19
+ scaleX: O,
20
+ originX: 0
21
+ }
22
+ }),
23
+ /* @__PURE__ */ n("div", {
24
+ className: a(e["xiping-container"], e["xiping-text-content"]),
25
+ ref: E,
26
+ children: /* @__PURE__ */ n("div", {
27
+ ref: D,
28
+ className: a(e["xiping-content"], _),
29
+ style: {
30
+ fontSize: `${h}px`,
31
+ lineHeight: m,
32
+ fontWeight: g,
33
+ ...v
34
+ },
35
+ children: p
36
+ })
37
+ }),
38
+ w && /* @__PURE__ */ n(o.div, {
39
+ id: "scroll-present",
40
+ className: a(e["xiping-bottom-progress"], T),
41
+ children: A
42
+ })
43
+ ] });
75
44
  };
45
+ //#endregion
46
+ export { p as default };
@@ -1 +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
+ ._xiping-top-progress_rkm9f_23{background-color:#f08;height:10px;position:fixed;top:0;left:0;right:0}._xiping-container_rkm9f_33{width:100%;height:100%;position:relative;overflow-y:auto}._xiping-content_rkm9f_41{white-space:pre-wrap;word-break:break-word;width:100%}._xiping-bottom-progress_rkm9f_48{color:#fff;background-color:#000000b3;border-radius:4px;padding:.25rem .5rem;font-size:.875rem;position:fixed;bottom:1.25rem;right:1.25rem}._xiping-text-content_rkm9f_63::-webkit-scrollbar{width:8px}._xiping-text-content_rkm9f_63::-webkit-scrollbar-thumb{background:#0003;box-shadow:inset 0 0 5px #0003}._xiping-text-content_rkm9f_63::-webkit-scrollbar-track{background:#00000014;border-radius:0;box-shadow:inset 0 0 5px #0003}