motion-dom 12.42.0 → 12.42.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"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 { 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\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 * Each layer's box size per snapshot, so `finalizeCrop` can tell whether a\n * morph's aspect ratio changed (the only case worth cropping).\n */\n const cropBox = new Map<\n string,\n {\n old?: { width: number; height: number }\n new?: { width: number; height: number }\n }\n >()\n\n const measureLayers = (phase: \"old\" | \"new\") =>\n nameRegistry.forEach((name, element) => {\n const rect = (element as HTMLElement).getBoundingClientRect?.()\n if (rect && rect.height) {\n const entry = cropBox.get(name) ?? {}\n entry[phase] = { width: rect.width, height: rect.height }\n cropBox.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 = cropBox.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 * 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 const timingType =\n name.type.startsWith(\"group\") || isMorphCrossfade\n ? \"group\"\n : name.type\n\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 *perceptual*\n * (visual) duration - the geometry can keep bouncing, but the\n * opacity shouldn't drag through the settle. So capture\n * `visualDuration` before `applyGeneratorOptions` replaces it\n * with the full 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 const duration =\n isMorphCrossfade && visualDuration !== undefined\n ? secondsToMilliseconds(visualDuration)\n : animationTransition.duration\n\n const easing = isMorphCrossfade\n ? \"linear\"\n : (mapEasingToNativeEasing(\n animationTransition.ease,\n animationTransition.duration!\n ) as string)\n\n effect.updateTiming({\n delay: secondsToMilliseconds(\n animationTransition.delay ?? 0\n ),\n duration,\n easing,\n })\n\n animations.push(new NativeAnimationWrapper(animation))\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":";;;;;;;;;;;;;;;AAqBA,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU;AAE1E;;;;;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;;;;;;AAMG;AACH,IAAA,MAAM,YAAY,GAAG,IAAI,GAAG,EAAmB;IAC/C,MAAM,QAAQ,GAAc,EAAE;AAC9B;;;;AAIG;IACH,MAAM,OAAO,GAAc,EAAE;AAC7B;;;;;AAKG;IAC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":"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;;;;;;AAMG;AACH,IAAA,MAAM,YAAY,GAAG,IAAI,G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GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,QAAQ,EAAE;AAEvC,IAAA,IAAI,QAAQ,CAAC,QAAQ,KAAK,SAAS,EAAE;AACjC,QAAA,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,cAAc;AACvE,QAAA,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,MAAM,CAAC,IAAI;IACvD;AAEA,IAAA,OAAO,MAAM;AACjB;;;;"}
@@ -4213,6 +4213,19 @@
4213
4213
  }
4214
4214
  }
4215
4215
 
