@readdy/anim 0.0.21

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 (310) hide show
  1. package/animations/button/3d-flip/index.js +60 -0
  2. package/animations/button/3d-flip/react.tsx +29 -0
  3. package/animations/button/3d-flip/style.css +17 -0
  4. package/animations/button/blur-fade-in/index.js +21 -0
  5. package/animations/button/blur-fade-in/react.tsx +26 -0
  6. package/animations/button/blur-fade-in/style.css +27 -0
  7. package/animations/button/border-beam/index.js +172 -0
  8. package/animations/button/border-beam/react.tsx +55 -0
  9. package/animations/button/border-beam/style.css +59 -0
  10. package/animations/button/bounce-elastic/index.js +21 -0
  11. package/animations/button/bounce-elastic/react.tsx +26 -0
  12. package/animations/button/bounce-elastic/style.css +31 -0
  13. package/animations/button/bubble-button/index.js +317 -0
  14. package/animations/button/bubble-button/react.tsx +19 -0
  15. package/animations/button/bubble-button/style.css +245 -0
  16. package/animations/button/confetti-button/index.js +66 -0
  17. package/animations/button/confetti-button/react.tsx +30 -0
  18. package/animations/button/confetti-button/style.css +48 -0
  19. package/animations/button/glow-cta/index.js +69 -0
  20. package/animations/button/glow-cta/react.tsx +45 -0
  21. package/animations/button/glow-cta/style.css +78 -0
  22. package/animations/button/magnetic-hover/index.js +61 -0
  23. package/animations/button/magnetic-hover/react.tsx +29 -0
  24. package/animations/button/magnetic-hover/style.css +18 -0
  25. package/animations/button/pulse/index.js +21 -0
  26. package/animations/button/pulse/react.tsx +26 -0
  27. package/animations/button/pulse/style.css +24 -0
  28. package/animations/button/rainbow-button/index.js +21 -0
  29. package/animations/button/rainbow-button/react.tsx +26 -0
  30. package/animations/button/rainbow-button/style.css +54 -0
  31. package/animations/button/shimmer-border/index.js +28 -0
  32. package/animations/button/shimmer-border/react.tsx +41 -0
  33. package/animations/button/shimmer-border/style.css +53 -0
  34. package/animations/button/sketch-button/index.js +16 -0
  35. package/animations/button/sketch-button/react.tsx +19 -0
  36. package/animations/button/sketch-button/style.css +25 -0
  37. package/animations/card/blur-rise/index.js +21 -0
  38. package/animations/card/blur-rise/react.tsx +26 -0
  39. package/animations/card/blur-rise/style.css +27 -0
  40. package/animations/card/bounce-in-bottom/index.js +21 -0
  41. package/animations/card/bounce-in-bottom/react.tsx +26 -0
  42. package/animations/card/bounce-in-bottom/style.css +31 -0
  43. package/animations/card/card-fan-spread/index.js +146 -0
  44. package/animations/card/card-fan-spread/react.tsx +35 -0
  45. package/animations/card/card-fan-spread/style.css +90 -0
  46. package/animations/card/card-flip/index.js +203 -0
  47. package/animations/card/card-flip/react.tsx +35 -0
  48. package/animations/card/card-flip/style.css +71 -0
  49. package/animations/card/float-idle/index.js +21 -0
  50. package/animations/card/float-idle/react.tsx +26 -0
  51. package/animations/card/float-idle/style.css +21 -0
  52. package/animations/card/image-magnifier/index.js +333 -0
  53. package/animations/card/image-magnifier/react.tsx +31 -0
  54. package/animations/card/image-magnifier/style.css +42 -0
  55. package/animations/card/image-zoom-rotate/index.js +48 -0
  56. package/animations/card/image-zoom-rotate/react.tsx +31 -0
  57. package/animations/card/image-zoom-rotate/style.css +20 -0
  58. package/animations/card/pop-in-stack/index.js +25 -0
  59. package/animations/card/pop-in-stack/react.tsx +33 -0
  60. package/animations/card/pop-in-stack/style.css +25 -0
  61. package/animations/card/reveal-from-top/index.js +21 -0
  62. package/animations/card/reveal-from-top/react.tsx +26 -0
  63. package/animations/card/reveal-from-top/style.css +28 -0
  64. package/animations/card/rgb-split-glitch/index.js +28 -0
  65. package/animations/card/rgb-split-glitch/react.tsx +41 -0
  66. package/animations/card/rgb-split-glitch/style.css +33 -0
  67. package/animations/card/tilted-card/index.js +64 -0
  68. package/animations/card/tilted-card/react.tsx +33 -0
  69. package/animations/card/tilted-card/style.css +27 -0
  70. package/animations/header/anime-splittext/index.js +108 -0
  71. package/animations/header/anime-splittext/react.tsx +30 -0
  72. package/animations/header/anime-splittext/style.css +71 -0
  73. package/animations/header/bounce-in-down/index.js +40 -0
  74. package/animations/header/bounce-in-down/react.tsx +29 -0
  75. package/animations/header/bounce-in-down/style.css +40 -0
  76. package/animations/header/fly-in-chars/index.js +46 -0
  77. package/animations/header/fly-in-chars/react.tsx +30 -0
  78. package/animations/header/fly-in-chars/style.css +29 -0
  79. package/animations/header/gradient-text/index.js +21 -0
  80. package/animations/header/gradient-text/react.tsx +26 -0
  81. package/animations/header/gradient-text/style.css +28 -0
  82. package/animations/header/letter-bounce/index.js +33 -0
  83. package/animations/header/letter-bounce/react.tsx +34 -0
  84. package/animations/header/letter-bounce/style.css +25 -0
  85. package/animations/header/roll-in/index.js +40 -0
  86. package/animations/header/roll-in/react.tsx +29 -0
  87. package/animations/header/roll-in/style.css +31 -0
  88. package/animations/header/shimmer-text/index.js +16 -0
  89. package/animations/header/shimmer-text/react.tsx +28 -0
  90. package/animations/header/shimmer-text/style.css +29 -0
  91. package/animations/header/shuffle/index.js +118 -0
  92. package/animations/header/shuffle/react.tsx +50 -0
  93. package/animations/header/shuffle/style.css +25 -0
  94. package/animations/header/split-text/index.js +72 -0
  95. package/animations/header/split-text/react.tsx +38 -0
  96. package/animations/header/split-text/style.css +31 -0
  97. package/animations/header/text-type/index.js +267 -0
  98. package/animations/header/text-type/react.tsx +63 -0
  99. package/animations/header/text-type/style.css +37 -0
  100. package/animations/header/word-curtain-reveal/index.js +97 -0
  101. package/animations/header/word-curtain-reveal/react.tsx +30 -0
  102. package/animations/header/word-curtain-reveal/style.css +39 -0
  103. package/dist/button/3d-flip/react.js +21 -0
  104. package/dist/button/3d-flip.js +61 -0
  105. package/dist/button/blur-fade-in/react.js +28 -0
  106. package/dist/button/blur-fade-in.js +17 -0
  107. package/dist/button/border-beam/react.js +22 -0
  108. package/dist/button/border-beam.js +168 -0
  109. package/dist/button/bounce-elastic/react.js +28 -0
  110. package/dist/button/bounce-elastic.js +17 -0
  111. package/dist/button/bubble-button/react.js +20 -0
  112. package/dist/button/bubble-button.js +318 -0
  113. package/dist/button/confetti-button/react.js +21 -0
  114. package/dist/button/confetti-button.js +67 -0
  115. package/dist/button/glow-cta/react.js +23 -0
  116. package/dist/button/glow-cta.js +65 -0
  117. package/dist/button/magnetic-hover/react.js +21 -0
  118. package/dist/button/magnetic-hover.js +62 -0
  119. package/dist/button/pulse/react.js +28 -0
  120. package/dist/button/pulse.js +17 -0
  121. package/dist/button/rainbow-button/react.js +28 -0
  122. package/dist/button/rainbow-button.js +17 -0
  123. package/dist/button/shimmer-border/react.js +22 -0
  124. package/dist/button/shimmer-border.js +24 -0
  125. package/dist/button/sketch-button/react.js +20 -0
  126. package/dist/button/sketch-button.js +17 -0
  127. package/dist/card/blur-rise/react.js +28 -0
  128. package/dist/card/blur-rise.js +17 -0
  129. package/dist/card/bounce-in-bottom/react.js +28 -0
  130. package/dist/card/bounce-in-bottom.js +17 -0
  131. package/dist/card/card-fan-spread/react.js +20 -0
  132. package/dist/card/card-fan-spread.js +147 -0
  133. package/dist/card/float-idle/react.js +28 -0
  134. package/dist/card/float-idle.js +17 -0
  135. package/dist/card/image-magnifier/react.js +22 -0
  136. package/dist/card/image-magnifier.js +334 -0
  137. package/dist/card/image-zoom-rotate/react.js +21 -0
  138. package/dist/card/image-zoom-rotate.js +49 -0
  139. package/dist/card/pop-in-stack/react.js +20 -0
  140. package/dist/card/pop-in-stack.js +26 -0
  141. package/dist/card/reveal-from-top/react.js +28 -0
  142. package/dist/card/reveal-from-top.js +17 -0
  143. package/dist/card/rgb-split-glitch/react.js +22 -0
  144. package/dist/card/rgb-split-glitch.js +24 -0
  145. package/dist/card/tilted-card/react.js +21 -0
  146. package/dist/card/tilted-card.js +65 -0
  147. package/dist/chunks/constants-EnH6-Pz4.js +66 -0
  148. package/dist/chunks/constants-ZTHic1pf.js +66 -0
  149. package/dist/chunks/pointer-follow-B3RFnn_q.js +93 -0
  150. package/dist/chunks/pointer-follow-BETANySn.js +93 -0
  151. package/dist/chunks/reduced-motion-BpQYuEzK.js +17 -0
  152. package/dist/chunks/reduced-motion-HX79Ac8G.js +17 -0
  153. package/dist/chunks/resolve-card-media-Cj3V_oms.js +43 -0
  154. package/dist/chunks/resolve-card-media-DBIU-duL.js +43 -0
  155. package/dist/chunks/text-split-D02jltVh.js +191 -0
  156. package/dist/chunks/text-split-frOR4UpH.js +191 -0
  157. package/dist/full.css +1 -0
  158. package/dist/full.js +3192 -0
  159. package/dist/header/anime-splittext/react.js +22 -0
  160. package/dist/header/anime-splittext.js +109 -0
  161. package/dist/header/bounce-in-down/react.js +32 -0
  162. package/dist/header/bounce-in-down.js +36 -0
  163. package/dist/header/fly-in-chars/react.js +23 -0
  164. package/dist/header/fly-in-chars.js +47 -0
  165. package/dist/header/gradient-text/react.js +28 -0
  166. package/dist/header/gradient-text.js +17 -0
  167. package/dist/header/letter-bounce/react.js +23 -0
  168. package/dist/header/letter-bounce.js +34 -0
  169. package/dist/header/roll-in/react.js +32 -0
  170. package/dist/header/roll-in.js +36 -0
  171. package/dist/header/shimmer-text/react.js +27 -0
  172. package/dist/header/shimmer-text.js +17 -0
  173. package/dist/header/shuffle/react.js +30 -0
  174. package/dist/header/shuffle.js +119 -0
  175. package/dist/header/split-text/react.js +26 -0
  176. package/dist/header/split-text.js +73 -0
  177. package/dist/header/text-type/react.js +43 -0
  178. package/dist/header/text-type.js +268 -0
  179. package/dist/header/word-curtain-reveal/react.js +22 -0
  180. package/dist/header/word-curtain-reveal.js +98 -0
  181. package/dist/meta.json +6 -0
  182. package/dist/metadata.json +1051 -0
  183. package/dist/react.css +1 -0
  184. package/dist/types/animations/button/3d-flip/index.d.ts +3 -0
  185. package/dist/types/animations/button/3d-flip/react.d.ts +8 -0
  186. package/dist/types/animations/button/blur-fade-in/index.d.ts +3 -0
  187. package/dist/types/animations/button/blur-fade-in/react.d.ts +13 -0
  188. package/dist/types/animations/button/border-beam/index.d.ts +3 -0
  189. package/dist/types/animations/button/border-beam/react.d.ts +25 -0
  190. package/dist/types/animations/button/bounce-elastic/index.d.ts +3 -0
  191. package/dist/types/animations/button/bounce-elastic/react.d.ts +13 -0
  192. package/dist/types/animations/button/bubble-button/index.d.ts +3 -0
  193. package/dist/types/animations/button/bubble-button/react.d.ts +4 -0
  194. package/dist/types/animations/button/confetti-button/index.d.ts +3 -0
  195. package/dist/types/animations/button/confetti-button/react.d.ts +8 -0
  196. package/dist/types/animations/button/glow-cta/index.d.ts +3 -0
  197. package/dist/types/animations/button/glow-cta/react.d.ts +20 -0
  198. package/dist/types/animations/button/magnetic-hover/index.d.ts +3 -0
  199. package/dist/types/animations/button/magnetic-hover/react.d.ts +8 -0
  200. package/dist/types/animations/button/pulse/index.d.ts +3 -0
  201. package/dist/types/animations/button/pulse/react.d.ts +13 -0
  202. package/dist/types/animations/button/rainbow-button/index.d.ts +3 -0
  203. package/dist/types/animations/button/rainbow-button/react.d.ts +13 -0
  204. package/dist/types/animations/button/shimmer-border/index.d.ts +3 -0
  205. package/dist/types/animations/button/shimmer-border/react.d.ts +18 -0
  206. package/dist/types/animations/button/sketch-button/index.d.ts +3 -0
  207. package/dist/types/animations/button/sketch-button/react.d.ts +4 -0
  208. package/dist/types/animations/card/blur-rise/index.d.ts +3 -0
  209. package/dist/types/animations/card/blur-rise/react.d.ts +13 -0
  210. package/dist/types/animations/card/bounce-in-bottom/index.d.ts +3 -0
  211. package/dist/types/animations/card/bounce-in-bottom/react.d.ts +13 -0
  212. package/dist/types/animations/card/card-fan-spread/index.d.ts +3 -0
  213. package/dist/types/animations/card/card-fan-spread/react.d.ts +11 -0
  214. package/dist/types/animations/card/card-flip/index.d.ts +3 -0
  215. package/dist/types/animations/card/card-flip/react.d.ts +11 -0
  216. package/dist/types/animations/card/float-idle/index.d.ts +3 -0
  217. package/dist/types/animations/card/float-idle/react.d.ts +13 -0
  218. package/dist/types/animations/card/image-magnifier/index.d.ts +3 -0
  219. package/dist/types/animations/card/image-magnifier/react.d.ts +9 -0
  220. package/dist/types/animations/card/image-zoom-rotate/index.d.ts +3 -0
  221. package/dist/types/animations/card/image-zoom-rotate/react.d.ts +9 -0
  222. package/dist/types/animations/card/pop-in-stack/index.d.ts +3 -0
  223. package/dist/types/animations/card/pop-in-stack/react.d.ts +10 -0
  224. package/dist/types/animations/card/reveal-from-top/index.d.ts +3 -0
  225. package/dist/types/animations/card/reveal-from-top/react.d.ts +13 -0
  226. package/dist/types/animations/card/rgb-split-glitch/index.d.ts +3 -0
  227. package/dist/types/animations/card/rgb-split-glitch/react.d.ts +18 -0
  228. package/dist/types/animations/card/tilted-card/index.d.ts +3 -0
  229. package/dist/types/animations/card/tilted-card/react.d.ts +10 -0
  230. package/dist/types/animations/header/anime-splittext/index.d.ts +3 -0
  231. package/dist/types/animations/header/anime-splittext/react.d.ts +8 -0
  232. package/dist/types/animations/header/bounce-in-down/index.d.ts +3 -0
  233. package/dist/types/animations/header/bounce-in-down/react.d.ts +13 -0
  234. package/dist/types/animations/header/fly-in-chars/index.d.ts +3 -0
  235. package/dist/types/animations/header/fly-in-chars/react.d.ts +8 -0
  236. package/dist/types/animations/header/gradient-text/index.d.ts +3 -0
  237. package/dist/types/animations/header/gradient-text/react.d.ts +13 -0
  238. package/dist/types/animations/header/letter-bounce/index.d.ts +3 -0
  239. package/dist/types/animations/header/letter-bounce/react.d.ts +10 -0
  240. package/dist/types/animations/header/roll-in/index.d.ts +3 -0
  241. package/dist/types/animations/header/roll-in/react.d.ts +13 -0
  242. package/dist/types/animations/header/shimmer-text/index.d.ts +3 -0
  243. package/dist/types/animations/header/shimmer-text/react.d.ts +4 -0
  244. package/dist/types/animations/header/shuffle/index.d.ts +3 -0
  245. package/dist/types/animations/header/shuffle/react.d.ts +14 -0
  246. package/dist/types/animations/header/split-text/index.d.ts +3 -0
  247. package/dist/types/animations/header/split-text/react.d.ts +10 -0
  248. package/dist/types/animations/header/text-type/index.d.ts +3 -0
  249. package/dist/types/animations/header/text-type/react.d.ts +13 -0
  250. package/dist/types/animations/header/word-curtain-reveal/index.d.ts +3 -0
  251. package/dist/types/animations/header/word-curtain-reveal/react.d.ts +8 -0
  252. package/dist/types/react-barrel.d.ts +34 -0
  253. package/dist/types/scripts/bundle-all.d.ts +173 -0
  254. package/dist/types/scripts/check-metadata.d.ts +1 -0
  255. package/dist/types/scripts/copy-metadata.d.ts +1 -0
  256. package/dist/types/scripts/generate-animation-id-map.d.ts +1 -0
  257. package/dist/types/scripts/generate-dist-meta.d.ts +1 -0
  258. package/dist/types/scripts/generate-preview-manifest.d.ts +1 -0
  259. package/dist/types/scripts/update-metadata.d.ts +1 -0
  260. package/dist/types/shared/constants.d.ts +34 -0
  261. package/dist/types/shared/meta.d.ts +18 -0
  262. package/dist/types/shared/pointer-follow.d.ts +8 -0
  263. package/dist/types/shared/reduced-motion.d.ts +11 -0
  264. package/dist/types/shared/resolve-card-media.d.ts +1 -0
  265. package/dist/types/shared/text-split.d.ts +19 -0
  266. package/dist/types/stories/3d-flip.stories.d.ts +7 -0
  267. package/dist/types/stories/_helpers.d.ts +24 -0
  268. package/dist/types/stories/anime-splittext.stories.d.ts +8 -0
  269. package/dist/types/stories/blur-fade-in.stories.d.ts +8 -0
  270. package/dist/types/stories/blur-rise.stories.d.ts +8 -0
  271. package/dist/types/stories/blur-to-sharp-rise-header.stories.d.ts +8 -0
  272. package/dist/types/stories/border-beam.stories.d.ts +8 -0
  273. package/dist/types/stories/bounce-elastic.stories.d.ts +8 -0
  274. package/dist/types/stories/bounce-in-bottom.stories.d.ts +8 -0
  275. package/dist/types/stories/bounce-in-down.stories.d.ts +9 -0
  276. package/dist/types/stories/bubble-button.stories.d.ts +8 -0
  277. package/dist/types/stories/card-fan-spread.stories.d.ts +7 -0
  278. package/dist/types/stories/card-flip.stories.d.ts +7 -0
  279. package/dist/types/stories/confetti-button.stories.d.ts +7 -0
  280. package/dist/types/stories/float-idle.stories.d.ts +8 -0
  281. package/dist/types/stories/fly-in-chars.stories.d.ts +8 -0
  282. package/dist/types/stories/glow-cta.stories.d.ts +9 -0
  283. package/dist/types/stories/gradient-text.stories.d.ts +9 -0
  284. package/dist/types/stories/image-magnifier.stories.d.ts +10 -0
  285. package/dist/types/stories/image-zoom-rotate.stories.d.ts +7 -0
  286. package/dist/types/stories/letter-bounce.stories.d.ts +8 -0
  287. package/dist/types/stories/magic-ui-border-beam-card.stories.d.ts +8 -0
  288. package/dist/types/stories/magnetic-hover.stories.d.ts +7 -0
  289. package/dist/types/stories/pop-in-stack.stories.d.ts +7 -0
  290. package/dist/types/stories/pulse.stories.d.ts +8 -0
  291. package/dist/types/stories/rainbow-button.stories.d.ts +8 -0
  292. package/dist/types/stories/reveal-from-top.stories.d.ts +8 -0
  293. package/dist/types/stories/rgb-split-glitch.stories.d.ts +8 -0
  294. package/dist/types/stories/roll-in.stories.d.ts +9 -0
  295. package/dist/types/stories/shimmer-border.stories.d.ts +9 -0
  296. package/dist/types/stories/shimmer-text.stories.d.ts +8 -0
  297. package/dist/types/stories/shuffle.stories.d.ts +8 -0
  298. package/dist/types/stories/sketch-button.stories.d.ts +7 -0
  299. package/dist/types/stories/split-text.stories.d.ts +8 -0
  300. package/dist/types/stories/text-type.stories.d.ts +8 -0
  301. package/dist/types/stories/tilted-card.stories.d.ts +7 -0
  302. package/dist/types/stories/word-curtain-reveal.stories.d.ts +8 -0
  303. package/package.json +166 -0
  304. package/react-barrel.js +44 -0
  305. package/shared/constants.js +64 -0
  306. package/shared/meta.js +21 -0
  307. package/shared/pointer-follow.js +91 -0
  308. package/shared/reduced-motion.js +15 -0
  309. package/shared/resolve-card-media.js +41 -0
  310. package/shared/text-split.js +188 -0
