@ichaingo/image 1.5.14 → 1.5.15
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/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -25
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -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;;
|
|
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;;AA+ED,wBAAiC"}
|
package/dist/index.js
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { memo as
|
|
2
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
3
|
+
import { memo as m, useState as g, useMemo as _ } from "react";
|
|
4
4
|
import h from "next/image";
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
return e.replace(
|
|
5
|
+
const a = new RegExp("http(s)?://{image_base_path}"), E = ({ src: e, width: o }) => {
|
|
6
|
+
if (a.test(e))
|
|
7
|
+
return e.replace(a, process.env.NEXT_PUBLIC_IMAGES_URL || "");
|
|
8
8
|
if (typeof e != "string" || e.includes("default_image_bd46f9a3d8.png") || e.includes("default_f7fac00bf2.png"))
|
|
9
9
|
return e;
|
|
10
10
|
if (e.includes("ichainfo.com") || e.includes("ichatgo.ai")) {
|
|
11
11
|
const t = new URL(e.startsWith("//") ? "https:" + e : e);
|
|
12
|
-
return t.searchParams.set("format", "auto"), t.searchParams.set("width",
|
|
12
|
+
return t.searchParams.set("format", "auto"), t.searchParams.set("width", o.toString()), t.toString();
|
|
13
13
|
}
|
|
14
14
|
return e;
|
|
15
|
-
},
|
|
15
|
+
}, L = ({
|
|
16
16
|
src: e = `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/default_image_bd46f9a3d8.png`,
|
|
17
|
-
width:
|
|
17
|
+
width: o = 24,
|
|
18
18
|
height: t = 24,
|
|
19
19
|
alt: r,
|
|
20
|
-
objectFit:
|
|
21
|
-
errorSrc:
|
|
22
|
-
...
|
|
20
|
+
objectFit: f = "cover",
|
|
21
|
+
errorSrc: n = `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/default_f7fac00bf2.png`,
|
|
22
|
+
...s
|
|
23
23
|
}) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
typeof e == "string" && a.test(e) && (e = e.replace(a, process.env.NEXT_PUBLIC_IMAGES_URL || ""));
|
|
25
|
+
const [i, u] = g(!1);
|
|
26
|
+
(!e || typeof e == "string" && e.trim() === "") && (e = n);
|
|
27
|
+
const p = () => {
|
|
28
|
+
i || u(!0);
|
|
29
|
+
}, d = _(() => typeof e != "string" ? !1 : e.includes("ichainfo.com") || e.includes("ichatgo.ai"), [e]);
|
|
30
|
+
return /* @__PURE__ */ l(
|
|
30
31
|
h,
|
|
31
32
|
{
|
|
32
|
-
src:
|
|
33
|
+
src: i ? n : e,
|
|
33
34
|
alt: r || "",
|
|
34
35
|
"data-link": e,
|
|
35
|
-
width:
|
|
36
|
+
width: o,
|
|
36
37
|
height: t,
|
|
37
38
|
suppressHydrationWarning: !0,
|
|
38
|
-
style: { objectFit:
|
|
39
|
-
onError:
|
|
40
|
-
loader:
|
|
39
|
+
style: { objectFit: f },
|
|
40
|
+
onError: p,
|
|
41
|
+
loader: d ? E : void 0,
|
|
41
42
|
unoptimized: !0,
|
|
42
|
-
...
|
|
43
|
+
...s
|
|
43
44
|
}
|
|
44
45
|
);
|
|
45
|
-
},
|
|
46
|
+
}, c = m(L);
|
|
46
47
|
export {
|
|
47
|
-
|
|
48
|
+
c as default
|
|
48
49
|
};
|