@hanzogui/animations-moti 8.3.1 → 8.3.3

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.
Files changed (42) hide show
  1. package/dist/cjs/createAnimations.js +304 -0
  2. package/dist/cjs/createAnimations.js.map +1 -0
  3. package/dist/cjs/index.js +6 -0
  4. package/dist/cjs/index.js.map +1 -0
  5. package/dist/cjs/package.json +1 -0
  6. package/dist/cjs/polyfill.js +10 -0
  7. package/dist/cjs/polyfill.js.map +1 -0
  8. package/dist/esm/createAnimations.js +300 -0
  9. package/dist/esm/createAnimations.js.map +1 -0
  10. package/dist/esm/index.js +3 -3
  11. package/dist/esm/index.js.map +1 -1
  12. package/dist/esm/polyfill.js +10 -0
  13. package/dist/esm/polyfill.js.map +1 -0
  14. package/package.json +22 -17
  15. package/src/index.ts +2 -2
  16. package/types/createAnimations.d.ts +2 -3
  17. package/types/createAnimations.d.ts.map +1 -11
  18. package/types/index.d.ts +2 -3
  19. package/types/index.d.ts.map +1 -11
  20. package/types/polyfill.d.ts +0 -1
  21. package/types/polyfill.d.ts.map +1 -11
  22. package/dist/cjs/createAnimations.cjs +0 -308
  23. package/dist/cjs/createAnimations.native.js +0 -328
  24. package/dist/cjs/createAnimations.native.js.map +0 -1
  25. package/dist/cjs/index.cjs +0 -21
  26. package/dist/cjs/index.native.js +0 -24
  27. package/dist/cjs/index.native.js.map +0 -1
  28. package/dist/cjs/polyfill.cjs +0 -6
  29. package/dist/cjs/polyfill.native.js +0 -9
  30. package/dist/cjs/polyfill.native.js.map +0 -1
  31. package/dist/esm/createAnimations.mjs +0 -272
  32. package/dist/esm/createAnimations.mjs.map +0 -1
  33. package/dist/esm/createAnimations.native.js +0 -289
  34. package/dist/esm/createAnimations.native.js.map +0 -1
  35. package/dist/esm/index.mjs +0 -3
  36. package/dist/esm/index.mjs.map +0 -1
  37. package/dist/esm/index.native.js +0 -3
  38. package/dist/esm/index.native.js.map +0 -1
  39. package/dist/esm/polyfill.mjs +0 -7
  40. package/dist/esm/polyfill.mjs.map +0 -1
  41. package/dist/esm/polyfill.native.js +0 -7
  42. package/dist/esm/polyfill.native.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createAnimations.js","sourceRoot":"","sources":["../../src/createAnimations.tsx"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpF,2CAA2C;AAC3C,OAAO,EACL,cAAc,EACd,KAAK,EACL,KAAK,EACL,IAAI,EACJ,eAAe,EACf,iBAAiB,EACjB,IAAI,GAGL,MAAM,gBAAgB,CAAA;AAEvB,2FAA2F;AAC3F,MAAM,mBAAmB,GAAG,CAAC,KAAU,EAAE,MAAe,EAAO,EAAE;IAC/D,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;QAC7D,MAAM,YAAY,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAA;QACtE,OAAO,YAAY,CAAA;IACrB,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAG1D,OAAO,SAAS,EAAE,EAChB,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,UAAU,EACV,UAAU,GACX,MAAM,yBAAyB,CAAA;AAEhC,oCAAoC;AACpC,2EAA2E;AAC3E,MAAM,YAAY,GAAG,CAAK,CAAqB,EAAK,EAAE;IACpD,MAAM,CAAC,GAAG,CAAQ,CAAA;IAClB,MAAM,GAAG,GAAG,CAAC,CAA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import "./polyfill.mjs";
