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.
Files changed (210) hide show
  1. package/dist/react-with-addons.js +3864 -21390
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/shallowCompare.js +1 -2
  52. package/lib/sliceChildren.js +0 -1
  53. package/lib/traverseAllChildren.js +11 -3
  54. package/lib/update.js +6 -8
  55. package/package.json +1 -1
  56. package/lib/AutoFocusUtils.js +0 -24
  57. package/lib/BeforeInputEventPlugin.js +0 -390
  58. package/lib/CSSProperty.js +0 -148
  59. package/lib/CSSPropertyOperations.js +0 -205
  60. package/lib/CallbackQueue.js +0 -106
  61. package/lib/ChangeEventPlugin.js +0 -325
  62. package/lib/DOMChildrenOperations.js +0 -194
  63. package/lib/DOMLazyTree.js +0 -118
  64. package/lib/DOMProperty.js +0 -206
  65. package/lib/DOMPropertyOperations.js +0 -221
  66. package/lib/Danger.js +0 -48
  67. package/lib/DefaultEventPluginOrder.js +0 -27
  68. package/lib/DisabledInputUtils.js +0 -50
  69. package/lib/EnterLeaveEventPlugin.js +0 -105
  70. package/lib/EventConstants.js +0 -97
  71. package/lib/EventPluginHub.js +0 -251
  72. package/lib/EventPluginRegistry.js +0 -247
  73. package/lib/EventPluginUtils.js +0 -229
  74. package/lib/EventPropagators.js +0 -137
  75. package/lib/FallbackCompositionState.js +0 -95
  76. package/lib/HTMLDOMPropertyConfig.js +0 -212
  77. package/lib/LinkedValueUtils.js +0 -136
  78. package/lib/NativeMethodsMixin.js +0 -167
  79. package/lib/ReactBrowserEventEmitter.js +0 -330
  80. package/lib/ReactChildReconciler.js +0 -154
  81. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  82. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  83. package/lib/ReactComponentEnvironment.js +0 -45
  84. package/lib/ReactComponentTreeTestUtils.js +0 -87
  85. package/lib/ReactCompositeComponent.js +0 -904
  86. package/lib/ReactDOM.js +0 -110
  87. package/lib/ReactDOMButton.js +0 -24
  88. package/lib/ReactDOMComponent.js +0 -1006
  89. package/lib/ReactDOMComponentTree.js +0 -188
  90. package/lib/ReactDOMContainerInfo.js +0 -33
  91. package/lib/ReactDOMEmptyComponent.js +0 -60
  92. package/lib/ReactDOMFiber.js +0 -76
  93. package/lib/ReactDOMIDOperations.js +0 -34
  94. package/lib/ReactDOMInput.js +0 -269
  95. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  96. package/lib/ReactDOMOption.js +0 -123
  97. package/lib/ReactDOMSelect.js +0 -201
  98. package/lib/ReactDOMSelection.js +0 -212
  99. package/lib/ReactDOMServer.js +0 -26
  100. package/lib/ReactDOMTextComponent.js +0 -164
  101. package/lib/ReactDOMTextarea.js +0 -155
  102. package/lib/ReactDOMTreeTraversal.js +0 -136
  103. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  104. package/lib/ReactDebugTool.js +0 -301
  105. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  106. package/lib/ReactDefaultInjection.js +0 -84
  107. package/lib/ReactEmptyComponent.js +0 -30
  108. package/lib/ReactErrorUtils.js +0 -76
  109. package/lib/ReactEventEmitterMixin.js +0 -33
  110. package/lib/ReactEventListener.js +0 -157
  111. package/lib/ReactFeatureFlags.js +0 -22
  112. package/lib/ReactHostComponent.js +0 -76
  113. package/lib/ReactHostOperationHistoryHook.js +0 -37
  114. package/lib/ReactInjection.js +0 -36
  115. package/lib/ReactInputSelection.js +0 -124
  116. package/lib/ReactInstanceHandles.js +0 -302
  117. package/lib/ReactInstanceMap.js +0 -48
  118. package/lib/ReactInstrumentation.js +0 -21
  119. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  120. package/lib/ReactMarkupChecksum.js +0 -50
  121. package/lib/ReactMount.js +0 -534
  122. package/lib/ReactMultiChild.js +0 -451
  123. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  124. package/lib/ReactNative.js +0 -71
  125. package/lib/ReactNativeAttributePayload.js +0 -371
  126. package/lib/ReactNativeBaseComponent.js +0 -198
  127. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  128. package/lib/ReactNativeComponentEnvironment.js +0 -31
  129. package/lib/ReactNativeComponentTree.js +0 -68
  130. package/lib/ReactNativeContainerInfo.js +0 -21
  131. package/lib/ReactNativeDOMIDOperations.js +0 -79
  132. package/lib/ReactNativeDefaultInjection.js +0 -101
  133. package/lib/ReactNativeEventEmitter.js +0 -191
  134. package/lib/ReactNativeEventPluginOrder.js +0 -16
  135. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  136. package/lib/ReactNativeMount.js +0 -193
  137. package/lib/ReactNativePropRegistry.js +0 -52
  138. package/lib/ReactNativeReconcileTransaction.js +0 -129
  139. package/lib/ReactNativeTagHandles.js +0 -56
  140. package/lib/ReactNativeTextComponent.js +0 -71
  141. package/lib/ReactNativeTreeTraversal.js +0 -127
  142. package/lib/ReactNodeTypes.js +0 -40
  143. package/lib/ReactNoop.js +0 -173
  144. package/lib/ReactOwner.js +0 -94
  145. package/lib/ReactPerf.js +0 -494
  146. package/lib/ReactReconcileTransaction.js +0 -178
  147. package/lib/ReactReconciler.js +0 -168
  148. package/lib/ReactRef.js +0 -80
  149. package/lib/ReactServerBatchingStrategy.js +0 -22
  150. package/lib/ReactServerRendering.js +0 -90
  151. package/lib/ReactServerRenderingTransaction.js +0 -90
  152. package/lib/ReactServerUpdateQueue.js +0 -141
  153. package/lib/ReactSimpleEmptyComponent.js +0 -37
  154. package/lib/ReactTestMount.js +0 -126
  155. package/lib/ReactTestReconcileTransaction.js +0 -121
  156. package/lib/ReactTestRenderer.js +0 -144
  157. package/lib/ReactTestUtils.js +0 -518
  158. package/lib/ReactUpdateQueue.js +0 -226
  159. package/lib/ReactUpdates.js +0 -251
  160. package/lib/ResponderEventPlugin.js +0 -510
  161. package/lib/ResponderSyntheticEvent.js +0 -39
  162. package/lib/ResponderTouchHistoryStore.js +0 -184
  163. package/lib/SVGDOMPropertyConfig.js +0 -302
  164. package/lib/SelectEventPlugin.js +0 -196
  165. package/lib/SimpleEventPlugin.js +0 -635
  166. package/lib/SyntheticAnimationEvent.js +0 -39
  167. package/lib/SyntheticClipboardEvent.js +0 -38
  168. package/lib/SyntheticCompositionEvent.js +0 -36
  169. package/lib/SyntheticDragEvent.js +0 -36
  170. package/lib/SyntheticEvent.js +0 -268
  171. package/lib/SyntheticFocusEvent.js +0 -36
  172. package/lib/SyntheticInputEvent.js +0 -37
  173. package/lib/SyntheticKeyboardEvent.js +0 -84
  174. package/lib/SyntheticMouseEvent.js +0 -72
  175. package/lib/SyntheticTouchEvent.js +0 -45
  176. package/lib/SyntheticTransitionEvent.js +0 -39
  177. package/lib/SyntheticUIEvent.js +0 -59
  178. package/lib/SyntheticWheelEvent.js +0 -54
  179. package/lib/TapEventPlugin.js +0 -110
  180. package/lib/TouchHistoryMath.js +0 -99
  181. package/lib/Transaction.js +0 -233
  182. package/lib/ViewportMetrics.js +0 -27
  183. package/lib/accumulate.js +0 -46
  184. package/lib/accumulateInto.js +0 -58
  185. package/lib/adler32.js +0 -44
  186. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  187. package/lib/createReactNativeComponentClass.js +0 -42
  188. package/lib/dangerousStyleValue.js +0 -79
  189. package/lib/escapeTextContentForBrowser.js +0 -123
  190. package/lib/findDOMNode.js +0 -60
  191. package/lib/findNodeHandle.js +0 -91
  192. package/lib/forEachAccumulated.js +0 -31
  193. package/lib/getEventCharCode.js +0 -50
  194. package/lib/getEventKey.js +0 -102
  195. package/lib/getEventModifierState.js +0 -43
  196. package/lib/getEventTarget.js +0 -35
  197. package/lib/getHostComponentFromComposite.js +0 -30
  198. package/lib/getNodeForCharacterOffset.js +0 -74
  199. package/lib/getTestDocument.js +0 -21
  200. package/lib/getTextContentAccessor.js +0 -33
  201. package/lib/getVendorPrefixedEventName.js +0 -101
  202. package/lib/instantiateReactComponent.js +0 -119
  203. package/lib/isEventSupported.js +0 -60
  204. package/lib/isTextInputElement.js +0 -51
  205. package/lib/quoteAttributeValueForBrowser.js +0 -26
  206. package/lib/reactComponentExpect.js +0 -217
  207. package/lib/setInnerHTML.js +0 -98
  208. package/lib/setTextContent.js +0 -48
  209. package/lib/shouldUpdateReactComponent.js +0 -42
  210. package/lib/validateDOMNesting.js +0 -382
