@rxdrag/website-lib 0.0.66 → 0.0.68

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.66",
3
+ "version": "0.0.68",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -25,17 +25,17 @@
25
25
  "gsap": "^3.12.7",
26
26
  "typescript": "^5",
27
27
  "@rxdrag/rxcms-models": "0.3.89",
28
- "@rxdrag/slate-preview": "1.2.58",
28
+ "@rxdrag/entify-hooks": "0.2.70",
29
29
  "@rxdrag/eslint-config-custom": "0.2.12",
30
- "@rxdrag/tsconfig": "0.2.0",
31
- "@rxdrag/entify-hooks": "0.2.70"
30
+ "@rxdrag/slate-preview": "1.2.58",
31
+ "@rxdrag/tsconfig": "0.2.0"
32
32
  },
33
33
  "dependencies": {
34
34
  "clsx": "^2.1.0",
35
35
  "react": "^19.1.0",
36
36
  "react-dom": "^19.1.0",
37
- "@rxdrag/website-lib-core": "0.0.65",
38
- "@rxdrag/rxcms-models": "0.3.89"
37
+ "@rxdrag/rxcms-models": "0.3.89",
38
+ "@rxdrag/website-lib-core": "0.0.67"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "astro": "^4.0.0 || ^5.0.0"
@@ -1,22 +1,25 @@
1
1
  ---
2
- import type { BackgroundConfig, IEntify } from "@rxdrag/website-lib-core";
2
+ import type {
3
+ BackgroundConfig,
4
+ Locals,
5
+ VideoBackgroundConfig,
6
+ } from "@rxdrag/website-lib-core";
3
7
  import {
4
8
  BackgroundVideoPlayer,
5
9
  BackgroundHlsVideoPlayer,
10
+ Entify,
6
11
  } from "@rxdrag/website-lib-core";
7
12
 
8
13
  export interface Props {
9
14
  background: BackgroundConfig;
10
15
  index?: number;
11
16
  defaultClass?: string;
12
- rx: IEntify;
13
17
  }
14
18
 
15
- const {
16
- background,
17
- defaultClass = "absolute w-full h-full object-cover",
18
- rx,
19
- } = Astro.props;
19
+ const { env } = Astro.locals as Locals;
20
+
21
+ const { background, defaultClass = "absolute w-full h-full object-cover" } =
22
+ Astro.props;
20
23
 
21
24
  // 安全地提取 mediaRef 和 posterRef(只有部分背景类型有这些属性)
22
25
  const mediaRef =
@@ -29,6 +32,8 @@ const mediaRef =
29
32
  const posterRef =
30
33
  background.type === "video" ? background.posterRef : undefined;
31
34
 
35
+ const rx = Entify.getInstance(env);
36
+
32
37
  // 获取媒体数据
33
38
  const media = rx ? await rx.getMedia(mediaRef) : undefined;
34
39
  const poster = rx ? await rx.getMedia(posterRef) : undefined;
@@ -40,13 +45,9 @@ const className = [defaultClass, background.className]
40
45
 
41
46
  // 预计算视频相关数据
42
47
  const videoUrl =
43
- background.type === "video"
44
- ? media?.file?.original || background.url
45
- : undefined;
48
+ background.type === "video" ? media?.file?.original : undefined;
46
49
  const posterUrl =
47
- background.type === "video"
48
- ? poster?.file?.original || background.poster
49
- : undefined;
50
+ background.type === "video" ? poster?.file?.original : undefined;
50
51
  const isHls =
51
52
  background.type === "video" &&
52
53
  (media?.storageType === "cloudflare_stream" ||
@@ -55,9 +56,7 @@ const isHls =
55
56
 
56
57
  // 预计算图片 URL
57
58
  const imageUrl =
58
- background.type === "image"
59
- ? media?.file?.original || background.url
60
- : undefined;
59
+ background.type === "image" ? media?.file?.original : undefined;
61
60
 
62
61
  // 预计算 Spline URL
63
62
  const splineUrl =
@@ -1,21 +1,21 @@
1
1
  ---
2
- import type { BackgroundConfig, IEntify } from "@rxdrag/website-lib-core";
2
+ import type { BackgroundConfig } from "@rxdrag/website-lib-core";
3
3
  import Background from "./Background.astro";
4
4
 
5
5
  interface Props {
6
- rx: IEntify;
7
6
  backgrounds?: BackgroundConfig[];
8
7
  }
9
8
 
10
- const { backgrounds, rx } = Astro.props;
9
+ const { backgrounds } = Astro.props;
11
10
 
12
- const defaultClass = "absolute w-full h-full inset-0 object-cover object-center";
11
+ const defaultClass =
12
+ "absolute w-full h-full inset-0 object-cover object-center";
13
13
  ---
14
14
 
15
15
  <Fragment>
16
16
  {
17
17
  backgrounds?.map((background) => (
18
- <Background background={background} rx={rx} defaultClass={defaultClass} />
18
+ <Background background={background} defaultClass={defaultClass} />
19
19
  ))
20
20
  }
21
21
  </Fragment>
@@ -2,7 +2,6 @@
2
2
  import type {
3
3
  AnimationConfig,
4
4
  BackgroundConfig,
5
- IEntify,
6
5
  } from "@rxdrag/website-lib-core";
7
6
  import BackgroundGroup from "./BackgroundGroup.astro";
8
7
 
@@ -12,13 +11,12 @@ interface Props {
12
11
  backgrounds?: BackgroundConfig[];
13
12
  //动效
14
13
  animation?: AnimationConfig;
15
- rx: IEntify;
16
14
  }
17
15
 
18
- const { className, class: originalClass, backgrounds, rx } = Astro.props;
16
+ const { className, class: originalClass, backgrounds } = Astro.props;
19
17
  ---
20
18
 
21
19
  <div class:list={["w-full, h-full flex flex-col", className, originalClass]}>
22
- <BackgroundGroup backgrounds={backgrounds} rx={rx} />
20
+ <BackgroundGroup backgrounds={backgrounds} />
23
21
  <slot />
24
22
  </div>
@@ -2,7 +2,6 @@
2
2
  import type {
3
3
  AnimationConfig,
4
4
  BackgroundConfig,
5
- IEntify,
6
5
  } from "@rxdrag/website-lib-core";
7
6
  import BackgroundGroup from "./BackgroundGroup.astro";
8
7
 
@@ -14,15 +13,14 @@ interface Props {
14
13
  backgrounds?: BackgroundConfig[];
15
14
  //动效
16
15
  animation?: AnimationConfig;
17
- rx: IEntify;
18
16
  }
19
17
 
20
- const { className, class: originalClass, backgrounds, rx } = Astro.props;
18
+ const { className, class: originalClass, backgrounds } = Astro.props;
21
19
 
22
20
  //布局容器
23
21
  ---
24
22
 
25
23
  <div class:list={["relative grid gap-12", className, originalClass]}>
26
- <BackgroundGroup backgrounds={backgrounds} rx={rx} />
24
+ <BackgroundGroup backgrounds={backgrounds} />
27
25
  <slot />
28
26
  </div>
@@ -2,7 +2,6 @@
2
2
  import type {
3
3
  AnimationConfig,
4
4
  BackgroundConfig,
5
- IEntify,
6
5
  } from "@rxdrag/website-lib-core";
7
6
  import BackgroundGroup from "./BackgroundGroup.astro";
8
7
 
@@ -12,13 +11,12 @@ interface Props {
12
11
  backgrounds?: BackgroundConfig[];
13
12
  //动效
14
13
  animation?: AnimationConfig;
15
- rx: IEntify;
16
14
  }
17
15
 
18
- const { className, class: originalClass, backgrounds, rx } = Astro.props;
16
+ const { className, class: originalClass, backgrounds } = Astro.props;
19
17
  ---
20
18
 
21
19
  <div class:list={["w-full, h-full flex flex-col", className, originalClass]}>
22
- <BackgroundGroup backgrounds={backgrounds} rx={rx} />
20
+ <BackgroundGroup backgrounds={backgrounds} />
23
21
  <slot />
24
22
  </div>
@@ -2,7 +2,6 @@
2
2
  import type {
3
3
  AnimationConfig,
4
4
  BackgroundConfig,
5
- IEntify,
6
5
  } from "@rxdrag/website-lib-core";
7
6
  import BackgroundGroup from "./BackgroundGroup.astro";
8
7
  import Container from "./Container.astro";
@@ -19,7 +18,6 @@ interface Props {
19
18
  //动效
20
19
  animation?: AnimationConfig;
21
20
  disableContainer?: boolean;
22
- rx: IEntify;
23
21
  }
24
22
 
25
23
  const {
@@ -28,12 +26,11 @@ const {
28
26
  backgrounds,
29
27
  disableContainer,
30
28
  class: originalClass,
31
- rx,
32
29
  } = Astro.props;
33
30
  ---
34
31
 
35
32
  <section class:list={["section-block", className, originalClass]}>
36
- <BackgroundGroup rx={rx} backgrounds={backgrounds} />
33
+ <BackgroundGroup backgrounds={backgrounds} />
37
34
  {
38
35
  disableContainer ? (
39
36
  <slot />
@@ -1,5 +1,10 @@
1
1
  ---
2
- import { ReactVideoPlayer, type IEntify } from "@rxdrag/website-lib-core";
2
+ import {
3
+ Entify,
4
+ ReactVideoPlayer,
5
+ type Locals,
6
+ } from "@rxdrag/website-lib-core";
7
+ const { env } = Astro.locals as Locals;
3
8
 
4
9
  interface Props {
5
10
  videoRef?: string;
@@ -17,17 +22,17 @@ interface Props {
17
22
  ctaButton?: string;
18
23
  overlayReplayButton?: string;
19
24
  };
20
- rx: IEntify;
21
25
  }
22
26
 
23
27
  const {
24
- rx,
25
28
  videoRef,
26
29
  posterRef,
27
30
  endTitle = "Contact Us Now",
28
31
  classNames = {},
29
32
  } = Astro.props;
30
33
 
34
+ const rx = Entify.getInstance(env);
35
+
31
36
  // 获取媒体数据(增加 rx 为空时的保护)
32
37
  const media = rx ? await rx.getMedia(videoRef) : undefined;
33
38
  const poster = rx ? await rx.getMedia(posterRef) : undefined;