react 0.12.1 → 0.13.0-beta.1
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 +352 -251
- package/dist/react-with-addons.js +5409 -4242
- package/dist/react-with-addons.min.js +5 -6
- package/dist/react.js +5012 -4136
- 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 +57 -10
- 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 +4 -2
- 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 +9 -2
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/Object.assign.js +3 -1
- package/lib/PooledClass.js +1 -1
- package/lib/React.js +17 -51
- 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 +125 -0
- package/lib/ReactChildren.js +10 -8
- package/lib/ReactClass.js +916 -0
- package/lib/ReactComponent.js +81 -404
- package/lib/ReactComponentBrowserEnvironment.js +10 -83
- package/lib/ReactComponentEnvironment.js +57 -0
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +533 -1132
- 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 +110 -92
- 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/{ReactTextComponent.js → ReactDOMTextComponent.js} +48 -35
- package/lib/ReactDOMTextarea.js +5 -6
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +14 -8
- package/lib/ReactDefaultPerf.js +16 -7
- package/lib/ReactDefaultPerfAnalysis.js +1 -1
- package/lib/ReactElement.js +23 -15
- package/lib/ReactElementValidator.js +209 -57
- package/lib/ReactEmptyComponent.js +29 -11
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +3 -4
- 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/ReactLifeCycle.js +35 -0
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +239 -68
- package/lib/ReactMultiChild.js +49 -47
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +72 -25
- 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/ReactReconciler.js +107 -0
- package/lib/ReactRef.js +70 -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 +112 -26
- package/lib/ReactTransitionChildMapping.js +1 -1
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +48 -7
- package/lib/ReactUpdateQueue.js +264 -0
- package/lib/ReactUpdates.js +48 -61
- 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/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 +85 -67
- 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 +12 -1
- package/package.json +1 -1
- package/lib/CompositionEventPlugin.js +0 -257
- package/lib/ReactLegacyElement.js +0 -243
- package/lib/deprecated.js +0 -47
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");
|
|
@@ -104,20 +104,20 @@ assign(
|
|
|
104
104
|
|
|
105
105
|
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
|
106
106
|
|
|
107
|
-
function batchedUpdates(callback, a, b) {
|
|
107
|
+
function batchedUpdates(callback, a, b, c, d) {
|
|
108
108
|
ensureInjected();
|
|
109
|
-
batchingStrategy.batchedUpdates(callback, a, b);
|
|
109
|
+
batchingStrategy.batchedUpdates(callback, a, b, c, d);
|
|
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,69 +133,64 @@ 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
|
/**
|
|
189
190
|
* Mark a component as needing a rerender, adding an optional callback to a
|
|
190
191
|
* list of functions which will be executed once the rerender occurs.
|
|
191
192
|
*/
|
|
192
|
-
function enqueueUpdate(component
|
|
193
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
194
|
-
!callback || typeof callback === "function",
|
|
195
|
-
'enqueueUpdate(...): You called `setProps`, `replaceProps`, ' +
|
|
196
|
-
'`setState`, `replaceState`, or `forceUpdate` with a callback that ' +
|
|
197
|
-
'isn\'t callable.'
|
|
198
|
-
) : invariant(!callback || typeof callback === "function"));
|
|
193
|
+
function enqueueUpdate(component) {
|
|
199
194
|
ensureInjected();
|
|
200
195
|
|
|
201
196
|
// Various parts of our code (such as ReactCompositeComponent's
|
|
@@ -212,19 +207,11 @@ function enqueueUpdate(component, callback) {
|
|
|
212
207
|
) : null);
|
|
213
208
|
|
|
214
209
|
if (!batchingStrategy.isBatchingUpdates) {
|
|
215
|
-
batchingStrategy.batchedUpdates(enqueueUpdate, component
|
|
210
|
+
batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
|
216
211
|
return;
|
|
217
212
|
}
|
|
218
213
|
|
|
219
214
|
dirtyComponents.push(component);
|
|
220
|
-
|
|
221
|
-
if (callback) {
|
|
222
|
-
if (component._pendingCallbacks) {
|
|
223
|
-
component._pendingCallbacks.push(callback);
|
|
224
|
-
} else {
|
|
225
|
-
component._pendingCallbacks = [callback];
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
215
|
}
|
|
229
216
|
|
|
230
217
|
/**
|
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.
|
package/lib/SyntheticUIEvent.js
CHANGED
package/lib/Transaction.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @providesModule Transaction
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
'use strict';
|
|
13
13
|
|
|
14
14
|
var invariant = require("./invariant");
|
|
15
15
|
|
|
@@ -203,8 +203,8 @@ var Mixin = {
|
|
|
203
203
|
// close -- if it's still set to true in the finally block, it means
|
|
204
204
|
// wrapper.close threw.
|
|
205
205
|
errorThrown = true;
|
|
206
|
-
if (initData !== Transaction.OBSERVED_ERROR) {
|
|
207
|
-
wrapper.close
|
|
206
|
+
if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
|
|
207
|
+
wrapper.close.call(this, initData);
|
|
208
208
|
}
|
|
209
209
|
errorThrown = false;
|
|
210
210
|
} finally {
|
package/lib/ViewportMetrics.js
CHANGED
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
* @providesModule ViewportMetrics
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var getUnboundedScrollPosition = require("./getUnboundedScrollPosition");
|
|
12
|
+
'use strict';
|
|
15
13
|
|
|
16
14
|
var ViewportMetrics = {
|
|
17
15
|
|
|
@@ -19,8 +17,7 @@ var ViewportMetrics = {
|
|
|
19
17
|
|
|
20
18
|
currentScrollTop: 0,
|
|
21
19
|
|
|
22
|
-
refreshScrollValues: function() {
|
|
23
|
-
var scrollPosition = getUnboundedScrollPosition(window);
|
|
20
|
+
refreshScrollValues: function(scrollPosition) {
|
|
24
21
|
ViewportMetrics.currentScrollLeft = scrollPosition.x;
|
|
25
22
|
ViewportMetrics.currentScrollTop = scrollPosition.y;
|
|
26
23
|
}
|
package/lib/accumulateInto.js
CHANGED