Optimize initial loading performance

This commit is contained in:
2026-06-27 07:49:38 +09:00
parent 88207c3b6f
commit b74332973b
14 changed files with 552 additions and 533 deletions

View File

@@ -56,6 +56,11 @@ export const portraitAssets: Record<string, string> = Object.fromEntries(
Object.entries(portraitModules).map(([path, url]) => [fileSlugFromPath(path), url])
);
export type PortraitAssetEntry = {
textureKey: string;
url: string;
};
export function portraitSlugForKey(key: string) {
return legacyPortraitSlugs[key] ?? camelToKebab(key);
}
@@ -65,6 +70,18 @@ export function portraitTextureKey(key: string) {
return portraitAssets[slug] ? `portrait-${slug}` : undefined;
}
export function portraitAssetEntriesForKey(key: string): PortraitAssetEntry[] {
const slug = portraitSlugForKey(key);
const prefix = `${slug}-`;
return Object.keys(portraitAssets)
.filter((candidate) => candidate === slug || candidate.startsWith(prefix))
.sort()
.map((candidate) => ({
textureKey: `portrait-${candidate}`,
url: portraitAssets[candidate]
}));
}
export function portraitTextureKeysForKey(key: string) {
const slug = portraitSlugForKey(key);
const prefix = `${slug}-`;