2
- export * from "./createAnimations.mjs";
3
- //# sourceMappingURL=index.js.map
1
+ import './polyfill.js';
2
+ export * from './createAnimations.js';
3
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO;AAEP,cAAc","ignoreList":[]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,cAAc,uBAAwB,CAAA"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // for SSR
3
+ if (typeof requestAnimationFrame === 'undefined') {
4
+ globalThis['requestAnimationFrame'] = setTimeout;
5
+ }
6
+ // for reanimated
7
+ if (typeof global === 'undefined') {
8
+ globalThis['global'] = globalThis;
9
+ }
10
+ //# sourceMappingURL=polyfill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyfill.js","sourceRoot":"","sources":["../../src/polyfill.ts"],"names":[],"mappings":";AAAA,UAAU;AACV,IAAI,OAAO,qBAAqB,KAAK,WAAW,EAAE,CAAC;IACjD,UAAU,CAAC,uBAAuB,CAAC,GAAG,UAAU,CAAA;AAClD,CAAC;AAED,iBAAiB;AACjB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,UAAU,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAA;AACnC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzogui/animations-moti",
3
- "version": "8.3.1",
3
+ "version": "8.3.3",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "source": "src/index.ts",
@@ -13,41 +13,46 @@
13
13
  "sideEffects": [
14
14
  "polyfill.*"
15
15
  ],
16
- "main": "dist/cjs",
17
- "module": "dist/esm",
16
+ "main": "./dist/cjs/index.js",
17
+ "module": "./dist/esm/index.js",
18
18
  "types": "./types/index.d.ts",
19
19
  "exports": {
20
20
  "./package.json": "./package.json",
21
21
  ".": {
22
22
  "types": "./types/index.d.ts",
23
- "react-native": "./dist/esm/index.native.js",
24
- "browser": "./dist/esm/index.mjs",
25
- "module": "./dist/esm/index.mjs",
26
- "import": "./dist/esm/index.mjs",
27
- "require": "./dist/cjs/index.cjs",
28
- "default": "./dist/esm/index.mjs"
23
+ "react-native": "./dist/esm/index.js",
24
+ "browser": "./dist/esm/index.js",
25
+ "module": "./dist/esm/index.js",
26
+ "import": "./dist/esm/index.js",
27
+ "require": "./dist/cjs/index.js",
28
+ "default": "./dist/esm/index.js"
29
29
  }
30
30
  },
31
31
  "publishConfig": {
32
32
  "access": "public"
33
33
  },
34
34
  "scripts": {
35
- "build": "hanzogui-build",
35
+ "build": "hanzogui-build --skip-native",
36
36
  "watch": "hanzogui-build --watch",
37
37
  "clean": "hanzogui-build clean",
38
38
  "clean:build": "hanzogui-build clean:build"
39
39
  },
40
40
  "dependencies": {
41
- "@hanzogui/core": "8.3.1",
42
- "@hanzogui/use-presence": "8.3.1"
41
+ "@hanzogui/core": "8.3.3",
42
+ "@hanzogui/use-presence": "8.3.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@hanzogui/build": "8.3.1",
46
- "react": ">=19",
47
- "react-native": "0.83.2",
48
- "react-native-reanimated": "~4.2.2"
45
+ "@hanzogui/build": "8.3.3",
46
+ "react": "19.2.8",
47
+ "react-native": "^0.87.1",
48
+ "react-native-reanimated": "^4.6.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "react": ">=19"
51
+ "react": ">=19.2.8"
52
+ },
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "git+https://github.com/hanzoai/gui.git",
56
+ "directory": "pkgs/core/animations-moti"
52
57
  }
53
58
  }
package/src/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- import './polyfill'
1
+ import './polyfill.ts'
2
2
 
3
- export * from './createAnimations'
3
+ export * from './createAnimations.tsx'
@@ -1,5 +1,4 @@
1
- import { type AnimationDriver } from "@hanzogui/core";
2
- import type { TransitionConfig } from "moti";
1
+ import { type AnimationDriver } from '@hanzogui/core';
2
+ import type { TransitionConfig } from 'moti';
3
3
  export declare function createAnimations<A extends Record<string, TransitionConfig>>(animations: A): AnimationDriver<A>;
