@react-spring/zdog
Advanced tools
Comparing version 9.0.0-canary.809.5.f01ecc2 to 9.0.0-rc.1
@@ -9,20 +9,16 @@ 'use strict'; | ||
var core = require('@react-spring/core/index.cjs.js'); | ||
var animated$1 = require('@react-spring/animated/index.cjs.js'); | ||
var stringInterpolation = require('@react-spring/shared/stringInterpolation'); | ||
var colorNames = _interopDefault(require('@react-spring/shared/colors')); | ||
var animated$1 = require('@react-spring/animated/index.cjs.js'); | ||
var elements = ['Anchor', 'Shape', 'Group', 'Rect', 'RoundedRect', 'Ellipse', 'Polygon', 'Hemisphere', 'Cylinder', 'Cone', 'Box']; // Extend animated with all the available Zdog elements | ||
var primitives = ['Anchor', 'Shape', 'Group', 'Rect', 'RoundedRect', 'Ellipse', 'Polygon', 'Hemisphere', 'Cylinder', 'Cone', 'Box']; | ||
var animated = animated$1.extendAnimated(animated$1.withAnimated, elements); | ||
if (reactZdog.addEffect) reactZdog.addEffect(core.update); | ||
core.Globals.assign({ | ||
defaultElement: reactZdog.Anchor, | ||
frameLoop: reactZdog.addEffect && new core.FrameLoop({ | ||
requestFrame: reactZdog.invalidate | ||
}), | ||
applyAnimatedValues: reactZdog.applyProps, | ||
createStringInterpolator: stringInterpolation.createStringInterpolator, | ||
colorNames: colorNames | ||
}); | ||
var host = animated$1.createHost(primitives, { | ||
applyAnimatedValues: reactZdog.applyProps | ||
}); | ||
var animated = host.animated; | ||
@@ -29,0 +25,0 @@ Object.keys(core).forEach(function (k) { |
@@ -10,7 +10,12 @@ import * as Zdog from 'react-zdog'; | ||
}[keyof ZdogExports]; | ||
declare type ZdogComponents = { | ||
[Tag in ZdogElements]: AnimatedComponent<ZdogExports[Tag]>; | ||
declare const primitives: ZdogElements[]; | ||
declare type Primitives = typeof primitives[number]; | ||
declare type AnimatedPrimitives = { | ||
[P in Primitives]: AnimatedComponent<typeof Zdog[P]>; | ||
}; | ||
declare type CreateAnimated = <T extends ElementType>(wrappedComponent: T) => AnimatedComponent<T>; | ||
declare const animated: CreateAnimated & ZdogComponents; | ||
/** The type of the `animated()` function */ | ||
declare type WithAnimated = { | ||
<T extends ElementType>(wrappedComponent: T): AnimatedComponent<T>; | ||
} & AnimatedPrimitives; | ||
/** The type of an `animated()` component */ | ||
@@ -20,3 +25,3 @@ declare type AnimatedComponent<T extends ElementType> = ForwardRefExoticComponent<AnimatedProps<ComponentPropsWithRef<T>>>; | ||
declare type AnimatedProps<Props extends object> = { | ||
[P in keyof Props]: (P extends 'ref' | 'key' ? Props[P] : AnimatedProp<Props[P]>); | ||
[P in keyof Props]: P extends 'ref' | 'key' ? Props[P] : AnimatedProp<Props[P]>; | ||
}; | ||
@@ -27,4 +32,6 @@ declare type AnimatedProp<T> = [T, T] extends [infer T, infer DT] ? [DT] extends [never] ? never : DT extends void ? undefined : DT extends object ? AnimatedStyle<T> : DT | AnimatedLeaf<T> : never; | ||
} : DT | AnimatedLeaf<T> : never; | ||
declare type AnimatedLeaf<T> = [T] extends [object] ? never : FluidValue<Exclude<T, object | void>>; | ||
declare type AnimatedLeaf<T> = Exclude<T, object | void> | Extract<T, ReadonlyArray<number | string>> extends infer U ? [U] extends [never] ? never : FluidValue<U | Exclude<T, object | void>> : never; | ||
export { AnimatedComponent, AnimatedProps, animated as a, animated }; | ||
declare const animated: WithAnimated; | ||
export { AnimatedComponent, AnimatedProps, WithAnimated, animated as a, animated }; |
20
index.js
@@ -1,24 +0,20 @@ | ||
import { addEffect, Anchor, invalidate, applyProps } from 'react-zdog'; | ||
import { update, Globals, FrameLoop } from '@react-spring/core'; | ||
import { applyProps } from 'react-zdog'; | ||
import { Globals } from '@react-spring/core'; | ||
export * from '@react-spring/core'; | ||
import { createHost } from '@react-spring/animated'; | ||
import { createStringInterpolator } from '@react-spring/shared/stringInterpolation'; | ||
import colorNames from '@react-spring/shared/colors'; | ||
import { extendAnimated, withAnimated } from '@react-spring/animated'; | ||
const elements = ['Anchor', 'Shape', 'Group', 'Rect', 'RoundedRect', 'Ellipse', 'Polygon', 'Hemisphere', 'Cylinder', 'Cone', 'Box']; // Extend animated with all the available Zdog elements | ||
const primitives = ['Anchor', 'Shape', 'Group', 'Rect', 'RoundedRect', 'Ellipse', 'Polygon', 'Hemisphere', 'Cylinder', 'Cone', 'Box']; | ||
const animated = extendAnimated(withAnimated, elements); | ||
if (addEffect) addEffect(update); | ||
Globals.assign({ | ||
defaultElement: Anchor, | ||
frameLoop: addEffect && new FrameLoop({ | ||
requestFrame: invalidate | ||
}), | ||
applyAnimatedValues: applyProps, | ||
createStringInterpolator, | ||
colorNames | ||
}); | ||
const host = createHost(primitives, { | ||
applyAnimatedValues: applyProps | ||
}); | ||
const animated = host.animated; | ||
export { animated as a, animated }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@react-spring/zdog", | ||
"version": "9.0.0-canary.809.5.f01ecc2", | ||
"version": "9.0.0-rc.1", | ||
"description": "Cross-platform animation engine for React", | ||
@@ -31,8 +31,8 @@ "keywords": [ | ||
"@babel/runtime": "^7.3.1", | ||
"@react-spring/animated": "9.0.0-canary.809.5.f01ecc2", | ||
"@react-spring/core": "9.0.0-canary.809.5.f01ecc2", | ||
"@react-spring/shared": "9.0.0-canary.809.5.f01ecc2" | ||
"@react-spring/animated": "^9.0.0-rc.1", | ||
"@react-spring/core": "^9.0.0-rc.1", | ||
"@react-spring/shared": "^9.0.0-rc.1" | ||
}, | ||
"devDependencies": { | ||
"typescript": "3.6.2" | ||
"typescript": "3.8.3" | ||
}, | ||
@@ -39,0 +39,0 @@ "peerDependencies": { |
@@ -7,45 +7,15 @@ import * as Zdog from 'react-zdog' | ||
} from 'react' | ||
import { withAnimated, extendAnimated } from '@react-spring/animated' | ||
import { FluidValue } from '@react-spring/shared' | ||
import { primitives } from './primitives' | ||
type ZdogExports = typeof Zdog | ||
type ZdogElements = { | ||
[P in keyof ZdogExports]: P extends 'Illustration' | ||
? never | ||
: ZdogExports[P] extends ElementType | ||
? P | ||
: never | ||
}[keyof ZdogExports] | ||
type ZdogComponents = { | ||
[Tag in ZdogElements]: AnimatedComponent<ZdogExports[Tag]> | ||
type Primitives = typeof primitives[number] | ||
type AnimatedPrimitives = { | ||
[P in Primitives]: AnimatedComponent<typeof Zdog[P]> | ||
} | ||
const elements: ZdogElements[] = [ | ||
'Anchor', | ||
'Shape', | ||
'Group', | ||
'Rect', | ||
'RoundedRect', | ||
'Ellipse', | ||
'Polygon', | ||
'Hemisphere', | ||
'Cylinder', | ||
'Cone', | ||
'Box', | ||
] | ||
/** The type of the `animated()` function */ | ||
export type WithAnimated = { | ||
<T extends ElementType>(wrappedComponent: T): AnimatedComponent<T> | ||
} & AnimatedPrimitives | ||
type CreateAnimated = <T extends ElementType>( | ||
wrappedComponent: T | ||
) => AnimatedComponent<T> | ||
// Extend animated with all the available Zdog elements | ||
export const animated: CreateAnimated & ZdogComponents = extendAnimated( | ||
withAnimated, | ||
elements | ||
) | ||
export { animated as a } | ||
/** The type of an `animated()` component */ | ||
@@ -58,5 +28,5 @@ export type AnimatedComponent< | ||
export type AnimatedProps<Props extends object> = { | ||
[P in keyof Props]: (P extends 'ref' | 'key' | ||
[P in keyof Props]: P extends 'ref' | 'key' | ||
? Props[P] | ||
: AnimatedProp<Props[P]>) | ||
: AnimatedProp<Props[P]> | ||
} | ||
@@ -86,5 +56,9 @@ | ||
// An animated value that is not an object | ||
type AnimatedLeaf<T> = [T] extends [object] | ||
? never | ||
: FluidValue<Exclude<T, object | void>> | ||
// An animated primitive (or an array of them) | ||
type AnimatedLeaf<T> = | ||
| Exclude<T, object | void> | ||
| Extract<T, ReadonlyArray<number | string>> extends infer U | ||
? [U] extends [never] | ||
? never | ||
: FluidValue<U | Exclude<T, object | void>> | ||
: never |
@@ -1,13 +0,10 @@ | ||
import { Anchor, invalidate, applyProps, addEffect } from 'react-zdog' | ||
import { Globals, FrameLoop, update } from '@react-spring/core' | ||
import { applyProps } from 'react-zdog' | ||
import { Globals } from '@react-spring/core' | ||
import { createHost } from '@react-spring/animated' | ||
import { createStringInterpolator } from '@react-spring/shared/stringInterpolation' | ||
import colorNames from '@react-spring/shared/colors' | ||
import { primitives } from './primitives' | ||
import { WithAnimated } from './animated' | ||
// Add the update function as a global effect to react-zdog's update loop | ||
if (addEffect) addEffect(update) | ||
Globals.assign({ | ||
defaultElement: Anchor, | ||
frameLoop: addEffect && new FrameLoop({ requestFrame: invalidate }), | ||
applyAnimatedValues: applyProps, | ||
createStringInterpolator, | ||
@@ -17,3 +14,10 @@ colorNames, | ||
const host = createHost(primitives, { | ||
applyAnimatedValues: applyProps, | ||
}) | ||
export const animated = host.animated as WithAnimated | ||
export { animated as a } | ||
export * from './animated' | ||
export * from '@react-spring/core' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12770
13
225
1
+ Added@react-spring/animated@9.7.5(transitive)
+ Added@react-spring/core@9.7.5(transitive)
+ Added@react-spring/rafz@9.7.5(transitive)
+ Added@react-spring/shared@9.7.5(transitive)
+ Added@react-spring/types@9.7.5(transitive)
- Removed@react-spring/animated@9.0.0-canary.809.5.f01ecc2(transitive)
- Removed@react-spring/core@9.0.0-canary.809.5.f01ecc2(transitive)
- Removed@react-spring/shared@9.0.0-canary.809.5.f01ecc2(transitive)
- Removeduse-memo-one@1.1.3(transitive)