fix: preset thumbnails no longer conflict with main preview animation

- Inject only @keyframes (not .animated class rule) per preset thumbnail
  so the main preview's .animated rule cannot override them
- Drive thumbnail animation entirely via inline style properties
- Remove isActive/currentName — presets should never appear selected

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 17:08:22 +01:00
parent eeef3283c8
commit f4ee557e26
3 changed files with 41 additions and 30 deletions

View File

@@ -61,6 +61,24 @@ export function buildAnimationShorthand(config: AnimationConfig): string {
return `${config.name} ${config.duration}ms ${config.easing}${delay} ${iter} ${config.direction} ${config.fillMode}`;
}
export function buildKeyframesOnly(config: AnimationConfig): string {
const sorted = [...config.keyframes].sort((a, b) => a.offset - b.offset);
let out = `@keyframes ${config.name} {\n`;
for (const kf of sorted) {
const lines = buildProperties(kf.properties);
if (lines.length === 0) {
out += ` ${kf.offset}% { }\n`;
} else {
out += ` ${kf.offset}% {\n`;
for (const line of lines) out += ` ${line};\n`;
if (kf.easing) out += ` animation-timing-function: ${kf.easing};\n`;
out += ` }\n`;
}
}
out += `}\n`;
return out;
}
export function buildCSS(config: AnimationConfig): string {
const sorted = [...config.keyframes].sort((a, b) => a.offset - b.offset);