@rxdrag/website-lib-core 0.0.4 → 0.0.7

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 (168) hide show
  1. package/index.ts +1 -0
  2. package/package.json +12 -13
  3. package/src/entify/Entify.ts +365 -0
  4. package/{dist/entify/index.d.ts → src/entify/index.ts} +4 -4
  5. package/src/entify/lib/createEntifyClient.ts +23 -0
  6. package/{dist/entify/lib/index.d.ts → src/entify/lib/index.ts} +29 -29
  7. package/src/entify/lib/langFields.ts +12 -0
  8. package/src/entify/lib/newAvatarQueryOptions.ts +5 -0
  9. package/src/entify/lib/newOgImageQueryOptions.ts +6 -0
  10. package/src/entify/lib/newPageMetaOptions.ts +20 -0
  11. package/src/entify/lib/newQueryPostOptions.ts +41 -0
  12. package/src/entify/lib/newQueryProductOptions.ts +90 -0
  13. package/src/entify/lib/newQueryProductsMediaOptions.ts +26 -0
  14. package/src/entify/lib/queryAllProducts.ts +27 -0
  15. package/src/entify/lib/queryEntityList.ts +44 -0
  16. package/src/entify/lib/queryFeaturedProducts.ts +47 -0
  17. package/src/entify/lib/queryLangs.ts +47 -0
  18. package/src/entify/lib/queryLatestPosts.ts +65 -0
  19. package/src/entify/lib/queryOneEntity.ts +67 -0
  20. package/src/entify/lib/queryOnePostById.ts +21 -0
  21. package/src/entify/lib/queryOnePostBySlug.ts +21 -0
  22. package/src/entify/lib/queryOnePostCategoryBySlug.ts +30 -0
  23. package/src/entify/lib/queryOneProductById.ts +20 -0
  24. package/src/entify/lib/queryOneProductBySlug.ts +21 -0
  25. package/src/entify/lib/queryOneProductCategoryBySlug.ts +30 -0
  26. package/src/entify/lib/queryOneTheme.ts +76 -0
  27. package/src/entify/lib/queryOneUser.ts +38 -0
  28. package/src/entify/lib/queryPostCategories.ts +48 -0
  29. package/src/entify/lib/queryPostSlugs.ts +32 -0
  30. package/src/entify/lib/queryPosts.ts +92 -0
  31. package/src/entify/lib/queryProductCategories.ts +44 -0
  32. package/src/entify/lib/queryProducts.ts +69 -0
  33. package/src/entify/lib/queryProductsInMenu.ts +31 -0
  34. package/src/entify/lib/queryUserIds.ts +24 -0
  35. package/src/entify/lib/queryUserPosts.ts +74 -0
  36. package/src/entify/lib/queryWebSiteSettings.ts +29 -0
  37. package/src/entify/lib/searchProducts.ts +70 -0
  38. package/src/entify/lib/sendEmail.ts +8 -0
  39. package/src/entify/lib/toQueryOptions.ts +20 -0
  40. package/src/entify/lib/upsertEntity.ts +9 -0
  41. package/src/entify/types/index.ts +2 -0
  42. package/src/entify/types/utils.ts +4 -0
  43. package/src/entify/types/variables.ts +7 -0
  44. package/src/entify/view-model/funcs.ts +271 -0
  45. package/src/entify/view-model/index.ts +2 -0
  46. package/src/entify/view-model/models.ts +143 -0
  47. package/{dist/index.d.ts → src/index.ts} +5 -5
  48. package/src/motion/consts.ts +598 -0
  49. package/{dist/motion/index.d.ts → src/motion/index.ts} +2 -2
  50. package/src/motion/types.ts +46 -0
  51. package/src/react/components/EnquiryForm/Input.tsx +52 -0
  52. package/src/react/components/EnquiryForm/Submit.tsx +30 -0
  53. package/src/react/components/EnquiryForm/Textarea.tsx +51 -0
  54. package/src/react/components/EnquiryForm/index.tsx +334 -0
  55. package/src/react/components/GoogleConsent/CookieItemPanel.tsx +81 -0
  56. package/src/react/components/GoogleConsent/CumtomizedModal.tsx +149 -0
  57. package/src/react/components/GoogleConsent/GoogleConsent.tsx +101 -0
  58. package/src/react/components/GoogleConsent/README.md +1 -0
  59. package/src/react/components/GoogleConsent/gtags.ts +68 -0
  60. package/src/react/components/GoogleConsent/index.ts +3 -0
  61. package/src/react/components/GoogleConsent/types.ts +18 -0
  62. package/src/react/components/GoogleConsent//345/217/202/350/200/203.md +4 -0
  63. package/src/react/components/Medias/index.tsx +347 -0
  64. package/src/react/components/ProductCard/ProductCard.tsx +23 -0
  65. package/src/react/components/ProductCard/ProductCardPreview.tsx +12 -0
  66. package/src/react/components/ProductCard/ProductCta/index.tsx +41 -0
  67. package/src/react/components/ProductCard/ProductCta/style.css +4 -0
  68. package/src/react/components/ProductCard/ProductDescription/index.tsx +13 -0
  69. package/src/react/components/ProductCard/ProductDescription/style.css +6 -0
  70. package/src/react/components/ProductCard/ProductMedia/index.tsx +34 -0
  71. package/src/react/components/ProductCard/ProductMedia/style.css +6 -0
  72. package/src/react/components/ProductCard/ProductTitle/index.tsx +7 -0
  73. package/src/react/components/ProductCard/ProductTitle/style.css +4 -0
  74. package/src/react/components/ProductCard/ProductView.tsx +35 -0
  75. package/{dist/react/components/ProductCard/index.d.ts → src/react/components/ProductCard/index.ts} +6 -6
  76. package/src/react/components/ProductCard/useQueryProduct.ts +32 -0
  77. package/src/react/components/RichTextOutline/index.tsx +76 -0
  78. package/src/react/components/RichTextOutline/useAcitviedHeading.ts +54 -0
  79. package/src/react/components/RichTextOutline/useAnchorScroll.ts +24 -0
  80. package/src/react/components/Scroller.tsx +7 -0
  81. package/src/react/components/SearchInput.tsx +34 -0
  82. package/src/react/components/Share/index.tsx +69 -0
  83. package/src/react/components/Share/socials.tsx +79 -0
  84. package/src/react/components/Share//350/265/204/346/226/231.md +7 -0
  85. package/src/react/components/ToTop/index.tsx +33 -0
  86. package/src/react/components/ToTop.tsx +33 -0
  87. package/{dist/react/components/index.d.ts → src/react/components/index.ts} +8 -8
  88. package/src/react/hooks/index.ts +1 -0
  89. package/src/react/hooks/useScroll.ts +23 -0
  90. package/{dist/react/index.d.ts → src/react/index.ts} +2 -2
  91. package/src/robots.ts +4 -0
  92. package/src/scripts/actions.ts +304 -0
  93. package/src/scripts/consts.ts +32 -0
  94. package/src/scripts/events.ts +33 -0
  95. package/{dist/scripts/index.d.ts → src/scripts/index.ts} +3 -3
  96. package/dist/entify/Entify.d.ts +0 -138
  97. package/dist/entify/lib/createEntifyClient.d.ts +0 -3
  98. package/dist/entify/lib/langFields.d.ts +0 -2
  99. package/dist/entify/lib/newAvatarQueryOptions.d.ts +0 -2
  100. package/dist/entify/lib/newOgImageQueryOptions.d.ts +0 -2
  101. package/dist/entify/lib/newPageMetaOptions.d.ts +0 -2
  102. package/dist/entify/lib/newQueryPostOptions.d.ts +0 -3
  103. package/dist/entify/lib/newQueryProductOptions.d.ts +0 -3
  104. package/dist/entify/lib/newQueryProductsMediaOptions.d.ts +0 -3
  105. package/dist/entify/lib/queryAllProducts.d.ts +0 -4
  106. package/dist/entify/lib/queryEntityList.d.ts +0 -3
  107. package/dist/entify/lib/queryFeaturedProducts.d.ts +0 -4
  108. package/dist/entify/lib/queryLangs.d.ts +0 -4
  109. package/dist/entify/lib/queryLatestPosts.d.ts +0 -4
  110. package/dist/entify/lib/queryOneEntity.d.ts +0 -5
  111. package/dist/entify/lib/queryOnePostById.d.ts +0 -3
  112. package/dist/entify/lib/queryOnePostBySlug.d.ts +0 -3
  113. package/dist/entify/lib/queryOnePostCategoryBySlug.d.ts +0 -3
  114. package/dist/entify/lib/queryOneProductById.d.ts +0 -3
  115. package/dist/entify/lib/queryOneProductBySlug.d.ts +0 -3
  116. package/dist/entify/lib/queryOneProductCategoryBySlug.d.ts +0 -3
  117. package/dist/entify/lib/queryOneTheme.d.ts +0 -3
  118. package/dist/entify/lib/queryOneUser.d.ts +0 -3
  119. package/dist/entify/lib/queryPostCategories.d.ts +0 -4
  120. package/dist/entify/lib/queryPostSlugs.d.ts +0 -4
  121. package/dist/entify/lib/queryPosts.d.ts +0 -10
  122. package/dist/entify/lib/queryProductCategories.d.ts +0 -4
  123. package/dist/entify/lib/queryProducts.d.ts +0 -6
  124. package/dist/entify/lib/queryProductsInMenu.d.ts +0 -2
  125. package/dist/entify/lib/queryUserIds.d.ts +0 -4
  126. package/dist/entify/lib/queryUserPosts.d.ts +0 -9
  127. package/dist/entify/lib/queryWebSiteSettings.d.ts +0 -3
  128. package/dist/entify/lib/searchProducts.d.ts +0 -4
  129. package/dist/entify/lib/sendEmail.d.ts +0 -3
  130. package/dist/entify/lib/toQueryOptions.d.ts +0 -3
  131. package/dist/entify/lib/upsertEntity.d.ts +0 -2
  132. package/dist/entify/types/index.d.ts +0 -2
  133. package/dist/entify/types/utils.d.ts +0 -4
  134. package/dist/entify/types/variables.d.ts +0 -7
  135. package/dist/entify/view-model/funcs.d.ts +0 -20
  136. package/dist/entify/view-model/index.d.ts +0 -2
  137. package/dist/entify/view-model/models.d.ts +0 -119
  138. package/dist/index.mjs +0 -40514
  139. package/dist/index.mjs.map +0 -1
  140. package/dist/motion/consts.d.ts +0 -77
  141. package/dist/motion/types.d.ts +0 -26
  142. package/dist/react/components/EnquiryForm/Input.d.ts +0 -15
  143. package/dist/react/components/EnquiryForm/Submit.d.ts +0 -8
  144. package/dist/react/components/EnquiryForm/Textarea.d.ts +0 -13
  145. package/dist/react/components/EnquiryForm/index.d.ts +0 -22
  146. package/dist/react/components/Medias/index.d.ts +0 -8
  147. package/dist/react/components/ProductCard/ProductCard.d.ts +0 -15
  148. package/dist/react/components/ProductCard/ProductCardPreview.d.ts +0 -2
  149. package/dist/react/components/ProductCard/ProductCta/index.d.ts +0 -5
  150. package/dist/react/components/ProductCard/ProductDescription/index.d.ts +0 -2
  151. package/dist/react/components/ProductCard/ProductMedia/index.d.ts +0 -7
  152. package/dist/react/components/ProductCard/ProductTitle/index.d.ts +0 -2
  153. package/dist/react/components/ProductCard/ProductView.d.ts +0 -5
  154. package/dist/react/components/ProductCard/useQueryProduct.d.ts +0 -2
  155. package/dist/react/components/RichTextOutline/index.d.ts +0 -8
  156. package/dist/react/components/RichTextOutline/useAcitviedHeading.d.ts +0 -1
  157. package/dist/react/components/Scroller.d.ts +0 -3
  158. package/dist/react/components/SearchInput.d.ts +0 -2
  159. package/dist/react/components/Share/index.d.ts +0 -6
  160. package/dist/react/components/Share/socials.d.ts +0 -10
  161. package/dist/react/components/ToTop.d.ts +0 -5
  162. package/dist/react/hooks/index.d.ts +0 -1
  163. package/dist/react/hooks/useScroll.d.ts +0 -2
  164. package/dist/robots.d.ts +0 -2
  165. package/dist/scripts/actions.d.ts +0 -85
  166. package/dist/scripts/consts.d.ts +0 -21
  167. package/dist/scripts/events.d.ts +0 -11
  168. package/dist/style.css +0 -98
