@ichaingo/image 1.5.11 → 1.5.13

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 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAc,EAAe,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7E,UAAU,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrF,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;CAClE;;AAwED,wBAAiC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAc,EAAe,UAAU,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7E,UAAU,gBAAiB,SAAQ,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IACrF,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;CAClE;;AA4ED,wBAAiC"}
package/dist/index.js CHANGED
@@ -1,46 +1,48 @@
1
1
  'use client';
2
2
  import { jsx as m } from "react/jsx-runtime";
3
- import { memo as l, useState as p, useMemo as g } from "react";
3
+ import { memo as l, useState as g, useMemo as _ } from "react";
4
4
  import h from "next/image";
5
- const _ = ({ src: t, width: a }) => {
6
- if (typeof t != "string" || t.includes("default_image_bd46f9a3d8.png") || t.includes("default_f7fac00bf2.png"))
7
- return t;
8
- if (t.includes("ichainfo.com") || t.includes("ichatgo.ai")) {
9
- const e = new URL(t.startsWith("//") ? "https:" + t : t);
10
- return e.searchParams.set("format", "auto"), e.searchParams.set("width", a.toString()), e.toString();
5
+ const i = new RegExp("http(s)?://{image_base_path}"), E = ({ src: e, width: a }) => {
6
+ if (i.test(e))
7
+ return e.replace(i, process.env.NEXT_PUBLIC_IMAGE_BASE_PATH || "");
8
+ if (typeof e != "string" || e.includes("default_image_bd46f9a3d8.png") || e.includes("default_f7fac00bf2.png"))
9
+ return e;
10
+ if (e.includes("ichainfo.com") || e.includes("ichatgo.ai")) {
11
+ const t = new URL(e.startsWith("//") ? "https:" + e : e);
12
+ return t.searchParams.set("format", "auto"), t.searchParams.set("width", a.toString()), t.toString();
11
13
  }
12
- return t;
14
+ return e;
13
15
  }, c = ({
14
- src: t = `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/default_image_bd46f9a3d8.png`,
16
+ src: e = `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/default_image_bd46f9a3d8.png`,
15
17
  width: a = 24,
16
- height: e = 24,
17
- alt: n,
18
- objectFit: r = "cover",
18
+ height: t = 24,
19
+ alt: r,
20
+ objectFit: s = "cover",
19
21
  errorSrc: o = `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/default_f7fac00bf2.png`,
20
22
  ...u
21
23
  }) => {
22
- const [i, f] = p(!1);
23
- (!t || typeof t == "string" && t.trim() === "") && (t = o);
24
- const s = () => {
25
- i || f(!0);
26
- }, d = g(() => typeof t != "string" ? !1 : t.includes("ichainfo.com") || t.includes("ichatgo.ai"), [t]);
24
+ const [n, f] = g(!1);
25
+ (!e || typeof e == "string" && e.trim() === "") && (e = o);
26
+ const d = () => {
27
+ n || f(!0);
28
+ }, p = _(() => typeof e != "string" ? !1 : e.includes("ichainfo.com") || e.includes("ichatgo.ai"), [e]);
27
29
  return /* @__PURE__ */ m(
28
30
  h,
29
31
  {
30
- src: i ? o : t,
31
- alt: n || "",
32
- "data-link": t,
32
+ src: n ? o : e,
33
+ alt: r || "",
34
+ "data-link": e,
33
35
  width: a,
34
- height: e,
36
+ height: t,
35
37
  suppressHydrationWarning: !0,
36
- style: { objectFit: r },
37
- onError: s,
38
- loader: d ? _ : void 0,
38
+ style: { objectFit: s },
39
+ onError: d,
40
+ loader: p ? E : void 0,
39
41
  unoptimized: !0,
40
42
  ...u
41
43
  }
42
44
  );
43
- }, C = l(c);
45
+ }, P = l(c);
44
46
  export {
45
- C as default
47
+ P as default
46
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/image",
3
- "version": "1.5.11",
3
+ "version": "1.5.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",