react 0.14.0-alpha3 → 0.14.0-rc1
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/README.md +5 -2
- package/addons.js +8 -3
- package/dist/react-dom.js +42 -0
- package/dist/react-dom.min.js +12 -0
- package/dist/react-with-addons.js +6076 -5337
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +5445 -4839
- package/dist/react.min.js +6 -5
- package/lib/{AutoFocusMixin.js → AutoFocusUtils.js} +15 -5
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +22 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +18 -15
- package/lib/DOMChildrenOperations.js +17 -7
- package/lib/DOMProperty.js +82 -117
- package/lib/DOMPropertyOperations.js +84 -33
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +21 -13
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +17 -20
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +33 -42
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +19 -3
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +50 -38
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +15 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +56 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +75 -35
- package/lib/ReactClass.js +70 -87
- package/lib/ReactComponent.js +27 -20
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +3 -3
- package/lib/ReactCompositeComponent.js +117 -106
- package/lib/ReactDOM.js +74 -158
- package/lib/ReactDOMButton.js +15 -26
- package/lib/ReactDOMComponent.js +441 -72
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -66
- package/lib/ReactDOMInput.js +87 -99
- package/lib/ReactDOMOption.js +25 -44
- package/lib/ReactDOMSelect.js +88 -98
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +48 -61
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -72
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -11
- package/lib/ReactElement.js +92 -107
- package/lib/ReactElementValidator.js +53 -173
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +45 -9
- package/lib/ReactEventEmitterMixin.js +3 -4
- package/lib/ReactEventListener.js +64 -12
- package/lib/ReactFragment.js +29 -115
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +8 -7
- package/lib/ReactInstanceHandles.js +12 -12
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +196 -122
- package/lib/ReactMultiChild.js +119 -25
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -8
- package/lib/ReactNoopUpdateQueue.js +118 -0
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +41 -12
- package/lib/ReactReconcileTransaction.js +12 -10
- package/lib/ReactReconciler.js +8 -11
- package/lib/ReactRef.js +15 -2
- package/lib/ReactServerBatchingStrategy.js +23 -0
- package/lib/ReactServerRendering.js +22 -9
- package/lib/ReactServerRenderingTransaction.js +8 -7
- package/lib/ReactTestUtils.js +89 -64
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +60 -35
- package/lib/ReactUpdates.js +15 -18
- package/lib/{isTextNode.js → ReactVersion.js} +2 -13
- package/lib/ReactWithAddons.js +24 -17
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +25 -16
- package/lib/SimpleEventPlugin.js +200 -45
- package/lib/SyntheticClipboardEvent.js +3 -3
- package/lib/SyntheticCompositionEvent.js +3 -3
- package/lib/SyntheticDragEvent.js +3 -3
- package/lib/SyntheticEvent.js +24 -8
- package/lib/SyntheticFocusEvent.js +3 -3
- package/lib/SyntheticInputEvent.js +3 -3
- package/lib/SyntheticKeyboardEvent.js +6 -6
- package/lib/SyntheticMouseEvent.js +5 -5
- package/lib/SyntheticTouchEvent.js +4 -4
- package/lib/SyntheticUIEvent.js +4 -4
- package/lib/SyntheticWheelEvent.js +3 -3
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +17 -11
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +12 -7
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +48 -0
- package/lib/findDOMNode.js +11 -12
- package/lib/flattenChildren.js +4 -4
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getEventCharCode.js +1 -1
- package/lib/getEventKey.js +1 -1
- package/lib/getEventModifierState.js +0 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +27 -25
- package/lib/isEventSupported.js +1 -1
- package/lib/isTextInputElement.js +2 -1
- package/lib/joinClasses.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +216 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +2 -2
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +34 -0
- package/lib/traverseAllChildren.js +21 -19
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +2 -0
- package/addons/CSSTransitionGroup.js +0 -1
- package/addons/LinkedStateMixin.js +0 -1
- package/addons/Perf.js +0 -1
- package/addons/PureRenderMixin.js +0 -1
- package/addons/TestUtils.js +0 -1
- package/addons/TransitionGroup.js +0 -1
- package/addons/batchedUpdates.js +0 -1
- package/addons/cloneWithProps.js +0 -1
- package/addons/createFragment.js +0 -1
- package/addons/renderSubtreeIntoContainer.js +0 -1
- package/addons/shallowCompare.js +0 -1
- package/addons/update.js +0 -1
- package/dist/JSXTransformer.js +0 -17589
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/LocalEventTrapMixin.js +0 -46
- package/lib/ReactContext.js +0 -32
- package/lib/ReactDOMClient.js +0 -85
- package/lib/ReactDOMForm.js +0 -47
- package/lib/ReactDOMIframe.js +0 -43
- package/lib/ReactDOMImg.js +0 -44
- package/lib/ReactLifeCycle.js +0 -35
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createFullPageComponent.js +0 -51
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -115
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -61
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var invariant = require(
|
|
15
|
+
var invariant = require('fbjs/lib/invariant');
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Injectable ordering of event plugins.
|
|
@@ -37,15 +37,15 @@ function recomputePluginOrdering() {
|
|
|
37
37
|
for (var pluginName in namesToPlugins) {
|
|
38
38
|
var PluginModule = namesToPlugins[pluginName];
|
|
39
39
|
var pluginIndex = EventPluginOrder.indexOf(pluginName);
|
|
40
|
-
!(pluginIndex > -1) ?
|
|
40
|
+
!(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
|
|
41
41
|
if (EventPluginRegistry.plugins[pluginIndex]) {
|
|
42
42
|
continue;
|
|
43
43
|
}
|
|
44
|
-
!PluginModule.extractEvents ?
|
|
44
|
+
!PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
|
|
45
45
|
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
|
|
46
46
|
var publishedEvents = PluginModule.eventTypes;
|
|
47
47
|
for (var eventName in publishedEvents) {
|
|
48
|
-
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ?
|
|
48
|
+
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -59,7 +59,7 @@ function recomputePluginOrdering() {
|
|
|
59
59
|
* @private
|
|
60
60
|
*/
|
|
61
61
|
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
|
62
|
-
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ?
|
|
62
|
+
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
|
|
63
63
|
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
|
|
64
64
|
|
|
65
65
|
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
|
@@ -87,7 +87,7 @@ function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
|
|
87
87
|
* @private
|
|
88
88
|
*/
|
|
89
89
|
function publishRegistrationName(registrationName, PluginModule, eventName) {
|
|
90
|
-
!!EventPluginRegistry.registrationNameModules[registrationName] ?
|
|
90
|
+
!!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
|
|
91
91
|
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
|
|
92
92
|
EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
|
|
93
93
|
}
|
|
@@ -129,7 +129,7 @@ var EventPluginRegistry = {
|
|
|
129
129
|
* @see {EventPluginHub.injection.injectEventPluginOrder}
|
|
130
130
|
*/
|
|
131
131
|
injectEventPluginOrder: function (InjectedEventPluginOrder) {
|
|
132
|
-
!!EventPluginOrder ?
|
|
132
|
+
!!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
|
|
133
133
|
// Clone the ordering so it cannot be dynamically mutated.
|
|
134
134
|
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
|
|
135
135
|
recomputePluginOrdering();
|
|
@@ -153,7 +153,7 @@ var EventPluginRegistry = {
|
|
|
153
153
|
}
|
|
154
154
|
var PluginModule = injectedNamesToPlugins[pluginName];
|
|
155
155
|
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
|
|
156
|
-
!!namesToPlugins[pluginName] ?
|
|
156
|
+
!!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
|
|
157
157
|
namesToPlugins[pluginName] = PluginModule;
|
|
158
158
|
isOrderingDirty = true;
|
|
159
159
|
}
|
package/lib/EventPluginUtils.js
CHANGED
|
@@ -11,10 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var ReactErrorUtils = require('./ReactErrorUtils');
|
|
15
16
|
|
|
16
|
-
var invariant = require(
|
|
17
|
-
var warning = require(
|
|
17
|
+
var invariant = require('fbjs/lib/invariant');
|
|
18
|
+
var warning = require('fbjs/lib/warning');
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Injected dependencies:
|
|
@@ -28,8 +29,8 @@ var injection = {
|
|
|
28
29
|
Mount: null,
|
|
29
30
|
injectMount: function (InjectedMount) {
|
|
30
31
|
injection.Mount = InjectedMount;
|
|
31
|
-
if (
|
|
32
|
-
|
|
32
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
33
|
+
process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
};
|
|
@@ -48,7 +49,7 @@ function isStartish(topLevelType) {
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
var validateEventDispatches;
|
|
51
|
-
if (
|
|
52
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
52
53
|
validateEventDispatches = function (event) {
|
|
53
54
|
var dispatchListeners = event._dispatchListeners;
|
|
54
55
|
var dispatchIDs = event._dispatchIDs;
|
|
@@ -58,19 +59,30 @@ if ('production' !== process.env.NODE_ENV) {
|
|
|
58
59
|
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
|
|
59
60
|
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
|
|
62
63
|
};
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* Dispatch the event to the listener.
|
|
68
|
+
* @param {SyntheticEvent} event SyntheticEvent to handle
|
|
69
|
+
* @param {function} listener Application-level callback
|
|
70
|
+
* @param {string} domID DOM id to pass to the callback.
|
|
69
71
|
*/
|
|
70
|
-
function
|
|
72
|
+
function executeDispatch(event, listener, domID) {
|
|
73
|
+
var type = event.type || 'unknown-event';
|
|
74
|
+
event.currentTarget = injection.Mount.getNode(domID);
|
|
75
|
+
ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
|
|
76
|
+
event.currentTarget = null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Standard/simple iteration through an event's collected dispatches.
|
|
81
|
+
*/
|
|
82
|
+
function executeDispatchesInOrder(event) {
|
|
71
83
|
var dispatchListeners = event._dispatchListeners;
|
|
72
84
|
var dispatchIDs = event._dispatchIDs;
|
|
73
|
-
if (
|
|
85
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
74
86
|
validateEventDispatches(event);
|
|
75
87
|
}
|
|
76
88
|
if (Array.isArray(dispatchListeners)) {
|
|
@@ -79,31 +91,11 @@ function forEachEventDispatch(event, cb) {
|
|
|
79
91
|
break;
|
|
80
92
|
}
|
|
81
93
|
// Listeners and IDs are two parallel arrays that are always in sync.
|
|
82
|
-
|
|
94
|
+
executeDispatch(event, dispatchListeners[i], dispatchIDs[i]);
|
|
83
95
|
}
|
|
84
96
|
} else if (dispatchListeners) {
|
|
85
|
-
|
|
97
|
+
executeDispatch(event, dispatchListeners, dispatchIDs);
|
|
86
98
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Default implementation of PluginModule.executeDispatch().
|
|
91
|
-
* @param {SyntheticEvent} SyntheticEvent to handle
|
|
92
|
-
* @param {function} Application-level callback
|
|
93
|
-
* @param {string} domID DOM id to pass to the callback.
|
|
94
|
-
*/
|
|
95
|
-
function executeDispatch(event, listener, domID) {
|
|
96
|
-
event.currentTarget = injection.Mount.getNode(domID);
|
|
97
|
-
var returnValue = listener(event, domID);
|
|
98
|
-
event.currentTarget = null;
|
|
99
|
-
return returnValue;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Standard/simple iteration through an event's collected dispatches.
|
|
104
|
-
*/
|
|
105
|
-
function executeDispatchesInOrder(event, cb) {
|
|
106
|
-
forEachEventDispatch(event, cb);
|
|
107
99
|
event._dispatchListeners = null;
|
|
108
100
|
event._dispatchIDs = null;
|
|
109
101
|
}
|
|
@@ -112,13 +104,13 @@ function executeDispatchesInOrder(event, cb) {
|
|
|
112
104
|
* Standard/simple iteration through an event's collected dispatches, but stops
|
|
113
105
|
* at the first dispatch execution returning true, and returns that id.
|
|
114
106
|
*
|
|
115
|
-
* @return id of the first dispatch execution who's listener returns
|
|
116
|
-
* null if no listener returned true.
|
|
107
|
+
* @return {?string} id of the first dispatch execution who's listener returns
|
|
108
|
+
* true, or null if no listener returned true.
|
|
117
109
|
*/
|
|
118
110
|
function executeDispatchesInOrderStopAtTrueImpl(event) {
|
|
119
111
|
var dispatchListeners = event._dispatchListeners;
|
|
120
112
|
var dispatchIDs = event._dispatchIDs;
|
|
121
|
-
if (
|
|
113
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
122
114
|
validateEventDispatches(event);
|
|
123
115
|
}
|
|
124
116
|
if (Array.isArray(dispatchListeners)) {
|
|
@@ -156,15 +148,15 @@ function executeDispatchesInOrderStopAtTrue(event) {
|
|
|
156
148
|
* return values at each dispatch execution, but it does tend to make sense when
|
|
157
149
|
* dealing with "direct" dispatches.
|
|
158
150
|
*
|
|
159
|
-
* @return The return value of executing the single dispatch.
|
|
151
|
+
* @return {*} The return value of executing the single dispatch.
|
|
160
152
|
*/
|
|
161
153
|
function executeDirectDispatch(event) {
|
|
162
|
-
if (
|
|
154
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
163
155
|
validateEventDispatches(event);
|
|
164
156
|
}
|
|
165
157
|
var dispatchListener = event._dispatchListeners;
|
|
166
158
|
var dispatchID = event._dispatchIDs;
|
|
167
|
-
!!Array.isArray(dispatchListener) ?
|
|
159
|
+
!!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
|
|
168
160
|
var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
|
|
169
161
|
event._dispatchListeners = null;
|
|
170
162
|
event._dispatchIDs = null;
|
|
@@ -173,7 +165,7 @@ function executeDirectDispatch(event) {
|
|
|
173
165
|
|
|
174
166
|
/**
|
|
175
167
|
* @param {SyntheticEvent} event
|
|
176
|
-
* @return {
|
|
168
|
+
* @return {boolean} True iff number of dispatches accumulated is greater than 0.
|
|
177
169
|
*/
|
|
178
170
|
function hasDispatches(event) {
|
|
179
171
|
return !!event._dispatchListeners;
|
|
@@ -188,7 +180,6 @@ var EventPluginUtils = {
|
|
|
188
180
|
isStartish: isStartish,
|
|
189
181
|
|
|
190
182
|
executeDirectDispatch: executeDirectDispatch,
|
|
191
|
-
executeDispatch: executeDispatch,
|
|
192
183
|
executeDispatchesInOrder: executeDispatchesInOrder,
|
|
193
184
|
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
|
|
194
185
|
hasDispatches: hasDispatches,
|
package/lib/EventPropagators.js
CHANGED
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
15
|
-
var EventPluginHub = require(
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var EventPluginHub = require('./EventPluginHub');
|
|
16
16
|
|
|
17
|
-
var warning = require(
|
|
17
|
+
var warning = require('fbjs/lib/warning');
|
|
18
18
|
|
|
19
|
-
var accumulateInto = require(
|
|
20
|
-
var forEachAccumulated = require(
|
|
19
|
+
var accumulateInto = require('./accumulateInto');
|
|
20
|
+
var forEachAccumulated = require('./forEachAccumulated');
|
|
21
21
|
|
|
22
22
|
var PropagationPhases = EventConstants.PropagationPhases;
|
|
23
23
|
var getListener = EventPluginHub.getListener;
|
|
@@ -38,8 +38,8 @@ function listenerAtPhase(id, event, propagationPhase) {
|
|
|
38
38
|
* "dispatch" object that pairs the event with the listener.
|
|
39
39
|
*/
|
|
40
40
|
function accumulateDirectionalDispatches(domID, upwards, event) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
41
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
42
|
+
process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
|
|
43
43
|
}
|
|
44
44
|
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
|
|
45
45
|
var listener = listenerAtPhase(domID, event, phase);
|
|
@@ -52,7 +52,7 @@ function accumulateDirectionalDispatches(domID, upwards, event) {
|
|
|
52
52
|
/**
|
|
53
53
|
* Collect dispatches (must be entirely collected before dispatching - see unit
|
|
54
54
|
* tests). Lazily allocate the array to conserve memory. We must loop through
|
|
55
|
-
* each event and perform the traversal for each one. We
|
|
55
|
+
* each event and perform the traversal for each one. We cannot perform a
|
|
56
56
|
* single traversal for the entire collection of events because each event may
|
|
57
57
|
* have a different target.
|
|
58
58
|
*/
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var PooledClass = require(
|
|
15
|
+
var PooledClass = require('./PooledClass');
|
|
16
16
|
|
|
17
|
-
var assign = require(
|
|
18
|
-
var getTextContentAccessor = require(
|
|
17
|
+
var assign = require('./Object.assign');
|
|
18
|
+
var getTextContentAccessor = require('./getTextContentAccessor');
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* This helper class stores information about text content of a target node,
|
|
@@ -35,6 +35,12 @@ function FallbackCompositionState(root) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
assign(FallbackCompositionState.prototype, {
|
|
38
|
+
destructor: function () {
|
|
39
|
+
this._root = null;
|
|
40
|
+
this._startText = null;
|
|
41
|
+
this._fallbackText = null;
|
|
42
|
+
},
|
|
43
|
+
|
|
38
44
|
/**
|
|
39
45
|
* Get current text of input.
|
|
40
46
|
*
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var DOMProperty = require(
|
|
15
|
-
var ExecutionEnvironment = require(
|
|
14
|
+
var DOMProperty = require('./DOMProperty');
|
|
15
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
16
16
|
|
|
17
17
|
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
|
18
18
|
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
|
@@ -43,13 +43,14 @@ var HTMLDOMPropertyConfig = {
|
|
|
43
43
|
alt: null,
|
|
44
44
|
async: HAS_BOOLEAN_VALUE,
|
|
45
45
|
autoComplete: null,
|
|
46
|
-
// autoFocus is polyfilled/normalized by
|
|
46
|
+
// autoFocus is polyfilled/normalized by AutoFocusUtils
|
|
47
47
|
// autoFocus: HAS_BOOLEAN_VALUE,
|
|
48
48
|
autoPlay: HAS_BOOLEAN_VALUE,
|
|
49
49
|
capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
|
50
50
|
cellPadding: null,
|
|
51
51
|
cellSpacing: null,
|
|
52
52
|
charSet: MUST_USE_ATTRIBUTE,
|
|
53
|
+
challenge: MUST_USE_ATTRIBUTE,
|
|
53
54
|
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
|
54
55
|
classID: MUST_USE_ATTRIBUTE,
|
|
55
56
|
// To set className on SVG elements, it's necessary to use .setAttribute;
|
|
@@ -91,6 +92,10 @@ var HTMLDOMPropertyConfig = {
|
|
|
91
92
|
httpEquiv: null,
|
|
92
93
|
icon: null,
|
|
93
94
|
id: MUST_USE_PROPERTY,
|
|
95
|
+
inputMode: MUST_USE_ATTRIBUTE,
|
|
96
|
+
is: MUST_USE_ATTRIBUTE,
|
|
97
|
+
keyParams: MUST_USE_ATTRIBUTE,
|
|
98
|
+
keyType: MUST_USE_ATTRIBUTE,
|
|
94
99
|
label: null,
|
|
95
100
|
lang: null,
|
|
96
101
|
list: MUST_USE_ATTRIBUTE,
|
|
@@ -140,6 +145,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
140
145
|
start: HAS_NUMERIC_VALUE,
|
|
141
146
|
step: null,
|
|
142
147
|
style: null,
|
|
148
|
+
summary: null,
|
|
143
149
|
tabIndex: null,
|
|
144
150
|
target: null,
|
|
145
151
|
title: null,
|
|
@@ -148,6 +154,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
148
154
|
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
|
|
149
155
|
width: MUST_USE_ATTRIBUTE,
|
|
150
156
|
wmode: MUST_USE_ATTRIBUTE,
|
|
157
|
+
wrap: null,
|
|
151
158
|
|
|
152
159
|
/**
|
|
153
160
|
* Non-standard Properties
|
|
@@ -156,6 +163,8 @@ var HTMLDOMPropertyConfig = {
|
|
|
156
163
|
// keyboard hints.
|
|
157
164
|
autoCapitalize: null,
|
|
158
165
|
autoCorrect: null,
|
|
166
|
+
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
|
|
167
|
+
autoSave: null,
|
|
159
168
|
// itemProp, itemScope, itemType are for
|
|
160
169
|
// Microdata support. See http://schema.org/docs/gs.html
|
|
161
170
|
itemProp: MUST_USE_ATTRIBUTE,
|
|
@@ -168,6 +177,12 @@ var HTMLDOMPropertyConfig = {
|
|
|
168
177
|
itemRef: MUST_USE_ATTRIBUTE,
|
|
169
178
|
// property is supported for OpenGraph in meta tags.
|
|
170
179
|
property: null,
|
|
180
|
+
// results show looking glass icon and recent searches on input
|
|
181
|
+
// search fields in WebKit/Blink
|
|
182
|
+
results: null,
|
|
183
|
+
// IE-only attribute that specifies security restrictions on an iframe
|
|
184
|
+
// as an alternative to the sandbox attribute on IE<10
|
|
185
|
+
security: MUST_USE_ATTRIBUTE,
|
|
171
186
|
// IE-only attribute that controls focus behavior
|
|
172
187
|
unselectable: MUST_USE_ATTRIBUTE
|
|
173
188
|
},
|
|
@@ -183,6 +198,7 @@ var HTMLDOMPropertyConfig = {
|
|
|
183
198
|
autoCorrect: 'autocorrect',
|
|
184
199
|
autoFocus: 'autofocus',
|
|
185
200
|
autoPlay: 'autoplay',
|
|
201
|
+
autoSave: 'autosave',
|
|
186
202
|
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
|
|
187
203
|
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
|
|
188
204
|
encType: 'encoding',
|
package/lib/LinkedStateMixin.js
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactLink = require(
|
|
16
|
-
var ReactStateSetters = require(
|
|
15
|
+
var ReactLink = require('./ReactLink');
|
|
16
|
+
var ReactStateSetters = require('./ReactStateSetters');
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A simple mixin around ReactLink.forState().
|
package/lib/LinkedValueUtils.js
CHANGED
|
@@ -12,9 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
'use strict';
|
|
14
14
|
|
|
15
|
-
var ReactPropTypes = require(
|
|
15
|
+
var ReactPropTypes = require('./ReactPropTypes');
|
|
16
|
+
var ReactPropTypeLocations = require('./ReactPropTypeLocations');
|
|
16
17
|
|
|
17
|
-
var invariant = require(
|
|
18
|
+
var invariant = require('fbjs/lib/invariant');
|
|
19
|
+
var warning = require('fbjs/lib/warning');
|
|
18
20
|
|
|
19
21
|
var hasReadOnlyValue = {
|
|
20
22
|
'button': true,
|
|
@@ -27,32 +29,43 @@ var hasReadOnlyValue = {
|
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
function _assertSingleLink(inputProps) {
|
|
30
|
-
!(inputProps.checkedLink == null || inputProps.valueLink == null) ?
|
|
32
|
+
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
|
|
31
33
|
}
|
|
32
34
|
function _assertValueLink(inputProps) {
|
|
33
35
|
_assertSingleLink(inputProps);
|
|
34
|
-
!(inputProps.value == null && inputProps.onChange == null) ?
|
|
36
|
+
!(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
function _assertCheckedLink(inputProps) {
|
|
38
40
|
_assertSingleLink(inputProps);
|
|
39
|
-
!(inputProps.checked == null && inputProps.onChange == null) ?
|
|
41
|
+
!(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
44
|
+
var propTypes = {
|
|
45
|
+
value: function (props, propName, componentName) {
|
|
46
|
+
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
|
50
|
+
},
|
|
51
|
+
checked: function (props, propName, componentName) {
|
|
52
|
+
if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
|
56
|
+
},
|
|
57
|
+
onChange: ReactPropTypes.func
|
|
58
|
+
};
|
|
49
59
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
var loggedTypeFailures = {};
|
|
61
|
+
function getDeclarationErrorAddendum(owner) {
|
|
62
|
+
if (owner) {
|
|
63
|
+
var name = owner.getName();
|
|
64
|
+
if (name) {
|
|
65
|
+
return ' Check the render method of `' + name + '`.';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return '';
|
|
56
69
|
}
|
|
57
70
|
|
|
58
71
|
/**
|
|
@@ -60,21 +73,19 @@ function _handleLinkedCheckChange(e) {
|
|
|
60
73
|
* this outside of the ReactDOM controlled form components.
|
|
61
74
|
*/
|
|
62
75
|
var LinkedValueUtils = {
|
|
63
|
-
|
|
64
|
-
propTypes
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
onChange: ReactPropTypes.func
|
|
76
|
+
checkPropTypes: function (tagName, props, owner) {
|
|
77
|
+
for (var propName in propTypes) {
|
|
78
|
+
if (propTypes.hasOwnProperty(propName)) {
|
|
79
|
+
var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
|
|
80
|
+
}
|
|
81
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
82
|
+
// Only monitor this failure once because there tends to be a lot of the
|
|
83
|
+
// same error.
|
|
84
|
+
loggedTypeFailures[error.message] = true;
|
|
85
|
+
|
|
86
|
+
var addendum = getDeclarationErrorAddendum(owner);
|
|
87
|
+
process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
|
|
88
|
+
}
|
|
78
89
|
}
|
|
79
90
|
},
|
|
80
91
|
|
|
@@ -105,17 +116,18 @@ var LinkedValueUtils = {
|
|
|
105
116
|
|
|
106
117
|
/**
|
|
107
118
|
* @param {object} inputProps Props for form component
|
|
108
|
-
* @
|
|
119
|
+
* @param {SyntheticEvent} event change event to handle
|
|
109
120
|
*/
|
|
110
|
-
|
|
121
|
+
executeOnChange: function (inputProps, event) {
|
|
111
122
|
if (inputProps.valueLink) {
|
|
112
123
|
_assertValueLink(inputProps);
|
|
113
|
-
return
|
|
124
|
+
return inputProps.valueLink.requestChange(event.target.value);
|
|
114
125
|
} else if (inputProps.checkedLink) {
|
|
115
126
|
_assertCheckedLink(inputProps);
|
|
116
|
-
return
|
|
127
|
+
return inputProps.checkedLink.requestChange(event.target.checked);
|
|
128
|
+
} else if (inputProps.onChange) {
|
|
129
|
+
return inputProps.onChange.call(undefined, event);
|
|
117
130
|
}
|
|
118
|
-
return inputProps.onChange;
|
|
119
131
|
}
|
|
120
132
|
};
|
|
121
133
|
|