fix(cli): add window.__timelines guard to all templates

The studio bundler doesn't always initialize window.__timelines
before template scripts run, causing "Cannot set properties of
undefined" errors. Add defensive guard to every template.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Vance Ingalls
2026-03-26 18:03:29 +00:00
committed by Vance Ingalls
co-authored by Claude Opus 4.6
parent d5e4322fcc
commit d64050d41e
13 changed files with 13 additions and 0 deletions
@@ -150,6 +150,7 @@
);
});
window.__timelines = window.__timelines || {};
window.__timelines["captions"] = tl;
})();
</script>
@@ -99,6 +99,7 @@
ease: "elastic.out(1, 0.3)",
});
window.__timelines = window.__timelines || {};
window.__timelines["intro"] = tl;
})();
</script>
@@ -375,6 +375,7 @@
}
});
window.__timelines = window.__timelines || {};
window.__timelines["stats"] = tl;
})();
</script>
@@ -97,6 +97,7 @@
const tl = gsap.timeline({ paused: true });
if (!TRANSCRIPT || TRANSCRIPT.length === 0) {
window.__timelines = window.__timelines || {};
window.__timelines["captions"] = tl;
return;
}
@@ -199,6 +199,7 @@
S3_END - SLIDE_DUR,
);
window.__timelines = window.__timelines || {};
window.__timelines["graphics"] = tl;
})();
</script>
@@ -123,6 +123,7 @@
0.7,
);
window.__timelines = window.__timelines || {};
window.__timelines["intro"] = tl;
})();
</script>
@@ -168,6 +168,7 @@
);
});
window.__timelines = window.__timelines || {};
window.__timelines["captions"] = tl;
})();
</script>
@@ -316,6 +316,7 @@
);
tl.from("#branding .logo-underline", { scaleX: 0, duration: 0.8, ease: "expo.out" }, 13.04);
window.__timelines = window.__timelines || {};
window.__timelines["overlays"] = tl;
</script>
</div>
@@ -171,6 +171,7 @@
tl.to("#a-roll-wrapper", { opacity: 1, duration: 0 }, 7.3);
tl.to("#curtain-red", { left: "100%", duration: 0.4, ease: "power2.inOut" }, 7.3);
window.__timelines = window.__timelines || {};
window.__timelines["main-comp"] = tl;
</script>
</div>
@@ -134,6 +134,7 @@
);
});
window.__timelines = window.__timelines || {};
window.__timelines["captions"] = tl;
})();
</script>
@@ -156,6 +156,7 @@
// Hold until end (14s)
tl.to("#moment-3", { opacity: 0, duration: 0.5, ease: "power2.in" }, 13.5);
window.__timelines = window.__timelines || {};
window.__timelines["graphics"] = tl;
})();
</script>
@@ -78,6 +78,7 @@
1.8,
);
window.__timelines = window.__timelines || {};
window.__timelines["intro"] = tl;
})();
</script>
@@ -118,6 +118,7 @@
<div class="grain-texture"></div>
<script>
const grainTl = gsap.timeline({ paused: true });
window.__timelines = window.__timelines || {};
window.__timelines["grain-overlay"] = grainTl;
</script>
</div>