@rxdrag/website-lib-core 0.0.103 → 0.0.104
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.
- package/package.json +4 -4
- package/src/component-logic/index.ts +1 -8
- package/src/global.d.ts +7 -0
- package/src/index.ts +1 -3
- package/src/react/components/BackgroundHlsVideoPlayer.tsx +30 -1
- package/src/react/components/ContactForm/ContactForm.tsx +3 -2
- package/src/react/components/ContactForm/types.ts +1 -0
- package/src/react/components/Scroller.tsx +32 -4
- package/src/react/components/Share/socials.tsx +1 -2
- package/src/react/index.ts +1 -2
- package/src/component-logic/collapse.ts +0 -61
- package/src/component-logic/gsap.d.ts +0 -4
- package/src/component-logic/modal.ts +0 -45
- package/src/component-logic/motion.ts +0 -272
- package/src/component-logic/number.ts +0 -45
- package/src/component-logic/popover.ts +0 -51
- package/src/component-logic/tabs.ts +0 -10
- package/src/controller/AnimateController.ts +0 -138
- package/src/controller/AosController.ts +0 -240
- package/src/controller/CollapseController.ts +0 -130
- package/src/controller/FlipController.ts +0 -339
- package/src/controller/ModalController.ts +0 -127
- package/src/controller/NumberController.ts +0 -161
- package/src/controller/OpenableController.ts +0 -367
- package/src/controller/PageLoader.ts +0 -154
- package/src/controller/PopoverController.ts +0 -116
- package/src/controller/TabsController.ts +0 -271
- package/src/controller/applyAnimation.ts +0 -86
- package/src/controller/applyInitialState.ts +0 -79
- package/src/controller/consts.ts +0 -33
- package/src/controller/index.ts +0 -10
- package/src/controller/utils.ts +0 -48
- package/src/motion/consts.ts +0 -428
- package/src/motion/convertToGsapVars.ts +0 -102
- package/src/motion/index.ts +0 -6
- package/src/motion/normalizeAnimation.ts +0 -28
- package/src/motion/normalizeAosAnimation.ts +0 -22
- package/src/motion/normalizePopupAnimation.ts +0 -24
- package/src/motion/types.ts +0 -133
- package/src/react/hooks/index.ts +0 -1
- package/src/react/hooks/useScroll.ts +0 -30
package/src/motion/types.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { PresetAnimations } from "./consts";
|
|
2
|
-
|
|
3
|
-
// ease配置对象类型,修改为与GSAP兼容的类型
|
|
4
|
-
export type EaseFunction = (progress: number) => number;
|
|
5
|
-
export type EaseString = string;
|
|
6
|
-
|
|
7
|
-
export interface EaseConfig {
|
|
8
|
-
type?: string; // 如 "back", "elastic", "bounce" 等
|
|
9
|
-
config?: {
|
|
10
|
-
// 配置参数
|
|
11
|
-
amplitude?: number;
|
|
12
|
-
period?: number;
|
|
13
|
-
overshoot?: number;
|
|
14
|
-
friction?: number;
|
|
15
|
-
velocity?: number;
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type AnimationStyles = {
|
|
20
|
-
// CSS变换属性
|
|
21
|
-
x?: number | string;
|
|
22
|
-
y?: number | string;
|
|
23
|
-
z?: number | string;
|
|
24
|
-
rotation?: number | string;
|
|
25
|
-
rotationX?: number | string;
|
|
26
|
-
rotationY?: number | string;
|
|
27
|
-
rotationZ?: number | string;
|
|
28
|
-
scale?: number | string;
|
|
29
|
-
scaleX?: number | string;
|
|
30
|
-
scaleY?: number | string;
|
|
31
|
-
opacity?: number;
|
|
32
|
-
|
|
33
|
-
// 其他常用属性
|
|
34
|
-
transformOrigin?: string;
|
|
35
|
-
transform?: string;
|
|
36
|
-
backgroundColor?: string;
|
|
37
|
-
color?: string;
|
|
38
|
-
width?: number | string;
|
|
39
|
-
height?: number | string;
|
|
40
|
-
// 允许任意CSS属性
|
|
41
|
-
[prop: string]: unknown;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// GSAP TweenVars类型定义
|
|
45
|
-
export type TweenVars = AnimationStyles & {
|
|
46
|
-
// 动画控制参数 (也存在于IAnimation中,可保留做细粒度控制)
|
|
47
|
-
delay?: number;
|
|
48
|
-
duration?: number;
|
|
49
|
-
ease?: EaseString | EaseFunction;
|
|
50
|
-
repeat?: number;
|
|
51
|
-
repeatDelay?: number;
|
|
52
|
-
yoyo?: boolean;
|
|
53
|
-
stagger?: number | object;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type AnchorPlacement =
|
|
57
|
-
| "top-bottom"
|
|
58
|
-
| "top-center"
|
|
59
|
-
| "top-top"
|
|
60
|
-
| "center-bottom"
|
|
61
|
-
| "center-center"
|
|
62
|
-
| "center-top"
|
|
63
|
-
| "bottom-bottom"
|
|
64
|
-
| "bottom-center"
|
|
65
|
-
| "bottom-top";
|
|
66
|
-
|
|
67
|
-
export type AnchorOffset = {
|
|
68
|
-
element: number;
|
|
69
|
-
viewport: number;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export type AnchorOffsets = Record<AnchorPlacement, AnchorOffset>;
|
|
73
|
-
|
|
74
|
-
export type BaseAnimationConfig = {
|
|
75
|
-
// 初始状态设置 (gsap.set) - 立即应用,不产生动画
|
|
76
|
-
initial?: AnimationStyles;
|
|
77
|
-
// 主动画配置 - 三选一
|
|
78
|
-
to?: TweenVars; // 到目标状态 (gsap.to)
|
|
79
|
-
from?: TweenVars; // 从起始状态 (gsap.from)
|
|
80
|
-
fromTo?: {
|
|
81
|
-
// 从起始到目标状态 (gsap.fromTo)
|
|
82
|
-
from: TweenVars;
|
|
83
|
-
to: TweenVars;
|
|
84
|
-
};
|
|
85
|
-
// 通用动画配置
|
|
86
|
-
duration?: number;
|
|
87
|
-
delay?: number;
|
|
88
|
-
ease?: EaseString | EaseFunction;
|
|
89
|
-
opacity?: number;
|
|
90
|
-
autoAlpha?: number;
|
|
91
|
-
visibility?: string;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export type AnimationConfig = BaseAnimationConfig & {
|
|
95
|
-
preset?: PresetAnimations;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// 视口动画配置扩展接口
|
|
99
|
-
export type AosAnimationConfig = AnimationConfig & {
|
|
100
|
-
// 进入视口时的动画
|
|
101
|
-
enter?: AnimationConfig;
|
|
102
|
-
|
|
103
|
-
// 离开视口时的动画
|
|
104
|
-
exit?: AnimationConfig;
|
|
105
|
-
|
|
106
|
-
// 是否只触发一次 (默认false)
|
|
107
|
-
once?: boolean;
|
|
108
|
-
|
|
109
|
-
// 可选:触发阈值 (0-1之间,表示元素多少比例可见时触发)
|
|
110
|
-
threshold?: number;
|
|
111
|
-
|
|
112
|
-
// 可选:触发边距 (类似于IntersectionObserver的rootMargin)
|
|
113
|
-
margin?: string;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// Hover动画配置扩展接口
|
|
117
|
-
export type HoverAnimationConfig = AnimationConfig & {
|
|
118
|
-
// 鼠标进入时的动画
|
|
119
|
-
enter?: AnimationConfig;
|
|
120
|
-
|
|
121
|
-
// 鼠标离开时的动画
|
|
122
|
-
exit?: AnimationConfig;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type OpenableAnimationConfig = AnimationConfig & {
|
|
126
|
-
// 初始状态设置 (gsap.set) - 立即应用,不产生动画
|
|
127
|
-
initial?: AnimationStyles;
|
|
128
|
-
// 打开时的动画
|
|
129
|
-
open?: AnimationConfig;
|
|
130
|
-
|
|
131
|
-
// 关闭时的动画
|
|
132
|
-
close?: AnimationConfig;
|
|
133
|
-
};
|
package/src/react/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./useScroll"
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect } from "react";
|
|
2
|
-
|
|
3
|
-
export const defaultThreshold = 10;
|
|
4
|
-
|
|
5
|
-
export function useScroll(
|
|
6
|
-
threshold: number = defaultThreshold,
|
|
7
|
-
win: Window | undefined = typeof window !== "undefined" ? window : undefined,
|
|
8
|
-
doc: Document | undefined = typeof document !== "undefined"
|
|
9
|
-
? document
|
|
10
|
-
: undefined
|
|
11
|
-
) {
|
|
12
|
-
const onScroll = useCallback(() => {
|
|
13
|
-
if (!win || !doc) return;
|
|
14
|
-
|
|
15
|
-
const scrolled = win.scrollY > threshold;
|
|
16
|
-
|
|
17
|
-
if (scrolled) {
|
|
18
|
-
doc.body.classList.add("scrolled");
|
|
19
|
-
} else {
|
|
20
|
-
doc.body.classList.remove("scrolled");
|
|
21
|
-
}
|
|
22
|
-
}, [threshold, win, doc]);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (!win) return;
|
|
26
|
-
|
|
27
|
-
win.addEventListener("scroll", onScroll);
|
|
28
|
-
return () => win.removeEventListener("scroll", onScroll);
|
|
29
|
-
}, [onScroll, win]);
|
|
30
|
-
}
|