4216
+ /**
4217
+ * The four corner-radius longhands. Shared so the projection mixer, scale
4218
+ * corrector, WAAPI px-value set and view-transition crop pass don't each carry
4219
+ * their own copy. Order is irrelevant - every consumer mixes/corrects/animates
4220
+ * each corner independently.
4221
+ */
4222
+ const cornerRadiusProps = [
4223
+ "borderTopLeftRadius",
4224
+ "borderTopRightRadius",
4225
+ "borderBottomRightRadius",
4226
+ "borderBottomLeftRadius",
4227
+ ];
4228
+
4216
4229
  const pxValues = new Set([
4217
4230
  // Border props
4218
4231
  "borderWidth",
@@ -4221,10 +4234,7 @@
4221
4234
  "borderBottomWidth",
4222
4235
  "borderLeftWidth",
4223
4236
  "borderRadius",
4224
- "borderTopLeftRadius",
4225
- "borderTopRightRadius",
4226
- "borderBottomRightRadius",
4227
- "borderBottomLeftRadius",
4237
+ ...cornerRadiusProps,
4228
4238
  // Positioning props
4229
4239
  "width",
4230
4240
  "maxWidth",
@@ -5515,6 +5525,12 @@
5515
5525
  }
5516
5526
 
5517
5527
  const definitionNames = ["layout", "enter", "exit", "new", "old"];
5528
+ /**
5529
+ * Whether a computed border-radius is square (every component zero). Splitting
5530
+ * on whitespace handles two-value/elliptical radii like "0px 20px" - a leading
5531
+ * `parseFloat` alone would misread the non-zero vertical radius as square.
5532
+ */
5533
+ const isSquareRadius = (radius) => radius.split(" ").every((value) => parseFloat(value) === 0);
5518
5534
  /**
5519
5535
  * The `ViewTransitionTarget` buckets driving each generated layer type, in
5520
5536
  * priority order - the inverse of `chooseLayerType`. The new view is driven by
@@ -5701,16 +5717,48 @@
5701
5717
  return transition;
5702
5718
  };
5703
5719
  /**
5704
- * Each layer's box size per snapshot, so `finalizeCrop` can tell whether a
5705
- * morph's aspect ratio changed (the only case worth cropping).
5720
+ * Resolve a layer's group (`layout`) timing to plain WAAPI values: native
5721
+ * ms `delay`/`duration` and a baked `ease`. The single source of group
5722
+ * timing, shared by the generated-group retiming and the crop corner-radius
5723
+ * pass so the rounded clip animates on exactly the box's timing. It returns
5724
+ * no generator `type` (the WAAPI-only `NativeAnimation` rejects a string
5725
+ * type) nor `repeat`/`times` (which the group's `updateTiming` ignores), so
5726
+ * none of them can leak into the radius animation and desync it.
5706
5727
  */
5707
- const cropBox = new Map();
5728
+ const resolveGroupTiming = (name) => {
5729
+ const [index, total] = staggerPosition(name, "group");
5730
+ const transition = resolveLayerTransition(layerTargets.get(name), "group", "layout", index === -1 ? 0 : index, total);
5731
+ transition.duration && (transition.duration = motionUtils.secondsToMilliseconds(transition.duration));
5732
+ const { delay = 0, duration, ease } = applyGeneratorOptions(transition);
5733
+ return { delay: motionUtils.secondsToMilliseconds(delay), duration, ease };
5734
+ };
5735
+ /**
5736
+ * Each layer's measured box + corner radii per snapshot. The box lets
5737
+ * `finalizeCrop` tell whether a morph's aspect ratio changed (the only case
5738
+ * worth cropping); the radii let a cropped morph's group clip animate each
5739
+ * corner from the old element's radius to the new element's, keeping it
5740
+ * rounded where `overflow: clip` would otherwise square the corners.
5741
+ *
5742
+ * We never flatten the source for capture (a snapshot is a paint of the live
5743
+ * DOM, so squaring an element just for its capture would flash one real
5744
+ * square frame). For an aspect-changing morph `object-fit: cover` crops each
5745
+ * snapshot's own baked corners off-screen mid-morph, so the animated clip is
5746
+ * the only visible corner; a near-same-aspect forced crop (`.crop(true)`)
5747
+ * can't hide the outgoing snapshot's silhouette, but the endpoints coincide.
5748
+ */
5749
+ const cropMeasurements = new Map();
5708
5750
  const measureLayers = (phase) => nameRegistry.forEach((name, element) => {
5709
- const rect = element.getBoundingClientRect?.();
5751
+ const el = element;
5752
+ const rect = el.getBoundingClientRect?.();
5710
5753
  if (rect && rect.height) {
5711
- const entry = cropBox.get(name) ?? {};
5712
- entry[phase] = { width: rect.width, height: rect.height };
5713
- cropBox.set(name, entry);
5754
+ const style = getComputedStyle(el);
5755
+ const radii = {};
5756
+ for (const corner of cornerRadiusProps) {
5757
+ radii[corner] = style[corner];
5758
+ }
5759
+ const entry = cropMeasurements.get(name) ?? {};
5760
+ entry[phase] = { width: rect.width, height: rect.height, radii };
5761
+ cropMeasurements.set(name, entry);
5714
5762
  }
5715
5763
  });
5716
5764
  /**
@@ -5740,7 +5788,7 @@
5740
5788
  * never "changed".
5741
5789
  */
5742
5790
  const aspectChanged = (name) => {
5743
- const box = cropBox.get(name);
5791
+ const box = cropMeasurements.get(name);
5744
5792
  if (!box?.old || !box?.new || !box.old.height || !box.new.height) {
5745
5793
  return false;
5746
5794
  }
@@ -5984,6 +6032,31 @@
5984
6032
  }
5985
6033
  continue;
5986
6034
  }