@@ -1,39 +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 SyntheticAnimationEvent
10
- */
11
-
12
- 'use strict';
13
-
14
- var SyntheticEvent = require('./SyntheticEvent');
15
-
16
- /**
17
- * @interface Event
18
- * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
19
- * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
20
- */
21
- var AnimationEventInterface = {
22
- animationName: null,
23
- elapsedTime: null,
24
- pseudoElement: null
25
- };
26
-
27
- /**
28
- * @param {object} dispatchConfig Configuration used to dispatch this event.
29
- * @param {string} dispatchMarker Marker identifying the event target.
30
- * @param {object} nativeEvent Native browser event.
31
- * @extends {SyntheticEvent}
32
- */
33
- function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
34
- return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
35
- }
36
-
37
- SyntheticEvent.augmentClass(SyntheticAnimationEvent, AnimationEventInterface);
38
-
39
- module.exports = SyntheticAnimationEvent;
@@ -1,38 +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 SyntheticClipboardEvent
10
- */
11
-
12
- 'use strict';
13
-
14
- var SyntheticEvent = require('./SyntheticEvent');
15
-
16
- /**
17
- * @interface Event
18
- * @see http://www.w3.org/TR/clipboard-apis/
19
- */
20
- var ClipboardEventInterface = {
21
- clipboardData: function (event) {
22
- return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
23
- }
24
- };
25
-
26
- /**
27
- * @param {object} dispatchConfig Configuration used to dispatch this event.
28
- * @param {string} dispatchMarker Marker identifying the event target.
29
- * @param {object} nativeEvent Native browser event.
30
- * @extends {SyntheticUIEvent}
31
- */
32
- function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
33
- return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
34
- }
35
-
36
- SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
37
-
38
- module.exports = SyntheticClipboardEvent;
@@ -1,36 +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 SyntheticCompositionEvent
10
- */
11
-
12
- 'use strict';
13
-
14
- var SyntheticEvent = require('./SyntheticEvent');
15
-
16
- /**
17
- * @interface Event
18
- * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
19
- */
20
- var CompositionEventInterface = {
21
- data: null
22
- };
23
-
24
- /**
25
- * @param {object} dispatchConfig Configuration used to dispatch this event.
26
- * @param {string} dispatchMarker Marker identifying the event target.
27
- * @param {object} nativeEvent Native browser event.
28
- * @extends {SyntheticUIEvent}
29
- */
30
- function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
31
- return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
32
- }
33
-
34
- SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
35
-
36
- module.exports = SyntheticCompositionEvent;
@@ -1,36 +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 SyntheticDragEvent
10
- */
11
-
12
- 'use strict';
13
-
14
- var SyntheticMouseEvent = require('./SyntheticMouseEvent');
15
-
16
- /**
17
- * @interface DragEvent
18
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
19
- */
20
- var DragEventInterface = {
21
- dataTransfer: null
22
- };
23
-
24
- /**
25
- * @param {object} dispatchConfig Configuration used to dispatch this event.
26
- * @param {string} dispatchMarker Marker identifying the event target.
27
- * @param {object} nativeEvent Native browser event.
28
- * @extends {SyntheticUIEvent}
29
- */
30
- function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
31
- return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
32
- }
33
-
34
- SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
35
-
36
- module.exports = SyntheticDragEvent;
@@ -1,268 +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 SyntheticEvent
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var PooledClass = require('./PooledClass');
17
-
18
- var emptyFunction = require('fbjs/lib/emptyFunction');
19
- var warning = require('fbjs/lib/warning');
20
-
21
- var didWarnForAddedNewProperty = false;
22
- var isProxySupported = typeof Proxy === 'function';
23
-
24
- var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
25
-
26
- /**
27
- * @interface Event
28
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
29
- */
30
- var EventInterface = {
31
- type: null,
32
- target: null,
33
- // currentTarget is set when dispatching; no use in copying it here
34
- currentTarget: emptyFunction.thatReturnsNull,
35
- eventPhase: null,
36
- bubbles: null,
37
- cancelable: null,
38
- timeStamp: function (event) {
39
- return event.timeStamp || Date.now();
40
- },
41
- defaultPrevented: null,
42
- isTrusted: null
43
- };
44
-
45
- /**
46
- * Synthetic events are dispatched by event plugins, typically in response to a
47
- * top-level event delegation handler.
48
- *
49
- * These systems should generally use pooling to reduce the frequency of garbage
50
- * collection. The system should check `isPersistent` to determine whether the
51
- * event should be released into the pool after being dispatched. Users that
52
- * need a persisted event should invoke `persist`.
53
- *
54
- * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
55
- * normalizing browser quirks. Subclasses do not necessarily have to implement a
56
- * DOM interface; custom application-specific events can also subclass this.
57
- *
58
- * @param {object} dispatchConfig Configuration used to dispatch this event.
59
- * @param {*} targetInst Marker identifying the event target.
60
- * @param {object} nativeEvent Native browser event.
61
- * @param {DOMEventTarget} nativeEventTarget Target node.
62
- */
63
- function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarget) {
64
- if (process.env.NODE_ENV !== 'production') {
65
- // these have a getter/setter for warnings
66
- delete this.nativeEvent;
67
- delete this.preventDefault;
68
- delete this.stopPropagation;
69
- }
70
-
71
- this.dispatchConfig = dispatchConfig;
72
- this._targetInst = targetInst;
73
- this.nativeEvent = nativeEvent;
74
-
75
- var Interface = this.constructor.Interface;
76
- for (var propName in Interface) {
77
- if (!Interface.hasOwnProperty(propName)) {
78
- continue;
79
- }
80
- if (process.env.NODE_ENV !== 'production') {
81
- delete this[propName]; // this has a getter/setter for warnings
82
- }
83
- var normalize = Interface[propName];
84
- if (normalize) {
85
- this[propName] = normalize(nativeEvent);
86
- } else {
87
- if (propName === 'target') {
88
- this.target = nativeEventTarget;
89
- } else {
90
- this[propName] = nativeEvent[propName];
91
- }
92
- }
93
- }
94
-
95
- var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
96
- if (defaultPrevented) {
97
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
98
- } else {
99
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
100
- }
101
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
102
- return this;
103
- }
104
-
105
- _assign(SyntheticEvent.prototype, {
106
-
107
- preventDefault: function () {
108
- this.defaultPrevented = true;
109
- var event = this.nativeEvent;
110
- if (!event) {
111
- return;
112
- }
113
-
114
- if (event.preventDefault) {
115
- event.preventDefault();
116
- } else if (typeof event.returnValue !== 'unknown') {
117
- // eslint-disable-line valid-typeof
118
- event.returnValue = false;
119
- }
120
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
121
- },
122
-
123
- stopPropagation: function () {
124
- var event = this.nativeEvent;
125
- if (!event) {
126
- return;
127
- }
128
-
129
- if (event.stopPropagation) {
130
- event.stopPropagation();
131
- } else if (typeof event.cancelBubble !== 'unknown') {
132
- // eslint-disable-line valid-typeof
133
- // The ChangeEventPlugin registers a "propertychange" event for
134
- // IE. This event does not support bubbling or cancelling, and
135
- // any references to cancelBubble throw "Member not found". A
136
- // typeof check of "unknown" circumvents this issue (and is also
137
- // IE specific).
138
- event.cancelBubble = true;
139
- }
140
-
141
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
142
- },
143
-
144
- /**
145
- * We release all dispatched `SyntheticEvent`s after each event loop, adding
146
- * them back into the pool. This allows a way to hold onto a reference that
147
- * won't be added back into the pool.
148
- */
149
- persist: function () {
150
- this.isPersistent = emptyFunction.thatReturnsTrue;
151
- },
152
-
153
- /**
154
- * Checks if this event should be released back into the pool.
155
- *
156
- * @return {boolean} True if this should not be released, false otherwise.
157
- */
158
- isPersistent: emptyFunction.thatReturnsFalse,
159
-
160
- /**
161
- * `PooledClass` looks for `destructor` on each instance it releases.
162
- */
163
- destructor: function () {
164
- var Interface = this.constructor.Interface;
165
- for (var propName in Interface) {
166
- if (process.env.NODE_ENV !== 'production') {
167
- Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
168
- } else {
169
- this[propName] = null;
170
- }
171
- }
172
- for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
173
- this[shouldBeReleasedProperties[i]] = null;
174
- }
175
- if (process.env.NODE_ENV !== 'production') {
176
- Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
177
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
178
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
179
- }
180
- }
181
-
182
- });
183
-
184
- SyntheticEvent.Interface = EventInterface;
185
-
186
- if (process.env.NODE_ENV !== 'production') {
187
- if (isProxySupported) {
188
- /*eslint-disable no-func-assign */
189
- SyntheticEvent = new Proxy(SyntheticEvent, {
190
- construct: function (target, args) {
191
- return this.apply(target, Object.create(target.prototype), args);
192
- },
193
- apply: function (constructor, that, args) {
194
- return new Proxy(constructor.apply(that, args), {
195
- set: function (target, prop, value) {
196
- if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
197
- process.env.NODE_ENV !== 'production' ? warning(didWarnForAddedNewProperty || target.isPersistent(), 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re adding a new property in the synthetic event object. ' + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.') : void 0;
198
- didWarnForAddedNewProperty = true;
199
- }
200
- target[prop] = value;
201
- return true;
202
- }
203
- });
204
- }
205
- });
206
- /*eslint-enable no-func-assign */
207
- }
208
- }
209
- /**
210
- * Helper to reduce boilerplate when creating subclasses.
211
- *
212
- * @param {function} Class
213
- * @param {?object} Interface
214
- */
215
- SyntheticEvent.augmentClass = function (Class, Interface) {
216
- var Super = this;
217
-
218
- var E = function () {};
219
- E.prototype = Super.prototype;
220
- var prototype = new E();
221
-
222
- _assign(prototype, Class.prototype);
223
- Class.prototype = prototype;
224
- Class.prototype.constructor = Class;
225
-
226
- Class.Interface = _assign({}, Super.Interface, Interface);
227
- Class.augmentClass = Super.augmentClass;
228
-
229
- PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
230
- };
231
-
232
- PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
233
-
234
- module.exports = SyntheticEvent;
235
-
236
- /**
237
- * Helper to nullify syntheticEvent instance properties when destructing
238
- *
239
- * @param {object} SyntheticEvent
240
- * @param {String} propName
241
- * @return {object} defineProperty object
242
- */
243
- function getPooledWarningPropertyDefinition(propName, getVal) {
244
- var isFunction = typeof getVal === 'function';
245
- return {
246
- configurable: true,
247
- set: set,
248
- get: get
249
- };
250
-
251
- function set(val) {
252
- var action = isFunction ? 'setting the method' : 'setting the property';
253
- warn(action, 'This is effectively a no-op');
254
- return val;
255
- }
256
-
257
- function get() {
258
- var action = isFunction ? 'accessing the method' : 'accessing the property';
259
- var result = isFunction ? 'This is a no-op function' : 'This is set to null';
260
- warn(action, result);
261
- return getVal;
262
- }
263
-
264
- function warn(action, result) {
265
- var warningCondition = false;
266
- process.env.NODE_ENV !== 'production' ? warning(warningCondition, 'This synthetic event is reused for performance reasons. If you\'re seeing this, ' + 'you\'re %s `%s` on a released/nullified synthetic event. %s. ' + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
267
- }
268
- }
@@ -1,36 +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 SyntheticFocusEvent
10
- */
11
-
12
- 'use strict';
13
-
14
- var SyntheticUIEvent = require('./SyntheticUIEvent');
15
-
16
- /**
17
- * @interface FocusEvent
18
- * @see http://www.w3.org/TR/DOM-Level-3-Events/
19
- */
20
- var FocusEventInterface = {
21
- relatedTarget: null
22
- };
23
-
24
- /**
25
- * @param {object} dispatchConfig Configuration used to dispatch this event.
26
- * @param {string} dispatchMarker Marker identifying the event target.
27
- * @param {object} nativeEvent Native browser event.
28
- * @extends {SyntheticUIEvent}
29
- */
30
- function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
31
- return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
32
- }
33
-
34
- SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
35
-
36
- module.exports = SyntheticFocusEvent;