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
package/lib/ReactComponent.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
@@ -49,113 +49,88 @@ typeof Set === 'function' && isNative(Set) &&
|
|
|
49
49
|
// Set.prototype.keys
|
|
50
50
|
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
var
|
|
52
|
+
if (canUseCollections) {
|
|
53
|
+
var itemMap = new Map();
|
|
54
|
+
var rootIDSet = new Set();
|
|
54
55
|
|
|
55
|
-
var
|
|
56
|
-
|
|
56
|
+
var setItem = function (id, item) {
|
|
57
|
+
itemMap.set(id, item);
|
|
58
|
+
};
|
|
59
|
+
var getItem = function (id) {
|
|
60
|
+
return itemMap.get(id);
|
|
61
|
+
};
|
|
62
|
+
var removeItem = function (id) {
|
|
63
|
+
itemMap['delete'](id);
|
|
64
|
+
};
|
|
65
|
+
var getItemIDs = function () {
|
|
66
|
+
return Array.from(itemMap.keys());
|
|
67
|
+
};
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
69
|
+
var addRoot = function (id) {
|
|
70
|
+
rootIDSet.add(id);
|
|
71
|
+
};
|
|
72
|
+
var removeRoot = function (id) {
|
|
73
|
+
rootIDSet['delete'](id);
|
|
74
|
+
};
|
|
75
|
+
var getRootIDs = function () {
|
|
76
|
+
return Array.from(rootIDSet.keys());
|
|
77
|
+
};
|
|
61
78
|
} else {
|
|
62
|
-
itemByKey = {};
|
|
63
|
-
rootByKey = {};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var unmountedIDs = [];
|
|
79
|
+
var itemByKey = {};
|
|
80
|
+
var rootByKey = {};
|
|
67
81
|
|
|
68
|
-
// Use non-numeric keys to prevent V8 performance issues:
|
|
69
|
-
// https://github.com/facebook/react/pull/7232
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
}
|
|
82
|
+
// Use non-numeric keys to prevent V8 performance issues:
|
|
83
|
+
// https://github.com/facebook/react/pull/7232
|
|
84
|
+
var getKeyFromID = function (id) {
|
|
85
|
+
return '.' + id;
|
|
86
|
+
};
|
|
87
|
+
var getIDFromKey = function (key) {
|
|
88
|
+
return parseInt(key.substr(1), 10);
|
|
89
|
+
};
|
|
76
90
|
|
|
77
|
-
function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
91
|
+
var setItem = function (id, item) {
|
|
92
|
+
var key = getKeyFromID(id);
|
|
93
|
+
itemByKey[key] = item;
|
|
94
|
+
};
|
|
95
|
+
var getItem = function (id) {
|
|
81
96
|
var key = getKeyFromID(id);
|
|
82
97
|
return itemByKey[key];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
function remove(id) {
|
|
87
|
-
if (canUseCollections) {
|
|
88
|
-
itemMap['delete'](id);
|
|
89
|
-
} else {
|
|
98
|
+
};
|
|
99
|
+
var removeItem = function (id) {
|
|
90
100
|
var key = getKeyFromID(id);
|
|
91
101
|
delete itemByKey[key];
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
function create(id, element, parentID) {
|
|
96
|
-
var item = {
|
|
97
|
-
element: element,
|
|
98
|
-
parentID: parentID,
|
|
99
|
-
text: null,
|
|
100
|
-
childIDs: [],
|
|
101
|
-
isMounted: false,
|
|
102
|
-
updateCount: 0
|
|
102
|
+
};
|
|
103
|
+
var getItemIDs = function () {
|
|
104
|
+
return Object.keys(itemByKey).map(getIDFromKey);
|
|
103
105
|
};
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
itemMap.set(id, item);
|
|
107
|
-
} else {
|
|
108
|
-
var key = getKeyFromID(id);
|
|
109
|
-
itemByKey[key] = item;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function addRoot(id) {
|
|
114
|
-
if (canUseCollections) {
|
|
115
|
-
rootIDSet.add(id);
|
|
116
|
-
} else {
|
|
107
|
+
var addRoot = function (id) {
|
|
117
108
|
var key = getKeyFromID(id);
|
|
118
109
|
rootByKey[key] = true;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
function removeRoot(id) {
|
|
123
|
-
if (canUseCollections) {
|
|
124
|
-
rootIDSet['delete'](id);
|
|
125
|
-
} else {
|
|
110
|
+
};
|
|
111
|
+
var removeRoot = function (id) {
|
|
126
112
|
var key = getKeyFromID(id);
|
|
127
113
|
delete rootByKey[key];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
function getRegisteredIDs() {
|
|
132
|
-
if (canUseCollections) {
|
|
133
|
-
return Array.from(itemMap.keys());
|
|
134
|
-
} else {
|
|
135
|
-
return Object.keys(itemByKey).map(getIDFromKey);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function getRootIDs() {
|
|
140
|
-
if (canUseCollections) {
|
|
141
|
-
return Array.from(rootIDSet.keys());
|
|
142
|
-
} else {
|
|
114
|
+
};
|
|
115
|
+
var getRootIDs = function () {
|
|
143
116
|
return Object.keys(rootByKey).map(getIDFromKey);
|
|
144
|
-
}
|
|
117
|
+
};
|
|
145
118
|
}
|
|
146
119
|
|
|
120
|
+
var unmountedIDs = [];
|
|
121
|
+
|
|
147
122
|
function purgeDeep(id) {
|
|
148
|
-
var item =
|
|
123
|
+
var item = getItem(id);
|
|
149
124
|
if (item) {
|
|
150
125
|
var childIDs = item.childIDs;
|
|
151
126
|
|
|
152
|
-
|
|
127
|
+
removeItem(id);
|
|
153
128
|
childIDs.forEach(purgeDeep);
|
|
154
129
|
}
|
|
155
130
|
}
|
|
156
131
|
|
|
157
132
|
function describeComponentFrame(name, source, ownerName) {
|
|
158
|
-
return '\n in ' + name + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
133
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
159
134
|
}
|
|
160
135
|
|
|
161
136
|
function getDisplayName(element) {
|
|
@@ -184,12 +159,13 @@ function describeID(id) {
|
|
|
184
159
|
|
|
185
160
|
var ReactComponentTreeHook = {
|
|
186
161
|
onSetChildren: function (id, nextChildIDs) {
|
|
187
|
-
var item =
|
|
162
|
+
var item = getItem(id);
|
|
163
|
+
invariant(item, 'Item must have been set');
|
|
188
164
|
item.childIDs = nextChildIDs;
|
|
189
165
|
|
|
190
166
|
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
191
167
|
var nextChildID = nextChildIDs[i];
|
|
192
|
-
var nextChild =
|
|
168
|
+
var nextChild = getItem(nextChildID);
|
|
193
169
|
!nextChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
|
|
194
170
|
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
|
|
195
171
|
!nextChild.isMounted ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
|
|
@@ -197,16 +173,24 @@ var ReactComponentTreeHook = {
|
|
|
197
173
|
nextChild.parentID = id;
|
|
198
174
|
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
199
175
|
// componentWillMount currently causes not-yet-mounted components to
|
|
200
|
-
// be purged from our tree data so their parent
|
|
176
|
+
// be purged from our tree data so their parent id is missing.
|
|
201
177
|
}
|
|
202
178
|
!(nextChild.parentID === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
|
|
203
179
|
}
|
|
204
180
|
},
|
|
205
181
|
onBeforeMountComponent: function (id, element, parentID) {
|
|
206
|
-
|
|
182
|
+
var item = {
|
|
183
|
+
element: element,
|
|
184
|
+
parentID: parentID,
|
|
185
|
+
text: null,
|
|
186
|
+
childIDs: [],
|
|
187
|
+
isMounted: false,
|
|
188
|
+
updateCount: 0
|
|
189
|
+
};
|
|
190
|
+
setItem(id, item);
|
|
207
191
|
},
|
|
208
192
|
onBeforeUpdateComponent: function (id, element) {
|
|
209
|
-
var item =
|
|
193
|
+
var item = getItem(id);
|
|
210
194
|
if (!item || !item.isMounted) {
|
|
211
195
|
// We may end up here as a result of setState() in componentWillUnmount().
|
|
212
196
|
// In this case, ignore the element.
|
|
@@ -215,7 +199,8 @@ var ReactComponentTreeHook = {
|
|
|
215
199
|
item.element = element;
|
|
216
200
|
},
|
|
217
201
|
onMountComponent: function (id) {
|
|
218
|
-
var item =
|
|
202
|
+
var item = getItem(id);
|
|
203
|
+
invariant(item, 'Item must have been set');
|
|
219
204
|
item.isMounted = true;
|
|
220
205
|
var isRoot = item.parentID === 0;
|
|
221
206
|
if (isRoot) {
|
|
@@ -223,7 +208,7 @@ var ReactComponentTreeHook = {
|
|
|
223
208
|
}
|
|
224
209
|
},
|
|
225
210
|
onUpdateComponent: function (id) {
|
|
226
|
-
var item =
|
|
211
|
+
var item = getItem(id);
|
|
227
212
|
if (!item || !item.isMounted) {
|
|
228
213
|
// We may end up here as a result of setState() in componentWillUnmount().
|
|
229
214
|
// In this case, ignore the element.
|
|
@@ -232,7 +217,7 @@ var ReactComponentTreeHook = {
|
|
|
232
217
|
item.updateCount++;
|
|
233
218
|
},
|
|
234
219
|
onUnmountComponent: function (id) {
|
|
235
|
-
var item =
|
|
220
|
+
var item = getItem(id);
|
|
236
221
|
if (item) {
|
|
237
222
|
// We need to check if it exists.
|
|
238
223
|
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
@@ -260,16 +245,15 @@ var ReactComponentTreeHook = {
|
|
|
260
245
|
unmountedIDs.length = 0;
|
|
261
246
|
},
|
|
262
247
|
isMounted: function (id) {
|
|
263
|
-
var item =
|
|
248
|
+
var item = getItem(id);
|
|
264
249
|
return item ? item.isMounted : false;
|
|
265
250
|
},
|
|
266
251
|
getCurrentStackAddendum: function (topElement) {
|
|
267
252
|
var info = '';
|
|
268
253
|
if (topElement) {
|
|
269
|
-
var
|
|
270
|
-
var name = typeof type === 'function' ? type.displayName || type.name : type;
|
|
254
|
+
var name = getDisplayName(topElement);
|
|
271
255
|
var owner = topElement._owner;
|
|
272
|
-
info += describeComponentFrame(name
|
|
256
|
+
info += describeComponentFrame(name, topElement._source, owner && owner.getName());
|
|
273
257
|
}
|
|
274
258
|
|
|
275
259
|
var currentOwner = ReactCurrentOwner.current;
|
|
@@ -287,7 +271,7 @@ var ReactComponentTreeHook = {
|
|
|
287
271
|
return info;
|
|
288
272
|
},
|
|
289
273
|
getChildIDs: function (id) {
|
|
290
|
-
var item =
|
|
274
|
+
var item = getItem(id);
|
|
291
275
|
return item ? item.childIDs : [];
|
|
292
276
|
},
|
|
293
277
|
getDisplayName: function (id) {
|
|
@@ -298,7 +282,7 @@ var ReactComponentTreeHook = {
|
|
|
298
282
|
return getDisplayName(element);
|
|
299
283
|
},
|
|
300
284
|
getElement: function (id) {
|
|
301
|
-
var item =
|
|
285
|
+
var item = getItem(id);
|
|
302
286
|
return item ? item.element : null;
|
|
303
287
|
},
|
|
304
288
|
getOwnerID: function (id) {
|
|
@@ -309,11 +293,11 @@ var ReactComponentTreeHook = {
|
|
|
309
293
|
return element._owner._debugID;
|
|
310
294
|
},
|
|
311
295
|
getParentID: function (id) {
|
|
312
|
-
var item =
|
|
296
|
+
var item = getItem(id);
|
|
313
297
|
return item ? item.parentID : null;
|
|
314
298
|
},
|
|
315
299
|
getSource: function (id) {
|
|
316
|
-
var item =
|
|
300
|
+
var item = getItem(id);
|
|
317
301
|
var element = item ? item.element : null;
|
|
318
302
|
var source = element != null ? element._source : null;
|
|
319
303
|
return source;
|
|
@@ -329,14 +313,13 @@ var ReactComponentTreeHook = {
|
|
|
329
313
|
}
|
|
330
314
|
},
|
|
331
315
|
getUpdateCount: function (id) {
|
|
332
|
-
var item =
|
|
316
|
+
var item = getItem(id);
|
|
333
317
|
return item ? item.updateCount : 0;
|
|
334
318
|
},
|
|
335
319
|
|
|
336
320
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
getRootIDs: getRootIDs
|
|
321
|
+
getRootIDs: getRootIDs,
|
|
322
|
+
getRegisteredIDs: getItemIDs
|
|
340
323
|
};
|
|
341
324
|
|
|
342
325
|
module.exports = ReactComponentTreeHook;
|
|
@@ -6,15 +6,12 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule DOMNamespaces
|
|
10
9
|
*/
|
|
11
10
|
|
|
11
|
+
/* globals React */
|
|
12
|
+
|
|
12
13
|
'use strict';
|
|
13
14
|
|
|
14
|
-
var
|
|
15
|
-
html: 'http://www.w3.org/1999/xhtml',
|
|
16
|
-
mathml: 'http://www.w3.org/1998/Math/MathML',
|
|
17
|
-
svg: 'http://www.w3.org/2000/svg'
|
|
18
|
-
};
|
|
15
|
+
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
19
16
|
|
|
20
|
-
module.exports =
|
|
17
|
+
module.exports = ReactInternals.ReactComponentTreeHook;
|
package/lib/ReactCurrentOwner.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
* The current owner is the component who should own any components that are
|
|
18
18
|
* currently being constructed.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
20
|
var ReactCurrentOwner = {
|
|
22
21
|
|
|
23
22
|
/**
|
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* globals React */
|
|
11
12
|
|
|
12
13
|
'use strict';
|
|
13
14
|
|
|
14
|
-
var
|
|
15
|
+
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
15
16
|
|
|
16
|
-
module.exports =
|
|
17
|
+
module.exports = ReactInternals.ReactCurrentOwner;
|
package/lib/ReactDOMFactories.js
CHANGED
package/lib/ReactElement.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactElement
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
'use strict';
|
|
@@ -19,9 +18,7 @@ var warning = require('fbjs/lib/warning');
|
|
|
19
18
|
var canDefineProperty = require('./canDefineProperty');
|
|
20
19
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
// nor polyfill, then a plain number is used for performance.
|
|
24
|
-
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
21
|
+
var REACT_ELEMENT_TYPE = require('./ReactElementSymbol');
|
|
25
22
|
|
|
26
23
|
var RESERVED_PROPS = {
|
|
27
24
|
key: true,
|
|
@@ -125,7 +122,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
125
122
|
// This can be replaced with a WeakMap once they are implemented in
|
|
126
123
|
// commonly used development environments.
|
|
127
124
|
element._store = {};
|
|
128
|
-
var shadowChildren = Array.isArray(props.children) ? props.children.slice(0) : props.children;
|
|
129
125
|
|
|
130
126
|
// To make comparing ReactElements easier for testing purposes, we make
|
|
131
127
|
// the validation flag non-enumerable (where possible, which should
|
|
@@ -145,12 +141,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
145
141
|
writable: false,
|
|
146
142
|
value: self
|
|
147
143
|
});
|
|
148
|
-
Object.defineProperty(element, '_shadowChildren', {
|
|
149
|
-
configurable: false,
|
|
150
|
-
enumerable: false,
|
|
151
|
-
writable: false,
|
|
152
|
-
value: shadowChildren
|
|
153
|
-
});
|
|
154
144
|
// Two elements created in two different places should be considered
|
|
155
145
|
// equal for testing purposes and therefore we hide it from enumeration.
|
|
156
146
|
Object.defineProperty(element, '_source', {
|
|
@@ -162,7 +152,6 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
162
152
|
} else {
|
|
163
153
|
element._store.validated = false;
|
|
164
154
|
element._self = self;
|
|
165
|
-
element._shadowChildren = shadowChildren;
|
|
166
155
|
element._source = source;
|
|
167
156
|
}
|
|
168
157
|
if (Object.freeze) {
|
|
@@ -217,6 +206,11 @@ ReactElement.createElement = function (type, config, children) {
|
|
|
217
206
|
for (var i = 0; i < childrenLength; i++) {
|
|
218
207
|
childArray[i] = arguments[i + 2];
|
|
219
208
|
}
|
|
209
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
210
|
+
if (Object.freeze) {
|
|
211
|
+
Object.freeze(childArray);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
220
214
|
props.children = childArray;
|
|
221
215
|
}
|
|
222
216
|
|
|
@@ -343,6 +337,4 @@ ReactElement.isValidElement = function (object) {
|
|
|
343
337
|
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
344
338
|
};
|
|
345
339
|
|
|
346
|
-
ReactElement.REACT_ELEMENT_TYPE = REACT_ELEMENT_TYPE;
|
|
347
|
-
|
|
348
340
|
module.exports = ReactElement;
|