- web/: Vue 3 + Vite + UnoCSS + Pinia, dark tactical theme (amber/#0d1117) - AppNav, ListingCard, SearchView with filters/sort, composables (useSnipeMode, useKonamiCode, useMotion), Pinia search store - Steal shimmer, auction countdown, Snipe Mode easter egg all native in Vue - docker/web/: nginx + multi-stage Dockerfile (node build → nginx serve) - compose.yml: api (8510) + web (8509) services - Dockerfile CMD updated to uvicorn for upcoming FastAPI layer - Clean build: 0 TS errors, 380 modules
32 lines
No EOL
1.1 KiB
JavaScript
32 lines
No EOL
1.1 KiB
JavaScript
import { trimSVG } from "../svg/trim.js";
|
|
import { mergeIconProps } from "./utils.js";
|
|
|
|
/**
|
|
* Get custom icon from inline collection or using loader
|
|
*/
|
|
async function getCustomIcon(custom, collection, icon, options) {
|
|
let result;
|
|
try {
|
|
if (typeof custom === "function") result = await custom(icon);
|
|
else {
|
|
const inline = custom[icon];
|
|
result = typeof inline === "function" ? await inline() : inline;
|
|
}
|
|
} catch (err) {
|
|
console.warn(`Failed to load custom icon "${icon}" in "${collection}":`, err);
|
|
return;
|
|
}
|
|
if (result) {
|
|
const cleanupIdx = result.indexOf("<svg");
|
|
if (cleanupIdx > 0) result = result.slice(cleanupIdx);
|
|
const { transform } = options?.customizations ?? {};
|
|
result = typeof transform === "function" ? await transform(result, collection, icon) : result;
|
|
if (!result.startsWith("<svg")) {
|
|
console.warn(`Custom icon "${icon}" in "${collection}" is not a valid SVG`);
|
|
return result;
|
|
}
|
|
return await mergeIconProps(options?.customizations?.trimCustomSvg === true ? trimSVG(result) : result, collection, icon, options, void 0);
|
|
}
|
|
}
|
|
|
|
export { getCustomIcon }; |