feat(studio): an element's source-parsed animations are part of Studio's API (#8061)

This commit is contained in:
Miguel Ángel
2026-11-17 09:03:19 +00:00
committed by GitHub
parent 5ea86450a2
commit efc91fc877
2 changed files with 14 additions and 0 deletions
@@ -0,0 +1,13 @@
import { describe, expect, it } from "vitest";
import type { GsapAnimation } from "@hyperframes/core/gsap-parser";
import { getAnimationsForElement } from "./index";
const tween = (targetSelector: string) => ({ targetSelector }) as GsapAnimation;
describe("an element's animations from Studio's public API", () => {
it("are the parsed tweens that address it by id or selector, read where a sealed preview's host can", () => {
const parsed = [tween("#title"), tween(".card, .hero"), tween("#other")];
expect(getAnimationsForElement(parsed, { id: "title", selector: null })).toEqual([parsed[0]]);
expect(getAnimationsForElement(parsed, { id: null, selector: ".hero" })).toEqual([parsed[1]]);
});
});
+1
View File
@@ -117,6 +117,7 @@ export { ImageThumbnail } from "./player/components/ImageThumbnail";
export type { ImageThumbnailProps } from "./player/components/ImageThumbnail";
export { useRenderClipContent } from "./hooks/useRenderClipContent";
export { useThumbnailStill } from "./hooks/useThumbnailStill";
export { fetchParsedAnimations, getAnimationsForElement } from "./hooks/useGsapTweenCache";
export type { ThumbnailStill, UseThumbnailStillOptions } from "./hooks/useThumbnailStill";
export type { UseRenderClipContentOptions } from "./hooks/useRenderClipContent";
export type { ThumbnailPriority } from "./player/lib/thumbnailScheduler";