@medialane/ui 0.375.0 → 0.376.0
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/action-button.cjs +6 -6
- package/dist/components/action-button.cjs.map +1 -1
- package/dist/components/action-button.d.cts +6 -4
- package/dist/components/action-button.d.ts +6 -4
- package/dist/components/action-button.js +7 -7
- package/dist/components/action-button.js.map +1 -1
- package/dist/components/archived-asset-notice.cjs +2 -1
- package/dist/components/archived-asset-notice.cjs.map +1 -1
- package/dist/components/archived-asset-notice.js +2 -1
- package/dist/components/archived-asset-notice.js.map +1 -1
- package/dist/components/asset-access-cards.cjs +2 -1
- package/dist/components/asset-access-cards.cjs.map +1 -1
- package/dist/components/asset-access-cards.js +2 -1
- package/dist/components/asset-access-cards.js.map +1 -1
- package/dist/components/asset-collection-bar.cjs +3 -2
- package/dist/components/asset-collection-bar.cjs.map +1 -1
- package/dist/components/asset-collection-bar.js +3 -2
- package/dist/components/asset-collection-bar.js.map +1 -1
- package/dist/components/asset-license-summary.cjs +4 -10
- package/dist/components/asset-license-summary.cjs.map +1 -1
- package/dist/components/asset-license-summary.js +4 -10
- package/dist/components/asset-license-summary.js.map +1 -1
- package/dist/components/asset-marketplace-panel.cjs +6 -16
- package/dist/components/asset-marketplace-panel.cjs.map +1 -1
- package/dist/components/asset-marketplace-panel.js +6 -16
- package/dist/components/asset-marketplace-panel.js.map +1 -1
- package/dist/components/asset-markets-tab.cjs +6 -23
- package/dist/components/asset-markets-tab.cjs.map +1 -1
- package/dist/components/asset-markets-tab.js +6 -23
- package/dist/components/asset-markets-tab.js.map +1 -1
- package/dist/components/asset-overview-content.cjs +27 -36
- package/dist/components/asset-overview-content.cjs.map +1 -1
- package/dist/components/asset-overview-content.js +27 -36
- package/dist/components/asset-overview-content.js.map +1 -1
- package/dist/components/asset-owners-panel.cjs +2 -1
- package/dist/components/asset-owners-panel.cjs.map +1 -1
- package/dist/components/asset-owners-panel.js +2 -1
- package/dist/components/asset-owners-panel.js.map +1 -1
- package/dist/components/asset-provenance-tab.cjs +15 -12
- package/dist/components/asset-provenance-tab.cjs.map +1 -1
- package/dist/components/asset-provenance-tab.js +15 -12
- package/dist/components/asset-provenance-tab.js.map +1 -1
- package/dist/components/asset-publication.cjs +2 -1
- package/dist/components/asset-publication.cjs.map +1 -1
- package/dist/components/asset-publication.js +2 -1
- package/dist/components/asset-publication.js.map +1 -1
- package/dist/components/asset-type-panels.cjs +4 -5
- package/dist/components/asset-type-panels.cjs.map +1 -1
- package/dist/components/asset-type-panels.js +4 -5
- package/dist/components/asset-type-panels.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 +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/hidden-content-banner.cjs +4 -3
- package/dist/components/hidden-content-banner.cjs.map +1 -1
- package/dist/components/hidden-content-banner.js +4 -3
- package/dist/components/hidden-content-banner.js.map +1 -1
- package/dist/components/ip-type-display.cjs +5 -2
- package/dist/components/ip-type-display.cjs.map +1 -1
- package/dist/components/ip-type-display.js +5 -2
- package/dist/components/ip-type-display.js.map +1 -1
- package/dist/components/panel.cjs +81 -0
- package/dist/components/panel.cjs.map +1 -0
- package/dist/components/panel.d.cts +22 -0
- package/dist/components/panel.d.ts +22 -0
- package/dist/components/panel.js +44 -0
- package/dist/components/panel.js.map +1 -0
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/components/soulbound-card.cjs +2 -1
- package/dist/components/soulbound-card.cjs.map +1 -1
- package/dist/components/soulbound-card.js +2 -1
- package/dist/components/soulbound-card.js.map +1 -1
- package/dist/data/brand.cjs +37 -25
- package/dist/data/brand.cjs.map +1 -1
- package/dist/data/brand.d.cts +31 -14
- package/dist/data/brand.d.ts +31 -14
- package/dist/data/brand.js +33 -24
- package/dist/data/brand.js.map +1 -1
- package/dist/data/ip-types.cjs +11 -9
- package/dist/data/ip-types.cjs.map +1 -1
- package/dist/data/ip-types.js +11 -9
- package/dist/data/ip-types.js.map +1 -1
- package/dist/index.cjs +9 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-xl border border-border bg-muted/20 px-4 py-3 transition-colors hover:border-primary/40 group\"\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground\"\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8IU;AA3IV,0BAKO;AACP,kBAA2B;AAC3B,0BAAoD;AACpD,sBAAqB;AAWrB,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,KAAoB;AACxB,QAAI,EAAE,SAAS,SAAS,UAAU,GAAG;AACnC,WAAK,EAAE,SAAS,MAAM,CAAC;AAAA,IACzB,WAAW,EAAE,SAAS,SAAS,aAAa,GAAG;AAC7C,WAAK,EAAE,aAAa,IAAI,GAAG;AAAA,IAC7B;AACA,QAAI,CAAC,GAAI,QAAO;AAChB,WAAO,iCAAiC,EAAE;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,CAAC,EAAE,SAAS,SAAS,aAAa,EAAG,QAAO;AAEhD,UAAM,QAAQ,EAAE,SAAS;AAAA,MACvB;AAAA,IACF;AACA,QAAI,CAAC,MAAO,QAAO;AAC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AAA;AAAA,QAChB;AAAA,WAZQ,QAaV;AAAA,IAEJ,CAAC;AAAA,IAEA,QAAQ,SAAS,KAChB,6CAAC,SAAI,WAAU,eACb;AAAA,kDAAC,OAAE,WAAU,6CACV,YAAE,OAAO,GACZ;AAAA,MACA,4CAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAU;AAAA,YAEV;AAAA,0DAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\nimport { PANEL_INSET, panelBackground } from \"./panel.js\";\nimport { cn } from \"../utils/cn.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group\"\n style={{ backgroundImage: panelBackground() }}\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\", PANEL_INSET)}\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgJU;AA7IV,0BAKO;AACP,kBAA2B;AAC3B,0BAAoD;AACpD,sBAAqB;AACrB,mBAA6C;AAC7C,gBAAmB;AAWnB,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,KAAoB;AACxB,QAAI,EAAE,SAAS,SAAS,UAAU,GAAG;AACnC,WAAK,EAAE,SAAS,MAAM,CAAC;AAAA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SAAI,WAAU,uEACb;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,WAAU;AAAA,cACV,OAAM;AAAA,cACN,iBAAe;AAAA,cACf,SAAQ;AAAA,cACR,OAAO,EAAE,KAAK,KAAK;AAAA;AAAA,UACrB,GACF;AAAA,aAvBM,QAyBV;AAAA,MAEJ;AAEA,aACE,6CAAC,SACC;AAAA,oDAAC,OAAE,WAAU,kDACV,YAAE,KAAK,KAAK,GACf;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAU;AAAA,YAEV;AAAA,0DAAC,oCAAa,WAAU,eAAc;AAAA,cACrC,EAAE,WAAW;AAAA;AAAA;AAAA,QAChB;AAAA,WAZQ,QAaV;AAAA,IAEJ,CAAC;AAAA,IAEA,QAAQ,SAAS,KAChB,6CAAC,SAAI,WAAU,eACb;AAAA,kDAAC,OAAE,WAAU,6CACV,YAAE,OAAO,GACZ;AAAA,MACA,4CAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,eAAW,cAAG,6HAA6H,wBAAW;AAAA,YAEtJ;AAAA,0DAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
import { ipfsToHttp } from "../utils/ipfs.js";
|
|
9
9
|
import { ExternalLink, FileText, ShieldCheck } from "lucide-react";
|
|
10
10
|
import { useT } from "../i18n/provider.js";
|
|
11
|
+
import { PANEL_INSET, panelBackground } from "./panel.js";
|
|
12
|
+
import { cn } from "../utils/cn.js";
|
|
11
13
|
function parseYouTubeEmbed(url) {
|
|
12
14
|
try {
|
|
13
15
|
const u = new URL(url);
|
|
@@ -120,7 +122,8 @@ function IPTypeDisplay({ attributes }) {
|
|
|
120
122
|
href: docUri.startsWith("ipfs://") ? ipfsToHttp(docUri) : docUri,
|
|
121
123
|
target: "_blank",
|
|
122
124
|
rel: "noopener noreferrer",
|
|
123
|
-
className: "flex items-center gap-3 rounded-
|
|
125
|
+
className: "flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group",
|
|
126
|
+
style: { backgroundImage: panelBackground() },
|
|
124
127
|
children: [
|
|
125
128
|
/* @__PURE__ */ jsx(FileText, { className: "h-5 w-5 text-primary shrink-0" }),
|
|
126
129
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
@@ -190,7 +193,7 @@ function IPTypeDisplay({ attributes }) {
|
|
|
190
193
|
href: value,
|
|
191
194
|
target: "_blank",
|
|
192
195
|
rel: "noopener noreferrer",
|
|
193
|
-
className: "inline-flex items-center gap-1.5 rounded-full
|
|
196
|
+
className: cn("inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground", PANEL_INSET),
|
|
194
197
|
children: [
|
|
195
198
|
/* @__PURE__ */ jsx(SIcon, { className: "h-3.5 w-3.5" }),
|
|
196
199
|
t(meta.label)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-xl border border-border bg-muted/20 px-4 py-3 transition-colors hover:border-primary/40 group\"\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground\"\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AA8IU,cAcI,YAdJ;AA3IV;AA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J;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\nimport { PANEL_INSET, panelBackground } from \"./panel.js\";\nimport { cn } from \"../utils/cn.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group\"\n style={{ backgroundImage: panelBackground() }}\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\", PANEL_INSET)}\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAgJU,cAeI,YAfJ;AA7IV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,cAAc,UAAU,mBAAmB;AACpD,SAAS,YAAY;AACrB,SAAS,aAAa,uBAAuB;AAC7C,SAAS,UAAU;AAWnB,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,KAAoB;AACxB,QAAI,EAAE,SAAS,SAAS,UAAU,GAAG;AACnC,WAAK,EAAE,SAAS,MAAM,CAAC;AAAA,IACzB,WAAW,EAAE,SAAS,SAAS,aAAa,GAAG;AAC7C,WAAK,EAAE,aAAa,IAAI,GAAG;AAAA,IAC7B;AACA,QAAI,CAAC,GAAI,QAAO;AAChB,WAAO,iCAAiC,EAAE;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,CAAC,EAAE,SAAS,SAAS,aAAa,EAAG,QAAO;AAEhD,UAAM,QAAQ,EAAE,SAAS;AAAA,MACvB;AAAA,IACF;AACA,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,kCAAkC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,EAC/D,QAAQ;AACN,WA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,CAAC;AAAA,IAEA,QAAQ,SAAS,KAChB,qBAAC,SAAI,WAAU,eACb;AAAA,0BAAC,OAAE,WAAU,6CACV,YAAE,OAAO,GACZ;AAAA,MACA,oBAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAW,GAAG,6HAA6H,WAAW;AAAA,YAEtJ;AAAA,kCAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var panel_exports = {};
|
|
30
|
+
__export(panel_exports, {
|
|
31
|
+
PANEL_INSET: () => PANEL_INSET,
|
|
32
|
+
Panel: () => Panel,
|
|
33
|
+
Pill: () => Pill,
|
|
34
|
+
panelBackground: () => panelBackground
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(panel_exports);
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var React = __toESM(require("react"), 1);
|
|
39
|
+
var import_cn = require("../utils/cn.js");
|
|
40
|
+
var import_brand = require("../data/brand.js");
|
|
41
|
+
const stop = (color, alpha) => `hsl(var(--brand-${color}) / ${alpha})`;
|
|
42
|
+
function panelBackground(tone = "neutral") {
|
|
43
|
+
if (tone === "neutral") return "linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)";
|
|
44
|
+
if (typeof tone === "string") return `linear-gradient(to bottom right, ${stop(tone, 0.2)}, transparent)`;
|
|
45
|
+
const [from, to] = tone;
|
|
46
|
+
return `linear-gradient(to bottom right, ${stop(from, 0.2)}, ${stop(to, 0.1)}, transparent)`;
|
|
47
|
+
}
|
|
48
|
+
const Panel = React.forwardRef(
|
|
49
|
+
({ tone = "neutral", className, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
className: (0, import_cn.cn)("rounded-2xl", className),
|
|
54
|
+
style: { backgroundImage: panelBackground(tone), ...style },
|
|
55
|
+
...props
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
Panel.displayName = "Panel";
|
|
60
|
+
const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
61
|
+
function Pill({ color, className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
"span",
|
|
64
|
+
{
|
|
65
|
+
className: (0, import_cn.cn)(
|
|
66
|
+
"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium",
|
|
67
|
+
color ? import_brand.BRAND[color].text : "text-muted-foreground",
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
PANEL_INSET,
|
|
77
|
+
Panel,
|
|
78
|
+
Pill,
|
|
79
|
+
panelBackground
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=panel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/panel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../utils/cn.js\";\nimport { BRAND } from \"../data/brand.js\";\n\nexport type PanelColor = keyof typeof BRAND;\n\n/** \"neutral\", one brand colour, or a pair blended from the first into the second. */\nexport type PanelTone = \"neutral\" | PanelColor | readonly [PanelColor, PanelColor];\n\nconst stop = (color: PanelColor, alpha: number) => `hsl(var(--brand-${color}) / ${alpha})`;\n\n/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */\nexport function panelBackground(tone: PanelTone = \"neutral\"): string {\n if (tone === \"neutral\") return \"linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)\";\n if (typeof tone === \"string\") return `linear-gradient(to bottom right, ${stop(tone, 0.2)}, transparent)`;\n const [from, to] = tone;\n return `linear-gradient(to bottom right, ${stop(from, 0.2)}, ${stop(to, 0.1)}, transparent)`;\n}\n\nexport interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {\n tone?: PanelTone;\n}\n\nexport const Panel = React.forwardRef<HTMLDivElement, PanelProps>(\n ({ tone = \"neutral\", className, style, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"rounded-2xl\", className)}\n style={{ backgroundImage: panelBackground(tone), ...style }}\n {...props}\n />\n ),\n);\nPanel.displayName = \"Panel\";\n\n/** Surface for controls and chips that sit on a panel. */\nexport const PANEL_INSET = \"bg-background/40 hover:bg-background/70 transition-colors\";\n\nexport interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Brand colour for the text and icon; muted text when omitted. */\n color?: PanelColor;\n}\n\nexport function Pill({ color, className, ...props }: PillProps) {\n return (\n <span\n className={cn(\n \"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium\",\n color ? BRAND[color].text : \"text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAzBJ,YAAuB;AACvB,gBAAmB;AACnB,mBAAsB;AAOtB,MAAM,OAAO,CAAC,OAAmB,UAAkB,mBAAmB,KAAK,OAAO,KAAK;AAGhF,SAAS,gBAAgB,OAAkB,WAAmB;AACnE,MAAI,SAAS,UAAW,QAAO;AAC/B,MAAI,OAAO,SAAS,SAAU,QAAO,oCAAoC,KAAK,MAAM,GAAG,CAAC;AACxF,QAAM,CAAC,MAAM,EAAE,IAAI;AACnB,SAAO,oCAAoC,KAAK,MAAM,GAAG,CAAC,KAAK,KAAK,IAAI,GAAG,CAAC;AAC9E;AAMO,MAAM,QAAQ,MAAM;AAAA,EACzB,CAAC,EAAE,OAAO,WAAW,WAAW,OAAO,GAAG,MAAM,GAAG,QACjD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,cAAG,eAAe,SAAS;AAAA,MACtC,OAAO,EAAE,iBAAiB,gBAAgB,IAAI,GAAG,GAAG,MAAM;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,MAAM,cAAc;AAGb,MAAM,cAAc;AAOpB,SAAS,KAAK,EAAE,OAAO,WAAW,GAAG,MAAM,GAAc;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA,QAAQ,mBAAM,KAAK,EAAE,OAAO;AAAA,QAC5B;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { BRAND } from '../data/brand.cjs';
|
|
4
|
+
|
|
5
|
+
type PanelColor = keyof typeof BRAND;
|
|
6
|
+
/** "neutral", one brand colour, or a pair blended from the first into the second. */
|
|
7
|
+
type PanelTone = "neutral" | PanelColor | readonly [PanelColor, PanelColor];
|
|
8
|
+
/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */
|
|
9
|
+
declare function panelBackground(tone?: PanelTone): string;
|
|
10
|
+
interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
tone?: PanelTone;
|
|
12
|
+
}
|
|
13
|
+
declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
/** Surface for controls and chips that sit on a panel. */
|
|
15
|
+
declare const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
16
|
+
interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
17
|
+
/** Brand colour for the text and icon; muted text when omitted. */
|
|
18
|
+
color?: PanelColor;
|
|
19
|
+
}
|
|
20
|
+
declare function Pill({ color, className, ...props }: PillProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { PANEL_INSET, Panel, type PanelColor, type PanelProps, type PanelTone, Pill, type PillProps, panelBackground };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { BRAND } from '../data/brand.js';
|
|
4
|
+
|
|
5
|
+
type PanelColor = keyof typeof BRAND;
|
|
6
|
+
/** "neutral", one brand colour, or a pair blended from the first into the second. */
|
|
7
|
+
type PanelTone = "neutral" | PanelColor | readonly [PanelColor, PanelColor];
|
|
8
|
+
/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */
|
|
9
|
+
declare function panelBackground(tone?: PanelTone): string;
|
|
10
|
+
interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
tone?: PanelTone;
|
|
12
|
+
}
|
|
13
|
+
declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
/** Surface for controls and chips that sit on a panel. */
|
|
15
|
+
declare const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
16
|
+
interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
17
|
+
/** Brand colour for the text and icon; muted text when omitted. */
|
|
18
|
+
color?: PanelColor;
|
|
19
|
+
}
|
|
20
|
+
declare function Pill({ color, className, ...props }: PillProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { PANEL_INSET, Panel, type PanelColor, type PanelProps, type PanelTone, Pill, type PillProps, panelBackground };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { BRAND } from "../data/brand.js";
|
|
5
|
+
const stop = (color, alpha) => `hsl(var(--brand-${color}) / ${alpha})`;
|
|
6
|
+
function panelBackground(tone = "neutral") {
|
|
7
|
+
if (tone === "neutral") return "linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)";
|
|
8
|
+
if (typeof tone === "string") return `linear-gradient(to bottom right, ${stop(tone, 0.2)}, transparent)`;
|
|
9
|
+
const [from, to] = tone;
|
|
10
|
+
return `linear-gradient(to bottom right, ${stop(from, 0.2)}, ${stop(to, 0.1)}, transparent)`;
|
|
11
|
+
}
|
|
12
|
+
const Panel = React.forwardRef(
|
|
13
|
+
({ tone = "neutral", className, style, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
ref,
|
|
17
|
+
className: cn("rounded-2xl", className),
|
|
18
|
+
style: { backgroundImage: panelBackground(tone), ...style },
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
Panel.displayName = "Panel";
|
|
24
|
+
const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
25
|
+
function Pill({ color, className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
className: cn(
|
|
30
|
+
"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium",
|
|
31
|
+
color ? BRAND[color].text : "text-muted-foreground",
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
PANEL_INSET,
|
|
40
|
+
Panel,
|
|
41
|
+
Pill,
|
|
42
|
+
panelBackground
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/panel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../utils/cn.js\";\nimport { BRAND } from \"../data/brand.js\";\n\nexport type PanelColor = keyof typeof BRAND;\n\n/** \"neutral\", one brand colour, or a pair blended from the first into the second. */\nexport type PanelTone = \"neutral\" | PanelColor | readonly [PanelColor, PanelColor];\n\nconst stop = (color: PanelColor, alpha: number) => `hsl(var(--brand-${color}) / ${alpha})`;\n\n/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */\nexport function panelBackground(tone: PanelTone = \"neutral\"): string {\n if (tone === \"neutral\") return \"linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)\";\n if (typeof tone === \"string\") return `linear-gradient(to bottom right, ${stop(tone, 0.2)}, transparent)`;\n const [from, to] = tone;\n return `linear-gradient(to bottom right, ${stop(from, 0.2)}, ${stop(to, 0.1)}, transparent)`;\n}\n\nexport interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {\n tone?: PanelTone;\n}\n\nexport const Panel = React.forwardRef<HTMLDivElement, PanelProps>(\n ({ tone = \"neutral\", className, style, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"rounded-2xl\", className)}\n style={{ backgroundImage: panelBackground(tone), ...style }}\n {...props}\n />\n ),\n);\nPanel.displayName = \"Panel\";\n\n/** Surface for controls and chips that sit on a panel. */\nexport const PANEL_INSET = \"bg-background/40 hover:bg-background/70 transition-colors\";\n\nexport interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Brand colour for the text and icon; muted text when omitted. */\n color?: PanelColor;\n}\n\nexport function Pill({ color, className, ...props }: PillProps) {\n return (\n <span\n className={cn(\n \"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium\",\n color ? BRAND[color].text : \"text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":"AAyBI;AAzBJ,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,aAAa;AAOtB,MAAM,OAAO,CAAC,OAAmB,UAAkB,mBAAmB,KAAK,OAAO,KAAK;AAGhF,SAAS,gBAAgB,OAAkB,WAAmB;AACnE,MAAI,SAAS,UAAW,QAAO;AAC/B,MAAI,OAAO,SAAS,SAAU,QAAO,oCAAoC,KAAK,MAAM,GAAG,CAAC;AACxF,QAAM,CAAC,MAAM,EAAE,IAAI;AACnB,SAAO,oCAAoC,KAAK,MAAM,GAAG,CAAC,KAAK,KAAK,IAAI,GAAG,CAAC;AAC9E;AAMO,MAAM,QAAQ,MAAM;AAAA,EACzB,CAAC,EAAE,OAAO,WAAW,WAAW,OAAO,GAAG,MAAM,GAAG,QACjD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,eAAe,SAAS;AAAA,MACtC,OAAO,EAAE,iBAAiB,gBAAgB,IAAI,GAAG,GAAG,MAAM;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,MAAM,cAAc;AAGb,MAAM,cAAc;AAOpB,SAAS,KAAK,EAAE,OAAO,WAAW,GAAG,MAAM,GAAc;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,QAAQ,MAAM,KAAK,EAAE,OAAO;AAAA,QAC5B;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -38,6 +38,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
38
38
|
var import_lucide_react = require("lucide-react");
|
|
39
39
|
var import_sdk = require("@medialane/sdk");
|
|
40
40
|
var import_link = __toESM(require("./link.js"), 1);
|
|
41
|
+
var import_panel = require("./panel.js");
|
|
41
42
|
var import_address = require("../utils/address.js");
|
|
42
43
|
var import_provider = require("../i18n/provider.js");
|
|
43
44
|
var import_format = require("../i18n/format.js");
|
|
@@ -57,7 +58,7 @@ function SoulboundCard({ history = [], ownerAddress }) {
|
|
|
57
58
|
const t = (0, import_provider.useT)();
|
|
58
59
|
const locale = (0, import_provider.useLocale)();
|
|
59
60
|
const issued = issuedAt(history, locale);
|
|
60
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { "aria-label": t("Soulbound asset"), className: "flex items-center gap-4 overflow-hidden rounded-2xl
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { "aria-label": t("Soulbound asset"), className: "flex items-center gap-4 overflow-hidden rounded-2xl p-4", style: { backgroundImage: (0, import_panel.panelBackground)() }, children: [
|
|
61
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Fingerprint, { className: "h-7 w-7 shrink-0 text-brand-purple", strokeWidth: 1.5, "aria-hidden": true }),
|
|
62
63
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
63
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "font-display text-base font-bold leading-tight text-foreground", children: t("Soulbound") }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/soulbound-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fingerprint } from \"lucide-react\";\nimport { profileHref, type ApiActivity } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { useLocale, useT } from \"../i18n/provider.js\";\nimport { formatDate } from \"../i18n/format.js\";\n\nexport function issuedAt(history: readonly ApiActivity[], locale?: string): string | null {\n const times = history\n .filter((event) => event.type === \"mint\")\n .map((event) => new Date(event.timestamp).getTime())\n .filter((time) => Number.isFinite(time));\n if (times.length === 0) return null;\n return formatDate(Math.min(...times), locale, { day: \"numeric\", month: \"short\", year: \"numeric\" });\n}\n\nexport function SoulboundBadge() {\n const t = useT();\n return (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-brand-purple\">\n <Fingerprint className=\"h-3.5 w-3.5\" aria-hidden />\n {t(\"Soulbound\")}\n </span>\n );\n}\n\nexport interface SoulboundCardProps {\n history?: readonly ApiActivity[];\n ownerAddress?: string | null;\n}\n\nexport function SoulboundCard({ history = [], ownerAddress }: SoulboundCardProps) {\n const t = useT();\n const locale = useLocale();\n const issued = issuedAt(history, locale);\n return (\n <section aria-label={t(\"Soulbound asset\")} className=\"flex items-center gap-4 overflow-hidden rounded-2xl
|
|
1
|
+
{"version":3,"sources":["../../src/components/soulbound-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fingerprint } from \"lucide-react\";\nimport { profileHref, type ApiActivity } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport { panelBackground } from \"./panel.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { useLocale, useT } from \"../i18n/provider.js\";\nimport { formatDate } from \"../i18n/format.js\";\n\nexport function issuedAt(history: readonly ApiActivity[], locale?: string): string | null {\n const times = history\n .filter((event) => event.type === \"mint\")\n .map((event) => new Date(event.timestamp).getTime())\n .filter((time) => Number.isFinite(time));\n if (times.length === 0) return null;\n return formatDate(Math.min(...times), locale, { day: \"numeric\", month: \"short\", year: \"numeric\" });\n}\n\nexport function SoulboundBadge() {\n const t = useT();\n return (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-brand-purple\">\n <Fingerprint className=\"h-3.5 w-3.5\" aria-hidden />\n {t(\"Soulbound\")}\n </span>\n );\n}\n\nexport interface SoulboundCardProps {\n history?: readonly ApiActivity[];\n ownerAddress?: string | null;\n}\n\nexport function SoulboundCard({ history = [], ownerAddress }: SoulboundCardProps) {\n const t = useT();\n const locale = useLocale();\n const issued = issuedAt(history, locale);\n return (\n <section aria-label={t(\"Soulbound asset\")} className=\"flex items-center gap-4 overflow-hidden rounded-2xl p-4\" style={{ backgroundImage: panelBackground() }}>\n <Fingerprint className=\"h-7 w-7 shrink-0 text-brand-purple\" strokeWidth={1.5} aria-hidden />\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"font-display text-base font-bold leading-tight text-foreground\">{t(\"Soulbound\")}</h3>\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {ownerAddress ? (\n <>\n {t(\"Permanently bound to\")}{\" \"}\n <Link href={profileHref({ address: ownerAddress })} title={ownerAddress} className=\"font-mono font-medium text-foreground transition-colors hover:text-primary\">\n {shortenAddress(ownerAddress)}\n </Link>\n </>\n ) : (\n t(\"Permanently bound to the wallet it was issued to.\")\n )}\n </p>\n </div>\n {issued ? (\n <div className=\"shrink-0 text-right\">\n <p className=\"text-xs text-muted-foreground\">{t(\"Issued\")}</p>\n <p className=\"mt-0.5 text-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EACG;AAAA,UAAE,sBAAsB;AAAA,QAAG;AAAA,QAC5B,4CAAC,YAAAA,SAAA,EAAK,UAAM,wBAAY,EAAE,SAAS,aAAa,CAAC,GAAG,OAAO,cAAc,WAAU,8EAChF,6CAAe,YAAY,GAC9B;AAAA,SACF,IAEA,EAAE,mDAAmD,GAEzD;AAAA,OACF;AAAA,IACC,SACC,6CAAC,SAAI,WAAU,uBACb;AAAA,kDAAC,OAAE,WAAU,iCAAiC,YAAE,QAAQ,GAAE;AAAA,MAC1D,4CAAC,OAAE,WAAU,6DAA6D,kBAAO;AAAA,OACnF,IACE;AAAA,KACN;AAEJ;","names":["Link"]}
|
|
@@ -3,6 +3,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { Fingerprint } from "lucide-react";
|
|
4
4
|
import { profileHref } from "@medialane/sdk";
|
|
5
5
|
import Link from "./link.js";
|
|
6
|
+
import { panelBackground } from "./panel.js";
|
|
6
7
|
import { shortenAddress } from "../utils/address.js";
|
|
7
8
|
import { useLocale, useT } from "../i18n/provider.js";
|
|
8
9
|
import { formatDate } from "../i18n/format.js";
|
|
@@ -22,7 +23,7 @@ function SoulboundCard({ history = [], ownerAddress }) {
|
|
|
22
23
|
const t = useT();
|
|
23
24
|
const locale = useLocale();
|
|
24
25
|
const issued = issuedAt(history, locale);
|
|
25
|
-
return /* @__PURE__ */ jsxs("section", { "aria-label": t("Soulbound asset"), className: "flex items-center gap-4 overflow-hidden rounded-2xl
|
|
26
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": t("Soulbound asset"), className: "flex items-center gap-4 overflow-hidden rounded-2xl p-4", style: { backgroundImage: panelBackground() }, children: [
|
|
26
27
|
/* @__PURE__ */ jsx(Fingerprint, { className: "h-7 w-7 shrink-0 text-brand-purple", strokeWidth: 1.5, "aria-hidden": true }),
|
|
27
28
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
28
29
|
/* @__PURE__ */ jsx("h3", { className: "font-display text-base font-bold leading-tight text-foreground", children: t("Soulbound") }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/soulbound-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fingerprint } from \"lucide-react\";\nimport { profileHref, type ApiActivity } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { useLocale, useT } from \"../i18n/provider.js\";\nimport { formatDate } from \"../i18n/format.js\";\n\nexport function issuedAt(history: readonly ApiActivity[], locale?: string): string | null {\n const times = history\n .filter((event) => event.type === \"mint\")\n .map((event) => new Date(event.timestamp).getTime())\n .filter((time) => Number.isFinite(time));\n if (times.length === 0) return null;\n return formatDate(Math.min(...times), locale, { day: \"numeric\", month: \"short\", year: \"numeric\" });\n}\n\nexport function SoulboundBadge() {\n const t = useT();\n return (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-brand-purple\">\n <Fingerprint className=\"h-3.5 w-3.5\" aria-hidden />\n {t(\"Soulbound\")}\n </span>\n );\n}\n\nexport interface SoulboundCardProps {\n history?: readonly ApiActivity[];\n ownerAddress?: string | null;\n}\n\nexport function SoulboundCard({ history = [], ownerAddress }: SoulboundCardProps) {\n const t = useT();\n const locale = useLocale();\n const issued = issuedAt(history, locale);\n return (\n <section aria-label={t(\"Soulbound asset\")} className=\"flex items-center gap-4 overflow-hidden rounded-2xl
|
|
1
|
+
{"version":3,"sources":["../../src/components/soulbound-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { Fingerprint } from \"lucide-react\";\nimport { profileHref, type ApiActivity } from \"@medialane/sdk\";\nimport Link from \"./link.js\";\nimport { panelBackground } from \"./panel.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { useLocale, useT } from \"../i18n/provider.js\";\nimport { formatDate } from \"../i18n/format.js\";\n\nexport function issuedAt(history: readonly ApiActivity[], locale?: string): string | null {\n const times = history\n .filter((event) => event.type === \"mint\")\n .map((event) => new Date(event.timestamp).getTime())\n .filter((time) => Number.isFinite(time));\n if (times.length === 0) return null;\n return formatDate(Math.min(...times), locale, { day: \"numeric\", month: \"short\", year: \"numeric\" });\n}\n\nexport function SoulboundBadge() {\n const t = useT();\n return (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-brand-purple\">\n <Fingerprint className=\"h-3.5 w-3.5\" aria-hidden />\n {t(\"Soulbound\")}\n </span>\n );\n}\n\nexport interface SoulboundCardProps {\n history?: readonly ApiActivity[];\n ownerAddress?: string | null;\n}\n\nexport function SoulboundCard({ history = [], ownerAddress }: SoulboundCardProps) {\n const t = useT();\n const locale = useLocale();\n const issued = issuedAt(history, locale);\n return (\n <section aria-label={t(\"Soulbound asset\")} className=\"flex items-center gap-4 overflow-hidden rounded-2xl p-4\" style={{ backgroundImage: panelBackground() }}>\n <Fingerprint className=\"h-7 w-7 shrink-0 text-brand-purple\" strokeWidth={1.5} aria-hidden />\n <div className=\"min-w-0 flex-1\">\n <h3 className=\"font-display text-base font-bold leading-tight text-foreground\">{t(\"Soulbound\")}</h3>\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {ownerAddress ? (\n <>\n {t(\"Permanently bound to\")}{\" \"}\n <Link href={profileHref({ address: ownerAddress })} title={ownerAddress} className=\"font-mono font-medium text-foreground transition-colors hover:text-primary\">\n {shortenAddress(ownerAddress)}\n </Link>\n </>\n ) : (\n t(\"Permanently bound to the wallet it was issued to.\")\n )}\n </p>\n </div>\n {issued ? (\n <div className=\"shrink-0 text-right\">\n <p className=\"text-xs text-muted-foreground\">{t(\"Issued\")}</p>\n <p className=\"mt-0.5 text-sm font-semibold tabular-nums text-foreground\">{issued}</p>\n </div>\n ) : null}\n </section>\n );\n}\n"],"mappings":";AAsBI,SAuBQ,UAtBN,KADF;AApBJ,SAAS,mBAAmB;AAC5B,SAAS,mBAAqC;AAC9C,OAAO,UAAU;AACjB,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B,SAAS,WAAW,YAAY;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0BAAC,OAAE,WAAU,iCAAiC,YAAE,QAAQ,GAAE;AAAA,MAC1D,oBAAC,OAAE,WAAU,6DAA6D,kBAAO;AAAA,OACnF,IACE;AAAA,KACN;AAEJ;","names":[]}
|
package/dist/data/brand.cjs
CHANGED
|
@@ -20,11 +20,14 @@ var brand_exports = {};
|
|
|
20
20
|
__export(brand_exports, {
|
|
21
21
|
ACTION_FOREGROUNDS: () => ACTION_FOREGROUNDS,
|
|
22
22
|
ACTION_GRADIENTS: () => ACTION_GRADIENTS,
|
|
23
|
+
ACTION_PAIRS: () => ACTION_PAIRS,
|
|
23
24
|
BRAND: () => BRAND,
|
|
24
25
|
BRAND_COLOR: () => BRAND_COLOR,
|
|
25
26
|
BRAND_GRADIENT: () => BRAND_GRADIENT,
|
|
26
27
|
TONE_FOREGROUNDS: () => TONE_FOREGROUNDS,
|
|
27
|
-
TONE_GRADIENTS: () => TONE_GRADIENTS
|
|
28
|
+
TONE_GRADIENTS: () => TONE_GRADIENTS,
|
|
29
|
+
TONE_PAIRS: () => TONE_PAIRS,
|
|
30
|
+
brandTint: () => brandTint
|
|
28
31
|
});
|
|
29
32
|
module.exports = __toCommonJS(brand_exports);
|
|
30
33
|
const BRAND = {
|
|
@@ -68,24 +71,37 @@ const BRAND = {
|
|
|
68
71
|
to: "to-brand-navy/10"
|
|
69
72
|
}
|
|
70
73
|
};
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
red: token("destructive")
|
|
74
|
+
const TOKEN = {
|
|
75
|
+
blue: "brand-blue",
|
|
76
|
+
purple: "brand-purple",
|
|
77
|
+
rose: "brand-rose",
|
|
78
|
+
orange: "brand-orange",
|
|
79
|
+
maeve: "brand-maeve",
|
|
80
|
+
navy: "brand-navy",
|
|
81
|
+
red: "destructive"
|
|
80
82
|
};
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
const BRAND_COLOR = Object.fromEntries(
|
|
84
|
+
Object.entries(TOKEN).map(([name, token]) => [name, `hsl(var(--${token}))`])
|
|
85
|
+
);
|
|
86
|
+
const brandTint = (color, alpha) => `hsl(var(--${TOKEN[color]}) / ${alpha})`;
|
|
87
|
+
const ACTION_PAIRS = {
|
|
88
|
+
buy: ["blue", "purple"],
|
|
89
|
+
submit: ["maeve", "purple"],
|
|
90
|
+
offer: ["rose", "orange"],
|
|
91
|
+
remix: ["purple", "rose"],
|
|
92
|
+
license: ["blue", "purple"]
|
|
88
93
|
};
|
|
94
|
+
const TONE_PAIRS = {
|
|
95
|
+
blue: ["blue", "purple"],
|
|
96
|
+
purple: ["purple", "rose"],
|
|
97
|
+
orange: ["orange", "rose"],
|
|
98
|
+
red: ["red", "rose"],
|
|
99
|
+
rose: ["rose", "orange"]
|
|
100
|
+
};
|
|
101
|
+
const loop = ([a, b]) => [BRAND_COLOR[a], BRAND_COLOR[b], BRAND_COLOR[a]];
|
|
102
|
+
const mapPairs = (pairs, fn) => Object.fromEntries(Object.entries(pairs).map(([key, pair]) => [key, fn(pair)]));
|
|
103
|
+
const ACTION_GRADIENTS = mapPairs(ACTION_PAIRS, loop);
|
|
104
|
+
const TONE_GRADIENTS = mapPairs(TONE_PAIRS, loop);
|
|
89
105
|
const ACTION_FOREGROUNDS = {
|
|
90
106
|
buy: BRAND_COLOR.blue,
|
|
91
107
|
submit: BRAND_COLOR.purple,
|
|
@@ -93,13 +109,6 @@ const ACTION_FOREGROUNDS = {
|
|
|
93
109
|
remix: BRAND_COLOR.purple,
|
|
94
110
|
license: BRAND_COLOR.blue
|
|
95
111
|
};
|
|
96
|
-
const TONE_GRADIENTS = {
|
|
97
|
-
blue: loop("blue", "purple"),
|
|
98
|
-
purple: loop("purple", "rose"),
|
|
99
|
-
orange: loop("orange", "rose"),
|
|
100
|
-
red: loop("red", "rose"),
|
|
101
|
-
rose: loop("rose", "orange")
|
|
102
|
-
};
|
|
103
112
|
const TONE_FOREGROUNDS = {
|
|
104
113
|
blue: BRAND_COLOR.blue,
|
|
105
114
|
purple: BRAND_COLOR.purple,
|
|
@@ -112,10 +121,13 @@ const BRAND_GRADIENT = `linear-gradient(115deg, ${[BRAND_COLOR.blue, BRAND_COLOR
|
|
|
112
121
|
0 && (module.exports = {
|
|
113
122
|
ACTION_FOREGROUNDS,
|
|
114
123
|
ACTION_GRADIENTS,
|
|
124
|
+
ACTION_PAIRS,
|
|
115
125
|
BRAND,
|
|
116
126
|
BRAND_COLOR,
|
|
117
127
|
BRAND_GRADIENT,
|
|
118
128
|
TONE_FOREGROUNDS,
|
|
119
|
-
TONE_GRADIENTS
|
|
129
|
+
TONE_GRADIENTS,
|
|
130
|
+
TONE_PAIRS,
|
|
131
|
+
brandTint
|
|
120
132
|
});
|
|
121
133
|
//# sourceMappingURL=brand.cjs.map
|
package/dist/data/brand.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data/brand.ts"],"sourcesContent":["\nexport const BRAND = {\n blue: {\n text: \"text-brand-blue\",\n bg: \"bg-brand-blue/10\",\n bgSolid: \"bg-brand-blue/15\",\n from: \"from-brand-blue/20\",\n to: \"to-brand-blue/20\",\n },\n purple: {\n text: \"text-brand-purple\",\n bg: \"bg-brand-purple/10\",\n bgSolid: \"bg-brand-purple/15\",\n from: \"from-brand-purple/20\",\n to: \"to-brand-purple/20\",\n },\n rose: {\n text: \"text-brand-rose\",\n bg: \"bg-brand-rose/10\",\n bgSolid: \"bg-brand-rose/15\",\n from: \"from-brand-rose/20\",\n to: \"to-brand-rose/20\",\n },\n orange: {\n text: \"text-brand-orange\",\n bg: \"bg-brand-orange/10\",\n bgSolid: \"bg-brand-orange/15\",\n from: \"from-brand-orange/20\",\n to: \"to-brand-orange/20\",\n },\n maeve: {\n text: \"text-brand-maeve\",\n bg: \"bg-brand-maeve/10\",\n bgSolid: \"bg-brand-maeve/15\",\n },\n navy: {\n text: \"text-brand-navy\",\n bg: \"bg-brand-navy/10\",\n from: \"from-brand-navy/10\",\n to: \"to-brand-navy/10\",\n },\n} as const;\n\nconst
|
|
1
|
+
{"version":3,"sources":["../../src/data/brand.ts"],"sourcesContent":["\nexport const BRAND = {\n blue: {\n text: \"text-brand-blue\",\n bg: \"bg-brand-blue/10\",\n bgSolid: \"bg-brand-blue/15\",\n from: \"from-brand-blue/20\",\n to: \"to-brand-blue/20\",\n },\n purple: {\n text: \"text-brand-purple\",\n bg: \"bg-brand-purple/10\",\n bgSolid: \"bg-brand-purple/15\",\n from: \"from-brand-purple/20\",\n to: \"to-brand-purple/20\",\n },\n rose: {\n text: \"text-brand-rose\",\n bg: \"bg-brand-rose/10\",\n bgSolid: \"bg-brand-rose/15\",\n from: \"from-brand-rose/20\",\n to: \"to-brand-rose/20\",\n },\n orange: {\n text: \"text-brand-orange\",\n bg: \"bg-brand-orange/10\",\n bgSolid: \"bg-brand-orange/15\",\n from: \"from-brand-orange/20\",\n to: \"to-brand-orange/20\",\n },\n maeve: {\n text: \"text-brand-maeve\",\n bg: \"bg-brand-maeve/10\",\n bgSolid: \"bg-brand-maeve/15\",\n },\n navy: {\n text: \"text-brand-navy\",\n bg: \"bg-brand-navy/10\",\n from: \"from-brand-navy/10\",\n to: \"to-brand-navy/10\",\n },\n} as const;\n\nconst TOKEN = {\n blue: \"brand-blue\",\n purple: \"brand-purple\",\n rose: \"brand-rose\",\n orange: \"brand-orange\",\n maeve: \"brand-maeve\",\n navy: \"brand-navy\",\n red: \"destructive\",\n} as const;\n\nexport type BrandColorName = keyof typeof TOKEN;\n\nexport const BRAND_COLOR = Object.fromEntries(\n Object.entries(TOKEN).map(([name, token]) => [name, `hsl(var(--${token}))`]),\n) as { readonly [K in BrandColorName]: string };\n\n/** A brand colour at the given opacity. */\nexport const brandTint = (color: BrandColorName, alpha: number) => `hsl(var(--${TOKEN[color]}) / ${alpha})`;\n\ntype Pair = readonly [BrandColorName, BrandColorName];\n\nexport const ACTION_PAIRS = {\n buy: [\"blue\", \"purple\"],\n submit: [\"maeve\", \"purple\"],\n offer: [\"rose\", \"orange\"],\n remix: [\"purple\", \"rose\"],\n license: [\"blue\", \"purple\"],\n} as const satisfies Record<string, Pair>;\n\nexport const TONE_PAIRS = {\n blue: [\"blue\", \"purple\"],\n purple: [\"purple\", \"rose\"],\n orange: [\"orange\", \"rose\"],\n red: [\"red\", \"rose\"],\n rose: [\"rose\", \"orange\"],\n} as const satisfies Record<string, Pair>;\n\nconst loop = ([a, b]: Pair): [string, string, string] => [BRAND_COLOR[a], BRAND_COLOR[b], BRAND_COLOR[a]];\nconst mapPairs = <K extends string>(pairs: Record<K, Pair>, fn: (pair: Pair) => [string, string, string] | string) =>\n Object.fromEntries(Object.entries<Pair>(pairs).map(([key, pair]) => [key, fn(pair)]));\n\nexport const ACTION_GRADIENTS = mapPairs(ACTION_PAIRS, loop) as Record<keyof typeof ACTION_PAIRS, [string, string, string]>;\nexport const TONE_GRADIENTS = mapPairs(TONE_PAIRS, loop) as Record<keyof typeof TONE_PAIRS, [string, string, string]>;\n\nexport const ACTION_FOREGROUNDS: Record<keyof typeof ACTION_PAIRS, string> = {\n buy: BRAND_COLOR.blue,\n submit: BRAND_COLOR.purple,\n offer: BRAND_COLOR.orange,\n remix: BRAND_COLOR.purple,\n license: BRAND_COLOR.blue,\n};\n\nexport const TONE_FOREGROUNDS: Record<keyof typeof TONE_PAIRS, string> = {\n blue: BRAND_COLOR.blue,\n purple: BRAND_COLOR.purple,\n orange: BRAND_COLOR.orange,\n red: BRAND_COLOR.red,\n rose: BRAND_COLOR.rose,\n};\n\nexport const BRAND_GRADIENT = `linear-gradient(115deg, ${[BRAND_COLOR.blue, BRAND_COLOR.purple, BRAND_COLOR.rose, BRAND_COLOR.orange, BRAND_COLOR.blue].join(\", \")})`;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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