@teleporthq/teleport-project-generator-next 0.43.71 → 0.43.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/__tests__/page-transition-end2end.test.ts +16 -6
  2. package/__tests__/scroll-scene-chapter-index.test.ts +5 -4
  3. package/__tests__/scroll-scene-end2end.test.ts +26 -0
  4. package/__tests__/scroll-scene-moment.test.ts +5 -4
  5. package/dist/cjs/page-transition/page-transition-component.d.ts.map +1 -1
  6. package/dist/cjs/page-transition/page-transition-component.js +2 -2
  7. package/dist/cjs/page-transition/page-transition-component.js.map +1 -1
  8. package/dist/cjs/page-transition/reveal-on-screen-source.generated.d.ts +4 -0
  9. package/dist/cjs/page-transition/reveal-on-screen-source.generated.d.ts.map +1 -0
  10. package/dist/cjs/page-transition/reveal-on-screen-source.generated.js +11 -0
  11. package/dist/cjs/page-transition/reveal-on-screen-source.generated.js.map +1 -0
  12. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  13. package/dist/esm/page-transition/page-transition-component.d.ts.map +1 -1
  14. package/dist/esm/page-transition/page-transition-component.js +3 -3
  15. package/dist/esm/page-transition/page-transition-component.js.map +1 -1
  16. package/dist/esm/page-transition/reveal-on-screen-source.generated.d.ts +4 -0
  17. package/dist/esm/page-transition/reveal-on-screen-source.generated.d.ts.map +1 -0
  18. package/dist/esm/page-transition/reveal-on-screen-source.generated.js +8 -0
  19. package/dist/esm/page-transition/reveal-on-screen-source.generated.js.map +1 -0
  20. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +21 -18
  22. package/src/page-transition/page-transition-component.ts +6 -10
  23. package/src/page-transition/reveal-on-screen-source.generated.ts +8 -0
@@ -12,6 +12,7 @@ import {
12
12
  reversePageTransitionPreset,
13
13
  } from '../src/page-transition/page-transition-variants'
14
14
  import { revealOnScreen } from '../src/page-transition/reveal-on-screen'
15
+ import { REVEAL_ON_SCREEN_SOURCES } from '../src/page-transition/reveal-on-screen-source.generated'
15
16
 
16
17
  const template = () => JSON.parse(JSON.stringify(NextTemplate)) as GeneratedFolder
17
18
 
