88 HF_COLOR_GRADING_CANVAS_ID_PREFIX ,
99} from "@hyperframes/core/color-grading" ;
1010import { getIframeGsap , queryIframeElement , type IframeGsap } from "./gsapShared" ;
11+ import { gsapWritesChannels } from "./gsapRuntimeKeyframes" ;
1112import { roundTo3 } from "../utils/rounding" ;
1213
1314/**
@@ -50,27 +51,6 @@ export function readGsapProperty(
5051}
5152
5253export const POSITION_PROPS = new Set ( [ "x" , "y" , "xPercent" , "yPercent" ] ) ;
53- const GSAP_CONFIG_KEYS = new Set ( [
54- "duration" ,
55- "ease" ,
56- "delay" ,
57- "stagger" ,
58- "id" ,
59- "onComplete" ,
60- "onUpdate" ,
61- "onStart" ,
62- "onRepeat" ,
63- "repeat" ,
64- "yoyo" ,
65- "repeatDelay" ,
66- "paused" ,
67- "immediateRender" ,
68- "lazy" ,
69- "overwrite" ,
70- "keyframes" ,
71- "parent" ,
72- ] ) ;
73-
7454export function readAllAnimatedProperties (
7555 iframe : HTMLIFrameElement | null ,
7656 selector : string ,
@@ -115,74 +95,7 @@ export function readAllAnimatedProperties(
11595 }
11696 }
11797
118- const otherTweenProps = new Set < string > ( ) ;
119- try {
120- const win = iframe . contentWindow as unknown as { __timelines ?: Record < string , unknown > } ;
121- const timelines = win . __timelines ;
122- if ( timelines ) {
123- for ( const tl of Object . values ( timelines ) ) {
124- const tlObj = tl as {
125- getChildren ?: (
126- deep : boolean ,
127- ) => Array < { targets ?: ( ) => Element [ ] ; vars ?: Record < string , unknown > } > ;
128- } ;
129- if ( ! tlObj ?. getChildren ) continue ;
130- for ( const child of tlObj . getChildren ( true ) ) {
131- if ( typeof child . targets !== "function" ) continue ;
132- const targets = child . targets ( ) ;
133- if ( ! targets . includes ( el ) ) continue ;
134- const vars = child . vars ;
135- if ( ! vars ) continue ;
136- for ( const k of Object . keys ( vars ) ) {
137- if ( ! GSAP_CONFIG_KEYS . has ( k ) && inGroup ( k ) ) otherTweenProps . add ( k ) ;
138- }
139- }
140- }
141- }
142- } catch { }
143- for ( const p of groupedPropKeys ) otherTweenProps . delete ( p ) ;
144-
145- // Tier 1: Transform + visual properties with universal CSS defaults.
146- // Safe to compare against hardcoded values — these are always 0 or 1
147- // regardless of the element's stylesheet.
148- const UNIVERSAL_BASELINE : Record < string , number > = {
149- opacity : 1 ,
150- scale : 1 ,
151- scaleX : 1 ,
152- scaleY : 1 ,
153- scaleZ : 1 ,
154- rotation : 0 ,
155- rotationX : 0 ,
156- rotationY : 0 ,
157- skewX : 0 ,
158- skewY : 0 ,
159- z : 0 ,
160- xPercent : 0 ,
161- yPercent : 0 ,
162- transformPerspective : 0 ,
163- blur : 0 ,
164- brightness : 1 ,
165- contrast : 1 ,
166- saturate : 1 ,
167- hueRotate : 0 ,
168- grayscale : 0 ,
169- sepia : 0 ,
170- invert : 0 ,
171- } ;
172- // Collect all properties that ANY tween on this element explicitly targets.
173- // Only capture baseline values for these — GSAP reports non-default values
174- // (scaleZ=0, brightness=0) for untouched properties, polluting keyframes.
175- const allTweenedProps = new Set ( [ ...groupedPropKeys , ...otherTweenProps ] ) ;
176- for ( const [ prop , defaultVal ] of Object . entries ( UNIVERSAL_BASELINE ) ) {
177- if ( prop in result ) continue ;
178- if ( ! allTweenedProps . has ( prop ) ) continue ;
179- const val = readLiveGsapValue ( gsap , el , prop ) ;
180- if ( Number . isFinite ( val ) && Math . round ( val * 1000 ) !== Math . round ( defaultVal * 1000 ) ) {
181- result [ prop ] = roundTo3 ( val ) ;
182- }
183- }
184-
185- // Tier 2: Element-dependent properties — their "default" depends on the
98+ // Element-dependent properties — their "default" depends on the
18699 // stylesheet, so we compare GSAP's runtime value against the element's
187100 // computed CSS value. Only capture if GSAP has actively changed it.
188101 const COMPUTED_BASELINE = [
@@ -209,7 +122,7 @@ export function readAllAnimatedProperties(
209122 for ( const prop of COMPUTED_BASELINE ) {
210123 if ( prop in result ) continue ;
211124 if ( ! inGroup ( prop ) ) continue ;
212- if ( otherTweenProps . has ( prop ) ) continue ;
125+ if ( gsapWritesChannels ( el , [ prop ] ) ) continue ;
213126 const gsapVal = Number ( gsap . getProperty ( el , prop ) ) ;
214127 if ( ! Number . isFinite ( gsapVal ) ) continue ;
215128 let cssVal = NaN ;
0 commit comments