Saltar al contenido
Neshel-UI
Animaciones (experimental)Referencia

@neshel-ui/animations/page-transitions

Todas las exportaciones de @neshel-ui/animations/page-transitions, generadas desde sus declaraciones.

Experimental y no disponible en npm

@neshel-ui/animations es un paquete privado (0.0.0). No se puede instalar y su API puede cambiar antes de una primera publicación. Estas páginas documentan lo que existe en el repositorio.

Firmas, miembros y valores por defecto, generados desde las declaraciones compiladas. Las explicaciones y los ejemplos están en la guía.

Las descripciones de esta referencia se generan desde el código fuente del paquete y se muestran en inglés; las guías y el catálogo están en español.

  • 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
    PropTipoPredeterminadoDescripción
    effectPageEffect——
  • DirectionTracker interface

    DirectionTracker

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

    PageTransitionControl

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

    PageTransitionOptions

    PageTransitionOptions
    PropTipoPredeterminadoDescripción
    directionNavigationDirection | "auto"——
    effectPageEffect——
    fallback"none" | "flip""none"Elementos compartidos sin la API: FLIP desde la caja anterior (por defecto "none").
    maxWaitnumber—ms que el navegador puede retener el dibujo para la actualización (0–10000, por defecto 1500).
    reducedMotionReducedMotion——
    scopeElement—Elemento cuyo contenido cambia (por defecto: la raíz del documento).
    typesreadonly string[]——
  • PageTransitionProps interface

    PageTransitionProps

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

    También acepta las props de: React DOM attributes.

  • PageTransitionResult interface

    PageTransitionResult

    PageTransitionResult
    PropTipoPredeterminadoDescripción
    direction(obligatoria)NavigationDirection——
    native(obligatoria)boolean——
    status(obligatoria)"completed" | "skipped" | "interrupted"——
  • RouteProgressControl interface

    RouteProgressControl

    RouteProgressControl
    PropTipoPredeterminadoDescripción
    cancel(obligatoria)() => void——
    destroy(obligatoria)() => void——
    done(obligatoria)() => void——
    fail(obligatoria)() => void——
    start(obligatoria)() => void——
    state(obligatoria)RouteProgressState——
  • RouteProgressOptions interface

    RouteProgressOptions

    RouteProgressOptions
    PropTipoPredeterminadoDescripción
    announcebooleanfalseAnuncia una vez la finalización o el fallo en una región de estado (por defecto false).
    delaynumber—ms antes de que aparezca la barra (0–2000, por defecto 120).
    labelsPartial<Record<"loading" | "loaded" | "failed", string>>——
    minVisiblenumber—ms que sigue visible el estado completado o fallido (0–3000, por defecto 300).
    onTimeout() => void—Se llama cuando el vigilante cancela una navegación que nunca termina (su dueño debe limpiar su estado).
    timeoutnumber—ms tras los que se cancela una navegación pendiente (1000–120000, por defecto 15000).
  • RouteProgressProps interface

    RouteProgressProps

    RouteProgressProps
    PropTipoPredeterminadoDescripción
    announcebooleanfalseAnuncia una vez la finalización o el fallo en una región de estado (por defecto false).
    delaynumber—ms antes de que aparezca la barra (0–2000, por defecto 120).
    failedboolean—The last navigation failed (shown when pending turns false).
    labelsPartial<Record<"loading" | "loaded" | "failed", string>>——
    minVisiblenumber—ms que sigue visible el estado completado o fallido (0–3000, por defecto 300).
    navigationstring | number—Identity of the current navigation: a new value while still pending restarts the indicator.
    onTimeout() => void—Se llama cuando el vigilante cancela una navegación que nunca termina (su dueño debe limpiar su estado).
    pending(obligatoria)boolean—The router's real pending state.
    refRef<HTMLDivElement>——
    timeoutnumber—ms tras los que se cancela una navegación pendiente (1000–120000, por defecto 15000).

    También acepta las props de: React DOM attributes.

  • RouteTransitionInput interface

    RouteTransitionInput

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

    StartOptions

    StartOptions
    PropTipoPredeterminadoDescripción
    directionNavigationDirection | "auto"——
    effectPageEffect——
    fallback"none" | "flip""none"Elementos compartidos sin la API: FLIP desde la caja anterior (por defecto "none").
    maxWaitnumber—ms que el navegador puede retener el dibujo para la actualización (0–10000, por defecto 1500).
    nativeboolean—Force the framework-free controller even when React manages view transitions.
    reducedMotionReducedMotion——
    scopeElement—Elemento cuyo contenido cambia (por defecto: la raíz del documento).
    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
    PropTipoPredeterminadoDescripción
    classes(obligatoria)boolean—view-transition-class.
    crossDocument(obligatoria)boolean—Cross-document transitions (@view-transition, pagereveal).
    navigationApi(obligatoria)boolean—Navigation API with history entry indexes (direction detection).
    sameDocument(obligatoria)boolean—document.startViewTransition (same-document transitions).
    types(obligatoria)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"
Editar en GitHub