Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
738 commits
Select commit Hold shift + click to select a range
719834d
test: replace "onAnimate" with "onProps"
aleclarson Dec 17, 2019
01faedd
9.0.0-canary.808.13.719834d
aleclarson Dec 17, 2019
192785c
build: remove "installDistDeps" step in prepare script
aleclarson Dec 17, 2019
3bbb871
9.0.0-canary.808.14.192785c
aleclarson Dec 17, 2019
9ee08c4
types: fix argument types of "each" util
aleclarson Dec 19, 2019
4986fc6
fix: animated.Text is undefined when minified
aleclarson Dec 19, 2019
08dd5d8
types: ensure animated.Text has a children prop
aleclarson Dec 19, 2019
04be92b
types: use Remap on ControllerProps type
aleclarson Dec 23, 2019
a07dc62
types: remove UnknownPartial from ControllerProps type
aleclarson Dec 23, 2019
87705b3
types: stop using FluidProps on RangeProps type param
aleclarson Dec 23, 2019
552aa42
types: fix the Valid type
aleclarson Dec 23, 2019
290a404
types: fix PickAnimated<any> result
aleclarson Dec 23, 2019
d8b74ca
test: fix expected types
aleclarson Dec 23, 2019
f15ca72
types: update AnimatedLeaf type across all types
aleclarson Dec 23, 2019
a7ae368
chore: run prettier
aleclarson Dec 23, 2019
a6254d1
types: restrict the allowed FluidValue type in ControllerProps
aleclarson Dec 23, 2019
d10e469
types: loosen the type constraints of "useSpring" props argument
aleclarson Dec 23, 2019
b6e5e93
test: the "reverse" prop
aleclarson Dec 25, 2019
73fc16e
fix: when reversing, use previous "to" and/or "from" props when undef…
aleclarson Dec 25, 2019
12613c7
fix: computing the "started" local variable
aleclarson Dec 25, 2019
3e6e3dc
docs: explain which value types are supported by SpringValue
aleclarson Dec 25, 2019
f0b1b2d
nit: remove "Animation.reverse"
aleclarson Dec 25, 2019
1888558
chore: update test snapshots
aleclarson Dec 25, 2019
b70d416
chore: remove "typescript-snapshots-plugin" dev dependency
aleclarson Dec 25, 2019
062e88e
fix: setup of Animated node before ever animating
aleclarson Dec 25, 2019
d5ad4b7
test: move "beforeEach" into the proper "describe" block
aleclarson Dec 25, 2019
03d4995
nit: simplify condition for new "from" value in "SpringValue#_merge"
aleclarson Dec 25, 2019
aef9d30
nit: simplify the "immediate" expression
aleclarson Dec 25, 2019
8098f27
fix: make "SpringValue#_prepareNode" unwrap FluidValue objects
aleclarson Dec 25, 2019
9944c3b
nit: minor refactor of "SpringValue#set" method
aleclarson Dec 30, 2019
1ed22ff
test: add "advance" global function
aleclarson Dec 30, 2019
d9d51b2
test: when "to" prop equals current value
aleclarson Dec 30, 2019
9e472db
fix: when "to" prop is equal to the current value
aleclarson Dec 30, 2019
18b5758
nit: remove todo comment
aleclarson Dec 30, 2019
f1df9e5
types: allow unknown props in UseTransitionProps type
aleclarson Dec 30, 2019
37e882a
nit: rename Phase type to TransitionPhase
aleclarson Dec 30, 2019
1e2e80e
nit: remove pointless statement
aleclarson Jan 1, 2020
10e5e93
refactor: calculation of "started" local variable
aleclarson Jan 1, 2020
af9694e
types: fix "callProp" type
aleclarson Jan 1, 2020
9cf3c4d
types: fix "config" prop of useTransition
aleclarson Jan 1, 2020
dd1817e
types: fix "InferKey" type
aleclarson Jan 1, 2020
f049c2e
types: fix useSpring with props function
aleclarson Jan 4, 2020
859e8e0
feat: pass the item index to the render callback passed to the functi…
aleclarson Jan 4, 2020
661b44d
test: use flush-microtasks in "advanceUntil" helper
aleclarson Jan 11, 2020
53b9b9e
test: abort "advanceUntil" call when test ends
aleclarson Jan 11, 2020
5702543
test: clear the frameloop after each test
aleclarson Jan 11, 2020
b6fbf86
test: reduce max frames per "advanceUntil" call to 1000
aleclarson Jan 11, 2020
5f8f897
test: change how frames are observed
aleclarson Jan 11, 2020
86e1582
test: make "advanceUntilValue" use recorded frames if possible
aleclarson Jan 11, 2020
426b55f
feat: add "loop" prop
aleclarson Jan 11, 2020
997aa99
test: change how "advanceUntilValue" works
aleclarson Jan 11, 2020
4ff1939
test: the "loop" prop
aleclarson Jan 11, 2020
6f66a46
fix: stop coercing AnimatedString to AnimatedValue in "SpringValue#_g…
aleclarson Jan 11, 2020
d000b02
feat: add "SpringValue#resume" method and call it at the right times
aleclarson Jan 12, 2020
dc07037
nit: tiny change to "SpringValue#_merge"
aleclarson Jan 12, 2020
69f8485
chore: update test snapshots
aleclarson Jan 12, 2020
aa7bd77
nit: tiny change to "runAsync" helper
aleclarson Jan 12, 2020
9581e9b
types: simplify type of "getFrames" helper
aleclarson Jan 12, 2020
8b21e65
test: support Interpolation objects in "advanceUntil" helper
aleclarson Jan 12, 2020
9f4df79
test: fix "advanceUntilValue" helper not checking the correct frame
aleclarson Jan 12, 2020
e7b5d0d
chore: update lockfile
aleclarson Jan 12, 2020
780759f
fix: protect against adding an animation to the frameloop twice
aleclarson Jan 12, 2020
4400bc4
feat: let "loop" prop combine with "reverse" prop
aleclarson Jan 12, 2020
56d3299
chore: update some code comments
aleclarson Jan 12, 2020
1184556
nit: remove pointless "computeGoal" call
aleclarson Jan 12, 2020
b5acda9
fix: remove old prop from reserved props
aleclarson Jan 12, 2020
b598c6f
types: improve the "Remap" helper type
aleclarson Jan 12, 2020
2f7c1ab
test: define the "colorNames" global
aleclarson Jan 12, 2020
162b2be
test: animating between named colors with "loop"
aleclarson Jan 12, 2020
ba3a33a
fix: make `animated` work with arrow function component
chenesan Jan 24, 2020
805f8f6
feat: add pause and resume method in Controller
chenesan Jan 26, 2020
f97449b
feat: add pause and resume in useSpring/useTransitions ref api
chenesan Jan 26, 2020
e919322
fix: create/remove springs when useSprings length argument is changed
aleclarson Jan 27, 2020
f77d73e
test: useSprings change of length argument
aleclarson Jan 27, 2020
d4e5904
chore: install @testing-library/react in packages/core
aleclarson Jan 27, 2020
d3db04a
9.0.0-canary.808.15.d4e5904
aleclarson Jan 27, 2020
3fe0622
test: useSpring hook
aleclarson Jan 28, 2020
68edca3
fix: deps argument of useSprings
aleclarson Jan 28, 2020
9b9a4c8
9.0.0-canary.808.16.68edca3
aleclarson Jan 28, 2020
8e9b94b
fix: when useSpring from/to props are falsy
aleclarson Jan 28, 2020
8059861
test: more tests for useSprings
aleclarson Jan 28, 2020
55c5691
fix: useSprings with props function
aleclarson Jan 28, 2020
0916ce5
9.0.0-canary.808.17.55c5691
aleclarson Jan 28, 2020
03b4706
fix: "from" prop edge case
aleclarson Jan 29, 2020
f88ab1b
test: setting "from" prop before first animation
aleclarson Jan 29, 2020
0136b2c
nit: remove outdated logic for "immediate" prop updates
aleclarson Jan 29, 2020
82a2d45
types: fix "ref" prop type
aleclarson Feb 4, 2020
45fe9b4
refactor: render props API
aleclarson Feb 4, 2020
12d130b
types: make UnknownProps pass through the PickAnimated type
aleclarson Feb 4, 2020
5a028d4
types: make State parameter of ControllerProps default to UnknownProps
aleclarson Feb 4, 2020
7cc6554
types: refactor useTransition types
aleclarson Feb 5, 2020
988b082
feat: return the update and stop functions when deps are passed to us…
aleclarson Feb 5, 2020
56b044e
nit: use string values for TransitionPhase type
aleclarson Feb 5, 2020
187b1ca
nit: update FrameLoop description
aleclarson Feb 5, 2020
075dfb9
types: remove number keys from Indexable and UnknownProps types
aleclarson Feb 5, 2020
d96bbdd
types: make State parameter of EventProps default to UnknownProps
aleclarson Feb 5, 2020
8fa3668
types: fix animated array values with SpringValues type
aleclarson Feb 5, 2020
83882d6
nit: move animation hooks into "src/hooks"
aleclarson Feb 5, 2020
a6a66c2
types: make UnknownProps pass through the GoalValue type
aleclarson Feb 5, 2020
4c012ee
types: make T parameter of SpringHandle default to UnknownProps
aleclarson Feb 5, 2020
7fc5e46
types: remove Omit from SpringConfig type
aleclarson Feb 5, 2020
e0f9b1a
types: let SpringUpdateFn and others omit their type parameter
aleclarson Feb 5, 2020
9a37278
types: make UnknownProps pass through the UnknownPartial type
aleclarson Feb 5, 2020
60e1a70
types: fix update function returned by useSpring
aleclarson Feb 5, 2020
e2baa1c
types: make forward props optional in ControllerProps
aleclarson Feb 5, 2020
78a6e46
types: fix Spring component type
aleclarson Feb 5, 2020
2217465
types: include forward props in AsyncUpdate type
aleclarson Feb 5, 2020
32e94cd
types: fix type inference of "to"
aleclarson Feb 5, 2020
ffdf642
types: fix tests for Transition component
aleclarson Feb 5, 2020
03f6c34
types: fix type errors in Controller class
aleclarson Feb 5, 2020
c50573b
types: fix tests for Spring component
aleclarson Feb 5, 2020
41fd3b7
fix: use computeGoal on values in "finished" comparison
aleclarson Feb 6, 2020
6443fd0
types: use FluidProps from "fluids" package
aleclarson Feb 6, 2020
bbf73b9
types: export SpringPauseFn and SpringResumeFn types
aleclarson Feb 6, 2020
d6f6c3c
types: export SpringStartFn type
aleclarson Feb 6, 2020
6729393
types: fix AnimatedTransform type
aleclarson Feb 6, 2020
8b18f0a
fix: never pause the frameloop
aleclarson Feb 11, 2020
a3f4738
types: remove unknown access from Controller state
aleclarson Feb 12, 2020
8e56ecc
fix: let "getProps" helper take null or undefined
aleclarson Feb 12, 2020
157994a
feat: let new values be animated after first render
aleclarson Feb 12, 2020
f804e8b
fix: make "keys" a reserved prop
aleclarson Feb 12, 2020
2d67fcb
test: fix type tests for @react-spring/native
aleclarson Feb 12, 2020
4651cc4
test: refactor type tests for useSpring
aleclarson Feb 12, 2020
dda5b08
chore: update some comments
aleclarson Feb 12, 2020
a6131ee
types: fix EventProps property types
aleclarson Feb 26, 2020
64b46d6
fix: "loop" prop with async "to" function
aleclarson Feb 26, 2020
08758ef
fix: use default "config" props when explicitly undefined
aleclarson Feb 26, 2020
7d5b421
fix: use "to" value as initial value even if "delay" prop is defined
aleclarson Mar 1, 2020
af59cf3
feat: let "expires" prop be a boolean or function
aleclarson Mar 3, 2020
36452c5
fix: force update when all transitions are idle and expired items exist
aleclarson Mar 3, 2020
a92d443
test: "loop" with multiple values
aleclarson Mar 7, 2020
2524519
types: make "deps" argument a readonly array
aleclarson Mar 7, 2020
101c87a
test: remove unnecessary test
aleclarson Mar 7, 2020
61e09d0
fix: ensure keys of the same Controller are looped together
aleclarson Mar 7, 2020
4fc85a0
fix: handle errors thrown by "cancel" or "reset" functions
aleclarson Mar 7, 2020
cddbc3f
types: give "scheduleProps" new type parameters
aleclarson Mar 7, 2020
c6c10a3
fix: handle "loop" prop in SpringValue#_update
aleclarson Mar 7, 2020
ee27dd3
nit: remove unused type import
aleclarson Mar 7, 2020
995a613
feat: let "loop" prop override any "useSpring" props
aleclarson Mar 8, 2020
793dd87
types: let event maps contain undefined values
aleclarson Mar 8, 2020
528d49d
nit: remove unused type import
aleclarson Mar 8, 2020
84b4f8d
fix: make "getForwardProps" return undefined if no forward props exist
aleclarson Mar 8, 2020
5e5700d
types(useTransition): fix inference of untyped "enter" prop function
aleclarson Mar 8, 2020
92912d0
chore: remove unused "reverse" property from Animation class
aleclarson Mar 8, 2020
74b7c9e
fix: reset the "keys" prop for loop updates
aleclarson Mar 8, 2020
3fc4a41
test: promise resolution of no-op updates
aleclarson Mar 9, 2020
48c63b9
test: update "loop" and "reverse" combination
aleclarson Mar 9, 2020
c18c9da
fix: have "onRest" handlers determine their own "finished" value
aleclarson Mar 9, 2020
aaa69b4
types: fix inference for ControllerProps by making "loop" less correct
aleclarson Mar 9, 2020
a1d6a17
fix: make no-op updates wait for animation to finish
aleclarson Mar 9, 2020
3b5735d
fix: "reverse" handling in "createLoopUpdate" helper
aleclarson Mar 9, 2020
7b74f8a
chore: fix typescript errors
aleclarson Mar 9, 2020
29fda8d
chore: move useSpring test module
aleclarson Mar 9, 2020
ad75bc9
fix: ensure cached "onRest" is never undefined
aleclarson Mar 9, 2020
7e16a0d
nit: rename "_to" method to "_focus"
aleclarson Mar 21, 2020
07cb88c
nit: rename internal function
aleclarson Mar 21, 2020
074aefe
fix: remove "_prepareNode" call in SpringValue#update
aleclarson Mar 22, 2020
7d44f3e
fix: ensure "hasToChanged" is false when the "to" prop is ignored
aleclarson Mar 22, 2020
d55b3e6
fix: change how "from" prop behaves when "default" isn't true
aleclarson Mar 22, 2020
6d963b0
nit: update some inline comments
aleclarson Mar 22, 2020
8f5f4cc
nit: improve an error message slightly
aleclarson Mar 22, 2020
43e3144
test: add some tests and disable failed tests
aleclarson Mar 22, 2020
e89390c
types: fix config type of Globals.assign
aleclarson Mar 22, 2020
4e5d0d1
fix: call "onStart" and "onRest" when skipAnimation is true
aleclarson Mar 22, 2020
12134fc
feat: skip animation when the user isn't looking
aleclarson Mar 22, 2020
f72eee0
fix: "reset" prop with equal "from" and "to" values
aleclarson Mar 22, 2020
cd27adb
fix: allow abrupt stops when "reset" is true
aleclarson Mar 22, 2020
97a0af5
fix: let no-op updates change the "onRest" prop
aleclarson Mar 22, 2020
4d6f4b8
chore: upgrade "fluids"
aleclarson Mar 23, 2020
cc90b53
chore: reorganize types
aleclarson Mar 24, 2020
196510c
build: generate .d.ts module for .cjs entry points
aleclarson Mar 24, 2020
3fe067a
types: stop using PickAnimated on spring chains
aleclarson Mar 24, 2020
6a3ca5e
fix: nested runAsync calls
aleclarson Mar 25, 2020
cb8423b
nit: move "timestamp" into RunAsyncProps type
aleclarson Mar 25, 2020
5eb99ee
fix: avoid merging other props when "to" is temporally prevented
aleclarson Mar 25, 2020
136e91d
fix: replace timestamp tracking with call tracking
aleclarson Mar 25, 2020
61a8a45
test: add "advanceByTime" global helper
aleclarson Mar 25, 2020
00571de
test: call "jest.advanceTimersByTime" inside "advanceUntil"
aleclarson Mar 25, 2020
0c3250c
test: temporal prevention with the "delay" prop
aleclarson Mar 25, 2020
e6e4079
test: enable fake timers globally
aleclarson Mar 25, 2020
02681b3
fix: call "_merge" before "runAsync"
aleclarson Mar 25, 2020
69caa74
feat: support temporal prevention for async "to" prop
aleclarson Mar 25, 2020
88de0d7
refactor: remove unnecessary local variable
aleclarson Mar 25, 2020
d3ac30e
fix: resolve the promise of updates where "getAnimated" returns falsy
aleclarson Mar 25, 2020
90cae66
feat: add "onDelayEnd" prop
aleclarson Mar 25, 2020
28307fe
fix: respect "default" prop even if "to" prop is async
aleclarson Mar 25, 2020
b8f1daa
test: "from" stops the active animation when "to" is async
aleclarson Mar 25, 2020
8605357
test: "from" stops the active animation when "to" is undefined
aleclarson Mar 25, 2020
fa70692
fix: avoid calling "start" in SpringValue constructor is both args ar…
aleclarson Mar 25, 2020
b2cce09
chore: upgrade to jest@25
aleclarson Mar 25, 2020
0f5fe30
fix: guarantee order of delayed updates
aleclarson Mar 27, 2020
11bf351
test: fix how animations are observed
aleclarson Mar 27, 2020
5e789fd
fix: don't call "onDelayEnd" when temporally prevented
aleclarson Mar 27, 2020
ce88104
fix: skip "_merge" call when "to" prop is async and "cancel" prop is …
aleclarson Mar 27, 2020
8522989
chore: fix incorrect type imports
aleclarson Mar 27, 2020
896646d
test: fix failing tests for new "delay" prop logic
aleclarson Mar 27, 2020
72dccdb
test: remove test for unsupported prop combo
aleclarson Mar 27, 2020
900b76d
types: fix incorrect useSpring call signature
aleclarson Mar 29, 2020
25ee19e
fix: change return type of useSpring with prop function
aleclarson Mar 29, 2020
d6d22be
types: use SpringStartFn in return type of useTrail
aleclarson Apr 9, 2020
93c4b30
types: fix random type error
aleclarson Apr 9, 2020
554af72
chore: remove unused type import
aleclarson Apr 9, 2020
edf2510
test: fix type test for Spring component
aleclarson Apr 9, 2020
4cf2d61
fix(Controller): prepare springs before the next loop
aleclarson Apr 10, 2020
19a5a86
fix: properly skip "runAsync" when implicitly prevented
aleclarson Apr 10, 2020
04b05ab
fix: a few fixes to "createLoopUpdate" function
aleclarson Apr 10, 2020
e75a37a
types: prevent type distribution for InlineToProps
aleclarson Apr 11, 2020
25de622
types: constrain GoalValues type parameter
aleclarson Apr 11, 2020
277a1c9
types: refine the useSprings type
aleclarson Apr 11, 2020
dde42dd
types(web): ensure "document" is declared
aleclarson Apr 14, 2020
b0f1ed4
test: use SpringStartFn type in useSpring tests
aleclarson Apr 16, 2020
0a7ede9
test: add basic tests for useTrail
aleclarson Apr 16, 2020
9669a8b
types: use "readonly any[]" in deps argument of useTrail type
aleclarson Apr 16, 2020
ce4da12
fix: return "update" and "stop" functions when useTrail has a deps ar…
aleclarson Apr 16, 2020
61825e3
fix: make "useTrail" update springs on every render when a props obje…
aleclarson Apr 16, 2020
c7c8bc3
build: fix linking "dist" packages together
aleclarson Apr 17, 2020
ac1eb1e
types: fix type error with generics
aleclarson Apr 17, 2020
38be0dd
chore: upgrade rollup
aleclarson Apr 17, 2020
e6622be
build: ensure "shared" package has "tsc" in node_modules/.bin
aleclarson Apr 17, 2020
d8e8ff0
fix: stop using typescript in renderprops API
aleclarson Apr 17, 2020
450389f
Revert "fix: stop using typescript in renderprops API"
aleclarson Apr 17, 2020
2999955
chore: upgrade babel
aleclarson Apr 17, 2020
934a253
fix: "onRest" not called when async "to" prop is used
aleclarson Apr 19, 2020
2f0ef4c
fix: let immediate animations change the animated type
aleclarson Apr 19, 2020
6ebf191
test: expect string animation to be finished
aleclarson Apr 19, 2020
0e5c5e5
fix: wrap "onRest" call in "runAsync" with "batchedUpdates"
aleclarson Apr 19, 2020
1b7ee81
test: wrap "batchedUpdates" callbacks with "act"
aleclarson Apr 19, 2020
b658236
test: unmount after leave in useTransition
aleclarson Apr 19, 2020
87871a9
Revert "types(web): ensure "document" is declared"
aleclarson Apr 19, 2020
383bc6d
Revert "feat: skip animation when the user isn't looking"
aleclarson Apr 19, 2020
e50b008
fix(SpringValue): call "_focus" from the "set" method
aleclarson Apr 19, 2020
80ff689
fix: ensure "animation.immediate" is always true for non-animatable v…
aleclarson Apr 19, 2020
75f217d
fix: ensure "finished" is calculated properly for fluid "to" values
aleclarson Apr 19, 2020
9a0bf9a
types: use "SpringStartFn" type inside "SpringToFn" type
aleclarson Apr 19, 2020
6ce43dd
fix: prevent infinite recursion when looping a noop update
aleclarson Apr 25, 2020
a193f2f
fix: make FrameValue#idle an abstract getter
aleclarson Apr 25, 2020
2a511f6
types: remove Readonly around AnimationResult
aleclarson Apr 26, 2020
b48a39f
fix: try using the "loop" prop even for noop updates
aleclarson Apr 26, 2020
a8d5d96
test: refactor Controller tests for "loop" prop
aleclarson Apr 26, 2020
27de378
test: "loop" prop + "reverse" prop + Controller class
aleclarson Apr 26, 2020
cd99863
fix: ensure SpringValue has a "key" before applying initial props
aleclarson Apr 26, 2020
4404979
fix: pass loop objects to "inferTo" helper
aleclarson Apr 26, 2020
746f52d
fix: have TransitionFn return a fragment
aleclarson Apr 30, 2020
15cc275
types: fix constraint error
aleclarson May 2, 2020
09562e8
chore: move @alloc/types to dependencies
aleclarson May 2, 2020
9a02ff9
fix: wrap the FrameLoop.update function with try-catch
aleclarson May 2, 2020
60041ab
chore: add @types/react to devDeps of @react-spring/native
aleclarson May 2, 2020
53209b4
chore: update lockfile
aleclarson May 2, 2020
ae8fecd
cli: fix publish script bug
aleclarson May 2, 2020
efd9253
fix(three): stop using r3f's render loop
aleclarson May 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
12 changes: 10 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ React 16.8+ has global state to support its "hooks" feature, so you need to ensu

