Skip to Content
Neshel-UI
Animations (experimental)Reference

@neshel-ui/animations/page-transitions

Every export of @neshel-ui/animations/page-transitions, generated from its declarations.

Experimental and not on npm

@neshel-ui/animations is a private package (0.0.0). It cannot be installed, and its API may change before a first publication. These pages document what exists in the repository.

Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.

  • PageTransition component

    Boundary around route content: React `<ViewTransition>` with `neshel-pt-<effect>` (PT01, PT03–PT06).

    ({ effect, asChild, children, ...rest }: PageTransitionProps): Element
  • PersistentElement component

    PT08: an element that stays in place (no motion, no cross-fade) while the page changes.

    (props: NamedProps): Element
  • RouteProgress component

    PT07: indeterminate, accessible navigation progress (never a fake percentage).

    ({ pending, failed, navigation, onTimeout, delay, minVisible, timeout, announce, labels, className, ref, ...rest }: RouteProgressProps): Element
  • SharedElement component

    PT02: an element that morphs into the element with the same name on the next route.

    (props: NamedProps): Element
  • createRouteProgress function
    (element: HTMLElement, options?: RouteProgressOptions | undefined): RouteProgress
  • enableCrossDocumentTransitions function

    Returns the disposer; a no-op where cross-document transitions are unsupported.

    (options?: CrossDocumentOptions | undefined): () => void
  • getReactViewTransition function

    React's `ViewTransition` when this React exports it (19.3+), else `undefined`.

    (): ViewTransitionComponent | undefined
  • getViewTransitionSupport function

    Current capabilities (computed on every call: cheap, and test/polyfill friendly).

    (): ViewTransitionSupport
  • registerSharedElement function

    Register an element under a shared name; returns the unregister function.

    (element: Element, name: string, options?: { persist?: boolean | undefined; } | undefined): () => void
  • startPageTransition function
    (update: () => void | Promise<void>, options?: PageTransitionOptions | undefined): PageTransition
  • trackNavigationDirection function
    (options?: { onChange?(direction: NavigationDirection, type: NavigationType): void; } | undefined): DirectionTracker
  • useNavigationDirection function

    PT04: the last navigation's direction (state changes only on navigation).

    (): { direction: NavigationDirection; type: NavigationType; }
  • usePageTransition function

    Router-free page transitions: `start(update, options)` runs `update` (a state change) inside a React Transition with transition types when React manages view transitions, so React captures the real commit; otherwise inside `startPageTransition`, whose update resolves at the next commit of the component that called this hook (its layout effect) — or after `maxWait`, when the browser stops holding rendering.

    (): { start(update: () => void, options?: StartOptions | undefined): void; }
  • useRouteTransition function

    Router-independent contract (PT10): coordinates with the COMMITTED location (a layout effect after React committed the new route, never a click), moves focus only after a push/replace commit to an element the application marked, and reports the direction. Never intercepts links or history events.

    ({ location, type, focus }: RouteTransitionInput): { direction: NavigationDirection; }
  • DIRECTION_ATTRIBUTE const
    "data-neshel-pt-direction"
  • EFFECT_ATTRIBUTE const
    "data-neshel-pt-effect"
  • PAGE_EFFECTS const
    readonly PageEffect[]
  • CrossDocumentOptions interface

    CrossDocumentOptions

    CrossDocumentOptions
    PropTypeDefaultDescription
    effectPageEffect——
  • DirectionTracker interface

    DirectionTracker

    DirectionTracker
    PropTypeDefaultDescription
    destroy(required)() => void——
    direction(required)NavigationDirection——
    set(required)(direction: NavigationDirection, type?: NavigationType) => void—Router-provided direction (when the Navigation API is unavailable or the router knows better).
    type(required)NavigationType——
  • PageTransitionControl interface

    PageTransitionControl

    PageTransitionControl
    PropTypeDefaultDescription
    direction(required)NavigationDirection——
    finished(required)Promise<PageTransitionResult>—Resolves when everything is cleaned up; rejects only when the update failed.
    native(required)boolean——
    skip(required)() => void——
    state(required)PageTransitionState——
    updated(required)Promise<void>—Resolves when the update ran (rejects with its error).
  • PageTransitionOptions interface

    PageTransitionOptions

    PageTransitionOptions
    PropTypeDefaultDescription
    directionNavigationDirection | "auto"——
    effectPageEffect——
    fallback"none" | "flip""none"Shared elements without the API: FLIP from the old box (default "none").
    maxWaitnumber—ms the browser may hold rendering for the update (0–10000, default 1500).
    reducedMotionReducedMotion——
    scopeElement—Element whose content changes (default: the document root).
    typesreadonly string[]——
  • PageTransitionProps interface

    PageTransitionProps

    PageTransitionProps
    PropTypeDefaultDescription
    asChildboolean——
    childrenReactNode——
    effectPageEffect"fade"Effect of the route content (default "fade").
    refRef<HTMLDivElement>——

    Also accepts the props of: React DOM attributes.

  • PageTransitionResult interface

    PageTransitionResult

    PageTransitionResult
    PropTypeDefaultDescription
    direction(required)NavigationDirection——
    native(required)boolean——
    status(required)"completed" | "skipped" | "interrupted"——
  • RouteProgressControl interface

    RouteProgressControl

    RouteProgressControl
    PropTypeDefaultDescription
    cancel(required)() => void——
    destroy(required)() => void——
    done(required)() => void——
    fail(required)() => void——
    start(required)() => void——
    state(required)RouteProgressState——
  • RouteProgressOptions interface

    RouteProgressOptions

    RouteProgressOptions
    PropTypeDefaultDescription
    announcebooleanfalseAnnounce completion/failure once in a status region (default false).
    delaynumber—ms before the bar appears (0–2000, default 120).
    labelsPartial<Record<"loading" | "loaded" | "failed", string>>——
    minVisiblenumber—ms the completed/failed state stays visible (0–3000, default 300).
    onTimeout() => void—Called when the watchdog cancels a navigation that never settled (the owner should clear its state).
    timeoutnumber—ms after which a pending navigation is cancelled (1000–120000, default 15000).
  • RouteProgressProps interface

    RouteProgressProps

    RouteProgressProps
    PropTypeDefaultDescription
    announcebooleanfalseAnnounce completion/failure once in a status region (default false).
    delaynumber—ms before the bar appears (0–2000, default 120).
    failedboolean—The last navigation failed (shown when pending turns false).
    labelsPartial<Record<"loading" | "loaded" | "failed", string>>——
    minVisiblenumber—ms the completed/failed state stays visible (0–3000, default 300).
    navigationstring | number—Identity of the current navigation: a new value while still pending restarts the indicator.
    onTimeout() => void—Called when the watchdog cancels a navigation that never settled (the owner should clear its state).
    pending(required)boolean—The router's real pending state.
    refRef<HTMLDivElement>——
    timeoutnumber—ms after which a pending navigation is cancelled (1000–120000, default 15000).

    Also accepts the props of: React DOM attributes.

  • RouteTransitionInput interface

    RouteTransitionInput

    RouteTransitionInput
    PropTypeDefaultDescription
    failedboolean——
    focus"auto" | "none""auto"After a committed push/replace, focus [data-neshel-route-focus] (default "auto").
    location(required)string—Committed location (pathname + search, or a router key).
    pendingboolean—The router's real navigation state.
    typeNavigationType——
  • StartOptions interface

    StartOptions

    StartOptions
    PropTypeDefaultDescription
    directionNavigationDirection | "auto"——
    effectPageEffect——
    fallback"none" | "flip""none"Shared elements without the API: FLIP from the old box (default "none").
    maxWaitnumber—ms the browser may hold rendering for the update (0–10000, default 1500).
    nativeboolean—Force the framework-free controller even when React manages view transitions.
    reducedMotionReducedMotion——
    scopeElement—Element whose content changes (default: the document root).
    typesreadonly string[]——
  • ViewTransitionSupport interface

    ViewTransitionSupport

    View Transition capability detection (Phase 013; contracts/page-transitions.md §2, research R1–R3). Behavioural checks per capability, never user-agent sniffing; all false on the server.

    ViewTransitionSupport
    PropTypeDefaultDescription
    classes(required)boolean—view-transition-class.
    crossDocument(required)boolean—Cross-document transitions (@view-transition, pagereveal).
    navigationApi(required)boolean—Navigation API with history entry indexes (direction detection).
    sameDocument(required)boolean—document.startViewTransition (same-document transitions).
    types(required)boolean—Transition types (:active-view-transition-type(), { types }).
  • NavigationDirection type

    PT04 — Navigation direction (contracts/page-transitions.md §4, research R3). With the Navigation API, every `navigate` event decides the direction from history entry indexes (never from URLs): push → forward, replace/reload → replace, traverse → back or forward by comparing `destination.index` with `currentEntry.index`. The tracker writes `data-neshel-pt-direction` on `<html>` synchronously in the event — before any router updates the DOM — so CSS and React's own view transitions see it. A `replace` to the current URL is router state bookkeeping and leaves the direction alone. Without the API, routers may call `set()`; otherwise the direction stays `"unknown"` and direction-aware effects use their neutral variant. One shared listener, reference-counted.

    "forward" | "back" | "replace" | "unknown"
  • NavigationType type
    "push" | "replace" | "traverse" | "reload" | "unknown"
  • PageEffect type
    "fade" | "slide" | "scale" | "wipe" | "none"
  • PageTransitionState type
    "pending" | "updating" | "animating" | "completed" | "skipped" | "interrupted" | "failed"
  • RouteProgressState type
    "idle" | "pending" | "complete" | "failed"
Edit on GitHub