@neshel-ui/animations/page-transitions
Todas las exportaciones de @neshel-ui/animations/page-transitions, generadas desde sus declaraciones.
Experimental y no disponible en npm
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.
PageTransitioncomponentBoundary around route content: React `<ViewTransition>` with `neshel-pt-<effect>` (PT01, PT03–PT06).
({ effect, asChild, children, ...rest }: PageTransitionProps): ElementPersistentElementcomponentPT08: an element that stays in place (no motion, no cross-fade) while the page changes.
(props: NamedProps): ElementRouteProgresscomponentPT07: indeterminate, accessible navigation progress (never a fake percentage).
({ pending, failed, navigation, onTimeout, delay, minVisible, timeout, announce, labels, className, ref, ...rest }: RouteProgressProps): ElementSharedElementcomponentPT02: an element that morphs into the element with the same name on the next route.
(props: NamedProps): ElementcreateRouteProgressfunction(element: HTMLElement, options?: RouteProgressOptions | undefined): RouteProgressenableCrossDocumentTransitionsfunctionReturns the disposer; a no-op where cross-document transitions are unsupported.
(options?: CrossDocumentOptions | undefined): () => voidgetReactViewTransitionfunctionReact's `ViewTransition` when this React exports it (19.3+), else `undefined`.
(): ViewTransitionComponent | undefinedgetViewTransitionSupportfunctionCurrent capabilities (computed on every call: cheap, and test/polyfill friendly).
(): ViewTransitionSupportregisterSharedElementfunctionRegister an element under a shared name; returns the unregister function.
(element: Element, name: string, options?: { persist?: boolean | undefined; } | undefined): () => voidstartPageTransitionfunction(update: () => void | Promise<void>, options?: PageTransitionOptions | undefined): PageTransitiontrackNavigationDirectionfunction(options?: { onChange?(direction: NavigationDirection, type: NavigationType): void; } | undefined): DirectionTrackeruseNavigationDirectionfunctionPT04: the last navigation's direction (state changes only on navigation).
(): { direction: NavigationDirection; type: NavigationType; }usePageTransitionfunctionRouter-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; }useRouteTransitionfunctionRouter-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_ATTRIBUTEconst"data-neshel-pt-direction"EFFECT_ATTRIBUTEconst"data-neshel-pt-effect"PAGE_EFFECTSconstreadonly PageEffect[]CrossDocumentOptionsinterfaceCrossDocumentOptions
CrossDocumentOptions Prop Tipo Predeterminado Descripción effect PageEffect— — DirectionTrackerinterfaceDirectionTracker
DirectionTracker Prop Tipo Predeterminado Descripció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— — PageTransitionControlinterfacePageTransitionControl
PageTransitionControl Prop Tipo Predeterminado Descripció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). PageTransitionOptionsinterfacePageTransitionOptions
PageTransitionOptions Prop Tipo Predeterminado Descripción direction NavigationDirection | "auto"— — effect PageEffect— — fallback "none" | "flip""none"Elementos compartidos sin la API: FLIP desde la caja anterior (por defecto "none").maxWait number— ms que el navegador puede retener el dibujo para la actualización (0–10000, por defecto 1500). reducedMotion ReducedMotion— — scope Element— Elemento cuyo contenido cambia (por defecto: la raíz del documento). types readonly string[]— — PageTransitionPropsinterfacePageTransitionProps
PageTransitionProps Prop Tipo Predeterminado Descripción asChild boolean— — children ReactNode— — effect PageEffect"fade"Effect of the route content (default "fade").ref Ref<HTMLDivElement>— — También acepta las props de: React DOM attributes.
PageTransitionResultinterfacePageTransitionResult
PageTransitionResult Prop Tipo Predeterminado Descripción direction(obligatoria) NavigationDirection— — native(obligatoria) boolean— — status(obligatoria) "completed" | "skipped" | "interrupted"— — RouteProgressControlinterfaceRouteProgressControl
RouteProgressControl Prop Tipo Predeterminado Descripción cancel(obligatoria) () => void— — destroy(obligatoria) () => void— — done(obligatoria) () => void— — fail(obligatoria) () => void— — start(obligatoria) () => void— — state(obligatoria) RouteProgressState— — RouteProgressOptionsinterfaceRouteProgressOptions
RouteProgressOptions Prop Tipo Predeterminado Descripción announce booleanfalseAnuncia una vez la finalización o el fallo en una región de estado (por defecto false). delay number— ms antes de que aparezca la barra (0–2000, por defecto 120). labels Partial<Record<"loading" | "loaded" | "failed", string>>— — minVisible number— 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). timeout number— ms tras los que se cancela una navegación pendiente (1000–120000, por defecto 15000). RouteProgressPropsinterfaceRouteProgressProps
RouteProgressProps Prop Tipo Predeterminado Descripción announce booleanfalseAnuncia una vez la finalización o el fallo en una región de estado (por defecto false). delay number— ms antes de que aparezca la barra (0–2000, por defecto 120). failed boolean— The last navigation failed (shown when pendingturns false).labels Partial<Record<"loading" | "loaded" | "failed", string>>— — minVisible number— ms que sigue visible el estado completado o fallido (0–3000, por defecto 300). navigation string | 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. ref Ref<HTMLDivElement>— — timeout number— ms tras los que se cancela una navegación pendiente (1000–120000, por defecto 15000). También acepta las props de: React DOM attributes.
RouteTransitionInputinterfaceRouteTransitionInput
RouteTransitionInput Prop Tipo Predeterminado Descripción failed boolean— — 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). pending boolean— The router's real navigation state. type NavigationType— — StartOptionsinterfaceStartOptions
StartOptions Prop Tipo Predeterminado Descripción direction NavigationDirection | "auto"— — effect PageEffect— — fallback "none" | "flip""none"Elementos compartidos sin la API: FLIP desde la caja anterior (por defecto "none").maxWait number— ms que el navegador puede retener el dibujo para la actualización (0–10000, por defecto 1500). native boolean— Force the framework-free controller even when React manages view transitions. reducedMotion ReducedMotion— — scope Element— Elemento cuyo contenido cambia (por defecto: la raíz del documento). types readonly string[]— — ViewTransitionSupportinterfaceViewTransitionSupport
View Transition capability detection (Phase 013; contracts/page-transitions.md §2, research R1–R3). Behavioural checks per capability, never user-agent sniffing; all
falseon the server.ViewTransitionSupport Prop Tipo Predeterminado Descripció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 }).NavigationDirectiontypePT04 — 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"NavigationTypetype"push" | "replace" | "traverse" | "reload" | "unknown"PageEffecttype"fade" | "slide" | "scale" | "wipe" | "none"PageTransitionStatetype"pending" | "updating" | "animating" | "completed" | "skipped" | "interrupted" | "failed"RouteProgressStatetype"idle" | "pending" | "complete" | "failed"