react 0.12.0 → 0.13.0-alpha.2
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.
- package/dist/JSXTransformer.js +2345 -910
- package/dist/react-with-addons.js +5273 -4111
- package/dist/react-with-addons.min.js +5 -6
- package/dist/react.js +4840 -3940
- package/dist/react.min.js +5 -6
- package/lib/AutoFocusMixin.js +1 -1
- package/lib/BeforeInputEventPlugin.js +389 -112
- package/lib/CSSProperty.js +6 -3
- package/lib/CSSPropertyOperations.js +21 -1
- package/lib/CallbackQueue.js +2 -2
- package/lib/ChangeEventPlugin.js +3 -3
- package/lib/ClientReactRootIndex.js +1 -1
- package/lib/DOMChildrenOperations.js +6 -4
- package/lib/DOMProperty.js +1 -1
- package/lib/DOMPropertyOperations.js +1 -1
- package/lib/Danger.js +7 -6
- package/lib/DefaultEventPluginOrder.js +1 -2
- package/lib/EnterLeaveEventPlugin.js +1 -1
- package/lib/EventConstants.js +1 -1
- package/lib/EventPluginHub.js +9 -7
- package/lib/EventPluginRegistry.js +1 -1
- package/lib/EventPluginUtils.js +1 -1
- package/lib/EventPropagators.js +1 -1
- package/lib/ExecutionEnvironment.js +2 -3
- package/lib/FallbackCompositionState.js +89 -0
- package/lib/HTMLDOMPropertyConfig.js +19 -7
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +3 -3
- package/lib/LocalEventTrapMixin.js +1 -1
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +3 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +17 -50
- package/lib/ReactBrowserComponentMixin.js +3 -13
- package/lib/ReactBrowserEventEmitter.js +4 -6
- package/lib/ReactCSSTransitionGroup.js +4 -1
- package/lib/ReactCSSTransitionGroupChild.js +12 -2
- package/lib/ReactChildReconciler.js +121 -0
- package/lib/ReactChildren.js +10 -8
- package/lib/ReactClass.js +874 -0
- package/lib/ReactComponent.js +45 -286
- package/lib/ReactComponentBase.js +126 -0
- package/lib/ReactComponentBrowserEnvironment.js +10 -83
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +700 -1045
- package/lib/ReactContext.js +6 -2
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +3 -8
- package/lib/ReactDOMButton.js +5 -6
- package/lib/ReactDOMComponent.js +120 -77
- package/lib/ReactDOMForm.js +5 -6
- package/lib/ReactDOMIDOperations.js +56 -74
- package/lib/ReactDOMImg.js +4 -6
- package/lib/ReactDOMInput.js +5 -6
- package/lib/ReactDOMOption.js +5 -6
- package/lib/ReactDOMSelect.js +57 -65
- package/lib/ReactDOMSelection.js +6 -2
- package/lib/ReactDOMTextComponent.js +124 -0
- package/lib/ReactDOMTextarea.js +5 -6
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +14 -8
- package/lib/ReactDefaultPerf.js +8 -7
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +22 -15
- package/lib/ReactElementValidator.js +192 -53
- package/lib/ReactEmptyComponent.js +29 -11
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +3 -3
- package/lib/ReactInjection.js +7 -5
- package/lib/ReactInputSelection.js +3 -4
- package/lib/ReactInstanceHandles.js +3 -2
- package/lib/ReactInstanceMap.js +47 -0
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +202 -66
- package/lib/ReactMultiChild.js +44 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +47 -10
- package/lib/ReactOwner.js +4 -48
- package/lib/ReactPerf.js +21 -1
- package/lib/ReactPropTransferer.js +2 -57
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +14 -22
- package/lib/ReactPutListenerQueue.js +1 -1
- package/lib/ReactReconcileTransaction.js +1 -1
- package/lib/ReactRef.js +96 -0
- package/lib/ReactRootIndex.js +1 -1
- package/lib/ReactServerRendering.js +5 -3
- package/lib/ReactServerRenderingTransaction.js +1 -1
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +83 -26
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +48 -7
- package/lib/ReactUpdates.js +46 -45
- package/lib/ReactWithAddons.js +1 -1
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +3 -3
- package/lib/ServerReactRootIndex.js +1 -1
- package/lib/SimpleEventPlugin.js +1 -1
- package/lib/SyntheticClipboardEvent.js +1 -2
- package/lib/SyntheticCompositionEvent.js +1 -2
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +11 -3
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -2
- package/lib/SyntheticKeyboardEvent.js +1 -1
- package/lib/SyntheticMouseEvent.js +2 -4
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/Transaction.js +3 -3
- package/lib/ViewportMetrics.js +2 -5
- package/lib/accumulate.js +47 -0
- package/lib/accumulateInto.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +3 -3
- package/lib/copyProperties.js +2 -0
- package/lib/createFullPageComponent.js +3 -3
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/escapeTextForBrowser.js +6 -6
- package/lib/findDOMNode.js +51 -0
- package/lib/flattenChildren.js +11 -22
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +1 -1
- package/lib/getEventTarget.js +1 -1
- package/lib/getIteratorFn.js +42 -0
- package/lib/getNodeForCharacterOffset.js +2 -2
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +89 -66
- package/lib/isEventSupported.js +1 -1
- package/lib/isNode.js +3 -4
- package/lib/isTextInputElement.js +2 -3
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/memoizeStringOnly.js +4 -5
- package/lib/onlyChild.js +1 -1
- package/lib/setInnerHTML.js +12 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +48 -6
- package/lib/traverseAllChildren.js +111 -55
- package/lib/update.js +1 -1
- package/lib/warning.js +9 -2
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/ReactTextComponent.js +0 -104
- package/lib/deprecated.js +0 -47
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactTransitionGroup
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var React = require("./React");
|
|
15
15
|
var ReactTransitionChildMapping = require("./ReactTransitionChildMapping");
|
|
@@ -39,6 +39,21 @@ var ReactTransitionGroup = React.createClass({
|
|
|
39
39
|
};
|
|
40
40
|
},
|
|
41
41
|
|
|
42
|
+
componentWillMount: function() {
|
|
43
|
+
this.currentlyTransitioningKeys = {};
|
|
44
|
+
this.keysToEnter = [];
|
|
45
|
+
this.keysToLeave = [];
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
componentDidMount: function() {
|
|
49
|
+
var initialChildMapping = this.state.children;
|
|
50
|
+
for (var key in initialChildMapping) {
|
|
51
|
+
if (initialChildMapping[key]) {
|
|
52
|
+
this.performAppear(key);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
42
57
|
componentWillReceiveProps: function(nextProps) {
|
|
43
58
|
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
44
59
|
nextProps.children
|
|
@@ -73,12 +88,6 @@ var ReactTransitionGroup = React.createClass({
|
|
|
73
88
|
// If we want to someday check for reordering, we could do it here.
|
|
74
89
|
},
|
|
75
90
|
|
|
76
|
-
componentWillMount: function() {
|
|
77
|
-
this.currentlyTransitioningKeys = {};
|
|
78
|
-
this.keysToEnter = [];
|
|
79
|
-
this.keysToLeave = [];
|
|
80
|
-
},
|
|
81
|
-
|
|
82
91
|
componentDidUpdate: function() {
|
|
83
92
|
var keysToEnter = this.keysToEnter;
|
|
84
93
|
this.keysToEnter = [];
|
|
@@ -89,6 +98,38 @@ var ReactTransitionGroup = React.createClass({
|
|
|
89
98
|
keysToLeave.forEach(this.performLeave);
|
|
90
99
|
},
|
|
91
100
|
|
|
101
|
+
performAppear: function(key) {
|
|
102
|
+
this.currentlyTransitioningKeys[key] = true;
|
|
103
|
+
|
|
104
|
+
var component = this.refs[key];
|
|
105
|
+
|
|
106
|
+
if (component.componentWillAppear) {
|
|
107
|
+
component.componentWillAppear(
|
|
108
|
+
this._handleDoneAppearing.bind(this, key)
|
|
109
|
+
);
|
|
110
|
+
} else {
|
|
111
|
+
this._handleDoneAppearing(key);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
_handleDoneAppearing: function(key) {
|
|
116
|
+
var component = this.refs[key];
|
|
117
|
+
if (component.componentDidAppear) {
|
|
118
|
+
component.componentDidAppear();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
delete this.currentlyTransitioningKeys[key];
|
|
122
|
+
|
|
123
|
+
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(
|
|
124
|
+
this.props.children
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
|
|
128
|
+
// This was removed before it had fully appeared. Remove it.
|
|
129
|
+
this.performLeave(key);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
92
133
|
performEnter: function(key) {
|
|
93
134
|
this.currentlyTransitioningKeys[key] = true;
|
|
94
135
|
|
package/lib/ReactUpdates.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule ReactUpdates
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var CallbackQueue = require("./CallbackQueue");
|
|
15
15
|
var PooledClass = require("./PooledClass");
|
|
@@ -110,14 +110,14 @@ function batchedUpdates(callback, a, b) {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* Array comparator for ReactComponents by
|
|
113
|
+
* Array comparator for ReactComponents by mount ordering.
|
|
114
114
|
*
|
|
115
115
|
* @param {ReactComponent} c1 first component you're comparing
|
|
116
116
|
* @param {ReactComponent} c2 second component you're comparing
|
|
117
117
|
* @return {number} Return value usable by Array.prototype.sort().
|
|
118
118
|
*/
|
|
119
|
-
function
|
|
120
|
-
return c1.
|
|
119
|
+
function mountOrderComparator(c1, c2) {
|
|
120
|
+
return c1._mountOrder - c2._mountOrder;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
function runBatchedUpdates(transaction) {
|
|
@@ -133,56 +133,57 @@ function runBatchedUpdates(transaction) {
|
|
|
133
133
|
// Since reconciling a component higher in the owner hierarchy usually (not
|
|
134
134
|
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
|
135
135
|
// them before their children by sorting the array.
|
|
136
|
-
dirtyComponents.sort(
|
|
136
|
+
dirtyComponents.sort(mountOrderComparator);
|
|
137
137
|
|
|
138
138
|
for (var i = 0; i < len; i++) {
|
|
139
|
-
// If a component is unmounted before pending changes apply,
|
|
140
|
-
//
|
|
139
|
+
// If a component is unmounted before pending changes apply, it will still
|
|
140
|
+
// be here, but we assume that it has cleared its _pendingCallbacks and
|
|
141
|
+
// that performUpdateIfNecessary is a noop.
|
|
141
142
|
var component = dirtyComponents[i];
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
143
|
+
|
|
144
|
+
// If performUpdateIfNecessary happens to enqueue any new updates, we
|
|
145
|
+
// shouldn't execute the callbacks until the next render happens, so
|
|
146
|
+
// stash the callbacks first
|
|
147
|
+
var callbacks = component._pendingCallbacks;
|
|
148
|
+
component._pendingCallbacks = null;
|
|
149
|
+
component.performUpdateIfNecessary(transaction.reconcileTransaction);
|
|
150
|
+
|
|
151
|
+
if (callbacks) {
|
|
152
|
+
for (var j = 0; j < callbacks.length; j++) {
|
|
153
|
+
transaction.callbackQueue.enqueue(
|
|
154
|
+
callbacks[j],
|
|
155
|
+
component.getPublicInstance()
|
|
156
|
+
);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
var flushBatchedUpdates =
|
|
163
|
-
'
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
transaction.perform(runBatchedUpdates, null, transaction);
|
|
174
|
-
ReactUpdatesFlushTransaction.release(transaction);
|
|
175
|
-
}
|
|
162
|
+
var flushBatchedUpdates = function() {
|
|
163
|
+
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
|
|
164
|
+
// array and perform any updates enqueued by mount-ready handlers (i.e.,
|
|
165
|
+
// componentDidUpdate) but we need to check here too in order to catch
|
|
166
|
+
// updates enqueued by setState callbacks and asap calls.
|
|
167
|
+
while (dirtyComponents.length || asapEnqueued) {
|
|
168
|
+
if (dirtyComponents.length) {
|
|
169
|
+
var transaction = ReactUpdatesFlushTransaction.getPooled();
|
|
170
|
+
transaction.perform(runBatchedUpdates, null, transaction);
|
|
171
|
+
ReactUpdatesFlushTransaction.release(transaction);
|
|
172
|
+
}
|
|
176
173
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
174
|
+
if (asapEnqueued) {
|
|
175
|
+
asapEnqueued = false;
|
|
176
|
+
var queue = asapCallbackQueue;
|
|
177
|
+
asapCallbackQueue = CallbackQueue.getPooled();
|
|
178
|
+
queue.notifyAll();
|
|
179
|
+
CallbackQueue.release(queue);
|
|
184
180
|
}
|
|
185
181
|
}
|
|
182
|
+
};
|
|
183
|
+
flushBatchedUpdates = ReactPerf.measure(
|
|
184
|
+
'ReactUpdates',
|
|
185
|
+
'flushBatchedUpdates',
|
|
186
|
+
flushBatchedUpdates
|
|
186
187
|
);
|
|
187
188
|
|
|
188
189
|
/**
|
|
@@ -191,11 +192,11 @@ var flushBatchedUpdates = ReactPerf.measure(
|
|
|
191
192
|
*/
|
|
192
193
|
function enqueueUpdate(component, callback) {
|
|
193
194
|
("production" !== process.env.NODE_ENV ? invariant(
|
|
194
|
-
!callback || typeof callback ===
|
|
195
|
+
!callback || typeof callback === 'function',
|
|
195
196
|
'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' +
|
|
196
197
|
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
|
|
197
198
|
'isn\'t callable.'
|
|
198
|
-
) : invariant(!callback || typeof callback ===
|
|
199
|
+
) : invariant(!callback || typeof callback === 'function'));
|
|
199
200
|
ensureInjected();
|
|
200
201
|
|
|
201
202
|
// Various parts of our code (such as ReactCompositeComponent's
|
package/lib/ReactWithAddons.js
CHANGED
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule SelectEventPlugin
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var EventConstants = require("./EventConstants");
|
|
15
15
|
var EventPropagators = require("./EventPropagators");
|
|
@@ -94,8 +94,8 @@ function constructSelectEvent(nativeEvent) {
|
|
|
94
94
|
// won't dispatch.
|
|
95
95
|
if (mouseDown ||
|
|
96
96
|
activeElement == null ||
|
|
97
|
-
activeElement
|
|
98
|
-
return;
|
|
97
|
+
activeElement !== getActiveElement()) {
|
|
98
|
+
return null;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
// Only fire when selection has actually changed.
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var SyntheticEvent = require("./SyntheticEvent");
|
|
16
16
|
|
|
@@ -41,4 +41,3 @@ function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
|
41
41
|
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
|
|
42
42
|
|
|
43
43
|
module.exports = SyntheticClipboardEvent;
|
|
44
|
-
|
package/lib/SyntheticEvent.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var PooledClass = require("./PooledClass");
|
|
16
16
|
|
|
@@ -88,13 +88,21 @@ assign(SyntheticEvent.prototype, {
|
|
|
88
88
|
preventDefault: function() {
|
|
89
89
|
this.defaultPrevented = true;
|
|
90
90
|
var event = this.nativeEvent;
|
|
91
|
-
|
|
91
|
+
if (event.preventDefault) {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
} else {
|
|
94
|
+
event.returnValue = false;
|
|
95
|
+
}
|
|
92
96
|
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
|
93
97
|
},
|
|
94
98
|
|
|
95
99
|
stopPropagation: function() {
|
|
96
100
|
var event = this.nativeEvent;
|
|
97
|
-
|
|
101
|
+
if (event.stopPropagation) {
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
} else {
|
|
104
|
+
event.cancelBubble = true;
|
|
105
|
+
}
|
|
98
106
|
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
|
|
99
107
|
},
|
|
100
108
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @typechecks static-only
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
'use strict';
|
|
14
14
|
|
|
15
15
|
var SyntheticUIEvent = require("./SyntheticUIEvent");
|
|
16
16
|
var ViewportMetrics = require("./ViewportMetrics");
|
|
@@ -48,9 +48,7 @@ var MouseEventInterface = {
|
|
|
48
48
|
buttons: null,
|
|
49
49
|
relatedTarget: function(event) {
|
|
50
50
|
return event.relatedTarget || (
|
|
51
|
-
event.fromElement === event.srcElement ?
|
|
52
|
-
event.toElement :
|
|
53
|
-
event.fromElement
|
|
51
|
+
((event.fromElement === event.srcElement ? event.toElement : event.fromElement))
|
|
54
52
|
);
|
|
55
53
|
},
|
|
56
54
|
// "Proprietary" Interface.
|