@tamagui/animations-motion 1.132.9 → 1.132.10

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","fixStyles","getSplitStyles","hooks","styleToCSS","Text","useComposedRefs","useIsomorphicLayoutEffect","useThemeWithState","View","ResetPresence","usePresence","useAnimate","useMotionValue","useMotionValueEvent","React","forwardRef","useEffect","useMemo","useRef","useState","MotionValueStrategy","WeakMap","createAnimations","animationsProp","animations","key","type","MotionView","MotionText","isReactNative","supportsCSS","needsWebStyles","avoidReRenders","useAnimations","animationProps","props","style","componentState","stateRef","useStyleEmitter","presence","animationKey","Array","isArray","animation","isHydrating","unmounted","disableAnimation","isExiting","sendExitComplete","isFirstRender","scope","animate","lastAnimationStyle","lastDontAnimate","controls","styleKey","JSON","stringify","shouldDebug","process","env","NODE_ENV","debug","dontAnimate","doAnimate","animationOptions","motionAnimationState","getMotionAnimatedProps","animationsQueue","lastAnimateAt","minTimeBetweenAnimations","disposed","current","runAnimation","props2","waitForNextAnimationFrame","queue","last","length","console","error","elapsed","Date","now","info","flushAnimation","requestAnimationFrame","hasQueue","shouldWait","push","param","doAnimate2","dontAnimate2","animationOptions2","node","host","HTMLElement","firstAnimation","complete","groupCollapsed","groupEnd","next","diff","getDiff","Object","assign","key2","diff1","finished","then","nextStyle","_$animationProps","initialStyle","ref","tag","useAnimatedNumber","initial","motionValue","getInstance","getValue","get","setValue","config","arguments","onFinish","set","unsubscribe","on","value","Math","abs","stop","useAnimatedNumberReaction","onValue","instance","useAnimatedNumberStyle","val","getStyleProp","getStyleRef","getStyle","cur","disable","animationPropToAnimationConfig","animateOnly","disableAnimationProps","has","includes","animationProp","defaultAnimationKey","specificAnimations","defaultConfig","default","fromEntries","entries","flatMap","propName","animationNameOrConfig","Set","createMotionView","defaultTag","isText","Component","propsIn","_hooks_usePropsTransform","forwardedRef","propsRest","hostRef","composedRefs","_","state","styles","animatedStyle","nonAnimatedStyles","find","x","filter","getProps","out","staticConfig","theme","name","isAnimated","noClass","resolveValues","viewProps","Element","transformedProps","usePropsTransform","call","animationConfig","webStyle","motionAnimationConfig","duration"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAAA,GAAA,IAAAC,IAAA;AAAA,SAIEC,SAAA,EAAAC,cAAA,EAAAC,KAAA,EAAAC,UAAA,EAAAC,IAAA,EAAAC,eAAA,EAAAC,yBAAA,EAAAC,iBAAA,EAAAC,IAAA;AAAA,SACAC,aAAA,EAAAC,WAAA;AAAA,SACAC,UAAA,EAAAC,cAAA,EAAAC,mBAAA;AAAA,OACAC,KAAA,IAAAC,UAAA,EAAAC,SAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,QAAA;AAAA,IACAC,mBAAA,sBAAAC,OAAA;AAAA,SAEAC,iBAAAC,cAAA;EACA,IAAAC,UAAA;EACA,SAAAC,GAAA,IAAAF,cAAA,EACAC,UAAA,CAAAC,GAAA;IAAAC,IACK;IACP,GAASH,cAAA,CAAeE,GAAA;EACxB;EAIE;IACA;IACAjB,IAAA,EAAAmB,UAAA;IAAAvB,IAEK,EAAAwB,UAAA;IACPC,aAAgB;IAmlBLC,WAAA;IAvkBXC,cAAM;IAQCC,cAAS;IAMdR,UAAM;IACNd,WAAW;IACTD,aAAW;IAAOwB,aACV,WAAAA,CAAAC,cAAA;MACN,IAAG;UAAAC,KAAA;UAAAC,KAAe;UAAAC,cAAG;UAAAC,QAAA;UAAAC,eAAA;UAAAC;QAAA,IAAAN,cAAA;QAAAO,YAAA,GAAAC,KAAA,CAAAC,OAAA,CAAAR,KAAA,CAAAS,SAAA,IAAAT,KAAA,CAAAS,SAAA,MAAAT,KAAA,CAAAS,SAAA;QAAAC,WAAA,GAAAR,cAAA,CAAAS,SAAA;QAAAC,gBAAA,GAAAF,WAAA,KAAAJ,YAAA;QAAAO,SAAA,GAAAR,QAAA;QAAAS,gBAAA,GAAAT,QAAA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K,IAAA;cAGkCA,IAAA;cAChCuK,QAAO,GAAAH,eAAA,EAAAG,QAAA;YACJ,IAAAH,eAAkB,EAAApK,IAC5B,aACA;cAGGA,IAAA;cACTuK,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["jsx","_jsx","fixStyles","getSplitStyles","hooks","styleToCSS","Text","useComposedRefs","useIsomorphicLayoutEffect","useThemeWithState","View","ResetPresence","usePresence","useAnimate","useMotionValue","useMotionValueEvent","React","forwardRef","useEffect","useLayoutEffect","useMemo","useRef","useState","MotionValueStrategy","WeakMap","createAnimations","animationsProp","animations","key","type","MotionView","MotionText","isReactNative","supportsCSS","needsWebStyles","avoidReRenders","useAnimations","animationProps","props","style","componentState","stateRef","useStyleEmitter","presence","animationKey","Array","isArray","animation","isHydrating","unmounted","disableAnimation","isExiting","sendExitComplete","isFirstRender","scope","animate","lastAnimationStyle","controls","styleKey","JSON","stringify","shouldDebug","debug","dontAnimate","doAnimate","animationOptions","motionAnimationState","getMotionAnimatedProps","animationsQueue","lastAnimateAt","minTimeBetweenAnimations","disposed","firstRenderStyle","lastDontAnimate","current","runAnimation","props2","waitForNextAnimationFrame","queue","last","length","console","error","elapsed","Date","now","info","flushAnimation","requestAnimationFrame","hasQueue","shouldWait","push","updateFirstAnimationStyle","node","host","HTMLElement","firstAnimation","complete","groupCollapsed","groupEnd","param","doAnimate2","dontAnimate2","animationOptions2","next","curDontAnimate","key2","newDontAnimate","getDiff","Object","assign","diff","trace","finished","then","nextStyle","_$animationProps","animateKey","initialStyle","ref","tag","useAnimatedNumber","initial","motionValue","getInstance","getValue","get","setValue","config","arguments","onFinish","set","unsubscribe","on","value","Math","abs","stop","useAnimatedNumberReaction","onValue","instance","useAnimatedNumberStyle","val","getStyleProp","getStyleRef","getStyle","cur","disable","animationPropToAnimationConfig","animateOnly","disableAnimationProps","has","includes","animationProp","defaultAnimationKey","specificAnimations","defaultConfig","default","fromEntries","entries","flatMap","propName","animationNameOrConfig","Set","createMotionView","defaultTag","isText","Component","propsIn","_hooks_usePropsTransform","forwardedRef","propsRest","hostRef","composedRefs","_","state","styles","animatedStyle","nonAnimatedStyles","find","x","filter","getProps","out","staticConfig","theme","name","isAnimated","noClass","resolveValues","viewProps","Element","transformedProps","usePropsTransform","call","animationConfig","webStyle","motionAnimationConfig","duration"],"sources":["../../src/createAnimations.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAAA,GAAA,IAAAC,IAAA;AAAA,SAIEC,SAAA,EAAAC,cAAA,EAAAC,KAAA,EAAAC,UAAA,EAAAC,IAAA,EAAAC,eAAA,EAAAC,yBAAA,EAAAC,iBAAA,EAAAC,IAAA;AAAA,SACAC,aAAA,EAAAC,WAAA;AAAA,SACAC,UAAA,EAAAC,cAAA,EAAAC,mBAAA;AAAA,OACAC,KAAA,IAAAC,UAAA,EAAAC,SAAA,EAAAC,eAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,QAAA;AAAA,IACAC,mBAAA,sBAAAC,OAAA;AAAA,SAEAC,iBAAAC,cAAA;EACA,IAAAC,UAAA;EACA,SAAAC,GAAA,IAAAF,cAAA,EACAC,UAAA,CAAAC,GAAA;IAAAC,IACK;IACP,GAASH,cAAA,CAAeE,GAAA;EACxB;EAIE;IACA;IACAlB,IAAA,EAAAoB,UAAA;IAAAxB,IAEK,EAAAyB,UAAA;IACPC,aAAO;IACLC,WAAA;IACAC,cAAA;IACAC,cAAA;IACAR,UAAA;IACAf,WAAA;IACAD,aAAA;IAAAyB,aACK,WAAAA,CAAAC,cAAA;MAqnBI;UAAAC,KAAA;UAAAC,KAAA;UAAAC,cAAA;UAAAC,QAAA;UAAAC,eAAA;UAAAC;QAAA,IAAAN,cAAA;QAAAO,YAAA,GAAAC,KAAA,CAAAC,OAAA,CAAAR,KAAA,CAAAS,SAAA,IAAAT,KAAA,CAAAS,SAAA,MAAAT,KAAA,CAAAS,SAAA;QAAAC,WAAA,GAAAR,cAAA,CAAAS,SAAA;QAAAC,gBAAA,GAAAF,WAAA,KAAAJ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AA,OACDvB,SAAA;QACH,IAAI+J,aAAc,EAGnB,OAAAA,aAAA,CAAAtD,WAAA,CAAAU,EAAA,qBAAAC,KAAA;UAED,IAAAnB,SAAU,GAAA8D,aAEH,CAAAhC,QAAA,CAAAX,KAAA;YAAA6D,eAAA,GAAA5K,mBAAA,CAAAuG,GAAA,CAAAmD,aAAA,CAAAtD,WAAA;YAAA9B,IAAA,GAAA+E,OAAA,CAAAlG,OAAA;YAAA0H,QAAA,GAAAd,QAAA;cACT/I,KAAA,EAAA4E;YAES,GAAA5E,KACP;UAGK,IAAA6J,QAAA,IAAAvG,IAAA,YAAAE,WAAA;YACI,IAAAsG,qBAAA,GAAAF,eAAA,EAAAtK,IAAA;cAGkCA,IAAA;cAChCyK,QAAO,GAAAH,eAAA,EAAAG,QAAA;YACJ,IAAAH,eAAkB,EAAAtK,IAC5B,aACA;cAGGA,IAAA;cACTyK,QAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/animations-motion",
3
- "version": "1.132.9",
3
+ "version": "1.132.10",
4
4
  "source": "src/index.ts",
