Claude Cursor Skill

capgo-transitions

Adds native-feeling iOS/Android push, pop and root page transitions to Capacitor apps with @capgo/capacitor-transitions (Cap-go/capacitor-transitions, v9.x for Capacitor 9, v8.x for Capacitor 8). Web-only library, no native code - custom elements (`cap-router-outlet`, `cap-page`,

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download cap-go-capgo-skills-skills_capgo-transitions-76462e3.zip · 18 KB

Install

skills CLI npx skills add https://github.com/Cap-go/capgo-skills/tree/main/skills/capgo-transitions
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install cap-go-capgo-skills@llmmart
Git git clone https://github.com/Cap-go/capgo-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole cap-go/capgo-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Capgo Page Transitions

@capgo/capacitor-transitions gives Ionic-quality page transitions without Ionic's design system. It is a web-only package (custom elements + thin framework helpers), so there is nothing to cap sync and no Capacitor peer dependency.

When to Use

TRIGGER when:

  • A Capacitor app built with React, Vue, Svelte, Solid, Angular, Next.js, Nuxt, SvelteKit, TanStack or vanilla JS swaps routes instantly and should push/pop like a native app
  • The user wants iOS-style slide-in/slide-out or Android-style rise/fade between pages
  • The user wants the iOS edge swipe-back gesture in a WebView app
  • Router replace / onboarding-done / logout flows must reset the back stack but still animate
  • The package @capgo/capacitor-transitions or tags cap-router-outlet / cap-page appear in the code

Do not use:

  • Native navigation bar or tab bar owned by the native layer: capgo-native-navigation (it combines with this skill; see Patterns)
  • Bottom sheets, drawers, modal sheets: capgo-sheets
  • Ionic apps using ion-router-outlet / ion-nav: those already animate; use ionic-design
  • Sticky hover, tap highlight, overscroll bounce, input zoom: capacitor-native-feel
  • Notch / status bar overlap: safe-area-handling

Default recommendation: for a non-Ionic Capacitor app that needs push/pop page transitions, use this package rather than hand-written CSS transitions or a framework transition component.

Install

npm install @capgo/capacitor-transitions@^9   # Capacitor 9
npm install @capgo/capacitor-transitions@^8   # Capacitor 8

Entry points (from package.json exports): @capgo/capacitor-transitions (core + web components), /react, /vue, /svelte, /solid. Each adapter subpath imports and registers the custom elements. Angular and vanilla use the root entry.

Layout prerequisite: the outlet sets itself to height: 100%, so every ancestor must have a height (html, body, #root { height: 100%; }).

Quick Start

Vanilla / any framework (markup):

<cap-router-outlet platform="auto" swipe-gesture="auto">
  <cap-page>
    <cap-header slot="header"><h1>Inbox</h1></cap-header>
    <cap-content slot="content">...</cap-content>
    <cap-footer slot="footer"><nav>Tabs</nav></cap-footer>
  </cap-page>
</cap-router-outlet>
import '@capgo/capacitor-transitions';
const outlet = document.querySelector('cap-router-outlet')!;
await outlet.push(pageEl);                          // forward slide
await outlet.pop();                                 // back slide
await outlet.setRoot(homeEl, { direction: 'forward' }); // reset stack, forward slide

React (React Router):

import { setupRouterOutlet, setupPage, setDirection, setNavigation } from '@capgo/capacitor-transitions/react';

function App() {
  const outletRef = useRef<HTMLElement>(null);
  useEffect(() => {
    if (outletRef.current) setupRouterOutlet(outletRef.current, { platform: 'auto', swipeGesture: 'auto' });
  }, []);
  return (
    <cap-router-outlet ref={outletRef}>
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/details/:id" element={<Details />} />
      </Routes>
    </cap-router-outlet>
  );
}
// in a page: setDirection('forward'); navigate(`/details/${id}`);

Vue (Vue Router) - also add isCustomElement: (tag) => tag.startsWith('cap-') to the Vue compiler options:

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { setupRouterOutlet } from '@capgo/capacitor-transitions/vue';
const outletRef = ref<HTMLElement | null>(null);
onMounted(() => outletRef.value && setupRouterOutlet(outletRef.value, { platform: 'auto' }));
</script>
<template>
  <cap-router-outlet ref="outletRef"><router-view /></cap-router-outlet>
</template>

Svelte / SvelteKit:

<script>
  import { routerOutlet } from '@capgo/capacitor-transitions/svelte';
  import '@capgo/capacitor-transitions';
</script>
<cap-router-outlet use:routerOutlet={{ platform: 'auto' }}><slot /></cap-router-outlet>

Solid, Angular, Next.js, Nuxt, TanStack: see references/frameworks.md.

Every routed page renders one <cap-page> as the direct child of the outlet (Angular renders its component host element instead).

Core Concepts

  • Outlet observes the DOM. cap-router-outlet uses a MutationObserver. When the router adds a new child, it animates from the current page to the new one. If the router removes the old page first, the outlet re-inserts it temporarily so the leaving animation is visible.
  • Direction is an intent set before navigating. setDirection(d) writes data-direction on every outlet; the next added page consumes it. Without an intent, the outlet infers: popstate / History index decrease / a URL already in its history => back; same URL => none; otherwise forward. A data-direction attribute on the page element wins over the outlet's.
  • Stack action vs. animation. setNavigation(action, direction?) separates what happens to the stack (forward push, back pop, root clear, none replace top) from the animation. setNavigation('root', 'forward') slides forward but leaves no back entry (swipe-back disabled).
  • Directions: forward (iOS: slide in from right; Android: rise 40px + fade in), back (reverse), root (fade), none (instant).
  • Platform: platform="auto" picks by user agent (iPhone/iPad/iPod => ios, Android => android, else ios). Defaults: iOS 540ms cubic-bezier(0.32, 0.72, 0, 1); Android 280ms forward / 200ms back.
  • Pinned chrome. On iOS, header and footer of the moving pages are counter-translated so bars stay put while page bodies slide; direct toolbar children (h1-h3, button, a, .toolbar > *, [role="toolbar"] > *, [data-cap-toolbar-item]) slide and fade like UIKit titles.
  • Caching. keep-in-dom (default true) keeps up to max-cached (default 10) previous pages in the DOM.
  • Each outlet owns its own TransitionController. initTransitions() from an adapter creates a separate controller that outlets do not read. Configure outlets via attributes / setupRouterOutlet, and use outlet.getController().configure({...}) for easing, useViewTransitions, respectReducedMotion, manageFocus.

Full API: references/api.md. Gesture, reduced motion, focus, View Transitions internals: references/behavior.md.

Reference Map

Load When
references/api.md You need exact attributes, methods, helper signatures, exported core functions, types or constants
references/frameworks.md Wiring a specific router: React Router, TanStack Router/Start, Next.js, Vue Router, Nuxt, Svelte, SvelteKit, Solid Router, Angular Router, vanilla History
references/behavior.md Debugging direction inference, swipe-back thresholds and ignored targets, reduced motion, focus management, View Transitions, @capgo/native-navigation pairing

Patterns

Push / pop with a router. Call the helper right before the router call, every time:

setDirection('forward'); navigate(`/item/${id}`);
setDirection('back');    navigate(-1);            // or history.back()
setNavigation('root', 'forward'); navigate('/home', { replace: true }); // onboarding done
setNavigation('root', 'root');    navigate('/login', { replace: true }); // logout, fade

Wrap once with createTransitionNavigate(navigate) => go('/path'), go('/', 'back') (passes only to; use the helpers directly for router options such as replace).

Tab switches without animation. Tabs are siblings, not a stack. Use setNavigation('root', 'none') before switching to a tab root: instant swap, back stack cleared, swipe-back cannot return to the previous tab. setDirection('none') alone is not enough: the controller still pushes the page onto its stack.

Modal-style screens. The package has no modal/present transition; TransitionConfig.enterKeyframes, leaveKeyframes, targets and RouterOutletOptions.animation are declared in types but not used by the 9.0.1 source. Use capgo-sheets for sheets, or setNavigation('forward', 'root') for a fade-in page that still keeps a back entry.

Swipe-back. swipe-gesture="auto" (default) enables the 50px left-edge gesture only when Capacitor.isNativePlatform() and platform is ios. Force with true / false or outlet.setSwipeGesture(...). On commit the outlet calls window.history.back() (when history.length > 1) and skips the second animation, so the router must render the previous route on popstate. Mark horizontal carousels or sliders with data-swipe-back-ignore.

Native bars (@capgo/native-navigation). Keep the native navbar out of <cap-header>; use <cap-content slot="content" fullscreen> and pad with var(--cap-native-navigation-top) / var(--cap-native-navigation-bottom). On the native navbarBack event call setDirection('back') then router.back().

Lifecycle. setupPage(el, { onWillEnter, onDidEnter, onWillLeave, onDidLeave }) (Svelte: use:page={...}) listens for cap-will-enter, cap-did-enter, cap-will-leave, cap-did-leave on <cap-page> and returns a cleanup function. See trap below before relying on them.

Traps

  • Lifecycle events may never fire. In the 9.0.1 source, cap-page dispatches cap-*-enter/leave only from its own willEnter()/didEnter()/willLeave()/didLeave() methods, and neither the outlet nor the controller calls them; controller hooks run only for controller.registerLifecycle(pageId, ...) with the internal page id. Verify events on device before depending on them; for data loading use the framework's mount hooks or route guards.
  • Forgetting setDirection('back') on in-app back buttons that call navigate('/') makes the outlet see a new URL and slide forward. Prefer navigate(-1) / history.back(), or always set the direction.
  • Double animation. Do not also wrap pages in Vue <Transition>, Nuxt pageTransition, Svelte transition:, React Router viewTransition, SvelteKit onNavigate + startViewTransition, or CSS route animations. One system only. useViewTransitions (off by default) is a second path; enable it only if you removed the others.
  • Scroll restoration. Pages scroll inside cap-content (overflow: auto), not the window, so router scroll restoration (ScrollRestoration, Vue Router scrollBehavior, window.scrollTo) does nothing. Most routers mount a fresh element on back, and the outlet removes the stale cached one, so the old scroll offset is lost. Persist contentEl.scrollTop per route yourself (cap-content emits bubbling cap-scroll with { x, y } and has saveScrollPosition(), restoreScrollPosition(pos), scrollToTop()).
  • Fixed headers. During a transition the page element is transformed, so any position: fixed element inside cap-page becomes relative to the moving page and slides with it. Put bars in cap-header/cap-footer slots; keep truly global fixed UI outside the outlet.
  • fullscreen only sets data-fullscreen="true" on cap-content; you write the CSS that lets content run under the header.
  • Reduce Motion. With prefers-reduced-motion: reduce, slides become a 200ms crossfade (default respectReducedMotion: true); interactive swipe still tracks the finger. Do not add your own reduced-motion override on top. Opt out only with outlet.getController().configure({ respectReducedMotion: false }).
  • duration 0 does not disable animation. The controller treats 0 as "use platform default", and the Vue/Svelte/Solid helpers skip falsy durations. Use direction none.
  • Vue / Nuxt without isCustomElement for cap-* warns "Failed to resolve component" and may treat tags as components.
  • React TypeScript errors on cap-router-outlet in JSX: add src/capgo-transitions.d.ts containing import '@capgo/capacitor-transitions/react'; and include it in tsconfig.json.
  • SSR frameworks. Custom elements need the browser. Use static export (Next.js output: 'export', SvelteKit adapter-static, Nuxt ssr: false) as Capacitor requires anyway, and call initTransitions only on the client.
  • Background flash. cap-page paints var(--cap-page-background, Canvas); set --cap-page-background to your app background or pages look white/black mid-slide.

Verify on Device

  1. npm run build && npx cap copy (no cap sync needed for this package alone), run on a physical iPhone and an Android device.
  2. Navigate forward, back via in-app button, back via Android system back, and (iOS) swipe from the left edge: each must animate once in the right direction, with no flash and no double slide.
  3. Swipe halfway and release slowly: page springs back. Flick quickly: completes. Swipe on a carousel: does not trigger back.
  4. Reset flows (setNavigation('root', ...)): after landing, edge swipe must do nothing.
  5. Turn on iOS Settings > Accessibility > Motion > Reduce Motion (Android: Remove animations): navigation becomes a crossfade.
  6. In Safari Web Inspector / chrome://inspect, check document.querySelector('cap-router-outlet').stackLength and .canGoBack match the visible history.

Resources

Files (capgo-skills)
  • references
    • api.md 10.4 KB
      Loading…
    • behavior.md 7.1 KB
      Loading…
    • frameworks.md 12.2 KB
      Loading…
  • metadata.json 1.3 KB
    Loading…
  • SKILL.md 14.3 KB
    ---
    name: capgo-transitions
    description: Adds native-feeling iOS/Android push, pop and root page transitions to Capacitor apps with @capgo/capacitor-transitions (Cap-go/capacitor-transitions, v9.x for Capacitor 9, v8.x for Capacitor 8). Web-only library, no native code - custom elements (`cap-router-outlet`, `cap-page`, `cap-header`, `cap-content`, `cap-footer`) plus helpers for React (React Router, TanStack Router, Next.js static export), Vue (Vue Router, Nuxt), Svelte/SvelteKit, Solid, Angular and vanilla JS. Covers `setDirection` / `setNavigation` before router calls, interactive iOS edge swipe-back (`swipe-gesture`), page caching (`keep-in-dom`, `max-cached`), reduced-motion crossfade, focus management, optional View Transitions API. Use when a non-Ionic Capacitor app swaps pages with no animation or feels like a website when navigating, or when adding swipe-back. Do not use for native navbar/tabbar (capgo-native-navigation), bottom sheets/drawers (capgo-sheets), or Ionic's built-in ion-router-outlet animations (ionic-design).
    ---
    
    # Capgo Page Transitions
    
    `@capgo/capacitor-transitions` gives Ionic-quality page transitions without Ionic's design system. It is a web-only package (custom elements + thin framework helpers), so there is nothing to `cap sync` and no Capacitor peer dependency.
    
    ## When to Use
    
    TRIGGER when:
    - A Capacitor app built with React, Vue, Svelte, Solid, Angular, Next.js, Nuxt, SvelteKit, TanStack or vanilla JS swaps routes instantly and should push/pop like a native app
    - The user wants iOS-style slide-in/slide-out or Android-style rise/fade between pages
    - The user wants the iOS edge swipe-back gesture in a WebView app
    - Router `replace` / onboarding-done / logout flows must reset the back stack but still animate
    - The package `@capgo/capacitor-transitions` or tags `cap-router-outlet` / `cap-page` appear in the code
    
    Do not use:
    - Native navigation bar or tab bar owned by the native layer: `capgo-native-navigation` (it combines with this skill; see Patterns)
    - Bottom sheets, drawers, modal sheets: `capgo-sheets`
    - Ionic apps using `ion-router-outlet` / `ion-nav`: those already animate; use `ionic-design`
    - Sticky hover, tap highlight, overscroll bounce, input zoom: `capacitor-native-feel`
    - Notch / status bar overlap: `safe-area-handling`
    
    Default recommendation: for a non-Ionic Capacitor app that needs push/pop page transitions, use this package rather than hand-written CSS transitions or a framework transition component.
    
    ## Install
    
    ```bash
    npm install @capgo/capacitor-transitions@^9   # Capacitor 9
    npm install @capgo/capacitor-transitions@^8   # Capacitor 8
    ```
    
    Entry points (from `package.json` `exports`): `@capgo/capacitor-transitions` (core + web components), `/react`, `/vue`, `/svelte`, `/solid`. Each adapter subpath imports and registers the custom elements. Angular and vanilla use the root entry.
    
    Layout prerequisite: the outlet sets itself to `height: 100%`, so every ancestor must have a height (`html, body, #root { height: 100%; }`).
    
    ## Quick Start
    
    Vanilla / any framework (markup):
    
    ```html
    <cap-router-outlet platform="auto" swipe-gesture="auto">
      <cap-page>
        <cap-header slot="header"><h1>Inbox</h1></cap-header>
        <cap-content slot="content">...</cap-content>
        <cap-footer slot="footer"><nav>Tabs</nav></cap-footer>
      </cap-page>
    </cap-router-outlet>
    ```
    
    ```ts
    import '@capgo/capacitor-transitions';
    const outlet = document.querySelector('cap-router-outlet')!;
    await outlet.push(pageEl);                          // forward slide
    await outlet.pop();                                 // back slide
    await outlet.setRoot(homeEl, { direction: 'forward' }); // reset stack, forward slide
    ```
    
    React (React Router):
    
    ```tsx
    import { setupRouterOutlet, setupPage, setDirection, setNavigation } from '@capgo/capacitor-transitions/react';
    
    function App() {
      const outletRef = useRef<HTMLElement>(null);
      useEffect(() => {
        if (outletRef.current) setupRouterOutlet(outletRef.current, { platform: 'auto', swipeGesture: 'auto' });
      }, []);
      return (
        <cap-router-outlet ref={outletRef}>
          <Routes>
            <Route path="/" element={<Home />} />
            <Route path="/details/:id" element={<Details />} />
          </Routes>
        </cap-router-outlet>
      );
    }
    // in a page: setDirection('forward'); navigate(`/details/${id}`);
    ```
    
    Vue (Vue Router) - also add `isCustomElement: (tag) => tag.startsWith('cap-')` to the Vue compiler options:
    
    ```vue
    <script setup lang="ts">
    import { ref, onMounted } from 'vue';
    import { setupRouterOutlet } from '@capgo/capacitor-transitions/vue';
    const outletRef = ref<HTMLElement | null>(null);
    onMounted(() => outletRef.value && setupRouterOutlet(outletRef.value, { platform: 'auto' }));
    </script>
    <template>
      <cap-router-outlet ref="outletRef"><router-view /></cap-router-outlet>
    </template>
    ```
    
    Svelte / SvelteKit:
    
    ```svelte
    <script>
      import { routerOutlet } from '@capgo/capacitor-transitions/svelte';
      import '@capgo/capacitor-transitions';
    </script>
    <cap-router-outlet use:routerOutlet={{ platform: 'auto' }}><slot /></cap-router-outlet>
    ```
    
    Solid, Angular, Next.js, Nuxt, TanStack: see [references/frameworks.md](references/frameworks.md).
    
    Every routed page renders one `<cap-page>` as the direct child of the outlet (Angular renders its component host element instead).
    
    ## Core Concepts
    
    - **Outlet observes the DOM.** `cap-router-outlet` uses a MutationObserver. When the router adds a new child, it animates from the current page to the new one. If the router removes the old page first, the outlet re-inserts it temporarily so the leaving animation is visible.
    - **Direction is an intent set before navigating.** `setDirection(d)` writes `data-direction` on every outlet; the next added page consumes it. Without an intent, the outlet infers: `popstate` / History index decrease / a URL already in its history => `back`; same URL => `none`; otherwise `forward`. A `data-direction` attribute on the page element wins over the outlet's.
    - **Stack action vs. animation.** `setNavigation(action, direction?)` separates what happens to the stack (`forward` push, `back` pop, `root` clear, `none` replace top) from the animation. `setNavigation('root', 'forward')` slides forward but leaves no back entry (swipe-back disabled).
    - **Directions:** `forward` (iOS: slide in from right; Android: rise 40px + fade in), `back` (reverse), `root` (fade), `none` (instant).
    - **Platform:** `platform="auto"` picks by user agent (iPhone/iPad/iPod => ios, Android => android, else ios). Defaults: iOS 540ms `cubic-bezier(0.32, 0.72, 0, 1)`; Android 280ms forward / 200ms back.
    - **Pinned chrome.** On iOS, header and footer of the moving pages are counter-translated so bars stay put while page bodies slide; direct toolbar children (`h1`-`h3`, `button`, `a`, `.toolbar > *`, `[role="toolbar"] > *`, `[data-cap-toolbar-item]`) slide and fade like UIKit titles.
    - **Caching.** `keep-in-dom` (default `true`) keeps up to `max-cached` (default 10) previous pages in the DOM.
    - **Each outlet owns its own `TransitionController`.** `initTransitions()` from an adapter creates a separate controller that outlets do not read. Configure outlets via attributes / `setupRouterOutlet`, and use `outlet.getController().configure({...})` for `easing`, `useViewTransitions`, `respectReducedMotion`, `manageFocus`.
    
    Full API: [references/api.md](references/api.md). Gesture, reduced motion, focus, View Transitions internals: [references/behavior.md](references/behavior.md).
    
    ## Reference Map
    
    | Load | When |
    |------|------|
    | [references/api.md](references/api.md) | You need exact attributes, methods, helper signatures, exported core functions, types or constants |
    | [references/frameworks.md](references/frameworks.md) | Wiring a specific router: React Router, TanStack Router/Start, Next.js, Vue Router, Nuxt, Svelte, SvelteKit, Solid Router, Angular Router, vanilla History |
    | [references/behavior.md](references/behavior.md) | Debugging direction inference, swipe-back thresholds and ignored targets, reduced motion, focus management, View Transitions, `@capgo/native-navigation` pairing |
    
    ## Patterns
    
    **Push / pop with a router.** Call the helper right before the router call, every time:
    
    ```ts
    setDirection('forward'); navigate(`/item/${id}`);
    setDirection('back');    navigate(-1);            // or history.back()
    setNavigation('root', 'forward'); navigate('/home', { replace: true }); // onboarding done
    setNavigation('root', 'root');    navigate('/login', { replace: true }); // logout, fade
    ```
    
    Wrap once with `createTransitionNavigate(navigate)` => `go('/path')`, `go('/', 'back')` (passes only `to`; use the helpers directly for router options such as `replace`).
    
    **Tab switches without animation.** Tabs are siblings, not a stack. Use `setNavigation('root', 'none')` before switching to a tab root: instant swap, back stack cleared, swipe-back cannot return to the previous tab. `setDirection('none')` alone is not enough: the controller still pushes the page onto its stack.
    
    **Modal-style screens.** The package has no modal/present transition; `TransitionConfig.enterKeyframes`, `leaveKeyframes`, `targets` and `RouterOutletOptions.animation` are declared in types but not used by the 9.0.1 source. Use `capgo-sheets` for sheets, or `setNavigation('forward', 'root')` for a fade-in page that still keeps a back entry.
    
    **Swipe-back.** `swipe-gesture="auto"` (default) enables the 50px left-edge gesture only when `Capacitor.isNativePlatform()` and platform is `ios`. Force with `true` / `false` or `outlet.setSwipeGesture(...)`. On commit the outlet calls `window.history.back()` (when `history.length > 1`) and skips the second animation, so the router must render the previous route on `popstate`. Mark horizontal carousels or sliders with `data-swipe-back-ignore`.
    
    **Native bars (`@capgo/native-navigation`).** Keep the native navbar out of `<cap-header>`; use `<cap-content slot="content" fullscreen>` and pad with `var(--cap-native-navigation-top)` / `var(--cap-native-navigation-bottom)`. On the native `navbarBack` event call `setDirection('back')` then `router.back()`.
    
    **Lifecycle.** `setupPage(el, { onWillEnter, onDidEnter, onWillLeave, onDidLeave })` (Svelte: `use:page={...}`) listens for `cap-will-enter`, `cap-did-enter`, `cap-will-leave`, `cap-did-leave` on `<cap-page>` and returns a cleanup function. See trap below before relying on them.
    
    ## Traps
    
    - **Lifecycle events may never fire.** In the 9.0.1 source, `cap-page` dispatches `cap-*-enter/leave` only from its own `willEnter()`/`didEnter()`/`willLeave()`/`didLeave()` methods, and neither the outlet nor the controller calls them; controller hooks run only for `controller.registerLifecycle(pageId, ...)` with the internal page id. Verify events on device before depending on them; for data loading use the framework's mount hooks or route guards.
    - **Forgetting `setDirection('back')` on in-app back buttons** that call `navigate('/')` makes the outlet see a new URL and slide forward. Prefer `navigate(-1)` / `history.back()`, or always set the direction.
    - **Double animation.** Do not also wrap pages in Vue `<Transition>`, Nuxt `pageTransition`, Svelte `transition:`, React Router `viewTransition`, SvelteKit `onNavigate` + `startViewTransition`, or CSS route animations. One system only. `useViewTransitions` (off by default) is a second path; enable it only if you removed the others.
    - **Scroll restoration.** Pages scroll inside `cap-content` (`overflow: auto`), not the window, so router scroll restoration (`ScrollRestoration`, Vue Router `scrollBehavior`, `window.scrollTo`) does nothing. Most routers mount a fresh element on back, and the outlet removes the stale cached one, so the old scroll offset is lost. Persist `contentEl.scrollTop` per route yourself (`cap-content` emits bubbling `cap-scroll` with `{ x, y }` and has `saveScrollPosition()`, `restoreScrollPosition(pos)`, `scrollToTop()`).
    - **Fixed headers.** During a transition the page element is transformed, so any `position: fixed` element inside `cap-page` becomes relative to the moving page and slides with it. Put bars in `cap-header`/`cap-footer` slots; keep truly global fixed UI outside the outlet.
    - **`fullscreen` only sets `data-fullscreen="true"`** on `cap-content`; you write the CSS that lets content run under the header.
    - **Reduce Motion.** With `prefers-reduced-motion: reduce`, slides become a 200ms crossfade (default `respectReducedMotion: true`); interactive swipe still tracks the finger. Do not add your own reduced-motion override on top. Opt out only with `outlet.getController().configure({ respectReducedMotion: false })`.
    - **`duration` 0 does not disable animation.** The controller treats 0 as "use platform default", and the Vue/Svelte/Solid helpers skip falsy durations. Use direction `none`.
    - **Vue / Nuxt** without `isCustomElement` for `cap-*` warns "Failed to resolve component" and may treat tags as components.
    - **React TypeScript** errors on `cap-router-outlet` in JSX: add `src/capgo-transitions.d.ts` containing `import '@capgo/capacitor-transitions/react';` and include it in `tsconfig.json`.
    - **SSR frameworks.** Custom elements need the browser. Use static export (Next.js `output: 'export'`, SvelteKit `adapter-static`, Nuxt `ssr: false`) as Capacitor requires anyway, and call `initTransitions` only on the client.
    - **Background flash.** `cap-page` paints `var(--cap-page-background, Canvas)`; set `--cap-page-background` to your app background or pages look white/black mid-slide.
    
    ## Verify on Device
    
    1. `npm run build && npx cap copy` (no `cap sync` needed for this package alone), run on a physical iPhone and an Android device.
    2. Navigate forward, back via in-app button, back via Android system back, and (iOS) swipe from the left edge: each must animate once in the right direction, with no flash and no double slide.
    3. Swipe halfway and release slowly: page springs back. Flick quickly: completes. Swipe on a carousel: does not trigger back.
    4. Reset flows (`setNavigation('root', ...)`): after landing, edge swipe must do nothing.
    5. Turn on iOS Settings > Accessibility > Motion > Reduce Motion (Android: Remove animations): navigation becomes a crossfade.
    6. In Safari Web Inspector / `chrome://inspect`, check `document.querySelector('cap-router-outlet').stackLength` and `.canGoBack` match the visible history.
    
    ## Resources
    
    - Docs: https://capgo.app/docs/plugins/transitions/
    - Source and examples (React, Vue, Angular, Svelte, SvelteKit, Solid, TanStack, Next.js, Nuxt): https://github.com/Cap-go/capacitor-transitions
    - npm: https://www.npmjs.com/package/@capgo/capacitor-transitions
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.