@neshel-ui/animations/layout
Todas las exportaciones de @neshel-ui/animations/layout, 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.
AnimatedListcomponentA list whose items enter and exit (L03) while the remaining items FLIP into place (L01).
(props: AnimatedListProps): ElementAutoHeightcomponentA wrapper whose height follows its content smoothly (async content, text growing).
(props: AutoHeightProps): ElementCollapsecomponentAn expanding/collapsing panel (L06). Wire your trigger with `aria-expanded` and `aria-controls={id}`; the closed content stays in the DOM (`hidden="until-found"` where supported). Needs `layout.css`.
(props: CollapseProps): ElementCrossFadecomponentContent cross-fade swap (L09): old and new content overlap in one grid cell; the height follows (L02).
(props: CrossFadeProps): ElementLayoutItemcomponentAn element that FLIPs to its new layout box whenever an update of its group moves or resizes it.
(props: LayoutItemProps): ElementMasonrycomponentA masonry grid (row spans from observed heights) whose reflows animate (L10). Needs `layout.css`.
(props: MasonryProps): ElementPresencecomponent(props: PresenceProps): ElementReflowcomponentChildren animate whenever the container reflows (resize, column change, size change) — no renders.
(props: ReflowProps): ElementTabIndicatorcomponentA sliding indicator under the active tab (package-rendered layer; CSS transition on it only).
(props: TabIndicatorProps): ElementcreateLayoutGroupfunction(): LayoutGroupcreatePresencefunction<T>(): Presence<T>getLayoutDebugInfofunction(): LayoutDebugInfomeasureBoxfunctionLayout box of an element (offset chain + `offsetWidth/Height`), or the bounding box plus scroll for non-HTML elements (their transforms are then included — documented).
(element: Element): BoxuseIsPresentfunctionWhether this component is present (`false` while it exits).
(): booleanuseLayoutGroupfunctionThe nearest `<LayoutGroup>`'s group (`null` outside one): `snapshot()` / `play()` for imperative changes.
(): LayoutGroup | nulluseLayoutItemfunctionAttach the FLIP effect of the nearest group to `ref` (for custom components; see `<LayoutItem>`).
(ref: RefObject<Element | null>, options?: LayoutItemOptions | undefined): voidusePresencefunction`[isPresent, safeToRemove]` for a custom child of `<Presence>`; `[true, noop]` outside one.
(): [boolean, () => void]autoHeightconstReadonly<EffectDefinition<AutoHeightOptions, ResolvedHeight>>collapseconstReadonly<EffectDefinition<CollapseOptions, ResolvedCollapse>>crossFadeconstReadonly<EffectDefinition<CrossFadeOptions, ResolvedCrossFade>>flipMoveconstReadonly<EffectDefinition<FlipMoveOptions, ResolvedFlip>>gridReflowconstReadonly<EffectDefinition<GridReflowOptions, ResolvedReflow>>layoutEffectsconstEvery layout definition in catalogue order (L01–L07, L09, L10; L08 is `<Presence>`), for registries.
readonly AnyEffectDefinition[]listItemconstReadonly<EffectDefinition<ListItemOptions, ResolvedListItem>>masonryconstReadonly<EffectDefinition<MasonryOptions, ResolvedMasonry>>sharedLayoutconstReadonly<EffectDefinition<SharedLayoutOptions, ResolvedFlip>>tabIndicatorconstReadonly<EffectDefinition<TabIndicatorOptions, ResolvedIndicator>>LayoutGroupclassOwns a layout group for the items rendered inside it (L01, L03, L04).
AnimatedListPropsinterfaceAnimatedListProps
AnimatedListProps Prop Tipo Predeterminado Descripción as "ul" | "ol" | "div""ul"List element (default "ul").children ReactNode— Keyed items, each accepting a ref. duration number240Item enter/exit duration in ms (default 240). initial booleanfalseAnimate the first render's items (default false). onExitComplete (key: string) => void— — reducedMotion ReducedMotion— — ref Ref<HTMLElement>— — transition LayoutTransition— — También acepta las props de: React DOM attributes.
AutoHeightOptionsinterfaceAutoHeightOptions
L02 — Altura automática: la altura del elemento sigue a la altura observada de su contenido.
AutoHeightOptions Prop Tipo Predeterminado Descripción duration number | DurationPreset280ms o preset (por defecto 280). easing Easing | EasingPreset— — reducedMotion ReducedMotion— — AutoHeightPropsinterfaceAutoHeightProps
AutoHeightProps Prop Tipo Predeterminado Descripción children ReactNode— — duration number | DurationPreset— — easing Easing | EasingPreset— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — También acepta las props de: React DOM attributes.
BoxinterfaceBox
A layout box in document coordinates (transforms ignored).
Box Prop Tipo Predeterminado Descripción height(obligatoria) number— — width(obligatoria) number— — x(obligatoria) number— — y(obligatoria) number— — CollapseOptionsinterfaceCollapseOptions
L06 — Altura de acordeón (contrae / expande un panel del paquete).
CollapseOptions Prop Tipo Predeterminado Descripción driver "auto" | "css" | "js"— "auto"(por defecto): CSSinterpolate-sizedonde existe; si no, WAAPI medido.duration number | DurationPreset280ms o preset (por defecto 280). easing Easing | EasingPreset— — onRequestOpen () => void— La búsqueda en la página encontró contenido oculto: pide abrir el panel. open boolean— Estado expandido (controlado por ti). reducedMotion ReducedMotion— — CollapsePropsinterfaceCollapseProps
CollapseProps Prop Tipo Predeterminado Descripción children ReactNode— — driver "auto" | "css" | "js"— "auto"(por defecto): CSSinterpolate-sizedonde existe; si no, WAAPI medido.duration number | DurationPreset280ms o preset (por defecto 280). easing Easing | EasingPreset— — onRequestOpen () => void— La búsqueda en la página encontró contenido oculto: pide abrir el panel. open(obligatoria) boolean— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — También acepta las props de: React DOM attributes.
CrossFadeOptionsinterfaceCrossFadeOptions
L09 — Fundido de contenido (una capa del cambio;
<CrossFade>apila dos).CrossFadeOptions Prop Tipo Predeterminado Descripción appear boolean— Aparece con fundido al adjuntarse visible (por defecto false: el contenido SSR sigue visible). duration number | DurationPreset— — easing Easing | EasingPreset— — onHidden () => void— Se llama cada vez que la capa ha desaparecido. reducedMotion ReducedMotion— — visible boolean— Visible (aparece) u oculta (desaparece). Por defecto true. CrossFadePropsinterfaceCrossFadeProps
CrossFadeProps Prop Tipo Predeterminado Descripción children ReactNode— — duration number— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — swapKey(obligatoria) string | number— Change it to swap the content (old and new cross-fade while the height follows). También acepta las props de: React DOM attributes.
FlipMoveOptionsinterfaceFlipMoveOptions
L01 — Movimiento / reordenación FLIP (y L04, layout compartido con
layoutId).FlipMoveOptions Prop Tipo Predeterminado Descripción group LayoutGroup— El grupo cuyo ciclo snapshot/play anima este elemento ( createLayoutGroup();<LayoutGroup>).layout LayoutMode"position"Qué se anima (por defecto "position";"size"/"both"añaden una escala no uniforme).reducedMotion ReducedMotion— — transition LayoutTransition— — GridReflowOptionsinterfaceGridReflowOptions
L05 — Reflujo de cuadrícula.
GridReflowOptions Prop Tipo Predeterminado Descripción reducedMotion ReducedMotion— — transition LayoutTransition— — LayoutDebugInfointerfaceLayoutDebugInfo
LayoutDebugInfo Prop Tipo Predeterminado Descripción observers(obligatoria) number— — plays(obligatoria) number— — reads(obligatoria) number— — reflows(obligatoria) number— — snapshots(obligatoria) number— — watchdog(obligatoria) number— — LayoutEntryinterfaceLayoutEntry
LayoutEntry Prop Tipo Predeterminado Descripción animate(obligatoria) () => boolean— falsewhile motion is reduced: changes are applied without animation.animator(obligatoria) FlipAnimator— — layout(obligatoria) LayoutMode— — layoutId(obligatoria) string | undefined— — LayoutGroupHandleinterfaceLayoutGroupHandle
LayoutGroupHandle Prop Tipo Predeterminado Descripción destroy(obligatoria) () => void— — play(obligatoria) () => void— Measure the new boxes in the next read phase and animate the changes. register(obligatoria) (element: Element, entry: LayoutEntry) => () => void— Register an element; returns the unregister function. size(obligatoria) number— — snapshot(obligatoria) () => void— Read every registered box (once per pending change; further calls are no-ops until play).LayoutItemOptionsinterfaceLayoutItemOptions
LayoutItemOptions Prop Tipo Predeterminado Descripción layout LayoutMode— — layoutId string— Shared-layout id (L04): a new element with the same id animates from the old one's box. reducedMotion ReducedMotion— — transition LayoutTransition— — LayoutItemPropsinterfaceLayoutItemProps
LayoutItemProps Prop Tipo Predeterminado Descripción asChild boolean— Apply to the single child element instead of rendering a <div>.children ReactNode— — layout LayoutMode— — layoutId string— Shared-layout id (L04): a new element with the same id animates from the old one's box. reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — transition LayoutTransition— — También acepta las props de: React DOM attributes.
ListItemOptionsinterfaceListItemOptions
L03 — Entrada / salida de un elemento de lista (opacidad, 4 % de escala y 8 px; los hermanos hacen FLIP en un grupo).
ListItemOptions Prop Tipo Predeterminado Descripción appear boolean— Anima la primera aparición (por defecto true; <AnimatedList>pone false en los iniciales).duration number | DurationPreset— — easing Easing | EasingPreset— — onExited () => void— — present boolean— Presente (entra) o saliendo (sale y después llama a onExited). Por defecto true.reducedMotion ReducedMotion— — MasonryOptionsinterfaceMasonryOptions
L10 — Reflujo de mampostería.
MasonryOptions Prop Tipo Predeterminado Descripción columns number— Número fijo de columnas (1–12); omitido: tantas de minColumnWidthcomo quepan.gap number— Separación en px (0–96, por defecto 16). minColumnWidth number— Ancho mínimo de columna en px cuando se omite columns(80–800, por defecto 220).reducedMotion ReducedMotion— — transition LayoutTransition— — unit number— Unidad de fila en px para los tramos (1–32, por defecto 4). MasonryPropsinterfaceMasonryProps
MasonryProps Prop Tipo Predeterminado Descripción children ReactNode— — columns number— Número fijo de columnas (1–12); omitido: tantas de minColumnWidthcomo quepan.gap number— Separación en px (0–96, por defecto 16). minColumnWidth number— Ancho mínimo de columna en px cuando se omite columns(80–800, por defecto 220).reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — transition LayoutTransition— — unit number— Unidad de fila en px para los tramos (1–32, por defecto 4). También acepta las props de: React DOM attributes.
PresenceEntryinterfacePresenceEntry
PresenceEntry Prop Tipo Predeterminado Descripción generation(obligatoria) number— Increments on every status change; removeonly acts on the generation it was given.key(obligatoria) string— — status(obligatoria) PresenceStatus— — value(obligatoria) T— — PresencePropsinterfacePresenceProps
PresenceProps Prop Tipo Predeterminado Descripción children ReactNode— Elementos con key renderizados sin contenedor. Cada uno debe aceptar una ref que llegue a su elemento del DOM (los elementos nativos lo hacen; los componentes deben pasar ref), para dejar inerte el contenido que sale y retirarle el foco.duration number220Duración del fundido incluido en ms (por defecto 220). enter AnyPreset— Definición o preset de entrada para los hijos que entran (por defecto: el fundido incluido). exit AnyPreset— Definición o preset de entrada para los hijos que salen (por defecto: el fundido incluido). focusFallback RefObject<HTMLElement | null>— Destino del foco cuando estaba en un hijo que sale y ningún hermano presente puede recibirlo. initial boolean— Anima también los hijos del primer render (por defecto false: el contenido del servidor sigue visible). onExitComplete (key: string) => void— Se llama una vez por key eliminada, tras su salida. PresenceStateinterfacePresenceState
PresenceState Prop Tipo Predeterminado Descripción entries(obligatoria) readonly PresenceEntry<T>[]— — flush(obligatoria) () => boolean— Remove every exiting entry at once (container unmount, hidden page). remove(obligatoria) (key: string, generation: number) => boolean— An exit finished: remove the key if it is still exiting in generation.update(obligatoria) (next: ReadonlyArray<{ key: string; value: T; }>) => boolean— Merge the next ordered children; returns whether anything changed. ReflowPropsinterfaceReflowProps
ReflowProps Prop Tipo Predeterminado Descripción asChild boolean— — children ReactNode— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — transition LayoutTransition— — También acepta las props de: React DOM attributes.
SharedLayoutOptionsinterfaceTabIndicatorOptionsinterfaceTabIndicatorOptions
L07 — Indicador de pestaña deslizante (indicador del paquete dentro de la lista de pestañas).
TabIndicatorOptions Prop Tipo Predeterminado Descripción active Element | number | null— La pestaña activa: un elemento, su índice entre las pestañas ( [role="tab"], si no los hijos) o null.duration number | DurationPreset— — easing Easing | EasingPreset— — orientation "horizontal" | "vertical"— — reducedMotion ReducedMotion— — TabIndicatorPropsinterfaceTabIndicatorProps
TabIndicatorProps Prop Tipo Predeterminado Descripción active Element | number | null— La pestaña activa: un elemento, su índice entre las pestañas ( [role="tab"], si no los hijos) o null.asChild boolean— Apply to your tab list element instead of rendering a <div>.children ReactNode— — duration number | DurationPreset— — easing Easing | EasingPreset— — orientation "horizontal" | "vertical"— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — También acepta las props de: React DOM attributes.
LayoutModetype"position" | "size" | "both"LayoutTransitiontypeLayoutTransition
Transition of layout animations: a spring (default) or a tween.
LayoutTransition Prop Tipo Predeterminado Descripción duration number | DurationPreset— — easing Easing | EasingPreset— — spring SpringOptions | SpringPreset— — type(obligatoria) "spring" | "tween"— — PresenceStatustypePresence state machine (Phase 012, shared from `src/core` since Phase 015 by `./layout` L08 and `./feedback` F06; contracts/layout-engine.md §7, research R8). Framework-free and pure: it merges successive keyed child lists, keeping removed keys in place as `exiting` until `remove(key, generation)` confirms their exit, and turning re-added keys back to `present`. Timers, animations and focus live in the caller (the React `<Presence>` item); every transition is idempotent, so a repeated `update` with the same list (StrictMode double render) changes nothing.
"present" | "exiting"