An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
fix: handle aborted incoming page transitions
yzr78489b2b6de6
diff --git a/.claude/skills/papermorph/assets/engine/engine.js b/.claude/skills/papermorph/assets/engine/engine.jsindex aa84be8..568d6bd 100644--- a/.claude/skills/papermorph/assets/engine/engine.js+++ b/.claude/skills/papermorph/assets/engine/engine.js@@ -1,6 +1,8 @@// Papermorph lesson engine: stage, drawing, timeline, questions, player.// A chapter page loads this file, defines CHAPTER and BEATS, then calls boot().'use strict';+// A fast follow-up navigation can abort the incoming page transition.+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));document.body.insertAdjacentHTML('afterbegin', `<div id="frame"><svg id="stage" viewBox="0 0 1600 900" role="img" aria-label="Lesson animation"><defs>diff --git a/.claude/skills/papermorph/assets/templates/book.html b/.claude/skills/papermorph/assets/templates/book.htmlindex 435cec2..427ef4f 100644--- a/.claude/skills/papermorph/assets/templates/book.html+++ b/.claude/skills/papermorph/assets/templates/book.html@@ -3,6 +3,10 @@<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">+<script>+// Observe aborted incoming transitions before the first rendering opportunity.+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));+</script><title>BOOK TITLE</title><meta name="description" content="ONE SENTENCE ABOUT THE BOOK."><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%231d2b27'/%3E%3Ctext x='32' y='45' text-anchor='middle' font-size='48' fill='%23f0b45a'%3E∞%3C/text%3E%3C/svg%3E">@@ -305,8 +309,6 @@ const name = el => {};document.addEventListener('click', e => { const a = e.target.closest('a[href^="ch"]'); if (a) name(a); });addEventListener('pagereveal', e => {- // A new navigation can interrupt the incoming page transition.- e.viewTransition?.ready.catch(() => {});const target = (location.hash.length > 1 && document.getElementById(location.hash.slice(1))?.closest('.ch')) || (named?.offsetParent && named);name(e.viewTransition && target ? target : null);e.viewTransition?.finished.then(() => name(null), () => name(null));diff --git a/site/elementary-algebra/index.html b/site/elementary-algebra/index.htmlindex 43b05d9..4a35e3a 100644--- a/site/elementary-algebra/index.html+++ b/site/elementary-algebra/index.html@@ -3,6 +3,10 @@<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">+<script>+// Observe aborted incoming transitions before the first rendering opportunity.+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));+</script><title>Elementary Algebra — Papermorph</title><meta name="description" content="Animated pre-algebra and algebra, with narrated lessons, interactive quick checks, and chapter practice."><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%231d2b27'/%3E%3Ctext x='32' y='45' text-anchor='middle' font-size='48' fill='%23f0b45a'%3E∞%3C/text%3E%3C/svg%3E">@@ -335,8 +339,6 @@ const name = el => {};document.addEventListener('click', e => { const a = e.target.closest('a[href^="ch"]'); if (a) name(a); });addEventListener('pagereveal', e => {- // A new navigation can interrupt the incoming page transition.- e.viewTransition?.ready.catch(() => {});const target = (location.hash.length > 1 && document.getElementById(location.hash.slice(1))?.closest('.ch')) || (named?.offsetParent && named);name(e.viewTransition && target ? target : null);e.viewTransition?.finished.then(() => name(null), () => name(null));diff --git a/site/elementary-algebra/lib/engine.js b/site/elementary-algebra/lib/engine.jsindex 64fe4ba..2e2f2c2 100644--- a/site/elementary-algebra/lib/engine.js+++ b/site/elementary-algebra/lib/engine.js@@ -1,6 +1,8 @@// Papermorph lesson engine: stage, drawing, timeline, questions, player.// A chapter page loads this file, defines CHAPTER and BEATS, then calls boot().'use strict';+// A fast follow-up navigation can abort the incoming page transition.+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));document.body.insertAdjacentHTML('afterbegin', `<div id="frame"><svg id="stage" viewBox="0 0 1600 900" role="img" aria-label="Lesson animation"><defs>diff --git a/site/math-notebook/index.html b/site/math-notebook/index.htmlindex 74fb4fb..9744446 100644--- a/site/math-notebook/index.html+++ b/site/math-notebook/index.html@@ -3,6 +3,10 @@<head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">+<script>+// Observe aborted incoming transitions before the first rendering opportunity.+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));+</script><title>Elementary Mathematics — Papermorph</title><meta name="description" content="Animated middle-school mathematics, with narrated lessons, interactive quick checks, and chapter practice."><link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='14' fill='%231d2b27'/%3E%3Ctext x='32' y='45' text-anchor='middle' font-size='48' fill='%23f0b45a'%3E∞%3C/text%3E%3C/svg%3E">@@ -318,8 +322,6 @@ const name = el => {};document.addEventListener('click', e => { const a = e.target.closest('a[href^="ch"]'); if (a) name(a); });addEventListener('pagereveal', e => {- // A new navigation can interrupt the incoming page transition.- e.viewTransition?.ready.catch(() => {});const target = (location.hash.length > 1 && document.getElementById(location.hash.slice(1))?.closest('.ch')) || (named?.offsetParent && named);name(e.viewTransition && target ? target : null);e.viewTransition?.finished.then(() => name(null), () => name(null));diff --git a/site/math-notebook/lib/engine.js b/site/math-notebook/lib/engine.jsindex 40c1c91..84cb026 100644--- a/site/math-notebook/lib/engine.js+++ b/site/math-notebook/lib/engine.js@@ -1,6 +1,8 @@// Papermorph lesson engine: stage, drawing, timeline, questions, player.// A chapter page loads this file, defines CHAPTER and BEATS, then calls boot().'use strict';+// A fast follow-up navigation can abort the incoming page transition.+addEventListener('pagereveal', e => e.viewTransition?.ready.catch(() => {}));document.body.insertAdjacentHTML('afterbegin', `<div id="frame"><svg id="stage" viewBox="0 0 1600 900" role="img" aria-label="Lesson animation"><defs>