react 15.3.2 → 15.4.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react-with-addons.js +3864 -21390
- package/dist/react-with-addons.min.js +3 -6
- package/dist/react.js +2639 -19486
- package/dist/react.min.js +2 -6
- package/lib/KeyEscapeUtils.js +0 -1
- package/lib/LinkedStateMixin.js +1 -3
- package/lib/PooledClass.js +3 -1
- package/lib/React.js +0 -1
- package/lib/ReactAddonsDOMDependencies.js +35 -0
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
- package/lib/ReactCSSTransitionGroup.js +60 -43
- package/lib/ReactCSSTransitionGroupChild.js +2 -3
- package/lib/ReactChildren.js +0 -1
- package/lib/ReactClass.js +38 -54
- package/lib/ReactComponent.js +0 -1
- package/lib/ReactComponentTreeDevtool.js +0 -1
- package/lib/ReactComponentTreeHook.js +84 -101
- package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
- package/lib/ReactComponentWithPureRenderMixin.js +0 -1
- package/lib/ReactCurrentOwner.js +1 -2
- package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
- package/lib/ReactDOMFactories.js +0 -1
- package/lib/ReactElement.js +6 -14
- package/lib/ReactElementSymbol.js +19 -0
- package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
- package/lib/ReactElementValidator.js +1 -3
- package/lib/ReactFragment.js +0 -1
- package/lib/ReactLink.js +0 -1
- package/lib/ReactNoopUpdateQueue.js +0 -1
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +2 -12
- package/lib/ReactPropTypes.js +5 -3
- package/lib/ReactPropTypesSecret.js +1 -1
- package/lib/ReactPureComponent.js +0 -1
- package/lib/ReactStateSetters.js +0 -1
- package/lib/ReactTransitionChildMapping.js +0 -1
- package/lib/ReactTransitionEvents.js +1 -2
- package/lib/ReactTransitionGroup.js +145 -142
- package/lib/ReactUMDEntry.js +11 -6
- package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
- package/lib/ReactVersion.js +1 -2
- package/lib/ReactWithAddons.js +15 -3
- package/lib/ReactWithAddonsUMDEntry.js +11 -6
- package/lib/canDefineProperty.js +2 -1
- package/lib/checkReactTypeSpec.js +0 -1
- package/lib/deprecated.js +0 -1
- package/lib/flattenChildren.js +0 -1
- package/lib/getIteratorFn.js +0 -1
- package/lib/onlyChild.js +0 -1
- package/lib/reactProdInvariant.js +0 -1
- package/lib/shallowCompare.js +1 -2
- package/lib/sliceChildren.js +0 -1
- package/lib/traverseAllChildren.js +11 -3
- package/lib/update.js +6 -8
- package/package.json +1 -1
- package/lib/AutoFocusUtils.js +0 -24
- package/lib/BeforeInputEventPlugin.js +0 -390
- package/lib/CSSProperty.js +0 -148
- package/lib/CSSPropertyOperations.js +0 -205
- package/lib/CallbackQueue.js +0 -106
- package/lib/ChangeEventPlugin.js +0 -325
- package/lib/DOMChildrenOperations.js +0 -194
- package/lib/DOMLazyTree.js +0 -118
- package/lib/DOMProperty.js +0 -206
- package/lib/DOMPropertyOperations.js +0 -221
- package/lib/Danger.js +0 -48
- package/lib/DefaultEventPluginOrder.js +0 -27
- package/lib/DisabledInputUtils.js +0 -50
- package/lib/EnterLeaveEventPlugin.js +0 -105
- package/lib/EventConstants.js +0 -97
- package/lib/EventPluginHub.js +0 -251
- package/lib/EventPluginRegistry.js +0 -247
- package/lib/EventPluginUtils.js +0 -229
- package/lib/EventPropagators.js +0 -137
- package/lib/FallbackCompositionState.js +0 -95
- package/lib/HTMLDOMPropertyConfig.js +0 -212
- package/lib/LinkedValueUtils.js +0 -136
- package/lib/NativeMethodsMixin.js +0 -167
- package/lib/ReactBrowserEventEmitter.js +0 -330
- package/lib/ReactChildReconciler.js +0 -154
- package/lib/ReactChildrenMutationWarningHook.js +0 -54
- package/lib/ReactComponentBrowserEnvironment.js +0 -30
- package/lib/ReactComponentEnvironment.js +0 -45
- package/lib/ReactComponentTreeTestUtils.js +0 -87
- package/lib/ReactCompositeComponent.js +0 -904
- package/lib/ReactDOM.js +0 -110
- package/lib/ReactDOMButton.js +0 -24
- package/lib/ReactDOMComponent.js +0 -1006
- package/lib/ReactDOMComponentTree.js +0 -188
- package/lib/ReactDOMContainerInfo.js +0 -33
- package/lib/ReactDOMEmptyComponent.js +0 -60
- package/lib/ReactDOMFiber.js +0 -76
- package/lib/ReactDOMIDOperations.js +0 -34
- package/lib/ReactDOMInput.js +0 -269
- package/lib/ReactDOMNullInputValuePropHook.js +0 -43
- package/lib/ReactDOMOption.js +0 -123
- package/lib/ReactDOMSelect.js +0 -201
- package/lib/ReactDOMSelection.js +0 -212
- package/lib/ReactDOMServer.js +0 -26
- package/lib/ReactDOMTextComponent.js +0 -164
- package/lib/ReactDOMTextarea.js +0 -155
- package/lib/ReactDOMTreeTraversal.js +0 -136
- package/lib/ReactDOMUnknownPropertyHook.js +0 -112
- package/lib/ReactDebugTool.js +0 -301
- package/lib/ReactDefaultBatchingStrategy.js +0 -68
- package/lib/ReactDefaultInjection.js +0 -84
- package/lib/ReactEmptyComponent.js +0 -30
- package/lib/ReactErrorUtils.js +0 -76
- package/lib/ReactEventEmitterMixin.js +0 -33
- package/lib/ReactEventListener.js +0 -157
- package/lib/ReactFeatureFlags.js +0 -22
- package/lib/ReactHostComponent.js +0 -76
- package/lib/ReactHostOperationHistoryHook.js +0 -37
- package/lib/ReactInjection.js +0 -36
- package/lib/ReactInputSelection.js +0 -124
- package/lib/ReactInstanceHandles.js +0 -302
- package/lib/ReactInstanceMap.js +0 -48
- package/lib/ReactInstrumentation.js +0 -21
- package/lib/ReactInvalidSetStateWarningHook.js +0 -36
- package/lib/ReactMarkupChecksum.js +0 -50
- package/lib/ReactMount.js +0 -534
- package/lib/ReactMultiChild.js +0 -451
- package/lib/ReactMultiChildUpdateTypes.js +0 -32
- package/lib/ReactNative.js +0 -71
- package/lib/ReactNativeAttributePayload.js +0 -371
- package/lib/ReactNativeBaseComponent.js +0 -198
- package/lib/ReactNativeBridgeEventPlugin.js +0 -60
- package/lib/ReactNativeComponentEnvironment.js +0 -31
- package/lib/ReactNativeComponentTree.js +0 -68
- package/lib/ReactNativeContainerInfo.js +0 -21
- package/lib/ReactNativeDOMIDOperations.js +0 -79
- package/lib/ReactNativeDefaultInjection.js +0 -101
- package/lib/ReactNativeEventEmitter.js +0 -191
- package/lib/ReactNativeEventPluginOrder.js +0 -16
- package/lib/ReactNativeGlobalResponderHandler.js +0 -25
- package/lib/ReactNativeMount.js +0 -193
- package/lib/ReactNativePropRegistry.js +0 -52
- package/lib/ReactNativeReconcileTransaction.js +0 -129
- package/lib/ReactNativeTagHandles.js +0 -56
- package/lib/ReactNativeTextComponent.js +0 -71
- package/lib/ReactNativeTreeTraversal.js +0 -127
- package/lib/ReactNodeTypes.js +0 -40
- package/lib/ReactNoop.js +0 -173
- package/lib/ReactOwner.js +0 -94
- package/lib/ReactPerf.js +0 -494
- package/lib/ReactReconcileTransaction.js +0 -178
- package/lib/ReactReconciler.js +0 -168
- package/lib/ReactRef.js +0 -80
- package/lib/ReactServerBatchingStrategy.js +0 -22
- package/lib/ReactServerRendering.js +0 -90
- package/lib/ReactServerRenderingTransaction.js +0 -90
- package/lib/ReactServerUpdateQueue.js +0 -141
- package/lib/ReactSimpleEmptyComponent.js +0 -37
- package/lib/ReactTestMount.js +0 -126
- package/lib/ReactTestReconcileTransaction.js +0 -121
- package/lib/ReactTestRenderer.js +0 -144
- package/lib/ReactTestUtils.js +0 -518
- package/lib/ReactUpdateQueue.js +0 -226
- package/lib/ReactUpdates.js +0 -251
- package/lib/ResponderEventPlugin.js +0 -510
- package/lib/ResponderSyntheticEvent.js +0 -39
- package/lib/ResponderTouchHistoryStore.js +0 -184
- package/lib/SVGDOMPropertyConfig.js +0 -302
- package/lib/SelectEventPlugin.js +0 -196
- package/lib/SimpleEventPlugin.js +0 -635
- package/lib/SyntheticAnimationEvent.js +0 -39
- package/lib/SyntheticClipboardEvent.js +0 -38
- package/lib/SyntheticCompositionEvent.js +0 -36
- package/lib/SyntheticDragEvent.js +0 -36
- package/lib/SyntheticEvent.js +0 -268
- package/lib/SyntheticFocusEvent.js +0 -36
- package/lib/SyntheticInputEvent.js +0 -37
- package/lib/SyntheticKeyboardEvent.js +0 -84
- package/lib/SyntheticMouseEvent.js +0 -72
- package/lib/SyntheticTouchEvent.js +0 -45
- package/lib/SyntheticTransitionEvent.js +0 -39
- package/lib/SyntheticUIEvent.js +0 -59
- package/lib/SyntheticWheelEvent.js +0 -54
- package/lib/TapEventPlugin.js +0 -110
- package/lib/TouchHistoryMath.js +0 -99
- package/lib/Transaction.js +0 -233
- package/lib/ViewportMetrics.js +0 -27
- package/lib/accumulate.js +0 -46
- package/lib/accumulateInto.js +0 -58
- package/lib/adler32.js +0 -44
- package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
- package/lib/createReactNativeComponentClass.js +0 -42
- package/lib/dangerousStyleValue.js +0 -79
- package/lib/escapeTextContentForBrowser.js +0 -123
- package/lib/findDOMNode.js +0 -60
- package/lib/findNodeHandle.js +0 -91
- package/lib/forEachAccumulated.js +0 -31
- package/lib/getEventCharCode.js +0 -50
- package/lib/getEventKey.js +0 -102
- package/lib/getEventModifierState.js +0 -43
- package/lib/getEventTarget.js +0 -35
- package/lib/getHostComponentFromComposite.js +0 -30
- package/lib/getNodeForCharacterOffset.js +0 -74
- package/lib/getTestDocument.js +0 -21
- package/lib/getTextContentAccessor.js +0 -33
- package/lib/getVendorPrefixedEventName.js +0 -101
- package/lib/instantiateReactComponent.js +0 -119
- package/lib/isEventSupported.js +0 -60
- package/lib/isTextInputElement.js +0 -51
- package/lib/quoteAttributeValueForBrowser.js +0 -26
- package/lib/reactComponentExpect.js +0 -217
- package/lib/setInnerHTML.js +0 -98
- package/lib/setTextContent.js +0 -48
- package/lib/shouldUpdateReactComponent.js +0 -42
- package/lib/validateDOMNesting.js +0 -382
package/lib/ReactUMDEntry.js
CHANGED
|
@@ -6,21 +6,26 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactUMDEntry
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
'use strict';
|
|
13
12
|
|
|
14
13
|
var _assign = require('object-assign');
|
|
15
14
|
|
|
16
|
-
var ReactDOM = require('./ReactDOM');
|
|
17
|
-
var ReactDOMServer = require('./ReactDOMServer');
|
|
18
15
|
var React = require('./React');
|
|
19
16
|
|
|
20
|
-
// `version` will be added here by
|
|
17
|
+
// `version` will be added here by the React module.
|
|
21
18
|
var ReactUMDEntry = _assign({
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
20
|
+
ReactCurrentOwner: require('./ReactCurrentOwner')
|
|
21
|
+
}
|
|
24
22
|
}, React);
|
|
25
23
|
|
|
24
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
25
|
+
_assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
26
|
+
// ReactComponentTreeHook should not be included in production.
|
|
27
|
+
ReactComponentTreeHook: require('./ReactComponentTreeHook')
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
module.exports = ReactUMDEntry;
|
|
@@ -6,13 +6,10 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactDOMFeatureFlags
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
/* globals React */
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
useCreateElement: true
|
|
16
|
-
};
|
|
13
|
+
'use strict';
|
|
17
14
|
|
|
18
|
-
module.exports =
|
|
15
|
+
module.exports = React;
|
package/lib/ReactVersion.js
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactVersion
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
'use strict';
|
|
13
12
|
|
|
14
|
-
module.exports = '15.
|
|
13
|
+
module.exports = '15.4.0-rc.4';
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactWithAddons
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
'use strict';
|
|
13
12
|
|
|
14
13
|
var LinkedStateMixin = require('./LinkedStateMixin');
|
|
15
14
|
var React = require('./React');
|
|
15
|
+
var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies');
|
|
16
16
|
var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin');
|
|
17
17
|
var ReactCSSTransitionGroup = require('./ReactCSSTransitionGroup');
|
|
18
18
|
var ReactFragment = require('./ReactFragment');
|
|
@@ -33,8 +33,20 @@ React.addons = {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
if (process.env.NODE_ENV !== 'production') {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// For the UMD build we get these lazily from the global since they're tied
|
|
37
|
+
// to the DOM renderer and it hasn't loaded yet.
|
|
38
|
+
Object.defineProperty(React.addons, 'Perf', {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return ReactAddonsDOMDependencies.getReactPerf();
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(React.addons, 'TestUtils', {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return ReactAddonsDOMDependencies.getReactTestUtils();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
module.exports = React;
|
|
@@ -6,21 +6,26 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule ReactWithAddonsUMDEntry
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
'use strict';
|
|
13
12
|
|
|
14
13
|
var _assign = require('object-assign');
|
|
15
14
|
|
|
16
|
-
var ReactDOM = require('./ReactDOM');
|
|
17
|
-
var ReactDOMServer = require('./ReactDOMServer');
|
|
18
15
|
var ReactWithAddons = require('./ReactWithAddons');
|
|
19
16
|
|
|
20
|
-
// `version` will be added here by
|
|
17
|
+
// `version` will be added here by the React module.
|
|
21
18
|
var ReactWithAddonsUMDEntry = _assign({
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
20
|
+
ReactCurrentOwner: require('./ReactCurrentOwner')
|
|
21
|
+
}
|
|
24
22
|
}, ReactWithAddons);
|
|
25
23
|
|
|
24
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
25
|
+
_assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
26
|
+
// ReactComponentTreeHook should not be included in production.
|
|
27
|
+
ReactComponentTreeHook: require('./ReactComponentTreeHook')
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
module.exports = ReactWithAddonsUMDEntry;
|
package/lib/canDefineProperty.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
var canDefineProperty = false;
|
|
15
15
|
if (process.env.NODE_ENV !== 'production') {
|
|
16
16
|
try {
|
|
17
|
+
// $FlowFixMe https://github.com/facebook/flow/issues/285
|
|
17
18
|
Object.defineProperty({}, 'x', { get: function () {} });
|
|
18
19
|
canDefineProperty = true;
|
|
19
20
|
} catch (x) {
|
package/lib/deprecated.js
CHANGED
package/lib/flattenChildren.js
CHANGED
package/lib/getIteratorFn.js
CHANGED
package/lib/onlyChild.js
CHANGED
package/lib/shallowCompare.js
CHANGED
package/lib/sliceChildren.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule traverseAllChildren
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
'use strict';
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
var _prodInvariant = require('./reactProdInvariant');
|
|
15
14
|
|
|
16
15
|
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
17
|
-
var
|
|
16
|
+
var REACT_ELEMENT_TYPE = require('./ReactElementSymbol');
|
|
18
17
|
|
|
19
18
|
var getIteratorFn = require('./getIteratorFn');
|
|
20
19
|
var invariant = require('fbjs/lib/invariant');
|
|
@@ -24,6 +23,12 @@ var warning = require('fbjs/lib/warning');
|
|
|
24
23
|
var SEPARATOR = '.';
|
|
25
24
|
var SUBSEPARATOR = ':';
|
|
26
25
|
|
|
26
|
+
/**
|
|
27
|
+
* This is inlined from ReactElement since this file is shared between
|
|
28
|
+
* isomorphic and renderers. We could extract this to a
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
|
|
27
32
|
/**
|
|
28
33
|
* TODO: Test that a single child and an array with one item have the same key
|
|
29
34
|
* pattern.
|
|
@@ -65,7 +70,10 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
65
70
|
children = null;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
if (children === null || type === 'string' || type === 'number' ||
|
|
73
|
+
if (children === null || type === 'string' || type === 'number' ||
|
|
74
|
+
// The following is inlined from ReactElement. This means we can optimize
|
|
75
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
76
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
|
|
69
77
|
callback(traverseContext, children,
|
|
70
78
|
// If it's the only child, treat the name as if it was wrapped in an array
|
|
71
79
|
// so that it's consistent if the number of children grows.
|
package/lib/update.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*
|
|
9
|
-
* @providesModule update
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
/* global hasOwnProperty:true */
|
|
@@ -16,7 +15,6 @@
|
|
|
16
15
|
var _prodInvariant = require('./reactProdInvariant'),
|
|
17
16
|
_assign = require('object-assign');
|
|
18
17
|
|
|
19
|
-
var keyOf = require('fbjs/lib/keyOf');
|
|
20
18
|
var invariant = require('fbjs/lib/invariant');
|
|
21
19
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
22
20
|
|
|
@@ -30,12 +28,12 @@ function shallowCopy(x) {
|
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
var COMMAND_PUSH =
|
|
34
|
-
var COMMAND_UNSHIFT =
|
|
35
|
-
var COMMAND_SPLICE =
|
|
36
|
-
var COMMAND_SET =
|
|
37
|
-
var COMMAND_MERGE =
|
|
38
|
-
var COMMAND_APPLY =
|
|
31
|
+
var COMMAND_PUSH = '$push';
|
|
32
|
+
var COMMAND_UNSHIFT = '$unshift';
|
|
33
|
+
var COMMAND_SPLICE = '$splice';
|
|
34
|
+
var COMMAND_SET = '$set';
|
|
35
|
+
var COMMAND_MERGE = '$merge';
|
|
36
|
+
var COMMAND_APPLY = '$apply';
|
|
39
37
|
|
|
40
38
|
var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
|
|
41
39
|
|
package/package.json
CHANGED
package/lib/AutoFocusUtils.js
DELETED
|
@@ -1,24 +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 AutoFocusUtils
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
15
|
-
|
|
16
|
-
var focusNode = require('fbjs/lib/focusNode');
|
|
17
|
-
|
|
18
|
-
var AutoFocusUtils = {
|
|
19
|
-
focusDOMComponent: function () {
|
|
20
|
-
focusNode(ReactDOMComponentTree.getNodeFromInstance(this));
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
module.exports = AutoFocusUtils;
|
|
@@ -1,390 +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 BeforeInputEventPlugin
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var EventConstants = require('./EventConstants');
|
|
15
|
-
var EventPropagators = require('./EventPropagators');
|
|
16
|
-
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
|
-
var FallbackCompositionState = require('./FallbackCompositionState');
|
|
18
|
-
var SyntheticCompositionEvent = require('./SyntheticCompositionEvent');
|
|
19
|
-
var SyntheticInputEvent = require('./SyntheticInputEvent');
|
|
20
|
-
|
|
21
|
-
var keyOf = require('fbjs/lib/keyOf');
|
|
22
|
-
|
|
23
|
-
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
|
|
24
|
-
var START_KEYCODE = 229;
|
|
25
|
-
|
|
26
|
-
var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
|
|
27
|
-
|
|
28
|
-
var documentMode = null;
|
|
29
|
-
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
|
|
30
|
-
documentMode = document.documentMode;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Webkit offers a very useful `textInput` event that can be used to
|
|
34
|
-
// directly represent `beforeInput`. The IE `textinput` event is not as
|
|
35
|
-
// useful, so we don't use it.
|
|
36
|
-
var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
|
|
37
|
-
|
|
38
|
-
// In IE9+, we have access to composition events, but the data supplied
|
|
39
|
-
// by the native compositionend event may be incorrect. Japanese ideographic
|
|
40
|
-
// spaces, for instance (\u3000) are not recorded correctly.
|
|
41
|
-
var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Opera <= 12 includes TextEvent in window, but does not fire
|
|
45
|
-
* text input events. Rely on keypress instead.
|
|
46
|
-
*/
|
|
47
|
-
function isPresto() {
|
|
48
|
-
var opera = window.opera;
|
|
49
|
-
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var SPACEBAR_CODE = 32;
|
|
53
|
-
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
|
|
54
|
-
|
|
55
|
-
var topLevelTypes = EventConstants.topLevelTypes;
|
|
56
|
-
|
|
57
|
-
// Events and their corresponding property names.
|
|
58
|
-
var eventTypes = {
|
|
59
|
-
beforeInput: {
|
|
60
|
-
phasedRegistrationNames: {
|
|
61
|
-
bubbled: keyOf({ onBeforeInput: null }),
|
|
62
|
-
captured: keyOf({ onBeforeInputCapture: null })
|
|
63
|
-
},
|
|
64
|
-
dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
|
|
65
|
-
},
|
|
66
|
-
compositionEnd: {
|
|
67
|
-
phasedRegistrationNames: {
|
|
68
|
-
bubbled: keyOf({ onCompositionEnd: null }),
|
|
69
|
-
captured: keyOf({ onCompositionEndCapture: null })
|
|
70
|
-
},
|
|
71
|
-
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
|
72
|
-
},
|
|
73
|
-
compositionStart: {
|
|
74
|
-
phasedRegistrationNames: {
|
|
75
|
-
bubbled: keyOf({ onCompositionStart: null }),
|
|
76
|
-
captured: keyOf({ onCompositionStartCapture: null })
|
|
77
|
-
},
|
|
78
|
-
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
|
79
|
-
},
|
|
80
|
-
compositionUpdate: {
|
|
81
|
-
phasedRegistrationNames: {
|
|
82
|
-
bubbled: keyOf({ onCompositionUpdate: null }),
|
|
83
|
-
captured: keyOf({ onCompositionUpdateCapture: null })
|
|
84
|
-
},
|
|
85
|
-
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// Track whether we've ever handled a keypress on the space key.
|
|
90
|
-
var hasSpaceKeypress = false;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Return whether a native keypress event is assumed to be a command.
|
|
94
|
-
* This is required because Firefox fires `keypress` events for key commands
|
|
95
|
-
* (cut, copy, select-all, etc.) even though no character is inserted.
|
|
96
|
-
*/
|
|
97
|
-
function isKeypressCommand(nativeEvent) {
|
|
98
|
-
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
|
|
99
|
-
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
|
|
100
|
-
!(nativeEvent.ctrlKey && nativeEvent.altKey);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Translate native top level events into event types.
|
|
105
|
-
*
|
|
106
|
-
* @param {string} topLevelType
|
|
107
|
-
* @return {object}
|
|
108
|
-
*/
|
|
109
|
-
function getCompositionEventType(topLevelType) {
|
|
110
|
-
switch (topLevelType) {
|
|
111
|
-
case topLevelTypes.topCompositionStart:
|
|
112
|
-
return eventTypes.compositionStart;
|
|
113
|
-
case topLevelTypes.topCompositionEnd:
|
|
114
|
-
return eventTypes.compositionEnd;
|
|
115
|
-
case topLevelTypes.topCompositionUpdate:
|
|
116
|
-
return eventTypes.compositionUpdate;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Does our fallback best-guess model think this event signifies that
|
|
122
|
-
* composition has begun?
|
|
123
|
-
*
|
|
124
|
-
* @param {string} topLevelType
|
|
125
|
-
* @param {object} nativeEvent
|
|
126
|
-
* @return {boolean}
|
|
127
|
-
*/
|
|
128
|
-
function isFallbackCompositionStart(topLevelType, nativeEvent) {
|
|
129
|
-
return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* Does our fallback mode think that this event is the end of composition?
|
|
134
|
-
*
|
|
135
|
-
* @param {string} topLevelType
|
|
136
|
-
* @param {object} nativeEvent
|
|
137
|
-
* @return {boolean}
|
|
138
|
-
*/
|
|
139
|
-
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
|
|
140
|
-
switch (topLevelType) {
|
|
141
|
-
case topLevelTypes.topKeyUp:
|
|
142
|
-
// Command keys insert or clear IME input.
|
|
143
|
-
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
|
|
144
|
-
case topLevelTypes.topKeyDown:
|
|
145
|
-
// Expect IME keyCode on each keydown. If we get any other
|
|
146
|
-
// code we must have exited earlier.
|
|
147
|
-
return nativeEvent.keyCode !== START_KEYCODE;
|
|
148
|
-
case topLevelTypes.topKeyPress:
|
|
149
|
-
case topLevelTypes.topMouseDown:
|
|
150
|
-
case topLevelTypes.topBlur:
|
|
151
|
-
// Events are not possible without cancelling IME.
|
|
152
|
-
return true;
|
|
153
|
-
default:
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Google Input Tools provides composition data via a CustomEvent,
|
|
160
|
-
* with the `data` property populated in the `detail` object. If this
|
|
161
|
-
* is available on the event object, use it. If not, this is a plain
|
|
162
|
-
* composition event and we have nothing special to extract.
|
|
163
|
-
*
|
|
164
|
-
* @param {object} nativeEvent
|
|
165
|
-
* @return {?string}
|
|
166
|
-
*/
|
|
167
|
-
function getDataFromCustomEvent(nativeEvent) {
|
|
168
|
-
var detail = nativeEvent.detail;
|
|
169
|
-
if (typeof detail === 'object' && 'data' in detail) {
|
|
170
|
-
return detail.data;
|
|
171
|
-
}
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Track the current IME composition fallback object, if any.
|
|
176
|
-
var currentComposition = null;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* @return {?object} A SyntheticCompositionEvent.
|
|
180
|
-
*/
|
|
181
|
-
function extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
182
|
-
var eventType;
|
|
183
|
-
var fallbackData;
|
|
184
|
-
|
|
185
|
-
if (canUseCompositionEvent) {
|
|
186
|
-
eventType = getCompositionEventType(topLevelType);
|
|
187
|
-
} else if (!currentComposition) {
|
|
188
|
-
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
|
|
189
|
-
eventType = eventTypes.compositionStart;
|
|
190
|
-
}
|
|
191
|
-
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
|
192
|
-
eventType = eventTypes.compositionEnd;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (!eventType) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (useFallbackCompositionData) {
|
|
200
|
-
// The current composition is stored statically and must not be
|
|
201
|
-
// overwritten while composition continues.
|
|
202
|
-
if (!currentComposition && eventType === eventTypes.compositionStart) {
|
|
203
|
-
currentComposition = FallbackCompositionState.getPooled(nativeEventTarget);
|
|
204
|
-
} else if (eventType === eventTypes.compositionEnd) {
|
|
205
|
-
if (currentComposition) {
|
|
206
|
-
fallbackData = currentComposition.getData();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
var event = SyntheticCompositionEvent.getPooled(eventType, targetInst, nativeEvent, nativeEventTarget);
|
|
212
|
-
|
|
213
|
-
if (fallbackData) {
|
|
214
|
-
// Inject data generated from fallback path into the synthetic event.
|
|
215
|
-
// This matches the property of native CompositionEventInterface.
|
|
216
|
-
event.data = fallbackData;
|
|
217
|
-
} else {
|
|
218
|
-
var customData = getDataFromCustomEvent(nativeEvent);
|
|
219
|
-
if (customData !== null) {
|
|
220
|
-
event.data = customData;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
225
|
-
return event;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* @param {string} topLevelType Record from `EventConstants`.
|
|
230
|
-
* @param {object} nativeEvent Native browser event.
|
|
231
|
-
* @return {?string} The string corresponding to this `beforeInput` event.
|
|
232
|
-
*/
|
|
233
|
-
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
|
|
234
|
-
switch (topLevelType) {
|
|
235
|
-
case topLevelTypes.topCompositionEnd:
|
|
236
|
-
return getDataFromCustomEvent(nativeEvent);
|
|
237
|
-
case topLevelTypes.topKeyPress:
|
|
238
|
-
/**
|
|
239
|
-
* If native `textInput` events are available, our goal is to make
|
|
240
|
-
* use of them. However, there is a special case: the spacebar key.
|
|
241
|
-
* In Webkit, preventing default on a spacebar `textInput` event
|
|
242
|
-
* cancels character insertion, but it *also* causes the browser
|
|
243
|
-
* to fall back to its default spacebar behavior of scrolling the
|
|
244
|
-
* page.
|
|
245
|
-
*
|
|
246
|
-
* Tracking at:
|
|
247
|
-
* https://code.google.com/p/chromium/issues/detail?id=355103
|
|
248
|
-
*
|
|
249
|
-
* To avoid this issue, use the keypress event as if no `textInput`
|
|
250
|
-
* event is available.
|
|
251
|
-
*/
|
|
252
|
-
var which = nativeEvent.which;
|
|
253
|
-
if (which !== SPACEBAR_CODE) {
|
|
254
|
-
return null;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
hasSpaceKeypress = true;
|
|
258
|
-
return SPACEBAR_CHAR;
|
|
259
|
-
|
|
260
|
-
case topLevelTypes.topTextInput:
|
|
261
|
-
// Record the characters to be added to the DOM.
|
|
262
|
-
var chars = nativeEvent.data;
|
|
263
|
-
|
|
264
|
-
// If it's a spacebar character, assume that we have already handled
|
|
265
|
-
// it at the keypress level and bail immediately. Android Chrome
|
|
266
|
-
// doesn't give us keycodes, so we need to blacklist it.
|
|
267
|
-
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
|
|
268
|
-
return null;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
return chars;
|
|
272
|
-
|
|
273
|
-
default:
|
|
274
|
-
// For other native event types, do nothing.
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* For browsers that do not provide the `textInput` event, extract the
|
|
281
|
-
* appropriate string to use for SyntheticInputEvent.
|
|
282
|
-
*
|
|
283
|
-
* @param {string} topLevelType Record from `EventConstants`.
|
|
284
|
-
* @param {object} nativeEvent Native browser event.
|
|
285
|
-
* @return {?string} The fallback string for this `beforeInput` event.
|
|
286
|
-
*/
|
|
287
|
-
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
|
|
288
|
-
// If we are currently composing (IME) and using a fallback to do so,
|
|
289
|
-
// try to extract the composed characters from the fallback object.
|
|
290
|
-
// If composition event is available, we extract a string only at
|
|
291
|
-
// compositionevent, otherwise extract it at fallback events.
|
|
292
|
-
if (currentComposition) {
|
|
293
|
-
if (topLevelType === topLevelTypes.topCompositionEnd || !canUseCompositionEvent && isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
|
294
|
-
var chars = currentComposition.getData();
|
|
295
|
-
FallbackCompositionState.release(currentComposition);
|
|
296
|
-
currentComposition = null;
|
|
297
|
-
return chars;
|
|
298
|
-
}
|
|
299
|
-
return null;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
switch (topLevelType) {
|
|
303
|
-
case topLevelTypes.topPaste:
|
|
304
|
-
// If a paste event occurs after a keypress, throw out the input
|
|
305
|
-
// chars. Paste events should not lead to BeforeInput events.
|
|
306
|
-
return null;
|
|
307
|
-
case topLevelTypes.topKeyPress:
|
|
308
|
-
/**
|
|
309
|
-
* As of v27, Firefox may fire keypress events even when no character
|
|
310
|
-
* will be inserted. A few possibilities:
|
|
311
|
-
*
|
|
312
|
-
* - `which` is `0`. Arrow keys, Esc key, etc.
|
|
313
|
-
*
|
|
314
|
-
* - `which` is the pressed key code, but no char is available.
|
|
315
|
-
* Ex: 'AltGr + d` in Polish. There is no modified character for
|
|
316
|
-
* this key combination and no character is inserted into the
|
|
317
|
-
* document, but FF fires the keypress for char code `100` anyway.
|
|
318
|
-
* No `input` event will occur.
|
|
319
|
-
*
|
|
320
|
-
* - `which` is the pressed key code, but a command combination is
|
|
321
|
-
* being used. Ex: `Cmd+C`. No character is inserted, and no
|
|
322
|
-
* `input` event will occur.
|
|
323
|
-
*/
|
|
324
|
-
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
|
|
325
|
-
return String.fromCharCode(nativeEvent.which);
|
|
326
|
-
}
|
|
327
|
-
return null;
|
|
328
|
-
case topLevelTypes.topCompositionEnd:
|
|
329
|
-
return useFallbackCompositionData ? null : nativeEvent.data;
|
|
330
|
-
default:
|
|
331
|
-
return null;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/**
|
|
336
|
-
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
|
|
337
|
-
* `textInput` or fallback behavior.
|
|
338
|
-
*
|
|
339
|
-
* @return {?object} A SyntheticInputEvent.
|
|
340
|
-
*/
|
|
341
|
-
function extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
342
|
-
var chars;
|
|
343
|
-
|
|
344
|
-
if (canUseTextInputEvent) {
|
|
345
|
-
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
|
|
346
|
-
} else {
|
|
347
|
-
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
// If no characters are being inserted, no BeforeInput event should
|
|
351
|
-
// be fired.
|
|
352
|
-
if (!chars) {
|
|
353
|
-
return null;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, targetInst, nativeEvent, nativeEventTarget);
|
|
357
|
-
|
|
358
|
-
event.data = chars;
|
|
359
|
-
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
360
|
-
return event;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Create an `onBeforeInput` event to match
|
|
365
|
-
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
|
|
366
|
-
*
|
|
367
|
-
* This event plugin is based on the native `textInput` event
|
|
368
|
-
* available in Chrome, Safari, Opera, and IE. This event fires after
|
|
369
|
-
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
|
|
370
|
-
*
|
|
371
|
-
* `beforeInput` is spec'd but not implemented in any browsers, and
|
|
372
|
-
* the `input` event does not provide any useful information about what has
|
|
373
|
-
* actually been added, contrary to the spec. Thus, `textInput` is the best
|
|
374
|
-
* available event to identify the characters that have actually been inserted
|
|
375
|
-
* into the target node.
|
|
376
|
-
*
|
|
377
|
-
* This plugin is also responsible for emitting `composition` events, thus
|
|
378
|
-
* allowing us to share composition fallback code for both `beforeInput` and
|
|
379
|
-
* `composition` event types.
|
|
380
|
-
*/
|
|
381
|
-
var BeforeInputEventPlugin = {
|
|
382
|
-
|
|
383
|
-
eventTypes: eventTypes,
|
|
384
|
-
|
|
385
|
-
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
386
|
-
return [extractCompositionEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, targetInst, nativeEvent, nativeEventTarget)];
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
module.exports = BeforeInputEventPlugin;
|