@shipload/item-renderer 1.0.0-next.44 → 1.0.0-next.46
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipload/item-renderer",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.46",
|
|
4
4
|
"description": "Deterministic SVG rendering for Shipload items",
|
|
5
5
|
"homepage": "https://github.com/shipload/toolkit/tree/master/packages/item-renderer",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"fonts:copy": "bun run scripts/copy-fonts.ts"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@shipload/sdk": "^1.0.0-next.
|
|
48
|
+
"@shipload/sdk": "^1.0.0-next.46",
|
|
49
49
|
"@wharfkit/antelope": "1.2.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
@@ -13,6 +13,7 @@ export interface ItemCellProps {
|
|
|
13
13
|
size?: number
|
|
14
14
|
quantityColor?: string
|
|
15
15
|
quantityPrefix?: string
|
|
16
|
+
iconImageHref?: string
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
export function abbreviateQuantity(n: number): string {
|
|
@@ -65,7 +66,18 @@ function cellInner(props: ItemCellProps): string {
|
|
|
65
66
|
const entitySlug =
|
|
66
67
|
props.resolved.itemType === 'entity' ? entityIconSlugForName(props.resolved.name) : null
|
|
67
68
|
|
|
68
|
-
if (
|
|
69
|
+
if (props.iconImageHref) {
|
|
70
|
+
const iconSize = Math.round(size * (showQuantity ? 0.72 : 0.9))
|
|
71
|
+
const iconY = showQuantity ? Math.round(size * 0.08) : Math.round(height / 2 - iconSize / 2)
|
|
72
|
+
content = el('image', {
|
|
73
|
+
href: props.iconImageHref,
|
|
74
|
+
x: (size - iconSize) / 2,
|
|
75
|
+
y: iconY,
|
|
76
|
+
width: iconSize,
|
|
77
|
+
height: iconSize,
|
|
78
|
+
preserveAspectRatio: 'xMidYMid meet',
|
|
79
|
+
})
|
|
80
|
+
} else if (componentSlug) {
|
|
69
81
|
const iconSize = Math.round(size * (showQuantity ? 0.66 : 0.84))
|
|
70
82
|
const iconY = showQuantity ? Math.round(size * 0.12) : Math.round(height / 2 - iconSize / 2)
|
|
71
83
|
content = componentIcon(componentSlug, {
|