react 15.3.2 → 15.4.0-rc.4
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/react-with-addons.js +3864 -21390
- package/dist/react-with-addons.min.js +3 -6
- package/dist/react.js +2639 -19486
- package/dist/react.min.js +2 -6
- package/lib/KeyEscapeUtils.js +0 -1
- package/lib/LinkedStateMixin.js +1 -3
- package/lib/PooledClass.js +3 -1
- package/lib/React.js +0 -1
- package/lib/ReactAddonsDOMDependencies.js +35 -0
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
- package/lib/ReactCSSTransitionGroup.js +60 -43
- package/lib/ReactCSSTransitionGroupChild.js +2 -3
- package/lib/ReactChildren.js +0 -1
- package/lib/ReactClass.js +38 -54
- package/lib/ReactComponent.js +0 -1
- package/lib/ReactComponentTreeDevtool.js +0 -1
- package/lib/ReactComponentTreeHook.js +84 -101
- package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
- package/lib/ReactComponentWithPureRenderMixin.js +0 -1
- package/lib/ReactCurrentOwner.js +1 -2
- package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
- package/lib/ReactDOMFactories.js +0 -1
- package/lib/ReactElement.js +6 -14
- package/lib/ReactElementSymbol.js +19 -0
- package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
- package/lib/ReactElementValidator.js +1 -3
- package/lib/ReactFragment.js +0 -1
- package/lib/ReactLink.js +0 -1
- package/lib/ReactNoopUpdateQueue.js +0 -1
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +2 -12
- package/lib/ReactPropTypes.js +5 -3
- package/lib/ReactPropTypesSecret.js +1 -1
- package/lib/ReactPureComponent.js +0 -1
- package/lib/ReactStateSetters.js +0 -1
- package/lib/ReactTransitionChildMapping.js +0 -1
- package/lib/ReactTransitionEvents.js +1 -2
- package/lib/ReactTransitionGroup.js +145 -142
- package/lib/ReactUMDEntry.js +11 -6
- package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
- package/lib/ReactVersion.js +1 -2
- package/lib/ReactWithAddons.js +15 -3
- package/lib/ReactWithAddonsUMDEntry.js +11 -6
- package/lib/canDefineProperty.js +2 -1
- package/lib/checkReactTypeSpec.js +0 -1
- package/lib/deprecated.js +0 -1
- package/lib/flattenChildren.js +0 -1
- package/lib/getIteratorFn.js +0 -1
- package/lib/onlyChild.js +0 -1
- package/lib/reactProdInvariant.js +0 -1
- package/lib/shallowCompare.js +1 -2
- package/lib/sliceChildren.js +0 -1
- package/lib/traverseAllChildren.js +11 -3
- package/lib/update.js +6 -8
- package/package.json +1 -1
- package/lib/AutoFocusUtils.js +0 -24
- package/lib/BeforeInputEventPlugin.js +0 -390
- package/lib/CSSProperty.js +0 -148
- package/lib/CSSPropertyOperations.js +0 -205
- package/lib/CallbackQueue.js +0 -106
- package/lib/ChangeEventPlugin.js +0 -325
- package/lib/DOMChildrenOperations.js +0 -194
- package/lib/DOMLazyTree.js +0 -118
- package/lib/DOMProperty.js +0 -206
- package/lib/DOMPropertyOperations.js +0 -221
- package/lib/Danger.js +0 -48
- package/lib/DefaultEventPluginOrder.js +0 -27
- package/lib/DisabledInputUtils.js +0 -50
- package/lib/EnterLeaveEventPlugin.js +0 -105
- package/lib/EventConstants.js +0 -97
- package/lib/EventPluginHub.js +0 -251
- package/lib/EventPluginRegistry.js +0 -247
- package/lib/EventPluginUtils.js +0 -229
- package/lib/EventPropagators.js +0 -137
- package/lib/FallbackCompositionState.js +0 -95
- package/lib/HTMLDOMPropertyConfig.js +0 -212
- package/lib/LinkedValueUtils.js +0 -136
- package/lib/NativeMethodsMixin.js +0 -167
- package/lib/ReactBrowserEventEmitter.js +0 -330
- package/lib/ReactChildReconciler.js +0 -154
- package/lib/ReactChildrenMutationWarningHook.js +0 -54
- package/lib/ReactComponentBrowserEnvironment.js +0 -30
- package/lib/ReactComponentEnvironment.js +0 -45
- package/lib/ReactComponentTreeTestUtils.js +0 -87
- package/lib/ReactCompositeComponent.js +0 -904
- package/lib/ReactDOM.js +0 -110
- package/lib/ReactDOMButton.js +0 -24
- package/lib/ReactDOMComponent.js +0 -1006
- package/lib/ReactDOMComponentTree.js +0 -188
- package/lib/ReactDOMContainerInfo.js +0 -33
- package/lib/ReactDOMEmptyComponent.js +0 -60
- package/lib/ReactDOMFiber.js +0 -76
- package/lib/ReactDOMIDOperations.js +0 -34
- package/lib/ReactDOMInput.js +0 -269
- package/lib/ReactDOMNullInputValuePropHook.js +0 -43
- package/lib/ReactDOMOption.js +0 -123
- package/lib/ReactDOMSelect.js +0 -201
- package/lib/ReactDOMSelection.js +0 -212
- package/lib/ReactDOMServer.js +0 -26
- package/lib/ReactDOMTextComponent.js +0 -164
- package/lib/ReactDOMTextarea.js +0 -155
- package/lib/ReactDOMTreeTraversal.js +0 -136
- package/lib/ReactDOMUnknownPropertyHook.js +0 -112
- package/lib/ReactDebugTool.js +0 -301
- package/lib/ReactDefaultBatchingStrategy.js +0 -68
- package/lib/ReactDefaultInjection.js +0 -84
- package/lib/ReactEmptyComponent.js +0 -30
- package/lib/ReactErrorUtils.js +0 -76
- package/lib/ReactEventEmitterMixin.js +0 -33
- package/lib/ReactEventListener.js +0 -157
- package/lib/ReactFeatureFlags.js +0 -22
- package/lib/ReactHostComponent.js +0 -76
- package/lib/ReactHostOperationHistoryHook.js +0 -37
- package/lib/ReactInjection.js +0 -36
- package/lib/ReactInputSelection.js +0 -124
- package/lib/ReactInstanceHandles.js +0 -302
- package/lib/ReactInstanceMap.js +0 -48
- package/lib/ReactInstrumentation.js +0 -21
- package/lib/ReactInvalidSetStateWarningHook.js +0 -36
- package/lib/ReactMarkupChecksum.js +0 -50
- package/lib/ReactMount.js +0 -534
- package/lib/ReactMultiChild.js +0 -451
- package/lib/ReactMultiChildUpdateTypes.js +0 -32
- package/lib/ReactNative.js +0 -71
- package/lib/ReactNativeAttributePayload.js +0 -371
- package/lib/ReactNativeBaseComponent.js +0 -198
- package/lib/ReactNativeBridgeEventPlugin.js +0 -60
- package/lib/ReactNativeComponentEnvironment.js +0 -31
- package/lib/ReactNativeComponentTree.js +0 -68
- package/lib/ReactNativeContainerInfo.js +0 -21
- package/lib/ReactNativeDOMIDOperations.js +0 -79
- package/lib/ReactNativeDefaultInjection.js +0 -101
- package/lib/ReactNativeEventEmitter.js +0 -191
- package/lib/ReactNativeEventPluginOrder.js +0 -16
- package/lib/ReactNativeGlobalResponderHandler.js +0 -25
- package/lib/ReactNativeMount.js +0 -193
- package/lib/ReactNativePropRegistry.js +0 -52
- package/lib/ReactNativeReconcileTransaction.js +0 -129
- package/lib/ReactNativeTagHandles.js +0 -56
- package/lib/ReactNativeTextComponent.js +0 -71
- package/lib/ReactNativeTreeTraversal.js +0 -127
- package/lib/ReactNodeTypes.js +0 -40
- package/lib/ReactNoop.js +0 -173
- package/lib/ReactOwner.js +0 -94
- package/lib/ReactPerf.js +0 -494
- package/lib/ReactReconcileTransaction.js +0 -178
- package/lib/ReactReconciler.js +0 -168
- package/lib/ReactRef.js +0 -80
- package/lib/ReactServerBatchingStrategy.js +0 -22
- package/lib/ReactServerRendering.js +0 -90
- package/lib/ReactServerRenderingTransaction.js +0 -90
- package/lib/ReactServerUpdateQueue.js +0 -141
- package/lib/ReactSimpleEmptyComponent.js +0 -37
- package/lib/ReactTestMount.js +0 -126
- package/lib/ReactTestReconcileTransaction.js +0 -121
- package/lib/ReactTestRenderer.js +0 -144
- package/lib/ReactTestUtils.js +0 -518
- package/lib/ReactUpdateQueue.js +0 -226
- package/lib/ReactUpdates.js +0 -251
- package/lib/ResponderEventPlugin.js +0 -510
- package/lib/ResponderSyntheticEvent.js +0 -39
- package/lib/ResponderTouchHistoryStore.js +0 -184
- package/lib/SVGDOMPropertyConfig.js +0 -302
- package/lib/SelectEventPlugin.js +0 -196
- package/lib/SimpleEventPlugin.js +0 -635
- package/lib/SyntheticAnimationEvent.js +0 -39
- package/lib/SyntheticClipboardEvent.js +0 -38
- package/lib/SyntheticCompositionEvent.js +0 -36
- package/lib/SyntheticDragEvent.js +0 -36
- package/lib/SyntheticEvent.js +0 -268
- package/lib/SyntheticFocusEvent.js +0 -36
- package/lib/SyntheticInputEvent.js +0 -37
- package/lib/SyntheticKeyboardEvent.js +0 -84
- package/lib/SyntheticMouseEvent.js +0 -72
- package/lib/SyntheticTouchEvent.js +0 -45
- package/lib/SyntheticTransitionEvent.js +0 -39
- package/lib/SyntheticUIEvent.js +0 -59
- package/lib/SyntheticWheelEvent.js +0 -54
- package/lib/TapEventPlugin.js +0 -110
- package/lib/TouchHistoryMath.js +0 -99
- package/lib/Transaction.js +0 -233
- package/lib/ViewportMetrics.js +0 -27
- package/lib/accumulate.js +0 -46
- package/lib/accumulateInto.js +0 -58
- package/lib/adler32.js +0 -44
- package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
- package/lib/createReactNativeComponentClass.js +0 -42
- package/lib/dangerousStyleValue.js +0 -79
- package/lib/escapeTextContentForBrowser.js +0 -123
- package/lib/findDOMNode.js +0 -60
- package/lib/findNodeHandle.js +0 -91
- package/lib/forEachAccumulated.js +0 -31
- package/lib/getEventCharCode.js +0 -50
- package/lib/getEventKey.js +0 -102
- package/lib/getEventModifierState.js +0 -43
- package/lib/getEventTarget.js +0 -35
- package/lib/getHostComponentFromComposite.js +0 -30
- package/lib/getNodeForCharacterOffset.js +0 -74
- package/lib/getTestDocument.js +0 -21
- package/lib/getTextContentAccessor.js +0 -33
- package/lib/getVendorPrefixedEventName.js +0 -101
- package/lib/instantiateReactComponent.js +0 -119
- package/lib/isEventSupported.js +0 -60
- package/lib/isTextInputElement.js +0 -51
- package/lib/quoteAttributeValueForBrowser.js +0 -26
- package/lib/reactComponentExpect.js +0 -217
- package/lib/setInnerHTML.js +0 -98
- package/lib/setTextContent.js +0 -48
- package/lib/shouldUpdateReactComponent.js +0 -42
- package/lib/validateDOMNesting.js +0 -382
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule ReactServerRendering
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
14
|
-
|
|
15
|
-
var ReactDOMContainerInfo = require('./ReactDOMContainerInfo');
|
|
16
|
-
var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
|
|
17
|
-
var ReactElement = require('./ReactElement');
|
|
18
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
19
|
-
var ReactMarkupChecksum = require('./ReactMarkupChecksum');
|
|
20
|
-
var ReactReconciler = require('./ReactReconciler');
|
|
21
|
-
var ReactServerBatchingStrategy = require('./ReactServerBatchingStrategy');
|
|
22
|
-
var ReactServerRenderingTransaction = require('./ReactServerRenderingTransaction');
|
|
23
|
-
var ReactUpdates = require('./ReactUpdates');
|
|
24
|
-
|
|
25
|
-
var emptyObject = require('fbjs/lib/emptyObject');
|
|
26
|
-
var instantiateReactComponent = require('./instantiateReactComponent');
|
|
27
|
-
var invariant = require('fbjs/lib/invariant');
|
|
28
|
-
|
|
29
|
-
var pendingTransactions = 0;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @param {ReactElement} element
|
|
33
|
-
* @return {string} the HTML markup
|
|
34
|
-
*/
|
|
35
|
-
function renderToStringImpl(element, makeStaticMarkup) {
|
|
36
|
-
var transaction;
|
|
37
|
-
try {
|
|
38
|
-
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
|
39
|
-
|
|
40
|
-
transaction = ReactServerRenderingTransaction.getPooled(makeStaticMarkup);
|
|
41
|
-
|
|
42
|
-
pendingTransactions++;
|
|
43
|
-
|
|
44
|
-
return transaction.perform(function () {
|
|
45
|
-
var componentInstance = instantiateReactComponent(element, true);
|
|
46
|
-
var markup = ReactReconciler.mountComponent(componentInstance, transaction, null, ReactDOMContainerInfo(), emptyObject, 0 /* parentDebugID */
|
|
47
|
-
);
|
|
48
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
49
|
-
ReactInstrumentation.debugTool.onUnmountComponent(componentInstance._debugID);
|
|
50
|
-
}
|
|
51
|
-
if (!makeStaticMarkup) {
|
|
52
|
-
markup = ReactMarkupChecksum.addChecksumToMarkup(markup);
|
|
53
|
-
}
|
|
54
|
-
return markup;
|
|
55
|
-
}, null);
|
|
56
|
-
} finally {
|
|
57
|
-
pendingTransactions--;
|
|
58
|
-
ReactServerRenderingTransaction.release(transaction);
|
|
59
|
-
// Revert to the DOM batching strategy since these two renderers
|
|
60
|
-
// currently share these stateful modules.
|
|
61
|
-
if (!pendingTransactions) {
|
|
62
|
-
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Render a ReactElement to its initial HTML. This should only be used on the
|
|
69
|
-
* server.
|
|
70
|
-
* See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostring
|
|
71
|
-
*/
|
|
72
|
-
function renderToString(element) {
|
|
73
|
-
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : _prodInvariant('46') : void 0;
|
|
74
|
-
return renderToStringImpl(element, false);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Similar to renderToString, except this doesn't create extra DOM attributes
|
|
79
|
-
* such as data-react-id that React uses internally.
|
|
80
|
-
* See https://facebook.github.io/react/docs/top-level-api.html#reactdomserver.rendertostaticmarkup
|
|
81
|
-
*/
|
|
82
|
-
function renderToStaticMarkup(element) {
|
|
83
|
-
!ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : _prodInvariant('47') : void 0;
|
|
84
|
-
return renderToStringImpl(element, true);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
module.exports = {
|
|
88
|
-
renderToString: renderToString,
|
|
89
|
-
renderToStaticMarkup: renderToStaticMarkup
|
|
90
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule ReactServerRenderingTransaction
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var _assign = require('object-assign');
|
|
15
|
-
|
|
16
|
-
var PooledClass = require('./PooledClass');
|
|
17
|
-
var Transaction = require('./Transaction');
|
|
18
|
-
var ReactInstrumentation = require('./ReactInstrumentation');
|
|
19
|
-
var ReactServerUpdateQueue = require('./ReactServerUpdateQueue');
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Executed within the scope of the `Transaction` instance. Consider these as
|
|
23
|
-
* being member methods, but with an implied ordering while being isolated from
|
|
24
|
-
* each other.
|
|
25
|
-
*/
|
|
26
|
-
var TRANSACTION_WRAPPERS = [];
|
|
27
|
-
|
|
28
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
-
TRANSACTION_WRAPPERS.push({
|
|
30
|
-
initialize: ReactInstrumentation.debugTool.onBeginFlush,
|
|
31
|
-
close: ReactInstrumentation.debugTool.onEndFlush
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
var noopCallbackQueue = {
|
|
36
|
-
enqueue: function () {}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @class ReactServerRenderingTransaction
|
|
41
|
-
* @param {boolean} renderToStaticMarkup
|
|
42
|
-
*/
|
|
43
|
-
function ReactServerRenderingTransaction(renderToStaticMarkup) {
|
|
44
|
-
this.reinitializeTransaction();
|
|
45
|
-
this.renderToStaticMarkup = renderToStaticMarkup;
|
|
46
|
-
this.useCreateElement = false;
|
|
47
|
-
this.updateQueue = new ReactServerUpdateQueue(this);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
var Mixin = {
|
|
51
|
-
/**
|
|
52
|
-
* @see Transaction
|
|
53
|
-
* @abstract
|
|
54
|
-
* @final
|
|
55
|
-
* @return {array} Empty list of operation wrap procedures.
|
|
56
|
-
*/
|
|
57
|
-
getTransactionWrappers: function () {
|
|
58
|
-
return TRANSACTION_WRAPPERS;
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @return {object} The queue to collect `onDOMReady` callbacks with.
|
|
63
|
-
*/
|
|
64
|
-
getReactMountReady: function () {
|
|
65
|
-
return noopCallbackQueue;
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @return {object} The queue to collect React async events.
|
|
70
|
-
*/
|
|
71
|
-
getUpdateQueue: function () {
|
|
72
|
-
return this.updateQueue;
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* `PooledClass` looks for this, and will invoke this before allowing this
|
|
77
|
-
* instance to be reused.
|
|
78
|
-
*/
|
|
79
|
-
destructor: function () {},
|
|
80
|
-
|
|
81
|
-
checkpoint: function () {},
|
|
82
|
-
|
|
83
|
-
rollback: function () {}
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
_assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
|
|
87
|
-
|
|
88
|
-
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
|
|
89
|
-
|
|
90
|
-
module.exports = ReactServerRenderingTransaction;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule ReactServerUpdateQueue
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
|
|
17
|
-
var ReactUpdateQueue = require('./ReactUpdateQueue');
|
|
18
|
-
var Transaction = require('./Transaction');
|
|
19
|
-
var warning = require('fbjs/lib/warning');
|
|
20
|
-
|
|
21
|
-
function warnNoop(publicInstance, callerName) {
|
|
22
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
23
|
-
var constructor = publicInstance.constructor;
|
|
24
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounting component. ' + 'This usually means you called %s() outside componentWillMount() on the server. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* This is the update queue used for server rendering.
|
|
30
|
-
* It delegates to ReactUpdateQueue while server rendering is in progress and
|
|
31
|
-
* switches to ReactNoopUpdateQueue after the transaction has completed.
|
|
32
|
-
* @class ReactServerUpdateQueue
|
|
33
|
-
* @param {Transaction} transaction
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
var ReactServerUpdateQueue = function () {
|
|
37
|
-
/* :: transaction: Transaction; */
|
|
38
|
-
|
|
39
|
-
function ReactServerUpdateQueue(transaction) {
|
|
40
|
-
_classCallCheck(this, ReactServerUpdateQueue);
|
|
41
|
-
|
|
42
|
-
this.transaction = transaction;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Checks whether or not this composite component is mounted.
|
|
47
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
48
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
49
|
-
* @protected
|
|
50
|
-
* @final
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
ReactServerUpdateQueue.prototype.isMounted = function isMounted(publicInstance) {
|
|
55
|
-
return false;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Enqueue a callback that will be executed after all the pending updates
|
|
60
|
-
* have processed.
|
|
61
|
-
*
|
|
62
|
-
* @param {ReactClass} publicInstance The instance to use as `this` context.
|
|
63
|
-
* @param {?function} callback Called after state is updated.
|
|
64
|
-
* @internal
|
|
65
|
-
*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
ReactServerUpdateQueue.prototype.enqueueCallback = function enqueueCallback(publicInstance, callback, callerName) {
|
|
69
|
-
if (this.transaction.isInTransaction()) {
|
|
70
|
-
ReactUpdateQueue.enqueueCallback(publicInstance, callback, callerName);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Forces an update. This should only be invoked when it is known with
|
|
76
|
-
* certainty that we are **not** in a DOM transaction.
|
|
77
|
-
*
|
|
78
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
79
|
-
* component's state has changed but `setState` was not called.
|
|
80
|
-
*
|
|
81
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
82
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
83
|
-
*
|
|
84
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
85
|
-
* @internal
|
|
86
|
-
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
ReactServerUpdateQueue.prototype.enqueueForceUpdate = function enqueueForceUpdate(publicInstance) {
|
|
90
|
-
if (this.transaction.isInTransaction()) {
|
|
91
|
-
ReactUpdateQueue.enqueueForceUpdate(publicInstance);
|
|
92
|
-
} else {
|
|
93
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
99
|
-
* You should treat `this.state` as immutable.
|
|
100
|
-
*
|
|
101
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
102
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
103
|
-
*
|
|
104
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
105
|
-
* @param {object|function} completeState Next state.
|
|
106
|
-
* @internal
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
ReactServerUpdateQueue.prototype.enqueueReplaceState = function enqueueReplaceState(publicInstance, completeState) {
|
|
111
|
-
if (this.transaction.isInTransaction()) {
|
|
112
|
-
ReactUpdateQueue.enqueueReplaceState(publicInstance, completeState);
|
|
113
|
-
} else {
|
|
114
|
-
warnNoop(publicInstance, 'replaceState');
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
120
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
121
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
122
|
-
* during the merge.
|
|
123
|
-
*
|
|
124
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
125
|
-
* @param {object|function} partialState Next partial state to be merged with state.
|
|
126
|
-
* @internal
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
ReactServerUpdateQueue.prototype.enqueueSetState = function enqueueSetState(publicInstance, partialState) {
|
|
131
|
-
if (this.transaction.isInTransaction()) {
|
|
132
|
-
ReactUpdateQueue.enqueueSetState(publicInstance, partialState);
|
|
133
|
-
} else {
|
|
134
|
-
warnNoop(publicInstance, 'setState');
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return ReactServerUpdateQueue;
|
|
139
|
-
}();
|
|
140
|
-
|
|
141
|
-
module.exports = ReactServerUpdateQueue;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule ReactSimpleEmptyComponent
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var _assign = require('object-assign');
|
|
15
|
-
|
|
16
|
-
var ReactReconciler = require('./ReactReconciler');
|
|
17
|
-
|
|
18
|
-
var ReactSimpleEmptyComponent = function (placeholderElement, instantiate) {
|
|
19
|
-
this._currentElement = null;
|
|
20
|
-
this._renderedComponent = instantiate(placeholderElement);
|
|
21
|
-
};
|
|
22
|
-
_assign(ReactSimpleEmptyComponent.prototype, {
|
|
23
|
-
mountComponent: function (transaction, hostParent, hostContainerInfo, context, parentDebugID // 0 in production and for roots
|
|
24
|
-
) {
|
|
25
|
-
return ReactReconciler.mountComponent(this._renderedComponent, transaction, hostParent, hostContainerInfo, context, parentDebugID);
|
|
26
|
-
},
|
|
27
|
-
receiveComponent: function () {},
|
|
28
|
-
getHostNode: function () {
|
|
29
|
-
return ReactReconciler.getHostNode(this._renderedComponent);
|
|
30
|
-
},
|
|
31
|
-
unmountComponent: function () {
|
|
32
|
-
ReactReconciler.unmountComponent(this._renderedComponent);
|
|
33
|
-
this._renderedComponent = null;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
module.exports = ReactSimpleEmptyComponent;
|
package/lib/ReactTestMount.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule ReactTestMount
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
-
|
|
16
|
-
var ReactElement = require('./ReactElement');
|
|
17
|
-
var ReactReconciler = require('./ReactReconciler');
|
|
18
|
-
var ReactUpdates = require('./ReactUpdates');
|
|
19
|
-
|
|
20
|
-
var emptyObject = require('fbjs/lib/emptyObject');
|
|
21
|
-
var getHostComponentFromComposite = require('./getHostComponentFromComposite');
|
|
22
|
-
var instantiateReactComponent = require('./instantiateReactComponent');
|
|
23
|
-
var invariant = require('fbjs/lib/invariant');
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Temporary (?) hack so that we can store all top-level pending updates on
|
|
27
|
-
* composites instead of having to worry about different types of components
|
|
28
|
-
* here.
|
|
29
|
-
*/
|
|
30
|
-
var TopLevelWrapper = function () {};
|
|
31
|
-
TopLevelWrapper.prototype.isReactComponent = {};
|
|
32
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
33
|
-
TopLevelWrapper.displayName = 'TopLevelWrapper';
|
|
34
|
-
}
|
|
35
|
-
TopLevelWrapper.prototype.render = function () {
|
|
36
|
-
// this.props is actually a ReactElement
|
|
37
|
-
return this.props;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Mounts this component and inserts it into the DOM.
|
|
42
|
-
*
|
|
43
|
-
* @param {ReactComponent} componentInstance The instance to mount.
|
|
44
|
-
* @param {number} rootID ID of the root node.
|
|
45
|
-
* @param {number} containerTag container element to mount into.
|
|
46
|
-
* @param {ReactReconcileTransaction} transaction
|
|
47
|
-
*/
|
|
48
|
-
function mountComponentIntoNode(componentInstance, transaction) {
|
|
49
|
-
var image = ReactReconciler.mountComponent(componentInstance, transaction, null, null, emptyObject);
|
|
50
|
-
componentInstance._renderedComponent._topLevelWrapper = componentInstance;
|
|
51
|
-
return image;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Batched mount.
|
|
56
|
-
*
|
|
57
|
-
* @param {ReactComponent} componentInstance The instance to mount.
|
|
58
|
-
* @param {number} rootID ID of the root node.
|
|
59
|
-
* @param {number} containerTag container element to mount into.
|
|
60
|
-
*/
|
|
61
|
-
function batchedMountComponentIntoNode(componentInstance) {
|
|
62
|
-
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled();
|
|
63
|
-
var image = transaction.perform(mountComponentIntoNode, null, componentInstance, transaction);
|
|
64
|
-
ReactUpdates.ReactReconcileTransaction.release(transaction);
|
|
65
|
-
return image;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var ReactTestInstance = function (component) {
|
|
69
|
-
this._component = component;
|
|
70
|
-
};
|
|
71
|
-
ReactTestInstance.prototype.getInstance = function () {
|
|
72
|
-
return this._component._renderedComponent.getPublicInstance();
|
|
73
|
-
};
|
|
74
|
-
ReactTestInstance.prototype.update = function (nextElement) {
|
|
75
|
-
!this._component ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactTestRenderer: .update() can\'t be called after unmount.') : _prodInvariant('139') : void 0;
|
|
76
|
-
var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
|
|
77
|
-
var component = this._component;
|
|
78
|
-
ReactUpdates.batchedUpdates(function () {
|
|
79
|
-
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
|
|
80
|
-
transaction.perform(function () {
|
|
81
|
-
ReactReconciler.receiveComponent(component, nextWrappedElement, transaction, emptyObject);
|
|
82
|
-
});
|
|
83
|
-
ReactUpdates.ReactReconcileTransaction.release(transaction);
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
ReactTestInstance.prototype.unmount = function (nextElement) {
|
|
87
|
-
var component = this._component;
|
|
88
|
-
ReactUpdates.batchedUpdates(function () {
|
|
89
|
-
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
|
|
90
|
-
transaction.perform(function () {
|
|
91
|
-
ReactReconciler.unmountComponent(component, false);
|
|
92
|
-
});
|
|
93
|
-
ReactUpdates.ReactReconcileTransaction.release(transaction);
|
|
94
|
-
});
|
|
95
|
-
this._component = null;
|
|
96
|
-
};
|
|
97
|
-
ReactTestInstance.prototype.toJSON = function () {
|
|
98
|
-
var inst = getHostComponentFromComposite(this._component);
|
|
99
|
-
if (inst === null) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
return inst.toJSON();
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* As soon as `ReactMount` is refactored to not rely on the DOM, we can share
|
|
107
|
-
* code between the two. For now, we'll hard code the ID logic.
|
|
108
|
-
*/
|
|
109
|
-
var ReactTestMount = {
|
|
110
|
-
|
|
111
|
-
render: function (nextElement) {
|
|
112
|
-
var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
|
|
113
|
-
|
|
114
|
-
var instance = instantiateReactComponent(nextWrappedElement, false);
|
|
115
|
-
|
|
116
|
-
// The initial render is synchronous but any updates that happen during
|
|
117
|
-
// rendering, in componentWillMount or componentDidMount, will be batched
|
|
118
|
-
// according to the current batching strategy.
|
|
119
|
-
|
|
120
|
-
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, instance);
|
|
121
|
-
return new ReactTestInstance(instance);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
module.exports = ReactTestMount;
|