@@ -274,7 +275,7 @@ describe('Next generator reveal presets (Circle, the Wipes)', () => {
274
275
  )
275
276
  const wrapper = findFile(output, 'components', 'tq-page-transition')?.content || ''
276
277
  // the shipped wrapper carries the function tested below, and every reveal goes through it
277
- expect(wrapper).toContain(revealOnScreen.toString())
278
+ expect(wrapper).toContain(REVEAL_ON_SCREEN_SOURCES.revealOnScreen)
278
279
  expect(wrapper).toContain(
279
280
  'revealOnScreen(pageTransitionVariants(PRESET, SLIDE_PX, context, OPTIONS, CUSTOM || undefined), context.screen)'
280
281
  )
@@ -326,7 +327,9 @@ describe('Next generator reveal presets (Circle, the Wipes)', () => {
326
327
  expect(wrapper).toContain(
327
328
  'const origin = pointer || { x: screen.width / 2, y: screen.height / 2 }'
328
329
  )
329
- expect(revealOnScreen.toString()).not.toContain('`')
330
+ expect(REVEAL_ON_SCREEN_SOURCES.revealOnScreen.startsWith('function revealOnScreen(')).toBe(
331
+ true
332
+ )
330
333
  })
331
334
 
332
335
  it('opens a reveal over the leaving page, which holds; every other preset plays in turn', async () => {
@@ -413,10 +416,17 @@ describe('pageTransitionVariants (mirror of the editor contract)', () => {
413
416
  expect(reversePageTransitionPreset('fade')).toBe('fade')
414
417
  })
415
418
 
416
- it('injects cleanly: no backticks in any injected function source', () => {
417
- expect(pageTransitionVariants.toString()).not.toContain('`')
418
- expect(reversePageTransitionPreset.toString()).not.toContain('`')
419
- expect(pageTransitionCover.toString()).not.toContain('`')
419
+ it('ships its helpers as text derived from their sources, each under its own name', async () => {
420
+ const output = await createNextProjectGenerator().generateProject(
421
+ buildUidl({ preset: 'fade', duration: 0.3, easing: 'ease-out' }),
422
+ template()
423
+ )
424
+ const wrapper = findFile(output, 'components', 'tq-page-transition')?.content || ''
425
+ const sources = PageTransition.PAGE_TRANSITION_HELPER_SOURCES
426
+ for (const name of Object.keys(sources) as Array<keyof typeof sources>) {
427
+ expect(sources[name].startsWith(`function ${name}(`)).toBe(true)
428
+ expect(wrapper).toContain(sources[name])
429
+ }
420
430
  })
421
431
 
422
432
  it('cover presets hold the page while the panels sweep', () => {
@@ -1,3 +1,4 @@
1
+ import { ScrollSceneRuntime } from '@teleporthq/teleport-shared'
1
2
  import { activeChapterIndex } from '../src/widgets/scroll-scene-chapter-index'
2
3
 
3
4
  describe('activeChapterIndex (generated runtime)', () => {
@@ -27,9 +28,9 @@ describe('activeChapterIndex (generated runtime)', () => {
27
28
  expect(activeChapterIndex([0, 0.3], 0.3 - 1e-9)).toBe(1)
28
29
  })
29
30
 
30
- it('its source survives injection into the runtime as plain JS', () => {
31
- const source = activeChapterIndex.toString()
32
- expect(source).toContain('function activeChapterIndex')
33
- expect(source).not.toContain('`')
31
+ it('ships in the runtime as text derived from this file, under its own name', () => {
32
+ const source = ScrollSceneRuntime.SCROLL_SCENE_HELPER_SOURCES.activeChapterIndex
33
+ expect(source.startsWith('function activeChapterIndex(')).toBe(true)
34
+ expect(ScrollSceneRuntime.engineSource()).toContain(source)
34
35
  })
35
36
  })
@@ -1,3 +1,5 @@
1
+ import { parse } from '@babel/parser'
2
+ import type { FunctionDeclaration } from '@babel/types'
1
3
  import { GeneratedFolder, ProjectUIDL } from '@teleporthq/teleport-types'
2
4
  import uidlSample from '../../../examples/test-samples/project-sample.json'
3
5
  import { createNextProjectGenerator } from '../src'
@@ -133,6 +135,30 @@ describe('Next generator with a Scroll Scene element', () => {
133
135
  expect(indexPage?.content).toContain('sceneLength')
134
136
  })
135
137
 
138
+ it('is one valid module: every helper declared once, under the name the runtime calls', async () => {
139
+ const outputFolder = await generator.generateProject(buildUidlWithScene(), template)
140
+ const code = findFile(outputFolder, 'components', 'tq-scroll-scene')?.content || ''
141
+ // The helpers are spliced in as TEXT derived from their sources. Spliced
142
+ // from live functions, the editor's minified build renamed every one of
143
+ // them to `r`, and Vercel refused the component ("the name `r` is defined
144
+ // multiple times", 2026-10-06).
145
+ const ast = parse(code, { sourceType: 'module', plugins: ['jsx'] })
146
+ const declared = ast.program.body
147
+ .filter((node): node is FunctionDeclaration => node.type === 'FunctionDeclaration')
148
+ .map((node) => node.id?.name)
149
+ expect(new Set(declared).size).toBe(declared.length)
150
+ for (const name of [
151
+ 'settledMomentForLanes',
152
+ 'activeChapterIndex',
153
+ 'scenePointList',
154
+ 'passedScenePoints',
155
+ 'scenePointRank',
156
+ 'unclipStickyAncestors',
157
+ ]) {
158
+ expect(declared).toContain(name)
159
+ }
160
+ })
161
+
136
162
  it('ships the wrapper with the sticky track/stage, lane engine and guardrails', async () => {
137
163
  const outputFolder = await generator.generateProject(buildUidlWithScene(), template)
138
164
  const component = findFile(outputFolder, 'components', 'tq-scroll-scene')
@@ -1,3 +1,4 @@
1
+ import { ScrollSceneRuntime } from '@teleporthq/teleport-shared'
1
2
  import { settledMomentForLanes } from '../src/widgets/scroll-scene-moment'
2
3
 
3
4
  /**
@@ -38,9 +39,9 @@ describe('settledMomentForLanes (generated runtime)', () => {
38
39
  expect(settledMomentForLanes([lane([0.75, 1], [100, -100])])).toBeNull()
39
40
  })
40
41
 
41
- it('its source survives injection into the runtime as plain JS', () => {
42
- const source = settledMomentForLanes.toString()
43
- expect(source).toContain('function settledMomentForLanes')
44
- expect(source).not.toContain('`')
42
+ it('ships in the runtime as text derived from this file, under its own name', () => {
43
+ const source = ScrollSceneRuntime.SCROLL_SCENE_HELPER_SOURCES.settledMomentForLanes
44
+ expect(source.startsWith('function settledMomentForLanes(')).toBe(true)
45
+ expect(ScrollSceneRuntime.engineSource()).toContain(source)
45
46
  })
46
47
  })
@@ -1 +1 @@
1
- {"version":3,"file":"page-transition-component.d.ts","sourceRoot":"","sources":["../../../src/page-transition/page-transition-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAa5D,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,oBAAoB,CAAA;AAKtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,eAAO,MAAM,mCAAmC,WAAY,oBAAoB,KAAG,MAyZlF,CAAA"}
1
+ {"version":3,"file":"page-transition-component.d.ts","sourceRoot":"","sources":["../../../src/page-transition/page-transition-component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAS5D,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,oBAAoB,CAAA;AAKtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,eAAO,MAAM,mCAAmC,WAAY,oBAAoB,KAAG,MAyZlF,CAAA"}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.generatePageTransitionComponentCode = void 0;
4
4
  var teleport_shared_1 = require("@teleporthq/teleport-shared");
5
5
  var page_transition_variants_1 = require("./page-transition-variants");
6
- var reveal_on_screen_1 = require("./reveal-on-screen");
6
+ var reveal_on_screen_source_generated_1 = require("./reveal-on-screen-source.generated");
7
7
  var EASING_CURVES = teleport_shared_1.PageTransition.PAGE_TRANSITION_EASING_CURVES;
8
8
  var BACK_ATTR = teleport_shared_1.PageTransition.BACK_ATTR, ORIGIN_X = teleport_shared_1.PageTransition.ORIGIN_X, ORIGIN_Y = teleport_shared_1.PageTransition.ORIGIN_Y, morphHelpersSource = teleport_shared_1.PageTransition.morphHelpersSource, viewTransitionPlan = teleport_shared_1.PageTransition.viewTransitionPlan;
9
9
  /**
@@ -86,7 +86,7 @@ var generatePageTransitionComponentCode = function (config) {
86
86
  var plan = viewTransitionPlan(config, { crossDocument: false });
87
87
  var vtCss = plan && (plan.revealsOver || plan.flies) ? plan.css : '';
88
88
  var flies = !!plan && plan.flies;
89
- return "import React from 'react'\nimport { useRouter } from 'next/router'\nimport { AnimatePresence, motion, usePresence } from 'framer-motion'\n\n".concat(page_transition_variants_1.reversePageTransitionPreset.toString(), "\n\n").concat(page_transition_variants_1.pageTransitionVariants.toString(), "\n\n").concat(page_transition_variants_1.pageTransitionCover.toString(), "\n\n").concat(page_transition_variants_1.pageTransitionSkipPattern.toString(), "\n\n").concat(reveal_on_screen_1.revealOnScreen.toString(), "\n\n").concat(morphHelpersSource(), "\n\nconst PRESET = '").concat(preset, "'\n// The preset's choices, resolved to words the variants understand.\nconst OPTIONS = ").concat(JSON.stringify(options), "\nconst CUSTOM = ").concat(JSON.stringify(custom), "\nconst ORIGIN_FROM_POINTER = ").concat(options.origin !== 'center', "\nconst DURATION = ").concat(duration, "\nconst EASE = [").concat(curve.join(', '), "]\nconst SLIDE_PX = ").concat(page_transition_variants_1.PAGE_TRANSITION_SLIDE_PX, "\nconst CENTER = { reverse: false, skip: false, originX: '50%', originY: '50%' }\nconst PANELS = pageTransitionCover(PRESET)\n// Pages that opted out: they appear instantly; leaving them still plays.\nconst SKIP_ROUTES = ").concat(JSON.stringify(skipRoutes), "\nconst INSTANT = { initial: {}, animate: {}, exit: {} }\n// A reveal (Circle, the Wipes): the arriving page opens over the leaving one.\n// Without View Transitions it runs frame by frame, framer writing each\n// clip-path onto the page: run by the browser (framer's default for clip-path),\n// the animation ends one frame before framer writes its last value, and for\n// that frame the page shows its starting clip \u2014 the whole page blinks away as\n// the reveal completes. An onUpdate handler, even one that does nothing, keeps\n// the animation in framer's own loop.\nconst REVEAL = (() => {\n const variants = pageTransitionVariants(PRESET, SLIDE_PX, CENTER, OPTIONS, CUSTOM || undefined)\n return !!(variants && variants.animate.clipPath)\n})()\nconst stepByFrame = () => {}\n// Without View Transitions the two pages overlap for a reveal: the arriving\n// page is laid above the frozen one (a positioned box would paint on top of it).\nconst OVER = { position: 'relative', zIndex: 1 }\nconst SKIP_PATTERNS = SKIP_ROUTES.map(pageTransitionSkipPattern)\nconst isSkippedRoute = (key) => SKIP_PATTERNS.some((pattern) => pattern.test(key))\n// The cover family paints its panels in the theme colour the editor chose.\nconst PANEL_COLOR = '").concat((0, page_transition_variants_1.pageTransitionCoverColor)(options.color), "'\nconst PANEL_BASE = { position: 'fixed', top: 0, bottom: 0, zIndex: 2147483000, pointerEvents: 'none', background: PANEL_COLOR }\nconst panelBounds = (panel) =>\n panel.side === 'left' ? { left: 0, right: '50%' } : panel.side === 'right' ? { left: '50%', right: 0 } : { left: 0, right: 0 }\n\nconst routeKeyOf = (url) => String(url || '').split(/[?#]/)[0]\n\n// The page changes played as a View Transition (a reveal; a flying picture), as\n// the static export plays them.\nconst VT_CSS = ").concat(JSON.stringify(vtCss), "\nconst FLIES = ").concat(flies, "\n// A page that takes longer than this to arrive switches without the transition.\nconst ARRIVAL_WAIT_MS = 3000\n// An arriving picture still loading is waited for this long, so the flight lands on it.\nconst MORPH_DECODE_MS = 300\n// The arriving page waits this long at most for the pictures on its first screen.\nconst PICTURE_WAIT_MS = 300\nconst prefersLessMotion = () =>\n !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches)\n// Settles once the pictures on the arriving page's first screen are decoded, or\n// after PICTURE_WAIT_MS: an image the page asks to decode off the main thread\n// paints a few frames after the rest of the page.\nconst picturesReady = (node) => {\n const pictures = Array.prototype.filter.call(node.querySelectorAll('img'), (image) => {\n const box = image.getBoundingClientRect()\n return box.bottom > 0 && box.top < window.innerHeight && typeof image.decode === 'function'\n })\n return Promise.race([\n Promise.all(pictures.map((image) => image.decode().catch(() => {}))),\n new Promise((resolve) => setTimeout(resolve, PICTURE_WAIT_MS)),\n ])\n}\n\n// Keeps the leaving page in the document while it is still needed: until the\n// browser has pictured it (a View Transition), or until the page revealed over\n// it has fully opened (a reveal without View Transitions).\nconst HoldPage = ({ pageKey, changeRef, revealRef }) => {\n const [isPresent, safeToRemove] = usePresence()\n React.useEffect(() => {\n if (isPresent) {\n return\n }\n const change = changeRef.current\n const reveal = revealRef.current\n if (change && change.leavingKey === pageKey) {\n change.captured.then(safeToRemove)\n } else if (reveal && reveal.leavingKey === pageKey) {\n reveal.opened.then(safeToRemove)\n } else {\n safeToRemove()\n }\n }, [isPresent])\n return null\n}\n\nconst TqPageTransition = ({ children }) => {\n const router = useRouter()\n const routeKey = routeKeyOf(router.asPath)\n const routeKeyRef = React.useRef(routeKey)\n routeKeyRef.current = routeKey\n const [frozen, setFrozen] = React.useState(null)\n const [context, setContext] = React.useState(CENTER)\n const [panelPhase, setPanelPhase] = React.useState('idle')\n // The page being revealed over the leaving one without View Transitions.\n const [overKey, setOverKey] = React.useState(null)\n // The page whose arrival may play: the first page at once, every later one\n // once its first screen's pictures are ready.\n const [readyKey, setReadyKey] = React.useState(routeKey)\n const readyKeyRef = React.useRef(routeKey)\n const pageRef = React.useRef(null)\n const popRef = React.useRef(false)\n const pointerRef = React.useRef(null)\n const clickedRef = React.useRef(null)\n const changeRef = React.useRef(null)\n const revealRef = React.useRef(null)\n const variants = React.useMemo(\n () =>\n context.skip || context.morph\n ? INSTANT\n : revealOnScreen(pageTransitionVariants(PRESET, SLIDE_PX, context, OPTIONS, CUSTOM || undefined), context.screen),\n [context]\n )\n\n // The arriving page is in the document: wait for the pictures on its first\n // screen (and, in a View Transition, for its twin of the flying picture),\n // then let it play \u2014 or let the browser picture the new state.\n const setPage = React.useCallback((node) => {\n pageRef.current = node\n const key = node ? node.getAttribute('data-tq-page-transition') : null\n if (key === null || key === readyKeyRef.current) {\n return\n }\n readyKeyRef.current = key\n const change = changeRef.current\n const landing = change && !change.landed && node !== change.leaving ? change : null\n let twin = null\n if (landing) {\n landing.landed = true\n tqMorphClear()\n twin = landing.src ? tqMorphTarget(landing.src) : null\n if (twin) {\n twin.style.viewTransitionName = TQ_MORPH_NAME\n }\n }\n const twinReady =\n twin && !twin.complete && typeof twin.decode === 'function'\n ? Promise.race([\n twin.decode().catch(() => {}),\n new Promise((resolve) => setTimeout(resolve, MORPH_DECODE_MS)),\n ])\n : Promise.resolve()\n Promise.all([picturesReady(node), twinReady]).then(() => {\n // A later page may have arrived meanwhile; this one's turn has passed.\n if (readyKeyRef.current === key) {\n setReadyKey(key)\n setPanelPhase((phase) => (phase === 'covered' ? 'uncovering' : phase))\n }\n if (landing) {\n landing.arrive()\n }\n })\n }, [])\n\n React.useEffect(() => {\n const onPointerDown = (event) => {\n pointerRef.current = { x: event.clientX, y: event.clientY }\n }\n const onClick = (event) => {\n clickedRef.current = event.target && event.target.closest ? event.target.closest('a[href]') : null\n }\n window.addEventListener('pointerdown', onPointerDown, true)\n window.addEventListener('click', onClick, true)\n return () => {\n window.removeEventListener('pointerdown', onPointerDown, true)\n window.removeEventListener('click', onClick, true)\n }\n }, [])\n\n React.useEffect(() => {\n router.beforePopState(() => {\n popRef.current = true\n return true\n })\n const root = document.documentElement\n const abandon = (change) => {\n if (!change.landed) {\n change.landed = true\n change.transition.skipTransition()\n change.arrive()\n }\n }\n // The page change as a View Transition: every reveal, and a picture in the\n // followed link that the next page shows too (going forward only).\n const startViewChange = (url, pointer, reverse) => {\n if (!VT_CSS || !pageRef.current || typeof document.startViewTransition !== 'function' || prefersLessMotion()) {\n return false\n }\n const image = FLIES && !reverse ? tqMorphSource(url, clickedRef.current) : null\n if (!image && !REVEAL) {\n return false\n }\n const change = { leavingKey: routeKeyRef.current, leaving: pageRef.current, src: image ? image.currentSrc || image.src : null, landed: false }\n change.captured = new Promise((resolve) => {\n change.onCaptured = resolve\n })\n const arrived = new Promise((resolve) => {\n change.arrive = resolve\n })\n tqMorphClear()\n if (image) {\n image.style.viewTransitionName = TQ_MORPH_NAME\n }\n if (reverse) {\n root.setAttribute('").concat(BACK_ATTR, "', 'back')\n }\n if (pointer) {\n root.style.setProperty('").concat(ORIGIN_X, "', pointer.x + 'px')\n root.style.setProperty('").concat(ORIGIN_Y, "', pointer.y + 'px')\n }\n const settle = () => {\n if (changeRef.current === change) {\n changeRef.current = null\n tqMorphClear()\n root.removeAttribute('").concat(BACK_ATTR, "')\n root.style.removeProperty('").concat(ORIGIN_X, "')\n root.style.removeProperty('").concat(ORIGIN_Y, "')\n }\n }\n changeRef.current = change\n try {\n change.transition = document.startViewTransition(() => {\n change.onCaptured()\n return arrived\n })\n } catch (error) {\n settle()\n return false\n }\n change.transition.ready.catch(() => {})\n change.transition.finished.then(settle, settle)\n setTimeout(() => abandon(change), ARRIVAL_WAIT_MS)\n return true\n }\n const onRouteChangeStart = (url) => {\n if (routeKeyOf(url) === routeKeyRef.current) {\n return\n }\n const reverse = popRef.current\n popRef.current = false\n // A skipped page appears instantly; leaving it still plays the site's transition.\n // A visitor who asks for less motion gets every page that way. It is read\n // here, never while rendering: the server cannot know it, and a first render\n // that differs from the server's makes React throw the page away.\n const skip = prefersLessMotion() || isSkippedRoute(routeKeyOf(url))\n const pointer = reverse || !ORIGIN_FROM_POINTER ? null : pointerRef.current\n // A reveal is measured on this screen (revealOnScreen); without a press it\n // grows from the screen's centre, not the page's.\n const screen = { width: window.innerWidth, height: window.innerHeight }\n const origin = pointer || { x: screen.width / 2, y: screen.height / 2 }\n const next = { reverse, skip, originX: origin.x + 'px', originY: origin.y + 'px', screen }\n if (!skip && startViewChange(url, pointer, reverse)) {\n setContext(Object.assign({}, next, { morph: true }))\n return\n }\n setContext(next)\n if (PANELS && !skip) {\n setPanelPhase('covering')\n }\n if (REVEAL && !skip) {\n // Without View Transitions the two pages overlap: the leaving page is\n // held under the arriving one until that has fully opened (or, should\n // the arrival never complete, a little after its time).\n const reveal = { leavingKey: routeKeyRef.current, arrivingKey: routeKeyOf(url) }\n reveal.opened = new Promise((resolve) => {\n reveal.open = resolve\n })\n reveal.finish = () => {\n reveal.open()\n if (revealRef.current === reveal) {\n revealRef.current = null\n setOverKey(null)\n }\n }\n revealRef.current = reveal\n setOverKey(reveal.arrivingKey)\n setTimeout(reveal.finish, DURATION * 1000 + PICTURE_WAIT_MS + 1000)\n }\n setFrozen({ key: routeKeyRef.current, top: window.scrollY || 0 })\n }\n const onRouteChangeError = () => {\n if (changeRef.current) {\n abandon(changeRef.current)\n }\n }\n router.events.on('routeChangeStart', onRouteChangeStart)\n router.events.on('routeChangeError', onRouteChangeError)\n return () => {\n router.events.off('routeChangeStart', onRouteChangeStart)\n router.events.off('routeChangeError', onRouteChangeError)\n router.beforePopState(() => true)\n }\n }, [router])\n\n if (!variants) {\n return children\n }\n\n const frozenStyle =\n frozen && frozen.key === routeKey\n ? { position: 'fixed', top: -frozen.top, left: 0, right: 0 }\n : undefined\n const pageStyle = frozenStyle || (overKey === routeKey ? OVER : undefined)\n\n const onExitComplete = () => {\n setFrozen(null)\n // The panels open once the arriving page's pictures are ready (setPage).\n if (PANELS && panelPhase === 'covering') {\n setPanelPhase('covered')\n }\n }\n // The page revealed over the leaving one has fully opened: let the leaving page go.\n const onPageAnimationComplete = (definition) => {\n const reveal = revealRef.current\n if (definition === 'animate' && reveal && reveal.arrivingKey === routeKey) {\n reveal.finish()\n }\n }\n\n return (\n <>\n <AnimatePresence mode={context.morph || !REVEAL ? 'wait' : 'sync'} initial={false} onExitComplete={onExitComplete}>\n <motion.div\n key={routeKey}\n ref={setPage}\n initial=\"initial\"\n animate={readyKey === routeKey ? 'animate' : 'initial'}\n exit=\"exit\"\n variants={variants}\n transition={{ duration: DURATION, ease: EASE }}\n onUpdate={REVEAL ? stepByFrame : undefined}\n onAnimationComplete={onPageAnimationComplete}\n style={pageStyle}\n data-tq-page-transition={routeKey}\n >\n {children}\n {VT_CSS ? <HoldPage pageKey={routeKey} changeRef={changeRef} revealRef={revealRef} /> : null}\n </motion.div>\n </AnimatePresence>\n {PANELS\n ? PANELS.map((panel, index) => (\n <motion.div\n key={index}\n aria-hidden=\"true\"\n data-tq-page-transition-panel={index}\n style={Object.assign({}, PANEL_BASE, panelBounds(panel))}\n initial={panel.from}\n animate={panelPhase === 'covering' || panelPhase === 'covered' ? panel.cover : panelPhase === 'uncovering' ? panel.away : panel.from}\n transition={panelPhase === 'idle' ? { duration: 0 } : { duration: DURATION, ease: EASE }}\n onAnimationComplete={() => {\n if (panelPhase === 'uncovering') {\n setPanelPhase('idle')\n }\n }}\n />\n ))\n : null}\n {VT_CSS ? <style dangerouslySetInnerHTML={{ __html: VT_CSS }} /> : null}\n </>\n )\n}\n\nexport default TqPageTransition\n");
89
+ return "import React from 'react'\nimport { useRouter } from 'next/router'\nimport { AnimatePresence, motion, usePresence } from 'framer-motion'\n\n".concat(teleport_shared_1.PageTransition.PAGE_TRANSITION_HELPER_SOURCES.reversePageTransitionPreset, "\n\n").concat(teleport_shared_1.PageTransition.PAGE_TRANSITION_HELPER_SOURCES.pageTransitionVariants, "\n\n").concat(teleport_shared_1.PageTransition.PAGE_TRANSITION_HELPER_SOURCES.pageTransitionCover, "\n\n").concat(teleport_shared_1.PageTransition.PAGE_TRANSITION_HELPER_SOURCES.pageTransitionSkipPattern, "\n\n").concat(reveal_on_screen_source_generated_1.REVEAL_ON_SCREEN_SOURCES.revealOnScreen, "\n\n").concat(morphHelpersSource(), "\n\nconst PRESET = '").concat(preset, "'\n// The preset's choices, resolved to words the variants understand.\nconst OPTIONS = ").concat(JSON.stringify(options), "\nconst CUSTOM = ").concat(JSON.stringify(custom), "\nconst ORIGIN_FROM_POINTER = ").concat(options.origin !== 'center', "\nconst DURATION = ").concat(duration, "\nconst EASE = [").concat(curve.join(', '), "]\nconst SLIDE_PX = ").concat(page_transition_variants_1.PAGE_TRANSITION_SLIDE_PX, "\nconst CENTER = { reverse: false, skip: false, originX: '50%', originY: '50%' }\nconst PANELS = pageTransitionCover(PRESET)\n// Pages that opted out: they appear instantly; leaving them still plays.\nconst SKIP_ROUTES = ").concat(JSON.stringify(skipRoutes), "\nconst INSTANT = { initial: {}, animate: {}, exit: {} }\n// A reveal (Circle, the Wipes): the arriving page opens over the leaving one.\n// Without View Transitions it runs frame by frame, framer writing each\n// clip-path onto the page: run by the browser (framer's default for clip-path),\n// the animation ends one frame before framer writes its last value, and for\n// that frame the page shows its starting clip \u2014 the whole page blinks away as\n// the reveal completes. An onUpdate handler, even one that does nothing, keeps\n// the animation in framer's own loop.\nconst REVEAL = (() => {\n const variants = pageTransitionVariants(PRESET, SLIDE_PX, CENTER, OPTIONS, CUSTOM || undefined)\n return !!(variants && variants.animate.clipPath)\n})()\nconst stepByFrame = () => {}\n// Without View Transitions the two pages overlap for a reveal: the arriving\n// page is laid above the frozen one (a positioned box would paint on top of it).\nconst OVER = { position: 'relative', zIndex: 1 }\nconst SKIP_PATTERNS = SKIP_ROUTES.map(pageTransitionSkipPattern)\nconst isSkippedRoute = (key) => SKIP_PATTERNS.some((pattern) => pattern.test(key))\n// The cover family paints its panels in the theme colour the editor chose.\nconst PANEL_COLOR = '").concat((0, page_transition_variants_1.pageTransitionCoverColor)(options.color), "'\nconst PANEL_BASE = { position: 'fixed', top: 0, bottom: 0, zIndex: 2147483000, pointerEvents: 'none', background: PANEL_COLOR }\nconst panelBounds = (panel) =>\n panel.side === 'left' ? { left: 0, right: '50%' } : panel.side === 'right' ? { left: '50%', right: 0 } : { left: 0, right: 0 }\n\nconst routeKeyOf = (url) => String(url || '').split(/[?#]/)[0]\n\n// The page changes played as a View Transition (a reveal; a flying picture), as\n// the static export plays them.\nconst VT_CSS = ").concat(JSON.stringify(vtCss), "\nconst FLIES = ").concat(flies, "\n// A page that takes longer than this to arrive switches without the transition.\nconst ARRIVAL_WAIT_MS = 3000\n// An arriving picture still loading is waited for this long, so the flight lands on it.\nconst MORPH_DECODE_MS = 300\n// The arriving page waits this long at most for the pictures on its first screen.\nconst PICTURE_WAIT_MS = 300\nconst prefersLessMotion = () =>\n !!(window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches)\n// Settles once the pictures on the arriving page's first screen are decoded, or\n// after PICTURE_WAIT_MS: an image the page asks to decode off the main thread\n// paints a few frames after the rest of the page.\nconst picturesReady = (node) => {\n const pictures = Array.prototype.filter.call(node.querySelectorAll('img'), (image) => {\n const box = image.getBoundingClientRect()\n return box.bottom > 0 && box.top < window.innerHeight && typeof image.decode === 'function'\n })\n return Promise.race([\n Promise.all(pictures.map((image) => image.decode().catch(() => {}))),\n new Promise((resolve) => setTimeout(resolve, PICTURE_WAIT_MS)),\n ])\n}\n\n// Keeps the leaving page in the document while it is still needed: until the\n// browser has pictured it (a View Transition), or until the page revealed over\n// it has fully opened (a reveal without View Transitions).\nconst HoldPage = ({ pageKey, changeRef, revealRef }) => {\n const [isPresent, safeToRemove] = usePresence()\n React.useEffect(() => {\n if (isPresent) {\n return\n }\n const change = changeRef.current\n const reveal = revealRef.current\n if (change && change.leavingKey === pageKey) {\n change.captured.then(safeToRemove)\n } else if (reveal && reveal.leavingKey === pageKey) {\n reveal.opened.then(safeToRemove)\n } else {\n safeToRemove()\n }\n }, [isPresent])\n return null\n}\n\nconst TqPageTransition = ({ children }) => {\n const router = useRouter()\n const routeKey = routeKeyOf(router.asPath)\n const routeKeyRef = React.useRef(routeKey)\n routeKeyRef.current = routeKey\n const [frozen, setFrozen] = React.useState(null)\n const [context, setContext] = React.useState(CENTER)\n const [panelPhase, setPanelPhase] = React.useState('idle')\n // The page being revealed over the leaving one without View Transitions.\n const [overKey, setOverKey] = React.useState(null)\n // The page whose arrival may play: the first page at once, every later one\n // once its first screen's pictures are ready.\n const [readyKey, setReadyKey] = React.useState(routeKey)\n const readyKeyRef = React.useRef(routeKey)\n const pageRef = React.useRef(null)\n const popRef = React.useRef(false)\n const pointerRef = React.useRef(null)\n const clickedRef = React.useRef(null)\n const changeRef = React.useRef(null)\n const revealRef = React.useRef(null)\n const variants = React.useMemo(\n () =>\n context.skip || context.morph\n ? INSTANT\n : revealOnScreen(pageTransitionVariants(PRESET, SLIDE_PX, context, OPTIONS, CUSTOM || undefined), context.screen),\n [context]\n )\n\n // The arriving page is in the document: wait for the pictures on its first\n // screen (and, in a View Transition, for its twin of the flying picture),\n // then let it play \u2014 or let the browser picture the new state.\n const setPage = React.useCallback((node) => {\n pageRef.current = node\n const key = node ? node.getAttribute('data-tq-page-transition') : null\n if (key === null || key === readyKeyRef.current) {\n return\n }\n readyKeyRef.current = key\n const change = changeRef.current\n const landing = change && !change.landed && node !== change.leaving ? change : null\n let twin = null\n if (landing) {\n landing.landed = true\n tqMorphClear()\n twin = landing.src ? tqMorphTarget(landing.src) : null\n if (twin) {\n twin.style.viewTransitionName = TQ_MORPH_NAME\n }\n }\n const twinReady =\n twin && !twin.complete && typeof twin.decode === 'function'\n ? Promise.race([\n twin.decode().catch(() => {}),\n new Promise((resolve) => setTimeout(resolve, MORPH_DECODE_MS)),\n ])\n : Promise.resolve()\n Promise.all([picturesReady(node), twinReady]).then(() => {\n // A later page may have arrived meanwhile; this one's turn has passed.\n if (readyKeyRef.current === key) {\n setReadyKey(key)\n setPanelPhase((phase) => (phase === 'covered' ? 'uncovering' : phase))\n }\n if (landing) {\n landing.arrive()\n }\n })\n }, [])\n\n React.useEffect(() => {\n const onPointerDown = (event) => {\n pointerRef.current = { x: event.clientX, y: event.clientY }\n }\n const onClick = (event) => {\n clickedRef.current = event.target && event.target.closest ? event.target.closest('a[href]') : null\n }\n window.addEventListener('pointerdown', onPointerDown, true)\n window.addEventListener('click', onClick, true)\n return () => {\n window.removeEventListener('pointerdown', onPointerDown, true)\n window.removeEventListener('click', onClick, true)\n }\n }, [])\n\n React.useEffect(() => {\n router.beforePopState(() => {\n popRef.current = true\n return true\n })\n const root = document.documentElement\n const abandon = (change) => {\n if (!change.landed) {\n change.landed = true\n change.transition.skipTransition()\n change.arrive()\n }\n }\n // The page change as a View Transition: every reveal, and a picture in the\n // followed link that the next page shows too (going forward only).\n const startViewChange = (url, pointer, reverse) => {\n if (!VT_CSS || !pageRef.current || typeof document.startViewTransition !== 'function' || prefersLessMotion()) {\n return false\n }\n const image = FLIES && !reverse ? tqMorphSource(url, clickedRef.current) : null\n if (!image && !REVEAL) {\n return false\n }\n const change = { leavingKey: routeKeyRef.current, leaving: pageRef.current, src: image ? image.currentSrc || image.src : null, landed: false }\n change.captured = new Promise((resolve) => {\n change.onCaptured = resolve\n })\n const arrived = new Promise((resolve) => {\n change.arrive = resolve\n })\n tqMorphClear()\n if (image) {\n image.style.viewTransitionName = TQ_MORPH_NAME\n }\n if (reverse) {\n root.setAttribute('").concat(BACK_ATTR, "', 'back')\n }\n if (pointer) {\n root.style.setProperty('").concat(ORIGIN_X, "', pointer.x + 'px')\n root.style.setProperty('").concat(ORIGIN_Y, "', pointer.y + 'px')\n }\n const settle = () => {\n if (changeRef.current === change) {\n changeRef.current = null\n tqMorphClear()\n root.removeAttribute('").concat(BACK_ATTR, "')\n root.style.removeProperty('").concat(ORIGIN_X, "')\n root.style.removeProperty('").concat(ORIGIN_Y, "')\n }\n }\n changeRef.current = change\n try {\n change.transition = document.startViewTransition(() => {\n change.onCaptured()\n return arrived\n })\n } catch (error) {\n settle()\n return false\n }\n change.transition.ready.catch(() => {})\n change.transition.finished.then(settle, settle)\n setTimeout(() => abandon(change), ARRIVAL_WAIT_MS)\n return true\n }\n const onRouteChangeStart = (url) => {\n if (routeKeyOf(url) === routeKeyRef.current) {\n return\n }\n const reverse = popRef.current\n popRef.current = false\n // A skipped page appears instantly; leaving it still plays the site's transition.\n // A visitor who asks for less motion gets every page that way. It is read\n // here, never while rendering: the server cannot know it, and a first render\n // that differs from the server's makes React throw the page away.\n const skip = prefersLessMotion() || isSkippedRoute(routeKeyOf(url))\n const pointer = reverse || !ORIGIN_FROM_POINTER ? null : pointerRef.current\n // A reveal is measured on this screen (revealOnScreen); without a press it\n // grows from the screen's centre, not the page's.\n const screen = { width: window.innerWidth, height: window.innerHeight }\n const origin = pointer || { x: screen.width / 2, y: screen.height / 2 }\n const next = { reverse, skip, originX: origin.x + 'px', originY: origin.y + 'px', screen }\n if (!skip && startViewChange(url, pointer, reverse)) {\n setContext(Object.assign({}, next, { morph: true }))\n return\n }\n setContext(next)\n if (PANELS && !skip) {\n setPanelPhase('covering')\n }\n if (REVEAL && !skip) {\n // Without View Transitions the two pages overlap: the leaving page is\n // held under the arriving one until that has fully opened (or, should\n // the arrival never complete, a little after its time).\n const reveal = { leavingKey: routeKeyRef.current, arrivingKey: routeKeyOf(url) }\n reveal.opened = new Promise((resolve) => {\n reveal.open = resolve\n })\n reveal.finish = () => {\n reveal.open()\n if (revealRef.current === reveal) {\n revealRef.current = null\n setOverKey(null)\n }\n }\n revealRef.current = reveal\n setOverKey(reveal.arrivingKey)\n setTimeout(reveal.finish, DURATION * 1000 + PICTURE_WAIT_MS + 1000)\n }\n setFrozen({ key: routeKeyRef.current, top: window.scrollY || 0 })\n }\n const onRouteChangeError = () => {\n if (changeRef.current) {\n abandon(changeRef.current)\n }\n }\n router.events.on('routeChangeStart', onRouteChangeStart)\n router.events.on('routeChangeError', onRouteChangeError)\n return () => {\n router.events.off('routeChangeStart', onRouteChangeStart)\n router.events.off('routeChangeError', onRouteChangeError)\n router.beforePopState(() => true)\n }\n }, [router])\n\n if (!variants) {\n return children\n }\n\n const frozenStyle =\n frozen && frozen.key === routeKey\n ? { position: 'fixed', top: -frozen.top, left: 0, right: 0 }\n : undefined\n const pageStyle = frozenStyle || (overKey === routeKey ? OVER : undefined)\n\n const onExitComplete = () => {\n setFrozen(null)\n // The panels open once the arriving page's pictures are ready (setPage).\n if (PANELS && panelPhase === 'covering') {\n setPanelPhase('covered')\n }\n }\n // The page revealed over the leaving one has fully opened: let the leaving page go.\n const onPageAnimationComplete = (definition) => {\n const reveal = revealRef.current\n if (definition === 'animate' && reveal && reveal.arrivingKey === routeKey) {\n reveal.finish()\n }\n }\n\n return (\n <>\n <AnimatePresence mode={context.morph || !REVEAL ? 'wait' : 'sync'} initial={false} onExitComplete={onExitComplete}>\n <motion.div\n key={routeKey}\n ref={setPage}\n initial=\"initial\"\n animate={readyKey === routeKey ? 'animate' : 'initial'}\n exit=\"exit\"\n variants={variants}\n transition={{ duration: DURATION, ease: EASE }}\n onUpdate={REVEAL ? stepByFrame : undefined}\n onAnimationComplete={onPageAnimationComplete}\n style={pageStyle}\n data-tq-page-transition={routeKey}\n >\n {children}\n {VT_CSS ? <HoldPage pageKey={routeKey} changeRef={changeRef} revealRef={revealRef} /> : null}\n </motion.div>\n </AnimatePresence>\n {PANELS\n ? PANELS.map((panel, index) => (\n <motion.div\n key={index}\n aria-hidden=\"true\"\n data-tq-page-transition-panel={index}\n style={Object.assign({}, PANEL_BASE, panelBounds(panel))}\n initial={panel.from}\n animate={panelPhase === 'covering' || panelPhase === 'covered' ? panel.cover : panelPhase === 'uncovering' ? panel.away : panel.from}\n transition={panelPhase === 'idle' ? { duration: 0 } : { duration: DURATION, ease: EASE }}\n onAnimationComplete={() => {\n if (panelPhase === 'uncovering') {\n setPanelPhase('idle')\n }\n }}\n />\n ))\n : null}\n {VT_CSS ? <style dangerouslySetInnerHTML={{ __html: VT_CSS }} /> : null}\n </>\n )\n}\n\nexport default TqPageTransition\n");
90
90
  };
91
91
  exports.generatePageTransitionComponentCode = generatePageTransitionComponentCode;
92
92
  //# sourceMappingURL=page-transition-component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-transition-component.js","sourceRoot":"","sources":["../../../src/page-transition/page-transition-component.ts"],"names":[],"mappings":";;;AAAA,+DAA4D;AAC5D,uEASmC;AACnC,uDAAmD;AAInD,IAAM,aAAa,GAAG,gCAAc,CAAC,6BAA6B,CAAA;AAC1D,IAAA,SAAS,GAAiE,gCAAc,UAA/E,EAAE,QAAQ,GAAuD,gCAAc,SAArE,EAAE,QAAQ,GAA6C,gCAAc,SAA3D,EAAE,kBAAkB,GAAyB,gCAAc,mBAAvC,EAAE,kBAAkB,GAAK,gCAAc,mBAAnB,CAAmB;AAEhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACI,IAAM,mCAAmC,GAAG,UAAC,MAA4B;;IAC9E,IAAM,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,aAAa,CAAC,UAAU,CAAC,CAAA;IACvE,IAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAA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C,SAAS,CAAC,KAAK,CAAC,6BACtB,KAAK,y6MAmKQ,SAAS,wFAGJ,QAAQ,mEACR,QAAQ,qNAMR,SAAS,sDACJ,QAAQ,sDACR,QAAQ,+8KAmJ9C,CAAA;AACD,CAAC,CAAA;AAzZY,QAAA,mCAAmC,uCAyZ/C"}
@@ -0,0 +1,4 @@
1
+ export declare const REVEAL_ON_SCREEN_SOURCES: {
2
+ revealOnScreen: string;
3
+ };
4
+ //# sourceMappingURL=reveal-on-screen-source.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-on-screen-source.generated.d.ts","sourceRoot":"","sources":["../../../src/page-transition/reveal-on-screen-source.generated.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,wBAAwB;;CAGpC,CAAA"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REVEAL_ON_SCREEN_SOURCES = void 0;
4
+ // Generated by scripts/function-sources.js from reveal-on-screen.ts. Do not edit:
5
+ // `node scripts/function-sources.js` rewrites it, and its drift test fails until it is current.
6
+ /* tslint:disable */
7
+ /* eslint-disable */
8
+ exports.REVEAL_ON_SCREEN_SOURCES = {
9
+ revealOnScreen: "function revealOnScreen(variants, screen) {\n if (!variants || !variants.animate.clipPath) {\n return variants;\n }\n var onScreen = function (clip) {\n if (!screen || typeof clip !== 'string') {\n return clip;\n }\n var circle = /^circle\\(([\\d.]+)% at ([\\d.]+)px ([\\d.]+)px\\)$/.exec(clip);\n if (circle) {\n var measure = Math.sqrt((screen.width * screen.width + screen.height * screen.height) / 2);\n var radius = (parseFloat(circle[1]) / 100) * measure;\n return 'circle(' + radius + 'px at ' + circle[2] + 'px ' + circle[3] + 'px)';\n }\n var inset = /^inset\\((\\S+) (\\S+) (\\S+) (\\S+)\\)$/.exec(clip);\n if (inset) {\n var share = function (value) { return (parseFloat(value) || 0) / 100; };\n var upper = share(inset[1]) * screen.height;\n var lower = screen.height - share(inset[3]) * screen.height;\n return ('inset(' +\n upper +\n 'px ' +\n share(inset[2]) * 100 +\n '% calc(100% - ' +\n lower +\n 'px) ' +\n share(inset[4]) * 100 +\n '%)');\n }\n return clip;\n };\n var arriving = function (state) {\n return state.clipPath === undefined\n ? state\n : Object.assign({}, state, { clipPath: onScreen(state.clipPath) });\n };\n return {\n initial: arriving(variants.initial),\n animate: Object.assign({}, arriving(variants.animate), {\n transitionEnd: { clipPath: 'none' },\n }),\n exit: {},\n };\n}",
10
+ };
11
+ //# sourceMappingURL=reveal-on-screen-source.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-on-screen-source.generated.js","sourceRoot":"","sources":["../../../src/page-transition/reveal-on-screen-source.generated.ts"],"names":[],"mappings":";;;AAAA,kFAAkF;AAClF,gGAAgG;AAChG,oBAAoB;AACpB,oBAAoB;AACP,QAAA,wBAAwB,GAAG;IACtC,cAAc,EACZ,upDAAupD;CAC1pD,CAAA"}