@medialane/ui 0.126.2 → 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/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
|
@@ -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":[]}
|