@rxdrag/website-lib 0.0.60 → 0.0.62
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.62",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts"
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"eslint": "^7.32.0",
|
|
25
25
|
"gsap": "^3.12.7",
|
|
26
26
|
"typescript": "^5",
|
|
27
|
-
"@rxdrag/
|
|
28
|
-
"@rxdrag/
|
|
27
|
+
"@rxdrag/rxcms-models": "0.3.88",
|
|
28
|
+
"@rxdrag/entify-hooks": "0.2.69",
|
|
29
29
|
"@rxdrag/eslint-config-custom": "0.2.12",
|
|
30
30
|
"@rxdrag/slate-preview": "1.2.58",
|
|
31
31
|
"@rxdrag/tsconfig": "0.2.0"
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"clsx": "^2.1.0",
|
|
35
35
|
"react": "^19.1.0",
|
|
36
36
|
"react-dom": "^19.1.0",
|
|
37
|
-
"@rxdrag/rxcms-models": "0.3.
|
|
38
|
-
"@rxdrag/website-lib-core": "0.0.
|
|
37
|
+
"@rxdrag/rxcms-models": "0.3.88",
|
|
38
|
+
"@rxdrag/website-lib-core": "0.0.63"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"astro": "^4.0.0 || ^5.0.0"
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { BackgroundConfig, IEntify } from "@rxdrag/website-lib-core";
|
|
3
|
+
import {
|
|
4
|
+
BackgroundVideoPlayer,
|
|
5
|
+
BackgroundHlsVideoPlayer,
|
|
6
|
+
} from "@rxdrag/website-lib-core";
|
|
7
|
+
|
|
8
|
+
export interface Props {
|
|
9
|
+
background: BackgroundConfig;
|
|
10
|
+
index?: number;
|
|
11
|
+
defaultClass?: string;
|
|
12
|
+
rx: IEntify;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const {
|
|
16
|
+
background,
|
|
17
|
+
defaultClass = "absolute w-full h-full object-cover",
|
|
18
|
+
rx,
|
|
19
|
+
} = Astro.props;
|
|
20
|
+
|
|
21
|
+
// 安全地提取 mediaRef 和 posterRef(只有部分背景类型有这些属性)
|
|
22
|
+
const mediaRef =
|
|
23
|
+
background.type === "image" ||
|
|
24
|
+
background.type === "video" ||
|
|
25
|
+
background.type === "spline"
|
|
26
|
+
? background.mediaRef
|
|
27
|
+
: undefined;
|
|
28
|
+
|
|
29
|
+
const posterRef =
|
|
30
|
+
background.type === "video" ? background.posterRef : undefined;
|
|
31
|
+
|
|
32
|
+
// 获取媒体数据
|
|
33
|
+
const media = await rx.getMedia(mediaRef);
|
|
34
|
+
const poster = await rx.getMedia(posterRef);
|
|
35
|
+
|
|
36
|
+
// 构建 className
|
|
37
|
+
const className = [defaultClass, background.className]
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.join(" ");
|
|
40
|
+
|
|
41
|
+
// 预计算视频相关数据
|
|
42
|
+
const videoUrl =
|
|
43
|
+
background.type === "video"
|
|
44
|
+
? media?.file?.original || background.url
|
|
45
|
+
: undefined;
|
|
46
|
+
const posterUrl =
|
|
47
|
+
background.type === "video"
|
|
48
|
+
? poster?.file?.original || background.poster
|
|
49
|
+
: undefined;
|
|
50
|
+
const isHls =
|
|
51
|
+
background.type === "video" &&
|
|
52
|
+
(media?.storageType === "cloudflare_stream" ||
|
|
53
|
+
videoUrl?.endsWith(".m3u8") ||
|
|
54
|
+
videoUrl?.includes("cloudflarestream.com"));
|
|
55
|
+
|
|
56
|
+
// 预计算图片 URL
|
|
57
|
+
const imageUrl =
|
|
58
|
+
background.type === "image"
|
|
59
|
+
? media?.file?.original || background.url
|
|
60
|
+
: undefined;
|
|
61
|
+
|
|
62
|
+
// 预计算 Spline URL
|
|
63
|
+
const splineUrl =
|
|
64
|
+
background.type === "spline"
|
|
65
|
+
? background.url ||
|
|
66
|
+
(background.mediaRef ? `/media/${background.mediaRef}` : "")
|
|
67
|
+
: undefined;
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
{background.type === "color" && <div class={className} />}
|
|
71
|
+
|
|
72
|
+
{background.type === "blur" && <div class={className} />}
|
|
73
|
+
|
|
74
|
+
{
|
|
75
|
+
background.type === "image" && (
|
|
76
|
+
<img class={className} src={imageUrl} alt="Background Image" />
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
{
|
|
81
|
+
background.type === "svg" && background.code && (
|
|
82
|
+
<div class={className} set:html={background.code} />
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
{
|
|
87
|
+
background.type === "video" &&
|
|
88
|
+
(isHls ? (
|
|
89
|
+
<BackgroundHlsVideoPlayer
|
|
90
|
+
className={className}
|
|
91
|
+
src={videoUrl}
|
|
92
|
+
poster={posterUrl}
|
|
93
|
+
client:load
|
|
94
|
+
/>
|
|
95
|
+
) : (
|
|
96
|
+
<BackgroundVideoPlayer
|
|
97
|
+
className={className}
|
|
98
|
+
src={videoUrl}
|
|
99
|
+
poster={posterUrl}
|
|
100
|
+
client:load
|
|
101
|
+
/>
|
|
102
|
+
))
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
background.type === "spline" && (
|
|
107
|
+
<iframe class={className} src={splineUrl} title="Spline 3D Scene" />
|
|
108
|
+
)
|
|
109
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { BackgroundConfig, IEntify } from "@rxdrag/website-lib-core";
|
|
3
|
+
import Background from "./Background.astro";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
rx: IEntify;
|
|
7
|
+
backgrounds?: BackgroundConfig[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { backgrounds, rx } = Astro.props;
|
|
11
|
+
|
|
12
|
+
const defaultClass = "absolute w-full h-full inset-0 bg-cover bg-no-repeat";
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
<Fragment>
|
|
16
|
+
{
|
|
17
|
+
backgrounds?.map((background) => (
|
|
18
|
+
<Background background={background} rx={rx} defaultClass={defaultClass} />
|
|
19
|
+
))
|
|
20
|
+
}
|
|
21
|
+
</Fragment>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type {
|
|
3
|
+
AnimationConfig,
|
|
4
|
+
BackgroundConfig,
|
|
5
|
+
IEntify,
|
|
6
|
+
} from "@rxdrag/website-lib-core";
|
|
7
|
+
import BackgroundGroup from "./BackgroundGroup.astro";
|
|
8
|
+
import Container from "./Container.astro";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 区块
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
class?: string;
|
|
16
|
+
className?: string;
|
|
17
|
+
containerClassName?: string;
|
|
18
|
+
backgrounds?: BackgroundConfig[];
|
|
19
|
+
//动效
|
|
20
|
+
animation?: AnimationConfig;
|
|
21
|
+
disableContainer?: boolean;
|
|
22
|
+
rx: IEntify;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const {
|
|
26
|
+
className,
|
|
27
|
+
containerClassName,
|
|
28
|
+
backgrounds,
|
|
29
|
+
disableContainer,
|
|
30
|
+
class: originalClass,
|
|
31
|
+
rx,
|
|
32
|
+
} = Astro.props;
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
<section class:list={["section-block", className, originalClass]}>
|
|
36
|
+
<BackgroundGroup rx={rx} backgrounds={backgrounds} />
|
|
37
|
+
{
|
|
38
|
+
disableContainer ? (
|
|
39
|
+
<slot />
|
|
40
|
+
) : (
|
|
41
|
+
<Container class:list={["section-container", containerClassName]}>
|
|
42
|
+
<slot />
|
|
43
|
+
</Container>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
</section>
|
package/src/components/index.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export { default as AnimationNumber } from "./AnimationNumber.astro";
|
|
2
|
+
export { default as Background } from "./Background.astro";
|
|
3
|
+
export { default as BackgroundGroup } from "./BackgroundGroup.astro";
|
|
2
4
|
export { default as Collapse } from "./Collapse.astro";
|
|
3
5
|
export { default as CollapseTrigger } from "./CollapseTrigger.astro";
|
|
4
6
|
export { default as CollapsePanel } from "./CollapsePanel.astro";
|
|
7
|
+
export { default as Container } from "./Container.astro";
|
|
5
8
|
export { default as Flip } from "./Flip.astro";
|
|
6
9
|
export { default as Image } from "./Image.astro";
|
|
7
10
|
export { default as Link } from "./Link.astro";
|
|
@@ -14,6 +17,7 @@ export { default as Motion } from "./Motion.astro";
|
|
|
14
17
|
export { default as Popover } from "./Popover.astro";
|
|
15
18
|
export { default as PopoverPanel } from "./PopverPanel.astro";
|
|
16
19
|
export { default as RichTextView } from "./RichTextView.astro";
|
|
20
|
+
export { default as Section } from "./Section.astro";
|
|
17
21
|
export { default as Tabs } from "./Tabs.astro";
|
|
18
22
|
export { default as TabsBody } from "./TabsBody.astro";
|
|
19
23
|
export { default as TabsHeader } from "./TabsHeader.astro";
|