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/adler32.js
DELETED
|
@@ -1,44 +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 adler32
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var MOD = 65521;
|
|
16
|
-
|
|
17
|
-
// adler32 is not cryptographically strong, and is only used to sanity check that
|
|
18
|
-
// markup generated on the server matches the markup generated on the client.
|
|
19
|
-
// This implementation (a modified version of the SheetJS version) has been optimized
|
|
20
|
-
// for our use case, at the expense of conforming to the adler32 specification
|
|
21
|
-
// for non-ascii inputs.
|
|
22
|
-
function adler32(data) {
|
|
23
|
-
var a = 1;
|
|
24
|
-
var b = 0;
|
|
25
|
-
var i = 0;
|
|
26
|
-
var l = data.length;
|
|
27
|
-
var m = l & ~0x3;
|
|
28
|
-
while (i < m) {
|
|
29
|
-
var n = Math.min(i + 4096, m);
|
|
30
|
-
for (; i < n; i += 4) {
|
|
31
|
-
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
|
|
32
|
-
}
|
|
33
|
-
a %= MOD;
|
|
34
|
-
b %= MOD;
|
|
35
|
-
}
|
|
36
|
-
for (; i < l; i++) {
|
|
37
|
-
b += a += data.charCodeAt(i);
|
|
38
|
-
}
|
|
39
|
-
a %= MOD;
|
|
40
|
-
b %= MOD;
|
|
41
|
-
return a | b << 16;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
module.exports = adler32;
|
|
@@ -1,32 +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 createMicrosoftUnsafeLocalFunction
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/* globals MSApp */
|
|
13
|
-
|
|
14
|
-
'use strict';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Create a function which has 'unsafe' privileges (required by windows8 apps)
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
var createMicrosoftUnsafeLocalFunction = function (func) {
|
|
21
|
-
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
|
|
22
|
-
return function (arg0, arg1, arg2, arg3) {
|
|
23
|
-
MSApp.execUnsafeLocalFunction(function () {
|
|
24
|
-
return func(arg0, arg1, arg2, arg3);
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
} else {
|
|
28
|
-
return func;
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = createMicrosoftUnsafeLocalFunction;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-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 createReactNativeComponentClass
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var ReactNativeBaseComponent = require('./ReactNativeBaseComponent');
|
|
16
|
-
|
|
17
|
-
// See also ReactNativeBaseComponent
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @param {string} config iOS View configuration.
|
|
22
|
-
* @private
|
|
23
|
-
*/
|
|
24
|
-
var createReactNativeComponentClass = function (viewConfig) {
|
|
25
|
-
var Constructor = function (element) {
|
|
26
|
-
this._currentElement = element;
|
|
27
|
-
this._topLevelWrapper = null;
|
|
28
|
-
this._hostParent = null;
|
|
29
|
-
this._hostContainerInfo = null;
|
|
30
|
-
this._rootNodeID = 0;
|
|
31
|
-
this._renderedChildren = null;
|
|
32
|
-
};
|
|
33
|
-
Constructor.displayName = viewConfig.uiViewClassName;
|
|
34
|
-
Constructor.viewConfig = viewConfig;
|
|
35
|
-
Constructor.propTypes = viewConfig.propTypes;
|
|
36
|
-
Constructor.prototype = new ReactNativeBaseComponent(viewConfig);
|
|
37
|
-
Constructor.prototype.constructor = Constructor;
|
|
38
|
-
|
|
39
|
-
return Constructor;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
module.exports = createReactNativeComponentClass;
|
|
@@ -1,79 +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 dangerousStyleValue
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var CSSProperty = require('./CSSProperty');
|
|
15
|
-
var warning = require('fbjs/lib/warning');
|
|
16
|
-
|
|
17
|
-
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
|
|
18
|
-
var styleWarnings = {};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Convert a value into the proper css writable value. The style name `name`
|
|
22
|
-
* should be logical (no hyphens), as specified
|
|
23
|
-
* in `CSSProperty.isUnitlessNumber`.
|
|
24
|
-
*
|
|
25
|
-
* @param {string} name CSS property name such as `topMargin`.
|
|
26
|
-
* @param {*} value CSS property value such as `10px`.
|
|
27
|
-
* @param {ReactDOMComponent} component
|
|
28
|
-
* @return {string} Normalized style value with dimensions applied.
|
|
29
|
-
*/
|
|
30
|
-
function dangerousStyleValue(name, value, component) {
|
|
31
|
-
// Note that we've removed escapeTextForBrowser() calls here since the
|
|
32
|
-
// whole string will be escaped when the attribute is injected into
|
|
33
|
-
// the markup. If you provide unsafe user data here they can inject
|
|
34
|
-
// arbitrary CSS which may be problematic (I couldn't repro this):
|
|
35
|
-
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
|
|
36
|
-
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
|
|
37
|
-
// This is not an XSS hole but instead a potential CSS injection issue
|
|
38
|
-
// which has lead to a greater discussion about how we're going to
|
|
39
|
-
// trust URLs moving forward. See #2115901
|
|
40
|
-
|
|
41
|
-
var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
|
42
|
-
if (isEmpty) {
|
|
43
|
-
return '';
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
var isNonNumeric = isNaN(value);
|
|
47
|
-
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
|
|
48
|
-
return '' + value; // cast to string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (typeof value === 'string') {
|
|
52
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
53
|
-
// Allow '0' to pass through without warning. 0 is already special and
|
|
54
|
-
// doesn't require units, so we don't need to warn about it.
|
|
55
|
-
if (component && value !== '0') {
|
|
56
|
-
var owner = component._currentElement._owner;
|
|
57
|
-
var ownerName = owner ? owner.getName() : null;
|
|
58
|
-
if (ownerName && !styleWarnings[ownerName]) {
|
|
59
|
-
styleWarnings[ownerName] = {};
|
|
60
|
-
}
|
|
61
|
-
var warned = false;
|
|
62
|
-
if (ownerName) {
|
|
63
|
-
var warnings = styleWarnings[ownerName];
|
|
64
|
-
warned = warnings[name];
|
|
65
|
-
if (!warned) {
|
|
66
|
-
warnings[name] = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (!warned) {
|
|
70
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'a `%s` tag (owner: `%s`) was passed a numeric string value ' + 'for CSS property `%s` (value: `%s`) which will be treated ' + 'as a unitless number in a future version of React.', component._currentElement.type, ownerName || 'unknown', name, value) : void 0;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
value = value.trim();
|
|
75
|
-
}
|
|
76
|
-
return value + 'px';
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
module.exports = dangerousStyleValue;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016-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
|
-
* Based on the escape-html library, which is used under the MIT License below:
|
|
10
|
-
*
|
|
11
|
-
* Copyright (c) 2012-2013 TJ Holowaychuk
|
|
12
|
-
* Copyright (c) 2015 Andreas Lubbe
|
|
13
|
-
* Copyright (c) 2015 Tiancheng "Timothy" Gu
|
|
14
|
-
*
|
|
15
|
-
* Permission is hereby granted, free of charge, to any person obtaining
|
|
16
|
-
* a copy of this software and associated documentation files (the
|
|
17
|
-
* 'Software'), to deal in the Software without restriction, including
|
|
18
|
-
* without limitation the rights to use, copy, modify, merge, publish,
|
|
19
|
-
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
20
|
-
* permit persons to whom the Software is furnished to do so, subject to
|
|
21
|
-
* the following conditions:
|
|
22
|
-
*
|
|
23
|
-
* The above copyright notice and this permission notice shall be
|
|
24
|
-
* included in all copies or substantial portions of the Software.
|
|
25
|
-
*
|
|
26
|
-
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
27
|
-
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
28
|
-
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
29
|
-
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
30
|
-
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
31
|
-
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
32
|
-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
33
|
-
*
|
|
34
|
-
* @providesModule escapeTextContentForBrowser
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
'use strict';
|
|
38
|
-
|
|
39
|
-
// code copied and modified from escape-html
|
|
40
|
-
/**
|
|
41
|
-
* Module variables.
|
|
42
|
-
* @private
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
var matchHtmlRegExp = /["'&<>]/;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Escape special characters in the given string of html.
|
|
49
|
-
*
|
|
50
|
-
* @param {string} string The string to escape for inserting into HTML
|
|
51
|
-
* @return {string}
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
function escapeHtml(string) {
|
|
56
|
-
var str = '' + string;
|
|
57
|
-
var match = matchHtmlRegExp.exec(str);
|
|
58
|
-
|
|
59
|
-
if (!match) {
|
|
60
|
-
return str;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
var escape;
|
|
64
|
-
var html = '';
|
|
65
|
-
var index = 0;
|
|
66
|
-
var lastIndex = 0;
|
|
67
|
-
|
|
68
|
-
for (index = match.index; index < str.length; index++) {
|
|
69
|
-
switch (str.charCodeAt(index)) {
|
|
70
|
-
case 34:
|
|
71
|
-
// "
|
|
72
|
-
escape = '"';
|
|
73
|
-
break;
|
|
74
|
-
case 38:
|
|
75
|
-
// &
|
|
76
|
-
escape = '&';
|
|
77
|
-
break;
|
|
78
|
-
case 39:
|
|
79
|
-
// '
|
|
80
|
-
escape = '''; // modified from escape-html; used to be '''
|
|
81
|
-
break;
|
|
82
|
-
case 60:
|
|
83
|
-
// <
|
|
84
|
-
escape = '<';
|
|
85
|
-
break;
|
|
86
|
-
case 62:
|
|
87
|
-
// >
|
|
88
|
-
escape = '>';
|
|
89
|
-
break;
|
|
90
|
-
default:
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (lastIndex !== index) {
|
|
95
|
-
html += str.substring(lastIndex, index);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
lastIndex = index + 1;
|
|
99
|
-
html += escape;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
|
|
103
|
-
}
|
|
104
|
-
// end code copied and modified from escape-html
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Escapes text to prevent scripting attacks.
|
|
109
|
-
*
|
|
110
|
-
* @param {*} text Text value to escape.
|
|
111
|
-
* @return {string} An escaped string.
|
|
112
|
-
*/
|
|
113
|
-
function escapeTextContentForBrowser(text) {
|
|
114
|
-
if (typeof text === 'boolean' || typeof text === 'number') {
|
|
115
|
-
// this shortcircuit helps perf for types that we know will never have
|
|
116
|
-
// special characters, especially given that this function is used often
|
|
117
|
-
// for numeric dom ids.
|
|
118
|
-
return '' + text;
|
|
119
|
-
}
|
|
120
|
-
return escapeHtml(text);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
module.exports = escapeTextContentForBrowser;
|
package/lib/findDOMNode.js
DELETED
|
@@ -1,60 +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 findDOMNode
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
-
|
|
16
|
-
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
17
|
-
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
18
|
-
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
19
|
-
|
|
20
|
-
var getHostComponentFromComposite = require('./getHostComponentFromComposite');
|
|
21
|
-
var invariant = require('fbjs/lib/invariant');
|
|
22
|
-
var warning = require('fbjs/lib/warning');
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Returns the DOM node rendered by this element.
|
|
26
|
-
*
|
|
27
|
-
* See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
|
|
28
|
-
*
|
|
29
|
-
* @param {ReactComponent|DOMElement} componentOrElement
|
|
30
|
-
* @return {?DOMElement} The root node of this element.
|
|
31
|
-
*/
|
|
32
|
-
function findDOMNode(componentOrElement) {
|
|
33
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
34
|
-
var owner = ReactCurrentOwner.current;
|
|
35
|
-
if (owner !== null) {
|
|
36
|
-
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
|
|
37
|
-
owner._warnedAboutRefsInRender = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (componentOrElement == null) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
if (componentOrElement.nodeType === 1) {
|
|
44
|
-
return componentOrElement;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
var inst = ReactInstanceMap.get(componentOrElement);
|
|
48
|
-
if (inst) {
|
|
49
|
-
inst = getHostComponentFromComposite(inst);
|
|
50
|
-
return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (typeof componentOrElement.render === 'function') {
|
|
54
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
|
|
55
|
-
} else {
|
|
56
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = findDOMNode;
|
package/lib/findNodeHandle.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2015-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 findNodeHandle
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
16
|
-
|
|
17
|
-
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
18
|
-
var ReactInstanceMap = require('./ReactInstanceMap');
|
|
19
|
-
|
|
20
|
-
var invariant = require('fbjs/lib/invariant');
|
|
21
|
-
var warning = require('fbjs/lib/warning');
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* ReactNative vs ReactWeb
|
|
25
|
-
* -----------------------
|
|
26
|
-
* React treats some pieces of data opaquely. This means that the information
|
|
27
|
-
* is first class (it can be passed around), but cannot be inspected. This
|
|
28
|
-
* allows us to build infrastructure that reasons about resources, without
|
|
29
|
-
* making assumptions about the nature of those resources, and this allows that
|
|
30
|
-
* infra to be shared across multiple platforms, where the resources are very
|
|
31
|
-
* different. General infra (such as `ReactMultiChild`) reasons opaquely about
|
|
32
|
-
* the data, but platform specific code (such as `ReactNativeBaseComponent`) can
|
|
33
|
-
* make assumptions about the data.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* `rootNodeID`, uniquely identifies a position in the generated native view
|
|
37
|
-
* tree. Many layers of composite components (created with `React.createClass`)
|
|
38
|
-
* can all share the same `rootNodeID`.
|
|
39
|
-
*
|
|
40
|
-
* `nodeHandle`: A sufficiently unambiguous way to refer to a lower level
|
|
41
|
-
* resource (dom node, native view etc). The `rootNodeID` is sufficient for web
|
|
42
|
-
* `nodeHandle`s, because the position in a tree is always enough to uniquely
|
|
43
|
-
* identify a DOM node (we never have nodes in some bank outside of the
|
|
44
|
-
* document). The same would be true for `ReactNative`, but we must maintain a
|
|
45
|
-
* mapping that we can send efficiently serializable
|
|
46
|
-
* strings across native boundaries.
|
|
47
|
-
*
|
|
48
|
-
* Opaque name TodaysWebReact FutureWebWorkerReact ReactNative
|
|
49
|
-
* ----------------------------------------------------------------------------
|
|
50
|
-
* nodeHandle N/A rootNodeID tag
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
function findNodeHandle(componentOrHandle) {
|
|
54
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
55
|
-
var owner = ReactCurrentOwner.current;
|
|
56
|
-
if (owner !== null) {
|
|
57
|
-
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findNodeHandle inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
|
|
58
|
-
owner._warnedAboutRefsInRender = true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (componentOrHandle == null) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
if (typeof componentOrHandle === 'number') {
|
|
65
|
-
// Already a node handle
|
|
66
|
-
return componentOrHandle;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
var component = componentOrHandle;
|
|
70
|
-
|
|
71
|
-
// TODO (balpert): Wrap iOS native components in a composite wrapper, then
|
|
72
|
-
// ReactInstanceMap.get here will always succeed for mounted components
|
|
73
|
-
var internalInstance = ReactInstanceMap.get(component);
|
|
74
|
-
if (internalInstance) {
|
|
75
|
-
return internalInstance.getHostNode();
|
|
76
|
-
} else {
|
|
77
|
-
var rootNodeID = component._rootNodeID;
|
|
78
|
-
if (rootNodeID) {
|
|
79
|
-
return rootNodeID;
|
|
80
|
-
} else {
|
|
81
|
-
!(
|
|
82
|
-
// Native
|
|
83
|
-
typeof component === 'object' && '_rootNodeID' in component ||
|
|
84
|
-
// Composite
|
|
85
|
-
component.render != null && typeof component.render === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findNodeHandle(...): Argument is not a component (type: %s, keys: %s)', typeof component, Object.keys(component)) : _prodInvariant('21', typeof component, Object.keys(component)) : void 0;
|
|
86
|
-
!false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findNodeHandle(...): Unable to find node handle for unmounted component.') : _prodInvariant('22') : void 0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
module.exports = findNodeHandle;
|