@rxdrag/website-lib 0.0.165 → 0.0.168
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/components/Background.astro +2 -12
- package/components/Video.astro +13 -21
- package/package.json +7 -6
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
import type { BackgroundConfig, Locals } from "@rxdrag/website-lib-core";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
BackgroundHlsVideoPlayer,
|
|
6
|
-
Entify,
|
|
7
|
-
} from "@rxdrag/website-lib-core";
|
|
3
|
+
import { Entify } from "@rxdrag/website-lib-core";
|
|
4
|
+
import { BackgroundVideoPlayer, BackgroundHlsVideoPlayer } from "@rxdrag/website-lib-react";
|
|
8
5
|
import Image from "./Image.astro";
|
|
9
6
|
import GlassBorder from "./GlassBorder.astro";
|
|
10
7
|
import GradientBorder from "./GradientBorder.astro";
|
|
@@ -29,19 +26,15 @@ const className = rawClass
|
|
|
29
26
|
? `${hasLayoutOverride ? "absolute" : defaultFill} ${rawClass}`
|
|
30
27
|
: defaultFill;
|
|
31
28
|
|
|
32
|
-
// 安全地提取 mediaRef 和 posterRef(只有部分背景类型有这些属性)
|
|
33
29
|
const mediaRef = background.type === "video" ? background.mediaRef : undefined;
|
|
34
30
|
|
|
35
31
|
const rx = Entify.getInstance(env, imageSizes);
|
|
36
32
|
|
|
37
|
-
// 获取媒体数据
|
|
38
33
|
const media = rx ? await rx.getMedia(mediaRef) : undefined;
|
|
39
34
|
|
|
40
|
-
// 预计算视频相关数据
|
|
41
35
|
const videoUrl =
|
|
42
36
|
background.type === "video" ? media?.file?.original : undefined;
|
|
43
37
|
|
|
44
|
-
// 处理视频封面
|
|
45
38
|
let posterUrl: string | undefined;
|
|
46
39
|
if (background.type === "video" && background.poster) {
|
|
47
40
|
if (typeof background.poster === "string") {
|
|
@@ -69,9 +62,7 @@ const isHls =
|
|
|
69
62
|
videoUrl?.endsWith(".m3u8") ||
|
|
70
63
|
videoUrl?.includes("cloudflarestream.com"));
|
|
71
64
|
|
|
72
|
-
// 预计算 Spline URL
|
|
73
65
|
const splineUrl = background.type === "spline" ? background.url : undefined;
|
|
74
|
-
|
|
75
66
|
---
|
|
76
67
|
|
|
77
68
|
{background.type === "color" && <div class={className} />}
|
|
@@ -137,4 +128,3 @@ const splineUrl = background.type === "spline" ? background.url : undefined;
|
|
|
137
128
|
<iframe class={className} src={splineUrl} title="Spline 3D Scene" />
|
|
138
129
|
)
|
|
139
130
|
}
|
|
140
|
-
|
package/components/Video.astro
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
ReactVideoPlayer,
|
|
5
|
-
type Locals,
|
|
6
|
-
} from "@rxdrag/website-lib-core";
|
|
2
|
+
import { Entify, type Locals } from "@rxdrag/website-lib-core";
|
|
3
|
+
import { ReactVideoPlayer } from "@rxdrag/website-lib-react";
|
|
7
4
|
|
|
8
5
|
const { env, imageSizes } = Astro.locals as Locals;
|
|
9
6
|
|
|
@@ -37,32 +34,27 @@ const {
|
|
|
37
34
|
|
|
38
35
|
const rx = Entify.getInstance(env, imageSizes);
|
|
39
36
|
|
|
40
|
-
// 获取媒体数据(增加 rx 为空时的保护)
|
|
41
37
|
const media = rx ? await rx.getMedia(videoRef) : undefined;
|
|
42
38
|
|
|
43
|
-
// 处理封面图
|
|
44
39
|
let posterUrl: string | undefined;
|
|
45
40
|
if (poster) {
|
|
46
41
|
if (typeof poster === "string") {
|
|
47
42
|
posterUrl = poster;
|
|
48
43
|
} else {
|
|
49
|
-
|
|
50
|
-
posterUrl = poster.src; //;posterImage.src;
|
|
44
|
+
posterUrl = poster.src;
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
47
|
---
|
|
54
48
|
|
|
55
49
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</ReactVideoPlayer>
|
|
67
|
-
|
|
50
|
+
<ReactVideoPlayer
|
|
51
|
+
client:load
|
|
52
|
+
media={media}
|
|
53
|
+
endTitle={endTitle}
|
|
54
|
+
posterUrl={posterUrl}
|
|
55
|
+
eagerLoad={eagerLoad}
|
|
56
|
+
classNames={classNames}
|
|
57
|
+
>
|
|
58
|
+
<slot />
|
|
59
|
+
</ReactVideoPlayer>
|
|
68
60
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.168",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"eslint": "^9.39.2",
|
|
27
27
|
"gsap": "^3.12.7",
|
|
28
28
|
"typescript": "^5",
|
|
29
|
-
"@rxdrag/website-lib-core": "0.0.133",
|
|
30
|
-
"@rxdrag/rxcms-models": "0.3.111",
|
|
31
29
|
"@rxdrag/eslint-config-custom": "0.2.13",
|
|
32
|
-
"@rxdrag/tsconfig": "0.2.1",
|
|
33
30
|
"@rxdrag/entify-hooks": "0.2.79",
|
|
34
|
-
"@rxdrag/tiptap-preview": "0.0.3"
|
|
31
|
+
"@rxdrag/tiptap-preview": "0.0.3",
|
|
32
|
+
"@rxdrag/tsconfig": "0.2.1",
|
|
33
|
+
"@rxdrag/rxcms-models": "0.3.111",
|
|
34
|
+
"@rxdrag/website-lib-core": "0.0.136"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"aos": "3.0.0-beta.6",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"react": "^19.1.0",
|
|
40
40
|
"react-dom": "^19.1.0",
|
|
41
41
|
"vanilla-cookieconsent": "3.1.0",
|
|
42
|
-
"@rxdrag/rxcms-models": "0.3.111"
|
|
42
|
+
"@rxdrag/rxcms-models": "0.3.111",
|
|
43
|
+
"@rxdrag/website-lib-react": "0.0.2"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
46
|
"astro": "^6.1.1",
|