+ {location.building}
diff --git a/demo/examples/flap-box.jsx b/demo/examples/flap-box.jsx
index e6dfe2d..220deaf 100644
--- a/demo/examples/flap-box.jsx
+++ b/demo/examples/flap-box.jsx
@@ -1,7 +1,7 @@
var _ = require('lodash');
var React = require('react');
-var VelocityComponent = require('../../lib/velocity-component');
-var VelocityHelpers = require('../../lib/velocity-helpers');
+var VelocityComponent = require('../../velocity-component');
+var velocityHelpers = require('../../velocity-helpers');
var Box = require('../components/box');
var EmojiSpan = require('../components/emoji-span');
@@ -16,7 +16,7 @@ on a state value.
var FlipAnimations = {
// Brings the box from flipped up to down. Also the default state that the box starts in. When
// this animates, includes a little swing at the end so it feels more like a flap.
- down: VelocityHelpers.registerEffect({
+ down: velocityHelpers.registerEffect({
// longer due to spring timing
defaultDuration: 1100,
calls: [
@@ -36,7 +36,7 @@ var FlipAnimations = {
}),
// Flips the box up nearly 180°.
- up: VelocityHelpers.registerEffect({
+ up: velocityHelpers.registerEffect({
defaultDuration: 200,
calls: [
[{
@@ -57,14 +57,14 @@ var FlipAnimations = {
// immediately with no tweening, since that doesn't make sense for the effect. We're using
// Velocity here only to co-ordinate the timing of the change.
var BlurAnimations = {
- blur: VelocityHelpers.registerEffect({
+ blur: velocityHelpers.registerEffect({
defaultDuration: 200,
calls: [
[{ blur: [3, 3], opacity: [.4, .4] }, 1, { delay: 50 }],
],
}),
- unblur: VelocityHelpers.registerEffect({
+ unblur: velocityHelpers.registerEffect({
defaultDuration: 200,
calls: [
[{ blur: [0, 0], opacity: [1, 1] }, 1, { delay: 150 }],
diff --git a/demo/examples/scrolling-group.jsx b/demo/examples/scrolling-group.jsx
index fdac24e..875a989 100644
--- a/demo/examples/scrolling-group.jsx
+++ b/demo/examples/scrolling-group.jsx
@@ -1,6 +1,6 @@
var React = require('react');
-var VelocityTransitionGroup = require('../../lib/velocity-transition-group');
-var VelocityHelpers = require('../../lib/velocity-helpers');
+var VelocityTransitionGroup = require('../../velocity-transition-group');
+var velocityHelpers = require('../../velocity-helpers');
var Box = require('../components/box');
var EmojiSpan = require('../components/emoji-span');
@@ -11,7 +11,7 @@ var FOODS = ['🍅', '🍆', '🍇', '🍈', '🍉', '🍊', '🍌', '🍍', '
var Animations = {
// Register these with UI Pack so that we can use stagger later.
- In: VelocityHelpers.registerEffect({
+ In: velocityHelpers.registerEffect({
calls: [
[{
transformPerspective: [ 800, 800 ],
@@ -27,7 +27,7 @@ var Animations = {
],
}),
- Out: VelocityHelpers.registerEffect({
+ Out: velocityHelpers.registerEffect({
calls: [
[{
transformPerspective: [ 800, 800 ],
diff --git a/demo/examples/toggle-box.jsx b/demo/examples/toggle-box.jsx
index 502da24..96857cf 100644
--- a/demo/examples/toggle-box.jsx
+++ b/demo/examples/toggle-box.jsx
@@ -1,5 +1,5 @@
var React = require('react');
-var VelocityComponent = require('../../lib/velocity-component');
+var VelocityComponent = require('../../velocity-component');
var tweenState = require('react-tween-state');
var s = require('underscore.string');
diff --git a/demo/examples/trigger-box.jsx b/demo/examples/trigger-box.jsx
index c377040..6bfcb61 100644
--- a/demo/examples/trigger-box.jsx
+++ b/demo/examples/trigger-box.jsx
@@ -1,5 +1,5 @@
var React = require('react');
-var VelocityComponent = require('../../lib/velocity-component');
+var VelocityComponent = require('../../velocity-component');
var s = require('underscore.string');
var Box = require('../components/box');
diff --git a/demo/main.jsx b/demo/main.jsx
index 1b24bda..edd1c02 100644
--- a/demo/main.jsx
+++ b/demo/main.jsx
@@ -1,8 +1,9 @@
require('./css/flexbox.css');
var React = require('react');
-var VelocityComponent = require('../lib/velocity-component');
-var VelocityTransitionGroup = require('../lib/velocity-transition-group');
+
+require('velocity-animate');
+require('velocity-animate/velocity.ui');
var CrossfadeExample = require('./examples/crossfade-example');
var FlapBox = require('./examples/flap-box');
@@ -10,8 +11,6 @@ var ScrollingGroup = require('./examples/scrolling-group');
var ToggleBox = require('./examples/toggle-box');
var TriggerBox = require('./examples/trigger-box');
-require('velocity-animate/velocity.ui');
-
var Demo = React.createClass({
render: function () {
var boxStyle = {
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..9bf6593
--- /dev/null
+++ b/index.js
@@ -0,0 +1,19 @@
+// Convenience main entrypoint if you are running with destructuring support:
+//
+// import {VelocityComponent, VelocityTransitionGroup} from 'velocity-react';
+//
+// You can also require just the component(s) you're using:
+//
+// var VelocityComponent = require('velocity-react/velocity-component');
+//
+// Note that if you want to use UI Pack you will need to require 'velocity' and
+// 'velocity.ui' at a top level in your app:
+//
+// require('velocity');
+// require('velocity-animate/velocity.ui');
+
+module.exports = {
+ VelocityComponent: require('./velocity-component'),
+ VelocityTransitionGroup: require('./velocity-transition-group'),
+ velocityHelpers: require('./velocity-helpers'),
+};
diff --git a/package.json b/package.json
index 91d7258..48cf49c 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
{
"name": "velocity-react",
- "version": "0.0.1",
+ "version": "1.0.0",
"description": "React components to wrap Velocity animations",
- "main": "lib",
+ "main": "index.js",
"scripts": {
"demo": "./node_modules/.bin/webpack-dev-server --progress --colors --content-base demo --hot --inline --config demo/webpack.config.js"
},
@@ -23,13 +23,14 @@
"homepage": "https://github.com/crashlytics/velocity-react#readme",
"dependencies": {
"lodash": "^3.10.1",
- "velocity-animate": "phopkins/velocity#feature/finish-all-queued"
+ "velocity-animate": "^1.2.3"
},
"peerDependencies": {
- "react": "^0.13.3"
+ "react": ">=0.13.0"
},
"devDependencies": {
"babel-loader": "^5.3.2",
+ "css-loader": "^0.19.0",
"react": "^0.13.3",
"react-hot-loader": "^1.2.9",
"react-tween-state": "^0.1.3",
diff --git a/lib/velocity-component.js b/velocity-component.js
similarity index 98%
rename from lib/velocity-component.js
rename to velocity-component.js
index 598e0f2..9f4dc96 100644
--- a/lib/velocity-component.js
+++ b/velocity-component.js
@@ -84,7 +84,9 @@ var VelocityComponent = React.createClass({
// It's ok to call this externally! By default the animation will be queued up. Pass stop: true in
// to stop the current animation before running. Pass finish: true to finish the current animation
// before running.
- runAnimation: function (config = {}) {
+ runAnimation: function (config) {
+ config = config || {};
+
this._shouldRunAnimation = false;
if (!this.isMounted() || this.props.animation == null) {
diff --git a/lib/velocity-helpers.js b/velocity-helpers.js
similarity index 80%
rename from lib/velocity-helpers.js
rename to velocity-helpers.js
index 266c935..7dc5007 100644
--- a/lib/velocity-helpers.js
+++ b/velocity-helpers.js
@@ -1,8 +1,9 @@
+// Copyright (c) 2015 Twitter, Inc. and other contributors
+
var _ = {
isObject: require('lodash/lang/isObject'),
};
var Velocity = require('velocity-animate');
-require('velocity-animate/velocity.ui');
var effectCounter = 0;
@@ -14,6 +15,11 @@ var effectCounter = 0;
// Velocity "UI pack effects" can have chained animation calls and specify a "defaultDuration", and
// also can take advantage of "stagger" and "reverse" options on the VelocityComponent.
//
+// You will need to manually register the UI Pack with the global Velocity in your application with:
+//
+// require('velocity');
+// require('velocity-animate/velocity.ui');
+//
// See: http://julian.com/research/velocity/#uiPack
//
// Typical usage:
@@ -54,6 +60,10 @@ function registerEffect(suffix, animation) {
suffix = '';
}
+ if (Velocity.RegisterEffect === undefined) {
+ throw "Velocity.RegisterEffect not found. You need to require('velocity-animate/velocity.ui') at a top level for UI Pack.";
+ }
+
var key = 'VelocityHelper.animation.' + (effectCounter++) + suffix;
Velocity.RegisterEffect(key, animation);
return key;
diff --git a/lib/velocity-transition-group.js b/velocity-transition-group.js
similarity index 99%
rename from lib/velocity-transition-group.js
rename to velocity-transition-group.js
index 15020cc..2ab50fa 100644
--- a/lib/velocity-transition-group.js
+++ b/velocity-transition-group.js
@@ -1,8 +1,8 @@
/*
Copyright (c) 2015 Twitter, Inc. and other contributors
-Component to add Velocity animations around React transitions. Delegate's to the React
-TransitionGroup addon.
+Component to add Velocity animations around React transitions. Delegates to the React TransitionGroup
+addon.
Properties
enter: Animation to run on a child component being added