6035
+ /**
6036
+ * Drop the orphaned half of the default crossfade. The UA
6037
+ * fades old out and new in as a *pair*; if the opposing half
6038
+ * was explicitly overridden with something other than an
6039
+ * opacity fade (a clip or transform reveal), this side's
6040
+ * default opacity fade has no partner - left to run it would
6041
+ * dissolve what should be a static backdrop (e.g.
6042
+ * `.new({ clipPath })` should reveal over a still old view,
6043
+ * not fade the old out around the growing clip). Cancel it -
6044
+ * and its `plus-lighter` sibling on the same pseudo, which
6045
+ * would otherwise flash bright where the two opaque layers
6046
+ * overlap. A genuine crossfade (the opposing side also fading
6047
+ * opacity) keeps both halves and is handled above.
6048
+ */
6049
+ const opposite = name.type === "old"
6050
+ ? "new"
6051
+ : name.type === "new"
6052
+ ? "old"
6053
+ : undefined;
6054
+ if (opposite &&
6055
+ explicitlyAnimated.has(`${name.layer}:${opposite}`) &&
6056
+ !opacityAnimated.has(`${name.layer}:${opposite}`)) {
6057
+ animation.cancel();
6058
+ continue;
6059
+ }
5987
6060
  /**
5988
6061
  * Otherwise retime the browser-generated animation to
5989
6062
  * Motion's timing. This auto-enables the layout (group)
@@ -6008,36 +6081,85 @@
6008
6081
  const isMorphCrossfade = (name.type === "old" || name.type === "new") &&
6009
6082
  !!stagger?.old &&
6010
6083
  !!stagger?.new;
6011
- const timingType = name.type.startsWith("group") || isMorphCrossfade
6012
- ? "group"
6013
- : name.type;
6014
- const [index, total] = staggerPosition(name.layer, timingType);
6015
- const transitionName = timingType === "group" ? "layout" : "";
6016
- let animationTransition = resolveLayerTransition(targetDefinition, timingType, transitionName, index === -1 ? 0 : index, total);
6017
- /**
6018
- * The crossfade should resolve at the spring's *perceptual*
6019
- * (visual) duration - the geometry can keep bouncing, but the
6020
- * opacity shouldn't drag through the settle. So capture
6021
- * `visualDuration` before `applyGeneratorOptions` replaces it
6022
- * with the full overshoot duration, and use it for the fade.
6023
- */
6024
- const visualDuration = animationTransition.visualDuration;
6025
- animationTransition.duration && (animationTransition.duration = motionUtils.secondsToMilliseconds(animationTransition.duration));
6026
- animationTransition =
6027
- applyGeneratorOptions(animationTransition);
6028
- const duration = isMorphCrossfade && visualDuration !== undefined
6029
- ? motionUtils.secondsToMilliseconds(visualDuration)
6030
- : animationTransition.duration;
6031
- const easing = isMorphCrossfade
6032
- ? "linear"
6033
- : mapEasingToNativeEasing(animationTransition.ease, animationTransition.duration);
6034
- effect.updateTiming({
6035
- delay: motionUtils.secondsToMilliseconds(animationTransition.delay ?? 0),
6036
- duration,
6037
- easing,
6038
- });
6084
+ let timing;
6085
+ if (name.type.startsWith("group")) {
6086
+ // group + group-children follow the resolved group
6087
+ // timing - the single source shared with the crop
6088
+ // corner-radius pass below.
6089
+ const { delay, duration, ease } = resolveGroupTiming(name.layer);
6090
+ timing = {
6091
+ delay,
6092
+ duration,
6093
+ easing: mapEasingToNativeEasing(ease, duration),
6094
+ };
6095
+ }
6096
+ else {
6097
+ const timingType = isMorphCrossfade ? "group" : name.type;
6098
+ const [index, total] = staggerPosition(name.layer, timingType);
6099
+ const transitionName = timingType === "group" ? "layout" : "";
6100
+ let animationTransition = resolveLayerTransition(targetDefinition, timingType, transitionName, index === -1 ? 0 : index, total);
6101
+ /**
6102
+ * The crossfade should resolve at the spring's
6103
+ * *perceptual* (visual) duration - the geometry can keep
6104
+ * bouncing, but the opacity shouldn't drag through the
6105
+ * settle. So capture `visualDuration` before
6106
+ * `applyGeneratorOptions` replaces it with the full
6107
+ * overshoot duration, and use it for the fade.
6108
+ */
6109
+ const visualDuration = animationTransition.visualDuration;
6110
+ animationTransition.duration && (animationTransition.duration = motionUtils.secondsToMilliseconds(animationTransition.duration));
6111
+ animationTransition =
6112
+ applyGeneratorOptions(animationTransition);
6113
+ timing = {
6114
+ delay: motionUtils.secondsToMilliseconds(animationTransition.delay ?? 0),
6115
+ duration: isMorphCrossfade && visualDuration !== undefined
6116
+ ? motionUtils.secondsToMilliseconds(visualDuration)
6117
+ : animationTransition.duration,
6118
+ easing: isMorphCrossfade
6119
+ ? "linear"
6120
+ : mapEasingToNativeEasing(animationTransition.ease, animationTransition.duration),
6121
+ };
6122
+ }
6123
+ effect.updateTiming(timing);
6039
6124
  animations.push(new NativeAnimationWrapper(animation));