@@ -0,0 +1,598 @@
1
+ import { AnchorOffsets, SimpleAnimation, DualAnimation } from "./types";
2
+
3
+ // Easing functions
4
+ export const EASINGS = {
5
+ linear: [0, 0, 1, 1],
6
+ ease: [0.25, 0.1, 0.25, 1],
7
+ easeIn: [0.42, 0, 1, 1],
8
+ easeOut: [0, 0, 0.58, 1],
9
+ easeInOut: [0.42, 0, 0.58, 1],
10
+ // Back
11
+ easeInBack: [0.36, 0, 0.66, -0.56],
12
+ easeOutBack: [0.34, 1.56, 0.64, 1],
13
+ easeInOutBack: [0.68, -0.6, 0.32, 1.6],
14
+ // Sine
15
+ easeInSine: [0.12, 0, 0.39, 0],
16
+ easeOutSine: [0.61, 1, 0.88, 1],
17
+ easeInOutSine: [0.37, 0, 0.63, 1],
18
+ // Quad
19
+ easeInQuad: [0.11, 0, 0.5, 0],
20
+ easeOutQuad: [0.5, 1, 0.89, 1],
21
+ easeInOutQuad: [0.45, 0, 0.55, 1],
22
+ // Cubic
23
+ easeInCubic: [0.32, 0, 0.67, 0],
24
+ easeOutCubic: [0.33, 1, 0.68, 1],
25
+ easeInOutCubic: [0.65, 0, 0.35, 1],
26
+ // Quart
27
+ easeInQuart: [0.5, 0, 0.75, 0],
28
+ easeOutQuart: [0.25, 1, 0.5, 1],
29
+ easeInOutQuart: [0.76, 0, 0.24, 1],
30
+ // 柔和的缓动函数
31
+ softEaseOut: [0.16, 1, 0.3, 1], // 更加柔和
32
+ softEaseInOut: [0.4, 0, 0.2, 1], // 后期更慢
33
+ gentleEaseOut: [0.1, 0.9, 0.2, 1], // 非常柔和
34
+ gentleBackOut: [0.2, 1.2, 0.5, 1], // 轻微弹性且柔和
35
+ smoothEaseOut: [0.15, 0.85, 0.15, 1], // 平滑过渡
36
+ ultraSmoothOut: [0.05, 0.9, 0.1, 1], // 极度平滑,后期非常慢
37
+ microSmoothOut: [0.03, 0.94, 0.08, 1], // 微妙平滑,几乎无感知的减速
38
+ silkEaseOut: [0.04, 0.88, 0.06, 0.98], // 丝绸般平滑,非常柔和的结束
39
+ featherEaseOut: [0.08, 0.82, 0.17, 1], // 羽毛般轻盈,特别适合小幅度动画
40
+ gentleSilkOut: [0.02, 0.9, 0.1, 0.99], // 极其柔和,几乎感觉不到停止
41
+ ultraSlowOut: [0.02, 0.9, 0.05, 0.99], // 极度缓慢的结束
42
+ silkSlowOut: [0.01, 0.85, 0.05, 0.95], // 丝绸般缓慢,后期极慢
43
+ luxurySlowOut: [0.01, 0.8, 0.03, 0.92], // 奢华缓慢,几乎静止的结束
44
+ } as const;
45
+
46
+ //立即执行
47
+ export const DATA_MOTION_ANIMATE = "data-motion-animate";
48
+ //过渡
49
+ //export const DATA_MOTION_TRANSITION = "data-motion-transition";
50
+ //悬停
51
+ export const DATA_MOTION_HOVER = "data-motion-hover";
52
+ //按压
53
+ export const DATA_MOTION_TAP = "data-motion-tap";
54
+ //滚动
55
+ export const DATA_MOTION_SCROLL = "data-motion-scroll";
56
+ //入视图
57
+ export const DATA_MOTION_INVIEW = "data-motion-inview";
58
+ //打开动画,有动作的组件联动
59
+ export const DATA_MOTION_OPEN = "data-motion-open";
60
+ //关闭动画,有动作的组件联动
61
+ export const DATA_MOTION_CLOSE = "data-motion-close";
62
+
63
+ export enum ANIMATION {
64
+ // Fade animations
65
+ FADE = "fade",
66
+ FADE_UP = "fade-up",
67
+ FADE_DOWN = "fade-down",
68
+ FADE_LEFT = "fade-left",
69
+ FADE_RIGHT = "fade-right",
70
+ FADE_UP_RIGHT = "fade-up-right",
71
+ FADE_UP_LEFT = "fade-up-left",
72
+ FADE_DOWN_RIGHT = "fade-down-right",
73
+ FADE_DOWN_LEFT = "fade-down-left",
74
+
75
+ // Flip animations
76
+ FLIP_UP = "flip-up",
77
+ FLIP_DOWN = "flip-down",
78
+ FLIP_LEFT = "flip-left",
79
+ FLIP_RIGHT = "flip-right",
80
+
81
+ // Slide animations
82
+ SLIDE_UP = "slide-up",
83
+ SLIDE_DOWN = "slide-down",
84
+ SLIDE_LEFT = "slide-left",
85
+ SLIDE_RIGHT = "slide-right",
86
+
87
+ // Zoom animations
88
+ ZOOM_IN = "zoom-in",
89
+ ZOOM_IN_UP = "zoom-in-up",
90
+ ZOOM_IN_DOWN = "zoom-in-down",
91
+ ZOOM_IN_LEFT = "zoom-in-left",
92
+ ZOOM_IN_RIGHT = "zoom-in-right",
93
+ ZOOM_OUT = "zoom-out",
94
+ ZOOM_OUT_UP = "zoom-out-up",
95
+ ZOOM_OUT_DOWN = "zoom-out-down",
96
+ ZOOM_OUT_LEFT = "zoom-out-left",
97
+ ZOOM_OUT_RIGHT = "zoom-out-right",
98
+
99
+ // Special effects
100
+ ROTATE = "rotate",
101
+ ROTATE_SCALE = "rotate-scale",
102
+ }
103
+
104
+ // export enum ANCHOR_PLACEMENT {
105
+ // TOP_BOTTOM = "top-bottom",
106
+ // TOP_CENTER = "top-center",
107
+ // TOP_TOP = "top-top",
108
+ // CENTER_BOTTOM = "center-bottom",
109
+ // CENTER_CENTER = "center-center",
110
+ // CENTER_TOP = "center-top",
111
+ // BOTTOM_BOTTOM = "bottom-bottom",
112
+ // BOTTOM_CENTER = "bottom-center",
113
+ // BOTTOM_TOP = "bottom-top",
114
+ // }
115
+
116
+ // export enum EASE {
117
+ // // Basic
118
+ // LINEAR = "linear",
119
+ // EASE = "ease",
120
+ // EASE_IN = "ease-in",
121
+ // EASE_OUT = "ease-out",
122
+ // EASE_IN_OUT = "ease-in-out",
123
+
124
+ // // Back
125
+ // EASE_IN_BACK = "ease-in-back",
126
+ // EASE_OUT_BACK = "ease-out-back",
127
+ // EASE_IN_OUT_BACK = "ease-in-out-back",
128
+
129
+ // // Sine
130
+ // EASE_IN_SINE = "ease-in-sine",
131
+ // EASE_OUT_SINE = "ease-out-sine",
132
+ // EASE_IN_OUT_SINE = "ease-in-out-sine",
133
+
134
+ // // Quad
135
+ // EASE_IN_QUAD = "ease-in-quad",
136
+ // EASE_OUT_QUAD = "ease-out-quad",
137
+ // EASE_IN_OUT_QUAD = "ease-in-out-quad",
138
+
139
+ // // Cubic
140
+ // EASE_IN_CUBIC = "ease-in-cubic",
141
+ // EASE_OUT_CUBIC = "ease-out-cubic",
142
+ // EASE_IN_OUT_CUBIC = "ease-in-out-cubic",
143
+
144
+ // // Quart
145
+ // EASE_IN_QUART = "ease-in-quart",
146
+ // EASE_OUT_QUART = "ease-out-quart",
147
+ // EASE_IN_OUT_QUART = "ease-in-out-quart",
148
+ // }
149
+
150
+ // Anchor placements
151
+ export const ANCHOR_PLACEMENTS: AnchorOffsets = {
152
+ "top-bottom": { element: 0, viewport: 100 },
153
+ "top-center": { element: 0, viewport: 50 },
154
+ "top-top": { element: 0, viewport: 0 },
155
+ "center-bottom": { element: 50, viewport: 100 },
156
+ "center-center": { element: 50, viewport: 50 },
157
+ "center-top": { element: 50, viewport: 0 },
158
+ "bottom-bottom": { element: 100, viewport: 100 },
159
+ "bottom-center": { element: 100, viewport: 50 },
160
+ "bottom-top": { element: 100, viewport: 0 },
161
+ } as const;
162
+
163
+ export const ANIMATIONS: Record<string, SimpleAnimation> = {
164
+ // Fade animations
165
+ fade: {
166
+ keyframes: {
167
+ opacity: [0, 1],
168
+ scale: [0.8, 1],
169
+ },
170
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
171
+ },
172
+ "fade-up": {
173
+ keyframes: {
174
+ opacity: [0, 1],
175
+ transform: ["translateY(35px)", "translateY(0)"],
176
+ },
177
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
178
+ },
179
+ "fade-down": {
180
+ keyframes: {
181
+ opacity: [0, 1],
182
+ transform: ["translateY(-35px)", "translateY(0)"],
183
+ },
184
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
185
+ },
186
+ "fade-left": {
187
+ keyframes: {
188
+ opacity: [0, 1],
189
+ transform: ["translateX(35px)", "translateX(0)"],
190
+ },
191
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
192
+ },
193
+ "fade-right": {
194
+ keyframes: {
195
+ opacity: [0, 1],
196
+ transform: ["translateX(-35px)", "translateX(0)"],
197
+ },
198
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
199
+ },
200
+ "fade-up-right": {
201
+ keyframes: {
202
+ opacity: [0, 1],
203
+ transform: ["translate(-35px, 35px)", "translate(0, 0)"],
204
+ },
205
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
206
+ },
207
+ "fade-up-left": {
208
+ keyframes: {
209
+ opacity: [0, 1],
210
+ transform: ["translate(35px, 35px)", "translate(0, 0)"],
211
+ },
212
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
213
+ },
214
+ "fade-down-right": {
215
+ keyframes: {
216
+ opacity: [0, 1],
217
+ transform: ["translate(-35px, -35px)", "translate(0, 0)"],
218
+ },
219
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
220
+ },
221
+ "fade-down-left": {
222
+ keyframes: {
223
+ opacity: [0, 1],
224
+ transform: ["translate(35px, -35px)", "translate(0, 0)"],
225
+ },
226
+ transition: { duration: 1.3, ease: EASINGS.silkSlowOut },
227
+ },
228
+
229
+ // Flip animations
230
+ "flip-up": {
231
+ keyframes: {
232
+ transform: [
233
+ "perspective(2500px) rotateX(60deg)",
234
+ "perspective(2500px) rotateX(0)",
235
+ ],
236
+ opacity: [0, 1],
237
+ },
238
+ transition: { duration: 1.4, ease: EASINGS.luxurySlowOut },
239
+ },
240
+ "flip-down": {
241
+ keyframes: {
242
+ transform: [
243
+ "perspective(2500px) rotateX(-60deg)",
244
+ "perspective(2500px) rotateX(0)",
245
+ ],
246
+ opacity: [0, 1],
247
+ },
248
+ transition: { duration: 1.4, ease: EASINGS.luxurySlowOut },
249
+ },
250
+ "flip-left": {
251
+ keyframes: {
252
+ transform: [
253
+ "perspective(2500px) rotateY(-60deg)",
254
+ "perspective(2500px) rotateY(0)",
255
+ ],
256
+ opacity: [0, 1],
257
+ },
258
+ transition: { duration: 1.4, ease: EASINGS.luxurySlowOut },
259
+ },
260
+ "flip-right": {
261
+ keyframes: {
262
+ transform: [
263
+ "perspective(2500px) rotateY(60deg)",
264
+ "perspective(2500px) rotateY(0)",
265
+ ],
266
+ opacity: [0, 1],
267
+ },
268
+ transition: { duration: 1.4, ease: EASINGS.luxurySlowOut },
269
+ },
270
+
271
+ // Slide animations
272
+ "slide-up": {
273
+ keyframes: {
274
+ transform: ["translateY(60%)", "translateY(0)"],
275
+ },
276
+ transition: { duration: 1.4, ease: EASINGS.ultraSlowOut },
277
+ },
278
+ "slide-down": {
279
+ keyframes: {
280
+ transform: ["translateY(-60%)", "translateY(0)"],
281
+ },
282
+ transition: { duration: 1.4, ease: EASINGS.ultraSlowOut },
283
+ },
284
+ "slide-left": {
285
+ keyframes: {
286
+ transform: ["translateX(60%)", "translateX(0)"],
287
+ },
288
+ transition: { duration: 1.4, ease: EASINGS.ultraSlowOut },
289
+ },
290
+ "slide-right": {
291
+ keyframes: {
292
+ transform: ["translateX(-60%)", "translateX(0)"],
293
+ },
294
+ transition: { duration: 1.4, ease: EASINGS.ultraSlowOut },
295
+ },
296
+
297
+ // Zoom animations
298
+ "zoom-in": {
299
+ keyframes: {
300
+ transform: ["scale(0.85)", "scale(1)"],
301
+ opacity: [0, 1],
302
+ },
303
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
304
+ },
305
+ "zoom-in-up": {
306
+ keyframes: {
307
+ transform: ["scale(0.85) translateY(30px)", "scale(1) translateY(0)"],
308
+ opacity: [0, 1],
309
+ },
310
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
311
+ },
312
+ "zoom-in-down": {
313
+ keyframes: {
314
+ transform: ["scale(0.85) translateY(-30px)", "scale(1) translateY(0)"],
315
+ opacity: [0, 1],
316
+ },
317
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
318
+ },
319
+ "zoom-in-left": {
320
+ keyframes: {
321
+ transform: ["scale(0.85) translateX(30px)", "scale(1) translateX(0)"],
322
+ opacity: [0, 1],
323
+ },
324
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
325
+ },
326
+ "zoom-in-right": {
327
+ keyframes: {
328
+ transform: ["scale(0.85) translateX(-30px)", "scale(1) translateX(0)"],
329
+ opacity: [0, 1],
330
+ },
331
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
332
+ },
333
+ "zoom-out": {
334
+ keyframes: {
335
+ transform: ["scale(1.15)", "scale(1)"],
336
+ opacity: [0, 1],
337
+ },
338
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
339
+ },
340
+ "zoom-out-up": {
341
+ keyframes: {
342
+ transform: ["scale(1.15) translateY(30px)", "scale(1) translateY(0)"],
343
+ opacity: [0, 1],
344
+ },
345
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
346
+ },
347
+ "zoom-out-down": {
348
+ keyframes: {
349
+ transform: ["scale(1.15) translateY(-30px)", "scale(1) translateY(0)"],
350
+ opacity: [0, 1],
351
+ },
352
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
353
+ },
354
+ "zoom-out-left": {
355
+ keyframes: {
356
+ transform: ["scale(1.15) translateX(30px)", "scale(1) translateX(0)"],
357
+ opacity: [0, 1],
358
+ },
359
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
360
+ },
361
+ "zoom-out-right": {
362
+ keyframes: {
363
+ transform: ["scale(1.15) translateX(-30px)", "scale(1) translateX(0)"],
364
+ opacity: [0, 1],
365
+ },
366
+ transition: { duration: 1.2, ease: EASINGS.silkSlowOut },
367
+ },
368
+
369
+ // Special effects
370
+ rotate: {
371
+ keyframes: {
372
+ transform: ["rotate(-90deg)", "rotate(0)"],
373
+ opacity: [0, 1],
374
+ },
375
+ transition: { duration: 1.4, ease: EASINGS.luxurySlowOut },
376
+ },
377
+ "rotate-scale": {
378
+ keyframes: {
379
+ transform: ["rotate(-90deg) scale(0.85)", "rotate(0) scale(1)"],
380
+ opacity: [0, 1],
381
+ },
382
+ transition: { duration: 1.4, ease: EASINGS.luxurySlowOut },
383
+ },
384
+ };
385
+
386
+ export const DUAL_ANIMATIONS: Record<string, DualAnimation> = {
387
+ // Fade animations
388
+ fade: {
389
+ in: ANIMATIONS.fade,
390
+ out: {
391
+ keyframes: {
392
+ opacity: [1, 0],
393
+ scale: [1, 0.98],
394
+ },
395
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
396
+ },
397
+ },
398
+ "fade-up": {
399
+ in: ANIMATIONS["fade-up"],
400
+ out: {
401
+ keyframes: { opacity: [1, 0], y: [0, -35] },
402
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
403
+ },
404
+ },
405
+ "fade-down": {
406
+ in: ANIMATIONS["fade-down"],
407
+ out: {
408
+ keyframes: { opacity: [1, 0], y: [0, 35] },
409
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
410
+ },
411
+ },
412
+ "fade-left": {
413
+ in: ANIMATIONS["fade-left"],
414
+ out: {
415
+ keyframes: { opacity: [1, 0], x: [0, -35] },
416
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
417
+ },
418
+ },
419
+ "fade-right": {
420
+ in: ANIMATIONS["fade-right"],
421
+ out: {
422
+ keyframes: { opacity: [1, 0], x: [0, 35] },
423
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
424
+ },
425
+ },
426
+ "fade-up-right": {
427
+ in: ANIMATIONS["fade-up-right"],
428
+ out: {
429
+ keyframes: { opacity: [1, 0], x: [0, 35], y: [0, -35] },
430
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
431
+ },
432
+ },
433
+ "fade-up-left": {
434
+ in: ANIMATIONS["fade-up-left"],
435
+ out: {
436
+ keyframes: { opacity: [1, 0], x: [0, -35], y: [0, -35] },
437
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
438
+ },
439
+ },
440
+ "fade-down-right": {
441
+ in: ANIMATIONS["fade-down-right"],
442
+ out: {
443
+ keyframes: { opacity: [1, 0], x: [0, 35], y: [0, 35] },
444
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
445
+ },
446
+ },
447
+ "fade-down-left": {
448
+ in: ANIMATIONS["fade-down-left"],
449
+ out: {
450
+ keyframes: { opacity: [1, 0], x: [0, -35], y: [0, 35] },
451
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
452
+ },
453
+ },
454
+ // Flip animations
455
+ "flip-up": {
456
+ in: ANIMATIONS["flip-up"],
457
+ out: {
458
+ keyframes: { rotateX: [0, 60], opacity: [1, 0] },
459
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
460
+ },
461
+ },
462
+ "flip-down": {
463
+ in: ANIMATIONS["flip-down"],
464
+ out: {
465
+ keyframes: { rotateX: [0, -60], opacity: [1, 0] },
466
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
467
+ },
468
+ },
469
+ "flip-left": {
470
+ in: ANIMATIONS["flip-left"],
471
+ out: {
472
+ keyframes: { rotateY: [0, -60], opacity: [1, 0] },
473
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
474
+ },
475
+ },
476
+ "flip-right": {
477
+ in: ANIMATIONS["flip-right"],
478
+ out: {
479
+ keyframes: { rotateY: [0, 60], opacity: [1, 0] },
480
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
481
+ },
482
+ },
483
+ // Slide animations
484
+ "slide-up": {
485
+ in: ANIMATIONS["slide-up"],
486
+ out: {
487
+ keyframes: { y: [0, -60] },
488
+ transition: { duration: 1, ease: EASINGS.ultraSlowOut },
489
+ },
490
+ },
491
+ "slide-down": {
492
+ in: ANIMATIONS["slide-down"],
493
+ out: {
494
+ keyframes: { y: [0, 60] },
495
+ transition: { duration: 1, ease: EASINGS.ultraSlowOut },
496
+ },
497
+ },
498
+ "slide-left": {
499
+ in: ANIMATIONS["slide-left"],
500
+ out: {
501
+ keyframes: { x: [0, -60] },
502
+ transition: { duration: 1, ease: EASINGS.ultraSlowOut },
503
+ },
504
+ },
505
+ "slide-right": {
506
+ in: ANIMATIONS["slide-right"],
507
+ out: {
508
+ keyframes: { x: [0, 60] },
509
+ transition: { duration: 1, ease: EASINGS.ultraSlowOut },
510
+ },
511
+ },
512
+ // Zoom animations
513
+ "zoom-in": {
514
+ in: ANIMATIONS["zoom-in"],
515
+ out: {
516
+ keyframes: { scale: [1, 0.85], opacity: [1, 0] },
517
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
518
+ },
519
+ },
520
+ "zoom-in-up": {
521
+ in: ANIMATIONS["zoom-in-up"],
522
+ out: {
523
+ keyframes: { scale: [1, 0.85], y: [0, -30], opacity: [1, 0] },
524
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
525
+ },
526
+ },
527
+ "zoom-in-down": {
528
+ in: ANIMATIONS["zoom-in-down"],
529
+ out: {
530
+ keyframes: { scale: [1, 0.85], y: [0, 30], opacity: [1, 0] },
531
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
532
+ },
533
+ },
534
+ "zoom-in-left": {
535
+ in: ANIMATIONS["zoom-in-left"],
536
+ out: {
537
+ keyframes: { scale: [1, 0.85], x: [0, -30], opacity: [1, 0] },
538
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
539
+ },
540
+ },
541
+ "zoom-in-right": {
542
+ in: ANIMATIONS["zoom-in-right"],
543
+ out: {
544
+ keyframes: { scale: [1, 0.85], x: [0, 30], opacity: [1, 0] },
545
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
546
+ },
547
+ },
548
+ "zoom-out": {
549
+ in: ANIMATIONS["zoom-out"],
550
+ out: {
551
+ keyframes: { scale: [1, 1.15], opacity: [1, 0] },
552
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
553
+ },
554
+ },
555
+ "zoom-out-up": {
556
+ in: ANIMATIONS["zoom-out-up"],
557
+ out: {
558
+ keyframes: { scale: [1, 1.15], y: [0, -30], opacity: [1, 0] },
559
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
560
+ },
561
+ },
562
+ "zoom-out-down": {
563
+ in: ANIMATIONS["zoom-out-down"],
564
+ out: {
565
+ keyframes: { scale: [1, 1.15], y: [0, 30], opacity: [1, 0] },
566
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
567
+ },
568
+ },
569
+ "zoom-out-left": {
570
+ in: ANIMATIONS["zoom-out-left"],
571
+ out: {
572
+ keyframes: { scale: [1, 1.15], x: [0, -30], opacity: [1, 0] },
573
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
574
+ },
575
+ },
576
+ "zoom-out-right": {
577
+ in: ANIMATIONS["zoom-out-right"],
578
+ out: {
579
+ keyframes: { scale: [1, 1.15], x: [0, 30], opacity: [1, 0] },
580
+ transition: { duration: 1, ease: EASINGS.silkSlowOut },
581
+ },
582
+ },
583
+ // Special effects
584
+ rotate: {
585
+ in: ANIMATIONS.rotate,
586
+ out: {
587
+ keyframes: { rotate: [0, 90], opacity: [1, 0] },
588
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
589
+ },
590
+ },
591
+ "rotate-scale": {
592
+ in: ANIMATIONS["rotate-scale"],
593
+ out: {
594
+ keyframes: { rotate: [0, 90], scale: [1, 0.85], opacity: [1, 0] },
595
+ transition: { duration: 1, ease: EASINGS.luxurySlowOut },
596
+ },
597
+ },
598
+ };
@@ -1,2 +1,2 @@
1
- export * from "./consts";
2
- export * from "./types";
1
+ export * from "./consts";
2
+ export * from "./types";
@@ -0,0 +1,46 @@
1
+ import { AnimationOptions, DOMKeyframesDefinition } from "motion";
2
+ import { ANIMATION } from "./consts";
3
+
4
+ // 基础动画配置
5
+ export type BaseAnimation = {
6
+ preset?: ANIMATION;
7
+ keyframes?: DOMKeyframesDefinition;
8
+ transition?: AnimationOptions;
9
+ };
10
+
11
+ // 简单的单向动画(如 hover, tap 等)
12
+ export type SimpleAnimation = BaseAnimation;
13
+
14
+ // 双向动画(如 inView 的进入和离开)
15
+ export type DualAnimation = {
16
+ preset?: ANIMATION;
17
+ in?: SimpleAnimation;
18
+ out?: SimpleAnimation;
19
+ };
20
+
21
+ // 导出具体用途的类型别名,方便代码阅读和维护
22
+ export type HoverAnimation = DualAnimation;
23
+ export type TapAnimation = DualAnimation;
24
+ export type ScrollAnimation = SimpleAnimation;
25
+ export type ViewportAnimation = DualAnimation & {
26
+ once?: boolean;
27
+ };
28
+ export type SelectionAnimation = DualAnimation;
29
+
30
+ export type AnchorPlacement =
31
+ | "top-bottom"
32
+ | "top-center"
33
+ | "top-top"
34
+ | "center-bottom"
35
+ | "center-center"
36
+ | "center-top"
37
+ | "bottom-bottom"
38
+ | "bottom-center"
39
+ | "bottom-top";
40
+
41
+ export type AnchorOffset = {
42
+ element: number;
43
+ viewport: number;
44
+ };
45
+
46
+ export type AnchorOffsets = Record<AnchorPlacement, AnchorOffset>;
@@ -0,0 +1,52 @@
1
+ import { forwardRef, HTMLInputTypeAttribute } from "react";
2
+
3
+ export type InputProps = {
4
+ label: string;
5
+ name: string;
6
+ required?: boolean;
7
+ className?: string;
8
+ labelClassName?: string;
9
+ inputClassName?: string;
10
+ type?: HTMLInputTypeAttribute;
11
+ autoFocus?: boolean;
12
+ value?: string;
13
+ onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
14
+ error?: string;
15
+ };
16
+
17
+ export const Input = forwardRef<HTMLInputElement, InputProps>((props, ref) => {
18
+ const {
19
+ label,
20
+ name,
21
+ required,
22
+ labelClassName,
23
+ inputClassName,
24
+ type,
25
+ autoFocus,
26
+ value,
27
+ onChange,
28
+ error,
29
+ ...rest
30
+ } = props;
31
+
32
+ return (
33
+ <div {...rest}>
34
+ <label htmlFor={name} className={labelClassName}>
35
+ {label}
36
+ </label>
37
+ <input
38
+ ref={ref}
39
+ type={type || "text"}
40
+ id={name}
41
+ name={name}
42
+ required={required}
43
+ className={inputClassName}
44
+ autoComplete={name}
45
+ autoFocus={autoFocus}
46
+ value={value}
47
+ onChange={onChange}
48
+ />
49
+ {error && <p className="text-red-500 mt-1">{error}</p>}
50
+ </div>
51
+ );
52
+ });