@@ -0,0 +1,22 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { init, destroy } from '../anime-splittext.js';
4
+ import '../../chunks/constants-EnH6-Pz4.js';
5
+
6
+ function AnimAnimeSplittext({ children, stagger, duration, }) {
7
+ const ref = useRef(null);
8
+ useEffect(() => {
9
+ const el = ref.current;
10
+ if (!el)
11
+ return;
12
+ if (prefersReducedMotion())
13
+ return;
14
+ init(el, { stagger, duration });
15
+ return () => {
16
+ destroy(el);
17
+ };
18
+ }, [duration, stagger]);
19
+ return React.cloneElement(React.Children.only(children), { ref });
20
+ }
21
+
22
+ export { AnimAnimeSplittext };
@@ -0,0 +1,109 @@
1
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
2
+
3
+ const ANIMATION_ID = buildAnimId('anime-splittext');
4
+
5
+ const CSS_CLASS = buildAnimClass('anime-splittext');
6
+ const WORD_CLASS = buildAnimClass('anime-word');
7
+ const WORD_INNER_CLASS = buildAnimClass('anime-word-inner');
8
+ const CHAR_CLASS = buildAnimClass('anime-char');
9
+
10
+ function splitAnimatedUnits(text) {
11
+ if (/\s/.test(text)) {
12
+ return text.split(/(\s+)/).filter(Boolean)
13
+ }
14
+
15
+ return Array.from(text)
16
+ }
17
+
18
+ function buildWordFragment(word, wordIndex, stagger, duration) {
19
+ const outer = document.createElement('span');
20
+ outer.className = WORD_CLASS;
21
+ outer.style.setProperty('--readdy-anim-word-offset', wordIndex % 2 === 0 ? '110%' : '-110%');
22
+
23
+ const inner = document.createElement('span');
24
+ inner.className = WORD_INNER_CLASS;
25
+ inner.style.setProperty('--readdy-anim-word-delay', `${wordIndex * stagger}ms`);
26
+ inner.style.setProperty('--readdy-anim-word-loop-delay', `${duration + 20 + wordIndex * stagger}ms`)
27
+
28
+ ;[...word].forEach((char, charIndex) => {
29
+ const charSpan = document.createElement('span');
30
+ charSpan.className = CHAR_CLASS;
31
+ charSpan.textContent = char;
32
+ charSpan.style.setProperty(
33
+ '--readdy-anim-char-delay',
34
+ `${Math.round(duration * 0.6) + wordIndex * stagger + charIndex * 36}ms`
35
+ );
36
+ inner.appendChild(charSpan);
37
+ });
38
+
39
+ outer.appendChild(inner);
40
+ return outer
41
+ }
42
+
43
+ function wrapWordsInTextNode(textNode, getWordIndex, stagger, duration) {
44
+ const text = textNode.textContent ?? '';
45
+ if (!text.trim()) {
46
+ return
47
+ }
48
+
49
+ const parts = splitAnimatedUnits(text);
50
+ const fragment = document.createDocumentFragment();
51
+
52
+ for (const part of parts) {
53
+ if (!part) continue
54
+
55
+ if (/^\s+$/.test(part)) {
56
+ fragment.appendChild(document.createTextNode(part));
57
+ continue
58
+ }
59
+
60
+ fragment.appendChild(buildWordFragment(part, getWordIndex(), stagger, duration));
61
+ }
62
+
63
+ textNode.parentNode?.replaceChild(fragment, textNode);
64
+ }
65
+
66
+ function splitWords(el, options = {}) {
67
+ if (!el.dataset.originalText) {
68
+ el.dataset.originalText = el.innerHTML;
69
+ }
70
+
71
+ const stagger = options.stagger ?? 120;
72
+ const duration = options.duration ?? 700;
73
+
74
+ let wordIndex = 0;
75
+ const walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT);
76
+ const textNodes = [];
77
+ let node = walker.nextNode();
78
+
79
+ while (node) {
80
+ textNodes.push(node);
81
+ node = walker.nextNode();
82
+ }
83
+
84
+ for (const textNode of textNodes) {
85
+ wrapWordsInTextNode(textNode, () => wordIndex++, stagger, duration);
86
+ }
87
+ }
88
+
89
+ function init(el, options = {}) {
90
+ destroy(el);
91
+
92
+ if (!el.classList.contains(CSS_CLASS)) {
93
+ el.classList.add(CSS_CLASS);
94
+ }
95
+
96
+ el.style.setProperty('--readdy-anim-anime-word-duration', `${options.duration ?? 700}ms`);
97
+ splitWords(el, options);
98
+ }
99
+
100
+ function destroy(el) {
101
+ el.classList.remove(CSS_CLASS);
102
+ el.style.removeProperty('--readdy-anim-anime-word-duration');
103
+ if (el.dataset.originalText) {
104
+ el.innerHTML = el.dataset.originalText;
105
+ delete el.dataset.originalText;
106
+ }
107
+ }
108
+
109
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,32 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { init, destroy } from '../bounce-in-down.js';
4
+ import '../../chunks/constants-EnH6-Pz4.js';
5
+ import '../../chunks/text-split-frOR4UpH.js';
6
+
7
+ /**
8
+ * Bounce In Down — 从上方弹入
9
+ *
10
+ * 用法:
11
+ * <AnimBounceInDown><p>标题文字</p></AnimBounceInDown>
12
+ *
13
+ * 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-bounce-in-down class
14
+ * 必须恰好包裹一个子元素
15
+ */
16
+ function AnimBounceInDown({ children }) {
17
+ const ref = useRef(null);
18
+ useEffect(() => {
19
+ const el = ref.current;
20
+ if (!el)
21
+ return;
22
+ if (prefersReducedMotion())
23
+ return;
24
+ init(el);
25
+ return () => {
26
+ destroy(el);
27
+ };
28
+ }, []);
29
+ return React.cloneElement(React.Children.only(children), { ref });
30
+ }
31
+
32
+ export { AnimBounceInDown };
@@ -0,0 +1,36 @@
1
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
2
+ import { s as splitTextIntoChars } from '../chunks/text-split-frOR4UpH.js';
3
+ import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
4
+
5
+ const ANIMATION_ID = buildAnimId('bounce-in-down');
6
+
7
+ const CSS_CLASS = buildAnimClass('bounce-in-down');
8
+ const CHAR_CLASS = buildAnimClass('bounce-in-down-char');
9
+
10
+ function init(el, options = {}) {
11
+ if (el.classList.contains(CSS_CLASS)) {
12
+ return
13
+ }
14
+
15
+ el.classList.add(CSS_CLASS);
16
+
17
+ if (prefersReducedMotion()) {
18
+ return
19
+ }
20
+
21
+ splitTextIntoChars(el, {
22
+ stagger: options.stagger ?? 40,
23
+ charClass: CHAR_CLASS,
24
+ maxChars: options.maxChars ?? 160,
25
+ });
26
+ }
27
+
28
+ function destroy(el) {
29
+ el.classList.remove(CSS_CLASS);
30
+ if (el.dataset.originalText) {
31
+ el.innerHTML = el.dataset.originalText;
32
+ delete el.dataset.originalText;
33
+ }
34
+ }
35
+
36
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,23 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { init, destroy } from '../fly-in-chars.js';
4
+ import '../../chunks/text-split-frOR4UpH.js';
5
+ import '../../chunks/constants-EnH6-Pz4.js';
6
+
7
+ function AnimFlyInChars({ children, stagger, maxChars, }) {
8
+ const ref = useRef(null);
9
+ useEffect(() => {
10
+ const el = ref.current;
11
+ if (!el)
12
+ return;
13
+ if (prefersReducedMotion())
14
+ return;
15
+ init(el, { stagger, maxChars });
16
+ return () => {
17
+ destroy(el);
18
+ };
19
+ }, [maxChars, stagger]);
20
+ return React.cloneElement(React.Children.only(children), { ref });
21
+ }
22
+
23
+ export { AnimFlyInChars };
@@ -0,0 +1,47 @@
1
+ import { s as splitTextIntoChars } from '../chunks/text-split-frOR4UpH.js';
2
+ import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
4
+
5
+ const ANIMATION_ID = buildAnimId('fly-in-chars');
6
+
7
+ const CSS_CLASS = buildAnimClass('fly-in-chars');
8
+ const CHAR_CLASS = buildAnimClass('fly-in-char');
9
+
10
+ function randomBetween(min, max) {
11
+ return Math.round(min + Math.random() * (max - min))
12
+ }
13
+
14
+ function init(el, options = {}) {
15
+ if (el.classList.contains(CSS_CLASS)) {
16
+ return
17
+ }
18
+
19
+ el.classList.add(CSS_CLASS);
20
+
21
+ if (prefersReducedMotion()) {
22
+ return
23
+ }
24
+
25
+ splitTextIntoChars(el, {
26
+ stagger: options.stagger ?? 36,
27
+ charClass: CHAR_CLASS,
28
+ maxChars: options.maxChars ?? 160,
29
+ });
30
+
31
+ const chars = el.querySelectorAll(`.${CHAR_CLASS}`);
32
+ for (const char of chars) {
33
+ char.style.setProperty('--readdy-anim-fly-in-x', `${randomBetween(-120, 120)}px`);
34
+ char.style.setProperty('--readdy-anim-fly-in-y', `${randomBetween(-80, 80)}px`);
35
+ char.style.setProperty('--readdy-anim-fly-in-rotate', `${randomBetween(-25, 25)}deg`);
36
+ }
37
+ }
38
+
39
+ function destroy(el) {
40
+ el.classList.remove(CSS_CLASS);
41
+ if (el.dataset.originalText) {
42
+ el.innerHTML = el.dataset.originalText;
43
+ delete el.dataset.originalText;
44
+ }
45
+ }
46
+
47
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,28 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { init, destroy } from '../gradient-text.js';
3
+ import '../../chunks/constants-EnH6-Pz4.js';
4
+
5
+ /**
6
+ * Gradient Text — 渐变文字
7
+ *
8
+ * 用法:
9
+ * <AnimGradientText><p>标题文字</p></AnimGradientText>
10
+ *
11
+ * 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-gradient-text class
12
+ * 必须恰好包裹一个子元素
13
+ */
14
+ function AnimGradientText({ children }) {
15
+ const ref = useRef(null);
16
+ useEffect(() => {
17
+ const el = ref.current;
18
+ if (!el)
19
+ return;
20
+ init(el);
21
+ return () => {
22
+ destroy(el);
23
+ };
24
+ }, []);
25
+ return React.cloneElement(React.Children.only(children), { ref });
26
+ }
27
+
28
+ export { AnimGradientText };
@@ -0,0 +1,17 @@
1
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
2
+
3
+ const ANIMATION_ID = buildAnimId('gradient-text');
4
+
5
+ const CSS_CLASS = buildAnimClass('gradient-text');
6
+
7
+ function init(el, options = {}) {
8
+ if (!el.classList.contains(CSS_CLASS)) {
9
+ el.classList.add(CSS_CLASS);
10
+ }
11
+ }
12
+
13
+ function destroy(el) {
14
+ el.classList.remove(CSS_CLASS);
15
+ }
16
+
17
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,23 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { init, destroy } from '../letter-bounce.js';
4
+ import '../../chunks/text-split-frOR4UpH.js';
5
+ import '../../chunks/constants-EnH6-Pz4.js';
6
+
7
+ function AnimLetterBounce({ children, stagger, maxChars, duration, amplitude, }) {
8
+ const ref = useRef(null);
9
+ useEffect(() => {
10
+ const el = ref.current;
11
+ if (!el)
12
+ return;
13
+ if (prefersReducedMotion())
14
+ return;
15
+ init(el, { stagger, maxChars, duration, amplitude });
16
+ return () => {
17
+ destroy(el);
18
+ };
19
+ }, [amplitude, duration, maxChars, stagger]);
20
+ return React.cloneElement(React.Children.only(children), { ref });
21
+ }
22
+
23
+ export { AnimLetterBounce };
@@ -0,0 +1,34 @@
1
+ import { s as splitTextIntoChars } from '../chunks/text-split-frOR4UpH.js';
2
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
3
+
4
+ const ANIMATION_ID = buildAnimId('letter-bounce');
5
+
6
+ const CSS_CLASS = buildAnimClass('letter-bounce');
7
+ const CHAR_CLASS = buildAnimClass('letter-bounce-char');
8
+
9
+ function init(el, options = {}) {
10
+ if (!el.classList.contains(CSS_CLASS)) {
11
+ el.classList.add(CSS_CLASS);
12
+ }
13
+
14
+ el.style.setProperty('--readdy-anim-letter-bounce-duration', `${options.duration ?? 850}ms`);
15
+ el.style.setProperty('--readdy-anim-letter-bounce-amplitude', `${options.amplitude ?? 6}px`);
16
+
17
+ splitTextIntoChars(el, {
18
+ stagger: options.stagger ?? 60,
19
+ charClass: CHAR_CLASS,
20
+ maxChars: options.maxChars ?? 160,
21
+ });
22
+ }
23
+
24
+ function destroy(el) {
25
+ el.classList.remove(CSS_CLASS);
26
+ el.style.removeProperty('--readdy-anim-letter-bounce-duration');
27
+ el.style.removeProperty('--readdy-anim-letter-bounce-amplitude');
28
+ if (el.dataset.originalText) {
29
+ el.innerHTML = el.dataset.originalText;
30
+ delete el.dataset.originalText;
31
+ }
32
+ }
33
+
34
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,32 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { init, destroy } from '../roll-in.js';
4
+ import '../../chunks/constants-EnH6-Pz4.js';
5
+ import '../../chunks/text-split-frOR4UpH.js';
6
+
7
+ /**
8
+ * Roll In — 文字滚入
9
+ *
10
+ * 用法:
11
+ * <AnimRollIn><p>标题文字</p></AnimRollIn>
12
+ *
13
+ * 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-roll-in class
14
+ * 必须恰好包裹一个子元素
15
+ */
16
+ function AnimRollIn({ children }) {
17
+ const ref = useRef(null);
18
+ useEffect(() => {
19
+ const el = ref.current;
20
+ if (!el)
21
+ return;
22
+ if (prefersReducedMotion())
23
+ return;
24
+ init(el);
25
+ return () => {
26
+ destroy(el);
27
+ };
28
+ }, []);
29
+ return React.cloneElement(React.Children.only(children), { ref });
30
+ }
31
+
32
+ export { AnimRollIn };
@@ -0,0 +1,36 @@
1
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
2
+ import { s as splitTextIntoChars } from '../chunks/text-split-frOR4UpH.js';
3
+ import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
4
+
5
+ const ANIMATION_ID = buildAnimId('roll-in');
6
+
7
+ const CSS_CLASS = buildAnimClass('roll-in');
8
+ const CHAR_CLASS = buildAnimClass('roll-in-char');
9
+
10
+ function init(el, options = {}) {
11
+ if (el.classList.contains(CSS_CLASS)) {
12
+ return
13
+ }
14
+
15
+ el.classList.add(CSS_CLASS);
16
+
17
+ if (prefersReducedMotion()) {
18
+ return
19
+ }
20
+
21
+ splitTextIntoChars(el, {
22
+ stagger: options.stagger ?? 45,
23
+ charClass: CHAR_CLASS,
24
+ maxChars: options.maxChars ?? 160,
25
+ });
26
+ }
27
+
28
+ function destroy(el) {
29
+ el.classList.remove(CSS_CLASS);
30
+ if (el.dataset.originalText) {
31
+ el.innerHTML = el.dataset.originalText;
32
+ delete el.dataset.originalText;
33
+ }
34
+ }
35
+
36
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,27 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { init, destroy } from '../shimmer-text.js';
4
+ import { a as buildAnimClass } from '../../chunks/constants-EnH6-Pz4.js';
5
+
6
+ const CSS_CLASS = buildAnimClass('shimmer-text');
7
+ function AnimShimmerText({ children }) {
8
+ const ref = useRef(null);
9
+ useEffect(() => {
10
+ const el = ref.current;
11
+ if (!el)
12
+ return;
13
+ if (prefersReducedMotion()) {
14
+ el.classList.add(CSS_CLASS);
15
+ return () => {
16
+ el.classList.remove(CSS_CLASS);
17
+ };
18
+ }
19
+ init(el);
20
+ return () => {
21
+ destroy(el);
22
+ };
23
+ }, []);
24
+ return React.cloneElement(React.Children.only(children), { ref });
25
+ }
26
+
27
+ export { AnimShimmerText };
@@ -0,0 +1,17 @@
1
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
2
+
3
+ const ANIMATION_ID = buildAnimId('shimmer-text');
4
+
5
+ const CSS_CLASS = buildAnimClass('shimmer-text');
6
+
7
+ function init(el) {
8
+ if (!el.classList.contains(CSS_CLASS)) {
9
+ el.classList.add(CSS_CLASS);
10
+ }
11
+ }
12
+
13
+ function destroy(el) {
14
+ el.classList.remove(CSS_CLASS);
15
+ }
16
+
17
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,30 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { init, destroy } from '../shuffle.js';
3
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
4
+ import '../../chunks/text-split-frOR4UpH.js';
5
+ import '../../chunks/constants-EnH6-Pz4.js';
6
+
7
+ function AnimShuffle({ children, stagger, shuffleFrames, frameDelay, maxChars, idleOpacity, idleOffset, idleScale, settleDuration, }) {
8
+ const ref = useRef(null);
9
+ useEffect(() => {
10
+ const el = ref.current;
11
+ if (!el || prefersReducedMotion())
12
+ return;
13
+ init(el, {
14
+ stagger,
15
+ shuffleFrames,
16
+ frameDelay,
17
+ maxChars,
18
+ idleOpacity,
19
+ idleOffset,
20
+ idleScale,
21
+ settleDuration,
22
+ });
23
+ return () => {
24
+ destroy(el);
25
+ };
26
+ }, [frameDelay, idleOffset, idleOpacity, idleScale, maxChars, settleDuration, shuffleFrames, stagger]);
27
+ return React.cloneElement(React.Children.only(children), { ref });
28
+ }
29
+
30
+ export { AnimShuffle };
@@ -0,0 +1,119 @@
1
+ import { s as splitTextIntoChars } from '../chunks/text-split-frOR4UpH.js';
2
+ import { p as prefersReducedMotion } from '../chunks/reduced-motion-HX79Ac8G.js';
3
+ import { b as buildAnimId, a as buildAnimClass } from '../chunks/constants-EnH6-Pz4.js';
4
+
5
+ const ANIMATION_ID = buildAnimId('shuffle');
6
+
7
+ const CSS_CLASS = buildAnimClass('shuffle');
8
+ const CHAR_CLASS = buildAnimClass('shuffle-char');
9
+ const GLYPHS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*+-?';
10
+ const stateMap = new WeakMap();
11
+
12
+ function randomGlyph() {
13
+ return GLYPHS[Math.floor(Math.random() * GLYPHS.length)]
14
+ }
15
+
16
+ function clearState(state) {
17
+ for (const intervalId of state.intervals) {
18
+ window.clearInterval(intervalId);
19
+ }
20
+ for (const timeoutId of state.timeouts) {
21
+ window.clearTimeout(timeoutId);
22
+ }
23
+ state.intervals = [];
24
+ state.timeouts = [];
25
+ }
26
+
27
+ function runShuffle(el, options = {}) {
28
+ const state = stateMap.get(el);
29
+ if (!state) return
30
+
31
+ clearState(state);
32
+
33
+ const chars = [...el.querySelectorAll(`.${CHAR_CLASS}`)];
34
+ chars.forEach((char, index) => {
35
+ const finalChar = char.dataset.finalChar ?? char.textContent ?? '';
36
+ const startDelay = index * (options.stagger ?? 35);
37
+ const frames = options.shuffleFrames ?? 7;
38
+ const frameDelay = options.frameDelay ?? 40;
39
+
40
+ char.textContent = randomGlyph();
41
+ char.classList.remove('is-settled');
42
+
43
+ const timeoutId = window.setTimeout(() => {
44
+ let frame = 0;
45
+ const intervalId = window.setInterval(() => {
46
+ frame += 1;
47
+ char.textContent = frame >= frames ? finalChar : randomGlyph();
48
+ char.classList.toggle('is-settled', frame >= frames);
49
+
50
+ if (frame >= frames) {
51
+ window.clearInterval(intervalId);
52
+ }
53
+ }, frameDelay);
54
+
55
+ state.intervals.push(intervalId);
56
+ }, startDelay);
57
+
58
+ state.timeouts.push(timeoutId);
59
+ });
60
+ }
61
+
62
+ function init(el, options = {}) {
63
+ if (el.classList.contains(CSS_CLASS)) {
64
+ return
65
+ }
66
+
67
+ el.classList.add(CSS_CLASS);
68
+
69
+ el.style.setProperty('--readdy-anim-shuffle-opacity', `${options.idleOpacity ?? 0.45}`);
70
+ el.style.setProperty('--readdy-anim-shuffle-translate-y', options.idleOffset ?? '0.08em');
71
+ el.style.setProperty('--readdy-anim-shuffle-scale', `${options.idleScale ?? 0.98}`);
72
+ el.style.setProperty('--readdy-anim-shuffle-settle-duration', `${options.settleDuration ?? 180}ms`);
73
+
74
+ splitTextIntoChars(el, {
75
+ stagger: options.stagger ?? 35,
76
+ charClass: CHAR_CLASS,
77
+ maxChars: options.maxChars ?? 120,
78
+ });
79
+
80
+ const chars = el.querySelectorAll(`.${CHAR_CLASS}`);
81
+ chars.forEach((char) => {
82
+ char.dataset.finalChar = char.textContent ?? '';
83
+ });
84
+
85
+ if (prefersReducedMotion()) {
86
+ return
87
+ }
88
+
89
+ const state = {
90
+ intervals: [],
91
+ timeouts: [],
92
+ onMouseEnter: () => runShuffle(el, options),
93
+ };
94
+
95
+ stateMap.set(el, state);
96
+ el.addEventListener('mouseenter', state.onMouseEnter);
97
+ runShuffle(el, options);
98
+ }
99
+
100
+ function destroy(el) {
101
+ const state = stateMap.get(el);
102
+ if (state) {
103
+ clearState(state);
104
+ el.removeEventListener('mouseenter', state.onMouseEnter);
105
+ stateMap.delete(el);
106
+ }
107
+
108
+ el.classList.remove(CSS_CLASS);
109
+ el.style.removeProperty('--readdy-anim-shuffle-opacity');
110
+ el.style.removeProperty('--readdy-anim-shuffle-translate-y');
111
+ el.style.removeProperty('--readdy-anim-shuffle-scale');
112
+ el.style.removeProperty('--readdy-anim-shuffle-settle-duration');
113
+ if (el.dataset.originalText) {
114
+ el.innerHTML = el.dataset.originalText;
115
+ delete el.dataset.originalText;
116
+ }
117
+ }
118
+
119
+ export { ANIMATION_ID, destroy, init };
@@ -0,0 +1,26 @@
1
+ import React, { useRef, useEffect } from 'react';
2
+ import { init, destroy } from '../split-text.js';
3
+ import { p as prefersReducedMotion } from '../../chunks/reduced-motion-HX79Ac8G.js';
4
+ import '../../chunks/text-split-frOR4UpH.js';
5
+ import '../../chunks/constants-EnH6-Pz4.js';
6
+
7
+ function AnimSplitText({ children, stagger, maxChars, threshold, rootMargin, }) {
8
+ const ref = useRef(null);
9
+ useEffect(() => {
10
+ const el = ref.current;
11
+ if (!el || prefersReducedMotion())
12
+ return;
13
+ init(el, {
14
+ stagger,
15
+ maxChars,
16
+ threshold,
17
+ rootMargin,
18
+ });
19
+ return () => {
20
+ destroy(el);
21
+ };
22
+ }, [maxChars, rootMargin, stagger, threshold]);
23
+ return React.cloneElement(React.Children.only(children), { ref });
24
+ }
25
+
26
+ export { AnimSplitText };