@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,25 @@
1
+ .readdy-anim-sketch-button {
2
+ background: #ffffff;
3
+ color: #0f172a;
4
+ border: 2px solid #0f172a;
5
+ box-shadow: 0 0 0 #0f172a;
6
+ transition:
7
+ transform 0.24s ease,
8
+ box-shadow 0.24s ease;
9
+ }
10
+
11
+ .readdy-anim-sketch-button:hover {
12
+ transform: translate(-4px, -4px);
13
+ box-shadow: 4px 4px 0 #0f172a;
14
+ }
15
+
16
+ @media (prefers-reduced-motion: reduce) {
17
+ .readdy-anim-sketch-button {
18
+ transition: none;
19
+ }
20
+
21
+ .readdy-anim-sketch-button:hover {
22
+ transform: none;
23
+ box-shadow: 0 0 0 #0f172a;
24
+ }
25
+ }
@@ -0,0 +1,21 @@
1
+ import { buildAnimClass, buildAnimId } from '../../../shared/constants.js'
2
+ export const ANIMATION_ID = buildAnimId('blur-rise')
3
+
4
+ /**
5
+ * Blur Rise — 卡片从模糊中升起
6
+ * 实现:CSS-only,init 给元素加 .readdy-anim-blur-rise class,destroy 移除
7
+ */
8
+
9
+ import './style.css'
10
+
11
+ const CSS_CLASS = buildAnimClass('blur-rise')
12
+
13
+ export function init(el, options = {}) {
14
+ if (!el.classList.contains(CSS_CLASS)) {
15
+ el.classList.add(CSS_CLASS)
16
+ }
17
+ }
18
+
19
+ export function destroy(el) {
20
+ el.classList.remove(CSS_CLASS)
21
+ }
@@ -0,0 +1,26 @@
1
+ import React, { useRef, useEffect } from 'react'
2
+ import { init, destroy } from './index.js'
3
+
4
+ /**
5
+ * Blur Rise — 卡片从模糊中升起
6
+ *
7
+ * 用法:
8
+ * <AnimBlurRise><div className="card">内容</div></AnimBlurRise>
9
+ *
10
+ * 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-blur-rise class
11
+ * 必须恰好包裹一个子元素
12
+ */
13
+ export function AnimBlurRise({ children }: { children: React.ReactElement }) {
14
+ const ref = useRef<HTMLElement>(null)
15
+
16
+ useEffect(() => {
17
+ const el = ref.current
18
+ if (!el) return
19
+ init(el)
20
+ return () => {
21
+ destroy(el)
22
+ }
23
+ }, [])
24
+
25
+ return React.cloneElement(React.Children.only(children), { ref })
26
+ }
@@ -0,0 +1,27 @@
1
+ /* Blur Rise — 卡片从模糊中升起 */
2
+
3
+ @keyframes readdy-anim-blur-rise {
4
+ from {
5
+ opacity: 0;
6
+ transform: translateY(20px);
7
+ filter: blur(8px);
8
+ }
9
+ to {
10
+ opacity: 1;
11
+ transform: translateY(0);
12
+ filter: blur(0);
13
+ }
14
+ }
15
+
16
+ .readdy-anim-blur-rise {
17
+ animation: readdy-anim-blur-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
18
+ }
19
+
20
+ @media (prefers-reduced-motion: reduce) {
21
+ .readdy-anim-blur-rise {
22
+ animation: none;
23
+ opacity: 1;
24
+ transform: none;
25
+ filter: none;
26
+ }
27
+ }
@@ -0,0 +1,21 @@
1
+ import { buildAnimClass, buildAnimId } from '../../../shared/constants.js'
2
+ export const ANIMATION_ID = buildAnimId('bounce-in-bottom')
3
+
4
+ /**
5
+ * Bounce In Bottom — 卡片从底部弹入
6
+ * 实现:CSS-only,init 给元素加 .readdy-anim-bounce-in-bottom class,destroy 移除
7
+ */
8
+
9
+ import './style.css'
10
+
11
+ const CSS_CLASS = buildAnimClass('bounce-in-bottom')
12
+
13
+ export function init(el, options = {}) {
14
+ if (!el.classList.contains(CSS_CLASS)) {
15
+ el.classList.add(CSS_CLASS)
16
+ }
17
+ }
18
+
19
+ export function destroy(el) {
20
+ el.classList.remove(CSS_CLASS)
21
+ }
@@ -0,0 +1,26 @@
1
+ import React, { useRef, useEffect } from 'react'
2
+ import { init, destroy } from './index.js'
3
+
4
+ /**
5
+ * Bounce In Bottom — 卡片从底部弹入
6
+ *
7
+ * 用法:
8
+ * <AnimBounceInBottom><div className="card">内容</div></AnimBounceInBottom>
9
+ *
10
+ * 不加 wrapper div — 通过 cloneElement 给子元素注入 ref,加/删 .readdy-anim-bounce-in-bottom class
11
+ * 必须恰好包裹一个子元素
12
+ */
13
+ export function AnimBounceInBottom({ children }: { children: React.ReactElement }) {
14
+ const ref = useRef<HTMLElement>(null)
15
+
16
+ useEffect(() => {
17
+ const el = ref.current
18
+ if (!el) return
19
+ init(el)
20
+ return () => {
21
+ destroy(el)
22
+ }
23
+ }, [])
24
+
25
+ return React.cloneElement(React.Children.only(children), { ref })
26
+ }
@@ -0,0 +1,31 @@
1
+ /* Bounce In Bottom — 卡片从底部弹入 */
2
+
3
+ @keyframes readdy-anim-bounce-in-bottom {
4
+ 0% {
5
+ opacity: 0;
6
+ transform: translateY(28px);
7
+ }
8
+ 65% {
9
+ opacity: 1;
10
+ transform: translateY(-6px);
11
+ }
12
+ 85% {
13
+ transform: translateY(3px);
14
+ }
15
+ 100% {
16
+ opacity: 1;
17
+ transform: translateY(0);
18
+ }
19
+ }
20
+
21
+ .readdy-anim-bounce-in-bottom {
22
+ animation: readdy-anim-bounce-in-bottom 0.85s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
23
+ }
24
+
25
+ @media (prefers-reduced-motion: reduce) {
26
+ .readdy-anim-bounce-in-bottom {
27
+ animation: none;
28
+ opacity: 1;
29
+ transform: none;
30
+ }
31
+ }
@@ -0,0 +1,146 @@
1
+ import './style.css'
2
+ import { prefersReducedMotion } from '../../../shared/reduced-motion.js'
3
+ import { buildAnimClass, buildAnimId } from '../../../shared/constants.js'
4
+
5
+ export const ANIMATION_ID = buildAnimId('card-fan-spread')
6
+
7
+ const CSS_CLASS = buildAnimClass('card-fan-spread')
8
+ const STACK_CLASS = buildAnimClass('card-fan-stack')
9
+ const ITEM_CLASS = buildAnimClass('card-fan-item')
10
+ const SURFACE_CLASS = buildAnimClass('card-fan-surface')
11
+ const VISUAL_CLASS = buildAnimClass('card-fan-visual')
12
+ const VISUAL_TEXT_CLASS = buildAnimClass('card-fan-visual-text')
13
+ const stateMap = new WeakMap()
14
+
15
+ function buildCardVisual(el) {
16
+ const visual = el.cloneNode(true)
17
+ visual.classList.add(VISUAL_CLASS)
18
+ visual.removeAttribute('id')
19
+ visual.removeAttribute('tabindex')
20
+ visual.removeAttribute('aria-labelledby')
21
+ visual.removeAttribute('aria-describedby')
22
+ visual.removeAttribute('aria-controls')
23
+ visual.querySelectorAll('[id]').forEach((node) => node.removeAttribute('id'))
24
+ visual.querySelectorAll('button, a, input, textarea, select, [tabindex]').forEach((node) => {
25
+ node.setAttribute('aria-hidden', 'true')
26
+ node.setAttribute('tabindex', '-1')
27
+ node.style.pointerEvents = 'none'
28
+ })
29
+ visual.querySelectorAll('video, audio').forEach((node) => {
30
+ node.pause?.()
31
+ node.removeAttribute('autoplay')
32
+ node.removeAttribute('controls')
33
+ })
34
+ visual.querySelectorAll('*').forEach((node) => {
35
+ if (node.closest(`.${buildAnimClass('card-media')}`)) return
36
+ if (node.children.length === 0 && (node.textContent ?? '').trim()) {
37
+ node.classList.add(VISUAL_TEXT_CLASS)
38
+ }
39
+ })
40
+ return visual
41
+ }
42
+
43
+ function buildLayer(visualTemplate, index, radius) {
44
+ const item = document.createElement('div')
45
+ item.className = ITEM_CLASS
46
+ item.setAttribute('aria-hidden', 'true')
47
+ item.style.setProperty('--readdy-anim-card-fan-index', `${index}`)
48
+
49
+ const surface = document.createElement('div')
50
+ surface.className = SURFACE_CLASS
51
+ surface.style.borderRadius = radius
52
+ surface.appendChild(visualTemplate.cloneNode(true))
53
+ item.appendChild(surface)
54
+ return item
55
+ }
56
+
57
+ function ensureStack(el, visual) {
58
+ const stack = document.createElement('div')
59
+ stack.className = STACK_CLASS
60
+ stack.setAttribute('aria-hidden', 'true')
61
+
62
+ for (let index = 0; index < 2; index += 1) {
63
+ stack.appendChild(buildLayer(visual.visualTemplate, index, visual.radius))
64
+ }
65
+
66
+ el.insertBefore(stack, el.firstChild)
67
+ return stack
68
+ }
69
+
70
+ export function init(el, options = {}) {
71
+ destroy(el)
72
+
73
+ el.classList.add(CSS_CLASS)
74
+ const spreadDistance = options.spreadDistance ?? 72
75
+ const spreadRotate = options.spreadRotate ?? 24
76
+ const depthRotate = options.depthRotate ?? 18
77
+ const lift = options.lift ?? 14
78
+ const duration = options.duration ?? 550
79
+
80
+ el.style.setProperty('--readdy-anim-card-fan-distance', `${spreadDistance}px`)
81
+ el.style.setProperty('--readdy-anim-card-fan-rotate', `${spreadRotate}deg`)
82
+ el.style.setProperty('--readdy-anim-card-fan-depth-rotate', `${depthRotate}deg`)
83
+ el.style.setProperty('--readdy-anim-card-fan-lift', `${lift}px`)
84
+ el.style.setProperty('--readdy-anim-card-fan-duration', `${duration}ms`)
85
+
86
+ const visual = {
87
+ visualTemplate: buildCardVisual(el),
88
+ radius: window.getComputedStyle(el).borderRadius || 'inherit',
89
+ }
90
+ const stack = ensureStack(el, visual)
91
+ const state = {
92
+ savedTabIndex: el.getAttribute('tabindex'),
93
+ toggle: null,
94
+ onKeyDown: null,
95
+ stack,
96
+ }
97
+
98
+ el.tabIndex = el.tabIndex >= 0 ? el.tabIndex : 0
99
+
100
+ if (prefersReducedMotion()) {
101
+ stateMap.set(el, state)
102
+ return
103
+ }
104
+
105
+ state.toggle = () => {
106
+ el.classList.toggle('is-spread')
107
+ }
108
+
109
+ state.onKeyDown = (event) => {
110
+ if (event.key === 'Enter' || event.key === ' ') {
111
+ event.preventDefault()
112
+ state.toggle()
113
+ }
114
+ }
115
+
116
+ el.addEventListener('click', state.toggle)
117
+ el.addEventListener('keydown', state.onKeyDown)
118
+ stateMap.set(el, state)
119
+ }
120
+
121
+ export function destroy(el) {
122
+ const state = stateMap.get(el)
123
+ if (state) {
124
+ if (state.toggle) {
125
+ el.removeEventListener('click', state.toggle)
126
+ }
127
+ if (state.onKeyDown) {
128
+ el.removeEventListener('keydown', state.onKeyDown)
129
+ }
130
+ if (state.savedTabIndex === null) {
131
+ el.removeAttribute('tabindex')
132
+ } else {
133
+ el.setAttribute('tabindex', state.savedTabIndex)
134
+ }
135
+ state.stack?.remove()
136
+ stateMap.delete(el)
137
+ }
138
+
139
+ el.classList.remove(CSS_CLASS, 'is-spread')
140
+ el.style.removeProperty('--readdy-anim-card-fan-distance')
141
+ el.style.removeProperty('--readdy-anim-card-fan-rotate')
142
+ el.style.removeProperty('--readdy-anim-card-fan-depth-rotate')
143
+ el.style.removeProperty('--readdy-anim-card-fan-lift')
144
+ el.style.removeProperty('--readdy-anim-card-fan-duration')
145
+ el.querySelector(`.${STACK_CLASS}`)?.remove()
146
+ }
@@ -0,0 +1,35 @@
1
+ import React, { useEffect, useRef } from 'react'
2
+ import { init, destroy } from './index.js'
3
+ import { prefersReducedMotion } from '../../../shared/reduced-motion.js'
4
+
5
+ type AnimCardFanSpreadProps = {
6
+ children: React.ReactElement
7
+ spreadDistance?: number
8
+ spreadRotate?: number
9
+ depthRotate?: number
10
+ lift?: number
11
+ duration?: number
12
+ }
13
+
14
+ export function AnimCardFanSpread({
15
+ children,
16
+ spreadDistance,
17
+ spreadRotate,
18
+ depthRotate,
19
+ lift,
20
+ duration,
21
+ }: AnimCardFanSpreadProps) {
22
+ const ref = useRef<HTMLElement>(null)
23
+
24
+ useEffect(() => {
25
+ const el = ref.current
26
+ if (!el || prefersReducedMotion()) return
27
+
28
+ init(el, { spreadDistance, spreadRotate, depthRotate, lift, duration })
29
+ return () => {
30
+ destroy(el)
31
+ }
32
+ }, [spreadDistance, spreadRotate, depthRotate, lift, duration])
33
+
34
+ return React.cloneElement(React.Children.only(children), { ref })
35
+ }
@@ -0,0 +1,90 @@
1
+ .readdy-anim-card-fan-spread {
2
+ position: relative;
3
+ isolation: isolate;
4
+ overflow: visible;
5
+ cursor: pointer;
6
+ perspective: 900px;
7
+ transform-style: preserve-3d;
8
+ }
9
+
10
+ .readdy-anim-card-fan-spread::before {
11
+ content: '';
12
+ position: absolute;
13
+ inset: 0;
14
+ border-radius: inherit;
15
+ background: inherit;
16
+ z-index: 2;
17
+ pointer-events: none;
18
+ }
19
+
20
+ .readdy-anim-card-fan-spread > :not(.readdy-anim-card-fan-stack) {
21
+ position: relative;
22
+ z-index: 3;
23
+ }
24
+
25
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-stack {
26
+ position: absolute;
27
+ inset: 0;
28
+ pointer-events: none;
29
+ z-index: 1;
30
+ }
31
+
32
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-item {
33
+ position: absolute;
34
+ inset: 0;
35
+ transform-origin: 18% 85%;
36
+ transition: transform var(--readdy-anim-card-fan-duration, 550ms) cubic-bezier(0.22, 1, 0.36, 1);
37
+ will-change: transform;
38
+ }
39
+
40
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-item:nth-child(1) {
41
+ transform: rotate(-3deg) translate(-6px, 8px) scale(0.985);
42
+ }
43
+
44
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-item:nth-child(2) {
45
+ transform: rotate(3deg) translate(6px, 8px) scale(0.985);
46
+ }
47
+
48
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-surface {
49
+ width: 100%;
50
+ height: 100%;
51
+ overflow: hidden;
52
+ box-shadow: 0 18px 28px rgba(15, 23, 42, 0.16);
53
+ opacity: 0.86;
54
+ }
55
+
56
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-surface > * {
57
+ pointer-events: none !important;
58
+ }
59
+
60
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-visual-text {
61
+ opacity: 0.22 !important;
62
+ text-shadow: none !important;
63
+ filter: blur(0.15px);
64
+ }
65
+
66
+ .readdy-anim-card-fan-spread.is-spread .readdy-anim-card-fan-item:nth-child(1) {
67
+ transform:
68
+ rotateY(var(--readdy-anim-card-fan-depth-rotate, 18deg))
69
+ rotate(calc(var(--readdy-anim-card-fan-rotate, 24deg) * -1))
70
+ translate(
71
+ calc(var(--readdy-anim-card-fan-distance, 72px) * -1),
72
+ calc(var(--readdy-anim-card-fan-lift, 14px) * -0.714)
73
+ );
74
+ }
75
+
76
+ .readdy-anim-card-fan-spread.is-spread .readdy-anim-card-fan-item:nth-child(2) {
77
+ transform:
78
+ rotateY(calc(var(--readdy-anim-card-fan-depth-rotate, 18deg) * -1))
79
+ rotate(var(--readdy-anim-card-fan-rotate, 24deg))
80
+ translate(
81
+ var(--readdy-anim-card-fan-distance, 72px),
82
+ calc(var(--readdy-anim-card-fan-lift, 14px) * -0.714)
83
+ );
84
+ }
85
+
86
+ @media (prefers-reduced-motion: reduce) {
87
+ .readdy-anim-card-fan-spread .readdy-anim-card-fan-item {
88
+ transition: none;
89
+ }
90
+ }
@@ -0,0 +1,203 @@
1
+ import './style.css'
2
+ import { buildAnimClass, buildAnimId } from '../../../shared/constants.js'
3
+
4
+ export const ANIMATION_ID = buildAnimId('card-flip')
5
+
6
+ const CSS_CLASS = buildAnimClass('card-flip')
7
+ const SCENE_CLASS = buildAnimClass('card-flip-scene')
8
+ const INNER_CLASS = buildAnimClass('card-flip-inner')
9
+ const FACE_CLASS = buildAnimClass('card-flip-face')
10
+ const FRONT_CLASS = buildAnimClass('card-flip-front')
11
+ const BACK_CLASS = buildAnimClass('card-flip-back')
12
+
13
+ const stateMap = new WeakMap()
14
+ const FACE_STYLE_PROPS = [
15
+ 'background',
16
+ 'backgroundColor',
17
+ 'backgroundImage',
18
+ 'backgroundSize',
19
+ 'backgroundPosition',
20
+ 'backgroundRepeat',
21
+ 'backgroundClip',
22
+ 'border',
23
+ 'borderTop',
24
+ 'borderRight',
25
+ 'borderBottom',
26
+ 'borderLeft',
27
+ 'borderRadius',
28
+ 'boxShadow',
29
+ 'padding',
30
+ 'paddingTop',
31
+ 'paddingRight',
32
+ 'paddingBottom',
33
+ 'paddingLeft',
34
+ 'color',
35
+ 'backdropFilter',
36
+ 'WebkitBackdropFilter',
37
+ ]
38
+
39
+ function createEl(tag, className) {
40
+ const el = document.createElement(tag)
41
+ if (className) el.className = className
42
+ return el
43
+ }
44
+
45
+ function collectRenderableNodes(el) {
46
+ return Array.from(el.childNodes).filter((node) => {
47
+ if (node.nodeType !== Node.TEXT_NODE) return true
48
+ return (node.textContent ?? '').trim().length > 0
49
+ })
50
+ }
51
+
52
+ function sanitizeBackFaceClone(root) {
53
+ if (!(root instanceof HTMLElement)) {
54
+ return
55
+ }
56
+
57
+ const nodes = [root, ...root.querySelectorAll('*')]
58
+
59
+ root.removeAttribute('id')
60
+ root.removeAttribute('tabindex')
61
+ root.removeAttribute('aria-labelledby')
62
+ root.removeAttribute('aria-describedby')
63
+ root.removeAttribute('aria-controls')
64
+ root.removeAttribute('for')
65
+
66
+ nodes.forEach((node) => {
67
+ if (node instanceof HTMLElement) {
68
+ node.removeAttribute('id')
69
+ }
70
+ })
71
+
72
+ nodes.forEach((node) => {
73
+ if (
74
+ !(node instanceof HTMLElement) ||
75
+ !node.matches(
76
+ 'a, button, input, textarea, select, summary, [tabindex], [contenteditable], label[for]'
77
+ )
78
+ ) {
79
+ return
80
+ }
81
+
82
+ node.setAttribute('aria-hidden', 'true')
83
+ node.setAttribute('tabindex', '-1')
84
+ node.removeAttribute('for')
85
+ node.style.pointerEvents = 'none'
86
+ if (
87
+ node instanceof HTMLInputElement ||
88
+ node instanceof HTMLTextAreaElement ||
89
+ node instanceof HTMLSelectElement ||
90
+ node instanceof HTMLButtonElement
91
+ ) {
92
+ node.disabled = true
93
+ }
94
+ })
95
+ }
96
+
97
+ function buildBackFace(nodes) {
98
+ const back = createEl('div', `${FACE_CLASS} ${BACK_CLASS}`)
99
+ back.setAttribute('aria-hidden', 'true')
100
+ back.append(
101
+ ...nodes.map((node) => {
102
+ const clone = node.cloneNode(true)
103
+ sanitizeBackFaceClone(clone)
104
+ return clone
105
+ })
106
+ )
107
+ return back
108
+ }
109
+
110
+ function applyFaceShellStyles(host, face) {
111
+ const styles = window.getComputedStyle(host)
112
+ FACE_STYLE_PROPS.forEach((prop) => {
113
+ const value = styles[prop]
114
+ if (value) {
115
+ face.style[prop] = value
116
+ }
117
+ })
118
+ }
119
+
120
+ export function init(el, options = {}) {
121
+ destroy(el)
122
+
123
+ const originalNodes = collectRenderableNodes(el)
124
+ const rect = el.getBoundingClientRect()
125
+ const previousMinHeight = el.style.minHeight
126
+ const previousHeight = el.style.height
127
+ const previousTabIndex = el.getAttribute('tabindex')
128
+ const previousInlineStyles = {
129
+ background: el.style.background,
130
+ backgroundColor: el.style.backgroundColor,
131
+ backgroundImage: el.style.backgroundImage,
132
+ border: el.style.border,
133
+ boxShadow: el.style.boxShadow,
134
+ padding: el.style.padding,
135
+ overflow: el.style.overflow,
136
+ }
137
+
138
+ const scene = createEl('div', SCENE_CLASS)
139
+ const inner = createEl('div', INNER_CLASS)
140
+ const front = createEl('div', `${FACE_CLASS} ${FRONT_CLASS}`)
141
+ const back = buildBackFace(originalNodes)
142
+
143
+ applyFaceShellStyles(el, front)
144
+ applyFaceShellStyles(el, back)
145
+
146
+ front.append(...originalNodes)
147
+ inner.append(front, back)
148
+ scene.appendChild(inner)
149
+
150
+ stateMap.set(el, {
151
+ originalNodes,
152
+ previousMinHeight,
153
+ previousHeight,
154
+ previousTabIndex,
155
+ previousInlineStyles,
156
+ })
157
+
158
+ el.classList.add(CSS_CLASS)
159
+ el.style.setProperty('--readdy-anim-card-flip-duration', `${options.duration ?? 500}ms`)
160
+ el.style.setProperty('--readdy-anim-card-flip-perspective', `${options.perspective ?? 2000}px`)
161
+ if (rect.height > 0) {
162
+ el.style.minHeight = `${rect.height}px`
163
+ }
164
+ el.style.background = 'transparent'
165
+ el.style.backgroundColor = 'transparent'
166
+ el.style.backgroundImage = 'none'
167
+ el.style.border = 'none'
168
+ el.style.boxShadow = 'none'
169
+ el.style.padding = '0'
170
+ el.style.overflow = 'visible'
171
+ el.tabIndex = el.tabIndex >= 0 ? el.tabIndex : 0
172
+ el.replaceChildren(scene)
173
+ }
174
+
175
+ export function destroy(el) {
176
+ const state = stateMap.get(el)
177
+ el.classList.remove(CSS_CLASS)
178
+ el.style.removeProperty('--readdy-anim-card-flip-duration')
179
+ el.style.removeProperty('--readdy-anim-card-flip-perspective')
180
+
181
+ if (state) {
182
+ if (state.previousMinHeight) {
183
+ el.style.minHeight = state.previousMinHeight
184
+ } else {
185
+ el.style.removeProperty('min-height')
186
+ }
187
+ if (state.previousHeight) {
188
+ el.style.height = state.previousHeight
189
+ } else {
190
+ el.style.removeProperty('height')
191
+ }
192
+ if (state.previousTabIndex === null) {
193
+ el.removeAttribute('tabindex')
194
+ } else {
195
+ el.setAttribute('tabindex', state.previousTabIndex)
196
+ }
197
+ Object.assign(el.style, state.previousInlineStyles)
198
+ el.replaceChildren(...state.originalNodes)
199
+ stateMap.delete(el)
200
+ } else {
201
+ el.removeAttribute('tabindex')
202
+ }
203
+ }
@@ -0,0 +1,35 @@
1
+ import React, { useEffect, useRef } from 'react'
2
+ import { init, destroy } from './index.js'
3
+
4
+ export interface AnimCardFlipProps {
5
+ children: React.ReactElement
6
+ duration?: number
7
+ perspective?: number
8
+ }
9
+
10
+ /**
11
+ * Card Flip 会保留传入的 card 内容作为正面,同时使用当前内容克隆出背面。
12
+ * 适合直接包裹现有 card 宿主,而不是注入固定模板。
13
+ */
14
+ export function AnimCardFlip({
15
+ children,
16
+ duration = 500,
17
+ perspective = 2000,
18
+ }: AnimCardFlipProps) {
19
+ const ref = useRef<HTMLElement>(null)
20
+
21
+ useEffect(() => {
22
+ const el = ref.current
23
+ if (!el) return
24
+
25
+ init(el, {
26
+ duration,
27
+ perspective,
28
+ })
29
+ return () => {
30
+ destroy(el)
31
+ }
32
+ }, [duration, perspective])
33
+
34
+ return React.cloneElement(React.Children.only(children), { ref })
35
+ }