1 line
56 KiB
Plaintext
1 line
56 KiB
Plaintext
{"version":3,"file":"start.mjs","sources":["../../../src/view/start.ts"],"sourcesContent":["import { secondsToMilliseconds, warnOnce } from \"motion-utils\"\nimport { GroupAnimation } from \"../animation/GroupAnimation\"\nimport { NativeAnimation } from \"../animation/NativeAnimation\"\nimport { NativeAnimationWrapper } from \"../animation/NativeAnimationWrapper\"\nimport { AnimationPlaybackControls, DOMKeyframesDefinition } from \"../animation/types\"\nimport { getValueTransition } from \"../animation/utils/get-value-transition\"\nimport { mapEasingToNativeEasing } from \"../animation/waapi/easing/map-easing\"\nimport { applyGeneratorOptions } from \"../animation/waapi/utils/apply-generator\"\nimport { cornerRadiusProps } from \"../utils/border-radius\"\nimport { ElementOrSelector, resolveElements } from \"../utils/resolve-elements\"\nimport type { ViewTransitionBuilder } from \"./index\"\nimport { ViewTransitionTarget, ViewTransitionTargetDefinition } from \"./types\"\nimport {\n assignViewTransitionNames,\n releaseViewTransitionNames,\n} from \"./utils/assign-names\"\nimport { chooseLayerType } from \"./utils/choose-layer-type\"\nimport { css } from \"./utils/css\"\nimport { getViewAnimationLayerInfo } from \"./utils/get-layer-info\"\nimport { getViewAnimations } from \"./utils/get-view-animations\"\nimport { hasTarget } from \"./utils/has-target\"\n\nconst definitionNames = [\"layout\", \"enter\", \"exit\", \"new\", \"old\"] as const\n\ntype CornerRadii = Record<(typeof cornerRadiusProps)[number], string>\n\n/**\n * Whether a computed border-radius is square (every component zero). Splitting\n * on whitespace handles two-value/elliptical radii like \"0px 20px\" - a leading\n * `parseFloat` alone would misread the non-zero vertical radius as square.\n */\nconst isSquareRadius = (radius: string) =>\n radius.split(\" \").every((value) => parseFloat(value) === 0)\n\n/**\n * The `ViewTransitionTarget` buckets driving each generated layer type, in\n * priority order - the inverse of `chooseLayerType`. The new view is driven by\n * `new`/`enter`, the old by `old`/`exit`. `group-children`/`image-pair` have no\n * bucket; they follow the default layout timing.\n */\nconst typeBuckets: Record<string, (keyof ViewTransitionTarget)[]> = {\n group: [\"layout\"],\n new: [\"new\", \"enter\"],\n old: [\"old\", \"exit\"],\n}\n\n/**\n * Default \"absent\" origin for a single-value keyframe, by pseudo type, so e.g.\n * `enter({ scale: 1 })` grows in from 0.85 and `exit({ opacity: 0 })` fades\n * from 1. `enter` prefers the matching `exit` value over these (see below).\n */\nconst ORIGIN_DEFAULTS: Record<string, Record<string, number>> = {\n new: { opacity: 0, scale: 0.85 },\n old: { opacity: 1, scale: 1 },\n}\n\n/**\n * How much two box aspect ratios must differ before a morph is treated as\n * aspect-changing (and so worth cropping). Matches the projection engine's\n * `preserve-aspect` threshold, so small layout jitter doesn't trigger a crop.\n */\nconst ASPECT_TOLERANCE = 0.2\n\nexport function startViewAnimation(\n builder: ViewTransitionBuilder\n): Promise<GroupAnimation> {\n const {\n update,\n targets,\n resolveDefs,\n cropOverride,\n pairs,\n classNames,\n flatGroups,\n options: defaultOptions,\n } = builder\n\n if (!document.startViewTransition) {\n // An async IIFE (not `new Promise(async …)`) so a throwing/rejecting\n // update rejects this promise rather than leaving it unsettled.\n return (async () => {\n await update()\n return new GroupAnimation([])\n })()\n }\n\n /**\n * Resolve any selector/Element targets to layer names, assigning a\n * `view-transition-name` to each element as we go. We run this before the\n * update (so the elements are captured in the old snapshot) and again\n * after it (for the new snapshot). An element present in both keeps the\n * same name and animates as a single `group` layer.\n */\n const nameRegistry = new Map<Element, string>()\n const assigned: Element[] = []\n /**\n * Elements we tagged with a `view-transition-class` (via `.class()`),\n * tracked separately from `assigned` so cleanup removes the class without\n * ever stripping an author's own inline `view-transition-name`.\n */\n const classed: Element[] = []\n /**\n * Elements we set a `view-transition-group` on (for nesting), tracked for\n * cleanup. `clipChildren` collects the names of nested parents that clip in\n * the live layout, so their `::view-transition-group-children` is clipped\n * through the transition - not just once the live DOM takes back over.\n */\n const grouped: Element[] = []\n const clipChildren = new Set<string>()\n const layerTargets = new Map<string, ViewTransitionTarget>()\n const croppedNames = new Set<string>()\n /**\n * Each layer's explicit `.crop(true | false)` override (by resolved name),\n * so `finalizeCrop` can let an author's choice win over the morph default.\n */\n const cropForName = new Map<string, boolean>()\n /**\n * Each layer's stagger position (index + total) within its subject, per\n * snapshot. Resolving against the snapshot the layer belongs to keeps\n * stagger correct when `update()` replaces the matched elements, and lets\n * us skip a layer that's absent from a snapshot (e.g. an exited element\n * has no `new` pseudo-element).\n */\n const layerStagger = new Map<\n string,\n { old?: [number, number]; new?: [number, number] }\n >()\n /**\n * Names allocated for a paired subject in the old snapshot, replayed onto\n * its new-snapshot target so both ends share a layer and morph.\n */\n const pairNames = new Map<ViewTransitionTargetDefinition, string[]>()\n /**\n * The old (`from`) elements of each paired subject, so their names can be\n * transferred off before the new (`to`) elements inherit them.\n */\n const pairFrom = new Map<ViewTransitionTargetDefinition, Element[]>()\n\n const resolveLayers = (phase: \"old\" | \"new\") => {\n targets.forEach((target, definition) => {\n const className = classNames.get(definition)\n /**\n * Nest each resolved layer under its DOM-ancestor layer by default\n * (`contain`), so an ancestor's clip/transform/opacity reach it\n * through the transition; `.group(false)` opts a subject out (`none`)\n * to stay flat and escape. Skipped for root / pre-named layers, which\n * aren't elements we resolve and style.\n */\n const group =\n definition === \"root\" || !resolveDefs.has(definition)\n ? undefined\n : flatGroups.has(definition)\n ? \"none\"\n : \"contain\"\n let names: string[]\n if (definition === \"root\" || !resolveDefs.has(definition)) {\n names = [definition as string]\n } else if (pairs.has(definition)) {\n /**\n * Paired morph: name the old target in the old snapshot, then\n * force the same name(s) onto the new target in the new one, so\n * two different elements morph as a single layer.\n */\n if (phase === \"old\") {\n pairFrom.set(\n definition,\n resolveElements(definition as ElementOrSelector)\n )\n names = assignViewTransitionNames(\n definition as ElementOrSelector,\n nameRegistry,\n assigned,\n undefined,\n className,\n classed,\n group,\n grouped,\n clipChildren\n )\n pairNames.set(definition, names)\n } else {\n /**\n * Transfer the name(s) off the `from` elements before the\n * `to` elements inherit them. A `from` that survives into\n * the new snapshot (e.g. hidden with `visibility: hidden`\n * rather than removed) would otherwise keep the name and\n * collide - \"duplicate view-transition-name\".\n */\n for (const el of pairFrom.get(definition) ?? []) {\n ;(el as HTMLElement).style?.removeProperty(\n \"view-transition-name\"\n )\n /**\n * Drop the old end from the registry too, so the new\n * end alone supplies this name's `new` crop radii - we\n * neither re-measure nor get ordered by a stale element.\n */\n nameRegistry.delete(el)\n }\n names = assignViewTransitionNames(\n pairs.get(definition) as ElementOrSelector,\n nameRegistry,\n assigned,\n pairNames.get(definition),\n className,\n classed,\n group,\n grouped,\n clipChildren\n )\n }\n } else {\n names = assignViewTransitionNames(\n definition as ElementOrSelector,\n nameRegistry,\n assigned,\n undefined,\n className,\n classed,\n group,\n grouped,\n clipChildren\n )\n }\n\n // Record any explicit `.crop(true | false)` per resolved name; the\n // crop set itself is computed later by `finalizeCrop` (it needs both\n // snapshots to know which morphs change aspect ratio).\n const override = cropOverride.get(definition)\n\n names.forEach((name, index) => {\n /**\n * If two subjects resolve to the same element, merge their\n * definitions so neither subject's animations are dropped.\n */\n const existing = layerTargets.get(name)\n layerTargets.set(\n name,\n existing && existing !== target\n ? { ...existing, ...target }\n : target\n )\n\n if (override !== undefined) cropForName.set(name, override)\n\n const stagger = layerStagger.get(name) ?? {}\n stagger[phase] = [index, names.length]\n layerStagger.set(name, stagger)\n })\n })\n }\n\n /**\n * The stagger index/total for a layer, resolved against the snapshot it\n * belongs to. Returns index -1 when the layer is absent from that snapshot\n * so the caller can skip a pseudo-element that doesn't exist.\n */\n const staggerPosition = (name: string, type: string) => {\n const stagger = layerStagger.get(name)\n const position =\n type === \"old\"\n ? stagger?.old\n : type === \"new\"\n ? stagger?.new\n : // group / group-children / image-pair persist across both.\n stagger?.new ?? stagger?.old\n return position ?? ([-1, 1] as const)\n }\n\n /**\n * Merge default + per-layer transition options for a generated layer and\n * resolve any stagger/delay function against this element's position. Used\n * by both the morph-retiming and crop corner-radius passes.\n */\n const resolveLayerTransition = (\n target: ViewTransitionTarget | undefined,\n type: string,\n transitionName: string,\n index: number,\n total: number\n ) => {\n const transition = mergeTransition(\n getValueTransition(defaultOptions, transitionName),\n getValueTransition(\n (layerOptions(target, type) ?? {}) as any,\n transitionName\n )\n )\n\n if (typeof transition.delay === \"function\") {\n transition.delay = transition.delay(index, total)\n }\n\n return transition\n }\n\n /**\n * Resolve a layer's group (`layout`) timing to plain WAAPI values: native\n * ms `delay`/`duration` and a baked `ease`. The single source of group\n * timing, shared by the generated-group retiming and the crop corner-radius\n * pass so the rounded clip animates on exactly the box's timing. It returns\n * no generator `type` (the WAAPI-only `NativeAnimation` rejects a string\n * type) nor `repeat`/`times` (which the group's `updateTiming` ignores), so\n * none of them can leak into the radius animation and desync it.\n */\n const resolveGroupTiming = (name: string) => {\n const [index, total] = staggerPosition(name, \"group\")\n const transition = resolveLayerTransition(\n layerTargets.get(name),\n \"group\",\n \"layout\",\n index === -1 ? 0 : index,\n total\n )\n transition.duration &&= secondsToMilliseconds(transition.duration)\n const { delay = 0, duration, ease } = applyGeneratorOptions(transition)\n return { delay: secondsToMilliseconds(delay), duration, ease }\n }\n\n /**\n * Each layer's measured box + corner radii per snapshot. The box lets\n * `finalizeCrop` tell whether a morph's aspect ratio changed (the only case\n * worth cropping); the radii let a cropped morph's group clip animate each\n * corner from the old element's radius to the new element's, keeping it\n * rounded where `overflow: clip` would otherwise square the corners.\n *\n * We never flatten the source for capture (a snapshot is a paint of the live\n * DOM, so squaring an element just for its capture would flash one real\n * square frame). For an aspect-changing morph `object-fit: cover` crops each\n * snapshot's own baked corners off-screen mid-morph, so the animated clip is\n * the only visible corner; a near-same-aspect forced crop (`.crop(true)`)\n * can't hide the outgoing snapshot's silhouette, but the endpoints coincide.\n */\n const cropMeasurements = new Map<\n string,\n {\n old?: { width: number; height: number; radii: CornerRadii }\n new?: { width: number; height: number; radii: CornerRadii }\n }\n >()\n\n const measureLayers = (phase: \"old\" | \"new\") =>\n nameRegistry.forEach((name, element) => {\n const el = element as HTMLElement\n const rect = el.getBoundingClientRect?.()\n if (rect && rect.height) {\n const style = getComputedStyle(el)\n const radii = {} as CornerRadii\n for (const corner of cornerRadiusProps) {\n radii[corner] = style[corner]\n }\n const entry = cropMeasurements.get(name) ?? {}\n entry[phase] = { width: rect.width, height: rect.height, radii }\n cropMeasurements.set(name, entry)\n }\n })\n\n /**\n * With both snapshots measured, settle which layers crop. The default crops\n * only a morph whose aspect ratio *changes* between snapshots - the one case\n * where `object-fit: cover` does real work. A same-aspect morph or a\n * fade-only layer is left uncropped: its corners scale naturally (no flash\n * from squaring, no `overflow: clip` eating its shadow) and a backdrop can't\n * be clipped to nothing. An explicit `.crop(true | false)` overrides either\n * way. Runs after both snapshots are measured, since aspect needs both.\n */\n const finalizeCrop = () => {\n croppedNames.clear()\n for (const name of layerStagger.keys()) {\n if (name === \"root\") continue\n // An explicit `.crop(true | false)` wins; otherwise crop a morph\n // whose aspect ratio changed.\n if (cropForName.get(name) ?? aspectChanged(name)) {\n croppedNames.add(name)\n }\n }\n }\n\n /**\n * Whether a layer is a morph whose box aspect ratio changed between\n * snapshots (beyond a small tolerance). Fade-only layers (one snapshot) are\n * never \"changed\".\n */\n const aspectChanged = (name: string) => {\n const box = cropMeasurements.get(name)\n if (!box?.old || !box?.new || !box.old.height || !box.new.height) {\n return false\n }\n return (\n Math.abs(\n box.old.width / box.old.height -\n box.new.width / box.new.height\n ) > ASPECT_TOLERANCE\n )\n }\n\n /**\n * Write the persistent view-transition CSS: suppress root capture when the\n * root has no animations of its own; force linear timing (baked into the\n * keyframes, so we can retime later via updateTiming); and clip +\n * object-fit: cover every cropped morph (the UA default overflows on\n * aspect-ratio change).\n *\n * `css.commit` replaces rather than appends, so we re-set the full rule set\n * each call - the crop rules are only known after `finalizeCrop` runs in the\n * update callback, so the second call writes them.\n */\n const commitViewCSS = () => {\n if (!hasTarget(\"root\", targets)) {\n css.set(\":root\", { \"view-transition-name\": \"none\" })\n }\n\n css.set(\n \"::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*)\",\n { \"animation-timing-function\": \"linear !important\" }\n )\n\n croppedNames.forEach((name) => {\n css.set(`::view-transition-group(${name})`, { overflow: \"clip\" })\n css.set(\n `::view-transition-old(${name}), ::view-transition-new(${name})`,\n { width: \"100%\", height: \"100%\", \"object-fit\": \"cover\" }\n )\n })\n\n /**\n * Clip the nested children of any layer that clips in the live layout,\n * so a wrapper crops its child for the whole morph (mirroring the DOM)\n * rather than only at the live-DOM handoff. No-op on browsers without\n * nested view-transition groups.\n */\n clipChildren.forEach((name) => {\n css.set(`::view-transition-group-children(${name})`, {\n overflow: \"clip\",\n })\n })\n\n css.commit() // Write\n }\n\n const cleanup = () => {\n releaseViewTransitionNames(assigned, classed, grouped)\n css.remove() // Write\n }\n\n const callback = async () => {\n await update()\n\n /**\n * Re-resolve so elements created by the update are named for the new\n * snapshot, then measure them. With both snapshots measured we can\n * settle the crop set (aspect-changing morphs + forced).\n */\n resolveLayers(\"new\")\n measureLayers(\"new\")\n finalizeCrop()\n\n /**\n * Re-commit the crop CSS unconditionally: `finalizeCrop` is computed\n * here (after both snapshots are measured), so the clip rules must be\n * (re)written to match the settled set.\n */\n commitViewCSS()\n }\n\n let transition: ViewTransition\n try {\n resolveLayers(\"old\")\n /**\n * Measure the old snapshot against the optimistic crop set (the new\n * snapshot doesn't exist yet, so aspect change can't be known here;\n * `finalizeCrop` settles it post-update).\n */\n measureLayers(\"old\")\n commitViewCSS()\n transition = document.startViewTransition(callback)\n } catch (error) {\n /**\n * The prelude writes inline names before the transition exists. If it\n * throws (e.g. startViewTransition rejects in a bad UA state), release\n * them so we neither leak DOM state nor stall the queue on a promise\n * that never settles - hand back a rejection it can advance past.\n */\n cleanup()\n return Promise.reject(error)\n }\n\n transition.finished.finally(cleanup)\n\n return new Promise<GroupAnimation>((resolve, reject) => {\n transition.ready\n .then(() => {\n const generatedViewAnimations = getViewAnimations()\n\n const animations: AnimationPlaybackControls[] = []\n\n /**\n * Create animations for each of our explicitly-defined subjects.\n * `opacityAnimated` additionally tracks which `${name}:${type}`\n * we faded, so we can keep the UA `plus-lighter` blend only for a\n * genuine opacity crossfade (both sides fading) and drop it for a\n * slide/transform, where additive compositing would flash bright.\n */\n const explicitlyAnimated = new Set<string>()\n const opacityAnimated = new Set<string>()\n layerTargets.forEach((target, name) => {\n const stagger = layerStagger.get(name)\n /**\n * Presence: `enter` only fires for a pure newcomer (a new\n * view with no old), `exit` only for a pure leaver. A\n * survivor (both) gets neither - it just morphs.\n */\n const enterApplies = !!stagger?.new && !stagger?.old\n const exitApplies = !!stagger?.old && !stagger?.new\n\n for (const key of definitionNames) {\n if (!target[key]) continue\n if (key === \"enter\" && !enterApplies) continue\n if (key === \"exit\" && !exitApplies) continue\n\n const type = chooseLayerType(\n key as keyof ViewTransitionTarget\n )\n const [index, total] = staggerPosition(name, type)\n // Skip a layer absent from its snapshot.\n if (index === -1) continue\n\n const { keyframes, options } =\n target[key as keyof ViewTransitionTarget]!\n\n for (let [valueName, valueKeyframes] of Object.entries(\n keyframes\n )) {\n // Skip only missing values - `0` (e.g. opacity: 0)\n // is valid and must reach the from-value inference.\n if (valueKeyframes == null) continue\n\n /**\n * The view path hands keyframes straight to WAAPI,\n * so Motion's `x`/`y` shorthands (compiled to\n * `transform` only via the value pipeline) have no\n * effect. Warn and skip - use `transform`/`translate`.\n */\n if (valueName === \"x\" || valueName === \"y\") {\n warnOnce(\n false,\n `animateView() animates view-transition layers with CSS properties; the \"${valueName}\" shorthand has no effect - use transform, e.g. { transform: \"translateX(40px)\" }.`\n )\n continue\n }\n\n /**\n * enter/exit win over new/old on a shared property -\n * skip it here when the gated bucket also defines it.\n */\n if (\n key === \"new\" &&\n enterApplies &&\n target.enter?.keyframes[\n valueName as keyof DOMKeyframesDefinition\n ] != null\n ) {\n continue\n }\n if (\n key === \"old\" &&\n exitApplies &&\n target.exit?.keyframes[\n valueName as keyof DOMKeyframesDefinition\n ] != null\n ) {\n continue\n }\n\n const valueOptions = mergeTransition(\n getValueTransition(\n defaultOptions as any,\n valueName\n ),\n getValueTransition(options as any, valueName)\n )\n\n /**\n * Infer an origin for a single-value keyframe. An\n * `enter` mirrors the matching `exit` value (a\n * defined exit reverses into the enter for free);\n * otherwise the per-type default (opacity 0/1, scale\n * 0.85). No default -> left as-is (animates from the\n * live value).\n *\n * `new`/`old` fire for survivors too, where only the\n * opacity crossfade default applies - a transform\n * default like scale 0.85 would pop a persisting\n * element, so gate it on the layer actually\n * entering/leaving.\n */\n if (!Array.isArray(valueKeyframes)) {\n const exitValue =\n key === \"enter\"\n ? target.exit?.keyframes[\n valueName as keyof DOMKeyframesDefinition\n ]\n : undefined\n const allowDefault =\n valueName === \"opacity\" ||\n (type === \"new\" ? enterApplies : exitApplies)\n const from =\n exitValue != null\n ? Array.isArray(exitValue)\n ? exitValue[exitValue.length - 1]\n : exitValue\n : allowDefault\n ? ORIGIN_DEFAULTS[type]?.[valueName]\n : undefined\n if (from !== undefined) {\n valueKeyframes = [from, valueKeyframes]\n }\n }\n\n /**\n * Resolve stagger function if provided, per element\n * across this subject's resolved layers.\n */\n if (typeof valueOptions.delay === \"function\") {\n valueOptions.delay = valueOptions.delay(\n index,\n total\n )\n }\n\n valueOptions.duration &&= secondsToMilliseconds(\n valueOptions.duration\n )\n\n valueOptions.delay &&= secondsToMilliseconds(\n valueOptions.delay\n )\n\n animations.push(\n new NativeAnimation({\n ...valueOptions,\n element: document.documentElement,\n name: valueName,\n pseudoElement: `::view-transition-${type}(${name})`,\n keyframes: valueKeyframes,\n })\n )\n explicitlyAnimated.add(`${name}:${type}`)\n if (valueName === \"opacity\") {\n opacityAnimated.add(`${name}:${type}`)\n }\n }\n }\n })\n\n /**\n * Handle browser generated animations\n */\n for (const animation of generatedViewAnimations) {\n if (animation.playState === \"finished\") continue\n\n const { effect } = animation\n if (!effect || !(effect instanceof KeyframeEffect)) continue\n\n const { pseudoElement } = effect\n if (!pseudoElement) continue\n\n const name = getViewAnimationLayerInfo(pseudoElement)\n if (!name) continue\n\n const targetDefinition = layerTargets.get(name.layer)\n\n /**\n * We built our own animation for this layer, so drop the\n * browser-generated fade we're replacing. The UA\n * `plus-lighter` blend is a *separate* generated animation on\n * the same pseudo (it sets `mix-blend-mode` in its keyframes):\n * keep it *only* for a true opacity crossfade - both sides\n * fading - so a symmetric crossfade composites without\n * darkening, but a slide/transform (where both layers stay\n * opaque and overlap) doesn't flash bright from the addition.\n */\n if (explicitlyAnimated.has(`${name.layer}:${name.type}`)) {\n const isCrossfade =\n opacityAnimated.has(`${name.layer}:new`) &&\n opacityAnimated.has(`${name.layer}:old`)\n if (\n isCrossfade &&\n effect\n .getKeyframes()\n .some((keyframe) => keyframe.mixBlendMode)\n ) {\n animations.push(new NativeAnimationWrapper(animation))\n } else {\n animation.cancel()\n }\n continue\n }\n\n /**\n * Drop the orphaned half of the default crossfade. The UA\n * fades old out and new in as a *pair*; if the opposing half\n * was explicitly overridden with something other than an\n * opacity fade (a clip or transform reveal), this side's\n * default opacity fade has no partner - left to run it would\n * dissolve what should be a static backdrop (e.g.\n * `.new({ clipPath })` should reveal over a still old view,\n * not fade the old out around the growing clip). Cancel it -\n * and its `plus-lighter` sibling on the same pseudo, which\n * would otherwise flash bright where the two opaque layers\n * overlap. A genuine crossfade (the opposing side also fading\n * opacity) keeps both halves and is handled above.\n */\n const opposite =\n name.type === \"old\"\n ? \"new\"\n : name.type === \"new\"\n ? \"old\"\n : undefined\n if (\n opposite &&\n explicitlyAnimated.has(\n `${name.layer}:${opposite}`\n ) &&\n !opacityAnimated.has(`${name.layer}:${opposite}`)\n ) {\n animation.cancel()\n continue\n }\n\n /**\n * Otherwise retime the browser-generated animation to\n * Motion's timing. This auto-enables the layout (group)\n * morph for any resolved/named target, and applies the\n * default timing to old/new layers we haven't explicitly\n * overridden.\n *\n * group + group-children both follow the layout timing so\n * the nesting container stays in sync with the morph.\n */\n /**\n * A survivor's old + new are the two halves of one\n * `plus-lighter` crossfade. They must share identical timing\n * (so their opacities stay mirrored and sum to 1 - else the\n * additive blend flashes bright wherever both are partly\n * visible) and fade linearly (the bounce belongs on the\n * group's geometry, not the opacity). So time them as the\n * group, rather than via their own - potentially staggered,\n * or enter/exit-derived - old/new options.\n */\n const stagger = layerStagger.get(name.layer)\n const isMorphCrossfade =\n (name.type === \"old\" || name.type === \"new\") &&\n !!stagger?.old &&\n !!stagger?.new\n\n let timing: {\n delay: number\n duration?: number\n easing: string\n }\n if (name.type.startsWith(\"group\")) {\n // group + group-children follow the resolved group\n // timing - the single source shared with the crop\n // corner-radius pass below.\n const { delay, duration, ease } = resolveGroupTiming(\n name.layer\n )\n timing = {\n delay,\n duration,\n easing: mapEasingToNativeEasing(\n ease,\n duration!\n ) as string,\n }\n } else {\n const timingType = isMorphCrossfade ? \"group\" : name.type\n const [index, total] = staggerPosition(\n name.layer,\n timingType\n )\n const transitionName =\n timingType === \"group\" ? \"layout\" : \"\"\n let animationTransition = resolveLayerTransition(\n targetDefinition,\n timingType,\n transitionName,\n index === -1 ? 0 : index,\n total\n )\n\n /**\n * The crossfade should resolve at the spring's\n * *perceptual* (visual) duration - the geometry can keep\n * bouncing, but the opacity shouldn't drag through the\n * settle. So capture `visualDuration` before\n * `applyGeneratorOptions` replaces it with the full\n * overshoot duration, and use it for the fade.\n */\n const visualDuration = animationTransition.visualDuration\n\n animationTransition.duration &&= secondsToMilliseconds(\n animationTransition.duration\n )\n\n animationTransition =\n applyGeneratorOptions(animationTransition)\n\n timing = {\n delay: secondsToMilliseconds(\n animationTransition.delay ?? 0\n ),\n duration:\n isMorphCrossfade && visualDuration !== undefined\n ? secondsToMilliseconds(visualDuration)\n : animationTransition.duration,\n easing: isMorphCrossfade\n ? \"linear\"\n : (mapEasingToNativeEasing(\n animationTransition.ease,\n animationTransition.duration!\n ) as string),\n }\n }\n\n effect.updateTiming(timing)\n\n animations.push(new NativeAnimationWrapper(animation))\n }\n\n /**\n * Round each cropped layer's clip. Its `::view-transition-group`\n * has `overflow: clip`, which would otherwise square the corners\n * mid-morph; animate each corner from the old element's radius to\n * the new element's so the crop stays rounded. Timed as the group\n * (`layout`) so the radius tracks the morphing box.\n */\n cropMeasurements.forEach((entry, name) => {\n if (!croppedNames.has(name)) return\n\n // Reuse the group's resolved timing - native ms delay/\n // duration + a baked ease, with no generator `type` or\n // repeat/times to leak into (or throw inside) NativeAnimation.\n const { delay, duration, ease } = resolveGroupTiming(name)\n\n for (const corner of cornerRadiusProps) {\n // `||` (not `??`) so an empty measurement falls back to\n // the other snapshot rather than an invalid keyframe.\n const from =\n entry.old?.radii[corner] ||\n entry.new?.radii[corner] ||\n \"0px\"\n const to =\n entry.new?.radii[corner] ||\n entry.old?.radii[corner] ||\n \"0px\"\n // Nothing to round if the corner is square at both ends.\n if (isSquareRadius(from) && isSquareRadius(to)) continue\n\n animations.push(\n new NativeAnimation({\n element: document.documentElement,\n name: corner,\n pseudoElement: `::view-transition-group(${name})`,\n keyframes: [from, to],\n delay,\n duration,\n ease,\n })\n )\n }\n })\n\n resolve(new GroupAnimation(animations))\n })\n .catch(() =>\n /**\n * `ready` rejects when the transition is skipped - no visual\n * change, or superseded by an interrupting transition. The DOM\n * update still applied, so settle with no animations rather than\n * surfacing it as an error to an awaiting caller. A genuine\n * failure in `update()` rejects `updateCallbackDone` (already\n * settled by now), so propagate that instead.\n */\n transition.updateCallbackDone.then(\n () => resolve(new GroupAnimation([])),\n reject\n )\n )\n })\n}\n\n/**\n * The options that should time a given generated layer type, so a retimed\n * group/old/new picks up any per-target transition the user provided. Checks\n * the type's buckets in priority order (e.g. `new` before `enter`).\n */\nfunction layerOptions(target: ViewTransitionTarget | undefined, type: string) {\n for (const bucket of typeBuckets[type] ?? []) {\n const options = target?.[bucket]?.options\n if (options) return options\n }\n}\n\n/**\n * Merge a base transition (e.g. the default `options`) with a per-layer/value\n * override. An explicit `duration` on the override must win over an inherited\n * generator's own timing: a spring prefers `visualDuration`, and\n * `spring.applyToOptions` overwrites `duration` with the computed settle time -\n * so without this the override is silently discarded. Dropping the inherited\n * `type`/`visualDuration` makes the layer a plain tween of that duration, unless\n * it asked for its own generator `type`/`visualDuration`.\n */\nfunction mergeTransition(base: any, override: any) {\n const merged = { ...base, ...override }\n\n if (override.duration !== undefined) {\n if (override.visualDuration === undefined) delete merged.visualDuration\n if (override.type === undefined) delete merged.type\n }\n\n return merged\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU;AAI1E;;;;AAIG;AACH,MAAM,cAAc,GAAG,CAAC,MAAc,KAClC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAE/D;;;;;AAKG;AACH,MAAM,WAAW,GAAmD;IAChE,KAAK,EAAE,CAAC,QAAQ,CAAC;AACjB,IAAA,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC;AACrB,IAAA,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;AAIG;AACH,MAAM,eAAe,GAA2C;IAC5D,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE;IAChC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;CAChC;AAED;;;;AAIG;AACH,MAAM,gBAAgB,GAAG,GAAG;AAEtB,SAAU,kBAAkB,CAC9B,OAA8B,EAAA;IAE9B,MAAM,EACF,MAAM,EACN,OAAO,EACP,WAAW,EACX,YAAY,EACZ,KAAK,EACL,UAAU,EACV,UAAU,EACV,OAAO,EAAE,cAAc,GAC1B,GAAG,OAAO;AAEX,IAAA,IAAI,CAAC,QAAQ,CAAC,mBAAmB,EAAE;;;QAG/B,OAAO,CAAC,YAAW;YACf,MAAM,MAAM,EAAE;AACd,YAAA,OAAO,IAAI,cAAc,CAAC,EAAE,CAAC;QACjC,CAAC,GAAG;IACR;AAEA;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