@medialane/ui 0.126.1 → 0.126.3
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/components/animated-token-media.cjs +47 -27
- package/dist/components/animated-token-media.cjs.map +1 -1
- package/dist/components/animated-token-media.js +49 -29
- package/dist/components/animated-token-media.js.map +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/utils/ipfs.cjs +7 -2
- package/dist/utils/ipfs.cjs.map +1 -1
- package/dist/utils/ipfs.js +7 -2
- package/dist/utils/ipfs.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
36
|
var import_react = require("react");
|
|
37
37
|
var import_image = __toESM(require("next/image"), 1);
|
|
38
38
|
var import_use_intersection_active = require("../utils/use-intersection-active.js");
|
|
39
|
+
var import_cn = require("../utils/cn.js");
|
|
39
40
|
function AnimatedTokenMedia({
|
|
40
41
|
image,
|
|
41
42
|
alt,
|
|
@@ -55,9 +56,11 @@ function AnimatedTokenMedia({
|
|
|
55
56
|
setInternalError(true);
|
|
56
57
|
onImageError?.();
|
|
57
58
|
};
|
|
59
|
+
const [loaded, setLoaded] = (0, import_react.useState)(false);
|
|
60
|
+
(0, import_react.useEffect)(() => setLoaded(false), [image]);
|
|
58
61
|
const [ref, isVisible] = (0, import_use_intersection_active.useIntersectionActive)();
|
|
59
62
|
const showLive = live && !!animationUrl && isVisible;
|
|
60
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: mode === "fill" ? "absolute inset-0" : "w-full", children: showLive ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: mode === "fill" ? "absolute inset-0" : "relative w-full", children: showLive ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
64
|
"iframe",
|
|
62
65
|
{
|
|
63
66
|
src: animationUrl,
|
|
@@ -66,32 +69,49 @@ function AnimatedTokenMedia({
|
|
|
66
69
|
loading: "lazy",
|
|
67
70
|
className: mode === "fill" ? "absolute inset-0 w-full h-full border-0" : "w-full aspect-square border-0"
|
|
68
71
|
}
|
|
69
|
-
) : image && !imgError ?
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
72
|
+
) : image && !imgError ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
73
|
+
!loaded && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
"div",
|
|
75
|
+
{
|
|
76
|
+
className: (0, import_cn.cn)(
|
|
77
|
+
"animate-[shimmer_1.6s_ease-in-out_infinite] bg-foreground/[0.06] absolute",
|
|
78
|
+
mode === "fill" ? "inset-0" : "inset-x-0 top-0 aspect-square"
|
|
79
|
+
),
|
|
80
|
+
style: {
|
|
81
|
+
backgroundImage: "linear-gradient(90deg, transparent, color-mix(in srgb, var(--foreground) 8%, transparent), transparent)",
|
|
82
|
+
backgroundSize: "200% 100%"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
mode === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
87
|
+
import_image.default,
|
|
88
|
+
{
|
|
89
|
+
src: image,
|
|
90
|
+
alt,
|
|
91
|
+
fill: true,
|
|
92
|
+
unoptimized: true,
|
|
93
|
+
sizes,
|
|
94
|
+
priority,
|
|
95
|
+
className: (0, import_cn.cn)(className, "transition-opacity duration-300", loaded ? "opacity-100" : "opacity-0"),
|
|
96
|
+
onLoad: () => setLoaded(true),
|
|
97
|
+
onError: handleImageError
|
|
98
|
+
}
|
|
99
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
100
|
+
import_image.default,
|
|
101
|
+
{
|
|
102
|
+
src: image,
|
|
103
|
+
alt,
|
|
104
|
+
width: 0,
|
|
105
|
+
height: 0,
|
|
106
|
+
sizes,
|
|
107
|
+
priority,
|
|
108
|
+
crossOrigin: "anonymous",
|
|
109
|
+
className: (0, import_cn.cn)(className ?? "w-full h-auto", "transition-opacity duration-300", loaded ? "opacity-100" : "opacity-0"),
|
|
110
|
+
onLoad: () => setLoaded(true),
|
|
111
|
+
onError: handleImageError
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] }) : fallback ?? null });
|
|
95
115
|
}
|
|
96
116
|
// Annotate the CommonJS export names for ESM import in node:
|
|
97
117
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/animated-token-media.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Image from \"next/image\";\nimport { useIntersectionActive } from \"../utils/use-intersection-active.js\";\n\nexport interface AnimatedTokenMediaProps {\n\n image: string | null;\n alt: string;\n\n animationUrl?: string | null;\n\n live?: boolean;\n\n mode?: \"fill\" | \"natural\";\n className?: string;\n sizes?: string;\n priority?: boolean;\n\n imgError?: boolean;\n onImageError?: () => void;\n\n fallback?: React.ReactNode;\n}\n\nexport function AnimatedTokenMedia({\n image,\n alt,\n animationUrl,\n live = false,\n mode = \"fill\",\n className,\n sizes,\n priority,\n imgError: imgErrorProp,\n onImageError,\n fallback,\n}: AnimatedTokenMediaProps) {\n const [internalError, setInternalError] = useState(false);\n const imgError = imgErrorProp ?? internalError;\n const handleImageError = () => {\n setInternalError(true);\n onImageError?.();\n };\n\n const [ref, isVisible] = useIntersectionActive<HTMLDivElement>();\n const showLive = live && !!animationUrl && isVisible;\n\n return (\n <div ref={ref} className={mode === \"fill\" ? \"absolute inset-0\" : \"w-full\"}>\n {showLive ? (\n <iframe\n src={animationUrl!}\n title={alt}\n sandbox=\"allow-scripts\"\n loading=\"lazy\"\n className={\n mode === \"fill\"\n ? \"absolute inset-0 w-full h-full border-0\"\n : \"w-full aspect-square border-0\"\n }\n />\n ) : image && !imgError ? (\n mode === \"fill\" ? (\n <Image\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/animated-token-media.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport Image from \"next/image\";\nimport { useIntersectionActive } from \"../utils/use-intersection-active.js\";\nimport { cn } from \"../utils/cn.js\";\n\nexport interface AnimatedTokenMediaProps {\n\n image: string | null;\n alt: string;\n\n animationUrl?: string | null;\n\n live?: boolean;\n\n mode?: \"fill\" | \"natural\";\n className?: string;\n sizes?: string;\n priority?: boolean;\n\n imgError?: boolean;\n onImageError?: () => void;\n\n fallback?: React.ReactNode;\n}\n\nexport function AnimatedTokenMedia({\n image,\n alt,\n animationUrl,\n live = false,\n mode = \"fill\",\n className,\n sizes,\n priority,\n imgError: imgErrorProp,\n onImageError,\n fallback,\n}: AnimatedTokenMediaProps) {\n const [internalError, setInternalError] = useState(false);\n const imgError = imgErrorProp ?? internalError;\n const handleImageError = () => {\n setInternalError(true);\n onImageError?.();\n };\n\n const [loaded, setLoaded] = useState(false);\n useEffect(() => setLoaded(false), [image]);\n\n const [ref, isVisible] = useIntersectionActive<HTMLDivElement>();\n const showLive = live && !!animationUrl && isVisible;\n\n return (\n <div ref={ref} className={mode === \"fill\" ? \"absolute inset-0\" : \"relative w-full\"}>\n {showLive ? (\n <iframe\n src={animationUrl!}\n title={alt}\n sandbox=\"allow-scripts\"\n loading=\"lazy\"\n className={\n mode === \"fill\"\n ? \"absolute inset-0 w-full h-full border-0\"\n : \"w-full aspect-square border-0\"\n }\n />\n ) : image && !imgError ? (\n <>\n {!loaded && (\n <div\n className={cn(\n \"animate-[shimmer_1.6s_ease-in-out_infinite] bg-foreground/[0.06] absolute\",\n mode === \"fill\" ? \"inset-0\" : \"inset-x-0 top-0 aspect-square\"\n )}\n style={{\n backgroundImage:\n \"linear-gradient(90deg, transparent, color-mix(in srgb, var(--foreground) 8%, transparent), transparent)\",\n backgroundSize: \"200% 100%\",\n }}\n />\n )}\n {mode === \"fill\" ? (\n <Image\n src={image}\n alt={alt}\n fill\n unoptimized\n sizes={sizes}\n priority={priority}\n className={cn(className, \"transition-opacity duration-300\", loaded ? \"opacity-100\" : \"opacity-0\")}\n onLoad={() => setLoaded(true)}\n onError={handleImageError}\n />\n ) : (\n <Image\n src={image}\n alt={alt}\n width={0}\n height={0}\n sizes={sizes}\n priority={priority}\n crossOrigin=\"anonymous\"\n className={cn(className ?? \"w-full h-auto\", \"transition-opacity duration-300\", loaded ? \"opacity-100\" : \"opacity-0\")}\n onLoad={() => setLoaded(true)}\n onError={handleImageError}\n />\n )}\n </>\n ) : (\n fallback ?? null\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDQ;AAtDR,mBAAoC;AACpC,mBAAkB;AAClB,qCAAsC;AACtC,gBAAmB;AAsBZ,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AACF,GAA4B;AAC1B,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,KAAK;AACxD,QAAM,WAAW,gBAAgB;AACjC,QAAM,mBAAmB,MAAM;AAC7B,qBAAiB,IAAI;AACrB,mBAAe;AAAA,EACjB;AAEA,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,KAAK;AAC1C,8BA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x-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
4
|
import Image from "next/image";
|
|
5
5
|
import { useIntersectionActive } from "../utils/use-intersection-active.js";
|
|
6
|
+
import { cn } from "../utils/cn.js";
|
|
6
7
|
function AnimatedTokenMedia({
|
|
7
8
|
image,
|
|
8
9
|
alt,
|
|
@@ -22,9 +23,11 @@ function AnimatedTokenMedia({
|
|
|
22
23
|
setInternalError(true);
|
|
23
24
|
onImageError?.();
|
|
24
25
|
};
|
|
26
|
+
const [loaded, setLoaded] = useState(false);
|
|
27
|
+
useEffect(() => setLoaded(false), [image]);
|
|
25
28
|
const [ref, isVisible] = useIntersectionActive();
|
|
26
29
|
const showLive = live && !!animationUrl && isVisible;
|
|
27
|
-
return /* @__PURE__ */ jsx("div", { ref, className: mode === "fill" ? "absolute inset-0" : "w-full", children: showLive ? /* @__PURE__ */ jsx(
|
|
30
|
+
return /* @__PURE__ */ jsx("div", { ref, className: mode === "fill" ? "absolute inset-0" : "relative w-full", children: showLive ? /* @__PURE__ */ jsx(
|
|
28
31
|
"iframe",
|
|
29
32
|
{
|
|
30
33
|
src: animationUrl,
|
|
@@ -33,32 +36,49 @@ function AnimatedTokenMedia({
|
|
|
33
36
|
loading: "lazy",
|
|
34
37
|
className: mode === "fill" ? "absolute inset-0 w-full h-full border-0" : "w-full aspect-square border-0"
|
|
35
38
|
}
|
|
36
|
-
) : image && !imgError ?
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
) : image && !imgError ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
!loaded && /* @__PURE__ */ jsx(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
className: cn(
|
|
44
|
+
"animate-[shimmer_1.6s_ease-in-out_infinite] bg-foreground/[0.06] absolute",
|
|
45
|
+
mode === "fill" ? "inset-0" : "inset-x-0 top-0 aspect-square"
|
|
46
|
+
),
|
|
47
|
+
style: {
|
|
48
|
+
backgroundImage: "linear-gradient(90deg, transparent, color-mix(in srgb, var(--foreground) 8%, transparent), transparent)",
|
|
49
|
+
backgroundSize: "200% 100%"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
mode === "fill" ? /* @__PURE__ */ jsx(
|
|
54
|
+
Image,
|
|
55
|
+
{
|
|
56
|
+
src: image,
|
|
57
|
+
alt,
|
|
58
|
+
fill: true,
|
|
59
|
+
unoptimized: true,
|
|
60
|
+
sizes,
|
|
61
|
+
priority,
|
|
62
|
+
className: cn(className, "transition-opacity duration-300", loaded ? "opacity-100" : "opacity-0"),
|
|
63
|
+
onLoad: () => setLoaded(true),
|
|
64
|
+
onError: handleImageError
|
|
65
|
+
}
|
|
66
|
+
) : /* @__PURE__ */ jsx(
|
|
67
|
+
Image,
|
|
68
|
+
{
|
|
69
|
+
src: image,
|
|
70
|
+
alt,
|
|
71
|
+
width: 0,
|
|
72
|
+
height: 0,
|
|
73
|
+
sizes,
|
|
74
|
+
priority,
|
|
75
|
+
crossOrigin: "anonymous",
|
|
76
|
+
className: cn(className ?? "w-full h-auto", "transition-opacity duration-300", loaded ? "opacity-100" : "opacity-0"),
|
|
77
|
+
onLoad: () => setLoaded(true),
|
|
78
|
+
onError: handleImageError
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
] }) : fallback ?? null });
|
|
62
82
|
}
|
|
63
83
|
export {
|
|
64
84
|
AnimatedTokenMedia
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/animated-token-media.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Image from \"next/image\";\nimport { useIntersectionActive } from \"../utils/use-intersection-active.js\";\n\nexport interface AnimatedTokenMediaProps {\n\n image: string | null;\n alt: string;\n\n animationUrl?: string | null;\n\n live?: boolean;\n\n mode?: \"fill\" | \"natural\";\n className?: string;\n sizes?: string;\n priority?: boolean;\n\n imgError?: boolean;\n onImageError?: () => void;\n\n fallback?: React.ReactNode;\n}\n\nexport function AnimatedTokenMedia({\n image,\n alt,\n animationUrl,\n live = false,\n mode = \"fill\",\n className,\n sizes,\n priority,\n imgError: imgErrorProp,\n onImageError,\n fallback,\n}: AnimatedTokenMediaProps) {\n const [internalError, setInternalError] = useState(false);\n const imgError = imgErrorProp ?? internalError;\n const handleImageError = () => {\n setInternalError(true);\n onImageError?.();\n };\n\n const [ref, isVisible] = useIntersectionActive<HTMLDivElement>();\n const showLive = live && !!animationUrl && isVisible;\n\n return (\n <div ref={ref} className={mode === \"fill\" ? \"absolute inset-0\" : \"w-full\"}>\n {showLive ? (\n <iframe\n src={animationUrl!}\n title={alt}\n sandbox=\"allow-scripts\"\n loading=\"lazy\"\n className={\n mode === \"fill\"\n ? \"absolute inset-0 w-full h-full border-0\"\n : \"w-full aspect-square border-0\"\n }\n />\n ) : image && !imgError ? (\n mode === \"fill\" ? (\n <Image\n
|
|
1
|
+
{"version":3,"sources":["../../src/components/animated-token-media.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport Image from \"next/image\";\nimport { useIntersectionActive } from \"../utils/use-intersection-active.js\";\nimport { cn } from \"../utils/cn.js\";\n\nexport interface AnimatedTokenMediaProps {\n\n image: string | null;\n alt: string;\n\n animationUrl?: string | null;\n\n live?: boolean;\n\n mode?: \"fill\" | \"natural\";\n className?: string;\n sizes?: string;\n priority?: boolean;\n\n imgError?: boolean;\n onImageError?: () => void;\n\n fallback?: React.ReactNode;\n}\n\nexport function AnimatedTokenMedia({\n image,\n alt,\n animationUrl,\n live = false,\n mode = \"fill\",\n className,\n sizes,\n priority,\n imgError: imgErrorProp,\n onImageError,\n fallback,\n}: AnimatedTokenMediaProps) {\n const [internalError, setInternalError] = useState(false);\n const imgError = imgErrorProp ?? internalError;\n const handleImageError = () => {\n setInternalError(true);\n onImageError?.();\n };\n\n const [loaded, setLoaded] = useState(false);\n useEffect(() => setLoaded(false), [image]);\n\n const [ref, isVisible] = useIntersectionActive<HTMLDivElement>();\n const showLive = live && !!animationUrl && isVisible;\n\n return (\n <div ref={ref} className={mode === \"fill\" ? \"absolute inset-0\" : \"relative w-full\"}>\n {showLive ? (\n <iframe\n src={animationUrl!}\n title={alt}\n sandbox=\"allow-scripts\"\n loading=\"lazy\"\n className={\n mode === \"fill\"\n ? \"absolute inset-0 w-full h-full border-0\"\n : \"w-full aspect-square border-0\"\n }\n />\n ) : image && !imgError ? (\n <>\n {!loaded && (\n <div\n className={cn(\n \"animate-[shimmer_1.6s_ease-in-out_infinite] bg-foreground/[0.06] absolute\",\n mode === \"fill\" ? \"inset-0\" : \"inset-x-0 top-0 aspect-square\"\n )}\n style={{\n backgroundImage:\n \"linear-gradient(90deg, transparent, color-mix(in srgb, var(--foreground) 8%, transparent), transparent)\",\n backgroundSize: \"200% 100%\",\n }}\n />\n )}\n {mode === \"fill\" ? (\n <Image\n src={image}\n alt={alt}\n fill\n unoptimized\n sizes={sizes}\n priority={priority}\n className={cn(className, \"transition-opacity duration-300\", loaded ? \"opacity-100\" : \"opacity-0\")}\n onLoad={() => setLoaded(true)}\n onError={handleImageError}\n />\n ) : (\n <Image\n src={image}\n alt={alt}\n width={0}\n height={0}\n sizes={sizes}\n priority={priority}\n crossOrigin=\"anonymous\"\n className={cn(className ?? \"w-full h-auto\", \"transition-opacity duration-300\", loaded ? \"opacity-100\" : \"opacity-0\")}\n onLoad={() => setLoaded(true)}\n onError={handleImageError}\n />\n )}\n </>\n ) : (\n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ACA,WAAW,GAAG,WAAW,mCAAmC,SAAS,gBAAgB,WAAW;AAAA,QAChG,QAAQ,MAAM,UAAU,IAAI;AAAA,QAC5B,SAAS;AAAA;AAAA,IACX,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA,OAAO;AAAA,QACP,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,QACA,aAAY;AAAA,QACZ,WAAW,GAAG,aAAa,iBAAiB,mCAAmC,SAAS,gBAAgB,WAAW;AAAA,QACnH,QAAQ,MAAM,UAAU,IAAI;AAAA,QAC5B,SAAS;AAAA;AAAA,IACX;AAAA,KAEJ,IAEA,YAAY,MAEhB;AAEJ;","names":[]}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "outline" | "default" | "destructive" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "outline" | "default" | "destructive" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "link" | "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "link" | "outline" | "default" | "destructive" | "ghost" | "secondary" | "premium" | "tonal" | null | undefined;
|
|
7
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "link" | "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "link" | "outline" | "default" | "destructive" | "ghost" | "secondary" | "premium" | "tonal" | null | undefined;
|
|
7
|
+
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
package/dist/utils/ipfs.cjs
CHANGED
|
@@ -23,6 +23,7 @@ __export(ipfs_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(ipfs_exports);
|
|
24
24
|
const DEFAULT_GATEWAY = "/api/ipfs/";
|
|
25
25
|
const ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "ipfs:"]);
|
|
26
|
+
const KNOWN_IPFS_GATEWAY_HOSTS = /(^|\.)(mypinata\.cloud|pinata\.cloud|ipfs\.io|dweb\.link|cloudflare-ipfs\.com|nftstorage\.link|w3s\.link)$/i;
|
|
26
27
|
function ipfsToHttp(uri, gateway = DEFAULT_GATEWAY) {
|
|
27
28
|
if (!uri) return "";
|
|
28
29
|
if (uri.startsWith("ipfs://")) {
|
|
@@ -32,8 +33,12 @@ function ipfsToHttp(uri, gateway = DEFAULT_GATEWAY) {
|
|
|
32
33
|
return uri;
|
|
33
34
|
}
|
|
34
35
|
try {
|
|
35
|
-
const
|
|
36
|
-
if (!ALLOWED_PROTOCOLS.has(protocol)) return "";
|
|
36
|
+
const parsed = new URL(uri);
|
|
37
|
+
if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) return "";
|
|
38
|
+
if (KNOWN_IPFS_GATEWAY_HOSTS.test(parsed.hostname)) {
|
|
39
|
+
const match = parsed.pathname.match(/\/ipfs\/(.+)$/);
|
|
40
|
+
if (match) return `${gateway}${match[1]}`;
|
|
41
|
+
}
|
|
37
42
|
} catch {
|
|
38
43
|
return "";
|
|
39
44
|
}
|
package/dist/utils/ipfs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const DEFAULT_GATEWAY = \"/api/ipfs/\";\n\nconst ALLOWED_PROTOCOLS = new Set([\"http:\", \"https:\", \"ipfs:\"]);\n\nexport function ipfsToHttp(\n uri: string | null | undefined,\n gateway = DEFAULT_GATEWAY\n): string {\n if (!uri) return \"\";\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\"ipfs://\", gateway);\n }\n if (uri.startsWith(\"data:image/\")) {\n return uri;\n }\n try {\n const
|
|
1
|
+
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const DEFAULT_GATEWAY = \"/api/ipfs/\";\n\nconst ALLOWED_PROTOCOLS = new Set([\"http:\", \"https:\", \"ipfs:\"]);\n\nconst KNOWN_IPFS_GATEWAY_HOSTS = /(^|\\.)(mypinata\\.cloud|pinata\\.cloud|ipfs\\.io|dweb\\.link|cloudflare-ipfs\\.com|nftstorage\\.link|w3s\\.link)$/i;\n\nexport function ipfsToHttp(\n uri: string | null | undefined,\n gateway = DEFAULT_GATEWAY\n): string {\n if (!uri) return \"\";\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\"ipfs://\", gateway);\n }\n if (uri.startsWith(\"data:image/\")) {\n return uri;\n }\n try {\n const parsed = new URL(uri);\n if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) return \"\";\n\n if (KNOWN_IPFS_GATEWAY_HOSTS.test(parsed.hostname)) {\n const match = parsed.pathname.match(/\\/ipfs\\/(.+)$/);\n if (match) return `${gateway}${match[1]}`;\n }\n } catch {\n return \"\";\n }\n return uri;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,kBAAkB;AAExB,MAAM,oBAAoB,oBAAI,IAAI,CAAC,SAAS,UAAU,OAAO,CAAC;AAE9D,MAAM,2BAA2B;AAE1B,SAAS,WACd,KACA,UAAU,iBACF;AACR,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI,QAAQ,WAAW,OAAO;AAAA,EACvC;AACA,MAAI,IAAI,WAAW,aAAa,GAAG;AACjC,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,QAAI,CAAC,kBAAkB,IAAI,OAAO,QAAQ,EAAG,QAAO;AAEpD,QAAI,yBAAyB,KAAK,OAAO,QAAQ,GAAG;AAClD,YAAM,QAAQ,OAAO,SAAS,MAAM,eAAe;AACnD,UAAI,MAAO,QAAO,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAAA,IACzC;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
|
package/dist/utils/ipfs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const DEFAULT_GATEWAY = "/api/ipfs/";
|
|
2
2
|
const ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:", "ipfs:"]);
|
|
3
|
+
const KNOWN_IPFS_GATEWAY_HOSTS = /(^|\.)(mypinata\.cloud|pinata\.cloud|ipfs\.io|dweb\.link|cloudflare-ipfs\.com|nftstorage\.link|w3s\.link)$/i;
|
|
3
4
|
function ipfsToHttp(uri, gateway = DEFAULT_GATEWAY) {
|
|
4
5
|
if (!uri) return "";
|
|
5
6
|
if (uri.startsWith("ipfs://")) {
|
|
@@ -9,8 +10,12 @@ function ipfsToHttp(uri, gateway = DEFAULT_GATEWAY) {
|
|
|
9
10
|
return uri;
|
|
10
11
|
}
|
|
11
12
|
try {
|
|
12
|
-
const
|
|
13
|
-
if (!ALLOWED_PROTOCOLS.has(protocol)) return "";
|
|
13
|
+
const parsed = new URL(uri);
|
|
14
|
+
if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) return "";
|
|
15
|
+
if (KNOWN_IPFS_GATEWAY_HOSTS.test(parsed.hostname)) {
|
|
16
|
+
const match = parsed.pathname.match(/\/ipfs\/(.+)$/);
|
|
17
|
+
if (match) return `${gateway}${match[1]}`;
|
|
18
|
+
}
|
|
14
19
|
} catch {
|
|
15
20
|
return "";
|
|
16
21
|
}
|
package/dist/utils/ipfs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const DEFAULT_GATEWAY = \"/api/ipfs/\";\n\nconst ALLOWED_PROTOCOLS = new Set([\"http:\", \"https:\", \"ipfs:\"]);\n\nexport function ipfsToHttp(\n uri: string | null | undefined,\n gateway = DEFAULT_GATEWAY\n): string {\n if (!uri) return \"\";\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\"ipfs://\", gateway);\n }\n if (uri.startsWith(\"data:image/\")) {\n return uri;\n }\n try {\n const
|
|
1
|
+
{"version":3,"sources":["../../src/utils/ipfs.ts"],"sourcesContent":["const DEFAULT_GATEWAY = \"/api/ipfs/\";\n\nconst ALLOWED_PROTOCOLS = new Set([\"http:\", \"https:\", \"ipfs:\"]);\n\nconst KNOWN_IPFS_GATEWAY_HOSTS = /(^|\\.)(mypinata\\.cloud|pinata\\.cloud|ipfs\\.io|dweb\\.link|cloudflare-ipfs\\.com|nftstorage\\.link|w3s\\.link)$/i;\n\nexport function ipfsToHttp(\n uri: string | null | undefined,\n gateway = DEFAULT_GATEWAY\n): string {\n if (!uri) return \"\";\n if (uri.startsWith(\"ipfs://\")) {\n return uri.replace(\"ipfs://\", gateway);\n }\n if (uri.startsWith(\"data:image/\")) {\n return uri;\n }\n try {\n const parsed = new URL(uri);\n if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) return \"\";\n\n if (KNOWN_IPFS_GATEWAY_HOSTS.test(parsed.hostname)) {\n const match = parsed.pathname.match(/\\/ipfs\\/(.+)$/);\n if (match) return `${gateway}${match[1]}`;\n }\n } catch {\n return \"\";\n }\n return uri;\n}\n"],"mappings":"AAAA,MAAM,kBAAkB;AAExB,MAAM,oBAAoB,oBAAI,IAAI,CAAC,SAAS,UAAU,OAAO,CAAC;AAE9D,MAAM,2BAA2B;AAE1B,SAAS,WACd,KACA,UAAU,iBACF;AACR,MAAI,CAAC,IAAK,QAAO;AACjB,MAAI,IAAI,WAAW,SAAS,GAAG;AAC7B,WAAO,IAAI,QAAQ,WAAW,OAAO;AAAA,EACvC;AACA,MAAI,IAAI,WAAW,aAAa,GAAG;AACjC,WAAO;AAAA,EACT;AACA,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,GAAG;AAC1B,QAAI,CAAC,kBAAkB,IAAI,OAAO,QAAQ,EAAG,QAAO;AAEpD,QAAI,yBAAyB,KAAK,OAAO,QAAQ,GAAG;AAClD,YAAM,QAAQ,OAAO,SAAS,MAAM,eAAe;AACnD,UAAI,MAAO,QAAO,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAAA,IACzC;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACA,SAAO;AACT;","names":[]}
|