react 15.3.1-rc.2 → 15.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -1,188 +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 ReactDOMComponentTree
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var DOMProperty = require('./DOMProperty');
17
- var ReactDOMComponentFlags = require('./ReactDOMComponentFlags');
18
-
19
- var invariant = require('fbjs/lib/invariant');
20
-
21
- var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
22
- var Flags = ReactDOMComponentFlags;
23
-
24
- var internalInstanceKey = '__reactInternalInstance$' + Math.random().toString(36).slice(2);
25
-
26
- /**
27
- * Drill down (through composites and empty components) until we get a host or
28
- * host text component.
29
- *
30
- * This is pretty polymorphic but unavoidable with the current structure we have
31
- * for `_renderedChildren`.
32
- */
33
- function getRenderedHostOrTextFromComponent(component) {
34
- var rendered;
35
- while (rendered = component._renderedComponent) {
36
- component = rendered;
37
- }
38
- return component;
39
- }
40
-
41
- /**
42
- * Populate `_hostNode` on the rendered host/text component with the given
43
- * DOM node. The passed `inst` can be a composite.
44
- */
45
- function precacheNode(inst, node) {
46
- var hostInst = getRenderedHostOrTextFromComponent(inst);
47
- hostInst._hostNode = node;
48
- node[internalInstanceKey] = hostInst;
49
- }
50
-
51
- function uncacheNode(inst) {
52
- var node = inst._hostNode;
53
- if (node) {
54
- delete node[internalInstanceKey];
55
- inst._hostNode = null;
56
- }
57
- }
58
-
59
- /**
60
- * Populate `_hostNode` on each child of `inst`, assuming that the children
61
- * match up with the DOM (element) children of `node`.
62
- *
63
- * We cache entire levels at once to avoid an n^2 problem where we access the
64
- * children of a node sequentially and have to walk from the start to our target
65
- * node every time.
66
- *
67
- * Since we update `_renderedChildren` and the actual DOM at (slightly)
68
- * different times, we could race here and see a newer `_renderedChildren` than
69
- * the DOM nodes we see. To avoid this, ReactMultiChild calls
70
- * `prepareToManageChildren` before we change `_renderedChildren`, at which
71
- * time the container's child nodes are always cached (until it unmounts).
72
- */
73
- function precacheChildNodes(inst, node) {
74
- if (inst._flags & Flags.hasCachedChildNodes) {
75
- return;
76
- }
77
- var children = inst._renderedChildren;
78
- var childNode = node.firstChild;
79
- outer: for (var name in children) {
80
- if (!children.hasOwnProperty(name)) {
81
- continue;
82
- }
83
- var childInst = children[name];
84
- var childID = getRenderedHostOrTextFromComponent(childInst)._domID;
85
- if (childID === 0) {
86
- // We're currently unmounting this child in ReactMultiChild; skip it.
87
- continue;
88
- }
89
- // We assume the child nodes are in the same order as the child instances.
90
- for (; childNode !== null; childNode = childNode.nextSibling) {
91
- if (childNode.nodeType === 1 && childNode.getAttribute(ATTR_NAME) === String(childID) || childNode.nodeType === 8 && childNode.nodeValue === ' react-text: ' + childID + ' ' || childNode.nodeType === 8 && childNode.nodeValue === ' react-empty: ' + childID + ' ') {
92
- precacheNode(childInst, childNode);
93
- continue outer;
94
- }
95
- }
96
- // We reached the end of the DOM children without finding an ID match.
97
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Unable to find element with ID %s.', childID) : _prodInvariant('32', childID) : void 0;
98
- }
99
- inst._flags |= Flags.hasCachedChildNodes;
100
- }
101
-
102
- /**
103
- * Given a DOM node, return the closest ReactDOMComponent or
104
- * ReactDOMTextComponent instance ancestor.
105
- */
106
- function getClosestInstanceFromNode(node) {
107
- if (node[internalInstanceKey]) {
108
- return node[internalInstanceKey];
109
- }
110
-
111
- // Walk up the tree until we find an ancestor whose instance we have cached.
112
- var parents = [];
113
- while (!node[internalInstanceKey]) {
114
- parents.push(node);
115
- if (node.parentNode) {
116
- node = node.parentNode;
117
- } else {
118
- // Top of the tree. This node must not be part of a React tree (or is
119
- // unmounted, potentially).
120
- return null;
121
- }
122
- }
123
-
124
- var closest;
125
- var inst;
126
- for (; node && (inst = node[internalInstanceKey]); node = parents.pop()) {
127
- closest = inst;
128
- if (parents.length) {
129
- precacheChildNodes(inst, node);
130
- }
131
- }
132
-
133
- return closest;
134
- }
135
-
136
- /**
137
- * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
138
- * instance, or null if the node was not rendered by this React.
139
- */
140
- function getInstanceFromNode(node) {
141
- var inst = getClosestInstanceFromNode(node);
142
- if (inst != null && inst._hostNode === node) {
143
- return inst;
144
- } else {
145
- return null;
146
- }
147
- }
148
-
149
- /**
150
- * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
151
- * DOM node.
152
- */
153
- function getNodeFromInstance(inst) {
154
- // Without this first invariant, passing a non-DOM-component triggers the next
155
- // invariant for a missing parent, which is super confusing.
156
- !(inst._hostNode !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
157
-
158
- if (inst._hostNode) {
159
- return inst._hostNode;
160
- }
161
-
162
- // Walk up the tree until we find an ancestor whose DOM node we have cached.
163
- var parents = [];
164
- while (!inst._hostNode) {
165
- parents.push(inst);
166
- !inst._hostParent ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React DOM tree root should always have a node reference.') : _prodInvariant('34') : void 0;
167
- inst = inst._hostParent;
168
- }
169
-
170
- // Now parents contains each ancestor that does *not* have a cached native
171
- // node, and `inst` is the deepest ancestor that does.
172
- for (; parents.length; inst = parents.pop()) {
173
- precacheChildNodes(inst, inst._hostNode);
174
- }
175
-
176
- return inst._hostNode;
177
- }
178
-
179
- var ReactDOMComponentTree = {
180
- getClosestInstanceFromNode: getClosestInstanceFromNode,
181
- getInstanceFromNode: getInstanceFromNode,
182
- getNodeFromInstance: getNodeFromInstance,
183
- precacheChildNodes: precacheChildNodes,
184
- precacheNode: precacheNode,
185
- uncacheNode: uncacheNode
186
- };
187
-
188
- module.exports = ReactDOMComponentTree;
@@ -1,33 +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 ReactDOMContainerInfo
10
- */
11
-
12
- 'use strict';
13
-
14
- var validateDOMNesting = require('./validateDOMNesting');
15
-
16
- var DOC_NODE_TYPE = 9;
17
-
18
- function ReactDOMContainerInfo(topLevelWrapper, node) {
19
- var info = {
20
- _topLevelWrapper: topLevelWrapper,
21
- _idCounter: 1,
22
- _ownerDocument: node ? node.nodeType === DOC_NODE_TYPE ? node : node.ownerDocument : null,
23
- _node: node,
24
- _tag: node ? node.nodeName.toLowerCase() : null,
25
- _namespaceURI: node ? node.namespaceURI : null
26
- };
27
- if (process.env.NODE_ENV !== 'production') {
28
- info._ancestorInfo = node ? validateDOMNesting.updatedAncestorInfo(null, info._tag, null) : null;
29
- }
30
- return info;
31
- }
32
-
33
- module.exports = ReactDOMContainerInfo;
@@ -1,60 +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 ReactDOMEmptyComponent
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var DOMLazyTree = require('./DOMLazyTree');
17
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
18
-
19
- var ReactDOMEmptyComponent = function (instantiate) {
20
- // ReactCompositeComponent uses this:
21
- this._currentElement = null;
22
- // ReactDOMComponentTree uses these:
23
- this._hostNode = null;
24
- this._hostParent = null;
25
- this._hostContainerInfo = null;
26
- this._domID = 0;
27
- };
28
- _assign(ReactDOMEmptyComponent.prototype, {
29
- mountComponent: function (transaction, hostParent, hostContainerInfo, context) {
30
- var domID = hostContainerInfo._idCounter++;
31
- this._domID = domID;
32
- this._hostParent = hostParent;
33
- this._hostContainerInfo = hostContainerInfo;
34
-
35
- var nodeValue = ' react-empty: ' + this._domID + ' ';
36
- if (transaction.useCreateElement) {
37
- var ownerDocument = hostContainerInfo._ownerDocument;
38
- var node = ownerDocument.createComment(nodeValue);
39
- ReactDOMComponentTree.precacheNode(this, node);
40
- return DOMLazyTree(node);
41
- } else {
42
- if (transaction.renderToStaticMarkup) {
43
- // Normally we'd insert a comment node, but since this is a situation
44
- // where React won't take over (static pages), we can simply return
45
- // nothing.
46
- return '';
47
- }
48
- return '<!--' + nodeValue + '-->';
49
- }
50
- },
51
- receiveComponent: function () {},
52
- getHostNode: function () {
53
- return ReactDOMComponentTree.getNodeFromInstance(this);
54
- },
55
- unmountComponent: function () {
56
- ReactDOMComponentTree.uncacheNode(this);
57
- }
58
- });
59
-
60
- module.exports = ReactDOMEmptyComponent;
@@ -1,78 +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 ReactDOMFiber
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- var ReactFiberReconciler = require('./ReactFiberReconciler');
16
-
17
- function recursivelyAppendChildren(parent, child) {
18
- if (!child) {
19
- return;
20
- }
21
- /* $FlowFixMe: Element should have this property. */
22
- if (child.nodeType === 1) {
23
- /* $FlowFixMe: Refinement issue. I don't know how to express different. */
24
- parent.appendChild(child);
25
- } else {
26
- /* As a result of the refinement issue this type isn't known. */
27
- var node = child;
28
- do {
29
- recursivelyAppendChildren(parent, node.output);
30
- } while (node = node.sibling);
31
- }
32
- }
33
-
34
- var DOMRenderer = ReactFiberReconciler({
35
- updateContainer: function (container, children) {
36
- container.innerHTML = '';
37
- recursivelyAppendChildren(container, children);
38
- },
39
- createInstance: function (type, props, children) {
40
- var domElement = document.createElement(type);
41
- recursivelyAppendChildren(domElement, children);
42
- if (typeof props.children === 'string') {
43
- domElement.textContent = props.children;
44
- }
45
- return domElement;
46
- },
47
- prepareUpdate: function (domElement, oldProps, newProps, children) {
48
- return true;
49
- },
50
- commitUpdate: function (domElement, oldProps, newProps, children) {
51
- domElement.innerHTML = '';
52
- recursivelyAppendChildren(domElement, children);
53
- if (typeof newProps.children === 'string') {
54
- domElement.textContent = newProps.children;
55
- }
56
- },
57
- deleteInstance: function (instance) {
58
- // Noop
59
- },
60
-
61
-
62
- scheduleHighPriCallback: window.requestAnimationFrame,
63
-
64
- scheduleLowPriCallback: window.requestIdleCallback
65
-
66
- });
67
-
68
- var ReactDOM = {
69
- render: function (element, container) {
70
- if (!container._reactRootContainer) {
71
- container._reactRootContainer = DOMRenderer.mountContainer(element, container);
72
- } else {
73
- DOMRenderer.updateContainer(element, container._reactRootContainer);
74
- }
75
- }
76
- };
77
-
78
- module.exports = ReactDOM;
@@ -1,34 +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 ReactDOMIDOperations
10
- */
11
-
12
- 'use strict';
13
-
14
- var DOMChildrenOperations = require('./DOMChildrenOperations');
15
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
16
-
17
- /**
18
- * Operations used to process updates to DOM nodes.
19
- */
20
- var ReactDOMIDOperations = {
21
-
22
- /**
23
- * Updates a component's children by processing a series of updates.
24
- *
25
- * @param {array<object>} updates List of update configurations.
26
- * @internal
27
- */
28
- dangerouslyProcessChildrenUpdates: function (parentInst, updates) {
29
- var node = ReactDOMComponentTree.getNodeFromInstance(parentInst);
30
- DOMChildrenOperations.processUpdates(node, updates);
31
- }
32
- };
33
-
34
- module.exports = ReactDOMIDOperations;
@@ -1,269 +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 ReactDOMInput
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant'),
15
- _assign = require('object-assign');
16
-
17
- var DisabledInputUtils = require('./DisabledInputUtils');
18
- var DOMPropertyOperations = require('./DOMPropertyOperations');
19
- var LinkedValueUtils = require('./LinkedValueUtils');
20
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
21
- var ReactUpdates = require('./ReactUpdates');
22
-
23
- var invariant = require('fbjs/lib/invariant');
24
- var warning = require('fbjs/lib/warning');
25
-
26
- var didWarnValueLink = false;
27
- var didWarnCheckedLink = false;
28
- var didWarnValueDefaultValue = false;
29
- var didWarnCheckedDefaultChecked = false;
30
- var didWarnControlledToUncontrolled = false;
31
- var didWarnUncontrolledToControlled = false;
32
-
33
- function forceUpdateIfMounted() {
34
- if (this._rootNodeID) {
35
- // DOM component is still mounted; update
36
- ReactDOMInput.updateWrapper(this);
37
- }
38
- }
39
-
40
- function isControlled(props) {
41
- var usesChecked = props.type === 'checkbox' || props.type === 'radio';
42
- return usesChecked ? props.checked !== undefined : props.value !== undefined;
43
- }
44
-
45
- /**
46
- * Implements an <input> host component that allows setting these optional
47
- * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
48
- *
49
- * If `checked` or `value` are not supplied (or null/undefined), user actions
50
- * that affect the checked state or value will trigger updates to the element.
51
- *
52
- * If they are supplied (and not null/undefined), the rendered element will not
53
- * trigger updates to the element. Instead, the props must change in order for
54
- * the rendered element to be updated.
55
- *
56
- * The rendered element will be initialized as unchecked (or `defaultChecked`)
57
- * with an empty value (or `defaultValue`).
58
- *
59
- * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
60
- */
61
- var ReactDOMInput = {
62
- getHostProps: function (inst, props) {
63
- var value = LinkedValueUtils.getValue(props);
64
- var checked = LinkedValueUtils.getChecked(props);
65
-
66
- var hostProps = _assign({
67
- // Make sure we set .type before any other properties (setting .value
68
- // before .type means .value is lost in IE11 and below)
69
- type: undefined,
70
- // Make sure we set .step before .value (setting .value before .step
71
- // means .value is rounded on mount, based upon step precision)
72
- step: undefined,
73
- // Make sure we set .min & .max before .value (to ensure proper order
74
- // in corner cases such as min or max deriving from value, e.g. Issue #7170)
75
- min: undefined,
76
- max: undefined
77
- }, DisabledInputUtils.getHostProps(inst, props), {
78
- defaultChecked: undefined,
79
- defaultValue: undefined,
80
- value: value != null ? value : inst._wrapperState.initialValue,
81
- checked: checked != null ? checked : inst._wrapperState.initialChecked,
82
- onChange: inst._wrapperState.onChange
83
- });
84
-
85
- return hostProps;
86
- },
87
-
88
- mountWrapper: function (inst, props) {
89
- if (process.env.NODE_ENV !== 'production') {
90
- LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
91
-
92
- var owner = inst._currentElement._owner;
93
-
94
- if (props.valueLink !== undefined && !didWarnValueLink) {
95
- process.env.NODE_ENV !== 'production' ? warning(false, '`valueLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
96
- didWarnValueLink = true;
97
- }
98
- if (props.checkedLink !== undefined && !didWarnCheckedLink) {
99
- process.env.NODE_ENV !== 'production' ? warning(false, '`checkedLink` prop on `input` is deprecated; set `value` and `onChange` instead.') : void 0;
100
- didWarnCheckedLink = true;
101
- }
102
- if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) {
103
- process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
104
- didWarnCheckedDefaultChecked = true;
105
- }
106
- if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) {
107
- process.env.NODE_ENV !== 'production' ? warning(false, '%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
108
- didWarnValueDefaultValue = true;
109
- }
110
- }
111
-
112
- var defaultValue = props.defaultValue;
113
- inst._wrapperState = {
114
- initialChecked: props.checked != null ? props.checked : props.defaultChecked,
115
- initialValue: props.value != null ? props.value : defaultValue,
116
- listeners: null,
117
- onChange: _handleChange.bind(inst)
118
- };
119
-
120
- if (process.env.NODE_ENV !== 'production') {
121
- inst._wrapperState.controlled = isControlled(props);
122
- }
123
- },
124
-
125
- updateWrapper: function (inst) {
126
- var props = inst._currentElement.props;
127
-
128
- if (process.env.NODE_ENV !== 'production') {
129
- var controlled = isControlled(props);
130
- var owner = inst._currentElement._owner;
131
-
132
- if (!inst._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
133
- process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing an uncontrolled input of type %s to be controlled. ' + 'Input elements should not switch from uncontrolled to controlled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
134
- didWarnUncontrolledToControlled = true;
135
- }
136
- if (inst._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
137
- process.env.NODE_ENV !== 'production' ? warning(false, '%s is changing a controlled input of type %s to be uncontrolled. ' + 'Input elements should not switch from controlled to uncontrolled (or vice versa). ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://fb.me/react-controlled-components', owner && owner.getName() || 'A component', props.type) : void 0;
138
- didWarnControlledToUncontrolled = true;
139
- }
140
- }
141
-
142
- // TODO: Shouldn't this be getChecked(props)?
143
- var checked = props.checked;
144
- if (checked != null) {
145
- DOMPropertyOperations.setValueForProperty(ReactDOMComponentTree.getNodeFromInstance(inst), 'checked', checked || false);
146
- }
147
-
148
- var node = ReactDOMComponentTree.getNodeFromInstance(inst);
149
- var value = LinkedValueUtils.getValue(props);
150
- if (value != null) {
151
-
152
- // Cast `value` to a string to ensure the value is set correctly. While
153
- // browsers typically do this as necessary, jsdom doesn't.
154
- var newValue = '' + value;
155
-
156
- // To avoid side effects (such as losing text selection), only set value if changed
157
- if (newValue !== node.value) {
158
- node.value = newValue;
159
- }
160
- } else {
161
- if (props.value == null && props.defaultValue != null) {
162
- node.defaultValue = '' + props.defaultValue;
163
- }
164
- if (props.checked == null && props.defaultChecked != null) {
165
- node.defaultChecked = !!props.defaultChecked;
166
- }
167
- }
168
- },
169
-
170
- postMountWrapper: function (inst) {
171
- var props = inst._currentElement.props;
172
-
173
- // This is in postMount because we need access to the DOM node, which is not
174
- // available until after the component has mounted.
175
- var node = ReactDOMComponentTree.getNodeFromInstance(inst);
176
-
177
- // Detach value from defaultValue. We won't do anything if we're working on
178
- // submit or reset inputs as those values & defaultValues are linked. They
179
- // are not resetable nodes so this operation doesn't matter and actually
180
- // removes browser-default values (eg "Submit Query") when no value is
181
- // provided.
182
-
183
- switch (props.type) {
184
- case 'submit':
185
- case 'reset':
186
- break;
187
- case 'color':
188
- case 'date':
189
- case 'datetime':
190
- case 'datetime-local':
191
- case 'month':
192
- case 'time':
193
- case 'week':
194
- // This fixes the no-show issue on iOS Safari and Android Chrome:
195
- // https://github.com/facebook/react/issues/7233
196
- node.value = '';
197
- node.value = node.defaultValue;
198
- break;
199
- default:
200
- node.value = node.value;
201
- break;
202
- }
203
-
204
- // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug
205
- // this is needed to work around a chrome bug where setting defaultChecked
206
- // will sometimes influence the value of checked (even after detachment).
207
- // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416
208
- // We need to temporarily unset name to avoid disrupting radio button groups.
209
- var name = node.name;
210
- if (name !== '') {
211
- node.name = '';
212
- }
213
- node.defaultChecked = !node.defaultChecked;
214
- node.defaultChecked = !node.defaultChecked;
215
- if (name !== '') {
216
- node.name = name;
217
- }
218
- }
219
- };
220
-
221
- function _handleChange(event) {
222
- var props = this._currentElement.props;
223
-
224
- var returnValue = LinkedValueUtils.executeOnChange(props, event);
225
-
226
- // Here we use asap to wait until all updates have propagated, which
227
- // is important when using controlled components within layers:
228
- // https://github.com/facebook/react/issues/1698
229
- ReactUpdates.asap(forceUpdateIfMounted, this);
230
-
231
- var name = props.name;
232
- if (props.type === 'radio' && name != null) {
233
- var rootNode = ReactDOMComponentTree.getNodeFromInstance(this);
234
- var queryRoot = rootNode;
235
-
236
- while (queryRoot.parentNode) {
237
- queryRoot = queryRoot.parentNode;
238
- }
239
-
240
- // If `rootNode.form` was non-null, then we could try `form.elements`,
241
- // but that sometimes behaves strangely in IE8. We could also try using
242
- // `form.getElementsByName`, but that will only return direct children
243
- // and won't include inputs that use the HTML5 `form=` attribute. Since
244
- // the input might not even be in a form, let's just use the global
245
- // `querySelectorAll` to ensure we don't miss anything.
246
- var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
247
-
248
- for (var i = 0; i < group.length; i++) {
249
- var otherNode = group[i];
250
- if (otherNode === rootNode || otherNode.form !== rootNode.form) {
251
- continue;
252
- }
253
- // This will throw if radio buttons rendered by different copies of React
254
- // and the same name are rendered into the same form (same as #1939).
255
- // That's probably okay; we don't support it just as we don't support
256
- // mixing React radio buttons with non-React ones.
257
- var otherInstance = ReactDOMComponentTree.getInstanceFromNode(otherNode);
258
- !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.') : _prodInvariant('90') : void 0;
259
- // If this is a controlled radio button group, forcing the input that
260
- // was previously checked to update will cause it to be come re-checked
261
- // as appropriate.
262
- ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
263
- }
264
- }
265
-
266
- return returnValue;
267
- }
268
-
269
- module.exports = ReactDOMInput;