mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-02 09:29:54 +08:00
* feat(brand-kit): map catalog artwork sources, improve favicon/cover fetching, and stabilize gallery grid - Add scripts/sync-brand-websites.ts and update library/brand-kits/websites.json and catalog.json to map upstream source URLs, same-site coverPages, and pinned preview coverImages across the Brand Kit catalog. - Serve favicon and cover endpoints for every Brand Kit entry via websiteUrl or sourceUrl with GitHub origin/repo deduplication, relaxed explicit OG fallback, preload/noscript/itemprop/AVIF support, extra favicon fallback paths, and a single browser-UA retry only on 403/406 responses. - Replace initial SVG/initial-letter flashes with shared loading skeletons for covers and favicons, lock Brand Kit card geometry to 16:9 inside a row-major CSS Grid, and drop offscreen queued artwork loads to prevent layout jitter. - Update backend/Studio unit tests and Brand Kit documentation. * fix(brand-kit): address PR #689 review feedback - Initialize stop before start/release in BrandArtworkImage so the no-IntersectionObserver synchronous fallback never hits a TDZ ReferenceError or leaks a queue slot; add regression test coverage in BrandKitPage.test.tsx. - Remove unreachable coverAspect state and onCoverAspect callback in TemplateGalleryCard and TemplatePoster. - Align docs/brand-kits.md and docs/product/architecture.md with the fixed-aspect row-major Brand Kit grid and loading skeletons. --------- Co-authored-by: pftom <pftom@pftomdeMacBook-Pro.local> Co-authored-by: pftom <pftom@pftomdeMBP.lan>
30 lines
1.0 KiB
TypeScript
30 lines
1.0 KiB
TypeScript
import { brandKitShowcase, type BrandSample } from './brand-kit.ts';
|
|
|
|
export type BrandCatalogEntry = {
|
|
id: string;
|
|
name: string;
|
|
category: string;
|
|
description: string;
|
|
appearance: 'Light' | 'Dark';
|
|
colors: string[];
|
|
tags: string[];
|
|
sourceUrl: string;
|
|
websiteUrl?: string;
|
|
coverPage?: string;
|
|
coverImage?: string;
|
|
sample: BrandSample;
|
|
files: { path: string; sha256: string }[];
|
|
};
|
|
export type BrandCatalog = {
|
|
schemaVersion: 1;
|
|
repository: string;
|
|
revision: string;
|
|
entries: BrandCatalogEntry[];
|
|
};
|
|
export const brandCoverRevision = 5;
|
|
const brandCatalogShowcaseRevision = 3;
|
|
export const brandCatalogArtworkUrl = (entry: Pick<BrandCatalogEntry, 'websiteUrl' | 'sourceUrl'>) =>
|
|
entry.websiteUrl || entry.sourceUrl;
|
|
export const brandCatalogFile = (id: string, file: 'poster.svg' | 'style-cover.svg' | 'showcase' | 'cover' | 'favicon') =>
|
|
`/motion-api/brand-kits/catalog/${encodeURIComponent(id)}/${file}?v=${file === 'showcase' ? brandCatalogShowcaseRevision : file === 'poster.svg' ? brandKitShowcase.revision : brandCoverRevision}`;
|