react 0.13.1 → 0.14.0-alpha2
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/README.md +1 -1
- package/addons.js +7 -0
- package/addons/CSSTransitionGroup.js +1 -0
- package/addons/LinkedStateMixin.js +1 -0
- package/addons/Perf.js +1 -0
- package/addons/PureRenderMixin.js +1 -0
- package/addons/TestUtils.js +1 -0
- package/addons/TransitionGroup.js +1 -0
- package/addons/batchedUpdates.js +1 -0
- package/addons/cloneWithProps.js +1 -0
- package/addons/createFragment.js +1 -0
- package/addons/renderSubtreeIntoContainer.js +1 -0
- package/addons/shallowCompare.js +1 -0
- package/addons/update.js +1 -0
- package/dist/JSXTransformer.js +3336 -1671
- package/dist/react-with-addons.js +3320 -5125
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +2952 -4533
- package/dist/react.min.js +5 -5
- package/lib/AutoFocusMixin.js +4 -3
- package/lib/BeforeInputEventPlugin.js +30 -118
- package/lib/CSSCore.js +12 -23
- package/lib/CSSProperty.js +9 -4
- package/lib/CSSPropertyOperations.js +14 -30
- package/lib/CallbackQueue.js +7 -10
- package/lib/ChangeEventPlugin.js +24 -88
- package/lib/ClientReactRootIndex.js +2 -2
- package/lib/DOMChildrenOperations.js +13 -33
- package/lib/DOMProperty.js +41 -67
- package/lib/DOMPropertyOperations.js +30 -51
- package/lib/Danger.js +19 -62
- package/lib/DefaultEventPluginOrder.js +2 -12
- package/lib/EnterLeaveEventPlugin.js +11 -33
- package/lib/EventConstants.js +2 -2
- package/lib/EventListener.js +11 -13
- package/lib/EventPluginHub.js +44 -47
- package/lib/EventPluginRegistry.js +18 -74
- package/lib/EventPluginUtils.js +27 -38
- package/lib/EventPropagators.js +23 -26
- package/lib/ExecutionEnvironment.js +4 -8
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +13 -20
- package/lib/LinkedStateMixin.js +3 -6
- package/lib/LinkedValueUtils.js +34 -64
- package/lib/LocalEventTrapMixin.js +9 -16
- package/lib/Object.assign.js +1 -1
- package/lib/PooledClass.js +8 -11
- package/lib/React.js +9 -129
- package/lib/ReactBrowserComponentMixin.js +9 -2
- package/lib/ReactBrowserEventEmitter.js +26 -82
- package/lib/ReactCSSTransitionGroup.js +13 -24
- package/lib/ReactCSSTransitionGroupChild.js +18 -28
- package/lib/ReactChildReconciler.js +11 -19
- package/lib/ReactChildren.js +21 -28
- package/lib/ReactClass.js +81 -234
- package/lib/ReactComponent.js +17 -33
- package/lib/ReactComponentBrowserEnvironment.js +4 -8
- package/lib/ReactComponentEnvironment.js +6 -12
- package/lib/ReactComponentWithPureRenderMixin.js +4 -5
- package/lib/ReactCompositeComponent.js +85 -297
- package/lib/ReactContext.js +2 -44
- package/lib/ReactCurrentOwner.js +1 -3
- package/lib/ReactDOM.js +4 -2
- package/lib/ReactDOMButton.js +3 -4
- package/lib/ReactDOMClient.js +85 -0
- package/lib/ReactDOMComponent.js +184 -146
- package/lib/ReactDOMForm.js +3 -3
- package/lib/ReactDOMIDOperations.js +11 -22
- package/lib/ReactDOMIframe.js +3 -3
- package/lib/ReactDOMImg.js +3 -3
- package/lib/ReactDOMInput.js +22 -35
- package/lib/ReactDOMOption.js +68 -10
- package/lib/ReactDOMSelect.js +50 -28
- package/lib/ReactDOMSelection.js +5 -20
- package/lib/ReactDOMServer.js +24 -0
- package/lib/ReactDOMTextComponent.js +17 -18
- package/lib/ReactDOMTextarea.js +15 -27
- package/lib/ReactDefaultBatchingStrategy.js +9 -13
- package/lib/ReactDefaultInjection.js +31 -40
- package/lib/ReactDefaultPerf.js +36 -69
- package/lib/ReactDefaultPerfAnalysis.js +8 -14
- package/lib/ReactElement.js +24 -57
- package/lib/ReactElementValidator.js +38 -105
- package/lib/ReactEmptyComponent.js +7 -11
- package/lib/ReactErrorUtils.js +2 -2
- package/lib/ReactEventEmitterMixin.js +3 -12
- package/lib/ReactEventListener.js +16 -38
- package/lib/ReactFragment.js +23 -54
- package/lib/ReactInjection.js +1 -1
- package/lib/ReactInputSelection.js +11 -21
- package/lib/ReactInstanceHandles.js +27 -57
- package/lib/ReactInstanceMap.js +5 -5
- package/lib/ReactIsomorphic.js +70 -0
- package/lib/ReactLifeCycle.js +1 -1
- package/lib/ReactLink.js +2 -4
- package/lib/ReactMarkupChecksum.js +5 -10
- package/lib/ReactMount.js +137 -260
- package/lib/ReactMultiChild.js +19 -45
- package/lib/ReactMultiChildUpdateTypes.js +1 -1
- package/lib/ReactNativeComponent.js +7 -11
- package/lib/ReactOwner.js +7 -24
- package/lib/ReactPerf.js +8 -12
- package/lib/ReactPropTransferer.js +4 -4
- package/lib/ReactPropTypeLocationNames.js +2 -2
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +29 -61
- package/lib/ReactReconcileTransaction.js +9 -34
- package/lib/ReactReconciler.js +9 -19
- package/lib/ReactRef.js +5 -8
- package/lib/ReactRootIndex.js +2 -2
- package/lib/ReactServerRendering.js +7 -15
- package/lib/ReactServerRenderingTransaction.js +7 -32
- package/lib/ReactStateSetters.js +6 -6
- package/lib/ReactTestUtils.js +93 -165
- package/lib/ReactTransitionChildMapping.js +5 -7
- package/lib/ReactTransitionEvents.js +5 -5
- package/lib/ReactTransitionGroup.js +30 -52
- package/lib/ReactUpdateQueue.js +27 -90
- package/lib/ReactUpdates.js +27 -79
- package/lib/ReactWithAddons.js +7 -6
- package/lib/SVGDOMPropertyConfig.js +41 -4
- package/lib/SelectEventPlugin.js +28 -29
- package/lib/ServerReactRootIndex.js +2 -2
- package/lib/SimpleEventPlugin.js +136 -128
- package/lib/SyntheticClipboardEvent.js +3 -7
- package/lib/SyntheticCompositionEvent.js +3 -9
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +8 -10
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +3 -9
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +8 -14
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +3 -3
- package/lib/SyntheticWheelEvent.js +11 -15
- package/lib/Transaction.js +12 -24
- package/lib/ViewportMetrics.js +2 -2
- package/lib/accumulateInto.js +2 -5
- package/lib/adler32.js +2 -4
- package/lib/camelize.js +4 -2
- package/lib/camelizeStyleName.js +2 -2
- package/lib/cloneWithProps.js +5 -11
- package/lib/containsNode.js +29 -16
- package/lib/createArrayFromMixed.js +17 -16
- package/lib/createFullPageComponent.js +4 -11
- package/lib/createNodesFromMarkup.js +6 -8
- package/lib/dangerousStyleValue.js +2 -3
- package/lib/emptyFunction.js +10 -4
- package/lib/emptyObject.js +1 -1
- package/lib/escapeTextContentForBrowser.js +1 -1
- package/lib/findDOMNode.js +5 -24
- package/lib/flattenChildren.js +4 -10
- package/lib/focusNode.js +2 -3
- package/lib/forEachAccumulated.js +2 -2
- package/lib/getActiveElement.js +4 -2
- 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 +2 -4
- package/lib/getMarkupWrap.js +7 -5
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getTextContentAccessor.js +2 -4
- package/lib/getUnboundedScrollPosition.js +1 -1
- package/lib/hyphenate.js +3 -1
- package/lib/hyphenateStyleName.js +2 -2
- package/lib/instantiateReactComponent.js +14 -37
- package/lib/invariant.js +8 -12
- package/lib/isEventSupported.js +7 -10
- package/lib/isNode.js +4 -6
- package/lib/isTextInputElement.js +2 -4
- package/lib/isTextNode.js +3 -1
- package/lib/joinClasses.js +2 -2
- package/lib/keyMirror.js +3 -6
- package/lib/keyOf.js +4 -3
- package/lib/mapObject.js +1 -1
- package/lib/memoizeStringOnly.js +2 -2
- package/lib/onlyChild.js +2 -5
- package/lib/performance.js +2 -5
- package/lib/performanceNow.js +3 -1
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/renderSubtreeIntoContainer.js +16 -0
- package/lib/setInnerHTML.js +11 -8
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +24 -0
- package/lib/shallowEqual.js +17 -11
- package/lib/shouldUpdateReactComponent.js +3 -64
- package/lib/toArray.js +8 -19
- package/lib/traverseAllChildren.js +22 -89
- package/lib/update.js +33 -90
- package/lib/validateDOMNesting.js +355 -0
- package/lib/warning.js +17 -15
- package/package.json +3 -3
- package/lib/MobileSafariClickEventPlugin.js +0 -56
- package/lib/ReactPutListenerQueue.js +0 -54
- package/lib/cx.js +0 -52
- package/lib/getReactRootElementInContainer.js +0 -33
package/lib/ReactUpdates.js
CHANGED
|
@@ -29,18 +29,14 @@ var asapEnqueued = false;
|
|
|
29
29
|
var batchingStrategy = null;
|
|
30
30
|
|
|
31
31
|
function ensureInjected() {
|
|
32
|
-
|
|
33
|
-
ReactUpdates.ReactReconcileTransaction && batchingStrategy,
|
|
34
|
-
'ReactUpdates: must inject a reconcile transaction class and batching ' +
|
|
35
|
-
'strategy'
|
|
36
|
-
) : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy));
|
|
32
|
+
'production' !== process.env.NODE_ENV ? invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(ReactUpdates.ReactReconcileTransaction && batchingStrategy);
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
var NESTED_UPDATES = {
|
|
40
|
-
initialize: function() {
|
|
36
|
+
initialize: function () {
|
|
41
37
|
this.dirtyComponentsLength = dirtyComponents.length;
|
|
42
38
|
},
|
|
43
|
-
close: function() {
|
|
39
|
+
close: function () {
|
|
44
40
|
if (this.dirtyComponentsLength !== dirtyComponents.length) {
|
|
45
41
|
// Additional updates were enqueued by componentDidUpdate handlers or
|
|
46
42
|
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
|
|
@@ -56,10 +52,10 @@ var NESTED_UPDATES = {
|
|
|
56
52
|
};
|
|
57
53
|
|
|
58
54
|
var UPDATE_QUEUEING = {
|
|
59
|
-
initialize: function() {
|
|
55
|
+
initialize: function () {
|
|
60
56
|
this.callbackQueue.reset();
|
|
61
57
|
},
|
|
62
|
-
close: function() {
|
|
58
|
+
close: function () {
|
|
63
59
|
this.callbackQueue.notifyAll();
|
|
64
60
|
}
|
|
65
61
|
};
|
|
@@ -70,18 +66,15 @@ function ReactUpdatesFlushTransaction() {
|
|
|
70
66
|
this.reinitializeTransaction();
|
|
71
67
|
this.dirtyComponentsLength = null;
|
|
72
68
|
this.callbackQueue = CallbackQueue.getPooled();
|
|
73
|
-
this.reconcileTransaction =
|
|
74
|
-
ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
69
|
+
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
75
70
|
}
|
|
76
71
|
|
|
77
|
-
assign(
|
|
78
|
-
|
|
79
|
-
Transaction.Mixin, {
|
|
80
|
-
getTransactionWrappers: function() {
|
|
72
|
+
assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
|
|
73
|
+
getTransactionWrappers: function () {
|
|
81
74
|
return TRANSACTION_WRAPPERS;
|
|
82
75
|
},
|
|
83
76
|
|
|
84
|
-
destructor: function() {
|
|
77
|
+
destructor: function () {
|
|
85
78
|
this.dirtyComponentsLength = null;
|
|
86
79
|
CallbackQueue.release(this.callbackQueue);
|
|
87
80
|
this.callbackQueue = null;
|
|
@@ -89,25 +82,18 @@ assign(
|
|
|
89
82
|
this.reconcileTransaction = null;
|
|
90
83
|
},
|
|
91
84
|
|
|
92
|
-
perform: function(method, scope, a) {
|
|
85
|
+
perform: function (method, scope, a) {
|
|
93
86
|
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
|
|
94
87
|
// with this transaction's wrappers around it.
|
|
95
|
-
return Transaction.Mixin.perform.call(
|
|
96
|
-
this,
|
|
97
|
-
this.reconcileTransaction.perform,
|
|
98
|
-
this.reconcileTransaction,
|
|
99
|
-
method,
|
|
100
|
-
scope,
|
|
101
|
-
a
|
|
102
|
-
);
|
|
88
|
+
return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
|
|
103
89
|
}
|
|
104
90
|
});
|
|
105
91
|
|
|
106
92
|
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
|
107
93
|
|
|
108
|
-
function batchedUpdates(callback, a, b, c, d) {
|
|
94
|
+
function batchedUpdates(callback, a, b, c, d, e) {
|
|
109
95
|
ensureInjected();
|
|
110
|
-
batchingStrategy.batchedUpdates(callback, a, b, c, d);
|
|
96
|
+
batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
|
|
111
97
|
}
|
|
112
98
|
|
|
113
99
|
/**
|
|
@@ -123,13 +109,7 @@ function mountOrderComparator(c1, c2) {
|
|
|
123
109
|
|
|
124
110
|
function runBatchedUpdates(transaction) {
|
|
125
111
|
var len = transaction.dirtyComponentsLength;
|
|
126
|
-
|
|
127
|
-
len === dirtyComponents.length,
|
|
128
|
-
'Expected flush transaction\'s stored dirty-components length (%s) to ' +
|
|
129
|
-
'match dirty-components array length (%s).',
|
|
130
|
-
len,
|
|
131
|
-
dirtyComponents.length
|
|
132
|
-
) : invariant(len === dirtyComponents.length));
|
|
112
|
+
'production' !== process.env.NODE_ENV ? invariant(len === dirtyComponents.length, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(len === dirtyComponents.length);
|
|
133
113
|
|
|
134
114
|
// Since reconciling a component higher in the owner hierarchy usually (not
|
|
135
115
|
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
|
@@ -148,23 +128,17 @@ function runBatchedUpdates(transaction) {
|
|
|
148
128
|
var callbacks = component._pendingCallbacks;
|
|
149
129
|
component._pendingCallbacks = null;
|
|
150
130
|
|
|
151
|
-
ReactReconciler.performUpdateIfNecessary(
|
|
152
|
-
component,
|
|
153
|
-
transaction.reconcileTransaction
|
|
154
|
-
);
|
|
131
|
+
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
|
|
155
132
|
|
|
156
133
|
if (callbacks) {
|
|
157
134
|
for (var j = 0; j < callbacks.length; j++) {
|
|
158
|
-
transaction.callbackQueue.enqueue(
|
|
159
|
-
callbacks[j],
|
|
160
|
-
component.getPublicInstance()
|
|
161
|
-
);
|
|
135
|
+
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
|
|
162
136
|
}
|
|
163
137
|
}
|
|
164
138
|
}
|
|
165
139
|
}
|
|
166
140
|
|
|
167
|
-
var flushBatchedUpdates = function() {
|
|
141
|
+
var flushBatchedUpdates = function () {
|
|
168
142
|
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
|
|
169
143
|
// array and perform any updates enqueued by mount-ready handlers (i.e.,
|
|
170
144
|
// componentDidUpdate) but we need to check here too in order to catch
|
|
@@ -185,11 +159,7 @@ var flushBatchedUpdates = function() {
|
|
|
185
159
|
}
|
|
186
160
|
}
|
|
187
161
|
};
|
|
188
|
-
flushBatchedUpdates = ReactPerf.measure(
|
|
189
|
-
'ReactUpdates',
|
|
190
|
-
'flushBatchedUpdates',
|
|
191
|
-
flushBatchedUpdates
|
|
192
|
-
);
|
|
162
|
+
flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
|
|
193
163
|
|
|
194
164
|
/**
|
|
195
165
|
* Mark a component as needing a rerender, adding an optional callback to a
|
|
@@ -203,13 +173,7 @@ function enqueueUpdate(component) {
|
|
|
203
173
|
// verify that that's the case. (This is called by each top-level update
|
|
204
174
|
// function, like setProps, setState, forceUpdate, etc.; creation and
|
|
205
175
|
// destruction of top-level components is guarded in ReactMount.)
|
|
206
|
-
|
|
207
|
-
ReactCurrentOwner.current == null,
|
|
208
|
-
'enqueueUpdate(): Render methods should be a pure function of props ' +
|
|
209
|
-
'and state; triggering nested component updates from render is not ' +
|
|
210
|
-
'allowed. If necessary, trigger nested updates in ' +
|
|
211
|
-
'componentDidUpdate.'
|
|
212
|
-
) : null);
|
|
176
|
+
'production' !== process.env.NODE_ENV ? warning(ReactCurrentOwner.current == null, 'enqueueUpdate(): Render methods should be a pure function of props ' + 'and state; triggering nested component updates from render is not ' + 'allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate.') : null;
|
|
213
177
|
|
|
214
178
|
if (!batchingStrategy.isBatchingUpdates) {
|
|
215
179
|
batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
|
@@ -224,37 +188,21 @@ function enqueueUpdate(component) {
|
|
|
224
188
|
* if no updates are currently being performed.
|
|
225
189
|
*/
|
|
226
190
|
function asap(callback, context) {
|
|
227
|
-
|
|
228
|
-
batchingStrategy.isBatchingUpdates,
|
|
229
|
-
'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' +
|
|
230
|
-
'updates are not being batched.'
|
|
231
|
-
) : invariant(batchingStrategy.isBatchingUpdates));
|
|
191
|
+
'production' !== process.env.NODE_ENV ? invariant(batchingStrategy.isBatchingUpdates, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(batchingStrategy.isBatchingUpdates);
|
|
232
192
|
asapCallbackQueue.enqueue(callback, context);
|
|
233
193
|
asapEnqueued = true;
|
|
234
194
|
}
|
|
235
195
|
|
|
236
196
|
var ReactUpdatesInjection = {
|
|
237
|
-
injectReconcileTransaction: function(ReconcileTransaction) {
|
|
238
|
-
|
|
239
|
-
ReconcileTransaction,
|
|
240
|
-
'ReactUpdates: must provide a reconcile transaction class'
|
|
241
|
-
) : invariant(ReconcileTransaction));
|
|
197
|
+
injectReconcileTransaction: function (ReconcileTransaction) {
|
|
198
|
+
'production' !== process.env.NODE_ENV ? invariant(ReconcileTransaction, 'ReactUpdates: must provide a reconcile transaction class') : invariant(ReconcileTransaction);
|
|
242
199
|
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
|
243
200
|
},
|
|
244
201
|
|
|
245
|
-
injectBatchingStrategy: function(_batchingStrategy) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
) : invariant(_batchingStrategy));
|
|
250
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
251
|
-
typeof _batchingStrategy.batchedUpdates === 'function',
|
|
252
|
-
'ReactUpdates: must provide a batchedUpdates() function'
|
|
253
|
-
) : invariant(typeof _batchingStrategy.batchedUpdates === 'function'));
|
|
254
|
-
("production" !== process.env.NODE_ENV ? invariant(
|
|
255
|
-
typeof _batchingStrategy.isBatchingUpdates === 'boolean',
|
|
256
|
-
'ReactUpdates: must provide an isBatchingUpdates boolean attribute'
|
|
257
|
-
) : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean'));
|
|
202
|
+
injectBatchingStrategy: function (_batchingStrategy) {
|
|
203
|
+
'production' !== process.env.NODE_ENV ? invariant(_batchingStrategy, 'ReactUpdates: must provide a batching strategy') : invariant(_batchingStrategy);
|
|
204
|
+
'production' !== process.env.NODE_ENV ? invariant(typeof _batchingStrategy.batchedUpdates === 'function', 'ReactUpdates: must provide a batchedUpdates() function') : invariant(typeof _batchingStrategy.batchedUpdates === 'function');
|
|
205
|
+
'production' !== process.env.NODE_ENV ? invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean', 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(typeof _batchingStrategy.isBatchingUpdates === 'boolean');
|
|
258
206
|
batchingStrategy = _batchingStrategy;
|
|
259
207
|
}
|
|
260
208
|
};
|
|
@@ -275,4 +223,4 @@ var ReactUpdates = {
|
|
|
275
223
|
asap: asap
|
|
276
224
|
};
|
|
277
225
|
|
|
278
|
-
module.exports = ReactUpdates;
|
|
226
|
+
module.exports = ReactUpdates;
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
|
|
21
21
|
var LinkedStateMixin = require("./LinkedStateMixin");
|
|
22
22
|
var React = require("./React");
|
|
23
|
-
var ReactComponentWithPureRenderMixin =
|
|
24
|
-
require("./ReactComponentWithPureRenderMixin");
|
|
23
|
+
var ReactComponentWithPureRenderMixin = require("./ReactComponentWithPureRenderMixin");
|
|
25
24
|
var ReactCSSTransitionGroup = require("./ReactCSSTransitionGroup");
|
|
26
25
|
var ReactFragment = require("./ReactFragment");
|
|
27
26
|
var ReactTransitionGroup = require("./ReactTransitionGroup");
|
|
28
27
|
var ReactUpdates = require("./ReactUpdates");
|
|
29
28
|
|
|
30
|
-
var cx = require("./cx");
|
|
31
29
|
var cloneWithProps = require("./cloneWithProps");
|
|
30
|
+
var renderSubtreeIntoContainer = require("./renderSubtreeIntoContainer");
|
|
31
|
+
var shallowCompare = require("./shallowCompare");
|
|
32
32
|
var update = require("./update");
|
|
33
33
|
|
|
34
34
|
React.addons = {
|
|
@@ -38,15 +38,16 @@ React.addons = {
|
|
|
38
38
|
TransitionGroup: ReactTransitionGroup,
|
|
39
39
|
|
|
40
40
|
batchedUpdates: ReactUpdates.batchedUpdates,
|
|
41
|
-
classSet: cx,
|
|
42
41
|
cloneWithProps: cloneWithProps,
|
|
43
42
|
createFragment: ReactFragment.create,
|
|
43
|
+
renderSubtreeIntoContainer: renderSubtreeIntoContainer,
|
|
44
|
+
shallowCompare: shallowCompare,
|
|
44
45
|
update: update
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
if (
|
|
48
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
48
49
|
React.addons.Perf = require("./ReactDefaultPerf");
|
|
49
50
|
React.addons.TestUtils = require("./ReactTestUtils");
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
module.exports = React;
|
|
53
|
+
module.exports = React;
|
|
@@ -9,16 +9,20 @@
|
|
|
9
9
|
* @providesModule SVGDOMPropertyConfig
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
/*jslint bitwise: true*/
|
|
13
|
-
|
|
14
12
|
'use strict';
|
|
15
13
|
|
|
16
14
|
var DOMProperty = require("./DOMProperty");
|
|
17
15
|
|
|
18
16
|
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
|
19
17
|
|
|
18
|
+
var NS = {
|
|
19
|
+
xlink: 'http://www.w3.org/1999/xlink',
|
|
20
|
+
xml: 'http://www.w3.org/XML/1998/namespace'
|
|
21
|
+
};
|
|
22
|
+
|
|
20
23
|
var SVGDOMPropertyConfig = {
|
|
21
24
|
Properties: {
|
|
25
|
+
clipPath: MUST_USE_ATTRIBUTE,
|
|
22
26
|
cx: MUST_USE_ATTRIBUTE,
|
|
23
27
|
cy: MUST_USE_ATTRIBUTE,
|
|
24
28
|
d: MUST_USE_ATTRIBUTE,
|
|
@@ -59,11 +63,34 @@ var SVGDOMPropertyConfig = {
|
|
|
59
63
|
x1: MUST_USE_ATTRIBUTE,
|
|
60
64
|
x2: MUST_USE_ATTRIBUTE,
|
|
61
65
|
x: MUST_USE_ATTRIBUTE,
|
|
66
|
+
xlinkActuate: MUST_USE_ATTRIBUTE,
|
|
67
|
+
xlinkArcrole: MUST_USE_ATTRIBUTE,
|
|
68
|
+
xlinkHref: MUST_USE_ATTRIBUTE,
|
|
69
|
+
xlinkRole: MUST_USE_ATTRIBUTE,
|
|
70
|
+
xlinkShow: MUST_USE_ATTRIBUTE,
|
|
71
|
+
xlinkTitle: MUST_USE_ATTRIBUTE,
|
|
72
|
+
xlinkType: MUST_USE_ATTRIBUTE,
|
|
73
|
+
xmlBase: MUST_USE_ATTRIBUTE,
|
|
74
|
+
xmlLang: MUST_USE_ATTRIBUTE,
|
|
75
|
+
xmlSpace: MUST_USE_ATTRIBUTE,
|
|
62
76
|
y1: MUST_USE_ATTRIBUTE,
|
|
63
77
|
y2: MUST_USE_ATTRIBUTE,
|
|
64
78
|
y: MUST_USE_ATTRIBUTE
|
|
65
79
|
},
|
|
80
|
+
DOMAttributeNamespaces: {
|
|
81
|
+
xlinkActuate: NS.xlink,
|
|
82
|
+
xlinkArcrole: NS.xlink,
|
|
83
|
+
xlinkHref: NS.xlink,
|
|
84
|
+
xlinkRole: NS.xlink,
|
|
85
|
+
xlinkShow: NS.xlink,
|
|
86
|
+
xlinkTitle: NS.xlink,
|
|
87
|
+
xlinkType: NS.xlink,
|
|
88
|
+
xmlBase: NS.xml,
|
|
89
|
+
xmlLang: NS.xml,
|
|
90
|
+
xmlSpace: NS.xml
|
|
91
|
+
},
|
|
66
92
|
DOMAttributeNames: {
|
|
93
|
+
clipPath: 'clip-path',
|
|
67
94
|
fillOpacity: 'fill-opacity',
|
|
68
95
|
fontFamily: 'font-family',
|
|
69
96
|
fontSize: 'font-size',
|
|
@@ -83,8 +110,18 @@ var SVGDOMPropertyConfig = {
|
|
|
83
110
|
strokeOpacity: 'stroke-opacity',
|
|
84
111
|
strokeWidth: 'stroke-width',
|
|
85
112
|
textAnchor: 'text-anchor',
|
|
86
|
-
viewBox: 'viewBox'
|
|
113
|
+
viewBox: 'viewBox',
|
|
114
|
+
xlinkActuate: 'xlink:actuate',
|
|
115
|
+
xlinkArcrole: 'xlink:arcrole',
|
|
116
|
+
xlinkHref: 'xlink:href',
|
|
117
|
+
xlinkRole: 'xlink:role',
|
|
118
|
+
xlinkShow: 'xlink:show',
|
|
119
|
+
xlinkTitle: 'xlink:title',
|
|
120
|
+
xlinkType: 'xlink:type',
|
|
121
|
+
xmlBase: 'xml:base',
|
|
122
|
+
xmlLang: 'xml:lang',
|
|
123
|
+
xmlSpace: 'xml:space'
|
|
87
124
|
}
|
|
88
125
|
};
|
|
89
126
|
|
|
90
|
-
module.exports = SVGDOMPropertyConfig;
|
|
127
|
+
module.exports = SVGDOMPropertyConfig;
|
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -26,18 +26,10 @@ var topLevelTypes = EventConstants.topLevelTypes;
|
|
|
26
26
|
var eventTypes = {
|
|
27
27
|
select: {
|
|
28
28
|
phasedRegistrationNames: {
|
|
29
|
-
bubbled: keyOf({onSelect: null}),
|
|
30
|
-
captured: keyOf({onSelectCapture: null})
|
|
29
|
+
bubbled: keyOf({ onSelect: null }),
|
|
30
|
+
captured: keyOf({ onSelectCapture: null })
|
|
31
31
|
},
|
|
32
|
-
dependencies: [
|
|
33
|
-
topLevelTypes.topBlur,
|
|
34
|
-
topLevelTypes.topContextMenu,
|
|
35
|
-
topLevelTypes.topFocus,
|
|
36
|
-
topLevelTypes.topKeyDown,
|
|
37
|
-
topLevelTypes.topMouseDown,
|
|
38
|
-
topLevelTypes.topMouseUp,
|
|
39
|
-
topLevelTypes.topSelectionChange
|
|
40
|
-
]
|
|
32
|
+
dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
35
|
|
|
@@ -46,6 +38,11 @@ var activeElementID = null;
|
|
|
46
38
|
var lastSelection = null;
|
|
47
39
|
var mouseDown = false;
|
|
48
40
|
|
|
41
|
+
// Track whether a listener exists for this plugin. If none exist, we do
|
|
42
|
+
// not extract events.
|
|
43
|
+
var hasListener = false;
|
|
44
|
+
var ON_SELECT_KEY = keyOf({ onSelect: null });
|
|
45
|
+
|
|
49
46
|
/**
|
|
50
47
|
* Get an object which is a unique representation of the current selection.
|
|
51
48
|
*
|
|
@@ -56,8 +53,7 @@ var mouseDown = false;
|
|
|
56
53
|
* @param {object}
|
|
57
54
|
*/
|
|
58
55
|
function getSelection(node) {
|
|
59
|
-
if ('selectionStart' in node &&
|
|
60
|
-
ReactInputSelection.hasSelectionCapabilities(node)) {
|
|
56
|
+
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
|
|
61
57
|
return {
|
|
62
58
|
start: node.selectionStart,
|
|
63
59
|
end: node.selectionEnd
|
|
@@ -92,9 +88,7 @@ function constructSelectEvent(nativeEvent) {
|
|
|
92
88
|
// selection (this matches native `select` event behavior). In HTML5, select
|
|
93
89
|
// fires only on input and textarea thus if there's no focused element we
|
|
94
90
|
// won't dispatch.
|
|
95
|
-
if (mouseDown ||
|
|
96
|
-
activeElement == null ||
|
|
97
|
-
activeElement !== getActiveElement()) {
|
|
91
|
+
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
|
|
98
92
|
return null;
|
|
99
93
|
}
|
|
100
94
|
|
|
@@ -103,11 +97,7 @@ function constructSelectEvent(nativeEvent) {
|
|
|
103
97
|
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
104
98
|
lastSelection = currentSelection;
|
|
105
99
|
|
|
106
|
-
var syntheticEvent = SyntheticEvent.getPooled(
|
|
107
|
-
eventTypes.select,
|
|
108
|
-
activeElementID,
|
|
109
|
-
nativeEvent
|
|
110
|
-
);
|
|
100
|
+
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent);
|
|
111
101
|
|
|
112
102
|
syntheticEvent.type = 'select';
|
|
113
103
|
syntheticEvent.target = activeElement;
|
|
@@ -116,6 +106,8 @@ function constructSelectEvent(nativeEvent) {
|
|
|
116
106
|
|
|
117
107
|
return syntheticEvent;
|
|
118
108
|
}
|
|
109
|
+
|
|
110
|
+
return null;
|
|
119
111
|
}
|
|
120
112
|
|
|
121
113
|
/**
|
|
@@ -144,17 +136,16 @@ var SelectEventPlugin = {
|
|
|
144
136
|
* @return {*} An accumulation of synthetic events.
|
|
145
137
|
* @see {EventPluginHub.extractEvents}
|
|
146
138
|
*/
|
|
147
|
-
extractEvents: function(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
139
|
+
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent) {
|
|
140
|
+
|
|
141
|
+
if (!hasListener) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
152
144
|
|
|
153
145
|
switch (topLevelType) {
|
|
154
146
|
// Track the input node that has focus.
|
|
155
147
|
case topLevelTypes.topFocus:
|
|
156
|
-
if (isTextInputElement(topLevelTarget) ||
|
|
157
|
-
topLevelTarget.contentEditable === 'true') {
|
|
148
|
+
if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
|
|
158
149
|
activeElement = topLevelTarget;
|
|
159
150
|
activeElementID = topLevelTargetID;
|
|
160
151
|
lastSelection = null;
|
|
@@ -187,7 +178,15 @@ var SelectEventPlugin = {
|
|
|
187
178
|
case topLevelTypes.topKeyUp:
|
|
188
179
|
return constructSelectEvent(nativeEvent);
|
|
189
180
|
}
|
|
181
|
+
|
|
182
|
+
return null;
|
|
183
|
+
},
|
|
184
|
+
|
|
185
|
+
didPutListener: function (id, registrationName, listener) {
|
|
186
|
+
if (registrationName === ON_SELECT_KEY) {
|
|
187
|
+
hasListener = true;
|
|
188
|
+
}
|
|
190
189
|
}
|
|
191
190
|
};
|
|
192
191
|
|
|
193
|
-
module.exports = SelectEventPlugin;
|
|
192
|
+
module.exports = SelectEventPlugin;
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
|
|
22
22
|
|
|
23
23
|
var ServerReactRootIndex = {
|
|
24
|
-
createReactRootIndex: function() {
|
|
24
|
+
createReactRootIndex: function () {
|
|
25
25
|
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
module.exports = ServerReactRootIndex;
|
|
29
|
+
module.exports = ServerReactRootIndex;
|