react 0.11.2 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/JSXTransformer.js +2714 -7859
- package/dist/react-with-addons.js +3139 -3593
- package/dist/react-with-addons.min.js +11 -17
- package/dist/react.js +2940 -3308
- package/dist/react.min.js +11 -16
- package/lib/AutoFocusMixin.js +5 -12
- package/lib/BeforeInputEventPlugin.js +12 -14
- package/lib/CSSCore.js +6 -13
- package/lib/CSSProperty.js +10 -14
- package/lib/CSSPropertyOperations.js +46 -12
- package/lib/CallbackQueue.js +7 -14
- package/lib/ChangeEventPlugin.js +5 -12
- package/lib/ClientReactRootIndex.js +5 -12
- package/lib/CompositionEventPlugin.js +5 -12
- package/lib/DOMChildrenOperations.js +8 -15
- package/lib/DOMProperty.js +16 -19
- package/lib/DOMPropertyOperations.js +14 -14
- package/lib/Danger.js +12 -17
- package/lib/DefaultEventPluginOrder.js +5 -12
- package/lib/EnterLeaveEventPlugin.js +5 -12
- package/lib/EventConstants.js +5 -12
- package/lib/EventListener.js +14 -0
- package/lib/EventPluginHub.js +8 -26
- package/lib/EventPluginRegistry.js +5 -12
- package/lib/EventPluginUtils.js +5 -12
- package/lib/EventPropagators.js +12 -17
- package/lib/ExecutionEnvironment.js +5 -12
- package/lib/HTMLDOMPropertyConfig.js +16 -15
- package/lib/LinkedStateMixin.js +5 -12
- package/lib/LinkedValueUtils.js +5 -12
- package/lib/LocalEventTrapMixin.js +8 -14
- package/lib/MobileSafariClickEventPlugin.js +5 -12
- package/lib/Object.assign.js +45 -0
- package/lib/PooledClass.js +5 -12
- package/lib/React.js +87 -54
- package/lib/ReactBrowserComponentMixin.js +5 -12
- package/lib/ReactBrowserEventEmitter.js +7 -14
- package/lib/ReactCSSTransitionGroup.js +15 -17
- package/lib/ReactCSSTransitionGroupChild.js +9 -13
- package/lib/ReactChildren.js +5 -12
- package/lib/ReactComponent.js +61 -68
- package/lib/ReactComponentBrowserEnvironment.js +5 -12
- package/lib/ReactComponentWithPureRenderMixin.js +5 -12
- package/lib/ReactCompositeComponent.js +191 -180
- package/lib/ReactContext.js +8 -15
- package/lib/ReactCurrentOwner.js +5 -12
- package/lib/ReactDOM.js +145 -177
- package/lib/ReactDOMButton.js +8 -14
- package/lib/ReactDOMComponent.js +103 -38
- package/lib/ReactDOMForm.js +9 -15
- package/lib/ReactDOMIDOperations.js +5 -12
- package/lib/ReactDOMImg.js +8 -14
- package/lib/ReactDOMInput.js +30 -38
- package/lib/ReactDOMOption.js +8 -14
- package/lib/ReactDOMSelect.js +25 -24
- package/lib/ReactDOMSelection.js +11 -18
- package/lib/ReactDOMTextarea.js +19 -24
- package/lib/ReactDefaultBatchingStrategy.js +14 -18
- package/lib/ReactDefaultInjection.js +23 -26
- package/lib/ReactDefaultPerf.js +14 -17
- package/lib/ReactDefaultPerfAnalysis.js +18 -17
- package/lib/ReactElement.js +242 -0
- package/lib/{ReactDescriptorValidator.js → ReactElementValidator.js} +51 -56
- package/lib/ReactEmptyComponent.js +8 -13
- package/lib/ReactErrorUtils.js +5 -12
- package/lib/ReactEventEmitterMixin.js +5 -12
- package/lib/ReactEventListener.js +7 -14
- package/lib/ReactInjection.js +7 -14
- package/lib/ReactInputSelection.js +5 -12
- package/lib/ReactInstanceHandles.js +5 -12
- package/lib/ReactLegacyElement.js +243 -0
- package/lib/ReactLink.js +5 -12
- package/lib/ReactMarkupChecksum.js +5 -12
- package/lib/ReactMount.js +45 -32
- package/lib/ReactMultiChild.js +14 -18
- package/lib/ReactMultiChildUpdateTypes.js +5 -12
- package/lib/ReactNativeComponent.js +69 -0
- package/lib/ReactOwner.js +5 -12
- package/lib/ReactPerf.js +8 -13
- package/lib/ReactPropTransferer.js +34 -33
- package/lib/ReactPropTypeLocationNames.js +5 -12
- package/lib/ReactPropTypeLocations.js +5 -12
- package/lib/ReactPropTypes.js +38 -29
- package/lib/ReactPutListenerQueue.js +7 -14
- package/lib/ReactReconcileTransaction.js +7 -15
- package/lib/ReactRootIndex.js +5 -12
- package/lib/ReactServerRendering.js +21 -34
- package/lib/ReactServerRenderingTransaction.js +11 -15
- package/lib/ReactStateSetters.js +5 -12
- package/lib/ReactTestUtils.js +31 -33
- package/lib/ReactTextComponent.js +18 -21
- package/lib/ReactTransitionChildMapping.js +6 -13
- package/lib/ReactTransitionEvents.js +5 -12
- package/lib/ReactTransitionGroup.js +14 -17
- package/lib/ReactUpdates.js +43 -22
- package/lib/ReactWithAddons.js +7 -13
- package/lib/SVGDOMPropertyConfig.js +5 -12
- package/lib/SelectEventPlugin.js +13 -20
- package/lib/ServerReactRootIndex.js +5 -12
- package/lib/SimpleEventPlugin.js +20 -15
- package/lib/SyntheticClipboardEvent.js +5 -12
- package/lib/SyntheticCompositionEvent.js +5 -12
- package/lib/SyntheticDragEvent.js +5 -12
- package/lib/SyntheticEvent.js +9 -17
- package/lib/SyntheticFocusEvent.js +5 -12
- package/lib/SyntheticInputEvent.js +4 -11
- package/lib/SyntheticKeyboardEvent.js +17 -19
- package/lib/SyntheticMouseEvent.js +5 -12
- package/lib/SyntheticTouchEvent.js +5 -12
- package/lib/SyntheticUIEvent.js +5 -12
- package/lib/SyntheticWheelEvent.js +5 -12
- package/lib/Transaction.js +5 -12
- package/lib/ViewportMetrics.js +5 -12
- package/lib/accumulateInto.js +62 -0
- package/lib/adler32.js +6 -13
- package/lib/camelize.js +30 -0
- package/lib/camelizeStyleName.js +40 -0
- package/lib/cloneWithProps.js +9 -15
- package/lib/containsNode.js +5 -12
- package/lib/copyProperties.js +12 -12
- package/lib/createArrayFrom.js +5 -12
- package/lib/createFullPageComponent.js +12 -18
- package/lib/createNodesFromMarkup.js +5 -12
- package/lib/cx.js +5 -12
- package/lib/dangerousStyleValue.js +5 -12
- package/lib/deprecated.js +47 -0
- package/lib/emptyFunction.js +11 -22
- package/lib/emptyObject.js +5 -12
- package/lib/escapeTextForBrowser.js +5 -12
- package/lib/flattenChildren.js +19 -13
- package/lib/focusNode.js +10 -16
- package/lib/forEachAccumulated.js +5 -12
- package/lib/getActiveElement.js +5 -12
- package/lib/getEventCharCode.js +50 -0
- package/lib/getEventKey.js +9 -21
- package/lib/getEventModifierState.js +4 -11
- package/lib/getEventTarget.js +5 -12
- package/lib/getMarkupWrap.js +5 -12
- package/lib/getNodeForCharacterOffset.js +5 -12
- package/lib/getReactRootElementInContainer.js +5 -12
- package/lib/getTextContentAccessor.js +5 -12
- package/lib/getUnboundedScrollPosition.js +5 -12
- package/lib/hyphenate.js +5 -12
- package/lib/hyphenateStyleName.js +8 -15
- package/lib/instantiateReactComponent.js +90 -42
- package/lib/invariant.js +5 -12
- package/lib/isEventSupported.js +5 -12
- package/lib/isNode.js +5 -12
- package/lib/isTextInputElement.js +5 -12
- package/lib/isTextNode.js +5 -12
- package/lib/joinClasses.js +8 -13
- package/lib/keyMirror.js +5 -12
- package/lib/keyOf.js +5 -12
- package/lib/mapObject.js +35 -36
- package/lib/memoizeStringOnly.js +5 -12
- package/lib/merge.js +14 -17
- package/lib/mergeInto.js +13 -35
- package/lib/monitorCodeUse.js +5 -12
- package/lib/onlyChild.js +8 -15
- package/lib/performance.js +5 -12
- package/lib/performanceNow.js +5 -12
- package/lib/setInnerHTML.js +10 -19
- package/lib/shallowEqual.js +6 -13
- package/lib/shouldUpdateReactComponent.js +14 -22
- package/lib/toArray.js +5 -12
- package/lib/traverseAllChildren.js +34 -48
- package/lib/update.js +8 -15
- package/lib/warning.js +6 -13
- package/package.json +3 -8
- package/lib/ReactDescriptor.js +0 -251
- package/lib/accumulate.js +0 -54
- package/lib/mergeHelpers.js +0 -147
- package/lib/mixInto.js +0 -34
package/lib/setInnerHTML.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule setInnerHTML
|
|
17
10
|
*/
|
|
@@ -20,6 +13,9 @@
|
|
|
20
13
|
|
|
21
14
|
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
22
15
|
|
|
16
|
+
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
|
|
17
|
+
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
|
|
18
|
+
|
|
23
19
|
/**
|
|
24
20
|
* Set the innerHTML property of a node, ensuring that whitespace is preserved
|
|
25
21
|
* even in IE8.
|
|
@@ -56,13 +52,8 @@ if (ExecutionEnvironment.canUseDOM) {
|
|
|
56
52
|
// thin air on IE8, this only happens if there is no visible text
|
|
57
53
|
// in-front of the non-visible tags. Piggyback on the whitespace fix
|
|
58
54
|
// and simply check if any non-visible tags appear in the source.
|
|
59
|
-
if (
|
|
60
|
-
html[0] === '<' && (
|
|
61
|
-
html.indexOf('<noscript') !== -1 ||
|
|
62
|
-
html.indexOf('<script') !== -1 ||
|
|
63
|
-
html.indexOf('<style') !== -1 ||
|
|
64
|
-
html.indexOf('<meta') !== -1 ||
|
|
65
|
-
html.indexOf('<link') !== -1)) {
|
|
55
|
+
if (WHITESPACE_TEST.test(html) ||
|
|
56
|
+
html[0] === '<' && NONVISIBLE_TEST.test(html)) {
|
|
66
57
|
// Recover leading whitespace by temporarily prepending any character.
|
|
67
58
|
// \uFEFF has the potential advantage of being zero-width/invisible.
|
|
68
59
|
node.innerHTML = '\uFEFF' + html;
|
package/lib/shallowEqual.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule shallowEqual
|
|
17
10
|
*/
|
|
@@ -37,7 +30,7 @@ function shallowEqual(objA, objB) {
|
|
|
37
30
|
return false;
|
|
38
31
|
}
|
|
39
32
|
}
|
|
40
|
-
// Test for B'
|
|
33
|
+
// Test for B's keys missing from A.
|
|
41
34
|
for (key in objB) {
|
|
42
35
|
if (objB.hasOwnProperty(key) && !objA.hasOwnProperty(key)) {
|
|
43
36
|
return false;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule shouldUpdateReactComponent
|
|
17
10
|
* @typechecks static-only
|
|
@@ -20,22 +13,21 @@
|
|
|
20
13
|
"use strict";
|
|
21
14
|
|
|
22
15
|
/**
|
|
23
|
-
* Given a `
|
|
16
|
+
* Given a `prevElement` and `nextElement`, determines if the existing
|
|
24
17
|
* instance should be updated as opposed to being destroyed or replaced by a new
|
|
25
|
-
* instance. Both arguments are
|
|
18
|
+
* instance. Both arguments are elements. This ensures that this logic can
|
|
26
19
|
* operate on stateless trees without any backing instance.
|
|
27
20
|
*
|
|
28
|
-
* @param {?object}
|
|
29
|
-
* @param {?object}
|
|
21
|
+
* @param {?object} prevElement
|
|
22
|
+
* @param {?object} nextElement
|
|
30
23
|
* @return {boolean} True if the existing instance should be updated.
|
|
31
24
|
* @protected
|
|
32
25
|
*/
|
|
33
|
-
function shouldUpdateReactComponent(
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
) && prevDescriptor._owner === nextDescriptor._owner) {
|
|
26
|
+
function shouldUpdateReactComponent(prevElement, nextElement) {
|
|
27
|
+
if (prevElement && nextElement &&
|
|
28
|
+
prevElement.type === nextElement.type &&
|
|
29
|
+
prevElement.key === nextElement.key &&
|
|
30
|
+
prevElement._owner === nextElement._owner) {
|
|
39
31
|
return true;
|
|
40
32
|
}
|
|
41
33
|
return false;
|
package/lib/toArray.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule toArray
|
|
17
10
|
* @typechecks
|
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule traverseAllChildren
|
|
17
10
|
*/
|
|
18
11
|
|
|
19
12
|
"use strict";
|
|
20
13
|
|
|
14
|
+
var ReactElement = require("./ReactElement");
|
|
21
15
|
var ReactInstanceHandles = require("./ReactInstanceHandles");
|
|
22
|
-
var ReactTextComponent = require("./ReactTextComponent");
|
|
23
16
|
|
|
24
17
|
var invariant = require("./invariant");
|
|
25
18
|
|
|
@@ -54,9 +47,9 @@ function userProvidedKeyEscaper(match) {
|
|
|
54
47
|
* @return {string}
|
|
55
48
|
*/
|
|
56
49
|
function getComponentKey(component, index) {
|
|
57
|
-
if (component && component.
|
|
50
|
+
if (component && component.key != null) {
|
|
58
51
|
// Explicit key
|
|
59
|
-
return wrapUserProvidedKey(component.
|
|
52
|
+
return wrapUserProvidedKey(component.key);
|
|
60
53
|
}
|
|
61
54
|
// Implicit key determined by the index in the set
|
|
62
55
|
return index.toString(36);
|
|
@@ -97,16 +90,17 @@ function wrapUserProvidedKey(key) {
|
|
|
97
90
|
*/
|
|
98
91
|
var traverseAllChildrenImpl =
|
|
99
92
|
function(children, nameSoFar, indexSoFar, callback, traverseContext) {
|
|
93
|
+
var nextName, nextIndex;
|
|
100
94
|
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
101
95
|
if (Array.isArray(children)) {
|
|
102
96
|
for (var i = 0; i < children.length; i++) {
|
|
103
97
|
var child = children[i];
|
|
104
|
-
|
|
98
|
+
nextName = (
|
|
105
99
|
nameSoFar +
|
|
106
100
|
(nameSoFar ? SUBSEPARATOR : SEPARATOR) +
|
|
107
101
|
getComponentKey(child, i)
|
|
108
102
|
);
|
|
109
|
-
|
|
103
|
+
nextIndex = indexSoFar + subtreeCount;
|
|
110
104
|
subtreeCount += traverseAllChildrenImpl(
|
|
111
105
|
child,
|
|
112
106
|
nextName,
|
|
@@ -126,40 +120,32 @@ var traverseAllChildrenImpl =
|
|
|
126
120
|
// All of the above are perceived as null.
|
|
127
121
|
callback(traverseContext, null, storageName, indexSoFar);
|
|
128
122
|
subtreeCount = 1;
|
|
129
|
-
} else if (
|
|
130
|
-
children
|
|
123
|
+
} else if (type === 'string' || type === 'number' ||
|
|
124
|
+
ReactElement.isValidElement(children)) {
|
|
131
125
|
callback(traverseContext, children, storageName, indexSoFar);
|
|
132
126
|
subtreeCount = 1;
|
|
133
|
-
} else {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
127
|
+
} else if (type === 'object') {
|
|
128
|
+
("production" !== process.env.NODE_ENV ? invariant(
|
|
129
|
+
!children || children.nodeType !== 1,
|
|
130
|
+
'traverseAllChildren(...): Encountered an invalid child; DOM ' +
|
|
131
|
+
'elements are not valid children of React components.'
|
|
132
|
+
) : invariant(!children || children.nodeType !== 1));
|
|
133
|
+
for (var key in children) {
|
|
134
|
+
if (children.hasOwnProperty(key)) {
|
|
135
|
+
nextName = (
|
|
136
|
+
nameSoFar + (nameSoFar ? SUBSEPARATOR : SEPARATOR) +
|
|
137
|
+
wrapUserProvidedKey(key) + SUBSEPARATOR +
|
|
138
|
+
getComponentKey(children[key], 0)
|
|
139
|
+
);
|
|
140
|
+
nextIndex = indexSoFar + subtreeCount;
|
|
141
|
+
subtreeCount += traverseAllChildrenImpl(
|
|
142
|
+
children[key],
|
|
143
|
+
nextName,
|
|
144
|
+
nextIndex,
|
|
145
|
+
callback,
|
|
146
|
+
traverseContext
|
|
147
|
+
);
|
|
154
148
|
}
|
|
155
|
-
} else if (type === 'string') {
|
|
156
|
-
var normalizedText = ReactTextComponent(children);
|
|
157
|
-
callback(traverseContext, normalizedText, storageName, indexSoFar);
|
|
158
|
-
subtreeCount += 1;
|
|
159
|
-
} else if (type === 'number') {
|
|
160
|
-
var normalizedNumber = ReactTextComponent('' + children);
|
|
161
|
-
callback(traverseContext, normalizedNumber, storageName, indexSoFar);
|
|
162
|
-
subtreeCount += 1;
|
|
163
149
|
}
|
|
164
150
|
}
|
|
165
151
|
}
|
package/lib/update.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013-2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule update
|
|
17
10
|
*/
|
|
18
11
|
|
|
19
12
|
"use strict";
|
|
20
13
|
|
|
21
|
-
var
|
|
14
|
+
var assign = require("./Object.assign");
|
|
22
15
|
var keyOf = require("./keyOf");
|
|
23
16
|
var invariant = require("./invariant");
|
|
24
17
|
|
|
@@ -26,7 +19,7 @@ function shallowCopy(x) {
|
|
|
26
19
|
if (Array.isArray(x)) {
|
|
27
20
|
return x.concat();
|
|
28
21
|
} else if (x && typeof x === 'object') {
|
|
29
|
-
return
|
|
22
|
+
return assign(new x.constructor(), x);
|
|
30
23
|
} else {
|
|
31
24
|
return x;
|
|
32
25
|
}
|
|
@@ -106,7 +99,7 @@ function update(value, spec) {
|
|
|
106
99
|
COMMAND_MERGE,
|
|
107
100
|
nextValue
|
|
108
101
|
) : invariant(nextValue && typeof nextValue === 'object'));
|
|
109
|
-
|
|
102
|
+
assign(nextValue, spec[COMMAND_MERGE]);
|
|
110
103
|
}
|
|
111
104
|
|
|
112
105
|
if (spec.hasOwnProperty(COMMAND_PUSH)) {
|
package/lib/warning.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2014 Facebook, Inc.
|
|
2
|
+
* Copyright 2014, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
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.
|
|
15
8
|
*
|
|
16
9
|
* @providesModule warning
|
|
17
10
|
*/
|
|
@@ -30,7 +23,7 @@ var emptyFunction = require("./emptyFunction");
|
|
|
30
23
|
var warning = emptyFunction;
|
|
31
24
|
|
|
32
25
|
if ("production" !== process.env.NODE_ENV) {
|
|
33
|
-
warning = function(condition, format ) {var args=
|
|
26
|
+
warning = function(condition, format ) {for (var args=[],$__0=2,$__1=arguments.length;$__0<$__1;$__0++) args.push(arguments[$__0]);
|
|
34
27
|
if (format === undefined) {
|
|
35
28
|
throw new Error(
|
|
36
29
|
'`warning(condition, format, ...args)` requires a warning ' +
|
package/package.json
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react"
|
|
7
7
|
],
|
|
8
8
|
"homepage": "https://github.com/facebook/react/tree/master/npm-react",
|
|
9
9
|
"bugs": "https://github.com/facebook/react/issues?labels=react-core",
|
|
10
|
-
"
|
|
11
|
-
{
|
|
12
|
-
"type": "Apache-2.0",
|
|
13
|
-
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
10
|
+
"license": "BSD-3-Clause",
|
|
16
11
|
"files": [
|
|
17
12
|
"README.md",
|
|
18
13
|
"addons.js",
|
|
@@ -29,7 +24,7 @@
|
|
|
29
24
|
"node": ">=0.10.0"
|
|
30
25
|
},
|
|
31
26
|
"dependencies": {
|
|
32
|
-
"envify": "^
|
|
27
|
+
"envify": "^3.0.0"
|
|
33
28
|
},
|
|
34
29
|
"browserify": {
|
|
35
30
|
"transform": [
|
package/lib/ReactDescriptor.js
DELETED
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014 Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*
|
|
16
|
-
* @providesModule ReactDescriptor
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
"use strict";
|
|
20
|
-
|
|
21
|
-
var ReactContext = require("./ReactContext");
|
|
22
|
-
var ReactCurrentOwner = require("./ReactCurrentOwner");
|
|
23
|
-
|
|
24
|
-
var merge = require("./merge");
|
|
25
|
-
var warning = require("./warning");
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Warn for mutations.
|
|
29
|
-
*
|
|
30
|
-
* @internal
|
|
31
|
-
* @param {object} object
|
|
32
|
-
* @param {string} key
|
|
33
|
-
*/
|
|
34
|
-
function defineWarningProperty(object, key) {
|
|
35
|
-
Object.defineProperty(object, key, {
|
|
36
|
-
|
|
37
|
-
configurable: false,
|
|
38
|
-
enumerable: true,
|
|
39
|
-
|
|
40
|
-
get: function() {
|
|
41
|
-
if (!this._store) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
return this._store[key];
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
set: function(value) {
|
|
48
|
-
("production" !== process.env.NODE_ENV ? warning(
|
|
49
|
-
false,
|
|
50
|
-
'Don\'t set the ' + key + ' property of the component. ' +
|
|
51
|
-
'Mutate the existing props object instead.'
|
|
52
|
-
) : null);
|
|
53
|
-
this._store[key] = value;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* This is updated to true if the membrane is successfully created.
|
|
61
|
-
*/
|
|
62
|
-
var useMutationMembrane = false;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Warn for mutations.
|
|
66
|
-
*
|
|
67
|
-
* @internal
|
|
68
|
-
* @param {object} descriptor
|
|
69
|
-
*/
|
|
70
|
-
function defineMutationMembrane(prototype) {
|
|
71
|
-
try {
|
|
72
|
-
var pseudoFrozenProperties = {
|
|
73
|
-
props: true
|
|
74
|
-
};
|
|
75
|
-
for (var key in pseudoFrozenProperties) {
|
|
76
|
-
defineWarningProperty(prototype, key);
|
|
77
|
-
}
|
|
78
|
-
useMutationMembrane = true;
|
|
79
|
-
} catch (x) {
|
|
80
|
-
// IE will fail on defineProperty
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Transfer static properties from the source to the target. Functions are
|
|
86
|
-
* rebound to have this reflect the original source.
|
|
87
|
-
*/
|
|
88
|
-
function proxyStaticMethods(target, source) {
|
|
89
|
-
if (typeof source !== 'function') {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
for (var key in source) {
|
|
93
|
-
if (source.hasOwnProperty(key)) {
|
|
94
|
-
var value = source[key];
|
|
95
|
-
if (typeof value === 'function') {
|
|
96
|
-
var bound = value.bind(source);
|
|
97
|
-
// Copy any properties defined on the function, such as `isRequired` on
|
|
98
|
-
// a PropTypes validator. (mergeInto refuses to work on functions.)
|
|
99
|
-
for (var k in value) {
|
|
100
|
-
if (value.hasOwnProperty(k)) {
|
|
101
|
-
bound[k] = value[k];
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
target[key] = bound;
|
|
105
|
-
} else {
|
|
106
|
-
target[key] = value;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Base constructor for all React descriptors. This is only used to make this
|
|
114
|
-
* work with a dynamic instanceof check. Nothing should live on this prototype.
|
|
115
|
-
*
|
|
116
|
-
* @param {*} type
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
var ReactDescriptor = function() {};
|
|
120
|
-
|
|
121
|
-
if ("production" !== process.env.NODE_ENV) {
|
|
122
|
-
defineMutationMembrane(ReactDescriptor.prototype);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
ReactDescriptor.createFactory = function(type) {
|
|
126
|
-
|
|
127
|
-
var descriptorPrototype = Object.create(ReactDescriptor.prototype);
|
|
128
|
-
|
|
129
|
-
var factory = function(props, children) {
|
|
130
|
-
// For consistency we currently allocate a new object for every descriptor.
|
|
131
|
-
// This protects the descriptor from being mutated by the original props
|
|
132
|
-
// object being mutated. It also protects the original props object from
|
|
133
|
-
// being mutated by children arguments and default props. This behavior
|
|
134
|
-
// comes with a performance cost and could be deprecated in the future.
|
|
135
|
-
// It could also be optimized with a smarter JSX transform.
|
|
136
|
-
if (props == null) {
|
|
137
|
-
props = {};
|
|
138
|
-
} else if (typeof props === 'object') {
|
|
139
|
-
props = merge(props);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Children can be more than one argument, and those are transferred onto
|
|
143
|
-
// the newly allocated props object.
|
|
144
|
-
var childrenLength = arguments.length - 1;
|
|
145
|
-
if (childrenLength === 1) {
|
|
146
|
-
props.children = children;
|
|
147
|
-
} else if (childrenLength > 1) {
|
|
148
|
-
var childArray = Array(childrenLength);
|
|
149
|
-
for (var i = 0; i < childrenLength; i++) {
|
|
150
|
-
childArray[i] = arguments[i + 1];
|
|
151
|
-
}
|
|
152
|
-
props.children = childArray;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Initialize the descriptor object
|
|
156
|
-
var descriptor = Object.create(descriptorPrototype);
|
|
157
|
-
|
|
158
|
-
// Record the component responsible for creating this descriptor.
|
|
159
|
-
descriptor._owner = ReactCurrentOwner.current;
|
|
160
|
-
|
|
161
|
-
// TODO: Deprecate withContext, and then the context becomes accessible
|
|
162
|
-
// through the owner.
|
|
163
|
-
descriptor._context = ReactContext.current;
|
|
164
|
-
|
|
165
|
-
if ("production" !== process.env.NODE_ENV) {
|
|
166
|
-
// The validation flag and props are currently mutative. We put them on
|
|
167
|
-
// an external backing store so that we can freeze the whole object.
|
|
168
|
-
// This can be replaced with a WeakMap once they are implemented in
|
|
169
|
-
// commonly used development environments.
|
|
170
|
-
descriptor._store = { validated: false, props: props };
|
|
171
|
-
|
|
172
|
-
// We're not allowed to set props directly on the object so we early
|
|
173
|
-
// return and rely on the prototype membrane to forward to the backing
|
|
174
|
-
// store.
|
|
175
|
-
if (useMutationMembrane) {
|
|
176
|
-
Object.freeze(descriptor);
|
|
177
|
-
return descriptor;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
descriptor.props = props;
|
|
182
|
-
return descriptor;
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// Currently we expose the prototype of the descriptor so that
|
|
186
|
-
// <Foo /> instanceof Foo works. This is controversial pattern.
|
|
187
|
-
factory.prototype = descriptorPrototype;
|
|
188
|
-
|
|
189
|
-
// Expose the type on the factory and the prototype so that it can be
|
|
190
|
-
// easily accessed on descriptors. E.g. <Foo />.type === Foo.type and for
|
|
191
|
-
// static methods like <Foo />.type.staticMethod();
|
|
192
|
-
// This should not be named constructor since this may not be the function
|
|
193
|
-
// that created the descriptor, and it may not even be a constructor.
|
|
194
|
-
factory.type = type;
|
|
195
|
-
descriptorPrototype.type = type;
|
|
196
|
-
|
|
197
|
-
proxyStaticMethods(factory, type);
|
|
198
|
-
|
|
199
|
-
// Expose a unique constructor on the prototype is that this works with type
|
|
200
|
-
// systems that compare constructor properties: <Foo />.constructor === Foo
|
|
201
|
-
// This may be controversial since it requires a known factory function.
|
|
202
|
-
descriptorPrototype.constructor = factory;
|
|
203
|
-
|
|
204
|
-
return factory;
|
|
205
|
-
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
ReactDescriptor.cloneAndReplaceProps = function(oldDescriptor, newProps) {
|
|
209
|
-
var newDescriptor = Object.create(oldDescriptor.constructor.prototype);
|
|
210
|
-
// It's important that this property order matches the hidden class of the
|
|
211
|
-
// original descriptor to maintain perf.
|
|
212
|
-
newDescriptor._owner = oldDescriptor._owner;
|
|
213
|
-
newDescriptor._context = oldDescriptor._context;
|
|
214
|
-
|
|
215
|
-
if ("production" !== process.env.NODE_ENV) {
|
|
216
|
-
newDescriptor._store = {
|
|
217
|
-
validated: oldDescriptor._store.validated,
|
|
218
|
-
props: newProps
|
|
219
|
-
};
|
|
220
|
-
if (useMutationMembrane) {
|
|
221
|
-
Object.freeze(newDescriptor);
|
|
222
|
-
return newDescriptor;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
newDescriptor.props = newProps;
|
|
227
|
-
return newDescriptor;
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Checks if a value is a valid descriptor constructor.
|
|
232
|
-
*
|
|
233
|
-
* @param {*}
|
|
234
|
-
* @return {boolean}
|
|
235
|
-
* @public
|
|
236
|
-
*/
|
|
237
|
-
ReactDescriptor.isValidFactory = function(factory) {
|
|
238
|
-
return typeof factory === 'function' &&
|
|
239
|
-
factory.prototype instanceof ReactDescriptor;
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* @param {?object} object
|
|
244
|
-
* @return {boolean} True if `object` is a valid component.
|
|
245
|
-
* @final
|
|
246
|
-
*/
|
|
247
|
-
ReactDescriptor.isValidDescriptor = function(object) {
|
|
248
|
-
return object instanceof ReactDescriptor;
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
module.exports = ReactDescriptor;
|