@react-spring/konva
Advanced tools
Comparing version 9.0.0-canary.809.5.f01ecc2 to 9.0.0-rc.1
@@ -13,10 +13,9 @@ 'use strict'; | ||
var elements = ['Arc', 'Arrow', 'Circle', 'Ellipse', 'FastLayer', 'Group', 'Image', 'Label', 'Layer', 'Line', 'Path', 'Rect', 'RegularPolygon', 'Ring', 'Shape', 'Sprite', 'Star', 'Tag', 'Text', 'TextPath', 'Transformer', 'Wedge']; | ||
var primitives = ['Arc', 'Arrow', 'Circle', 'Ellipse', 'FastLayer', 'Group', 'Image', 'Label', 'Layer', 'Line', 'Path', 'Rect', 'RegularPolygon', 'Ring', 'Shape', 'Sprite', 'Star', 'Tag', 'Text', 'TextPath', 'Transformer', 'Wedge']; | ||
var animated = animated$1.extendAnimated(animated$1.withAnimated, elements); | ||
shared.Globals.assign({ | ||
defaultElement: 'Group', | ||
createStringInterpolator: stringInterpolation.createStringInterpolator, | ||
colorNames: colorNames, | ||
colorNames: colorNames | ||
}); | ||
var host = animated$1.createHost(primitives, { | ||
applyAnimatedValues: function applyAnimatedValues(instance, props) { | ||
@@ -28,2 +27,3 @@ if (!instance.nodeType) return false; | ||
}); | ||
var animated = host.animated; | ||
@@ -30,0 +30,0 @@ Object.keys(core).forEach(function (k) { |
@@ -7,11 +7,13 @@ import { ElementType, ForwardRefExoticComponent, CSSProperties } from 'react'; | ||
declare type KonvaExports = typeof konva; | ||
declare type KonvaElements = { | ||
declare type Primitives = { | ||
[P in keyof KonvaExports]: KonvaExports[P] extends ElementType ? P : never; | ||
}[keyof KonvaExports]; | ||
declare type CreateAnimated = <T extends ElementType$1>(wrappedComponent: T) => AnimatedComponent<T>; | ||
declare type KonvaComponents = { | ||
[Tag in KonvaElements]: AnimatedComponent<KonvaExports[Tag]>; | ||
declare type AnimatedPrimitives = { | ||
[P in Primitives]: AnimatedComponent<KonvaExports[P]>; | ||
}; | ||
declare const animated: CreateAnimated & KonvaComponents; | ||
/** The type of the `animated()` function */ | ||
declare type WithAnimated = { | ||
<T extends ElementType$1>(wrappedComponent: T): AnimatedComponent<T>; | ||
} & AnimatedPrimitives; | ||
/** The type of an `animated()` component */ | ||
@@ -21,3 +23,3 @@ declare type AnimatedComponent<T extends ElementType$1> = 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]>; | ||
}; | ||
@@ -33,4 +35,6 @@ declare type AnimatedProp<T> = [T, T] extends [infer T, infer DT] ? [DT] extends [never] ? never : DT extends void ? undefined : DT extends object ? [AssignableKeys<DT, CSSProperties>] extends [never] ? DT extends ReadonlyArray<any> ? AnimatedStyles<DT> : DT : 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 }; |
13
index.js
import { Globals } from '@react-spring/shared'; | ||
import { createStringInterpolator } from '@react-spring/shared/stringInterpolation'; | ||
import colorNames from '@react-spring/shared/colors'; | ||
import { extendAnimated, withAnimated } from '@react-spring/animated'; | ||
import { createHost } from '@react-spring/animated'; | ||
export * from '@react-spring/core'; | ||
const elements = ['Arc', 'Arrow', 'Circle', 'Ellipse', 'FastLayer', 'Group', 'Image', 'Label', 'Layer', 'Line', 'Path', 'Rect', 'RegularPolygon', 'Ring', 'Shape', 'Sprite', 'Star', 'Tag', 'Text', 'TextPath', 'Transformer', 'Wedge']; | ||
const primitives = ['Arc', 'Arrow', 'Circle', 'Ellipse', 'FastLayer', 'Group', 'Image', 'Label', 'Layer', 'Line', 'Path', 'Rect', 'RegularPolygon', 'Ring', 'Shape', 'Sprite', 'Star', 'Tag', 'Text', 'TextPath', 'Transformer', 'Wedge']; | ||
const animated = extendAnimated(withAnimated, elements); | ||
Globals.assign({ | ||
defaultElement: 'Group', | ||
createStringInterpolator, | ||
colorNames, | ||
colorNames | ||
}); | ||
const host = createHost(primitives, { | ||
applyAnimatedValues(instance, props) { | ||
@@ -23,4 +21,5 @@ if (!instance.nodeType) return false; | ||
}); | ||
const animated = host.animated; | ||
export { animated as a, animated }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@react-spring/konva", | ||
"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": { |
import { CSSProperties, ForwardRefExoticComponent } from 'react' | ||
import { withAnimated, extendAnimated } from '@react-spring/animated' | ||
import { | ||
@@ -9,20 +8,13 @@ AssignableKeys, | ||
} from '@react-spring/shared' | ||
import { KonvaExports, KonvaElements, elements } from './elements' | ||
import { KonvaExports, Primitives } from './primitives' | ||
type CreateAnimated = <T extends ElementType>( | ||
wrappedComponent: T | ||
) => AnimatedComponent<T> | ||
type KonvaComponents = { | ||
[Tag in KonvaElements]: AnimatedComponent<KonvaExports[Tag]> | ||
type AnimatedPrimitives = { | ||
[P in Primitives]: AnimatedComponent<KonvaExports[P]> | ||
} | ||
// Extend animated with all the available Konva elements | ||
export const animated: CreateAnimated & KonvaComponents = extendAnimated( | ||
withAnimated, | ||
elements | ||
) | ||
/** The type of the `animated()` function */ | ||
export type WithAnimated = { | ||
<T extends ElementType>(wrappedComponent: T): AnimatedComponent<T> | ||
} & AnimatedPrimitives | ||
export { animated as a } | ||
/** The type of an `animated()` component */ | ||
@@ -35,5 +27,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]> | ||
} | ||
@@ -80,5 +72,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 |
import { Globals } from '@react-spring/shared' | ||
import { createStringInterpolator } from '@react-spring/shared/stringInterpolation' | ||
import colorNames from '@react-spring/shared/colors' | ||
import { createHost } from '@react-spring/animated' | ||
import { primitives } from './primitives' | ||
import { WithAnimated } from './animated' | ||
Globals.assign({ | ||
defaultElement: 'Group', | ||
createStringInterpolator, | ||
colorNames, | ||
}) | ||
const host = createHost(primitives, { | ||
applyAnimatedValues(instance, props) { | ||
@@ -15,3 +20,6 @@ if (!instance.nodeType) return false | ||
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
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
14319
12
237
+ Added@react-spring/animated@9.7.4(transitive)
+ Added@react-spring/core@9.7.4(transitive)
+ Added@react-spring/rafz@9.7.4(transitive)
+ Added@react-spring/shared@9.7.4(transitive)
+ Added@react-spring/types@9.7.4(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)