# Publishing

Run `yarn bump` to analyze commits and increment the version of any updated packages.
To publish a new version:

Run `yarn release` to publish any packages with a new version.
```
yarn release
```

To publish a **canary** version:

```
yarn release --canary
```
16 changes: 16 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
presets: [
'@babel/typescript',
'@babel/react',
[
'@babel/env',
{
exclude: [
'transform-async-to-generator',
'transform-classes',
'transform-regenerator',
],
},
],
],
}
21 changes: 7 additions & 14 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,35 +36,28 @@ function createConfig(rootDir) {
const { compilerOptions } = fs.readJsonSync(
path.join(rootDir, 'tsconfig.json')
)
compilerOptions.allowJs = true
compilerOptions.noEmitOnError = false
return {
rootDir,
transform: {
'.+\\.(js|ts|tsx)$': 'ts-jest',
},
setupFilesAfterEnv:
rootDir.indexOf('shared') < 0
? [path.join(__dirname, 'packages/core/test/setup.ts')]
: [],
testMatch,
testEnvironment: 'jsdom',
testPathIgnorePatterns: ['.+/(types|__snapshots__)/.+'],
modulePathIgnorePatterns: ['dist'],
moduleFileExtensions: ['ts', 'tsx', 'js'],
moduleNameMapper: {
...getModuleNameMapper(compilerOptions),
...getModuleNameMapper(compilerOptions.paths),
'^react$': '<rootDir>/../../node_modules/react',
},
collectCoverageFrom: ['src/**/*'],
coverageDirectory: './coverage',
coverageReporters: ['json', 'html', 'text'],
globals: {
'ts-jest': {
diagnostics: false,
tsConfig: compilerOptions,
},
},
timers: 'fake',
}
}

