@arcblock/nft-display
Advanced tools
Comparing version 2.5.61 to 2.5.62
@@ -6,2 +6,3 @@ import type { LiteralUnion } from 'type-fest'; | ||
export type NFTVariant = LiteralUnion<'did-space' | 'app-space' | 'app-passport' | 'app-purchase', string>; | ||
export type NFTTagVariant = LiteralUnion<'info' | 'success' | 'error' | 'warning', string>; | ||
export type NFTChain = LiteralUnion<'arcblock' | 'ethereum' | '', string>; | ||
@@ -28,3 +29,4 @@ export type NFTSubject = { | ||
chain?: NFTChain; | ||
revoked?: boolean; | ||
tag?: string; | ||
tagVariant?: NFTTagVariant; | ||
}; | ||
@@ -40,3 +42,3 @@ export declare const formatDid: (did: string, length?: number) => string; | ||
export declare const getBadgesSvg: (verifiable: boolean, chain: NFTChain, id: string) => string; | ||
export declare const getRevokedSvg: (revoked: boolean, id: string) => string; | ||
export declare const getTagSvg: (tag: string, variant: NFTTagVariant, id: string) => string; | ||
export declare const getSvg: (props: NFTProps) => string; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSvg = exports.getRevokedSvg = exports.getBadgesSvg = exports.getChainBadge = exports.getVerifiableBadge = exports.getDidSvg = exports.getExtraSvg = exports.getIssuerSvg = exports.getHeaderSvg = exports.getLayoutSvg = exports.formatDid = void 0; | ||
exports.getSvg = exports.getTagSvg = exports.getBadgesSvg = exports.getChainBadge = exports.getVerifiableBadge = exports.getDidSvg = exports.getExtraSvg = exports.getIssuerSvg = exports.getHeaderSvg = exports.getLayoutSvg = exports.formatDid = void 0; | ||
const nanoid_1 = require("nanoid"); | ||
@@ -783,17 +783,23 @@ const DidMotif = __importStar(require("@arcblock/did-motif")); | ||
exports.getBadgesSvg = getBadgesSvg; | ||
const getRevokedSvg = (revoked, id) => { | ||
if (revoked) { | ||
const filterId = getId(id, 'revoked-distort'); | ||
return `<g id="${getId(id, 'revoked')}" transform="translate(112,-36) rotate(45)"> | ||
<rect x="60" y="0" width="90" height="30" stroke="rgba(255,0,0,0.8)" stroke-width="2" /> | ||
const getTagSvg = (tag, variant, id) => { | ||
const colors = { | ||
success: '#34BE74', | ||
error: '#F16E6E', | ||
info: '#0775F8', | ||
warning: '#DE9E37', | ||
}; | ||
if (tag) { | ||
const filterId = getId(id, 'tag-distort'); | ||
return `<g id="${getId(id, 'tag')}" transform="translate(112,-36) rotate(45)"> | ||
<rect x="60" y="0" width="95" height="30" stroke="${colors[variant]}" stroke-width="2" /> | ||
<text | ||
x="64" | ||
x="104" | ||
y="12" | ||
font-size="15" | ||
font-size="14" | ||
font-weight="bold" | ||
font-family="Helvetica, Arial, sans-serif" | ||
fill="rgba(255,0,0,0.8)" | ||
text-anchor="start" | ||
fill="${colors[variant]}" | ||
text-anchor="middle" | ||
alignment-baseline="middle" | ||
dominant-baseline="middle" filter="url(#${filterId})">REVOKED</text> | ||
dominant-baseline="middle" filter="url(#${filterId})">${tag.toUpperCase()}</text> | ||
<defs> | ||
@@ -809,3 +815,3 @@ <filter id="${filterId}"> | ||
}; | ||
exports.getRevokedSvg = getRevokedSvg; | ||
exports.getTagSvg = getTagSvg; | ||
const getSvg = (props) => { | ||
@@ -822,5 +828,5 @@ const id = props.id || (0, nanoid_1.nanoid)(8); | ||
const identity = (0, exports.getDidSvg)(props.did, id); | ||
const revoked = (0, exports.getRevokedSvg)(props.revoked || false, id); | ||
return layout([header, issuer, extra, badges, identity, revoked].filter(Boolean).join(''), width, height); | ||
const tag = (0, exports.getTagSvg)(props.tag, props.tagVariant, id); | ||
return layout([header, issuer, extra, badges, identity, tag].filter(Boolean).join(''), width, height); | ||
}; | ||
exports.getSvg = getSvg; |
{ | ||
"name": "@arcblock/nft-display", | ||
"version": "2.5.61", | ||
"version": "2.5.62", | ||
"description": "arcblock's nft display generic component", | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "382f83849428e3dff23540983b06a65f658ef1b2" | ||
"gitHead": "c3067dee4e427fcedbe7e2d254159dd99606823c" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52753
1123