@rxdrag/website-lib 0.0.129 → 0.0.130
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/Video.astro +16 -9
- package/package.json +6 -6
package/components/Video.astro
CHANGED
|
@@ -4,15 +4,14 @@ import {
|
|
|
4
4
|
ReactVideoPlayer,
|
|
5
5
|
type Locals,
|
|
6
6
|
} from "@rxdrag/website-lib-core";
|
|
7
|
+
import { getImage } from "astro:assets";
|
|
8
|
+
import type { ImageMetadata } from "astro";
|
|
9
|
+
|
|
7
10
|
const { env, imageSizes } = Astro.locals as Locals;
|
|
8
11
|
|
|
9
12
|
interface Props {
|
|
10
|
-
//TODO 要删除
|
|
11
13
|
videoRef?: string;
|
|
12
|
-
|
|
13
|
-
posterRef?: string;
|
|
14
|
-
src?: string;
|
|
15
|
-
poster?: string;
|
|
14
|
+
poster?: string | ImageMetadata;
|
|
16
15
|
endTitle?: string;
|
|
17
16
|
eagerLoad?: boolean;
|
|
18
17
|
classNames?: {
|
|
@@ -31,8 +30,6 @@ interface Props {
|
|
|
31
30
|
|
|
32
31
|
const {
|
|
33
32
|
videoRef,
|
|
34
|
-
posterRef,
|
|
35
|
-
src,
|
|
36
33
|
poster,
|
|
37
34
|
eagerLoad,
|
|
38
35
|
endTitle = "Contact Us Now",
|
|
@@ -43,7 +40,17 @@ const rx = Entify.getInstance(env, imageSizes);
|
|
|
43
40
|
|
|
44
41
|
// 获取媒体数据(增加 rx 为空时的保护)
|
|
45
42
|
const media = rx ? await rx.getMedia(videoRef) : undefined;
|
|
46
|
-
|
|
43
|
+
|
|
44
|
+
// 处理封面图
|
|
45
|
+
let posterUrl: string | undefined;
|
|
46
|
+
if (poster) {
|
|
47
|
+
if (typeof poster === "string") {
|
|
48
|
+
posterUrl = poster;
|
|
49
|
+
} else {
|
|
50
|
+
const posterImage = await getImage({ src: poster });
|
|
51
|
+
posterUrl = posterImage.src;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
47
54
|
---
|
|
48
55
|
|
|
49
56
|
{
|
|
@@ -52,7 +59,7 @@ const posterObj = rx ? await rx.getMedia(posterRef) : undefined;
|
|
|
52
59
|
client:load
|
|
53
60
|
media={media}
|
|
54
61
|
endTitle={endTitle}
|
|
55
|
-
posterUrl={
|
|
62
|
+
posterUrl={posterUrl}
|
|
56
63
|
eagerLoad={eagerLoad}
|
|
57
64
|
classNames={classNames}
|
|
58
65
|
/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdrag/website-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.130",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.ts",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"eslint": "^9.39.2",
|
|
27
27
|
"gsap": "^3.12.7",
|
|
28
28
|
"typescript": "^5",
|
|
29
|
-
"@rxdrag/entify-hooks": "0.2.79",
|
|
30
|
-
"@rxdrag/rxcms-models": "0.3.98",
|
|
31
|
-
"@rxdrag/eslint-config-custom": "0.2.13",
|
|
32
29
|
"@rxdrag/tiptap-preview": "0.0.3",
|
|
33
|
-
"@rxdrag/
|
|
30
|
+
"@rxdrag/eslint-config-custom": "0.2.13",
|
|
31
|
+
"@rxdrag/rxcms-models": "0.3.98",
|
|
32
|
+
"@rxdrag/tsconfig": "0.2.1",
|
|
33
|
+
"@rxdrag/entify-hooks": "0.2.79"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"aos": "3.0.0-beta.6",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react": "^19.1.0",
|
|
39
39
|
"react-dom": "^19.1.0",
|
|
40
40
|
"vanilla-cookieconsent": "3.1.0",
|
|
41
|
-
"@rxdrag/website-lib-core": "0.0.
|
|
41
|
+
"@rxdrag/website-lib-core": "0.0.123",
|
|
42
42
|
"@rxdrag/rxcms-models": "0.3.98"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|