@hanzogui/animations-motion 3.0.6 → 4.4.0

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,"names":["jsx","_jsx","getEffectiveAnimation","normalizeTransition","ResetPresence","usePresence","fixStyles","getConfig","getSplitStyles","hooks","styleToCSS","Text","useComposedRefs","useIsomorphicLayoutEffect","useThemeWithState","View","useAnimate","useMotionValue","useMotionValueEvent","React","forwardRef","useEffect","useLayoutEffect","useMemo","useRef","useState","_instanceof","left","right","Symbol","hasInstance","_type_of","obj","constructor","isServer","window","useAnimateSSRSafe","MotionValueStrategy","WeakMap","createAnimations","animations","isHydratingGlobal","hydratingComponents","Set","MotionView","MotionText","isReactNative","inputStyle","outputStyle","avoidReRenders","onMount","forEach","cb","useAnimations","animationProps","settings","disableSSR","props","style","componentState","stateRef","useStyleEmitter","presence","animationKey","Array","isArray","transition","isComponentHydrating","unmounted","isMounting","isEntering","isExiting","sendExitComplete","refs","current","isFirstRender","lastDoAnimate","lastDontAnimate","controls","lastAnimateAt","disposed","wasExiting","animationState","frozenExitTarget","exitCompleteScheduled","wasEntering","justFinishedEntering","disableAnimation","scope","animate","justStartedExiting","justStoppedExiting","dontAnimate","doAnimate","animationOptions","getMotionAnimatedProps","firstRenderStyle","isHydrating","setIsHydrating","add","flushAnimation","param","doAnimateRaw","passedOptions","dontAnimate2","startedControls","isCurrentlyExiting","currentSendExitComplete","doAnimate2","_props_transition","animationOptions2","getAnimationOptions","node","host","process","env","NODE_ENV","debug","console","groupCollapsed","JSON","stringify","getDiff","info","trace","groupEnd","HTMLElement","prevDont","removeRemovedStyles","changed","Object","assign","key","lastAnimated","diff","isPopperPosition","hasAttribute","midFlightValues","computed","getComputedStyle","key1","val","stop","key2","anims","getAnimations","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","iterator","_step","next","done","anim","value","cancel","err","return","fixedDiff","fixTransparentColors","transform","Date","now","finished","then","catch","nextStyle","effectiveTransition","_$animationProps","keys","length","ref","render","useAnimatedNumber","initial","motionValue","getInstance","getValue","get","setValue","config","arguments","type","onFinish","set","unsubscribe","on","Math","abs","useAnimatedNumberReaction","onValue","instance","useAnimatedNumberStyle","getStyleProp","getStyleRef","getStyle","cur","disable","transitionOverride","_ref","animateOnly","disableAnimationProps","has","includes","transitionProp","normalized","effectiveKey","enter","exit","globalConfigOverride","properties","defaultConfig","withInferredType","delay","result","duration","damping","stiffness","mass","default","entries","propName","animationNameOrConfig","baseConfig","convertMsToS","isTimingBased","prev","dontClearIfIn","createMotionView","defaultTag","isText","Component","propsIn","_hooks_usePropsTransform","forwardedRef","animation","propsRest","hostRef","composedRefs","_","state","styles","animatedStyle","nonAnimatedStyles","animatedStyle2","nonAnimatedStyles2","style2","push","getProps","props2","out","staticConfig","theme","name","isAnimated","noClass","resolveValues","viewProps"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,2BAAuB;AAChC,SAASC,qBAAe,EAAAC,mBAAmB;AAC3C,SAAAC,aAAA,EAAAC,WAAA;AAAA,SAGEC,SAAA,EAAAC,SAAA,EAAAC,cAAA,EAAAC,KAAA,EAAAC,UAAA,EAAAC,IAAA,EAAAC,eAAA,EAAAC,yBAAA,EAAAC,iBAAA,EAAAC,IAAA;AAAA,SACAC,UAAA,EAAAC,cAAA,EAAAC,mBAAA;AAAA,OACAC,KAAA,IAAAC,UAAA,EAAAC,SAAA,EAAAC,eAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,QAAA;AAAA,SACAC,YAAAC,IAAA,EAAAC,KAAA;EACA,OAAAA,KAAA,mBAAAC,MAAA,UAAAD,KAAA,CAAAC,MAAA,CAAAC,WAAA,MAAAF,KAAA,CAAAC,MAAA,CAAAC,WAAA,EAAAH,IAAA,IAAAA,IAAA,YAAAC,KAAA;AAAA;AACA,SAGAG,SAAAC,GAAA;EACA;;EACA,OAAAA,GAAA,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,cAAA;YACb;UACE;UACE,OAAI,CACJiG,cAAM,EACNC,kBAAW,CACT;QACE;MACA,SAAAG,QAAIA,CAAAC,MAAW;QACb,IAAAC,GAAA,GAAAnP,cAAgB,CAAAkP,MAAA,EAAWnB,MAAM,GAAA5N,IAAA,CAAAiP,YAAiB,GAAA7O,IAAU,CAAC6O,YAAC,EAAAX,KAAA,EAAAY,KAAA,EAAAZ,KAAA,EAAAa,IAAA;UAC9D1L,SAAA;QAAA;UAEJ2L,UAAA;UAEEC,OAAA,EAAW;UAIjBC,aAAA;QAEF;QACF,OAAAN,GAAA,IAAAA,GAAA,CAAAO,SAAA,CAAAxM,KAAA,KAAApD,SAAA,CAAAqP,GAAA,CAAAO,SAAA,CAAAxM,KAAA,GAAAhD,UAAA,CAAAiP,GAAA,CAAAO,SAAA,CAAAxM,KAAA,IAAAiM,GAAA,CAAAO,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["jsx","_jsx","getEffectiveAnimation","normalizeTransition","ResetPresence","usePresence","fixStyles","getConfig","getSplitStyles","hooks","styleToCSS","Text","useComposedRefs","useIsomorphicLayoutEffect","useThemeWithState","View","useAnimate","useMotionValue","useMotionValueEvent","React","forwardRef","useEffect","useLayoutEffect","useMemo","useRef","useState","_instanceof","left","right","Symbol","hasInstance","_type_of","obj","constructor","isServer","window","useAnimateSSRSafe","MotionValueStrategy","WeakMap","PendingMotionOnFinish","settlePendingMotionOnFinish","mv","controls","onFinish","get","delete","then","catch","createAnimations","animations","isHydratingGlobal","hydratingComponents","Set","MotionView","MotionText","isReactNative","inputStyle","outputStyle","avoidReRenders","onMount","forEach","cb","useAnimations","animationProps","settings","disableSSR","props","style","componentState","stateRef","useStyleEmitter","presence","animationKey","Array","isArray","transition","isComponentHydrating","unmounted","isMounting","isEntering","isExiting","sendExitComplete","refs","current","isFirstRender","lastDoAnimate","lastDontAnimate","lastAnimateAt","disposed","wasExiting","animationState","frozenExitTarget","exitCompleteScheduled","wasEntering","justFinishedEntering","disableAnimation","scope","animate","justStartedExiting","justStoppedExiting","dontAnimate","doAnimate","animationOptions","getMotionAnimatedProps","firstRenderStyle","isHydrating","setIsHydrating","add","flushAnimation","param","doAnimateRaw","passedOptions","dontAnimate2","startedControls","isCurrentlyExiting","currentSendExitComplete","doAnimate2","_props_transition","animationOptions2","getAnimationOptions","node","host","process","env","NODE_ENV","console","groupCollapsed","JSON","stringify","getDiff","info","trace","groupEnd","HTMLElement","prevDont","removeRemovedStyles","changed","Object","assign","key","lastAnimated","diff","isPopperPosition","hasAttribute","midFlightValues","computed","getComputedStyle","key1","val","e","stop","key2","anims","getAnimations","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","iterator","_step","next","done","anim","value","cancel","err","return","fixedDiff","fixTransparentColors","transform","Date","now","finished","nextStyle","effectiveTransition","_$animationProps","keys","length","ref","render","useAnimatedNumber","initial","motionValue","getInstance","getValue","setValue","config","arguments","type","set","prior","useAnimatedNumberReaction","onValue","instance","useAnimatedNumberStyle","getStyleProp","getStyleRef","getStyle","cur","useAnimatedNumbersStyle","vals","motionValues","map","v","_len","currentValues","_key","disable","transitionOverride","_ref","animateOnly","disableAnimationProps","has","includes","transitionProp","normalized","effectiveKey","enter","exit","globalConfigOverride","properties","defaultConfig","withInferredType","delay","result","duration","damping","stiffness","mass","default","entries","propName","animationNameOrConfig","baseConfig","convertMsToS","isTimingBased","prev","dontClearIfIn","createMotionView","defaultTag","isText","Component","propsIn","_hooks_usePropsTransform","forwardedRef","animation","propsRest","hostRef","composedRefs","_","state","styles","animatedStyle","nonAnimatedStyles","animatedStyle2","nonAnimatedStyles2","style2","push","getProps","props2","out","staticConfig","theme","name","isAnimated","noClass","resolveValues","viewProps","Element"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,GAAA,IAAAC,IAAA,2BAAuB;AAChC,SAASC,qBAAe,EAAAC,mBAAmB;AAC3C,SAAAC,aAAA,EAAAC,WAAA;AAAA,SAGEC,SAAA,EAAAC,S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BAAA;YAC3C,MAAWC,cAAa;UAClB;QACF;MACA;MACF,QACFkG,cAAA,EACAC,kBAAO,CACT;IAIA;IAKE,SAAIG,QAASA,CAAAC,MAAA;MACb,IAAAC,GAAW,GAAA5P,cAAa,CAAA2P,MAAA,EAAAnB,MAAA,GAAArO,IAAA,CAAA0P,YAAA,GAAAtP,IAAA,CAAAsP,YAAA,EAAAX,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAAY,KAAA,EAAAZ,KAAA,aAAAA,KAAA,uBAAAA,KAAA,CAAAa,IAAA;QAClB1L,SAAQ;MACV;QACA2L,UAAM,OAAa;QACnBC,OAAA,EAAW;QACTC,aAAW;MACT;MACA,KAAAN,GAAI;QACF;MACA;MAAA,IACFA,GAAA,CAAAO,SAAA,CAAAxM,KAAA;QACF7D,SAAA,CAAA8P,GAAA,CAAAO,SAAA,CAAAxM,KAAA;QACFzD,UAAA,CAAA0P,GAAA,CAAAO,SAAA,CAAAxM,KAAA;MACA;MACE,OAAAiM,GAAA,CAASO,SAAK;IAAK;IAErB,IAAAzM,KAAO,GAAGgM,QAAI;MAChB,GAAAZ,SAAA;MACFnL,KAAA,EAAA0L;IACA;IACF,IAAAe,OAAA,GAAAzF,MAAA","ignoreList":[]}
@@ -1,7 +1,13 @@
1
- var hasWarnedOnce = !1;
1
+ var hasWarnedOnce = false;
2
2
  function createAnimations(_animations) {
3
- return process.env.NODE_ENV === "development" && (hasWarnedOnce || (hasWarnedOnce = !0, console.warn("[@hanzogui/animations-motion] This animation driver only works on web. On native, use @hanzogui/animations-react-native or @hanzogui/animations-reanimated instead."))), {
4
- isReactNative: !1,
3
+ if (process.env.NODE_ENV === "development") {
4
+ if (!hasWarnedOnce) {
5
+ hasWarnedOnce = true;
6
+ console.warn("[@hanzogui/animations-motion] This animation driver only works on web. On native, use @hanzogui/animations-react-native or @hanzogui/animations-reanimated instead.");
7
+ }
8
+ }
9
+ return {
10
+ isReactNative: false,
5
11
  animations: _animations,
6
12
  View: void 0,
7
13
  Text: void 0
@@ -1 +1 @@
1
- {"version":3,"names":["hasWarnedOnce","createAnimations","_animations","process","env","NODE_ENV","console","warn","isReactNative","animations","View","Text"],"sources":["../../src/index.native.ts"],"sourcesContent":[null],"mappings":"AAEA,IAAIA,aAAA,GAAgB;AACb,SAASC,iBAAiBC,WAAA,EAAa;EAC1C,OAAIC,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,kBACpBL,aAAA,KACDA,aAAA,GAAgB,IAChBM,OAAA,CAAQC,IAAA,CAAK,qKAAqK,KAKnL;IACHC,aAAA,EAAe;IACfC,UAAA,EAAYP,WAAA;IACZQ,IAAA,EAAM;IACNC,IAAA,EAAM;EACV;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["hasWarnedOnce","createAnimations","_animations","process","env","NODE_ENV","console","warn","isReactNative","animations","View","Text"],"sources":["../../src/index.native.ts"],"sourcesContent":[null],"mappings":"AAEA,IAAIA,aAAA,GAAgB;AACb,SAASC,iBAAiBC,WAAA,EAAa;EAC1C,IAAIC,OAAA,CAAQC,GAAA,CAAIC,QAAA,KAAa,eAAe;IACxC,IAAI,CAACL,aAAA,EAAe;MAChBA,aAAA,GAAgB;MAChBM,OAAA,CAAQC,IAAA,CAAK,qKAAqK;IACtL;EACJ;EAGA,OAAO;IACHC,aAAA,EAAe;IACfC,UAAA,EAAYP,WAAA;IACZQ,IAAA,EAAM;IACNC,IAAA,EAAM;EACV;AACJ","ignoreList":[]}
@@ -1,2 +1,4 @@
1
- typeof requestAnimationFrame > "u" && (globalThis.requestAnimationFrame = setTimeout);
1
+ if (typeof requestAnimationFrame === "undefined") {
2
+ globalThis["requestAnimationFrame"] = setTimeout;
3
+ }
2
4
  //# sourceMappingURL=polyfill.mjs.map
@@ -1 +1 @@
1
- {"version":3,"names":["requestAnimationFrame","globalThis","setTimeout"],"sources":["../../src/polyfill.ts"],"sourcesContent":[null],"mappings":"AACI,OAAOA,qBAAA,GAA0B,QACnCC,UAAA,CAAWD,qBAAA,GAA2BE,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["requestAnimationFrame","globalThis","setTimeout"],"sources":["../../src/polyfill.ts"],"sourcesContent":[null],"mappings":"AACA,IAAI,OAAOA,qBAAA,KAA0B,aAAa;EAChDC,UAAA,CAAW,uBAAuB,IAAIC,UAAA;AACxC","ignoreList":[]}
@@ -1,2 +1,4 @@
1
- typeof requestAnimationFrame > "u" && (globalThis.requestAnimationFrame = setTimeout);
1
+ if (typeof requestAnimationFrame === "undefined") {
2
+ globalThis["requestAnimationFrame"] = setTimeout;
3
+ }
2
4
  //# sourceMappingURL=polyfill.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["requestAnimationFrame","globalThis","setTimeout"],"sources":["../../src/polyfill.ts"],"sourcesContent":[null],"mappings":"AACI,OAAOA,qBAAA,GAA0B,QACnCC,UAAA,CAAWD,qBAAA,GAA2BE,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["requestAnimationFrame","globalThis","setTimeout"],"sources":["../../src/polyfill.ts"],"sourcesContent":[null],"mappings":"AACA,IAAI,OAAOA,qBAAA,KAA0B,aAAa;EAChDC,UAAA,CAAW,uBAAuB,IAAIC,UAAA;AACxC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/animations-motion",
3
- "version": "3.0.6",
3
+ "version": "4.4.0",
4
4
  "license": "MIT",
5
5
  "source": "src/index.ts",
6
6
  "files": [
@@ -38,13 +38,13 @@
38
38
  "clean:build": "hanzo-gui-build clean:build"
39
39
  },
40
40
  "dependencies": {
41
- "@hanzogui/animation-helpers": "3.0.6",
42
- "@hanzogui/use-presence": "3.0.6",
43
- "@hanzogui/web": "3.0.6",
41
+ "@hanzogui/animation-helpers": "4.4.0",
42
+ "@hanzogui/use-presence": "4.4.0",
43
+ "@hanzogui/web": "4.4.0",
44
44
  "motion": ">=12.35.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@hanzogui/build": "3.0.6",
47
+ "@hanzogui/build": "4.4.0",
48
48
  "react": ">=19"
49
49
  },
50
50
  "peerDependencies": {
@@ -50,8 +50,9 @@ type MotionAnimatedNumber = MotionValue<number>
50
50
  type AnimationConfig = ValueTransition
51
51
 
52
52
  type MotionAnimatedNumberStyle = {
53
- getStyle: (cur: number) => Record<string, unknown>
54
- motionValue: MotionValue<number>
53
+ getStyle: (...args: any[]) => Record<string, unknown>
54
+ motionValue?: MotionValue<number>
55
+ motionValues?: MotionValue<number>[]
55
56
  }
56
57
 
57
58
  /**
@@ -65,6 +66,27 @@ type TransitionAnimationOptions = AnimationOptions & {
65
66
 
66
67
  const MotionValueStrategy = new WeakMap<MotionValue, AnimatedNumberStrategy>()
67
68
 
69
+ // pending setValue onFinish callbacks, keyed by motion value. setValue stores
70
+ // the callback here; the change handler in the animated component's useEffect
71
+ // consumes it by chaining to the DOM-level animate() controls so onFinish
72
+ // fires when the *visible* animation actually completes.
73
+ const PendingMotionOnFinish = new WeakMap<MotionValue, () => void>()
74
+
75
+ function settlePendingMotionOnFinish(
76
+ mv: MotionValue,
77
+ controls: AnimationPlaybackControlsWithThen
78
+ ) {
79
+ const onFinish = PendingMotionOnFinish.get(mv)
80
+ if (!onFinish) return
81
+ PendingMotionOnFinish.delete(mv)
82
+ // chain to the DOM animation's completion. settle on both resolve and
83
+ // reject — a rejection means the animation was cancelled by a later
84
+ // setValue, and the caller still needs a completion signal. use the
85
+ // real Promise interface (.then().catch()) because framer-motion types
86
+ // the .then() callbacks as VoidFunction with no error arg.
87
+ controls.then(() => onFinish()).catch(() => onFinish())
88
+ }
89
+
68
90
  type AnimationProps = {
69
91
  doAnimate?: Record<string, unknown>
70
92
  dontAnimate?: Record<string, unknown>
@@ -500,25 +522,44 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
500
522
  },
501
523
  setValue(next, config = { type: 'spring' }, onFinish) {
502
524
  if (config.type === 'direct') {
503
- MotionValueStrategy.set(motionValue, {
504
- type: 'direct',
505
- })
525
+ MotionValueStrategy.set(motionValue, { type: 'direct' })
506
526
  motionValue.set(next)
507
527
  onFinish?.()
508
- } else {
509
- MotionValueStrategy.set(motionValue, config)
528
+ return
529
+ }
510
530
 
511
- if (onFinish) {
512
- const unsubscribe = motionValue.on('change', (value) => {
513
- if (Math.abs(value - next) < 0.01) {
514
- unsubscribe()
515
- onFinish()
516
- }
517
- })
531
+ MotionValueStrategy.set(motionValue, config)
532
+
533
+ // we intentionally DO NOT animate the motion value itself here
534
+ // (via framer-motion's imperative animate(motionValue, next)).
535
+ // doing so drives the JS value over time, which fires a 'change'
536
+ // event per frame, and each change event kicks off a new DOM
537
+ // animate(node, ...) that cancels the previous one — the DOM
538
+ // never reaches the target (double-animation stall).
539
+ //
540
+ // instead we jump the motion value to `next` synchronously. the
541
+ // animated component's change handler receives a single change
542
+ // event, computes the final webStyle, and drives the visible
543
+ // animation via DOM animate(node, webStyle, springConfig). that
544
+ // DOM animation is the real timing source.
545
+ //
546
+ // to make `onFinish` resolve when the VISIBLE animation finishes
547
+ // (not synchronously on the change event), we stash it in
548
+ // PendingMotionOnFinish here and the change handler chains it to
549
+ // the DOM animate() controls.
550
+ if (onFinish) {
551
+ // if a previous setValue is still pending on this motion value,
552
+ // fire it now — the new setValue will cancel the prior DOM
553
+ // animation, and the caller is still owed a completion signal.
554
+ const prior = PendingMotionOnFinish.get(motionValue)
555
+ if (prior) {
556
+ PendingMotionOnFinish.delete(motionValue)
557
+ prior()
518
558
  }
519
-
520
- motionValue.set(next)
559
+ PendingMotionOnFinish.set(motionValue, onFinish)
521
560
  }
561
+
562
+ motionValue.set(next)
522
563
  },
523
564
  stop() {
524
565
  motionValue.stop()
@@ -549,6 +590,19 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
549
590
  } satisfies MotionAnimatedNumberStyle
550
591
  }, [])
551
592
  },
593
+
594
+ useAnimatedNumbersStyle(vals, getStyleProp) {
595
+ const motionValues = vals.map((v) => v.getInstance() as MotionValue<number>)
596
+ const getStyleRef = useRef<typeof getStyleProp>(getStyleProp)
597
+ getStyleRef.current = getStyleProp
598
+
599
+ return useMemo(() => {
600
+ return {
601
+ getStyle: (...currentValues: number[]) => getStyleRef.current(...currentValues),
602
+ motionValues,
603
+ } satisfies MotionAnimatedNumberStyle
604
+ }, [])
605
+ },
552
606
  }
553
607
 
554
608
  function getMotionAnimatedProps(
@@ -822,9 +876,40 @@ function createMotionView(defaultTag: string) {
822
876
  useEffect(() => {
823
877
  if (!animatedStyle) return
824
878
 
879
+ // multi-value path: subscribe to all motion values
880
+ if (animatedStyle.motionValues) {
881
+ const mvs = animatedStyle.motionValues
882
+ const unsubs = mvs.map((mv) =>
883
+ mv.on('change', () => {
884
+ const currentValues = mvs.map((v) => v.get())
885
+ const nextStyle = animatedStyle.getStyle(...currentValues)
886
+ const animationConfig = MotionValueStrategy.get(mv)
887
+ const node = hostRef.current
888
+
889
+ const webStyle = getProps({ style: nextStyle }).style
890
+
891
+ if (webStyle && node instanceof HTMLElement) {
892
+ const motionAnimationConfig =
893
+ animationConfig?.type === 'timing'
894
+ ? { type: 'tween', duration: (animationConfig?.duration || 0) / 1000 }
895
+ : animationConfig?.type === 'direct'
896
+ ? { type: 'tween', duration: 0 }
897
+ : { type: 'spring', ...(animationConfig as any) }
898
+
899
+ const controls = animate(node, webStyle as any, motionAnimationConfig)
900
+ settlePendingMotionOnFinish(mv, controls)
901
+ }
902
+ })
903
+ )
904
+ return () => unsubs.forEach((fn) => fn())
905
+ }
906
+
907
+ // single-value path
908
+ if (!animatedStyle.motionValue) return
909
+
825
910
  return animatedStyle.motionValue.on('change', (value) => {
826
911
  const nextStyle = animatedStyle.getStyle(value)
827
- const animationConfig = MotionValueStrategy.get(animatedStyle.motionValue)
912
+ const animationConfig = MotionValueStrategy.get(animatedStyle.motionValue!)
828
913
  const node = hostRef.current
829
914
 
830
915
  const webStyle = getProps({ style: nextStyle }).style
@@ -843,7 +928,8 @@ function createMotionView(defaultTag: string) {
843
928
  ...(animationConfig as any),
844
929
  }
845
930
 
846
- animate(node, webStyle as any, motionAnimationConfig)
931
+ const controls = animate(node, webStyle as any, motionAnimationConfig)
932
+ settlePendingMotionOnFinish(animatedStyle.motionValue!, controls)
847
933
  }
848
934
  })
849
935
  }, [animatedStyle])
@@ -1,11 +1,11 @@
1
1
  {
2
- "mappings": "AAEA,cAEO,uBAaA;AACP,cAOO,uBACA;KAuBF,kBAAkB;AAyCvB,OAAO,iBAAS,iBAAiB,UAAU,eAAe,kBACxD,YAAY,IACX,gBAAgB;AA+nBnB,OAAO,cAAM,uBAAuB",
2
+ "mappings": "AAEA,cAEO,uBAaA;AACP,cAOO,uBACA;KAuBF,kBAAkB;AA+DvB,OAAO,iBAAS,iBAAiB,UAAU,eAAe,kBACxD,YAAY,IACX,gBAAgB;AA+pBnB,OAAO,cAAM,uBAAuB",
3
3
  "names": [],
4
4
  "sources": [
5
5
  "src/createAnimations.tsx"
6
6
  ],
7
7
  "version": 3,
8
8
  "sourcesContent": [
9
- "import { getEffectiveAnimation, normalizeTransition } from '@hanzogui/animation-helpers'\nimport { ResetPresence, usePresence } from '@hanzogui/use-presence'\nimport {\n type AnimatedNumberStrategy,\n type AnimationDriver,\n fixStyles,\n getConfig,\n getSplitStyles,\n hooks,\n styleToCSS,\n Text,\n TransitionProp,\n type UniversalAnimatedNumber,\n useComposedRefs,\n useIsomorphicLayoutEffect,\n useThemeWithState,\n View,\n} from '@hanzogui/web'\nimport {\n type AnimationOptions,\n type AnimationPlaybackControlsWithThen,\n type MotionValue,\n useAnimate,\n useMotionValue,\n useMotionValueEvent,\n type ValueTransition,\n} from 'motion/react'\nimport React, {\n forwardRef,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nconst isServer = typeof window === 'undefined'\n\n// SSR-safe wrapper: framer-motion's useAnimate imports its own React copy in\n// Vite SSR bundles which causes \"Invalid hook call\" errors. during SSR we\n// don't need animations so we return a no-op scope/animate pair.\nfunction useAnimateSSRSafe() {\n if (isServer) {\n return [useRef(null), (() => {}) as any] as ReturnType<typeof useAnimate>\n }\n return useAnimate()\n}\n\ntype MotionAnimatedNumber = MotionValue<number>\ntype AnimationConfig = ValueTransition\n\ntype MotionAnimatedNumberStyle = {\n getStyle: (cur: number) => Record<string, unknown>\n motionValue: MotionValue<number>\n}\n\n/**\n * Animation options with optional default and per-property configs.\n * This extends AnimationOptions to support the default key.\n */\ntype TransitionAnimationOptions = AnimationOptions & {\n default?: ValueTransition\n [propertyName: string]: ValueTransition | undefined\n}\n\nconst MotionValueStrategy = new WeakMap<MotionValue, AnimatedNumberStrategy>()\n\ntype AnimationProps = {\n doAnimate?: Record<string, unknown>\n dontAnimate?: Record<string, unknown>\n animationOptions?: AnimationOptions\n}\n\n// internal refs consolidated into a single object\ntype MotionRefs = {\n isFirstRender: boolean\n lastDoAnimate: Record<string, unknown> | null\n lastDontAnimate: Record<string, unknown> | null\n controls: AnimationPlaybackControlsWithThen | null\n lastAnimateAt: number\n disposed: boolean\n wasExiting: boolean\n isExiting: boolean\n sendExitComplete: (() => void) | null | undefined\n animationState: 'enter' | 'exit' | 'default'\n frozenExitTarget: Record<string, unknown> | null\n exitCompleteScheduled: boolean\n wasEntering: boolean\n}\n\nexport function createAnimations<A extends Record<string, AnimationConfig>>(\n animations: A\n): AnimationDriver<A> {\n let isHydratingGlobal: boolean | undefined\n const hydratingComponents = new Set<Function>()\n\n return {\n View: MotionView,\n Text: MotionText,\n isReactNative: false,\n inputStyle: 'css',\n outputStyle: 'inline',\n avoidReRenders: true,\n animations,\n usePresence,\n ResetPresence,\n\n onMount() {\n isHydratingGlobal = false\n hydratingComponents.forEach((cb) => cb())\n },\n\n useAnimations: (animationProps) => {\n if (isHydratingGlobal === undefined && !getConfig().settings.disableSSR) {\n isHydratingGlobal = true\n }\n\n const { props, style, componentState, stateRef, useStyleEmitter, presence } =\n animationProps\n\n const animationKey = Array.isArray(props.transition)\n ? props.transition[0]\n : props.transition\n\n const isComponentHydrating = componentState.unmounted === true\n const isMounting = componentState.unmounted === 'should-enter'\n const isEntering = !!componentState.unmounted\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n\n // single consolidated ref with lazy init\n const refs = useRef<MotionRefs>(null!)\n if (!refs.current) {\n refs.current = {\n isFirstRender: true,\n lastDoAnimate: null,\n lastDontAnimate: null,\n controls: null,\n lastAnimateAt: 0,\n disposed: false,\n wasExiting: false,\n isExiting: false,\n sendExitComplete: undefined,\n animationState: 'default',\n frozenExitTarget: null,\n exitCompleteScheduled: false,\n wasEntering: false,\n }\n }\n\n // track entering state transitions\n const justFinishedEntering = refs.current.wasEntering && !isEntering\n useEffect(() => {\n refs.current.wasEntering = isEntering\n })\n\n // determine animation state for enter/exit transitions\n const animationState: 'enter' | 'exit' | 'default' = isExiting\n ? 'exit'\n : isMounting || justFinishedEntering\n ? 'enter'\n : 'default'\n\n // disable animation during hydration and mounting (prevents \"flying across the page\")\n const disableAnimation = isComponentHydrating || isMounting || !animationKey\n\n const [scope, animate] = useAnimateSSRSafe()\n\n // sync ref values for reliable access from callbacks\n refs.current.isExiting = isExiting\n refs.current.sendExitComplete = sendExitComplete\n refs.current.animationState = animationState\n\n // detect transition into exiting state\n const justStartedExiting = isExiting && !refs.current.wasExiting\n const justStoppedExiting = !isExiting && refs.current.wasExiting\n\n // freeze exit animation target so direction changes don't reverse mid-exit\n if (justStartedExiting || justStoppedExiting) {\n refs.current.frozenExitTarget = null\n refs.current.exitCompleteScheduled = false\n }\n\n // track previous exiting state\n useEffect(() => {\n refs.current.wasExiting = isExiting\n })\n\n const {\n dontAnimate = {},\n doAnimate,\n animationOptions,\n } = getMotionAnimatedProps(props as any, style, disableAnimation, animationState)\n\n const [firstRenderStyle] = useState(style)\n\n // avoid first render returning wrong styles - always render all, after that we can just mutate\n if (refs.current.isFirstRender) {\n refs.current.lastDontAnimate = firstRenderStyle\n }\n const [isHydrating, setIsHydrating] = useState(isHydratingGlobal)\n\n useLayoutEffect(() => {\n if (isHydratingGlobal) {\n hydratingComponents.add(() => {\n setIsHydrating(false)\n })\n }\n return () => {\n refs.current.disposed = true\n }\n }, [])\n\n const flushAnimation = ({\n doAnimate: doAnimateRaw = {},\n animationOptions: passedOptions = {},\n dontAnimate,\n }: AnimationProps) => {\n // track whether THIS flush starts a new animation (vs using stale controls)\n let startedControls: AnimationPlaybackControlsWithThen | null = null\n\n // read current state from refs (closure variables can be stale)\n const isCurrentlyExiting = refs.current.isExiting\n const currentSendExitComplete = refs.current.sendExitComplete\n\n // freeze exit target: once the first exit animation starts, subsequent\n // renders (e.g. direction change) should not reverse the exit animation.\n let doAnimate = doAnimateRaw\n if (isCurrentlyExiting && refs.current.frozenExitTarget) {\n doAnimate = refs.current.frozenExitTarget\n }\n\n // only recompute animation options for exit animations to avoid stale state.\n const animationOptions =\n isCurrentlyExiting && currentSendExitComplete\n ? getAnimationOptions(props.transition ?? null, 'exit')\n : passedOptions\n\n try {\n const node = stateRef.current.host\n\n // on first render, reset stale animation refs - they can persist if component\n // instance is reused (e.g. AnimatePresence keepChildrenMounted)\n if (refs.current.isFirstRender) {\n refs.current.lastDontAnimate = null\n refs.current.lastDoAnimate = null\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug'] && props['debug'] !== 'profile') {\n console.groupCollapsed(\n `[motion] animate (${JSON.stringify(getDiff(refs.current.lastDoAnimate, doAnimate), null, 2)})`\n )\n console.info({\n props,\n componentState,\n doAnimate,\n dontAnimate,\n animationOptions,\n animationProps,\n lastDoAnimate: { ...refs.current.lastDoAnimate },\n lastDontAnimate: { ...refs.current.lastDontAnimate },\n isExiting,\n style,\n node,\n })\n console.groupCollapsed(`trace >`)\n console.trace()\n console.groupEnd()\n console.groupEnd()\n }\n }\n\n if (!(node instanceof HTMLElement)) {\n return\n }\n\n // handle case where dontAnimate changes\n const prevDont = refs.current.lastDontAnimate\n if (dontAnimate) {\n if (prevDont) {\n removeRemovedStyles(prevDont, dontAnimate, node, doAnimate)\n const changed = getDiff(prevDont, dontAnimate)\n if (changed) {\n Object.assign(node.style, changed as any)\n }\n } else {\n Object.assign(node.style, dontAnimate as any)\n }\n }\n\n if (doAnimate) {\n // when a property moves from dontAnimate to doAnimate, preserve\n // the current inline style value so WAAPI starts from the right place\n if (prevDont) {\n for (const key in prevDont) {\n if (key in doAnimate) {\n node.style[key] = prevDont[key]\n if (refs.current.lastDoAnimate) {\n refs.current.lastDoAnimate[key] = prevDont[key]\n }\n }\n }\n }\n\n const lastAnimated = refs.current.lastDoAnimate\n if (lastAnimated) {\n removeRemovedStyles(lastAnimated, doAnimate, node, dontAnimate)\n }\n\n const diff = getDiff(refs.current.lastDoAnimate, doAnimate)\n\n if (diff) {\n // capture frozen exit target on first exit diff\n if (isCurrentlyExiting && !refs.current.frozenExitTarget) {\n refs.current.frozenExitTarget = { ...doAnimate }\n }\n\n // capture mid-flight values so we can provide explicit [from, to]\n // keyframes to WAAPI, ensuring smooth interpolation from the\n // current visual state.\n //\n // only stop() during exit — for non-exit cases, WAAPI\n // naturally replaces only conflicting property animations,\n // letting non-conflicting ones (like an in-flight enter\n // opacity animation) continue to completion.\n const isPopperPosition = node.hasAttribute('data-popper-animate-position')\n let midFlightValues: Record<string, string> | null = null\n if (refs.current.controls) {\n try {\n const computed = getComputedStyle(node)\n midFlightValues = {}\n for (const key in diff) {\n const val = (computed as any)[key]\n if (val !== undefined && val !== '') {\n midFlightValues[key] = val\n }\n }\n } catch {\n // getComputedStyle can fail on detached nodes\n }\n\n if (isCurrentlyExiting) {\n refs.current.controls.stop()\n }\n\n // write mid-flight values to inline so the 1-frame gap\n // (while motion resolves keyframes) shows the correct\n // position instead of stale inline styles\n if (midFlightValues) {\n for (const key in midFlightValues) {\n ;(node.style as any)[key] = midFlightValues[key]\n }\n }\n\n // for popper position elements, cancel WAAPI animations\n // directly so motion.dev's internal stop() sees \"idle\" state\n // and skips commitStyles. without this, commitStyles writes\n // a mid-flight transform that's visible for 1 frame before\n // the new animation starts, causing a flash toward (0,0).\n if (isPopperPosition) {\n const anims = node.getAnimations()\n for (const anim of anims) {\n anim.cancel()\n }\n }\n }\n\n const fixedDiff = fixTransparentColors(\n diff,\n refs.current.lastDoAnimate,\n doAnimate\n )\n\n // provide explicit [from, to] keyframe for transforms during\n // mid-flight interruption so motion starts from the right place\n if (midFlightValues?.transform && fixedDiff.transform) {\n fixedDiff.transform = [midFlightValues.transform, fixedDiff.transform]\n }\n\n startedControls = animate(scope.current, fixedDiff, animationOptions)\n refs.current.controls = startedControls\n refs.current.lastAnimateAt = Date.now()\n }\n }\n\n refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {}\n refs.current.lastDoAnimate = doAnimate ? { ...doAnimate } : {}\n } finally {\n // exit completion: notify AnimatePresence when exit animation finishes\n if (isCurrentlyExiting && currentSendExitComplete) {\n if (startedControls) {\n // new animation started — attach completion handler\n refs.current.exitCompleteScheduled = true\n startedControls.finished\n .then(() => {\n // guard: only complete if still exiting (prevents stale promise\n // from calling sendExitComplete after a re-entry cancels the exit)\n if (refs.current.isExiting) {\n currentSendExitComplete()\n }\n })\n .catch(() => {\n if (refs.current.isExiting) {\n currentSendExitComplete()\n }\n })\n } else if (!refs.current.exitCompleteScheduled) {\n // no animation started AND none previously scheduled (e.g. diff=null\n // on re-render mid-exit because frozenExitTarget matches lastDoAnimate)\n // — complete immediately only if we've never started an exit animation\n currentSendExitComplete()\n }\n // else: exit animation already scheduled via a previous flush,\n // its .finished promise will call sendExitComplete when done\n }\n }\n }\n\n useStyleEmitter?.((nextStyle, effectiveTransition) => {\n const animationProps = getMotionAnimatedProps(\n props as any,\n nextStyle,\n disableAnimation,\n refs.current.animationState,\n effectiveTransition\n )\n\n flushAnimation(animationProps)\n })\n\n useIsomorphicLayoutEffect(() => {\n if (refs.current.isFirstRender) {\n refs.current.isFirstRender = false\n\n // during hydration, skip inline style writes entirely — SSR CSS\n // already has the correct values. writing them again as inline\n // styles triggers browser style recalc that causes visible font\n // flashes (fontWeight, fontSize, letterSpacing, lineHeight).\n // we only need to track refs for future animation diffing.\n if (isHydrating) {\n if (doAnimate && Object.keys(doAnimate).length > 0) {\n refs.current.lastDoAnimate = { ...doAnimate }\n } else {\n refs.current.lastDoAnimate = dontAnimate ? { ...dontAnimate } : {}\n }\n\n refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {}\n refs.current.lastAnimateAt = Date.now()\n return\n }\n\n // after hydration, use simpler logic\n refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {}\n refs.current.lastDoAnimate = doAnimate ? { ...doAnimate } : {}\n return\n }\n\n flushAnimation({\n doAnimate,\n dontAnimate,\n animationOptions,\n })\n }, [style, isExiting, disableAnimation])\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug'] && props['debug'] !== 'profile') {\n console.groupCollapsed(`[motion] render`)\n console.info({\n style,\n doAnimate,\n dontAnimate,\n scope,\n animationOptions,\n isExiting,\n isFirstRender: refs.current.isFirstRender,\n animationProps,\n })\n console.groupEnd()\n }\n }\n\n return {\n style: firstRenderStyle,\n ref: scope,\n render: 'div',\n }\n },\n\n useAnimatedNumber(initial): UniversalAnimatedNumber<MotionAnimatedNumber> {\n const motionValue = useMotionValue(initial)\n\n return React.useMemo(\n () => ({\n getInstance() {\n return motionValue\n },\n getValue() {\n return motionValue.get()\n },\n setValue(next, config = { type: 'spring' }, onFinish) {\n if (config.type === 'direct') {\n MotionValueStrategy.set(motionValue, {\n type: 'direct',\n })\n motionValue.set(next)\n onFinish?.()\n } else {\n MotionValueStrategy.set(motionValue, config)\n\n if (onFinish) {\n const unsubscribe = motionValue.on('change', (value) => {\n if (Math.abs(value - next) < 0.01) {\n unsubscribe()\n onFinish()\n }\n })\n }\n\n motionValue.set(next)\n }\n },\n stop() {\n motionValue.stop()\n },\n }),\n [motionValue]\n )\n },\n\n useAnimatedNumberReaction({ value }, onValue) {\n const instance = value.getInstance() as MotionValue<number>\n useMotionValueEvent(instance, 'change', onValue)\n },\n\n useAnimatedNumberStyle(val, getStyleProp) {\n const motionValue = val.getInstance() as MotionValue<number>\n const getStyleRef = useRef<typeof getStyleProp>(getStyleProp)\n\n // we need to change useAnimatedNumberStyle to have dep args to be concurrent safe\n getStyleRef.current = getStyleProp\n\n return useMemo(() => {\n return {\n getStyle: (cur) => {\n return getStyleRef.current(cur)\n },\n motionValue,\n } satisfies MotionAnimatedNumberStyle\n }, [])\n },\n }\n\n function getMotionAnimatedProps(\n props: { transition?: TransitionProp | null; animateOnly?: string[] },\n style: Record<string, unknown>,\n disable: boolean,\n animationState: 'enter' | 'exit' | 'default' = 'default',\n transitionOverride?: TransitionProp | null\n ): AnimationProps {\n if (disable) {\n return {\n dontAnimate: style,\n }\n }\n\n const animationOptions = getAnimationOptions(\n transitionOverride ?? props.transition ?? null,\n animationState\n )\n\n let dontAnimate: Record<string, unknown> | undefined\n let doAnimate: Record<string, unknown> | undefined\n\n const animateOnly = props.animateOnly as string[] | undefined\n for (const key in style) {\n const value = style[key]\n if (disableAnimationProps.has(key) || (animateOnly && !animateOnly.includes(key))) {\n dontAnimate ||= {}\n dontAnimate[key] = value\n } else {\n doAnimate ||= {}\n doAnimate[key] = value\n }\n }\n\n return {\n dontAnimate,\n doAnimate,\n animationOptions,\n }\n }\n\n function getAnimationOptions(\n transitionProp: TransitionProp | null,\n animationState: 'enter' | 'exit' | 'default' = 'default'\n ): TransitionAnimationOptions {\n const normalized = normalizeTransition(transitionProp)\n\n let effectiveKey = getEffectiveAnimation(normalized, animationState)\n\n // fallback: if we have enter/exit defined but state is 'default' and no default key,\n // use enter timing as fallback to avoid empty animation options\n if (!effectiveKey && animationState === 'default') {\n effectiveKey = normalized.enter || normalized.exit || null\n }\n\n const globalConfigOverride: Record<string, unknown> | undefined = normalized.config\n ? { ...normalized.config }\n : undefined\n\n if (\n !effectiveKey &&\n Object.keys(normalized.properties).length === 0 &&\n !globalConfigOverride\n ) {\n return {}\n }\n\n const defaultConfig = effectiveKey ? withInferredType(animations[effectiveKey]) : null\n\n const delay = normalized.delay\n\n // framer motion's animate() expects default config at the TOP LEVEL\n const result: TransitionAnimationOptions = {}\n\n if (defaultConfig) {\n Object.assign(result, defaultConfig)\n }\n\n if (globalConfigOverride) {\n Object.assign(result, globalConfigOverride)\n if (\n result.type === undefined &&\n result.duration !== undefined &&\n result.damping === undefined &&\n result.stiffness === undefined &&\n result.mass === undefined\n ) {\n result.type = 'tween'\n }\n }\n\n if (delay) {\n result.delay = delay\n }\n\n if (defaultConfig || globalConfigOverride || delay) {\n result.default = {\n ...defaultConfig,\n ...globalConfigOverride,\n ...(delay ? { delay } : null),\n }\n }\n\n for (const [propName, animationNameOrConfig] of Object.entries(\n normalized.properties\n )) {\n if (typeof animationNameOrConfig === 'string') {\n result[propName] = withInferredType(animations[animationNameOrConfig])\n } else if (animationNameOrConfig && typeof animationNameOrConfig === 'object') {\n const baseConfig = animationNameOrConfig.type\n ? withInferredType(animations[animationNameOrConfig.type])\n : defaultConfig\n\n result[propName] = {\n ...baseConfig,\n ...animationNameOrConfig,\n } as ValueTransition\n }\n }\n\n // we standardize to ms across drivers, motion expects s\n convertMsToS(result as ValueTransition)\n convertMsToS(result.default)\n for (const key in result) {\n if (key !== 'default' && typeof result[key] === 'object') {\n convertMsToS(result[key])\n }\n }\n\n return result\n }\n}\n\nfunction withInferredType(config: AnimationConfig | undefined): AnimationConfig {\n if (!config) {\n return { type: 'spring' }\n }\n const isTimingBased =\n config.duration !== undefined &&\n config.damping === undefined &&\n config.stiffness === undefined &&\n config.mass === undefined\n return { type: isTimingBased ? 'tween' : 'spring', ...config }\n}\n\nfunction convertMsToS(config: ValueTransition | undefined) {\n if (!config) return\n if (typeof config.delay === 'number') config.delay = config.delay / 1000\n if (typeof config.duration === 'number') {\n const isTimingBased =\n config.type === 'tween' ||\n (config.type === undefined &&\n config.damping === undefined &&\n config.stiffness === undefined &&\n config.mass === undefined)\n if (isTimingBased) {\n config.duration = config.duration / 1000\n }\n }\n}\n\nfunction removeRemovedStyles(\n prev: object,\n next: object,\n node: HTMLElement,\n dontClearIfIn?: object\n) {\n for (const key in prev) {\n if (!(key in next)) {\n if (dontClearIfIn && key in dontClearIfIn) {\n continue\n }\n node.style[key] = ''\n }\n }\n}\n\n// truly non-animatable CSS properties (discrete, keyword-based, no interpolation)\n// properties like margin, maxHeight, zIndex, etc are animatable and intentionally excluded\nexport const disableAnimationProps: Set<string> = new Set<string>([\n 'alignContent',\n 'alignItems',\n 'boxSizing',\n 'contain',\n 'containerType',\n 'display',\n 'flexBasis',\n 'flexDirection',\n 'fontFamily',\n 'justifyContent',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'pointerEvents',\n 'position',\n 'textWrap',\n 'userSelect',\n])\n\nconst MotionView = createMotionView('div')\nconst MotionText = createMotionView('span')\n\nfunction createMotionView(defaultTag: string) {\n const isText = defaultTag === 'span'\n\n const Component = forwardRef((propsIn: any, ref) => {\n const { forwardedRef, animation, render = defaultTag, style, ...propsRest } = propsIn\n const [scope, animate] = useAnimateSSRSafe()\n const hostRef = useRef<HTMLElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref, hostRef, scope)\n\n const stateRef = useRef<any>(null)\n if (!stateRef.current) {\n stateRef.current = {\n get host() {\n return hostRef.current\n },\n }\n }\n\n const [_, state] = useThemeWithState({})\n\n const styles = Array.isArray(style) ? style : [style]\n\n const [animatedStyle, nonAnimatedStyles] = (() => {\n let animatedStyle: MotionAnimatedNumberStyle | undefined\n const nonAnimatedStyles: typeof styles = []\n for (const style of styles) {\n if (style.getStyle) {\n animatedStyle = style as MotionAnimatedNumberStyle\n } else {\n nonAnimatedStyles.push(style)\n }\n }\n return [animatedStyle, nonAnimatedStyles] as const\n })()\n\n function getProps(props: any) {\n const out = getSplitStyles(\n props,\n isText ? Text.staticConfig : View.staticConfig,\n state?.theme,\n state?.name,\n {\n unmounted: false,\n },\n {\n isAnimated: false,\n noClass: true,\n resolveValues: 'auto',\n }\n )\n\n if (!out) {\n return {}\n }\n\n if (out.viewProps.style) {\n fixStyles(out.viewProps.style)\n styleToCSS(out.viewProps.style)\n }\n\n return out.viewProps\n }\n\n const props = getProps({ ...propsRest, style: nonAnimatedStyles })\n const Element = render || 'div'\n const transformedProps = hooks.usePropsTransform?.(render, props, stateRef, false)\n\n useEffect(() => {\n if (!animatedStyle) return\n\n return animatedStyle.motionValue.on('change', (value) => {\n const nextStyle = animatedStyle.getStyle(value)\n const animationConfig = MotionValueStrategy.get(animatedStyle.motionValue)\n const node = hostRef.current\n\n const webStyle = getProps({ style: nextStyle }).style\n\n if (webStyle && node instanceof HTMLElement) {\n const motionAnimationConfig =\n animationConfig?.type === 'timing'\n ? {\n type: 'tween',\n duration: (animationConfig?.duration || 0) / 1000,\n }\n : animationConfig?.type === 'direct'\n ? { type: 'tween', duration: 0 }\n : {\n type: 'spring',\n ...(animationConfig as any),\n }\n\n animate(node, webStyle as any, motionAnimationConfig)\n }\n })\n }, [animatedStyle])\n\n return <Element {...transformedProps} ref={composedRefs} />\n })\n\n Component['acceptRenderProp'] = true\n\n return Component\n}\n\nfunction getDiff<T extends Record<string, unknown>>(\n previous: T | null,\n next: T\n): Record<string, unknown> | null {\n if (!previous) {\n return next\n }\n\n let diff: Record<string, unknown> | null = null\n for (const key in next) {\n if (next[key] !== previous[key]) {\n diff ||= {}\n diff[key] = next[key]\n }\n }\n return diff\n}\n\n// motion.dev can't animate to \"transparent\" - convert it to rgba\n// try to extract RGB from previous or next value for smooth color transitions\nfunction fixTransparentColors(\n diff: Record<string, unknown>,\n previous: Record<string, unknown> | null,\n next?: Record<string, unknown> | null\n): Record<string, unknown> {\n let result = diff\n for (const key in diff) {\n if (diff[key] === 'transparent') {\n let fixed = 'rgba(0, 0, 0, 0)'\n const candidates = [previous?.[key], next?.[key]]\n for (const candidate of candidates) {\n if (typeof candidate === 'string' && candidate !== 'transparent') {\n const rgbaMatch = candidate.match(/^rgba?\\(([^,]+),\\s*([^,]+),\\s*([^,)]+)/)\n if (rgbaMatch) {\n fixed = `rgba(${rgbaMatch[1]}, ${rgbaMatch[2]}, ${rgbaMatch[3]}, 0)`\n break\n }\n }\n }\n if (result === diff) {\n result = { ...diff }\n }\n result[key] = fixed\n }\n }\n return result\n}\n"
9
+ "import { getEffectiveAnimation, normalizeTransition } from '@hanzogui/animation-helpers'\nimport { ResetPresence, usePresence } from '@hanzogui/use-presence'\nimport {\n type AnimatedNumberStrategy,\n type AnimationDriver,\n fixStyles,\n getConfig,\n getSplitStyles,\n hooks,\n styleToCSS,\n Text,\n TransitionProp,\n type UniversalAnimatedNumber,\n useComposedRefs,\n useIsomorphicLayoutEffect,\n useThemeWithState,\n View,\n} from '@hanzogui/web'\nimport {\n type AnimationOptions,\n type AnimationPlaybackControlsWithThen,\n type MotionValue,\n useAnimate,\n useMotionValue,\n useMotionValueEvent,\n type ValueTransition,\n} from 'motion/react'\nimport React, {\n forwardRef,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\n\nconst isServer = typeof window === 'undefined'\n\n// SSR-safe wrapper: framer-motion's useAnimate imports its own React copy in\n// Vite SSR bundles which causes \"Invalid hook call\" errors. during SSR we\n// don't need animations so we return a no-op scope/animate pair.\nfunction useAnimateSSRSafe() {\n if (isServer) {\n return [useRef(null), (() => {}) as any] as ReturnType<typeof useAnimate>\n }\n return useAnimate()\n}\n\ntype MotionAnimatedNumber = MotionValue<number>\ntype AnimationConfig = ValueTransition\n\ntype MotionAnimatedNumberStyle = {\n getStyle: (...args: any[]) => Record<string, unknown>\n motionValue?: MotionValue<number>\n motionValues?: MotionValue<number>[]\n}\n\n/**\n * Animation options with optional default and per-property configs.\n * This extends AnimationOptions to support the default key.\n */\ntype TransitionAnimationOptions = AnimationOptions & {\n default?: ValueTransition\n [propertyName: string]: ValueTransition | undefined\n}\n\nconst MotionValueStrategy = new WeakMap<MotionValue, AnimatedNumberStrategy>()\n\n// pending setValue onFinish callbacks, keyed by motion value. setValue stores\n// the callback here; the change handler in the animated component's useEffect\n// consumes it by chaining to the DOM-level animate() controls so onFinish\n// fires when the *visible* animation actually completes.\nconst PendingMotionOnFinish = new WeakMap<MotionValue, () => void>()\n\nfunction settlePendingMotionOnFinish(\n mv: MotionValue,\n controls: AnimationPlaybackControlsWithThen\n) {\n const onFinish = PendingMotionOnFinish.get(mv)\n if (!onFinish) return\n PendingMotionOnFinish.delete(mv)\n // chain to the DOM animation's completion. settle on both resolve and\n // reject — a rejection means the animation was cancelled by a later\n // setValue, and the caller still needs a completion signal. use the\n // real Promise interface (.then().catch()) because framer-motion types\n // the .then() callbacks as VoidFunction with no error arg.\n controls.then(() => onFinish()).catch(() => onFinish())\n}\n\ntype AnimationProps = {\n doAnimate?: Record<string, unknown>\n dontAnimate?: Record<string, unknown>\n animationOptions?: AnimationOptions\n}\n\n// internal refs consolidated into a single object\ntype MotionRefs = {\n isFirstRender: boolean\n lastDoAnimate: Record<string, unknown> | null\n lastDontAnimate: Record<string, unknown> | null\n controls: AnimationPlaybackControlsWithThen | null\n lastAnimateAt: number\n disposed: boolean\n wasExiting: boolean\n isExiting: boolean\n sendExitComplete: (() => void) | null | undefined\n animationState: 'enter' | 'exit' | 'default'\n frozenExitTarget: Record<string, unknown> | null\n exitCompleteScheduled: boolean\n wasEntering: boolean\n}\n\nexport function createAnimations<A extends Record<string, AnimationConfig>>(\n animations: A\n): AnimationDriver<A> {\n let isHydratingGlobal: boolean | undefined\n const hydratingComponents = new Set<Function>()\n\n return {\n View: MotionView,\n Text: MotionText,\n isReactNative: false,\n inputStyle: 'css',\n outputStyle: 'inline',\n avoidReRenders: true,\n animations,\n usePresence,\n ResetPresence,\n\n onMount() {\n isHydratingGlobal = false\n hydratingComponents.forEach((cb) => cb())\n },\n\n useAnimations: (animationProps) => {\n if (isHydratingGlobal === undefined && !getConfig().settings.disableSSR) {\n isHydratingGlobal = true\n }\n\n const { props, style, componentState, stateRef, useStyleEmitter, presence } =\n animationProps\n\n const animationKey = Array.isArray(props.transition)\n ? props.transition[0]\n : props.transition\n\n const isComponentHydrating = componentState.unmounted === true\n const isMounting = componentState.unmounted === 'should-enter'\n const isEntering = !!componentState.unmounted\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n\n // single consolidated ref with lazy init\n const refs = useRef<MotionRefs>(null!)\n if (!refs.current) {\n refs.current = {\n isFirstRender: true,\n lastDoAnimate: null,\n lastDontAnimate: null,\n controls: null,\n lastAnimateAt: 0,\n disposed: false,\n wasExiting: false,\n isExiting: false,\n sendExitComplete: undefined,\n animationState: 'default',\n frozenExitTarget: null,\n exitCompleteScheduled: false,\n wasEntering: false,\n }\n }\n\n // track entering state transitions\n const justFinishedEntering = refs.current.wasEntering && !isEntering\n useEffect(() => {\n refs.current.wasEntering = isEntering\n })\n\n // determine animation state for enter/exit transitions\n const animationState: 'enter' | 'exit' | 'default' = isExiting\n ? 'exit'\n : isMounting || justFinishedEntering\n ? 'enter'\n : 'default'\n\n // disable animation during hydration and mounting (prevents \"flying across the page\")\n const disableAnimation = isComponentHydrating || isMounting || !animationKey\n\n const [scope, animate] = useAnimateSSRSafe()\n\n // sync ref values for reliable access from callbacks\n refs.current.isExiting = isExiting\n refs.current.sendExitComplete = sendExitComplete\n refs.current.animationState = animationState\n\n // detect transition into exiting state\n const justStartedExiting = isExiting && !refs.current.wasExiting\n const justStoppedExiting = !isExiting && refs.current.wasExiting\n\n // freeze exit animation target so direction changes don't reverse mid-exit\n if (justStartedExiting || justStoppedExiting) {\n refs.current.frozenExitTarget = null\n refs.current.exitCompleteScheduled = false\n }\n\n // track previous exiting state\n useEffect(() => {\n refs.current.wasExiting = isExiting\n })\n\n const {\n dontAnimate = {},\n doAnimate,\n animationOptions,\n } = getMotionAnimatedProps(props as any, style, disableAnimation, animationState)\n\n const [firstRenderStyle] = useState(style)\n\n // avoid first render returning wrong styles - always render all, after that we can just mutate\n if (refs.current.isFirstRender) {\n refs.current.lastDontAnimate = firstRenderStyle\n }\n const [isHydrating, setIsHydrating] = useState(isHydratingGlobal)\n\n useLayoutEffect(() => {\n if (isHydratingGlobal) {\n hydratingComponents.add(() => {\n setIsHydrating(false)\n })\n }\n return () => {\n refs.current.disposed = true\n }\n }, [])\n\n const flushAnimation = ({\n doAnimate: doAnimateRaw = {},\n animationOptions: passedOptions = {},\n dontAnimate,\n }: AnimationProps) => {\n // track whether THIS flush starts a new animation (vs using stale controls)\n let startedControls: AnimationPlaybackControlsWithThen | null = null\n\n // read current state from refs (closure variables can be stale)\n const isCurrentlyExiting = refs.current.isExiting\n const currentSendExitComplete = refs.current.sendExitComplete\n\n // freeze exit target: once the first exit animation starts, subsequent\n // renders (e.g. direction change) should not reverse the exit animation.\n let doAnimate = doAnimateRaw\n if (isCurrentlyExiting && refs.current.frozenExitTarget) {\n doAnimate = refs.current.frozenExitTarget\n }\n\n // only recompute animation options for exit animations to avoid stale state.\n const animationOptions =\n isCurrentlyExiting && currentSendExitComplete\n ? getAnimationOptions(props.transition ?? null, 'exit')\n : passedOptions\n\n try {\n const node = stateRef.current.host\n\n // on first render, reset stale animation refs - they can persist if component\n // instance is reused (e.g. AnimatePresence keepChildrenMounted)\n if (refs.current.isFirstRender) {\n refs.current.lastDontAnimate = null\n refs.current.lastDoAnimate = null\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug'] && props['debug'] !== 'profile') {\n console.groupCollapsed(\n `[motion] animate (${JSON.stringify(getDiff(refs.current.lastDoAnimate, doAnimate), null, 2)})`\n )\n console.info({\n props,\n componentState,\n doAnimate,\n dontAnimate,\n animationOptions,\n animationProps,\n lastDoAnimate: { ...refs.current.lastDoAnimate },\n lastDontAnimate: { ...refs.current.lastDontAnimate },\n isExiting,\n style,\n node,\n })\n console.groupCollapsed(`trace >`)\n console.trace()\n console.groupEnd()\n console.groupEnd()\n }\n }\n\n if (!(node instanceof HTMLElement)) {\n return\n }\n\n // handle case where dontAnimate changes\n const prevDont = refs.current.lastDontAnimate\n if (dontAnimate) {\n if (prevDont) {\n removeRemovedStyles(prevDont, dontAnimate, node, doAnimate)\n const changed = getDiff(prevDont, dontAnimate)\n if (changed) {\n Object.assign(node.style, changed as any)\n }\n } else {\n Object.assign(node.style, dontAnimate as any)\n }\n }\n\n if (doAnimate) {\n // when a property moves from dontAnimate to doAnimate, preserve\n // the current inline style value so WAAPI starts from the right place\n if (prevDont) {\n for (const key in prevDont) {\n if (key in doAnimate) {\n node.style[key] = prevDont[key]\n if (refs.current.lastDoAnimate) {\n refs.current.lastDoAnimate[key] = prevDont[key]\n }\n }\n }\n }\n\n const lastAnimated = refs.current.lastDoAnimate\n if (lastAnimated) {\n removeRemovedStyles(lastAnimated, doAnimate, node, dontAnimate)\n }\n\n const diff = getDiff(refs.current.lastDoAnimate, doAnimate)\n\n if (diff) {\n // capture frozen exit target on first exit diff\n if (isCurrentlyExiting && !refs.current.frozenExitTarget) {\n refs.current.frozenExitTarget = { ...doAnimate }\n }\n\n // capture mid-flight values so we can provide explicit [from, to]\n // keyframes to WAAPI, ensuring smooth interpolation from the\n // current visual state.\n //\n // only stop() during exit — for non-exit cases, WAAPI\n // naturally replaces only conflicting property animations,\n // letting non-conflicting ones (like an in-flight enter\n // opacity animation) continue to completion.\n const isPopperPosition = node.hasAttribute('data-popper-animate-position')\n let midFlightValues: Record<string, string> | null = null\n if (refs.current.controls) {\n try {\n const computed = getComputedStyle(node)\n midFlightValues = {}\n for (const key in diff) {\n const val = (computed as any)[key]\n if (val !== undefined && val !== '') {\n midFlightValues[key] = val\n }\n }\n } catch {\n // getComputedStyle can fail on detached nodes\n }\n\n if (isCurrentlyExiting) {\n refs.current.controls.stop()\n }\n\n // write mid-flight values to inline so the 1-frame gap\n // (while motion resolves keyframes) shows the correct\n // position instead of stale inline styles\n if (midFlightValues) {\n for (const key in midFlightValues) {\n ;(node.style as any)[key] = midFlightValues[key]\n }\n }\n\n // for popper position elements, cancel WAAPI animations\n // directly so motion.dev's internal stop() sees \"idle\" state\n // and skips commitStyles. without this, commitStyles writes\n // a mid-flight transform that's visible for 1 frame before\n // the new animation starts, causing a flash toward (0,0).\n if (isPopperPosition) {\n const anims = node.getAnimations()\n for (const anim of anims) {\n anim.cancel()\n }\n }\n }\n\n const fixedDiff = fixTransparentColors(\n diff,\n refs.current.lastDoAnimate,\n doAnimate\n )\n\n // provide explicit [from, to] keyframe for transforms during\n // mid-flight interruption so motion starts from the right place\n if (midFlightValues?.transform && fixedDiff.transform) {\n fixedDiff.transform = [midFlightValues.transform, fixedDiff.transform]\n }\n\n startedControls = animate(scope.current, fixedDiff, animationOptions)\n refs.current.controls = startedControls\n refs.current.lastAnimateAt = Date.now()\n }\n }\n\n refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {}\n refs.current.lastDoAnimate = doAnimate ? { ...doAnimate } : {}\n } finally {\n // exit completion: notify AnimatePresence when exit animation finishes\n if (isCurrentlyExiting && currentSendExitComplete) {\n if (startedControls) {\n // new animation started — attach completion handler\n refs.current.exitCompleteScheduled = true\n startedControls.finished\n .then(() => {\n // guard: only complete if still exiting (prevents stale promise\n // from calling sendExitComplete after a re-entry cancels the exit)\n if (refs.current.isExiting) {\n currentSendExitComplete()\n }\n })\n .catch(() => {\n if (refs.current.isExiting) {\n currentSendExitComplete()\n }\n })\n } else if (!refs.current.exitCompleteScheduled) {\n // no animation started AND none previously scheduled (e.g. diff=null\n // on re-render mid-exit because frozenExitTarget matches lastDoAnimate)\n // — complete immediately only if we've never started an exit animation\n currentSendExitComplete()\n }\n // else: exit animation already scheduled via a previous flush,\n // its .finished promise will call sendExitComplete when done\n }\n }\n }\n\n useStyleEmitter?.((nextStyle, effectiveTransition) => {\n const animationProps = getMotionAnimatedProps(\n props as any,\n nextStyle,\n disableAnimation,\n refs.current.animationState,\n effectiveTransition\n )\n\n flushAnimation(animationProps)\n })\n\n useIsomorphicLayoutEffect(() => {\n if (refs.current.isFirstRender) {\n refs.current.isFirstRender = false\n\n // during hydration, skip inline style writes entirely — SSR CSS\n // already has the correct values. writing them again as inline\n // styles triggers browser style recalc that causes visible font\n // flashes (fontWeight, fontSize, letterSpacing, lineHeight).\n // we only need to track refs for future animation diffing.\n if (isHydrating) {\n if (doAnimate && Object.keys(doAnimate).length > 0) {\n refs.current.lastDoAnimate = { ...doAnimate }\n } else {\n refs.current.lastDoAnimate = dontAnimate ? { ...dontAnimate } : {}\n }\n\n refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {}\n refs.current.lastAnimateAt = Date.now()\n return\n }\n\n // after hydration, use simpler logic\n refs.current.lastDontAnimate = dontAnimate ? { ...dontAnimate } : {}\n refs.current.lastDoAnimate = doAnimate ? { ...doAnimate } : {}\n return\n }\n\n flushAnimation({\n doAnimate,\n dontAnimate,\n animationOptions,\n })\n }, [style, isExiting, disableAnimation])\n\n if (process.env.NODE_ENV === 'development') {\n if (props['debug'] && props['debug'] !== 'profile') {\n console.groupCollapsed(`[motion] render`)\n console.info({\n style,\n doAnimate,\n dontAnimate,\n scope,\n animationOptions,\n isExiting,\n isFirstRender: refs.current.isFirstRender,\n animationProps,\n })\n console.groupEnd()\n }\n }\n\n return {\n style: firstRenderStyle,\n ref: scope,\n render: 'div',\n }\n },\n\n useAnimatedNumber(initial): UniversalAnimatedNumber<MotionAnimatedNumber> {\n const motionValue = useMotionValue(initial)\n\n return React.useMemo(\n () => ({\n getInstance() {\n return motionValue\n },\n getValue() {\n return motionValue.get()\n },\n setValue(next, config = { type: 'spring' }, onFinish) {\n if (config.type === 'direct') {\n MotionValueStrategy.set(motionValue, { type: 'direct' })\n motionValue.set(next)\n onFinish?.()\n return\n }\n\n MotionValueStrategy.set(motionValue, config)\n\n // we intentionally DO NOT animate the motion value itself here\n // (via framer-motion's imperative animate(motionValue, next)).\n // doing so drives the JS value over time, which fires a 'change'\n // event per frame, and each change event kicks off a new DOM\n // animate(node, ...) that cancels the previous one — the DOM\n // never reaches the target (double-animation stall).\n //\n // instead we jump the motion value to `next` synchronously. the\n // animated component's change handler receives a single change\n // event, computes the final webStyle, and drives the visible\n // animation via DOM animate(node, webStyle, springConfig). that\n // DOM animation is the real timing source.\n //\n // to make `onFinish` resolve when the VISIBLE animation finishes\n // (not synchronously on the change event), we stash it in\n // PendingMotionOnFinish here and the change handler chains it to\n // the DOM animate() controls.\n if (onFinish) {\n // if a previous setValue is still pending on this motion value,\n // fire it now — the new setValue will cancel the prior DOM\n // animation, and the caller is still owed a completion signal.\n const prior = PendingMotionOnFinish.get(motionValue)\n if (prior) {\n PendingMotionOnFinish.delete(motionValue)\n prior()\n }\n PendingMotionOnFinish.set(motionValue, onFinish)\n }\n\n motionValue.set(next)\n },\n stop() {\n motionValue.stop()\n },\n }),\n [motionValue]\n )\n },\n\n useAnimatedNumberReaction({ value }, onValue) {\n const instance = value.getInstance() as MotionValue<number>\n useMotionValueEvent(instance, 'change', onValue)\n },\n\n useAnimatedNumberStyle(val, getStyleProp) {\n const motionValue = val.getInstance() as MotionValue<number>\n const getStyleRef = useRef<typeof getStyleProp>(getStyleProp)\n\n // we need to change useAnimatedNumberStyle to have dep args to be concurrent safe\n getStyleRef.current = getStyleProp\n\n return useMemo(() => {\n return {\n getStyle: (cur) => {\n return getStyleRef.current(cur)\n },\n motionValue,\n } satisfies MotionAnimatedNumberStyle\n }, [])\n },\n\n useAnimatedNumbersStyle(vals, getStyleProp) {\n const motionValues = vals.map((v) => v.getInstance() as MotionValue<number>)\n const getStyleRef = useRef<typeof getStyleProp>(getStyleProp)\n getStyleRef.current = getStyleProp\n\n return useMemo(() => {\n return {\n getStyle: (...currentValues: number[]) => getStyleRef.current(...currentValues),\n motionValues,\n } satisfies MotionAnimatedNumberStyle\n }, [])\n },\n }\n\n function getMotionAnimatedProps(\n props: { transition?: TransitionProp | null; animateOnly?: string[] },\n style: Record<string, unknown>,\n disable: boolean,\n animationState: 'enter' | 'exit' | 'default' = 'default',\n transitionOverride?: TransitionProp | null\n ): AnimationProps {\n if (disable) {\n return {\n dontAnimate: style,\n }\n }\n\n const animationOptions = getAnimationOptions(\n transitionOverride ?? props.transition ?? null,\n animationState\n )\n\n let dontAnimate: Record<string, unknown> | undefined\n let doAnimate: Record<string, unknown> | undefined\n\n const animateOnly = props.animateOnly as string[] | undefined\n for (const key in style) {\n const value = style[key]\n if (disableAnimationProps.has(key) || (animateOnly && !animateOnly.includes(key))) {\n dontAnimate ||= {}\n dontAnimate[key] = value\n } else {\n doAnimate ||= {}\n doAnimate[key] = value\n }\n }\n\n return {\n dontAnimate,\n doAnimate,\n animationOptions,\n }\n }\n\n function getAnimationOptions(\n transitionProp: TransitionProp | null,\n animationState: 'enter' | 'exit' | 'default' = 'default'\n ): TransitionAnimationOptions {\n const normalized = normalizeTransition(transitionProp)\n\n let effectiveKey = getEffectiveAnimation(normalized, animationState)\n\n // fallback: if we have enter/exit defined but state is 'default' and no default key,\n // use enter timing as fallback to avoid empty animation options\n if (!effectiveKey && animationState === 'default') {\n effectiveKey = normalized.enter || normalized.exit || null\n }\n\n const globalConfigOverride: Record<string, unknown> | undefined = normalized.config\n ? { ...normalized.config }\n : undefined\n\n if (\n !effectiveKey &&\n Object.keys(normalized.properties).length === 0 &&\n !globalConfigOverride\n ) {\n return {}\n }\n\n const defaultConfig = effectiveKey ? withInferredType(animations[effectiveKey]) : null\n\n const delay = normalized.delay\n\n // framer motion's animate() expects default config at the TOP LEVEL\n const result: TransitionAnimationOptions = {}\n\n if (defaultConfig) {\n Object.assign(result, defaultConfig)\n }\n\n if (globalConfigOverride) {\n Object.assign(result, globalConfigOverride)\n if (\n result.type === undefined &&\n result.duration !== undefined &&\n result.damping === undefined &&\n result.stiffness === undefined &&\n result.mass === undefined\n ) {\n result.type = 'tween'\n }\n }\n\n if (delay) {\n result.delay = delay\n }\n\n if (defaultConfig || globalConfigOverride || delay) {\n result.default = {\n ...defaultConfig,\n ...globalConfigOverride,\n ...(delay ? { delay } : null),\n }\n }\n\n for (const [propName, animationNameOrConfig] of Object.entries(\n normalized.properties\n )) {\n if (typeof animationNameOrConfig === 'string') {\n result[propName] = withInferredType(animations[animationNameOrConfig])\n } else if (animationNameOrConfig && typeof animationNameOrConfig === 'object') {\n const baseConfig = animationNameOrConfig.type\n ? withInferredType(animations[animationNameOrConfig.type])\n : defaultConfig\n\n result[propName] = {\n ...baseConfig,\n ...animationNameOrConfig,\n } as ValueTransition\n }\n }\n\n // we standardize to ms across drivers, motion expects s\n convertMsToS(result as ValueTransition)\n convertMsToS(result.default)\n for (const key in result) {\n if (key !== 'default' && typeof result[key] === 'object') {\n convertMsToS(result[key])\n }\n }\n\n return result\n }\n}\n\nfunction withInferredType(config: AnimationConfig | undefined): AnimationConfig {\n if (!config) {\n return { type: 'spring' }\n }\n const isTimingBased =\n config.duration !== undefined &&\n config.damping === undefined &&\n config.stiffness === undefined &&\n config.mass === undefined\n return { type: isTimingBased ? 'tween' : 'spring', ...config }\n}\n\nfunction convertMsToS(config: ValueTransition | undefined) {\n if (!config) return\n if (typeof config.delay === 'number') config.delay = config.delay / 1000\n if (typeof config.duration === 'number') {\n const isTimingBased =\n config.type === 'tween' ||\n (config.type === undefined &&\n config.damping === undefined &&\n config.stiffness === undefined &&\n config.mass === undefined)\n if (isTimingBased) {\n config.duration = config.duration / 1000\n }\n }\n}\n\nfunction removeRemovedStyles(\n prev: object,\n next: object,\n node: HTMLElement,\n dontClearIfIn?: object\n) {\n for (const key in prev) {\n if (!(key in next)) {\n if (dontClearIfIn && key in dontClearIfIn) {\n continue\n }\n node.style[key] = ''\n }\n }\n}\n\n// truly non-animatable CSS properties (discrete, keyword-based, no interpolation)\n// properties like margin, maxHeight, zIndex, etc are animatable and intentionally excluded\nexport const disableAnimationProps: Set<string> = new Set<string>([\n 'alignContent',\n 'alignItems',\n 'boxSizing',\n 'contain',\n 'containerType',\n 'display',\n 'flexBasis',\n 'flexDirection',\n 'fontFamily',\n 'justifyContent',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'pointerEvents',\n 'position',\n 'textWrap',\n 'userSelect',\n])\n\nconst MotionView = createMotionView('div')\nconst MotionText = createMotionView('span')\n\nfunction createMotionView(defaultTag: string) {\n const isText = defaultTag === 'span'\n\n const Component = forwardRef((propsIn: any, ref) => {\n const { forwardedRef, animation, render = defaultTag, style, ...propsRest } = propsIn\n const [scope, animate] = useAnimateSSRSafe()\n const hostRef = useRef<HTMLElement>(null)\n const composedRefs = useComposedRefs(forwardedRef, ref, hostRef, scope)\n\n const stateRef = useRef<any>(null)\n if (!stateRef.current) {\n stateRef.current = {\n get host() {\n return hostRef.current\n },\n }\n }\n\n const [_, state] = useThemeWithState({})\n\n const styles = Array.isArray(style) ? style : [style]\n\n const [animatedStyle, nonAnimatedStyles] = (() => {\n let animatedStyle: MotionAnimatedNumberStyle | undefined\n const nonAnimatedStyles: typeof styles = []\n for (const style of styles) {\n if (style.getStyle) {\n animatedStyle = style as MotionAnimatedNumberStyle\n } else {\n nonAnimatedStyles.push(style)\n }\n }\n return [animatedStyle, nonAnimatedStyles] as const\n })()\n\n function getProps(props: any) {\n const out = getSplitStyles(\n props,\n isText ? Text.staticConfig : View.staticConfig,\n state?.theme,\n state?.name,\n {\n unmounted: false,\n },\n {\n isAnimated: false,\n noClass: true,\n resolveValues: 'auto',\n }\n )\n\n if (!out) {\n return {}\n }\n\n if (out.viewProps.style) {\n fixStyles(out.viewProps.style)\n styleToCSS(out.viewProps.style)\n }\n\n return out.viewProps\n }\n\n const props = getProps({ ...propsRest, style: nonAnimatedStyles })\n const Element = render || 'div'\n const transformedProps = hooks.usePropsTransform?.(render, props, stateRef, false)\n\n useEffect(() => {\n if (!animatedStyle) return\n\n // multi-value path: subscribe to all motion values\n if (animatedStyle.motionValues) {\n const mvs = animatedStyle.motionValues\n const unsubs = mvs.map((mv) =>\n mv.on('change', () => {\n const currentValues = mvs.map((v) => v.get())\n const nextStyle = animatedStyle.getStyle(...currentValues)\n const animationConfig = MotionValueStrategy.get(mv)\n const node = hostRef.current\n\n const webStyle = getProps({ style: nextStyle }).style\n\n if (webStyle && node instanceof HTMLElement) {\n const motionAnimationConfig =\n animationConfig?.type === 'timing'\n ? { type: 'tween', duration: (animationConfig?.duration || 0) / 1000 }\n : animationConfig?.type === 'direct'\n ? { type: 'tween', duration: 0 }\n : { type: 'spring', ...(animationConfig as any) }\n\n const controls = animate(node, webStyle as any, motionAnimationConfig)\n settlePendingMotionOnFinish(mv, controls)\n }\n })\n )\n return () => unsubs.forEach((fn) => fn())\n }\n\n // single-value path\n if (!animatedStyle.motionValue) return\n\n return animatedStyle.motionValue.on('change', (value) => {\n const nextStyle = animatedStyle.getStyle(value)\n const animationConfig = MotionValueStrategy.get(animatedStyle.motionValue!)\n const node = hostRef.current\n\n const webStyle = getProps({ style: nextStyle }).style\n\n if (webStyle && node instanceof HTMLElement) {\n const motionAnimationConfig =\n animationConfig?.type === 'timing'\n ? {\n type: 'tween',\n duration: (animationConfig?.duration || 0) / 1000,\n }\n : animationConfig?.type === 'direct'\n ? { type: 'tween', duration: 0 }\n : {\n type: 'spring',\n ...(animationConfig as any),\n }\n\n const controls = animate(node, webStyle as any, motionAnimationConfig)\n settlePendingMotionOnFinish(animatedStyle.motionValue!, controls)\n }\n })\n }, [animatedStyle])\n\n return <Element {...transformedProps} ref={composedRefs} />\n })\n\n Component['acceptRenderProp'] = true\n\n return Component\n}\n\nfunction getDiff<T extends Record<string, unknown>>(\n previous: T | null,\n next: T\n): Record<string, unknown> | null {\n if (!previous) {\n return next\n }\n\n let diff: Record<string, unknown> | null = null\n for (const key in next) {\n if (next[key] !== previous[key]) {\n diff ||= {}\n diff[key] = next[key]\n }\n }\n return diff\n}\n\n// motion.dev can't animate to \"transparent\" - convert it to rgba\n// try to extract RGB from previous or next value for smooth color transitions\nfunction fixTransparentColors(\n diff: Record<string, unknown>,\n previous: Record<string, unknown> | null,\n next?: Record<string, unknown> | null\n): Record<string, unknown> {\n let result = diff\n for (const key in diff) {\n if (diff[key] === 'transparent') {\n let fixed = 'rgba(0, 0, 0, 0)'\n const candidates = [previous?.[key], next?.[key]]\n for (const candidate of candidates) {\n if (typeof candidate === 'string' && candidate !== 'transparent') {\n const rgbaMatch = candidate.match(/^rgba?\\(([^,]+),\\s*([^,]+),\\s*([^,)]+)/)\n if (rgbaMatch) {\n fixed = `rgba(${rgbaMatch[1]}, ${rgbaMatch[2]}, ${rgbaMatch[3]}, 0)`\n break\n }\n }\n }\n if (result === diff) {\n result = { ...diff }\n }\n result[key] = fixed\n }\n }\n return result\n}\n"
10
10
  ]
11
11
  }