4
-
5
4
  //# sourceMappingURL=createAnimations.d.ts.map
@@ -1,11 +1 @@
1
- {
2
- "mappings": "AAGA,cAQO,uBAEA;AAUP,cAAc,wBAAwB;AAwHtC,OAAO,iBAAS,iBAAiB,UAAU,eAAe,mBACxD,YAAY,IACX,gBAAgB",
3
- "names": [],
4
- "sources": [
5
- "src/createAnimations.tsx"
6
- ],
7
- "version": 3,
8
- "sourcesContent": [
9
- "// @ts-nocheck - deprecated package, moti dependency intentionally not included\nimport { PresenceContext, ResetPresence, usePresence } from '@hanzogui/use-presence'\n// we need core for hooks.usePropsTransform\nimport {\n getSplitStyles,\n hooks,\n isWeb,\n Text,\n useComposedRefs,\n useThemeWithState,\n View,\n type AnimationDriver,\n type UniversalAnimatedNumber,\n} from '@hanzogui/core'\n\n// Helper to resolve dynamic theme values like {dynamic: {dark: \"value\", light: undefined}}\nconst resolveDynamicValue = (value: any, isDark: boolean): any => {\n if (value && typeof value === 'object' && 'dynamic' in value) {\n const dynamicValue = isDark ? value.dynamic.dark : value.dynamic.light\n return dynamicValue\n }\n return value\n}\nimport type { TransitionConfig } from 'moti'\nimport { useMotify } from 'moti/author'\nimport type { CSSProperties } from 'react'\nimport React, { forwardRef, useMemo, useRef } from 'react'\nimport type { TextStyle } from 'react-native'\nimport type { SharedValue } from 'react-native-reanimated'\nimport Animated_, {\n cancelAnimation,\n runOnJS,\n useAnimatedReaction,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withSpring,\n withTiming,\n} from 'react-native-reanimated'\n\n// fix for building with type module\n// see https://github.com/evanw/esbuild/issues/2480#issuecomment-1833104754\nconst safeESModule = <T,>(a: T | { default: T }): T => {\n const b = a as any\n const out = b.__esModule || b[Symbol.toStringTag] === 'Module' ? b.default : b\n // add metro support\n return out || a\n}\n\nconst Animated = safeESModule(Animated_)\n\ntype ReanimatedAnimatedNumber = SharedValue<number>\n\n// this is our own custom reanimated animated component so we can allow data- attributes, className etc\n// this should ultimately be merged with react-native-web-lite\n\nfunction createGuiAnimatedComponent(defaultTag = 'div') {\n const isText = defaultTag === 'span'\n\n const Component = Animated.createAnimatedComponent(\n forwardRef((propsIn: any, ref) => {\n const { forwardedRef, animation, render = defaultTag, ...propsRest } = propsIn\n const hostRef = useRef(null)\n const composedRefs = useComposedRefs(forwardedRef, ref, hostRef)\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 // get styles but only inline style\n const result = getSplitStyles(\n propsRest,\n isText ? Text.staticConfig : View.staticConfig,\n state?.theme,\n state?.name,\n {\n unmounted: false,\n } as any,\n {\n isAnimated: false,\n noClass: true,\n }\n )\n\n const props = result?.viewProps || {}\n const Element = render\n const transformedProps = hooks.usePropsTransform?.(render, props, stateRef, false)\n\n return <Element {...transformedProps} ref={composedRefs} />\n })\n )\n Component['acceptRenderProp'] = true\n return Component\n}\n\nconst AnimatedView = createGuiAnimatedComponent('div')\nconst AnimatedText = createGuiAnimatedComponent('span')\n\n// const AnimatedView = styled(View, {\n// disableClassName: true,\n// })\n\n// const AnimatedText = styled(Text, {\n// disableClassName: true,\n// })\n\nconst onlyAnimateKeys: { [key in keyof TextStyle | keyof CSSProperties]?: boolean } = {\n transform: true,\n opacity: true,\n height: true,\n width: true,\n backgroundColor: true,\n borderColor: true,\n borderLeftColor: true,\n borderRightColor: true,\n borderTopColor: true,\n borderBottomColor: true,\n borderRadius: true,\n borderTopLeftRadius: true,\n borderTopRightRadius: true,\n borderBottomLeftRadius: true,\n borderBottomRightRadius: true,\n borderLeftWidth: true,\n borderRightWidth: true,\n borderTopWidth: true,\n borderBottomWidth: true,\n color: true,\n left: true,\n right: true,\n top: true,\n bottom: true,\n fontSize: true,\n fontWeight: true,\n lineHeight: true,\n letterSpacing: true,\n}\n\nexport function createAnimations<A extends Record<string, TransitionConfig>>(\n animations: A\n): AnimationDriver<A> {\n return {\n needsCustomComponent: true,\n View: isWeb ? AnimatedView : Animated.View,\n Text: isWeb ? AnimatedText : Animated.Text,\n // View: Animated.View,\n // Text: Animated.Text,\n isReactNative: true,\n inputStyle: 'value',\n outputStyle: 'inline',\n animations,\n usePresence,\n ResetPresence,\n\n useAnimatedNumber(initial): UniversalAnimatedNumber<ReanimatedAnimatedNumber> {\n const sharedValue = useSharedValue(initial)\n\n return React.useMemo(\n () => ({\n getInstance() {\n 'worklet'\n return sharedValue\n },\n getValue() {\n 'worklet'\n return sharedValue.value\n },\n setValue(next, config = { type: 'spring' }, onFinish) {\n 'worklet'\n if (config.type === 'direct') {\n sharedValue.value = next\n onFinish?.()\n } else if (config.type === 'spring') {\n sharedValue.value = withSpring(\n next,\n config,\n onFinish\n ? () => {\n 'worklet'\n runOnJS(onFinish)()\n }\n : undefined\n )\n } else {\n sharedValue.value = withTiming(\n next,\n config,\n onFinish\n ? () => {\n 'worklet'\n runOnJS(onFinish)()\n }\n : undefined\n )\n }\n },\n stop() {\n 'worklet'\n cancelAnimation(sharedValue)\n },\n }),\n [sharedValue]\n )\n },\n\n useAnimatedNumberReaction({ value }, onValue) {\n const instance = value.getInstance()\n return useAnimatedReaction(\n () => {\n return instance.value\n },\n (next, prev) => {\n if (prev !== next) {\n // @nate what is the point of this hook? is this necessary?\n // without runOnJS, onValue would need to be a worklet\n runOnJS(onValue)(next)\n }\n },\n // dependency array is very important here\n [onValue, instance]\n )\n },\n\n /**\n * `getStyle` must be a worklet\n */\n useAnimatedNumberStyle(val, getStyle) {\n const instance = val.getInstance()\n\n // this seems wrong but it works\n const derivedValue = useDerivedValue(() => {\n return instance.value\n // dependency array is very important here\n }, [instance, getStyle])\n\n return useAnimatedStyle(() => {\n return getStyle(derivedValue.value)\n // dependency array is very important here\n }, [val, getStyle, derivedValue, instance])\n },\n\n useAnimations: (animationProps) => {\n const { props, presence, style, componentState } = animationProps\n const animationKey = Array.isArray(props.transition)\n ? props.transition[0]\n : props.transition\n\n const isHydrating = componentState.unmounted === true\n const disableAnimation = isHydrating || !animationKey\n const presenceContext = React.useContext(PresenceContext)\n const [, themeState] = useThemeWithState({})\n // Check scheme first, then fall back to checking theme name for 'dark'\n const isDark = themeState?.scheme === 'dark' || themeState?.name?.startsWith('dark')\n\n // this memo is very important for performance, there's a big cost to\n // updating these values every render\n const { dontAnimate, motiProps } = useMemo(() => {\n let animate = {}\n let dontAnimate = {}\n\n if (disableAnimation) {\n // Resolve dynamic objects based on current theme\n for (const key in style) {\n const rawValue = style[key]\n const value = resolveDynamicValue(rawValue, isDark)\n if (value === undefined) continue\n dontAnimate[key] = value\n }\n } else {\n const animateOnly = props.animateOnly as string[]\n for (const key in style) {\n const rawValue = style[key]\n // Resolve dynamic theme values (like $theme-dark)\n const value = resolveDynamicValue(rawValue, isDark)\n if (value === undefined) continue\n if (\n !onlyAnimateKeys[key] ||\n value === 'auto' ||\n (typeof value === 'string' && value.startsWith('calc')) ||\n (animateOnly && !animateOnly.includes(key))\n ) {\n dontAnimate[key] = value\n } else {\n animate[key] = value\n }\n }\n }\n\n // if we don't do this moti seems to flicker a frame before applying animation\n if (componentState.unmounted === 'should-enter') {\n // Resolve dynamic objects based on current theme\n for (const key in style) {\n const rawValue = style[key]\n const value = resolveDynamicValue(rawValue, isDark)\n if (value === undefined) continue\n dontAnimate[key] = value\n }\n }\n\n const styles = animate\n const isExiting = Boolean(presence?.[1])\n const usePresenceValue = (presence || undefined) as any\n\n type UseMotiProps = Parameters<typeof useMotify>[0]\n\n // TODO moti is giving us type troubles, but this should work\n let transition = isHydrating\n ? { type: 'transition', duration: 0 }\n : (animations[animationKey as keyof typeof animations] as any)\n\n let hasClonedTransition = false\n\n if (Array.isArray(props.transition)) {\n const config = props.transition[1]\n if (config && typeof config === 'object') {\n for (const key in config) {\n const val = config[key]\n\n // performance - this seems to have (strangely) huge performance effect in uniswap\n // so instead of cloning up front, we clone only when we absolutely have to\n if (!hasClonedTransition) {\n transition = Object.assign({}, transition)\n hasClonedTransition = true\n }\n\n // referencing a pre-defined config\n if (typeof val === 'string') {\n transition[key] = animations[val]\n } else {\n transition[key] = val\n }\n }\n }\n }\n\n return {\n dontAnimate,\n motiProps: {\n animate: isExiting || componentState.unmounted === true ? {} : styles,\n transition: componentState.unmounted ? { duration: 0 } : transition,\n usePresenceValue,\n presenceContext,\n exit: isExiting ? styles : undefined,\n } satisfies UseMotiProps,\n }\n }, [\n presenceContext,\n presence,\n animationKey,\n componentState.unmounted,\n JSON.stringify(style),\n presenceContext,\n isDark,\n ])\n\n const moti = useMotify(motiProps)\n\n if (\n process.env.NODE_ENV === 'development' &&\n props['debug'] &&\n props['debug'] !== 'profile'\n ) {\n console.info(`useMotify(`, JSON.stringify(motiProps, null, 2) + ')', {\n 'componentState.unmounted': componentState.unmounted,\n animationProps,\n motiProps,\n moti,\n style: [dontAnimate, moti.style],\n })\n }\n\n return {\n style: [dontAnimate, moti.style],\n }\n },\n }\n}\n"
10
- ]
11
- }
1
+ {"version":3,"file":"createAnimations.d.ts","sourceRoot":"","sources":["../src/createAnimations.tsx"],"names":[],"mappings":"AAGA,OAAO,EAQL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAA;AAUvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAA;AAwH5C,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACzE,UAAU,EAAE,CAAC,GACZ,eAAe,CAAC,CAAC,CAAC,CA4OpB"}
package/types/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import "./polyfill";
2
- export * from "./createAnimations";
3
-
1
+ import './polyfill.ts';
2
+ export * from './createAnimations.tsx';
4
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1 @@
1
- {
2
- "mappings": "AAAA,OAAO;AAEP,cAAc",
3
- "names": [],
4
- "sources": [
5
- "src/index.ts"
6
- ],
7
- "version": 3,
8
- "sourcesContent": [
9
- "import './polyfill'\n\nexport * from './createAnimations'\n"
10
- ]
11
- }
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AAEtB,cAAc,wBAAwB,CAAA"}
@@ -1,2 +1 @@
1
-
2
1
  //# sourceMappingURL=polyfill.d.ts.map