6040
6125
  }
6126
+ /**
6127
+ * Round each cropped layer's clip. Its `::view-transition-group`
6128
+ * has `overflow: clip`, which would otherwise square the corners
6129
+ * mid-morph; animate each corner from the old element's radius to
6130
+ * the new element's so the crop stays rounded. Timed as the group
6131
+ * (`layout`) so the radius tracks the morphing box.
6132
+ */
6133
+ cropMeasurements.forEach((entry, name) => {
6134
+ if (!croppedNames.has(name))
6135
+ return;
6136
+ // Reuse the group's resolved timing - native ms delay/
6137
+ // duration + a baked ease, with no generator `type` or
6138
+ // repeat/times to leak into (or throw inside) NativeAnimation.
6139
+ const { delay, duration, ease } = resolveGroupTiming(name);
6140
+ for (const corner of cornerRadiusProps) {
6141
+ // `||` (not `??`) so an empty measurement falls back to
6142
+ // the other snapshot rather than an invalid keyframe.
6143
+ const from = entry.old?.radii[corner] ||
6144
+ entry.new?.radii[corner] ||
6145
+ "0px";
6146
+ const to = entry.new?.radii[corner] ||
6147
+ entry.old?.radii[corner] ||
6148
+ "0px";
6149
+ // Nothing to round if the corner is square at both ends.
6150
+ if (isSquareRadius(from) && isSquareRadius(to))
6151
+ continue;
6152
+ animations.push(new NativeAnimation({
6153
+ element: document.documentElement,
6154
+ name: corner,
6155
+ pseudoElement: `::view-transition-group(${name})`,
6156
+ keyframes: [from, to],
6157
+ delay,
6158
+ duration,
6159
+ ease,
6160
+ }));
6161
+ }
6162
+ });
6041
6163
  resolve(new GroupAnimation(animations));
6042
6164
  })
6043
6165
  .catch(() =>
@@ -7417,12 +7539,7 @@
7417
7539
  const scaleCorrectors = {
7418
7540
  borderRadius: {
7419
7541
  ...correctBorderRadius,
7420
- applyTo: [
7421
- "borderTopLeftRadius",
7422
- "borderTopRightRadius",
7423
- "borderBottomLeftRadius",
7424
- "borderBottomRightRadius",
7425
- ],
7542
+ applyTo: [...cornerRadiusProps],
7426
7543
  },
7427
7544
  borderTopLeftRadius: correctBorderRadius,
7428
7545
  borderTopRightRadius: correctBorderRadius,
@@ -8350,13 +8467,7 @@
8350
8467
  return transform || "none";
8351
8468
  }
8352
8469
 
8353
- const borderLabels = [
8354
- "borderTopLeftRadius",
8355
- "borderTopRightRadius",
8356
- "borderBottomLeftRadius",
8357
- "borderBottomRightRadius",
8358
- ];
8359
- const numBorders = borderLabels.length;
8470
+ const numBorders = cornerRadiusProps.length;
8360
8471
  const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
8361
8472
  const isPx = (value) => typeof value === "number" || px.test(value);
8362
8473
  function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
@@ -8371,7 +8482,7 @@
8371
8482
  * Mix border radius
8372
8483
  */
8373
8484
  for (let i = 0; i < numBorders; i++) {
8374
- const borderLabel = borderLabels[i];
8485
+ const borderLabel = cornerRadiusProps[i];
8375
8486
  let followRadius = getRadius(follow, borderLabel);
8376
8487
  let leadRadius = getRadius(lead, borderLabel);
8377
8488
  if (followRadius === undefined && leadRadius === undefined)