5
5
  "license": "MIT",
6
6
  "types": "./types/index.d.ts",
@@ -29,12 +29,12 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@tamagui/core": "1.132.9",
33
- "@tamagui/use-presence": "1.132.9",
32
+ "@tamagui/core": "1.132.10",
33
+ "@tamagui/use-presence": "1.132.10",
34
34
  "motion": "^12.23.6"
35
35
  },
36
36
  "devDependencies": {
37
- "@tamagui/build": "1.132.9",
37
+ "@tamagui/build": "1.132.10",
38
38
  "react": "*"
39
39
  },
40
40
  "scripts": {
@@ -23,7 +23,14 @@ import {
23
23
  useMotionValueEvent,
24
24
  type ValueTransition,
25
25
  } from 'motion/react'
26
- import React, { forwardRef, RefObject, useEffect, useMemo, useRef, useState } from 'react'
26
+ import React, {
27
+ forwardRef,
28
+ useEffect,
29
+ useLayoutEffect,
30
+ useMemo,
31
+ useRef,
32
+ useState,
33
+ } from 'react'
27
34
 
28
35
  // TODO: useAnimatedNumber style could avoid re-rendering
29
36
 
@@ -85,14 +92,13 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
85
92
  const isFirstRender = useRef(true)
86
93
  const [scope, animate] = useAnimate()
87
94
  const lastAnimationStyle = useRef<Record<string, unknown> | null>(null)
88
- const lastDontAnimate = useRef<Record<string, unknown>>({})
89
95
  const controls = useRef<AnimationPlaybackControlsWithThen | null>(null)
90
96
  const styleKey = JSON.stringify(style)
91
97
 
98
+ // until fully stable allow debugging in prod to help debugging prod issues
92
99
  const shouldDebug =
93
- process.env.NODE_ENV === 'development' &&
94
- props['debug'] &&
95
- props['debug'] !== 'profile'
100
+ // process.env.NODE_ENV === 'development' &&
101
+ props['debug'] && props['debug'] !== 'profile'
96
102
 
97
103
  const {
98
104
  dontAnimate = {},
@@ -111,14 +117,12 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
111
117
  const lastAnimateAt = useRef(0)
112
118
  const minTimeBetweenAnimations = 16.667
113
119
  const disposed = useRef(false)
120
+ const [firstRenderStyle] = useState(style)
114
121
 
115
- useIsomorphicLayoutEffect(() => {
116
- lastDontAnimate.current = dontAnimate
117
- })
118
-
119
- useEffect(() => {
120
- isFirstRender.current = false
122
+ // avoid first render returning wrong styles - always render all, after that we can just mutate
123
+ const lastDontAnimate = useRef<Record<string, unknown>>(firstRenderStyle)
121
124
 
125
+ useLayoutEffect(() => {
122
126
  return () => {
123
127
  disposed.current = true
124
128
  }
@@ -167,7 +171,9 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
167
171
 
168
172
  const hasQueue = animationsQueue.current.length
169
173
  const shouldWait =
170
- hasQueue || Date.now() - lastAnimateAt.current > minTimeBetweenAnimations
174
+ hasQueue ||
175
+ (lastAnimateAt.current &&
176
+ Date.now() - lastAnimateAt.current > minTimeBetweenAnimations)
171
177
 
172
178
  if (isExiting || isFirstRender.current || (scope.current && !shouldWait)) {
173
179
  flushAnimation(props)
@@ -179,6 +185,32 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
179
185
  }
180
186
  }
181
187
 
188
+ const updateFirstAnimationStyle = () => {
189
+ const node = stateRef.current.host
190
+
191
+ if (!(node instanceof HTMLElement)) {
192
+ return false
193
+ }
194
+
195
+ if (!lastAnimationStyle.current) {
196
+ lastAnimationStyle.current = style
197
+ const firstAnimation = animate(scope.current, doAnimate || {}, {
198
+ type: false,
199
+ })
200
+ firstAnimation.complete()
201
+ scope.animations = []
202
+
203
+ if (shouldDebug) {
204
+ console.groupCollapsed(`[motion] 🌊 FIRST`)
205
+ console.info(doAnimate)
206
+ console.groupEnd()
207
+ }
208
+ return true
209
+ }
210
+
211
+ return false
212
+ }
213
+
182
214
  const flushAnimation = ({
183
215
  doAnimate,
184
216
  dontAnimate,
@@ -191,22 +223,6 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
191
223
  return
192
224
  }
193
225
 
194
- if (!lastAnimationStyle.current) {
195
- lastAnimationStyle.current = style
196
- const firstAnimation = animate(scope.current, doAnimate || {}, {
197
- type: false,
198
- })
199
- firstAnimation.complete()
200
- // scope.animations = []
201
-
202
- if (shouldDebug) {
203
- console.groupCollapsed(`[motion] 🌊 FIRST`)
204
- console.info(doAnimate)
205
- console.groupEnd()
206
- }
207
- return
208
- }
209
-
210
226
  if (!doAnimate && !dontAnimate) {
211
227
  return
212
228
  }
@@ -216,21 +232,27 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
216
232
  // handle case where dontAnimate changes
217
233
  // we just set it onto animate + set options to not actually animate
218
234
  if (dontAnimate) {
219
- if (node) {
220
- const diff = getDiff(lastDontAnimate.current, dontAnimate)
221
- if (diff) {
222
- lastDontAnimate.current = dontAnimate
223
- Object.assign(node.style, dontAnimate as any)
224
- }
225
- for (const key in lastDontAnimate.current) {
226
- if (!(key in dontAnimate)) {
235
+ const curDontAnimate = lastDontAnimate.current
236
+ if (node && curDontAnimate) {
237
+ for (const key in curDontAnimate) {
238
+ if (!(key in style)) {
227
239
  console.info('deleting!', key, { dontAnimate, doAnimate })
228
240
  delete node.style[key]
229
241
  }
230
242
  }
243
+ const newDontAnimate = getDiff(curDontAnimate, dontAnimate)
244
+ if (newDontAnimate) {
245
+ Object.assign(node.style, newDontAnimate as any)
246
+ }
231
247
  }
232
248
  }
233
249
 
250
+ lastDontAnimate.current = dontAnimate || {}
251
+
252
+ if (updateFirstAnimationStyle()) {
253
+ return
254
+ }
255
+
234
256
  const diff = getDiff(lastAnimationStyle.current, next)
235
257
 
236
258
  if (shouldDebug) {
@@ -245,16 +267,18 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
245
267
  lastAnimationStyle: { ...lastAnimationStyle.current },
246
268
  isExiting,
247
269
  })
270
+ console.trace()
248
271
  console.groupEnd()
249
272
  }
250
273
 
274
+ lastAnimationStyle.current = next
275
+ lastAnimateAt.current = Date.now()
276
+
251
277
  if (!diff) {
252
278
  return
253
279
  }
254
280
 
255
- lastAnimateAt.current = Date.now()
256
281
  controls.current = animate(scope.current, diff, animationOptions)
257
- lastAnimationStyle.current = next
258
282
  } finally {
259
283
  if (isExiting) {
260
284
  if (controls.current) {
@@ -287,17 +311,27 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
287
311
  }
288
312
  }, [])
289
313
 
314
+ const animateKey = JSON.stringify(doAnimate)
315
+
290
316
  useIsomorphicLayoutEffect(() => {
317
+ if (isFirstRender.current) {
318
+ updateFirstAnimationStyle()
319
+ isFirstRender.current = false
320
+ return
321
+ }
322
+
291
323
  if (!doAnimate && !isExiting) return
292
324
 
293
325
  // always clear queue if we re-render
294
326
  animationsQueue.current = []
295
327
 
296
- runAnimation({
328
+ // don't ever queue on a render
329
+ flushAnimation({
297
330
  doAnimate,
331
+ dontAnimate,
298
332
  animationOptions,
299
333
  })
300
- }, [JSON.stringify(doAnimate), isExiting, lastAnimationStyle])
334
+ }, [animateKey, isExiting, lastAnimationStyle])
301
335
 
302
336
  const [initialStyle] = useState(() => ({ ...dontAnimate, ...doAnimate }))
303
337
 
@@ -307,17 +341,19 @@ export function createAnimations<A extends Record<string, AnimationConfig>>(
307
341
  style,
308
342
  doAnimate,
309
343
  dontAnimate,
344
+ animateKey,
310
345
  scope,
311
346
  animationOptions,
312
347
  initialStyle,
313
348
  isExiting,
349
+ isFirstRender: isFirstRender.current,
314
350
  })
315
351
  console.groupEnd()
316
352
  }
317
353
 
318
354
  return {
319
- // avoid first render returning wrong styles - always render all, after that we can just mutate
320
- style: isFirstRender.current ? style : dontAnimate,
355
+ // we never change this, after first render on
356
+ style: firstRenderStyle,
321
357
  ref: scope,
322
358
  tag: 'div',
323
359
  }
@@ -500,6 +536,10 @@ const disableAnimationProps = new Set<string>([
500
536
  'flexGrow',
501
537
  'flexShrink',
502
538
  'justifyContent',
539
+ 'marginRight',
540
+ 'marginLeft',
541
+ 'marginBottom',
542
+ 'marginTop',
503
543
  'maxHeight',
504
544
  'maxWidth',
505
545
  'minHeight',
@@ -515,6 +555,7 @@ const disableAnimationProps = new Set<string>([
515
555
  'textWrap',
516
556
  'transformOrigin',
517
557
  'zIndex',
558
+ 'WebkitBackdropFilter',
518
559
  ])
519
560
 
520
561
  const MotionView = createMotionView('div')
@@ -1,5 +1,5 @@
1
1
  {
2
- "mappings": "AAAA,cAEO,uBAYA,eAAe;AAEtB,cAOO,uBACA,cAAc;KAMhB,kBAAkB;AAevB,OAAO,iBAAS,iBAAiB,UAAU,eAAe,kBACxDA,gBAAgB,IACf,gBAAgB",
2
+ "mappings": "AAAA,cAEO,uBAYA,eAAe;AAEtB,cAOO,uBACA,cAAc;KAahB,kBAAkB;AAevB,OAAO,iBAAS,iBAAiB,UAAU,eAAe,kBACxDA,gBAAgB,IACf,gBAAgB",
3
3
  "names": [
4
4
  "animationsProp: A"
5
5
  ],
@@ -7,7 +7,7 @@
7
7
  "src/createAnimations.tsx"
8
8
  ],
9
9
  "sourcesContent": [
10
- "import {\n type AnimatedNumberStrategy,\n type AnimationDriver,\n type AnimationProp,\n fixStyles,\n getSplitStyles,\n hooks,\n styleToCSS,\n Text,\n type UniversalAnimatedNumber,\n useComposedRefs,\n useIsomorphicLayoutEffect,\n useThemeWithState,\n View,\n} from '@tamagui/core'\nimport { ResetPresence, usePresence } from '@tamagui/use-presence'\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, { forwardRef, RefObject, useEffect, useMemo, useRef, useState } from 'react'\n\n// TODO: useAnimatedNumber style could avoid re-rendering\n\ntype MotionAnimatedNumber = MotionValue<number>\ntype AnimationConfig = ValueTransition\n\ntype MotionAnimatedNumberStyle = {\n getStyle: (cur: number) => Record<string, unknown>\n motionValue: MotionValue<number>\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\nexport function createAnimations<A extends Record<string, AnimationConfig>>(\n animationsProp: A\n): AnimationDriver<A> {\n // normalize, it doesn't assume type: 'spring' even if damping etc there so we do that\n // which also matches the moti driver\n // @ts-expect-error avoid doing a spread for no reason, sub-constraint type issue\n const animations: A = {}\n for (const key in animationsProp) {\n animations[key] = {\n type: 'spring',\n ...animationsProp[key],\n }\n }\n\n return {\n // this is only used by Sheet basically for now to pass result of useAnimatedStyle to\n View: MotionView,\n Text: MotionText,\n isReactNative: false,\n supportsCSS: true,\n needsWebStyles: true,\n avoidReRenders: true,\n animations,\n usePresence,\n ResetPresence,\n\n useAnimations: (animationProps) => {\n const { props, style, componentState, stateRef, useStyleEmitter, presence } =\n animationProps\n\n const animationKey = Array.isArray(props.animation)\n ? props.animation[0]\n : props.animation\n\n const isHydrating = componentState.unmounted === true\n const disableAnimation = isHydrating || !animationKey\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n\n const isFirstRender = useRef(true)\n const [scope, animate] = useAnimate()\n const lastAnimationStyle = useRef<Record<string, unknown> | null>(null)\n const lastDontAnimate = useRef<Record<string, unknown>>({})\n const controls = useRef<AnimationPlaybackControlsWithThen | null>(null)\n const styleKey = JSON.stringify(style)\n\n const shouldDebug =\n process.env.NODE_ENV === 'development' &&\n props['debug'] &&\n props['debug'] !== 'profile'\n\n const {\n dontAnimate = {},\n doAnimate,\n animationOptions,\n } = useMemo(() => {\n const motionAnimationState = getMotionAnimatedProps(\n props as any,\n style,\n disableAnimation\n )\n return motionAnimationState\n }, [isExiting, animationKey, styleKey])\n\n const animationsQueue = useRef<AnimationProps[]>([])\n const lastAnimateAt = useRef(0)\n const minTimeBetweenAnimations = 16.667\n const disposed = useRef(false)\n\n useIsomorphicLayoutEffect(() => {\n lastDontAnimate.current = dontAnimate\n })\n\n useEffect(() => {\n isFirstRender.current = false\n\n return () => {\n disposed.current = true\n }\n }, [])\n\n // useIsomorphicLayoutEffect(() => {\n // let disposed = false\n\n // // requestAnimationFrame(animationFrame)\n // // frame.postRender(animationFrame)\n\n // return () => {\n // disposed = true\n // }\n // }, [scope])\n\n const runAnimation = (props: AnimationProps) => {\n const waitForNextAnimationFrame = () => {\n // we just skip to the last one\n const queue = animationsQueue.current\n const last = queue[queue.length - 1]\n animationsQueue.current = []\n\n if (!last) {\n console.error(`Should never hit`)\n return\n }\n\n if (!props) return\n\n const elapsed = Date.now() - lastAnimateAt.current\n\n if (elapsed > minTimeBetweenAnimations && animationsQueue.current.length) {\n console.info('slow', elapsed, { props })\n }\n\n if (scope.current) {\n flushAnimation(props)\n } else {\n if (!disposed.current) {\n // frame.postRender(waitForNextAnimationFrame)\n requestAnimationFrame(waitForNextAnimationFrame)\n }\n }\n }\n\n const hasQueue = animationsQueue.current.length\n const shouldWait =\n hasQueue || Date.now() - lastAnimateAt.current > minTimeBetweenAnimations\n\n if (isExiting || isFirstRender.current || (scope.current && !shouldWait)) {\n flushAnimation(props)\n } else {\n animationsQueue.current.push(props)\n if (!hasQueue) {\n waitForNextAnimationFrame()\n }\n }\n }\n\n const flushAnimation = ({\n doAnimate,\n dontAnimate,\n animationOptions = {},\n }: AnimationProps) => {\n try {\n const node = stateRef.current.host\n\n if (!(node instanceof HTMLElement)) {\n return\n }\n\n if (!lastAnimationStyle.current) {\n lastAnimationStyle.current = style\n const firstAnimation = animate(scope.current, doAnimate || {}, {\n type: false,\n })\n firstAnimation.complete()\n // scope.animations = []\n\n if (shouldDebug) {\n console.groupCollapsed(`[motion] 🌊 FIRST`)\n console.info(doAnimate)\n console.groupEnd()\n }\n return\n }\n\n if (!doAnimate && !dontAnimate) {\n return\n }\n\n const next = doAnimate || {}\n\n // handle case where dontAnimate changes\n // we just set it onto animate + set options to not actually animate\n if (dontAnimate) {\n if (node) {\n const diff = getDiff(lastDontAnimate.current, dontAnimate)\n if (diff) {\n lastDontAnimate.current = dontAnimate\n Object.assign(node.style, dontAnimate as any)\n }\n for (const key in lastDontAnimate.current) {\n if (!(key in dontAnimate)) {\n console.info('deleting!', key, { dontAnimate, doAnimate })\n delete node.style[key]\n }\n }\n }\n }\n\n const diff = getDiff(lastAnimationStyle.current, next)\n\n if (shouldDebug) {\n console.groupCollapsed(\n `[motion] 🌊 animate (${JSON.stringify(diff, null, 2)})`\n )\n console.info({\n next,\n animationOptions,\n animationProps,\n diff,\n lastAnimationStyle: { ...lastAnimationStyle.current },\n isExiting,\n })\n console.groupEnd()\n }\n\n if (!diff) {\n return\n }\n\n lastAnimateAt.current = Date.now()\n controls.current = animate(scope.current, diff, animationOptions)\n lastAnimationStyle.current = next\n } finally {\n if (isExiting) {\n if (controls.current) {\n controls.current.finished.then(() => {\n sendExitComplete?.()\n })\n } else {\n sendExitComplete?.()\n }\n }\n }\n }\n\n useStyleEmitter?.((nextStyle) => {\n const animationProps = getMotionAnimatedProps(\n props as any,\n nextStyle,\n disableAnimation\n )\n runAnimation(animationProps)\n })\n\n // strict mode correctness fix, idk why i thought it would clear a useRef\n // before running strict? if you remove this you'll see the next\n // useLayoutEffect re-run and animate due to lastAnimationStyle.current\n // being set when in theory it should be clear\n useEffect(() => {\n return () => {\n lastAnimationStyle.current = null\n }\n }, [])\n\n useIsomorphicLayoutEffect(() => {\n if (!doAnimate && !isExiting) return\n\n // always clear queue if we re-render\n animationsQueue.current = []\n\n runAnimation({\n doAnimate,\n animationOptions,\n })\n }, [JSON.stringify(doAnimate), isExiting, lastAnimationStyle])\n\n const [initialStyle] = useState(() => ({ ...dontAnimate, ...doAnimate }))\n\n if (shouldDebug) {\n console.groupCollapsed(`[motion] 🌊 render`)\n console.info({\n style,\n doAnimate,\n dontAnimate,\n scope,\n animationOptions,\n initialStyle,\n isExiting,\n })\n console.groupEnd()\n }\n\n return {\n // avoid first render returning wrong styles - always render all, after that we can just mutate\n style: isFirstRender.current ? style : dontAnimate,\n ref: scope,\n tag: '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 // Motion doesn't have a direct onFinish callback, so we simulate it\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 // never changes\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: { animation: AnimationProp | null; animateOnly?: string[] },\n style: Record<string, unknown>,\n disable: boolean\n ): AnimationProps {\n if (disable) {\n return {\n dontAnimate: style,\n }\n }\n\n const animationOptions = animationPropToAnimationConfig(props.animation)\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 // half works in chrome but janky and stops working after first animation\n // if (\n // typeof doAnimate?.opacity !== 'undefined' &&\n // typeof dontAnimate?.backdropFilter === 'string'\n // ) {\n // if (!dontAnimate.backdropFilter.includes('opacity(')) {\n // dontAnimate.backdropFilter += ` opacity(${doAnimate.opacity})`\n // dontAnimate.WebkitBackdropFilter += ` opacity(${doAnimate.opacity})`\n // dontAnimate.transition = 'backdrop-filter ease-in 1000ms'\n // }\n // }\n\n return {\n dontAnimate,\n doAnimate,\n animationOptions,\n }\n }\n\n function animationPropToAnimationConfig(\n animationProp: AnimationProp | null\n ): AnimationOptions {\n let defaultAnimationKey = ''\n let specificAnimations = {}\n\n if (typeof animationProp === 'string') {\n defaultAnimationKey = animationProp\n } else if (Array.isArray(animationProp)) {\n if (typeof animationProp[0] === 'string') {\n defaultAnimationKey = animationProp[0]\n specificAnimations = animationProp[1]\n } else {\n specificAnimations = animationProp\n }\n }\n\n if (!defaultAnimationKey) {\n return {}\n }\n\n const defaultConfig = animations[defaultAnimationKey]\n\n return {\n default: defaultConfig,\n ...Object.fromEntries(\n Object.entries(specificAnimations).flatMap(\n ([propName, animationNameOrConfig]) => {\n if (typeof animationNameOrConfig === 'string') {\n return [[propName, animations[animationNameOrConfig]]]\n }\n if (animationNameOrConfig && typeof animationNameOrConfig === 'object') {\n return [\n [\n propName,\n {\n ...defaultConfig,\n ...animationNameOrConfig,\n },\n ],\n ]\n }\n return []\n }\n )\n ),\n }\n }\n}\n\n// sort of temporary\nconst disableAnimationProps = new Set<string>([\n 'alignContent',\n 'alignItems',\n 'aspectRatio',\n 'backdropFilter',\n 'boxSizing',\n 'contain',\n 'display',\n 'flexBasis',\n 'flexDirection',\n 'flexGrow',\n 'flexShrink',\n 'justifyContent',\n 'maxHeight',\n 'maxWidth',\n 'minHeight',\n 'minWidth',\n 'outlineColor',\n 'outlineStyle',\n 'outlineWidth',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'pointerEvents',\n 'position',\n 'textWrap',\n 'transformOrigin',\n 'zIndex',\n])\n\nconst MotionView = createMotionView('div')\nconst MotionText = createMotionView('span')\n\nfunction createMotionView(defaultTag: string) {\n // return forwardRef((props: any, ref) => {\n // console.info('rendering?', props)\n // const Element = motion[props.tag || defaultTag]\n // return <Element ref={ref} {...props} />\n // })\n const isText = defaultTag === 'span'\n\n const Component = forwardRef((propsIn: any, ref) => {\n const { forwardedRef, animation, tag = defaultTag, style, ...propsRest } = propsIn\n const [scope, animate] = useAnimate()\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 // we can assume just one animatedStyle max for now\n const [animatedStyle, nonAnimatedStyles] = (() => {\n return [\n styles.find((x) => x.getStyle) as MotionAnimatedNumberStyle | undefined,\n styles.filter((x) => !x.getStyle),\n ] 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 // noMergeStyle: true,\n resolveValues: 'auto',\n }\n )\n\n if (!out) {\n return {}\n }\n\n // we can definitely get rid of this here\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 = tag || 'div'\n const transformedProps = hooks.usePropsTransform?.(tag, 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['acceptTagProp'] = 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"
10
+ "import {\n type AnimatedNumberStrategy,\n type AnimationDriver,\n type AnimationProp,\n fixStyles,\n getSplitStyles,\n hooks,\n styleToCSS,\n Text,\n type UniversalAnimatedNumber,\n useComposedRefs,\n useIsomorphicLayoutEffect,\n useThemeWithState,\n View,\n} from '@tamagui/core'\nimport { ResetPresence, usePresence } from '@tamagui/use-presence'\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\n// TODO: useAnimatedNumber style could avoid re-rendering\n\ntype MotionAnimatedNumber = MotionValue<number>\ntype AnimationConfig = ValueTransition\n\ntype MotionAnimatedNumberStyle = {\n getStyle: (cur: number) => Record<string, unknown>\n motionValue: MotionValue<number>\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\nexport function createAnimations<A extends Record<string, AnimationConfig>>(\n animationsProp: A\n): AnimationDriver<A> {\n // normalize, it doesn't assume type: 'spring' even if damping etc there so we do that\n // which also matches the moti driver\n // @ts-expect-error avoid doing a spread for no reason, sub-constraint type issue\n const animations: A = {}\n for (const key in animationsProp) {\n animations[key] = {\n type: 'spring',\n ...animationsProp[key],\n }\n }\n\n return {\n // this is only used by Sheet basically for now to pass result of useAnimatedStyle to\n View: MotionView,\n Text: MotionText,\n isReactNative: false,\n supportsCSS: true,\n needsWebStyles: true,\n avoidReRenders: true,\n animations,\n usePresence,\n ResetPresence,\n\n useAnimations: (animationProps) => {\n const { props, style, componentState, stateRef, useStyleEmitter, presence } =\n animationProps\n\n const animationKey = Array.isArray(props.animation)\n ? props.animation[0]\n : props.animation\n\n const isHydrating = componentState.unmounted === true\n const disableAnimation = isHydrating || !animationKey\n const isExiting = presence?.[0] === false\n const sendExitComplete = presence?.[1]\n\n const isFirstRender = useRef(true)\n const [scope, animate] = useAnimate()\n const lastAnimationStyle = useRef<Record<string, unknown> | null>(null)\n const controls = useRef<AnimationPlaybackControlsWithThen | null>(null)\n const styleKey = JSON.stringify(style)\n\n // until fully stable allow debugging in prod to help debugging prod issues\n const shouldDebug =\n // process.env.NODE_ENV === 'development' &&\n props['debug'] && props['debug'] !== 'profile'\n\n const {\n dontAnimate = {},\n doAnimate,\n animationOptions,\n } = useMemo(() => {\n const motionAnimationState = getMotionAnimatedProps(\n props as any,\n style,\n disableAnimation\n )\n return motionAnimationState\n }, [isExiting, animationKey, styleKey])\n\n const animationsQueue = useRef<AnimationProps[]>([])\n const lastAnimateAt = useRef(0)\n const minTimeBetweenAnimations = 16.667\n const disposed = useRef(false)\n const [firstRenderStyle] = useState(style)\n\n // avoid first render returning wrong styles - always render all, after that we can just mutate\n const lastDontAnimate = useRef<Record<string, unknown>>(firstRenderStyle)\n\n useLayoutEffect(() => {\n return () => {\n disposed.current = true\n }\n }, [])\n\n // useIsomorphicLayoutEffect(() => {\n // let disposed = false\n\n // // requestAnimationFrame(animationFrame)\n // // frame.postRender(animationFrame)\n\n // return () => {\n // disposed = true\n // }\n // }, [scope])\n\n const runAnimation = (props: AnimationProps) => {\n const waitForNextAnimationFrame = () => {\n // we just skip to the last one\n const queue = animationsQueue.current\n const last = queue[queue.length - 1]\n animationsQueue.current = []\n\n if (!last) {\n console.error(`Should never hit`)\n return\n }\n\n if (!props) return\n\n const elapsed = Date.now() - lastAnimateAt.current\n\n if (elapsed > minTimeBetweenAnimations && animationsQueue.current.length) {\n console.info('slow', elapsed, { props })\n }\n\n if (scope.current) {\n flushAnimation(props)\n } else {\n if (!disposed.current) {\n // frame.postRender(waitForNextAnimationFrame)\n requestAnimationFrame(waitForNextAnimationFrame)\n }\n }\n }\n\n const hasQueue = animationsQueue.current.length\n const shouldWait =\n hasQueue ||\n (lastAnimateAt.current &&\n Date.now() - lastAnimateAt.current > minTimeBetweenAnimations)\n\n if (isExiting || isFirstRender.current || (scope.current && !shouldWait)) {\n flushAnimation(props)\n } else {\n animationsQueue.current.push(props)\n if (!hasQueue) {\n waitForNextAnimationFrame()\n }\n }\n }\n\n const updateFirstAnimationStyle = () => {\n const node = stateRef.current.host\n\n if (!(node instanceof HTMLElement)) {\n return false\n }\n\n if (!lastAnimationStyle.current) {\n lastAnimationStyle.current = style\n const firstAnimation = animate(scope.current, doAnimate || {}, {\n type: false,\n })\n firstAnimation.complete()\n scope.animations = []\n\n if (shouldDebug) {\n console.groupCollapsed(`[motion] 🌊 FIRST`)\n console.info(doAnimate)\n console.groupEnd()\n }\n return true\n }\n\n return false\n }\n\n const flushAnimation = ({\n doAnimate,\n dontAnimate,\n animationOptions = {},\n }: AnimationProps) => {\n try {\n const node = stateRef.current.host\n\n if (!(node instanceof HTMLElement)) {\n return\n }\n\n if (!doAnimate && !dontAnimate) {\n return\n }\n\n const next = doAnimate || {}\n\n // handle case where dontAnimate changes\n // we just set it onto animate + set options to not actually animate\n if (dontAnimate) {\n const curDontAnimate = lastDontAnimate.current\n if (node && curDontAnimate) {\n for (const key in curDontAnimate) {\n if (!(key in style)) {\n console.info('deleting!', key, { dontAnimate, doAnimate })\n delete node.style[key]\n }\n }\n const newDontAnimate = getDiff(curDontAnimate, dontAnimate)\n if (newDontAnimate) {\n Object.assign(node.style, newDontAnimate as any)\n }\n }\n }\n\n lastDontAnimate.current = dontAnimate || {}\n\n if (updateFirstAnimationStyle()) {\n return\n }\n\n const diff = getDiff(lastAnimationStyle.current, next)\n\n if (shouldDebug) {\n console.groupCollapsed(\n `[motion] 🌊 animate (${JSON.stringify(diff, null, 2)})`\n )\n console.info({\n next,\n animationOptions,\n animationProps,\n diff,\n lastAnimationStyle: { ...lastAnimationStyle.current },\n isExiting,\n })\n console.trace()\n console.groupEnd()\n }\n\n lastAnimationStyle.current = next\n lastAnimateAt.current = Date.now()\n\n if (!diff) {\n return\n }\n\n controls.current = animate(scope.current, diff, animationOptions)\n } finally {\n if (isExiting) {\n if (controls.current) {\n controls.current.finished.then(() => {\n sendExitComplete?.()\n })\n } else {\n sendExitComplete?.()\n }\n }\n }\n }\n\n useStyleEmitter?.((nextStyle) => {\n const animationProps = getMotionAnimatedProps(\n props as any,\n nextStyle,\n disableAnimation\n )\n runAnimation(animationProps)\n })\n\n // strict mode correctness fix, idk why i thought it would clear a useRef\n // before running strict? if you remove this you'll see the next\n // useLayoutEffect re-run and animate due to lastAnimationStyle.current\n // being set when in theory it should be clear\n useEffect(() => {\n return () => {\n lastAnimationStyle.current = null\n }\n }, [])\n\n const animateKey = JSON.stringify(doAnimate)\n\n useIsomorphicLayoutEffect(() => {\n if (isFirstRender.current) {\n updateFirstAnimationStyle()\n isFirstRender.current = false\n return\n }\n\n if (!doAnimate && !isExiting) return\n\n // always clear queue if we re-render\n animationsQueue.current = []\n\n // don't ever queue on a render\n flushAnimation({\n doAnimate,\n dontAnimate,\n animationOptions,\n })\n }, [animateKey, isExiting, lastAnimationStyle])\n\n const [initialStyle] = useState(() => ({ ...dontAnimate, ...doAnimate }))\n\n if (shouldDebug) {\n console.groupCollapsed(`[motion] 🌊 render`)\n console.info({\n style,\n doAnimate,\n dontAnimate,\n animateKey,\n scope,\n animationOptions,\n initialStyle,\n isExiting,\n isFirstRender: isFirstRender.current,\n })\n console.groupEnd()\n }\n\n return {\n // we never change this, after first render on\n style: firstRenderStyle,\n ref: scope,\n tag: '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 // Motion doesn't have a direct onFinish callback, so we simulate it\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 // never changes\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: { animation: AnimationProp | null; animateOnly?: string[] },\n style: Record<string, unknown>,\n disable: boolean\n ): AnimationProps {\n if (disable) {\n return {\n dontAnimate: style,\n }\n }\n\n const animationOptions = animationPropToAnimationConfig(props.animation)\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 // half works in chrome but janky and stops working after first animation\n // if (\n // typeof doAnimate?.opacity !== 'undefined' &&\n // typeof dontAnimate?.backdropFilter === 'string'\n // ) {\n // if (!dontAnimate.backdropFilter.includes('opacity(')) {\n // dontAnimate.backdropFilter += ` opacity(${doAnimate.opacity})`\n // dontAnimate.WebkitBackdropFilter += ` opacity(${doAnimate.opacity})`\n // dontAnimate.transition = 'backdrop-filter ease-in 1000ms'\n // }\n // }\n\n return {\n dontAnimate,\n doAnimate,\n animationOptions,\n }\n }\n\n function animationPropToAnimationConfig(\n animationProp: AnimationProp | null\n ): AnimationOptions {\n let defaultAnimationKey = ''\n let specificAnimations = {}\n\n if (typeof animationProp === 'string') {\n defaultAnimationKey = animationProp\n } else if (Array.isArray(animationProp)) {\n if (typeof animationProp[0] === 'string') {\n defaultAnimationKey = animationProp[0]\n specificAnimations = animationProp[1]\n } else {\n specificAnimations = animationProp\n }\n }\n\n if (!defaultAnimationKey) {\n return {}\n }\n\n const defaultConfig = animations[defaultAnimationKey]\n\n return {\n default: defaultConfig,\n ...Object.fromEntries(\n Object.entries(specificAnimations).flatMap(\n ([propName, animationNameOrConfig]) => {\n if (typeof animationNameOrConfig === 'string') {\n return [[propName, animations[animationNameOrConfig]]]\n }\n if (animationNameOrConfig && typeof animationNameOrConfig === 'object') {\n return [\n [\n propName,\n {\n ...defaultConfig,\n ...animationNameOrConfig,\n },\n ],\n ]\n }\n return []\n }\n )\n ),\n }\n }\n}\n\n// sort of temporary\nconst disableAnimationProps = new Set<string>([\n 'alignContent',\n 'alignItems',\n 'aspectRatio',\n 'backdropFilter',\n 'boxSizing',\n 'contain',\n 'display',\n 'flexBasis',\n 'flexDirection',\n 'flexGrow',\n 'flexShrink',\n 'justifyContent',\n 'marginRight',\n 'marginLeft',\n 'marginBottom',\n 'marginTop',\n 'maxHeight',\n 'maxWidth',\n 'minHeight',\n 'minWidth',\n 'outlineColor',\n 'outlineStyle',\n 'outlineWidth',\n 'overflow',\n 'overflowX',\n 'overflowY',\n 'pointerEvents',\n 'position',\n 'textWrap',\n 'transformOrigin',\n 'zIndex',\n 'WebkitBackdropFilter',\n])\n\nconst MotionView = createMotionView('div')\nconst MotionText = createMotionView('span')\n\nfunction createMotionView(defaultTag: string) {\n // return forwardRef((props: any, ref) => {\n // console.info('rendering?', props)\n // const Element = motion[props.tag || defaultTag]\n // return <Element ref={ref} {...props} />\n // })\n const isText = defaultTag === 'span'\n\n const Component = forwardRef((propsIn: any, ref) => {\n const { forwardedRef, animation, tag = defaultTag, style, ...propsRest } = propsIn\n const [scope, animate] = useAnimate()\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 // we can assume just one animatedStyle max for now\n const [animatedStyle, nonAnimatedStyles] = (() => {\n return [\n styles.find((x) => x.getStyle) as MotionAnimatedNumberStyle | undefined,\n styles.filter((x) => !x.getStyle),\n ] 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 // noMergeStyle: true,\n resolveValues: 'auto',\n }\n )\n\n if (!out) {\n return {}\n }\n\n // we can definitely get rid of this here\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 = tag || 'div'\n const transformedProps = hooks.usePropsTransform?.(tag, 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['acceptTagProp'] = 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"
11
11
  ],
12
12
  "version": 3
13
13
  }