@@ -1,11 +1 @@
1
- {
2
- "mappings": "",
3
- "names": [],
4
- "sources": [
5
- "src/polyfill.ts"
6
- ],
7
- "version": 3,
8
- "sourcesContent": [
9
- "// for SSR\nif (typeof requestAnimationFrame === 'undefined') {\n globalThis['requestAnimationFrame'] = setTimeout\n}\n\n// for reanimated\nif (typeof global === 'undefined') {\n globalThis['global'] = globalThis\n}\n"
10
- ]
11
- }
1
+ {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../src/polyfill.ts"],"names":[],"mappings":""}
@@ -1,308 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: true
11
- });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
16
- get: () => from[key],
17
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
18
- });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
- value: mod,
29
- enumerable: true
30
- }) : target, mod));
31
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
- value: true
33
- }), mod);
34
- var createAnimations_exports = {};
35
- __export(createAnimations_exports, {
36
- createAnimations: () => createAnimations
37
- });
38
- module.exports = __toCommonJS(createAnimations_exports);
39
- var import_use_presence = require("@hanzogui/use-presence");
40
- var import_core = require("@hanzogui/core");
41
- var import_author = require("moti/author");
42
- var import_react = __toESM(require("react"), 1);
43
- var import_react_native_reanimated = __toESM(require("react-native-reanimated"), 1);
44
- var import_jsx_runtime = require("react/jsx-runtime");
45
- const resolveDynamicValue = (value, isDark) => {
46
- if (value && typeof value === "object" && "dynamic" in value) {
47
- const dynamicValue = isDark ? value.dynamic.dark : value.dynamic.light;
48
- return dynamicValue;
49
- }
50
- return value;
51
- };
52
- const safeESModule = a => {
53
- const b = a;
54
- const out = b.__esModule || b[Symbol.toStringTag] === "Module" ? b.default : b;
55
- return out || a;
56
- };
57
- const Animated = safeESModule(import_react_native_reanimated.default);
58
- function createGuiAnimatedComponent(defaultTag = "div") {
59
- const isText = defaultTag === "span";
60
- const Component = Animated.createAnimatedComponent((0, import_react.forwardRef)((propsIn, ref) => {
61
- const {
62
- forwardedRef,
63
- animation,
64
- render = defaultTag,
65
- ...propsRest
66
- } = propsIn;
67
- const hostRef = (0, import_react.useRef)(null);
68
- const composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref, hostRef);
69
- const stateRef = (0, import_react.useRef)(null);
70
- if (!stateRef.current) {
71
- stateRef.current = {
72
- get host() {
73
- return hostRef.current;
74
- }
75
- };
76
- }
77
- const [_, state] = (0, import_core.useThemeWithState)({});
78
- const result = (0, import_core.getSplitStyles)(propsRest, isText ? import_core.Text.staticConfig : import_core.View.staticConfig, state?.theme, state?.name, {
79
- unmounted: false
80
- }, {
81
- isAnimated: false,
82
- noClass: true
83
- });
84
- const props = result?.viewProps || {};
85
- const Element = render;
86
- const transformedProps = import_core.hooks.usePropsTransform?.(render, props, stateRef, false);
87
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(Element, {
88
- ...transformedProps,
89
- ref: composedRefs
90
- });
91
- }));
92
- Component["acceptRenderProp"] = true;
93
- return Component;
94
- }
95
- const AnimatedView = createGuiAnimatedComponent("div");
96
- const AnimatedText = createGuiAnimatedComponent("span");
97
- const onlyAnimateKeys = {
98
- transform: true,
99
- opacity: true,
100
- height: true,
101
- width: true,
102
- backgroundColor: true,
103
- borderColor: true,
104
- borderLeftColor: true,
105
- borderRightColor: true,
106
- borderTopColor: true,
107
- borderBottomColor: true,
108
- borderRadius: true,
109
- borderTopLeftRadius: true,
110
- borderTopRightRadius: true,
111
- borderBottomLeftRadius: true,
112
- borderBottomRightRadius: true,
113
- borderLeftWidth: true,
114
- borderRightWidth: true,
115
- borderTopWidth: true,
116
- borderBottomWidth: true,
117
- color: true,
118
- left: true,
119
- right: true,
120
- top: true,
121
- bottom: true,
122
- fontSize: true,
123
- fontWeight: true,
124
- lineHeight: true,
125
- letterSpacing: true
126
- };
127
- function createAnimations(animations) {
128
- return {
129
- needsCustomComponent: true,
130
- View: import_core.isWeb ? AnimatedView : Animated.View,
131
- Text: import_core.isWeb ? AnimatedText : Animated.Text,
132
- // View: Animated.View,
133
- // Text: Animated.Text,
134
- isReactNative: true,
135
- inputStyle: "value",
136
- outputStyle: "inline",
137
- animations,
138
- usePresence: import_use_presence.usePresence,
139
- ResetPresence: import_use_presence.ResetPresence,
140
- useAnimatedNumber(initial) {
141
- const sharedValue = (0, import_react_native_reanimated.useSharedValue)(initial);
142
- return import_react.default.useMemo(() => ({
143
- getInstance() {
144
- "worklet";
145
-
146
- return sharedValue;
147
- },
148
- getValue() {
149
- "worklet";
150
-
151
- return sharedValue.value;
152
- },
153
- setValue(next, config = {
154
- type: "spring"
155
- }, onFinish) {
156
- "worklet";
157
-
158
- if (config.type === "direct") {
159
- sharedValue.value = next;
160
- onFinish?.();
161
- } else if (config.type === "spring") {
162
- sharedValue.value = (0, import_react_native_reanimated.withSpring)(next, config, onFinish ? () => {
163
- "worklet";
164
-
165
- (0, import_react_native_reanimated.runOnJS)(onFinish)();
166
- } : void 0);
167
- } else {
168
- sharedValue.value = (0, import_react_native_reanimated.withTiming)(next, config, onFinish ? () => {
169
- "worklet";
170
-
171
- (0, import_react_native_reanimated.runOnJS)(onFinish)();
172
- } : void 0);
173
- }
174
- },
175
- stop() {
176
- "worklet";
177
-
178
- (0, import_react_native_reanimated.cancelAnimation)(sharedValue);
179
- }
180
- }), [sharedValue]);
181
- },
182
- useAnimatedNumberReaction({
183
- value
184
- }, onValue) {
185
- const instance = value.getInstance();
186
- return (0, import_react_native_reanimated.useAnimatedReaction)(() => {
187
- return instance.value;
188
- }, (next, prev) => {
189
- if (prev !== next) {
190
- (0, import_react_native_reanimated.runOnJS)(onValue)(next);
191
- }
192
- },
193
- // dependency array is very important here
194
- [onValue, instance]);
195
- },
196
- /**
197
- * `getStyle` must be a worklet
198
- */
199
- useAnimatedNumberStyle(val, getStyle) {
200
- const instance = val.getInstance();
201
- const derivedValue = (0, import_react_native_reanimated.useDerivedValue)(() => {
202
- return instance.value;
203
- }, [instance, getStyle]);
204
- return (0, import_react_native_reanimated.useAnimatedStyle)(() => {
205
- return getStyle(derivedValue.value);
206
- }, [val, getStyle, derivedValue, instance]);
207
- },
208
- useAnimations: animationProps => {
209
- const {
210
- props,
211
- presence,
212
- style,
213
- componentState
214
- } = animationProps;
215
- const animationKey = Array.isArray(props.transition) ? props.transition[0] : props.transition;
216
- const isHydrating = componentState.unmounted === true;
217
- const disableAnimation = isHydrating || !animationKey;
218
- const presenceContext = import_react.default.useContext(import_use_presence.PresenceContext);
219
- const [, themeState] = (0, import_core.useThemeWithState)({});
220
- const isDark = themeState?.scheme === "dark" || themeState?.name?.startsWith("dark");
221
- const {
222
- dontAnimate,
223
- motiProps
224
- } = (0, import_react.useMemo)(() => {
225
- let animate = {};
226
- let dontAnimate2 = {};
227
- if (disableAnimation) {
228
- for (const key in style) {
229
- const rawValue = style[key];
230
- const value = resolveDynamicValue(rawValue, isDark);
231
- if (value === void 0) continue;
232
- dontAnimate2[key] = value;
233
- }
234
- } else {
235
- const animateOnly = props.animateOnly;
236
- for (const key in style) {
237
- const rawValue = style[key];
238
- const value = resolveDynamicValue(rawValue, isDark);
239
- if (value === void 0) continue;
240
- if (!onlyAnimateKeys[key] || value === "auto" || typeof value === "string" && value.startsWith("calc") || animateOnly && !animateOnly.includes(key)) {
241
- dontAnimate2[key] = value;
242
- } else {
243
- animate[key] = value;
244
- }
245
- }
246
- }
247
- if (componentState.unmounted === "should-enter") {
248
- for (const key in style) {
249
- const rawValue = style[key];
250
- const value = resolveDynamicValue(rawValue, isDark);
251
- if (value === void 0) continue;
252
- dontAnimate2[key] = value;
253
- }
254
- }
255
- const styles = animate;
256
- const isExiting = Boolean(presence?.[1]);
257
- const usePresenceValue = presence || void 0;
258
- let transition = isHydrating ? {
259
- type: "transition",
260
- duration: 0
261
- } : animations[animationKey];
262
- let hasClonedTransition = false;
263
- if (Array.isArray(props.transition)) {
264
- const config = props.transition[1];
265
- if (config && typeof config === "object") {
266
- for (const key in config) {
267
- const val = config[key];
268
- if (!hasClonedTransition) {
269
- transition = Object.assign({}, transition);
270
- hasClonedTransition = true;
271
- }
272
- if (typeof val === "string") {
273
- transition[key] = animations[val];
274
- } else {
275
- transition[key] = val;
276
- }
277
- }
278
- }
279
- }
280
- return {
281
- dontAnimate: dontAnimate2,
282
- motiProps: {
283
- animate: isExiting || componentState.unmounted === true ? {} : styles,
284
- transition: componentState.unmounted ? {
285
- duration: 0
286
- } : transition,
287
- usePresenceValue,
288
- presenceContext,
289
- exit: isExiting ? styles : void 0
290
- }
291
- };
292
- }, [presenceContext, presence, animationKey, componentState.unmounted, JSON.stringify(style), presenceContext, isDark]);
293
- const moti = (0, import_author.useMotify)(motiProps);
294
- if (process.env.NODE_ENV === "development" && props["debug"] && props["debug"] !== "profile") {
295
- console.info(`useMotify(`, JSON.stringify(motiProps, null, 2) + ")", {
296
- "componentState.unmounted": componentState.unmounted,
297
- animationProps,
298
- motiProps,
299
- moti,
300
- style: [dontAnimate, moti.style]
301
- });
302
- }
303
- return {
304
- style: [dontAnimate, moti.style]
305
- };
306
- }
307
- };
308
- }