@rxdrag/website-lib 0.0.128 → 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.
@@ -1,11 +1,10 @@
1
1
  ---
2
- import type { Locals } from "@rxdrag/website-lib-core";
2
+ import type { BackgroundConfig, Locals } from "@rxdrag/website-lib-core";
3
3
  import {
4
4
  BackgroundVideoPlayer,
5
5
  BackgroundHlsVideoPlayer,
6
6
  Entify,
7
7
  } from "@rxdrag/website-lib-core";
8
- import type { BackgroundConfig } from "./Background.type";
9
8
  import { getImage } from "astro:assets";
10
9
  import type { ImageMetadata } from "astro";
11
10
  import Image from "./Image.astro";
@@ -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
- //TODO 要删除
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
- const posterObj = rx ? await rx.getMedia(posterRef) : undefined;
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={posterObj?.file?.original}
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.128",
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/tiptap-preview": "0.0.3",
29
30
  "@rxdrag/eslint-config-custom": "0.2.13",
30
- "@rxdrag/entify-hooks": "0.2.79",
31
31
  "@rxdrag/rxcms-models": "0.3.98",
32
32
  "@rxdrag/tsconfig": "0.2.1",
33
- "@rxdrag/tiptap-preview": "0.0.3"
33
+ "@rxdrag/entify-hooks": "0.2.79"
34
34
  },
35
35
  "dependencies": {
36
36
  "aos": "3.0.0-beta.6",
@@ -38,8 +38,8 @@
38
38
  "react": "^19.1.0",
39
39
  "react-dom": "^19.1.0",
40
40
  "vanilla-cookieconsent": "3.1.0",
41
- "@rxdrag/rxcms-models": "0.3.98",
42
- "@rxdrag/website-lib-core": "0.0.120"
41
+ "@rxdrag/website-lib-core": "0.0.123",
42
+ "@rxdrag/rxcms-models": "0.3.98"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "astro": "^4.0.0 || ^5.0.0"
@@ -1,18 +0,0 @@
1
- import type { BlurBackgroundConfig, ColorBackgroundConfig, ImageBackgroundConfig, SplineBackgroundConfig, SvgBackgroundConfig, VideoBackgroundConfig } from "@rxdrag/website-lib-core";
2
- import type { ImageMetadata } from "astro";
3
-
4
-
5
- export type ImageBgConfig = Omit<ImageBackgroundConfig, "src"> & {
6
- src?: string | ImageMetadata;
7
- }
8
-
9
- export type VideoBgConfig = Omit<VideoBackgroundConfig, "poster"> & {
10
- poster?: string | ImageMetadata;
11
- }
12
-
13
- export type BackgroundConfig = | ColorBackgroundConfig
14
- | BlurBackgroundConfig
15
- | ImageBgConfig
16
- | SvgBackgroundConfig
17
- | VideoBgConfig
18
- | SplineBackgroundConfig;