@rxdrag/website-lib 0.0.70 → 0.0.72

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.70",
3
+ "version": "0.0.72",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.ts"
@@ -24,18 +24,18 @@
24
24
  "eslint": "^7.32.0",
25
25
  "gsap": "^3.12.7",
26
26
  "typescript": "^5",
27
- "@rxdrag/rxcms-models": "0.3.91",
27
+ "@rxdrag/entify-hooks": "0.2.73",
28
+ "@rxdrag/eslint-config-custom": "0.2.12",
28
29
  "@rxdrag/slate-preview": "1.2.58",
29
- "@rxdrag/entify-hooks": "0.2.72",
30
- "@rxdrag/tsconfig": "0.2.0",
31
- "@rxdrag/eslint-config-custom": "0.2.12"
30
+ "@rxdrag/rxcms-models": "0.3.92",
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/rxcms-models": "0.3.91",
38
- "@rxdrag/website-lib-core": "0.0.69"
37
+ "@rxdrag/website-lib-core": "0.0.70",
38
+ "@rxdrag/rxcms-models": "0.3.92"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "astro": "^4.0.0 || ^5.0.0"
@@ -16,7 +16,7 @@ export interface Props {
16
16
  defaultClass?: string;
17
17
  }
18
18
 
19
- const { env } = Astro.locals as Locals;
19
+ const { env, imageSizes } = Astro.locals as Locals;
20
20
 
21
21
  const { background, defaultClass = "absolute w-full h-full object-cover" } =
22
22
  Astro.props;
@@ -32,7 +32,7 @@ const mediaRef =
32
32
  const posterRef =
33
33
  background.type === "video" ? background.posterRef : undefined;
34
34
 
35
- const rx = Entify.getInstance(env);
35
+ const rx = Entify.getInstance(env, imageSizes);
36
36
 
37
37
  // 获取媒体数据
38
38
  const media = rx ? await rx.getMedia(mediaRef) : undefined;
@@ -9,7 +9,7 @@ interface Props {
9
9
  const { backgrounds } = Astro.props;
10
10
 
11
11
  const defaultClass =
12
- "absolute w-full h-full inset-0 object-cover object-center";
12
+ "absolute w-full h-full inset-0 object-cover";
13
13
  ---
14
14
 
15
15
  <Fragment>
@@ -1,13 +1,18 @@
1
1
  ---
2
- import type { FileRef, Media } from "@rxdrag/rxcms-models";
2
+ import { Entify, type ImageProps, type Locals } from "@rxdrag/website-lib-core";
3
+ const { env, imageSizes } = Astro.locals as Locals;
3
4
 
4
- interface Props extends Omit<astroHTML.JSX.ImgHTMLAttributes, "src" | "class"> {
5
- showField?: keyof FileRef;
6
- image?: Media;
7
- className?: string;
8
- }
5
+ interface Props extends ImageProps {}
9
6
 
10
- const { showField = "url", image, className, ...props } = Astro.props;
7
+ const { mediaRef, fileField, resize, className, ...props } = Astro.props;
8
+
9
+ const rx = Entify.getInstance(env, imageSizes);
10
+
11
+ const media = rx ? await rx.getMedia(mediaRef, fileField, resize) : undefined;
11
12
  ---
12
13
 
13
- <img src={image?.file?.[showField] || ""} class={className} {...props} />
14
+ <img
15
+ src={fileField ? media?.file?.[fileField] : media?.file?.original || ""}
16
+ class={className}
17
+ {...props}
18
+ />
@@ -4,7 +4,7 @@ import {
4
4
  ReactVideoPlayer,
5
5
  type Locals,
6
6
  } from "@rxdrag/website-lib-core";
7
- const { env } = Astro.locals as Locals;
7
+ const { env, imageSizes } = Astro.locals as Locals;
8
8
 
9
9
  interface Props {
10
10
  videoRef?: string;
@@ -31,7 +31,7 @@ const {
31
31
  classNames = {},
32
32
  } = Astro.props;
33
33
 
34
- const rx = Entify.getInstance(env);
34
+ const rx = Entify.getInstance(env, imageSizes);
35
35
 
36
36
  // 获取媒体数据(增加 rx 为空时的保护)
37
37
  const media = rx ? await rx.getMedia(videoRef) : undefined;