function getModuleNameMapper({ paths }) {
function getModuleNameMapper(paths) {
if (!paths) return
const map = pathsToModuleNameMapper(paths)
for (const key in map) {
Expand Down
6 changes: 2 additions & 4 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "9.0.0-beta.34",
"version": "9.0.0-canary.808.17.55c5691",
"npmClient": "yarn",
"useWorkspaces": true,
"registry": "https://registry.npmjs.org",
Expand All @@ -17,10 +17,8 @@
"push": false
},
"publish": {
"bump": "from-package",
"contents": "dist",
"ignoreScripts": true,
"preDistTag": "next"
"ignoreScripts": true
}
}
}
43 changes: 23 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@react-spring/lerna",
"private": true,
"description": "Cross-platform animation engine",
"description": "Cross-platform animation engine for React",
"keywords": [
"animated",
"animation",
Expand Down Expand Up @@ -38,10 +38,9 @@
},
"scripts": {
"build": "bic",
"bump": "lerna version && yarn --force",
"clean": "lerna exec --parallel --no-bail -- rimraf node_modules dist .rpt2_cache .bic_cache",
"prepare": "node ./scripts/prepare.js && bic",
"release": "lerna publish",
"prepare": "node ./scripts/prepare.js && bic && yarn test:ts",
"release": "node ./scripts/release.js",
"test": "jest",
"test:cov": "jest --coverage",
"test:ts": "cd packages/react-spring && tsc -p . --noEmit"
Expand All @@ -55,39 +54,43 @@
"@babel/runtime": "^7.3.1"
},
"devDependencies": {
"@babel/core": "7.2.2",
"@babel/plugin-proposal-class-properties": "7.4.4",
"@babel/plugin-proposal-object-rest-spread": "7.3.2",
"@babel/plugin-transform-modules-commonjs": "7.4.4",
"@babel/plugin-transform-runtime": "7.4.4",
"@babel/preset-env": "7.3.1",
"@babel/preset-react": "7.0.0",
"@babel/core": "~7.9.0",
"@babel/plugin-proposal-class-properties": "~7.8.3",
"@babel/plugin-proposal-object-rest-spread": "~7.9.5",
"@babel/plugin-transform-modules-commonjs": "~7.9.0",
"@babel/plugin-transform-runtime": "~7.9.0",
"@babel/preset-env": "~7.9.5",
"@babel/preset-react": "~7.9.4",
"@babel/preset-typescript": "~7.9.0",
"@rollup/plugin-node-resolve": "^7.1.3",
"@types/jest": "^24.0.13",
"@types/react": "^16.8.19",
"build-if-changed": "^1.5.0",
"chalk": "^2.4.2",
"enquirer": "^2.3.2",
"execa": "^2.0.4",
"flush-microtasks": "^1.0.1",
"fs-extra": "7.0.1",
"husky": "1.3.1",
"jest": "^24.8.0",
"jest": "^25.1.0",
"jest-watch-typeahead": "^0.3.1",
"lerna": "3.15.0",
"meta": "^1.2.19",
"mock-raf": "npm:@react-spring/mock-raf",
"prettier": "^1.18.2",
"prettier": "1.19.1",
"pretty-quick": "1.10.0",
"react": "~16.9.0",
"recrawl-sync": "^1.2.2",
"rimraf": "2.6.3",
"rollup": "^1.14.4",
"rollup-plugin-babel": "4.3.2",
"rollup-plugin-dts": "^1.1.0",
"rollup-plugin-node-resolve": "4.0.0",
"rollup": "^2.6.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-dts": "^1.4.0",
"rollup-plugin-terser": "5.0.0",
"rollup-plugin-typescript2": "0.21.1",
"sade": "^1.6.1",
"sort-package-json": "1.22.1",
"spec.ts": "1.1.3",
"ts-jest": "^24.0.2",
"typescript": "3.6.2",
"ts-jest": "24.2.0",
"typescript": "3.8.3",
"typescript-rewrite-paths": "^1.2.0"
},
"publishConfig": {
Expand Down
7 changes: 0 additions & 7 deletions packages/addons/README.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/addons/src/index.ts

This file was deleted.

6 changes: 3 additions & 3 deletions packages/animated/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@react-spring/animated",
"version": "9.0.0-beta.33",
"version": "9.0.0-canary.808.17.55c5691",
"description": "Animated component props for React",
"main": "src/index.ts",
"scripts": {
"build": "rollup -c"
},
"dependencies": {
"@react-spring/shared": "link:../shared",
"tiny-invariant": "^1.0.4"
"react-layout-effect": "^1.0.1",
"shared": "link:../shared"
},
"publishConfig": {
"directory": "dist"
Expand Down
67 changes: 38 additions & 29 deletions packages/animated/src/Animated.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
import { FluidValue, defineHidden } from 'shared'
import { AnimatedValue } from './AnimatedValue'
export const animatedTag = Symbol.for('isAnimated')

export const isAnimated = (val: any): val is Animated =>
!!(val && val[animatedTag])
const $node: any = Symbol.for('Animated:node')

export abstract class Animated {
protected [animatedTag] = true
protected children = new Set<Animated>()
protected payload?: Set<AnimatedValue>
export const isAnimated = <T = any>(value: any): value is Animated<T> =>
!!value && value[$node] === value

/** Returns all values contained by this node. Pass true for only the animated values. */
abstract getValue(animated?: boolean): any
/** Get the owner's `Animated` node. */
export const getAnimated = <T = any>(owner: any): Animated<T> | undefined =>
owner && owner[$node]

/** Returns the set of `AnimatedValue` nodes contained by this node. */
getPayload(): ReadonlySet<AnimatedValue> {
return this.payload!
}
/** Set the owner's `Animated` node. */
export const setAnimated = (owner: any, node: Animated) =>
defineHidden(owner, $node, node)

/** Replace an `AnimatedValue` node in the payload. */
abstract updatePayload(prev: Animated, next: Animated): void
/** Get every `AnimatedValue` in the owner's `Animated` node. */
export const getPayload = (owner: any): AnimatedValue[] | undefined =>
owner && owner[$node] && owner[$node].getPayload()

/** Returns the set of animated nodes that depend on this node. */
getChildren(): ReadonlySet<Animated> {
return this.children
}
export abstract class Animated<T = any> {
/** The cache of animated values */
protected payload?: Payload

addChild(child: Animated) {
this.children.size || this._attach()
this.children.add(child)
constructor() {
// This makes "isAnimated" return true.
setAnimated(this, this)
}

removeChild(child: Animated) {
this.children.delete(child)
this.children.size || this._detach()
/** Get the current value. Pass `true` for only animated values. */
abstract getValue(animated?: boolean): T

/** Set the current value. */
abstract setValue(value: T): void

/** Reset any animation state. */
abstract reset(goal?: T): void

/** Get every `AnimatedValue` used by this node. */
getPayload(): Payload {
return this.payload || []
}

/** Called when this node goes from 0 children to 1+ children. */
abstract _attach(): void
/** The `AnimatedProps` class sets this before initializing */
static context: TreeContext | null = null
}

export type Payload = readonly AnimatedValue[]

/** Called when this node goes from 1+ children to 0 children. */
abstract _detach(): void
export type TreeContext = {
dependencies: Set<FluidValue>
}
78 changes: 38 additions & 40 deletions packages/animated/src/AnimatedArray.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
import { is, Animatable, SpringValue, InterpolatorArgs, each } from 'shared'
import { deprecateInterpolate } from 'shared/deprecations'
import { Animated } from './Animated'
import { AnimatedObject, toPayload } from './AnimatedObject'
import { to } from './interpolate'
import invariant from 'tiny-invariant'
import { isAnimatedString, each } from 'shared'
import { AnimatedObject } from './AnimatedObject'
import { AnimatedString } from './AnimatedString'
import { AnimatedValue } from './AnimatedValue'

type Value = number | string
type Source = AnimatedValue<Value>[]

/** An array of animated nodes */
export class AnimatedArray extends AnimatedObject
implements SpringValue<any[]> {
protected source!: Animated[]
constructor(source: Animated[]) {
super(source)
export class AnimatedArray<
T extends ReadonlyArray<Value> = Value[]
> extends AnimatedObject {
protected source!: Source
constructor(from: T, to?: T) {
super(null)
super.setValue(this._makeAnimated(from, to))
}

getValue(animated?: boolean) {
return this.source.map(node => node.getValue(animated))
static create<T extends ReadonlyArray<Value>>(from: T, to?: T) {
return new AnimatedArray(from, to)
}

setValue(value: any, flush?: boolean) {
const nodes = this.payload
if (is.arr(value)) {
invariant(value.length == nodes.size)
let i = 0
each(nodes, node => node.setValue(value[i++], flush))
} else {
each(nodes, node => node.setValue(value, flush))
}
getValue(): T {
return this.source.map(node => node.getValue()) as any
}

to<Out extends Animatable>(
...args: InterpolatorArgs<any[], Out>
): SpringValue<Out> {
return (to as any)(this, ...args)
}

interpolate<Out extends Animatable>(
...args: InterpolatorArgs<any[], Out>
): SpringValue<Out> {
deprecateInterpolate()
return this.to(...args)
setValue(newValue: T | null) {
const payload = this.getPayload()
// Reuse the payload when lengths are equal.
if (newValue && newValue.length == payload.length) {
each(payload, (node, i) => node.setValue(newValue[i]))
} else {
// Remake the payload when length changes.
this.source = this._makeAnimated(newValue)
this.payload = this._makePayload(this.source)
}
}

updatePayload(prev: Animated, next: Animated) {
const source = [...this.source]
each(source, (val, index) => {
if (val === prev) source[index] = next
})
this.source = source
this.payload = toPayload(source)
/** Convert the `from` and `to` values to an array of `Animated` nodes */
protected _makeAnimated(from: T | null, to: T = from!) {
return from
? from.map((from, i) =>
(isAnimatedString(from) ? AnimatedString : AnimatedValue).create(
from,
to[i]
)
)
: []
}
}
Loading